akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
typedef long long ll;
#define FOR(i,n) for(int i=0;i<n;i++)

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

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

int main(){
  ll a,b,ans=0;
  cin >> a >> b;
  ll c = gcd(a,b);
  //vector<char>s(c,0);
  for(auto p : prime_factor(c)){
    //cout << p.first << "\n";
    ans++;

  }

  cout << ans+1;
  return 0;
}


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

using namespace std;

vector<long long> lengths(51);
vector<long long> patties(51);

long long travel(int level, long long eat, long long ans) {
  if (eat == lengths[level]) return ans + patties[level];
  if (eat <= 1) return ans;
  if (eat < lengths[level - 1] + 1) return travel(level - 1, eat - 1, ans);
  if (eat == lengths[level - 1] + 1) return ans + patties[level - 1];
  if (eat == lengths[level - 1] + 2) return ans + patties[level - 1] + 1;
  if (eat > lengths[level - 1] + 2) return travel(level - 1, eat - lengths[level - 1] - 2, ans + patties[level - 1] + 1);
}

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

  lengths[0] = 1;
  patties[0] = 1;
  for (int i = 0; i < N; ++i) {
    lengths[i + 1] = 3 + 2 * lengths[i];
    patties[i + 1] = 1 + 2 * patties[i];
  }

  cout << travel(N, X, 0) << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
    private static FastScanner sc = new FastScanner();
    private static boolean DEBUG_FLG = false;

    public static void main(String[] args) {
    	int S = sc.nextInt();
    	int y = S / 100;
    	int m = S - y * 100;
    	if(m >= 1 && m <= 12) {
    		if(y >= 1 && y <= 12) {
    			System.out.println("AMBIGUOUS");
    		} else {
    			System.out.println("YYMM");
    		}
    	} else if(y >= 1 && y <= 12) {
    		System.out.println("MMYY");
    	} else {
    		System.out.println("NA");
    	}
    }

    static void debug(long... args) {
    	if(!DEBUG_FLG) return;
    	boolean flg = false;
    	for(long s : args) {
    		if(flg) System.out.print(" ");
    		flg = true;
    		System.out.print(s);
    	}
    	System.out.println();
    }

    static 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 static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); 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() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}


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

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; }

int main(){
    int h, w;
    cin >> h >> w;
    vs s(h);
    rep(i, h) cin >> s[i];
    int ans = 0;
    rep(i, h) rep(j, w) {
        queue<pii> q;
        vector<vi> dist(h, vi(w, INF));
        if (s[i][j] == '#') continue;
        q.emplace(i, j);
        dist[i][j] = 0;
        while (!q.empty()) {
            auto p = q.front(); q.pop();
            int y = p.first, x = p.second, d = dist[y][x];
            const vi dy = { -1, 0, 1, 0 }, dx = { 0, 1, 0, -1 };
            rep(i2, 4) {
                int ny = y + dy[i2], nx = x + dx[i2], nd = d + 1;
                if (ny<0 || ny>=h || nx<0 || nx>=w) continue;
                if (s[ny][nx] == '#') continue;
                if (dist[ny][nx] <= nd) continue;
                q.emplace(ny, nx);
                dist[ny][nx] = nd;
            }
        }
        rep(i2, h) rep(j2, w) {
            if (dist[i2][j2] == INF) continue;
            ans = max(ans, dist[i2][j2]);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<cmath>
using namespace std;
int main(){
	
	int s;
	int n;
	while(cin>>s,s!=0){
	for(int i=0;i<9;i++){
		cin>>n;
		s-=n;
	}
	
	cout<<s<<endl;
	}
}

Measured memory_bytes: 1160
from sys import stdin


def readline_from_stdin() -> str:
    return stdin.readline().rstrip


if __name__ == '__main__':
    _ = int(input())
    # R = 0
    # W = 1
    C = [0 if c == "R" else 1 for c in input()]
    # print(C)

    L = 0
    R = len(C)-1

    count = 0
    while True:
        # print(L,R,C)
        # 次の白まで飛ぶ
        while C[L] == 0:
            if L == len(C)-1:
                print(count)
                exit()
            L += 1
        # 次の赤まで飛ぶ
        while C[R] == 1:
            if R == 0:
                print(count)
                exit()
            R -= 1
        # 真ん中まで見たなら終わり
        if R-L < 1:
            print(count)
            exit()

        # 入れ替え
        C[L] = 0
        C[R] = 1
        L += 1
        R -= 1
        count += 1
        # print("!!!")
        # 入れ替え後、終わり？
        if L == len(C)-1:
            print(count)
            exit()
        if R == 0:
            print(count)
            exit()


Measured memory_bytes: 86640
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.lang.Math;

class Main{
    public static void main(String[] args){
        InputStreamReader inputStreamReader = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(inputStreamReader);
        
        String str;
        int[] num;
        
        try {
            while(reader.ready()){
                str = reader.readLine();
                num = getNum(str);

                System.out.println(gcd(num[0], num[1]) + " " + lcm(num[0], num[1]));
            }
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    // ----- 自作関数 ----- //

    private static int gcd(int a, int b){
        if (a < b) {
            int buff = a;
            a = b;
            b = buff;
        }

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

    private static int lcm(int a, int b) {
        return (int) (((long)a * b) / gcd(a, b));
    }

    private static int[] getNum(String str){
        String[] data = str.split(" "); 
        int[] num = new int[data.length];

        for (int i = 0; i < data.length; i++){
            num[i] = Integer.parseInt(data[i]);
        }
        return num;
    }
}


Measured memory_bytes: 24228
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;

#define MX 200002
vector<int> g[MX];

int vis[MX];
int dp[MX];
void dfs(int u,int &cnt)
{
	vis[u]=1;
	cnt+=1;
	for(int i=0;i<g[u].size();i++)
	{int v=g[u][i];
		if(!vis[v])
	         dfs(v,cnt);


	}

}
void solve()
{
    int n,m;
    cin>>n>>m;

    int ans=0;
    for(int i=0;i<m;i++)
    {
        int u,v;
        cin>>u>>v;
     g[u].pb(v);
     g[v].pb(u);
    }
    for(int i=1;i<=n;i++)
    {
        if(!vis[i])
        {int cnt=0;
            dfs(i,cnt);
            ans=max(ans,cnt);
        }
    }
    cout<<ans<<endl;

}







int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
    return 0;
}


Measured memory_bytes: 25468
#include<stdio.h>
int main(){
  int c[100001]={},n,i,j,x,y,z;
  scanf("%d%d",&n,&x);
  for(i=0;i<n;i++){scanf("%d%d%d",&x,&y,&z);for(j=x-1;j<y;j++)c[j]|=1<<z;}
  x=0;for(i=0;i<100001;i++){y=0;for(j=1;j<31;j++)if(c[i]&1<<j)y++;x=x>y?x:y;}
  printf("%d",x);
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
int main()
{
//	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	long long int a;
	cin>>a;
	if(a>=30)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}

Measured memory_bytes: 3632
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
using namespace std;
  
typedef long long ll;
const int N = 100010;
ll ret[N];
int fa[N], x[N], y[N], sz[N];

inline int find(int x)
{
    if (fa[x] == x) return x;
    return fa[x] = find(fa[x]);
}

inline void merge(int x, int y)
{
    int fx = find(x), fy = find(y);
    sz[fx] += sz[fy];
    fa[fy] = fx;
}

int main()
{
    int n, m;
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; ++i) {
        fa[i] = i;
        sz[i] = 1;
    }
    for (int i = 1; i <= m; ++i) {
        scanf("%d %d", &x[i], &y[i]);
    }
    ll ans = (ll)(n - 1) * n / 2;
    for (int i = m; i >= 1; --i) {
        ret[i] = ans;
        if (find(x[i]) != find(y[i])) {
            ans -= (ll)sz[find(x[i])] * sz[find(y[i])];
            merge(x[i], y[i]);
        }
    }
    for (int i = 1; i <= m; ++i) {
        printf("%lld\n", ret[i]);
    }
    return 0;
}

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

// #define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define LL long long

const int INF = 1e9;

int h, w, k;
int inp[15][1005];
int aux[15][1005];

void pre() {
	for(int i=1;i<=h;i++) {
		for(int j=1;j<=w;j++) {
			aux[i][j] = aux[i-1][j] + inp[i][j];
		}
	}
}

int main() {
	cin >> h >> w >> k;
	string s;
	for(int i=1;i<=h;i++) {
		cin >> s;
		for(int j=0;j<s.size();j++) {
			if(s[j] == '1') {
				inp[i][j+1] = 1;
			}
		}
	}
	pre();


	int ans = INF;
	for(int i=0;i<(1<<(h-1));i++) {
		int cnt = 0;

		vector<int> cuts;
		cuts.push_back(0);
		for(int j=0;j<(h-1);j++) {
			if(i & (1<<j)) {
				cuts.push_back(j+1);
				cnt++;
			}
		}
		cuts.push_back(h);

		trace(i, cnt);
	
		int sum[15];
		memset(sum, 0, sizeof(sum));

		for(int c1=1;c1<=w;c1++) {
			int pos = true;
			int flag = true;
			for(int id=1;id<cuts.size();id++) {
				trace(id, cuts[id], aux[cuts[id]][c1], aux[cuts[id-1]][c1]);
				if(aux[cuts[id]][c1] - aux[cuts[id-1]][c1] > k) {
					pos = false;
					break;
				}

				if(sum[id] + aux[cuts[id]][c1] - aux[cuts[id-1]][c1] > k) {
					flag = false;
					break;
				}
			}
			if(pos == false) {
				cnt = INF;
				break;
			}

			if(flag == true) {
				for(int id=1;id<cuts.size();id++) {
					sum[id] = sum[id] + aux[cuts[id]][c1] - aux[cuts[id-1]][c1];
				}
			} else {
				cnt++;
				for(int id=1;id<cuts.size();id++) {
					sum[id] = aux[cuts[id]][c1] - aux[cuts[id-1]][c1];
				}
			}
		}

		trace(i, cnt);

		ans = min(ans, cnt);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 384
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000007)
	sc.Split(bufio.ScanWords)
	a, _ := strconv.Atoi(Scanner())
	b, _ := strconv.Atoi(Scanner())
	c, _ := strconv.Atoi(Scanner())
	a, b = b, a
	a, c = c, a
	fmt.Println(a, b, c)
}


Measured memory_bytes: 640
//package atcoder.beginnner_176;

import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    
    public static void main (String[] args) throws Exception {

        String s = "20 12 6";

//        br = new BufferedReader(new StringReader(s));
        br = new BufferedReader(new InputStreamReader(System.in));
        bw = new BufferedWriter(new OutputStreamWriter(System.out));

        rl(); int N = nin(), X=nin(), T=nin();
        bw.write(((N/X)*T + (N%X==0?0:T)) + "\n");
        bw.flush();
    }

    static BufferedReader br; static BufferedWriter bw; static StringTokenizer st;
    static void rl() throws Exception{ st = new StringTokenizer(br.readLine()); }
    static long nlo(){ return Long.parseLong(st.nextToken()); }
    static int nin(){ return Integer.parseInt(st.nextToken()); }
    /*private static void te(){}*/
    static double ndo(){ return Double.parseDouble(st.nextToken()); }
    static char[] nca(){ return st.nextToken().toCharArray(); }
}

Measured memory_bytes: 36280
#include<vector>
#include<iostream>
#define MAX_V 1000
#define MAX_E 2000
#define INF 1e9
using namespace std;
struct edge
{
	int from, to, cost;
};
int V,E, d[MAX_V];
edge es[MAX_E];
bool find_negative_loop(int s)
{
	int count = 0;
	for (int i = 0; i < V; i++)
	{
		d[i] = INF;
	}
	d[s] = 0;
	while (true)
	{
		bool update = false;
		count++;
		for (int i = 0; i < E; i++)
		{
			edge e = es[i];
			if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost)
			{
				d[e.to] = d[e.from] + e.cost;
				if (count == V)
				{
					return true;
				}
				update = true;
			}
		}
		if (!update)
		{
			break;
		}
		
	}
	return false;

}


int main()
{
	int r;
	cin >> V >> E >> r;
	for (int i = 0; i < E; i++)
	{
		cin >> es[i].from >> es[i].to >> es[i].cost;
	}
	if (find_negative_loop(r))
	{
		cout<< "NEGATIVE CYCLE" << endl;
	}
	else
	{
		for (int i = 0; i < V; i++)
		{
			if (d[i] == INF)
			{
				cout <<"INF"<< endl;
			}
			else

			{
				cout << d[i] << endl;
			}

		}
	}
	return 0;
}


Measured memory_bytes: 3120
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long h = sc.nextLong();
		long w = sc.nextLong();
		if(h == 1 || w == 1){
			System.out.println(1);
		} else {
			System.out.println(h * w / 2 + h * w % 2);
		}
	}
}


Measured memory_bytes: 22100
//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <string>
//
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<double>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    string S;
    cin >> S;
    for (auto& ch : S)
    {
        ch = 'x';
    }
    cout << S;
    return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define ll long long
char s[210];
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int i,j,k,m,n,ans,flag;
    cin>>s;
    n=strlen(s);
    for(i=1;i<=n;i++)
    {
        flag=1;
        if((n-i)%2==0)
        {
            m=(n-i)/2;
            for(j=0;j<m;j++)
                if(s[j]!=s[j+m])
                {
                    flag=0;
                    break;
                }
            if(flag)
            {
                cout<<m*2<<endl;
                return 0;
            }
        }
    }
    return 0;
}


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

using namespace std;

long long MOD = 1e9+7;

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

  int A, B, C, K;
  cin >> A >> B >> C >> K;

  bool judge = false;

  for(int i = 0; i <= K; i++) {
    for(int j = 0; j <= K; j++) {
      int B_d = B * (1 << i), C_d = C * (1 << j);
      if(i + j <= K && A < B_d && B_d < C_d) judge = true;
    }
  }
  if(judge) {
    cout << "Yes" << endl;
  }
  else {
  cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 3640
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef pair<P,P> Edge;
typedef long long ll;

const double PI=4*atan(1.0);

void fast_stream(){
	std::ios_base::sync_with_stdio(0);
}
	
//#define RED_FILE

#ifdef RED_FILE
ifstream ifs("input.txt");
ofstream ofs("output.txt");
#define cin ifs
#define cout ofs
#endif

typedef pair<string,string> pss;

int n;
pss ind[1001];
string from;
string to;

const int INF=1000000000;
int dfs(string s){
    if(s==to)return 0;
    else if(s.size()>10)return INF;
    int res=INF;
    for(int i = 0; i < n; i++){
        string nstr;
        for(int j = 0; j < s.size(); j++){
            if(j<s.size()-ind[i].first.size()+1&&s.substr(j,ind[i].first.size())==ind[i].first){
                nstr+=ind[i].second;
                j+=ind[i].first.size();
                j--;
            }
            else
                nstr+=s[j];
        }
        if(nstr==s)continue;
        res=min(res,dfs(nstr)+1);
    }
    return res;
}

int main(){

    fast_stream();
    while(cin>>n&&n!=0){
        for(int i = 0; i < n; i++){
            string a,b;
            cin>>a>>b;
            ind[i].first=a;
            ind[i].second=b;
        }
        cin>>from>>to;
        int res=dfs(from);
        if(res==INF)cout<<-1<<endl;
        else cout<<res<<endl;
    }

    return 0;
}

Measured memory_bytes: 0
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.BitSet;
import java.io.BufferedReader;
import java.util.ArrayDeque;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        EHopscotchAddict solver = new EHopscotchAddict();
        solver.solve(1, in, out);
        out.close();
    }

    static class EHopscotchAddict {
        int n;
        int m;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            m = in.nextInt();

            HashSet<Integer>[] adj = new HashSet[3 * n];
            for (int i = 0; i < 3 * n; i++) {
                adj[i] = new HashSet<>();
            }

            for (int i = 0; i < m; i++) {
                int u = in.nextInt() - 1;
                int v = in.nextInt() - 1;
                adj[u].add(v + n);
                adj[u + n].add(v + 2 * n);
                adj[u + 2 * n].add(v);
            }

            int s = in.nextInt() - 1, t = in.nextInt() - 1;
            ArrayDeque<Integer> q = new ArrayDeque<>();
            q.addLast(s);
            BitSet visited = new BitSet();
            visited.set(s);
            int[] dist = new int[3 * n];
            dist[s] = 0;
            while (!q.isEmpty()) {
                int cur = q.pollFirst();
                for (int next : adj[cur]) {
                    if (visited.get(next))
                        continue;

                    visited.set(next);
                    dist[next] = dist[cur] + 1;
                    q.addLast(next);
                }
            }

            int answer = visited.get(t) ? dist[t] : -3;
            out.println(answer / 3);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public 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());
        }

    }
}



Measured memory_bytes: 129176
function Main(input) {

    input = input.split(" ");

    var a = parseInt(input[0], 10);
    var b = parseInt(input[1], 10);

    if (b % a == 0) {
        console.log(a + b);
    } else {
        console.log(b - a);
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
/* ex2_3 KitamoriFumiya */
#include <stdio.h>

int main(void){

	int N, A, R; // N,A,Rをint型の変数として宣言
	
	scanf("%d %d", &N, &A); // N,Aを入力
	R = N * N -A; // 黒色に塗るマスの数を計算
	printf("%d\n", R); // 黒色に塗るマスの数を出力
	
	return 0;
}

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

int main()
{

	int H, W;
	while (true)
	{
		cin >> H >> W;
		if (H == 0 && W == 0)
		{
			break;
		}
		//start row
		for (int row = 1; row <= H; row++)
		{
			for (int col = 1; col <= W; col++)
			{
				if (row % 2 == 0)
				{
					if (col % 2 == 1)
					{
						cout << ".";
					}
					else
					{
						cout << "#";
					}
				}
				else
				{
					if (col % 2 == 0)
					{
						cout << ".";
					}
					else
					{
						cout << "#";
					}
				}
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3112
n=int(input())
d=list(map(int,input().split()))
new_d=sorted(d)
count=0
x=0
y=0

for i in range(n-1):
  if d[i]>d[i+1] and count==1:
    d[y]=0
    d[y]+=d[i+1]
    d[i+1]=x
    count+=1
  if d[i]>d[i+1] and count==0:
    x+=d[i]
    y+=i
    count+=1
if d==new_d:
  print("YES")
else:
  print("NO")



Measured memory_bytes: 3064
N = int(input())
pLs=[]
for n in range(0,N):
    pLs.append(int(input()))

pLs.sort(reverse = True)

sm = 0
pLs[0] = int(pLs[0]/2)
for n in range(0,N):
    sm += pLs[n]

print(sm)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define MOD 998244353
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--){
        int n,k;
        cin>>n>>k;
        int a[n];
        for(int i=0;i<n;i++)
            cin>>a[i];
        int ans=0;
        sort(a,a+n);
        for(int i=0;i<k;i++)
            ans+=a[i];
        cout<<ans<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h> 
using namespace std;
 
#define ll long long int
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);
#define MOD 998244353
#define ll_MAX 19223372036859
#define endl "\n"
inline ll absdiff(ll a,ll b){ return (a>b)?a-b:b-a;}
ll fast_expo(ll x,ll p){if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
ll gcd(ll a,ll b){if(a==0||b==0) return a+b;  else return gcd(b%a,a); }

const ll N=100001;
ll dis1[N],dis2[N];

ll dfs(vector<ll> AdjL[],ll src,ll par){
    if(dis1[src]>=dis2[src]+1) return dis2[src];

    ll temp=dis2[src];

    for(auto i:AdjL[src]){
        if(i!=par){
            temp=max(dfs(AdjL,i,src),temp);
        }
    }
    return temp;
}

int main()
{
    fast
    ll q;q = 1;
    // cin>>q;
    for (ll t = 0; t < q; ++t)
    {
        ll n,u,v;cin>>n>>u>>v;
        vector<ll> AdjL[n+1];
        for(ll i=1;i<n;++i){
            ll x,y;cin>>x>>y;
            AdjL[x].pb(y);
            AdjL[y].pb(x);
        }

        ll vis1[n+1]{};
        fill_n(dis1,n+1,INT_MAX);
        queue<ll> Q;
        Q.push(u);
        dis1[u]=0;
        vis1[u]=1;
        while(!Q.empty()){
            ll temp=Q.front();
            Q.pop();
            for(ll i=0;i<AdjL[temp].size();++i){
                if(!vis1[AdjL[temp][i]]){
                    Q.push(AdjL[temp][i]);
                    vis1[AdjL[temp][i]]=1;
                    dis1[AdjL[temp][i]]=dis1[temp]+1;
                }
            }
        }

        ll vis2[n + 1]{};

        Q.push(v);
        dis2[v] = 0;
        vis2[v] = 1;
        while (!Q.empty())
        {
            ll temp = Q.front();
            Q.pop();
            for (ll i = 0; i < AdjL[temp].size(); ++i)
            {
                if (!vis2[AdjL[temp][i]])
                {
                    Q.push(AdjL[temp][i]);
                    vis2[AdjL[temp][i]] = 1;
                    dis2[AdjL[temp][i]] = dis2[temp] + 1;
                }
            }
        }

        cout<<dfs(AdjL,u,0)-1;
    }   
    return 0;
}   

Measured memory_bytes: 13184
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    int K,A,B;
    cin >> K >> A >> B;
    if((A+K-1)/K * K <= B) cout << "OK" << endl;
    else cout << "NG" << endl;
    
    

    return 0;
}


Measured memory_bytes: 3560
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	k := nextInt()
	t := nextInt()
	cake := make([]int, t)
	maxCake := 0
	for i := 0; i < t; i++ {
		cake[i] = nextInt()
		maxCake = max(maxCake, cake[i])
	}

	fmt.Println(max(maxCake-1-(k-maxCake), 0))
}

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextLine())
	return i
}

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


Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

typedef long long ll;
const ll INF = 1e18;

const ll MAX_N = 55555;
const ll MAX_NUM = MAX_N * 10;
bool is_prime[MAX_NUM];

int main(int argc, char* argv[])
{
  ll N;
  std::cin >> N;
  std::vector< ll > vans;

  for (ll i = 0; i < MAX_N; i++) {
    is_prime[i] = true;
  }

  is_prime[0] = false;
  is_prime[1] = false;
  for (ll i = 2; i < MAX_NUM; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j < MAX_NUM; j += i) {
	is_prime[j] = false;
      }
    }
  }

  for (ll i = 2; i <= MAX_N; i++) {
    if (is_prime[i] && i % 5 == 1) {
      vans.push_back(i);
    }
  }

  for (ll i = 0; i < N; i++) {
    std::cout << vans[i] << " ";
  }
  std::cout << std::endl;

  return 0;
}


Measured memory_bytes: 768
#include<stdio.h>

int main(void){
  int i;
  scanf("%d", &i);
  i = i % 10;
  if (i == 2 || i == 4 || i == 5 || i == 7 || i == 9){
    printf("hon");
  }else if(i == 0 || i == 1 || i == 6 || i == 8){
    printf("pon");
  }else if(i == 3){
    printf("bon");
  }else{}

  return 0;
}


Measured memory_bytes: 1728
#include<bits/stdc++.h>
#define ll long long
#define lu long unsigned
#define ull unsigned long long

using namespace std;
bool sortbysec(const pair<string,int> &a,
              const pair<string,int> &b)
{
    return (a.second < b.second);
}
bool sortpair(const pair<int,int> &a,
              const pair<int,int> &b)
{
    if(a.first==b.first)
        return (a.second<b.second);
    else
        return(a.first>b.first);
}
bool s(const string &a, const string &b){
    bool ans;
    return (a.size()<b.size());
}
bool isPrime(int val){
    for(int i=2;i*i<=val;i++){
        if(val%i==0)
            return false;
    }
    return true;
}
ll int conc(ll int a,ll int b){
   stringstream ss;
   ss<<a<<b;
   ll int ans;
   ss>>ans;
   ss.clear();
   return ans;
}
ll int binexp(int a,int b){
    ll int res=1;
    while(b!=0){
        if(b&1){
            res*=a;
            b--;
        }else{
            a*=a;
            b/=2;
        }
    }
    return res;
}
int gcd(int a,int b){
    if(a%b==0){
        return b;
    }else{
        return gcd(a%b,b);
    }
}
vector<int> ar[60];
int vis[60]={0};

void dfs(int v){
    vis[v]=1;
    cout<<v<<"->";
    for(int c:ar[v]){
        if(vis[c]==0){
            dfs(c);
        }
    }
}

void solve(){
    int n,m,a,b;
    cin>>n>>m;
    while(m--){
        cin>>a>>b;
        ar[a].push_back(b);
        ar[b].push_back(a);
    }
    for(int i=1;i<=n;i++){
        cout<<ar[i].size()<<endl;
    }
}


int main(){
    /*int t;
    cin>>t;
    while(t--)*/
        solve();


    return 0;
}



































































//1-(3+5-2+(3+19-(3-1-4+(9-4-(4-(1+(3)-2)-5)+8-(3-5)-1)-4)-5)-4+3-9)-4-(3+2-5)-10




















Measured memory_bytes: 3580
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
  
#define QMAX 35000
typedef struct { int t, s; } QUE;
QUE que[QMAX]; int qsize;
 
#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)
 
void min_heapify(int i)
{
    int l, r, min;
    QUE qt;
 
    l = LEFT(i), r = RIGHT(i);
    if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
    if (r < qsize && que[r].t < que[min].t) min = r;
    if (min != i) {
        qt = que[i], que[i] = que[min], que[min] = qt;
        min_heapify(min);
    }
}
 
void deq()
{
    que[0] = que[--qsize];
    min_heapify(0);
}
 
void enq(int s, int t)
{
    int i, min;
    QUE qt;
 
    i = qsize++;
    que[i].s = s, que[i].t = t;
    while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
        qt = que[i], que[i] = que[min], que[min] = qt;
        i = min;
    }
}
 
#define INF   0x30303030
#define MAX_V 10002
int hi[MAX_V], *to[MAX_V], *dd[MAX_V];
int dist[MAX_V];
 
void dijkstra(int n, int start)
{
    int i, s, e, t, nt;
 
    memset(dist, INF, n << 2);
    qsize = 0;
    dist[start] = 0, enq(start, 0);
    while (qsize) {
        s = que[0].s, t = que[0].t, deq();
        if (dist[s] < t) continue;
        for (i = 0; i < hi[s]; i++) {
            e = to[s][i], nt = t + dd[s][i];
            if (dist[e] > nt) dist[e] = nt, enq(e, nt);
        }
    }
}
 
#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
  
int in()
{
    int n = 0, c = gc();
    do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
    return n;
}
 
void out(int n)
{
    int i;
    char ob[20];
 
    if (!n) { pc('0'); return; }
    i = 0; while (n) ob[i++] = n%10 + '0', n/=10;
    while (i--) pc(ob[i]); 
}
 
int main()
{
    int n, i, j, k, u;
  
    n = in();
    for (i = 0; i < n; i++) {
        u = in(), hi[u] = k = in();
        to[u] = malloc(k<<2);
        dd[u] = malloc(k<<2);
        for (j = 0; j < k; j++) {
            to[u][j] = in(), dd[u][j] = in();
        }
    }
    dijkstra(n, 0);
    for (i = 0; i < n; i++) {
        out(i), pc(' '), out(dist[i]), pc('\n');
    }
    return 0;
}



Measured memory_bytes: 5504
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	static int r;
	static int g;
	static int b;
	static int rgb;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] param = line.split(" ");

		String s = param[0];
		String s2 = param[1];
		String s3 = param[2];

		r = 100 * Integer.parseInt(s);
		g = 10 * Integer.parseInt(s2);
		b = Integer.parseInt(s3);
		rgb = r + g + b;
		if((r/100)<=9 & (r/100)>=1 & (g/10)>=1 & (g/10)<=9 & b >=1 & b <=9){

		if( (rgb % 4) == 0){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
		}else{
			System.out.println("NO");
		}

	}
}

Measured memory_bytes: 23124
#include<iostream>
#include<vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main(void){
    int A,B,C;
    cin>>A>>B>>C;

    if(B/A>=C){
        cout<<C<<endl;
    }else{
        cout<<B/A<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final Character[] a = {'a', 'e', 'i', 'o', 'u'};

            System.out.println(
                Arrays.asList(a).contains(
                    s.charAt(0)) ? "vowel" : "consonant");
        }
    }
}


Measured memory_bytes: 21204
# include <stdio.h>
//# include <iostream>
//# include <cstdio>
//# include <conio.h>

//using namespace std;

int main ()
{
   char s [20];
   int i;
   
   for ( i=0; i < 12; i++ )
      scanf ("%c", &s [i]);
   
//   cin >> s;
   //int x = scanf ("%s", s);
   
   for ( i=0; i < 4; i++ )
//      cout << s [i];
      printf ("%c", s [i]);

//   cout << " ";
   printf (" ");
   
   for ( i=4; i < 12; i++ )
//      cout << s [i];
      printf ("%c", s [i]);
   printf ("\n");

//getch();
   return 0;
}


Measured memory_bytes: 128
#include <cstdio>
using namespace std;

int main() {
	const int MAX_N = 100;
	int N;
	int A[MAX_N];
	int key, p;

	scanf("%d", &N);
	for (int i = 0;i < N;i++) {
		scanf("%d", A + i);
	}

	for (int i = 0;i < N;i++) {
		key = A[i];
		p = i - 1;
		while (p >= 0 && A[p] > key) {
			A[p + 1] = A[p];
			p--;
		}
		A[p + 1] = key;
		for (int j = 0;j < N;j++) {
			printf("%d%c", A[j], (j + 1 < N) ? ' ' : '\n');
		}
	}

	return 0;
}

Measured memory_bytes: 1028
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

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

    int N=S.length();

    if(K>=N){
        cout<<S<<endl;
    }else{
        string T;
        for(int i=0;i<K;i++){
            T+=S[i];
        }
        cout<<T<<"..."<<endl;
    }


}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#define MAX(a, b) ((a) < (b) ? (b) : (a))
using namespace std;
typedef pair<int, int> P;
int main()
{
  int n;
  cin >> n;
  int a[n + 1];
  for (int i = 0; i < n; i++)
    cin >> a[i];
  sort(a, a + n);

  int now = a[0];
  int count = 0;
  int ans = 0;
  for (int i = 0; i < n + 1; i++)
  {
    if (now == a[i])
    {
      count++;
    }
    else
    {
      if (now <= count)
      {
        ans += count - now;
      }
      else
      {
        ans += count;
      }
      now = a[i];
      count = 1;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 768
// Running Offline
// g++ tester.cpp
// ./a.out
//#include "/Users/manasgupta/Desktop/stdc++.h"

 #include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pi pair<int,int>
#define pb push_back
#define fi first
#define se second
// #define mp make_pair
#define inf 1e9
#define EPS 1e-6
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define FILEIO(name1, name2) \
    freopen(name1".txt","r",stdin); \
    freopen(name2".txt","w",stdout);

const int N=105;
const int mod = 119 << 23 | 1;

int power(int a, int b, int c)
{
	int res=1;
	while (b)
	{
		if (b&1) res=(res*a)%c;
		a=(a*a)%c;
		b=b>>1;
	}
	return res;
}

int n,w;
int wt[N], v[N];
int dp[N][100005];

signed main()
{
	IOS;
	cin>>n>>w;
	int temp=0;
	for (int i=1; i<=n; i++)
	{
		cin>>wt[i]>>v[i];
		temp+=v[i];
	}
	for (int i=0; i<=n; i++)
	{
		for (int j=0; j<=temp; j++)
		{
			dp[i][j]=1e9;
		}
	}
	for (int i=1; i<=n; i++)
	{
		for (int j=0; j<=temp; j++)
		{
			if (v[i] > j)
			{
				dp[i][j]=dp[i-1][j];
			}
			else if (v[i]==j)
			{
				dp[i][j]=min(dp[i-1][j], wt[i]);
			}
			else
			{
				dp[i][j] = min(dp[i-1][j-v[i]]+wt[i], dp[i-1][j]);
			}
		}
	}
	for (int i=temp; i>0; i--)
	{
		// cout<<i<<" "<<dp[n][i]<<endl;
		if (dp[n][i] <= w)
		{
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<0<<endl;
    return 0;
}





Measured memory_bytes: 80128
#include <stdio.h>

#define N 2000001
#define K 10000

int A[2000001];
int B[2000001];
int C[10000];

void CountingSort(int,int);

int main(){
  int n,i,j;

  scanf("%d",&n);
  for(i=1;i<n+1;i++) scanf("%d",&A[i]);
    CountingSort(K,n);
   
     for(i=1;i<n;i++) printf("%d ",B[i]);
  printf("%d\n",B[i]);
    
  return 0;
}

void CountingSort(int k,int n){
  int i;

  for(i=0;i<k;i++) C[i]=0;

   for(i=1;i<n+1;i++) C[A[i]]++;

    for(i=1;i<k;i++)  C[i]+=C[i-1];


     for(i=n;i>0;i--){
    B[C[A[i]]] = A[i];
    C[A[i]]--;
    }

}

Measured memory_bytes: 16264
#include<bits/stdc++.h>
using namespace std;
int s[1100][1100];
int n,m;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=(1<<n)-1;i++,puts(""))
		for(int j=1;j<=(1<<m)-1;j++)
		{
			int x=s[i-1][j]^s[i][j-1]^s[i-1][j-1];
			s[i][j]=__builtin_popcount(i&j)&1;
			printf("%d",s[i][j]^x);
		}
	return 0;
}


Measured memory_bytes: 8080
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	int input{};
	cin >> input;
	while(input>10){
		input = input%10;
	}
	if(input == 2 || input == 4 || input ==5 || input == 7 || input == 9){
		cout << " hon ";
	}
	else if(input ==0 || input == 1 || input == 6 || input ==8){
		cout << " pon ";
	}
	else if( input == 3){
		cout <<" bon ";
	}
}

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

int main() {
    int x,n;
    cin>>x>>n;
    vector<int> arr(n);
    unordered_map<int,int> m;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        m[arr[i]]=1;
    }
    int ans=x;
   while(m.count(ans)>0)
   {
       ans+=1;
   }
   int ans2=x;
   while(m.count(ans2)>0)
   {
       ans2-=1;
   }
   if(abs(ans-x)<abs(x-ans2))
   {
       cout<<ans<<endl;
   }
   else
   {
       cout<<ans2<<endl;
   }
	// your code goes here
	return 0;
}


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

string siin(char a){
  if(a=='1')return "";
  else if(a=='2')return "k";
  else if(a=='3')return "s";
  else if(a=='4')return "t";
  else if(a=='5')return "n";
  else if(a=='6')return "h";
  else if(a=='7')return "m";
  else if(a=='8')return "y";
  else if(a=='9')return "r";
  else if(a=='0')return "w";
}

string boin(char a){
  if(a=='T')return "a";
  else if(a=='L')return "i";
  else if(a=='U')return "u";
  else if(a=='R')return "e";
  else if(a=='D')return "o";
}

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

  for(int i=0;i<s.size();i+=2){
    if(s[i]!='0'){
      cout << siin(s[i]) << boin(s[i+1]);
    }else{
      if(s[i+1]!='U')cout << siin(s[i]) << boin(s[i+1]);
      else cout << "nn";
    }
  }
  cout << endl;
}

Measured memory_bytes: 1192
// Problem : 
// 			A - Rainy Season
// 			
// 		
// Contest : AtCoder - AtCoder Beginner Contest 175
// URL : https://atcoder.jp/contests/abc175/tasks/abc175_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	string str;
	cin>>str;
	if(str[0]=='R'&&str[1]=='R'&&str[2]=='R')
		cout<<3<<nl;
	else if(str[0]=='R' && str[1]=='R' || str[1]=='R' && str[2]=='R')
		cout<<2<<nl;
	else if(str[0]=='R' || str[1]=='R' || str[2]=='R')
		cout<<1<<nl;
	else
		cout<<0<<nl;
		
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    for(int i=0;i<N;i++){
        char c;
        cin>>c;
        if(c=='Y'){
            cout<<"Four"<<endl;
            return 0;
        }
    }
    cout<<"Three"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
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; }
const int INF=1001001001;

int main() {
  int64_t N,A,B;
  cin>>N>>A>>B;
  int64_t ans=0;
  if(A%2==B%2){ans=abs(A-B)/2;}
  else{ans=min(min(A,B)+(max(A,B)-min(A,B))/2,min(N-A,N-B)+1+(max(N-A,N-B)-(min(N-A,N-B)+1))/2);}
  cout<<ans<<endl;
  return 0;}

Measured memory_bytes: 256
import Control.Monad
import Control.Monad.ST
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM

lot :: Int -> [(Int,Int)] -> V.Vector Int
lot n ss = runST $ do
    v <- V.thaw $ V.generate n succ
    forM_ ss $ uncurry (VM.swap v)
    V.unsafeFreeze v

parseLine :: String -> (Int,Int)
parseLine s = let (x,_:y) = break (== ',') s in (read x-1, read y-1)

main = do
    w <- readLn
    n <- readLn
    replicateM n getLine >>= V.mapM_ print . lot w . map parseLine

Measured memory_bytes: 4796
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <iomanip> 
#include <stdio.h>
//end of libraries ;
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
// ll lmax(ll o , ll w) {if(o>w)return o; return w;}
// ll lmin(ll o , ll w) {if(o<w)return o; return w;}
#define LNF 3999999999999999999
#define INF 999999999
#define N 3000003
#define PI 3.14159265359
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define ll long long
#define all(c) (c).begin(),(c).end()
#define sz(c) (c).size()
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
ll n , k , a[N] , ans;
int main(){
fcin;
    cin >> n >> k;
    for(ll i = 0 ; i < n ; i++) cin >> a[i];
    ll l = 1 , r = 10e8;
    while(l<=r){
        ll mid = (l+r)/2 , c = 0 ;
        for(ll i = 0 ; i < n ; i++){
            if(a[i] < mid) continue;
            c += ((a[i]/mid + (a[i]%mid!=0))-1);
        }
        if(c>k){
            l = mid + 1;
        }
        else{
            ans = mid;
            r = mid - 1;
        }
    }
    cout << ans << "\n";

}

Measured memory_bytes: 4652