akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    //全てに1を足してから最大のものをN+1引くとみなす
    ll N;
    cin >> N;
    ll a[N];
    rep(i, N) cin >> a[i];
    ll ans = 1e18;
    //最終的な操作回数をN+1で割った余りがiである場合
    rep(i, N+1){
        bool able = true;
        rep(j, N){
            if((a[j]+i)%(N+1) == N) able = false;
        }
        if(!able) continue;
        ll l = 0, r = 1e17;
        while(r-l > 1){
            ll n = (l+r)/2;
            //n*(N+1)+iを調べる
            ll x = n*(N+1)+i, sum = 0;
            rep(j, N){
                sum += (a[j]+x)/(N+1);
            }
            if(sum >= x) l = n;
            else r = n;
        }
        //cout << l << ' ' << l*(N+1)+i << endl;
        ans = min(ans, l*(N+1)+i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        
        int answer = 0;
        for (int i=1; i<=N; i++) {
            if (String.valueOf(i).length() % 2 == 1) {
                answer++;
            }
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 26068
N = int(input())
num_line = [0] + list(map(int, input().split()))
for i in range(N//2, 0, -1):
    num_line[i] = sum(num_line[i::i]) % 2
    #if sum(num_line[i::i]) % 2 != num_line[i]:
        #num_line[i] = 1
print(num_line.count(1))
print(" ".join(map(str, list(i for i in range(1, N+1) if num_line[i] == 1))))


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

int main() {
    ll n;
    cin >> n;
    vector<P> bk;

    rep(i,sqrt(n)) {
        if (n % (i+1) == 0) {
            bk.push_back(P((i+1),n/(i+1)));
        }
    }

    ll mini = bk[0].first + bk[0].second;
    rep(i,bk.size()) {
        ll tmp = bk[i].first + bk[i].second;
        mini = min(mini,tmp);
    }

    cout << mini - 2 << endl;

    return 0; 
}

Measured memory_bytes: 384
// Bismillaahirrahmaanirrahiim
/* Author	: Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>

/* MACROS SAMPAH */
#define jehian using
#define mau namespace
#define libur std
#define cepet {ios_base::sync_with_stdio(0);cin.tie(0);}

jehian mau libur;
/* MACROS FOR TYPE */
typedef long l;
typedef long double ld;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;

/* MACROS FOR PRINT */
#define nl printf("\n");
#define sp printf(" ");

/* MACROS FOR FUNCTION AND METHOD */
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define RESET(x) memset((x), 0, sizeof(x))
#define SET(x,y) memset((x), (y), sizeof(x))

/* MACROS FOR ATTRIBUTE */
#define fi first
#define se second

/* MACROS FOR SCAN */
#define scc(x) scanf("%c", &x)
#define scd(x) scanf("%Lf", &x)
#define scf(x) scanf("%f", &x)
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scld(x) scanf("%Lf", &x)
#define scui(x) sci(x)
#define scul(x) scl(x)
#define scull(x) scll(x)

int main(){
	string S;
	cin >> S;
	for (ll i = 0; i < S.size()-1; ++i){
		if (S[i] == 'A' && S[i+1] == 'C'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int>flag(101, 0);
    for (int i = 1; i < 10; ++i) {
        for (int j = 1; j < 10; ++j) {
            flag[i*j] = 1;
        }
    }
    if(flag[N]){
        cout << "Yes" << "\n";
    } else{
        cout << "No" << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */

public class Main {
    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                new Main().solve();
            }
        }, "1", 1 << 26).start();
    }

    void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CLower solver = new CLower();
        solver.solve(1, in, out);
        out.close();
    }

    static class CLower {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int ans = 0;
            int[] ar = new int[n];
            for (int i = 0; i < n; i++) {
                ar[i] = in.scanInt();
            }
            int[] dp = new int[n];
            for (int i = 1; i < n; i++) {
                if (ar[i] <= ar[i - 1]) dp[i] = dp[i - 1] + 1;
                ans = Math.max(dp[i], ans);
            }
            out.println(ans);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}



Measured memory_bytes: 26068
#pragma region Include
#include <bits/stdc++.h>
#pragma endregion

using namespace std;

#pragma region Macros
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define all(c) (c).begin(), (c).end()
#define newl "\n"
#define out(x) cout << (x) << newl
#define dump(x) \
  cout << "Line " << __LINE__ << " : " << #x << " = " << (x) << newl
template <class T>
using VV = vector<vector<T>>;
#define Uni(v) (v).erase(unique((v).begin(), (v).end()), (v).end());

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  os << "[";
  rep(i, vec.size()) os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  os << "]";
  return os;
}

template <typename T>
ostream& operator<<(ostream& os, vector<vector<T>>& mat) {
  os << "[";
  rep(i, mat.size()) os << mat[i] << (i + 1 == mat.size() ? "" : ",\n ");
  os << "]";
  return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x;
  return is;
}

template <typename V, typename H>
void resize(vector<V>& vec, const H head) {
  vec.resize(head);
}

template <typename V, typename H, typename... T>
void resize(vector<V>& vec, const H& head, const T... tail) {
  vec.resize(head);
  for (auto& v : vec) resize(v, tail...);
}
constexpr double EPS = 1e-10;
const int INF = 0x3f3f3f3f;

string tostring(int i, int digit) {
  auto cur = cout.flags();
  stringstream ss;
  ss << setw(digit) << setfill('0') << i;
  string ret = ss.str();
  cout.flags(cur);
  return ret;
}

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

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

ll mypow(ll x, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * x;
    x = x * x;
    n = n >> 1;
  }
  return res;
}

ll modpow(ll x, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n = n >> 1;
  }
  return res;
}

#pragma endregion

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N, K;
  cin >> N >> K;
  ll mod = 1000000007;
  ll ans = 0;
  for (ll i = K; i < N + 2; ++i) {
    ll tmp = N * i + i - i * i + 1;
    ans = (ans + tmp) % mod;
  }
  out(ans);

  return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <deque>
#include <set>
#include <cmath>
#include <bits/stdc++.h>
#include <limits>

#define MOD 1000000007

using namespace std;

int main(void){
    // Your code here!
    long long n, m, t[100], total_t = 0;
    
    
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> t[i];
        total_t += t[i];
    }
    
    cin >> m;
    for(int i = 0; i < m; i++){
        long long p, x;
        cin >> p >> x;
        cout << total_t - (t[p-1] - x) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
//In The Name of Allah
//Fri 12/2/97
#include <bits/stdc++.h>

#define Init ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define forar(i,n) for(long long int i = 0; i < n;i++)
#define fori(i,a,b) for(long long int i = a; i < b;i++)
#define WFile freopen("test.in","r",stdin),freopen("test.out","w",stdout)
#define Log(x) cout << "Log: " << x << endl;
#define F first
#define S second
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const ll mod = 1e9+7,M = 2e5+100;

void Solution();

int main()
{
	Init;
	Solution();
	return 0;
}

inline void Solution(){
	int a,b;
	cin >> a >> b;
	if(b<a)
		cout << a-1 << endl;
	else
		cout << a << endl;
}


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

int main()
{
    int N, A, B;
    vector<int> X;
    scanf("%d%d%d", &N, &A, &B);
    X.resize(N + 1);
    for (int i = 1; i <= N; i++) {
        scanf("%d", &X[i]);
    }
    long long ans = 0;
    for (int i = 1; i <= N - 1; i++) {
        ans += min((long long)A * (long long)(X[i + 1] - X[i]), (long long)B);
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define F first
#define S second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n;
queue<int> q[1010];
int a[1010][1010];
int tac[1010];
vector<int> vt,nxt;
int main()
{
	scanf("%d",&n);
	for (int i=0;i<n;i++)
	{
		tac[i]=0;
		for (int j=0;j<n-1;j++)
		{
			scanf("%d",&a[i][j]);
			a[i][j]--;
		}
	} 
	for (int i=0;i<n;i++) vt.push_back(i);
	for (int day=1;;day++)
	{
		bool ok=1,fl=0;
		vector<int> visit(n);
		nxt.clear(); 
		for (int k=0;k<vt.size();k++)
		{
			int i=vt[k];
			if (tac[i]==n-1 || visit[i]) continue;
			else ok=0;
			int j=a[i][tac[i]];
			if (tac[j]==n-1 || visit[j]) continue;
			if (a[j][tac[j]]==i)
			{
				//cout <<day<<" "<<i<<" "<<j<<" ##\n";
				visit[i]=visit[j]=1;
				tac[i]++,tac[j]++;
				nxt.push_back(i),nxt.push_back(j);
				fl=1;
			}
		} 
		if (ok)
		{
			printf("%d",day-1);
			return 0;
		}
		else if (!fl)
		{
			printf("-1");
			return 0;
		}
		vt=nxt;
	}
	return 0;
}

Measured memory_bytes: 4864
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		while (true) {
			// ???????????????????????¶???
			int dice[]  = {1,2,3,5,4,6};
			// ??????????????°
			int input = Integer.parseInt(br.readLine());
			// ??¢???????????????
			int output = dice[0];

			if (input == 0) {
				break;
			}

			// ??????????????°???????????????
			for (int i = 0; i < input; ++i) {
				String instruction = br.readLine();

				// ??\????????????????????????????????????
				switch (instruction) {
				case "North":
					dice = trunNorth(dice);
					break;
				case "East":
					dice = turnEast(dice);
					break;
				case "West":
					dice = turnWest(dice);
					break;
				case "South":
					dice = turnSouth(dice);
					break;
				case "Right":
					dice = turnRight(dice);
					break;
				case "Left":
					dice = turnLeft(dice);
					break;

				}
				// ?????´?????°????????????
				output = output + dice[0];
			}

			System.out.println(output);

		}
	}


	private static int[] trunNorth(int[] dice){
		int x = 0;
		x = dice[0];
		dice[0] = dice[1];
		dice[1] = dice[5];
		dice[5] = dice[3];
		dice[3] = x;
		return dice;
	}

	private static int[] turnEast(int[] dice){
		int x = 0;
		x = dice[0];
		dice[0] = dice[4];
		dice[4] = dice[5];
		dice[5] = dice[2];
		dice[2] = x;

		return dice;
	}

	private static int[] turnWest(int[] dice){
		int x = 0;
		x = dice[0];
		dice[0] = dice[2];
		dice[2] = dice[5];
		dice[5] = dice[4];
		dice[4] = x;
		return dice;
	}

	private static int[] turnSouth(int[] dice){
		int x = 0;
		x = dice[0];
		dice[0] = dice[3];
		dice[3] = dice[5];
		dice[5] = dice[1];
		dice[1] = x;
		return dice;
	}

	private static int[] turnLeft(int[] dice){
		int x = 0;
		x = dice[1];
		dice[1] = dice[4];
		dice[4] = dice[3];
		dice[3] = dice[2];
		dice[2] = x;
		return dice;
	}

	private static int[] turnRight(int[] dice){
		int x = dice[1];
		dice[1] = dice[2];
		dice[2] = dice[3];
		dice[3] = dice[4];
		dice[4] = x;
		return dice;
	}


}

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

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = readline().decode().rstrip()
T = readline().decode().rstrip()

cnt = 0
for s, t in zip(S, T):
    if s != t:
        cnt += 1

print(cnt)


Measured memory_bytes: 27316
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='1') cout<<9;
		else if(s[i]=='9') cout<<1;
		else cout<<s[i];
	}
	return 0;
}


Measured memory_bytes: 256
#include "iostream"
using namespace std;
 
int main(){
 
  int H1,M1,H2,M2,K;
  int allt;
  
  cin >> H1>>M1>>H2>>M2>>K;
  
  allt = H2*60 + M2 - (H1*60 + M1);
  
  cout << allt - K;
    
  return 0;
  
}

Measured memory_bytes: 3632
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<ll> x(N),y(N),h(N);
    rep(i,N) cin >> x[i] >> y[i] >> h[i];

    int r = 0;
    while (h[r] == 0) r++;
    ll h0 = h[r];
    ll x0 = x[r];
    ll y0 = y[r];

    int Cx,Cy;
    ll H;
    rep(i,101) {
        rep(j,101) {
            ll H0 = h0 + abs(x0 - i) + abs(y0 - j);
            bool ok = true;
            rep(k,N) {
                if (h[k] != max(H0 - abs(x[k]-i) - abs(y[k]-j),0LL)) ok = false;
            }
            if (ok) {
                Cx = i;
                Cy = j;
                H = H0;
            }
        }
    }

    cout << Cx << " " << Cy << " " << H << endl;
}


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

const int INF = INT_MAX / 3;

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()


double EPS = 1e-10;

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) return 0;
	return a + b;
}

struct P {
	double x, y;
	P() {}
	P(double x, double y) : x(x), y(y) {
	}
	P operator +(P p) {
		return P(add(x, p.x), add(y, p.y));
	}
	P operator -(P p) {
		return P(add(x, -p.x), add(y, -p.y));
	}
	P operator *(double d) {
		return P(d*x, d*y);
	}
	double dot(P p) {
		return add(x*p.x, y*p.y);
	}
	double det(P p) {
		return add(x*p.y, -y*p.x);
	}
	void print() {
		printf("%.10lf %.10lf \n", x, y);
		return;
	}
};

double dist(P p1, P p2) {
	double dx = p1.x - p2.x;
	double dy = p1.y - p2.y;
	return sqrt(dx*dx + dy*dy);
}

bool x_asc(const P& left, const P& right) {
	return left.x < right.x;
}

bool y_asc(const P& left, const P& right) {
	return left.y < right.y;
}

void merger(vector<P> &pointList, int start, int m, int end) {
	vector<P> tmp(end - start + 1);
	int i = start;
	int j = m + 1;
	for (int k = 0; k<end - start + 1; k++) {

		if (i == m + 1) {
			tmp[k] = pointList[j];
			j++;
			continue;
		}
		if (j == end + 1) {
			tmp[k] = pointList[i];
			i++;
			continue;
		}
		if (pointList[i].y >= pointList[j].y) {
			tmp[k] = pointList[j];
			j++;
			continue;
		}
		if (pointList[i].y < pointList[j].y) {
			tmp[k] = pointList[i];
			i++;
			continue;
		}
	}

	for (int i = start; i<end + 1; i++) {
		pointList[i] = tmp[i-start];
	}
}

double closestPoint(vector<P> &pointList, int start, int end) {
	int n = end - start + 1;
	int m = (start+end) / 2;
	double center = pointList[m].x;
	double d;
	if (start == end) return INF;
	d = min(closestPoint(pointList, start, m), closestPoint(pointList, m + 1, end));
	merger(pointList, start, m, end);

	vector<P> rangeList;
	for (int i = start; i<end + 1; i++) {
		if (fabs(pointList[i].x - center) >= d) continue;

		for (int j = rangeList.size() - 1; j>-1; j--) {
			double dd = dist(rangeList[j], pointList[i]);
			if (pointList[i].y - rangeList[j].y > d) break;
			d = min(d, dd);
		}
		rangeList.push_back(pointList[i]);

	}
	return d;
}

int main() {
	int n;
	cin >> n;
	vector<P> pointList(n);
	REP(i, n) {
		cin >> pointList[i].x >> pointList[i].y;
	}

	sort(ALL(pointList), x_asc);

	printf("%.10lf \n", closestPoint(pointList, 0, pointList.size() - 1));
	return 0;
}

Measured memory_bytes: 5880
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<< endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

int N, M;
int s[10][10];
int p[10];
int ans = 0;
int m[10];

void dfs(int depth) {
  if (depth == N) {
    rep(i, 0, M) {
      int cnt = 0;
      rep(j, 0, M) {
        if (s[i][j] == 0) break;
        cnt += m[s[i][j] - 1];
      }
      if (cnt % 2 != p[i]) return;
    }
    ans++;
    return;
  }
  m[depth] = 0;
  dfs(depth + 1);
  m[depth] = 1;
  dfs(depth + 1);
}

void solve() {
  in(N, M);
  rep(i, 0, M) {
    VAR(int, k);
    rep(j, 0, k) in(s[i][j]);
  }
  rep(i, 0, M) in(p[i]);

  dfs(0);
  print(ans);
}


Measured memory_bytes: 256
from collections import defaultdict
dic = defaultdict(int)

n = int(input())
A = [input() for i in range(n)]
for elem in A:
    dic[elem] += 1
# print(dic)
m = max(dic.values())
# print(m)

Ans = []
for key in dic:
    # print(dic[key])
    if dic[key] == m:
        Ans.append(key)

Ans = sorted(Ans)
for i in Ans:
    print(i)


Measured memory_bytes: 35572
#include<stdio.h>

int main(){
	int a[4],b[4],m,n,p,q;
	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=EOF&&scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3])!=EOF){
		p=0;q=0;
		for(m=0;m<4;m++)for(n=0;n<4;n++){
			if(m==n&&a[m]==b[n])p++;
			else if(a[m]==b[n])q++;}
		printf("%d %d\n",p,q);}
	return 0;
	}

Measured memory_bytes: 0
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

#define INF (1ll<<60)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;

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

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

using namespace std;

// gcd
int gcd(int a, int b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}

// sort big to small
// sort(A,A+N, greater<int>());

// v.front() = -BOUND;
// v.back() = BOUND;

// Iterator
// v.begin
// v.end

int main() {
    long long ans=0;
    long long N,K;

    cin >> N >>K;
    vector<long long>ball(N+1,0);

    rep(i,N){
        long long a;
        cin >> a;
        ball[a]++;
    }
    sort(ball.begin(), ball.end(),greater<long long>());

    long long num=0;
    for(long long i=0; i<N; i++){
        if(ball[i]==0) break;
        num++;
    }

    if(num<=K){
        ans=0;
    }else{
        for(long long i=K; i<num; i++){
            ans+=ball[i];
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
 
int main() {
  int H, N;
  cin >> H >> N;
  int A = 0;
  int a;
  rep(i, N){
      cin >> a;
      A += a;
  }
  if(A >= H) cout << "Yes";
  else cout << "No";
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long i,j,t,a,b,n,c,d,y,temp,m,r,sum,count,k,l,ans;
    t=1;
    // cin>>t;
    while(t--)
    {
        cin>>n>>m;
        ans=(n-m)*100+(m)*1900;
        ans*=pow(2,m);
        cout<<ans;
    }
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static int N = 3;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		long x = parseLong(sc.next());
		long a = parseLong(sc.next());
		long b = parseLong(sc.next());
		sc.close();
		long ab = -a + b;
		out.println(ab<=0?"delicious":ab<=x?"safe":"dangerous");
	}
}


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

#define fi first
#define se second

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

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

    sort(p.begin(),p.end());

    int ans=0;
    int nmax=p[0].se;
    for(int i=1;i<m;i++)
    {
        if(p[i].fi>=nmax)
        {
            ans++;
            nmax=p[i].se;
        }
        nmax=min(nmax,p[i].se);
    }
    ans++;

    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 3940
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  vector<char> data(S.size());
  bool result = true;
  
  for(int i=0;i<S.size();i++){
    char x = S.at(i);
    data.at(i) = x;
  }
  
  for(int i=0;i<S.size();i+=2){
    if(data.at(i)=='L')
      result = false;
  }
  for(int i=1;i<S.size();i+=2){
    if(data.at(i)=='R')
      result = false;
  }
  
  if(result)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

ll GCD(ll m, ll n) {
  if (m == 0) {
    return n;
  } 
  if (n == 0) {
    return m;
  }

  if (m >= n) {
    return GCD(m%n, n);
  } else {
    return GCD(m, n%m);
  }
}

int N;
ll X;
ll x[110000];

int main () {
  cin >> N >> X;
  Rep(i, N) {
    ll tmp;
    cin >> tmp;
    x[i] = abs(tmp - X);
  }

  ll ans = x[0];

  rep(i, N-1) {
    ans = GCD(ans, x[i]);
  }

  cout << ans << "\n";

}

Measured memory_bytes: 1024
a, b, c, x, y = list(map(int, input().split()))

yen = float('inf')
for nc in range(max(x, y) * 2, -2, -2):
    na = max(0, x - nc//2)
    nb = max(0, y - nc//2)
    tmp = na * a + nb * b + nc * c
    if tmp < yen:
        yen = tmp

print(yen)


Measured memory_bytes: 3060
a=int(input())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
if (a - 7)% 10 ==0 or (a//10 - 7) % 10==0 or (a//100 % 7)==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9160
//
//  main.c
//  Payment
//
//  Created by k19031kk on 2020/07/05.
//  Copyright © 2020 AIT. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    int yen,count = 0,sum = 0;
    scanf("%d",&yen);
    
    if(yen < 0 || yen > 10000){
        return 0;
    }
    
    
    while(1){
        sum = (1000 * count) - yen;
        if((sum < 1000) && (sum >= 0)){
            printf("%d\n",sum);
            break;
        }
        count++;
        
    }
    return 0;
}


Measured memory_bytes: 1732
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseFloat(x::SubString{String}) = parse(Float64, x)
parseFloat(x::Char) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    a=sort(parseMap(split(readline())),rev=true)
    cnt=Dict{Int,Int}()
    for i in a
        if haskey(cnt,i)
            cnt[i]+=1
        else
            cnt[i]=1
        end
    end
    hoge=sort(collect(cnt),by=x->x[1],rev=true)
    cnt=0
    ans=0
    for (i,j) in hoge
        if j>=2
            if cnt==1
                ans*=i
                break
            elseif j>=4
                ans=i^2
                break
            else
                ans=i
                cnt+=1
            end
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 134668
# AOJ 0056 Goldbach's Conjecture
# Python3 2018.6.16 bal4u

MAX = 50000
HALF = 2761			# prime[2760]=24989, prime[2761]=25013

prime = [
  3,  5,  7, 11, 13, 17, 19, 23, 29, 
 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 
 73, 79, 83, 89, 97,101,103,107,109,113, 
127,131,137,139,149,151,157,163,167,173, 
179,181,191,193,197,199,211,223 ]

sqp = [				# sqp[i] = prime[i]**2
  9,25,49,121,169,289,361,529,841,961,
1369,1681,1849,2209,2809,3481,3721,4489,5041,
5329,6241,6889,7921,9409,10201,10609,11449,11881,12769,
16129,17161,18769,19321,22201,22801,24649,26569,27889,29929,
32041,32761,36481,37249,38809,39601,44521,49729 ]

tbl = [0]*(MAX+1)	# zero if prime 
ans = [0]*(MAX+1)
ans[4] = 1

for i in range(47):
	for j in range(sqp[i], MAX, prime[i]): tbl[j] = 1;

for i in range(225, MAX+1, 2):
	if tbl[i] == 0: prime.append(i)

for i in range(HALF):
	j = i
	while True:
		k = prime[i]+prime[j]
		if k > MAX: break
		ans[k] += 1
		j += 1

while True:
	n = int(input())
	if n == 0: break
	if (n & 1) == 1: print(1-tbl[n-2])
	else: print(ans[n])


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

struct card{
  char name;int value;
};

int n;
card c1[40],c2[40];

void bubble(void){
  bool flag=1;
  for(int i=0;flag;i++){
    flag=0;
    for(int j=n-1;j>i;j--){
      if(c1[j].value<c1[j-1].value){
        swap(c1[j],c1[j-1]);
        flag=1;
      }
    }
  }
}

void select(){
  for(int i=0;i<n-1;i++){
    int minj=i;
    for(int j=i+1;j<n;j++){
      if(c2[minj].value>c2[j].value){
        minj=j;
      }
    }
    if(minj!=i){
      swap(c2[i],c2[minj]);
    }
  }
}

void print(card c[]){
  for(int i=0;i<n;i++){
    if(i){cout << " ";}
    cout << c[i].name<<c[i].value;
  }
  cout << endl;
}

bool check(){
  for(int i=0;i<n;i++){
    if(c1[i].name!=c2[i].name||c1[i].value!=c2[i].value){
      return 0;
    }
  }
  return 1;
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>c1[i].name>>c1[i].value;
    c2[i]=c1[i];
  }
  bubble();
  print(c1);
  cout << "Stable"<<endl;
  select();
  print(c2);
  cout << (check()?"Stable":"Not stable")<<endl;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();

int main()
{
    int x,n,ans,min=101,sa;
    cin>>x>>n;
    vector<int> p(n);
    ans=x;
    sa=0;
    rep(i,n){
        cin>>p[i];
    }
    sort(p.begin(),p.end());
    while(1){
        if((binary_search(p.begin(),p.end(),(x-sa)))==false){
            ans=(x-sa);
            break;
        }else if((binary_search(p.begin(),p.end(),(x+sa)))==false){
            ans=(x+sa);
            break;
        }else{
            sa++;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3636
import Control.Monad
main = do
  [n,m,c] <- map read . words <$> getLine
  bs <- map read . words <$> getLine
  ass <- replicateM n (map read . words <$> getLine)
  print . length . filter (>0) $ map (\as -> sum (zipWith (*) bs as) + c) ass

Measured memory_bytes: 1020
/*
By Tianyi Chen. All rights reserved.
Date: 2016-11-25
*/
#include<bits/stdc++.h>
using namespace std;
int n;
using ld=long double;
inline ld sqr(ld x) { return x*x; }
struct ck {
 ld x,y,r;
 void read() {
  cin>>x>>y>>r;
 }
 ld cdis(const ck&b)const {
  return max(ld(0),sqrt(sqr(x-b.x)+sqr(y-b.y))-r-b.r);
 }
}c[1111];
ld dis[1111][1111],d[1111];
queue<int>q;
int main() {
 ios::sync_with_stdio(0);
 cin>>c[0].x>>c[0].y;
 cin>>c[1].x>>c[1].y;
 cin>>n;
 for(int i=2;i<n+2;++i)c[i].read();
 int m=n+2;
 fill(d,d+1111,1e50);
 d[0]=0;
 for(int i=0;i<m;++i)for(int j=0;j<i;++j) {
  dis[i][j]=dis[j][i]=c[i].cdis(c[j]);
 }
 q.push(0);
 while (q.size()) {
  int p=q.front();q.pop();
  for(int i=0;i<m;++i) {
   ld nd=d[p]+dis[p][i];
   if (nd<d[i]) {
    d[i]=nd;
    q.push(i);
   }
  }
 }
 cout<<setprecision(20)<<d[1];
}

Measured memory_bytes: 18688
#include <iostream>
using namespace std;
int main(){
	int r, c;
	cin >> r >> c;
	int arr[r + 1][c + 1];
	for (int j = 0; j <= c ; j++) arr[r][j] = 0;

	for (int i = 0; i < r ; i++){
        arr[i][c] = 0;
		for (int j = 0; j < c ; j++){
            cin >> arr[i][j];
            arr[i][c] += arr[i][j];
            arr[r][j] += arr[i][j];
    	}
    	arr[r][c] += arr[i][c];
	}
    
	for (int i = 0; i <= r ; i++){
		for (int j = 0; j <= c ; j++){
            cout << arr[i][j];
            if(j != c) cout << " ";
            else cout << endl;
    	}
	}

	return 0;
}



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

int main() {
    int n;
    std::cin >> n;
    int64_t ans = 0;
    rep(i, n){
        if((i + 1) % 3 == 0 || (i + 1) % 5 == 0){}
        else ans = ans + i + 1;
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()
/*
void solve(){
  ll n; cin >> n;
  vector<ll> prime;
  FOR(i,2,(1000006)){
    bool flg = true;
    
    if(flg) prime.push_back(i);
  }
}
*/
/*
void solve(){
  int n; cin >> n; int ans =0;
  if(n<10) {cout << n; return;}
  priority_queue<
      int,                // 要素の型はint
      std::vector<int>,   // 内部コンテナはstd::vector (デフォルトのまま)
      std::greater<int>   // 昇順 (デフォルトはstd::less<T>)
    > qb, qa;
  FOR(i,1,10000000){
    string s = std::to_string(i);
    bool flg=true;
    FOR(j,0,s.size()-1){
      if(abs(s[j]-s[j+1])>1) {flg=false; break;}
    }
    if(flg) ans++;
    if(ans==n) {cout << i; return;}
  }
  cout << ans << endl;
}*/

void solve(){
  int n; cin >> n; int cnt=0;
  if(n<10) {cout <<n ; return;}
  queue<ll> q;
  FOR(i,1,10) q.push(i);
  cnt = 0;
  for(;cnt < n;){
    auto x = q.front();
    q.pop();
    ++cnt;
    if(cnt==n) cout << x;
    if( (x%10) != 0) {q.push(10*x+x%10-1);}
    if(true) {q.push(10*x + x%10);}
    if( (x%10) != 9) {q.push(10*x+x%10+1);}
  }
}

int main(){
  solve();
  return 0;
}

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

const long long bases[] = {10007,10009/*,10037*/};

template<long long mod = 1000000007>
struct RollingHashSimple{
	using ll = long long;
	vector<ll> hashes[2],powers[2];
	RollingHashSimple(const string &s){
		int n = s.length();
		for(int i = 0;i < 2;i++){
			hashes[i].resize(n + 1,0);
			powers[i].resize(n + 1,1);
			for(int j = 0;j < n;j++){
				powers[i][j + 1] = powers[i][j] * bases[i] % mod;
				hashes[i][j + 1] = (hashes[i][j] * bases[i] + s[j]) % mod;
			}
		}
	}
	inline ll hash(int l,int r,int b) const{
		return (hashes[b][r] - hashes[b][l] * powers[b][r - l] % mod + mod) % mod;
	}
	ll hash(int l = 0,int r = -1) const{
		if(r == -1) r = hashes[0].size() - 1;
		return hash(l,r,0) * mod + hash(l,r,1);
	}
	inline bool isSame(int a,int b,int c,int d) const{
		return hash(a,b) == hash(c,d);
	}
};

signed main(){
	string s,t;
	cin >> s >> t;
	int n = s.length(),m = t.length();
	RollingHashSimple<> rs(s),rt(t);
	for(int i = 0;i < n - m + 1;i++){
		if(rs.hash(i,i + m) == rt.hash()) cout << i << endl;
	}
}


Measured memory_bytes: 35660
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,w) for (int i = 0;i < (w); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;
int main(){
  int n,k;cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  ll ans = 1e18;
  rep(bit,1<<n){
    vector<int> temp(n);
    rep(i,n) temp[i] = a[i];

    ll sum = 0;

    if(__builtin_popcount(bit) != k) continue;
    int mx = temp[0]-1;
    //cout << mx << endl;
    rep(i,n){
      if(bit>>i&1){
        //cout << ((bit>>i)&1) << endl;
        //cout << " " << i << endl;
        sum += max(mx+1-temp[i],0);
        temp[i] = max(mx+1,temp[i]);
      }
      if(temp[i]>mx) mx = temp[i];
      //cout << mx << endl;
    }
    //printf("%d %d %d %d %d\n",temp[0],temp[1],temp[2],temp[3],temp[4]);
    ans = min(ans,sum);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3616
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args){
  Scanner scan = new Scanner(System.in);
   
  int r = scan.nextInt();
  int g = scan.nextInt();
  int b = scan.nextInt();
  scan.close();

  	if((10 * g + b)%4 == 0){
  	System.out.println("YES");
  	
  	}else{
  	System.out.println("NO");
  	}
  }
}


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

#define x first
#define y second

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;

ll cnt[256];
char all[5] = {'M','A','R','C','H'};

int main()
{
    int n;string s; cin >> n;
    while(n--) cin >>s, ++cnt[s[0]];
    ll ans = 0;
    for(int i=0;i<5;++i)
        for(int j=i+1;j<5;++j)
            for(int k=j+1;k<5;++k) ans += cnt[all[i]]*cnt[all[j]]*cnt[all[k]];
    cout << ans;
}



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

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;
int n;
int a[M];
 main()

{
    fast
    cin>>n;
    int ses;
    f(i,1,n)
    {
        cin>>a[i];
    }
    int sum=0;
    int cost=0;
    f(i,1,n)
    {
        sum+=a[i];
        if(i%2==0)
        {
           if(sum>=0)
           {
               cost+=(sum+1);
               sum=-1;
           }
        }
        else
        {
            if(sum<=0)
            {
                cost+=(abs(sum)+1);
                sum=1;
            }
        }
    }
    //cout<<cost<<"!"<<endl;
    ses=cost;
    sum=0;
    cost=0;
     f(i,1,n)
    {
        sum+=a[i];
        if(i%2==1)
        {
           if(sum>=0)
           {
               cost+=(sum+1);
               sum=-1;
           }
        }
        else
        {
            if(sum<=0)
            {
                cost+=(abs(sum)+1);
                sum=1;
            }
        }
    }
   // cout<<cost<<"!!"<<endl;
    ses=min(ses,cost);
    cout<<ses<<endl;
    return 0;

}





































Measured memory_bytes: 1024
import math


N,K = map(int, input().split())

possibility = 0.0

for i in range(1, N+1):
    tmp_possibility = 1 / N

    cnt = 0

    while i < K:
        i *= 2
        cnt += 1

    tmp_possibility = 1 / N * (0.5 ** cnt)

    possibility += tmp_possibility

print(possibility)


Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
  int n;
  
  scanf("%d",&n);
  
  int i;
  long long ans=0;
  
  for(i=1;i<=n;i++)
  {
    if(i%3==0||i%5==0)
    {
      continue;
    }
    else
    {
      ans+=i;
    }
  }
  
  printf("%lld\n",ans);
 
  return 0;
}

Measured memory_bytes: 1736
/*{{{*/
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n,k;
  cin >> n >> k;
  vl a(n);
  REP(i,n) cin >> a[i];

  ll t = 1;
  ll cnt = 0;
  REP(i,log(k)/log(2)) t *=2;
  while(t>0){
    if(cnt+t>k){
      t /= 2;
      continue;
    }
    ll count = 0;
    REP(i,n){
      if((a[i]&t) == 0) count++;
    }
    if(count>n/2) cnt += t;
    t /= 2;
  }
  ll ans = 0;
  REP(i,n){
    ans += (a[i]^cnt);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,-1,sizeof(x))
const int INF = 1000000001;

int main(){
  int n;
  cin >> n;
  map<int, int> even, odd;
  rep(i, n){
    int tmp;
    cin >> tmp;
    if(i%2==0){
      if(even.count(tmp)) even.at(tmp)++;
      else even[tmp] = 1;
    }else{
      if(odd.count(tmp)) odd.at(tmp)++;
      else odd[tmp] = 1;
    }
  }
  int max_even=0, max_odd=0, next_even=0, next_odd=0;
  int even_max, even_next, odd_max, odd_next;
  for(pair<int, int> x : even){
    if(x.second > max_even){
      next_even = max_even;
      max_even = x.second;
      even_next = even_max;
      even_max = x.first;
    }else if(x.second > next_even){
      next_even = x.second;
      even_next = x.first;
    }
  }
  for(pair<int, int> x : odd){
    if(x.second > max_odd){
      next_odd = max_odd;
      max_odd = x.second;
      odd_next = odd_max;
      odd_max = x.first;
    }else if(x.second > next_odd){
      next_odd = x.second;
      odd_next = x.first;
    }
  }
  if(even_max != odd_max){
    cout << n-max_even-max_odd;
  }else{
    cout << min(n-max_even-next_odd, n-next_even-max_odd) <<endl;
  }
}

Measured memory_bytes: 4992
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <atcoder/all>
//using namespace atcoder;
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n,q;cin>>n>>q;
    int x,y;
    vector<vector<int>> g(n,vector<int>(0,0));
    rep(i,n-1){
        cin>>x>>y;
        x--,y--;
        g[x].emplace_back(y);
        g[y].emplace_back(x);
    }
    vector<int> cnt(n,0);
    rep(i,q){
        cin>>x>>y;
        cnt[x-1] +=y;
    }
    vector<int> ans(n,-1);
    int num=1;
    queue<int> que;
    que.emplace(0);
    ans[0]=cnt[0];

    while(num<n){
        x=que.front();
        que.pop();
        for(auto z:g[x]){
            if(ans[z]>-1) continue;
            ans[z]=ans[x]+cnt[z];
            num ++;
            que.emplace(z);
        }    
    }
    rep(i,n-1) cout<<ans[i]<<" ";
    cout<<ans[n-1]<<endl;
}/*
./problem.exe
*/

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

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

const ll INF = 1LL << 60;

ll N;
vector<ll> c;

const int mod = 1e9 + 7;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    cin >> N;
    c.resize(N);
    rep(i, N) cin >> c[i];
    vector<mint> two(N + 1);
    two[0] = 1;
    rep(i, N) two[i + 1] = two[i] * 2; 
    sort(c.begin(), c.end());

    mint ans = 0;
    rep(i, N) {
        // if (i == 0) continue;
        // ans += two[i] * two[i - 1] * i * c[i]; 
        ll l = i;
        ll r = N - 1 - i;
        mint now = two[r];
        if (r != 0) now += two[r - 1] * r;

        now *= two[l];
        now *= c[i];

        ans += now;
    }

    ans *= two[N];
    cout << ans << endl;
}

Measured memory_bytes: 6404
import sys
import math
from functools import reduce
from operator import mul
sys.setrecursionlimit(10**6)

def InMap(): return list(map(int, sys.stdin.readline().split(' ')))
def In(): return int(sys.stdin.readline())
def InS(): return sys.stdin.readline()

S = InS()
A = int(S.split(' ')[0])
B = S.split(' ')[1]
B = B[0] + B[2] + B[3]
# A *= B
print(A * int(B) // 100)



Measured memory_bytes: 9572
#define Oo ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#include <bits/stdc++.h>
using namespace std;
#define PI acos(-1.0)
typedef long long ll;
int a[200];
int main()
{
      Oo
      int n;cin>>n;
      for (int i=0; i<n; i++)cin>>a[i];
      int ans=0;
      sort(a, a+n);
      for (int i=0; i<n; i++)
      {
            for (int j=i+1; j<n; j++)
            {
                  for (int k=j+1; k<n; k++)
                  {
                        if (a[i]!=a[j]&&a[i]!=a[k]&&a[j]!=a[k])
                        {
                              if (a[i]+a[j]>a[k]&&a[k]-a[i]<a[j])ans++;
                        }
                  }
            }
      }cout <<ans << endl;
	return 0;
}



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

typedef long long ll;

#define M 1000000007
#define MAX 100005

ll mpow(ll x, ll n){ 
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
ll msub(ll a,ll b){
	if(a>=b){
		return a-b;
	}
	return msub(a+M,b);
}

int main() {
	ll N,K;
    cin >> N >> K;
	ll gcd_num[MAX];
	
	ll sum=0;
	for(ll i=K; i >0; i--){
		ll num = mpow(K/i,N);
		for(int j=2;i*j<=K;j++){
			num = msub(num,gcd_num[i*j]);
		}
		gcd_num[i] = num;
		sum = (sum + (i * num%M))%M;
	}
	cout << sum << endl;

    return 0;
}


Measured memory_bytes: 4424
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    
    int m = -1000;
    m = max(m, a+b);
    m = max(m, a-b);
    m = max(m, a*b);

    cout << m;
}

Measured memory_bytes: 256