akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

bool visited[1010];
int n;
int w[1010], c[1010];

int partition(int a[], int p, int r) {
    int x = a[r];
    int i = p - 1;
    for (int j = p; j < r; ++j) if (a[j] <= x)swap(a[++i], a[j]);
    swap(a[++i], a[r]);
    return i;
}

void quickSort(int a[], int p, int r) {
    if (p >= r) return;
    int q = partition(a, p, r);
    quickSort(a, p, q - 1);
    quickSort(a, q + 1, r);
}

int search(int x) {
    int l = 0, r = n, m;
    while (r - l > 1) {
        m = (l + r) / 2;
        if (c[m] <= x) l = m; else r = m;
    }
    return l;
}

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> w[i];
        c[i] = w[i];
    }
    quickSort(c, 0, n - 1);
    int res = 0;
    for (int i = 0; i < n; ++i) {
        int j = i, cnt = 0, sum = 0, mn = 114514;
        while (!visited[j]) {
            visited[j] = true;
            cnt++;
            sum += w[j];
            mn = min(mn, w[j]);
            j = search(w[j]);
        }
        if (cnt > 1) res += sum + mn + min(mn * (cnt - 3), c[0] * (cnt + 1));
    }
    cout << res << endl;
    return 0;
}

/*--------- TO SOLVE ---------*/
/*
 * comparing sorted sequence with origin that, you would find that some number are looped in the group.
 * so, calculate sums and minimums of number groups and the cost to do so will be
 *      sum + minimum * (number of group - 2)
 *          or
 *      sum + minimum + (minimum number in the sequence) * (number of group + 1)
 */


Measured memory_bytes: 3120
n=int(input())
la=list(map(int,input().split()))
lc=[0]*n
for i in range(n):
  t=la[i]
  while t%2<1 and lc[i]<2:
    t//=2; lc[i]+=1
c=[lc.count(i) for i in range(3)]
print('YNeos'[c[0]-c[2]>1 or (c[0]>c[2] 
and n%2<1)::2])

Measured memory_bytes: 14228
#include<bits/stdc++.h>
#define ll long long
#define f  first
#define s  second
#define Tsetso ios_base::sync_with_stdio(0) ; cin.tie(0) ;
using namespace std;
const int  N = 100050, mod = 1e9+7, inf = 2e9 ;
ll dp[105][N] , mx = 0;
int main()
{
    Tsetso
    ll n, w;
     cin >> n >> w ;
     pair < ll , ll > p[n];
     for ( int i = 0 ; i <n ; i++){
         cin >> p[i].s >> p[i].f ;
         mx += p[i].f ;
     }
     sort(p,p+n) ;
     memset(dp, 0x3f, sizeof dp);
     dp[0][0] = 0 ;
     for ( int i = 1 ; i <= n ; i++)
     {
         ll curw = p[i-1].s ;
         ll curv = p[i-1].f ;
         for ( int j = 0 ; j <= mx ; j++){
             int l = max((ll)0,j-curv);
             dp[i][j] = min(curw+dp[i-1][l],dp[i-1][j]);
         }
     }
     int  ans = 0;
     for ( int i = 0 ; i <= mx ; i++)
         if ( dp[n][i] <= w)
                ans = i ;
     cout << ans ;
}


Measured memory_bytes: 85776
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include <queue>
#define rep(i,n) for(int i=0;i<(n);++i)
#define _GLIBCXX_DEBUG
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
int main() {
    int n;
    cin >> n;
    vector<int>a(n);
    vector<int> p(n),q(n);
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> q[i];
    rep(i, n)a[i] = i + 1;
    map<vector<int>, int> mp;
    do{
        mp[a] = mp.size();
    } while (next_permutation(a.begin(), a.end()));
    int ans = abs(mp[p] - mp[q]);
    cout << ans << endl;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;

vector<ii> adj[100005];
int color[100005];

void dfs(int u, int p){
    for(ii par : adj[u]){
        int v = par.first, w = par.second;
        if(v == p) continue;
        if(w%2 == 0) color[v] = color[u];
        else color[v] = !color[u];
        dfs(v, u);
    }
}

int main(){
    
    int n; cin >> n;
    for(int i = 0; i < n-1; i++){
        int u, v, w; cin >> u >> v >> w;
        adj[u].push_back({v, w});
        adj[v].push_back({u, w});
    }
    
    dfs(1, -1);
    for(int i = 1; i <= n; i++)
        cout << color[i] << endl;
    
	return 0;
}


Measured memory_bytes: 8320
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int sum = 1;
    int count = 1; 
    
    for(int i = 0; sum < b; i++) {
      sum = sum + a - 1;
      count++;
    }
    System.out.println(count - 1);
  }
}

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

#define rp(i, k, n) for (int i = k; i < n; i++)
#define ll  long long

int main() {
    int n;
    cin >> n;
    int m = n / 100;
    if (m * 111 >= n) {
        cout << m * 111;
    } else {
        cout << (m+1) * 111;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define CLR(a) memset(a, 0, sizeof(a))
#define DBG(x) cout<<(#x)<<"="<<x<<endl
#define FOR(i, a, b)  for(int i=(a); i<(b); i++)
#define REP(i, a, b)  for(int i=(a); i<=(b); i++)
#define DOWN(i, a, b) for(int i=(a); i>=(b); i--)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1000000009;
const int N= 2e5 +10;

int n;
int a[N];
map<int, int> m;
int ans;

int main() {
	cin>>n;
	REP(i, 1, n) cin>>a[i];
	REP(i, 1, n) {
		if (m.count(a[i]-1)) {
			m[a[i]]=m[a[i]-1]+1;
		}
		else m[a[i]]=1;
		ans=max(m[a[i]], ans);
	}
	cout<<n-ans<<endl;
	//cout<<1.*clock()/CLOCKS_PER_SEC<<"ms"<<"\n";
	return 0;
}

Measured memory_bytes: 10496
import java.util.Scanner

import scala.collection.mutable
import scala.util.control.Breaks

object MathAlgo {

  def Primes(size: Int): Array[Int] = {
    var primes = new Array[Int](0)
    val flag = Array.fill[Boolean](size)(true)
    val limit = Math.sqrt(size).toInt

    (2 until limit).foreach(i => {
      if (flag(i)) {
        primes = primes :+ i
        (i until size by i).foreach(j => {
          flag(j) = false
        })
      }
    })

    (limit until size).foreach(i => {
      if (flag(i)) {
        primes = primes :+ i
      }
    })

    primes
  }
}

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)

    val N = sc.nextInt
    val P = MathAlgo.Primes(55556)
    var ans: Array[Int] = new Array[Int](0)

    P.foreach(p => {
      if (p % 5 == 1) {
        ans = ans :+ p
      }
    })

    print(ans.slice(0,N).mkString(" "))
  }
}

Measured memory_bytes: 50852
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;
		int numC = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();
			numC = scanner.nextInt();

			int wk = numB;
			int res = 0;
			while (wk >= numA && res < numC) {
				wk -= numA;
				res++;
			}

			System.out.println(res);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;
		int numK = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();
			numK = scanner.nextInt();

			List<Integer> wk = new ArrayList<Integer>();
			for (int i = 1; i <= Math.max(numA, numB); i++) {
				if (numA % i == 0 && numB % i == 0) {
					wk.add(i);
				}
			}

			System.out.println(wk.get(wk.size() - numK));

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

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

#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
int main(){
    int ans=0;
    string s;
    cin >> s;
    int n=s.length()-1; //index number

    rep(i,n/2+1){
        if(s.at(i)!=s.at(n-i)){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long  
#define mod 1000000007
#define am 998244353
#define INFi 2147483647
#define INFl 9223372036854775807LL
#define fi first
#define se second
#define be begin()
#define en end()
int abs(int a,int b){ 
  int c=max(a,b)-min(a,b);
  return c;
}
int gcd(int a,int b){//最大公約数
  int c=a%b;
  while(true){
    if(c==0) break;
    a=b;
    b=c;
    c=a%b;
  }
  return b;
}
bool IsPrime(int num){
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false;
  double sqrtNum = sqrt(num);
  for(int i=3;i<=sqrtNum;i+=2){
    if(num%i==0){
      return false;
    }
  }
}
int lcm(int a,int b){//最小公倍数
    return (a*b)/gcd(a,b);
}	    
signed main(){
// __builtin_ctz(N);      Nを２で何回割り切れるかを返す
//(n+1)*n/2;              １からNまでの総和を求める式
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a;
    
    cin>>a;
    
    if(a=="SAT") cout<<"1";
    else {
	if(a=="SUN") cout<<"7";
	else {
	    if(a=="TUE") cout<<"5";
	    else {
		if(a=="WED") cout<<"4";
		else{
		    if(a=="THU") cout<<"3";
		    else {
			if(a=="FRI") cout<<"2";
			else cout<<"6";
		    }
		}
	    }
	}
    }
    cout<<"\n";
}

			    


Measured memory_bytes: 764
import java.util.Scanner;
public class Main {
	static void swap(int[] data,int x,int y){
		int tmp=data[x];
		data[x]=data[y];
		data[y]=tmp;
	}
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		int[] data=new int[N];
		int count=0,mini;
		for(int i=0;i<N;i++) data[i]=scan.nextInt();
		for(int i=0;i<N;i++){
			mini=i;
			for(int j=i;j<N;j++){
				if(data[j]<data[mini]){
					mini=j;
				}
			}
			if(i!=mini){
				swap(data,i,mini);
				count++;
			}
		}
		for(int i=0;i<N;i++){
			if(i==0) System.out.print(data[i]);
			else System.out.print(" "+data[i]);
		}
		System.out.printf("\n%d\n",count);
		scan.close();
	}
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  int A[N + 5];
  for (int i = 0; i < N; i++)
    cin >> A[i];
  cout << ceil(double(N - 1) / (K - 1)) << '\n';
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=5010, inf=1e9;
int n, m, mod;
int fac[maxn], inv[maxn], s[maxn][maxn];

template<typename T>
inline void read(T &k)
{
	int f=1; k=0; char c=getchar();
	while(c<'0' || c>'9') c=='-' && (f=-1), c=getchar();
	while(c<='9' && c>='0') k=k*10+c-'0', c=getchar();
	k*=f;
}

inline int power(int a, int b, int mod)
{
	int ans=1;
	for(;b;b>>=1, a=1ll*a*a%mod)
	if(b&1) ans=1ll*ans*a%mod;
	return ans;
}

inline int C(int n, int m){return (n<m)?0:1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;}

int main()
{
	read(n); read(mod);
	fac[0]=1; for(int i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%mod;
	inv[n]=power(fac[n], mod-2, mod); for(int i=n;i;i--) inv[i-1]=1ll*inv[i]*i%mod;
	s[0][0]=1;
	for(int i=1;i<=n+1;i++)
	{
		for(int j=1;j<=i;j++) 
		s[i][j]=(s[i-1][j-1]+1ll*s[i-1][j]*j)%mod;
	}
	int ans=0;
	for(int i=0;i<=n;i++)
	{
		int sum=0, mi=1;
		for(int j=0;j<=i;j++)
		{
			sum=(sum+1ll*mi*s[i+1][j+1])%mod;
			mi=1ll*mi*power(2, n-i, mod)%mod;
		}
		sum=1ll*sum*C(n, i)%mod*power(2, power(2, n-i, mod-1), mod)%mod;
		if(i&1) ans=(ans-sum+mod)%mod;
		else ans=(ans+sum)%mod;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 58112
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

# 半開区間[lower, upper)の素数のリストを作成する
def make_prime_list(lower:int, upper:int) -> list:
    
    # 変数のバリデーション
    if lower < 0:
        raise ValueError("lowerは0以上でなければいけません。(lower:{})".format(lower))

    elif upper <= lower:
        raise ValueError("upperはlowerより大きい数でなければいけません。\
                         (lower:{}, upper:{})".format(lower,upper))
    
    # 素数リストの初期化    
    isPrime = [True]*upper
    primeList = []
    
    # 区間内の数字が0,1のみならここで終了
    if upper <= 2:
        return primeList
    
    # 区間内の数字に2以上のものがあるとき
    isPrime[0] = False
    isPrime[1] = False
    
    # エラトステネスの篩の処理
    n = 2
    while n**2 <= upper:
        if isPrime[n]:
            res=2*n
            while res<upper:
                isPrime[res] = False
                res += n
                
        n += 1
    
    # 区間内の素数を抽出
    for n in range(lower,upper):
        if isPrime[n]:
            primeList.append(n)
        
    return primeList

n = ni()

prime_list = make_prime_list(0, 55555)

ans = []
for prime in prime_list:
    if prime % 5 == 1:
        ans.append(prime)
        
    if len(ans) == n:
        break
    
print(*ans)

Measured memory_bytes: 3700
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

typedef pair<int, int> P;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<P> request(M);
    for(int i=0;i<M;++i){
        cin >> request[i].second >> request[i].first;
    }

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

    int v=-1, ans=0;
    for(int i=0;i<M;++i){
        if(v <= request[i].second){
            ++ans;
            v = request[i].first;
        }
    }

    cout << ans << endl;
}


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

signed main(){
    int n;
    cin >> n;
    o(n * (n + 1) / 2);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
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; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    ll n, w, maxv = 0; cin >> n >> w;
    vector<pair<ll, ll>> wv(n+1);
    repf(i, n){
        cin >> wv[i].first >> wv[i].second;
        maxv += wv[i].second;
    }
    vvi dp(n+1, vi(maxv+1, (1LL<<60))); dp[0][0] = 0;

    for(ll i=1; i<=n; i++){
        for(ll sum_v=0; sum_v<=maxv; sum_v++){
            if(sum_v-wv[i].second >= 0){
                chmin(dp[i][sum_v], dp[i-1][sum_v-wv[i].second]+wv[i].first);
            }
            chmin(dp[i][sum_v], dp[i-1][sum_v]);
        }
    }
    ll ans = dp[n][0];
    for(ll i=1; i<=maxv; i++) if(dp[n][i] <= w) ans = i;
    cout << ans << endl;
}

Measured memory_bytes: 80256
#pragma warning(disable: 4996)

#include <iostream>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <functional>
#include <cstdio>
#include <cctype>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <bitset>
#include <numeric>
#include <string>
#include <set>
#include <tuple>
#include <utility>
#include <regex>
#include <deque>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
using namespace std;

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

	string s;
	int q, t, f;
	char c;
	cin >> s >> q;
	string a;
	bool one = true; // おもて
	for (int i = 0; i < q; ++i) {
		cin >> t;
		if (t == 1) {
			if (one) one = false;
			else one = true;
		}
		else if (t == 2) {
			cin >> f >> c;
			if (f == 1) { // 先頭にcを追加
				if (one) {
					a += c;
					//s = c + s;
				}
				else {
					s += c;
				}
			}
			else if (f == 2) {
				if (one) {
					s += c;
				}
				else {
					//s = c + s;
					a += c;
				}
			}
		}
	}
	reverse(a.begin(), a.end());
	s = a + s;
	string s2 = s;
	reverse(s2.begin(), s2.end());
	if (one) cout << s << endl;
	else cout << s2 << endl;
	return 0;
}

Measured memory_bytes: 1452
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main(){
	int n,m;
	cin>>n>>m;

	vector<int> items[m];
	vector<int> A(m);
	for(int i = 0; i < m ; i++){
		int a,b;cin>>a>>b;
		A[i] = a;
		for(int j = 0; j < b; j++){
			int t;cin>>t;
			items[i].push_back(t);
		}
	}

	vector<int> dp(5000,INF);
	dp[0] = 0;
	for(int i = 0; i < m; i++){
		int cur = 0;
		for(int j=0; j < items[i].size(); j++){
			cur|=(1<<(items[i][j]-1));
		}
		for(int j = 0; j < (1<<n); j++){
			dp[j|cur] = min(dp[j|cur],dp[j]+A[i]);
		}
	}

	if(dp[(1<<n)-1] >= INF) dp[(1<<n)-1] = -1;
	cout<<dp[(1<<n)-1];
}

Measured memory_bytes: 384
# original_author prd_xxx
from collections import Counter

N = int(input())
S = [input() for i in range(N)]

# collections.Counter()を使うと0回目の時にバグらないので23行目elseを省略可能
ctr = Counter()
ctr = {}
ans = 0

for s in S:
    # 文字列を昇順に並べ替え
    # 文字列をリスト化し、sortしたものを文字列化
    a = ''.join(sorted(list(s)))

    # ソート済み文字列が以前に存在していたら、答えに前回の合計値を加算する
    # 1..0 2..1 3..3 4..6 5..10 ... 組み合わせの数n(n-1)/2があり、
    # 最後にO(n)で計算も可能だが、冗長。
    # 一個ずつ処理していくと、
    # 1..0 2..+1(1) 3..+2(3) 4..+3(6) 5..+4(10)の増加になる
    if a in ctr:
        ans += ctr[a]
    else:
        ctr[a] = 0

    ctr[a] += 1

print(ans)


Measured memory_bytes: 25328
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;

static class MainClass
{
    public static void Main(string[] args)
    {

        var S = Console.ReadLine();
        if (S == "keyence")
        {
            Console.WriteLine("YES");
            return;
        }
        else
        {
            for (int i = 0; i < S.Length; i++)
            {
                for (int j = 0; j < S.Length + 1; j++)
                {
                    if (i + j < S.Length)
                    {
                        var str = S.Remove(i, j);
                        if (str == "keyence")
                        {
                            Console.WriteLine("YES");
                            return;
                        }
                    }
                    
                }
            }
        }
        Console.WriteLine("NO");


        Console.ReadLine();
    }

    

    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<long> SplittedStringToInt64List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 2;
    public const long LONGINF = long.MaxValue / 2;

    public static int Max(params int[] values)
    {
        var maxes = -1;
        for (int i = 0; i < values.Length; i++)
        {
            maxes = Math.Max(values[i], maxes);
        }
        return maxes;
    }

    public static void PrintArray(int[,] array)
    {
        for (int i = 0; i < array.GetLength(0); i++)
        {
            var sb = new StringBuilder();
            for (int j = 0; j < array.GetLength(1); j++)
            {
                sb.Append(array[i, j]).Append(" ");
            }
            Console.WriteLine(sb.ToString());
        }
    }
    // public static int[]

    #endregion
}



Measured memory_bytes: 13140
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var ar = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var dic = new Dictionary<int, int>();
        for (var i = 0; i < num; i++)
            if (dic.ContainsKey(ar[i])) dic[ar[i]]++;
            else dic[ar[i]] = 1;
        dic = dic.OrderByDescending(t => t.Key).ToDictionary(t => t.Key, t => t.Value);
        var res1 = 0L;
        var res2 = 0L;
        foreach(var vt in dic)
        {
            var val = vt.Value;
            while (val > 1)
            {
                if (res1 == 0) res1 = vt.Key;
                else if (res2 == 0) res2 = vt.Key;
                else break;
                val /= 2;
            }
            if (res1 != 0 && res2 != 0) break;
        }
        WriteLine(res1 * res2);
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 26464
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
int main() {
  string s;
  cin >> s;
  int yy = (s[0] - '0') * 10 + s[1] - '0';
  int mm = (s[2] - '0') * 10 + s[3] - '0';
  bool a = 0, b = 0;
  if (mm >= 1 && mm <= 12)
    a = 1;
  swap(mm, yy);
  if (mm >= 1 && mm <= 12)
    b = 1;
  if (a && b) {
    cout << "AMBIGUOUS" << endl;
  } else if (a) {
    cout << "YYMM" << endl;
  } else if (b) {
    cout << "MMYY" << endl;
  } else
    cout << "NA" << endl;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

def asdf():
    if abs(a - b) > k: return False
    if abs(a - c) > k: return False
    if abs(a - d) > k: return False
    if abs(a - e) > k: return False
    if abs(b - c) > k: return False
    if abs(b - d) > k: return False
    if abs(b - e) > k: return False
    if abs(c - d) > k: return False
    if abs(c - e) > k: return False
    if abs(d - e) > k: return False
    return True

print("Yay!" if asdf() else ":(")


Measured memory_bytes: 3064
#include<iostream>
#include<set>
using namespace std;
int main() {
    string s; cin >> s;
    int k; cin >> k;
    set<string> v;
    for (int i = 1; i <= k; ++i) { //個数 超長い文字列insertする意味ない
        for (int j = 0; i + j <= s.size(); ++j) { //j <= s.size() - i 要は最後まで
            v.insert(s.substr(j, i));
        }
    }
    auto p = v.begin();
    for (int i = 0; i < k - 1; ++i) p++;
    cout << *p << endl;
    return 0;
}


Measured memory_bytes: 1664
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.IO;

class Program
{
    static void Main()
    {
        new Magatro().Solve();
    }
}

public class Scanner
{
    private StreamReader Sr;

    private string[] S;
    private int Index;
    private const char Separator = ' ';

    public Scanner(Stream source)
    {
        Index = 0;
        S = new string[0];
        Sr = new StreamReader(source);
    }

    private string[] Line()
    {
        return Sr.ReadLine().Split(Separator);
    }

    public string Next()
    {
        string result;
        if (Index >= S.Length)
        {
            S = Line();
            Index = 0;
        }
        result = S[Index];
        Index++;
        return result;
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public decimal NextDecimal()
    {
        return decimal.Parse(Next());
    }
    public string[] StringArray(int index = 0)
    {
        Next();
        Index = S.Length;
        return S.Skip(index).ToArray();
    }
    public int[] IntArray(int index = 0)
    {
        return StringArray(index).Select(int.Parse).ToArray();
    }
    public long[] LongArray(int index = 0)
    {
        return StringArray(index).Select(long.Parse).ToArray();
    }
    public bool EndOfStream
    {
        get { return Sr.EndOfStream; }
    }
}

public class Magatro
{
    int N, M;
    int[] a, b, c, d;
    private void Scan()
    {
        var cin = new Scanner(Console.OpenStandardInput());
        N = cin.NextInt();
        M = cin.NextInt();
        a = new int[N];
        b = new int[N];
        for (int i = 0; i < N; i++)
        {
            a[i] = cin.NextInt();
            b[i] = cin.NextInt();
        }
        c = new int[M];
        d = new int[M];
        for (int i = 0; i < M; i++)
        {
            c[i] = cin.NextInt();
            d[i] = cin.NextInt();
        }
    }

    public void Solve()
    {
        Scan();
        for (int i = 0; i < N; i++)
        {
            int point = -1;
            int min = int.MaxValue;
            for (int j = 0; j < M; j++)
            {
                int dist = Dist(a[i], b[i], c[j], d[j]);
                if (min > dist)
                {
                    min = dist;
                    point = j + 1;
                }
            }
            Console.WriteLine(point);
        }
    }

    private int Dist(int x1, int y1, int x2, int y2)
    {
        return Math.Abs(x1 - x2) + Math.Abs(y1 - y2);
    }
}

Measured memory_bytes: 11220
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)
#define INF (1001001001)
#define EPS (1e-15)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define pra(x) do{rep(__i,(x).size()) pri(x,__i);}while(0)
#define pran(x,n) do{rep(__i,n) pri(x,__i);}while(0)
#define pral(x) do{cerr << (#x) << " =";rep(__i,(x).size()) cerr<<" "<<(x[__i]);cerr<<endl;}while(0)
#define prar(x,b,e) do{repr(__i,b,e) pri(x,__i);}while(0)

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool CHMAX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool CHMIN(T &l,const T &r){return l>r?l=r,1:0;}

ll MOD = 1000000007;

function<void(int,int)> tensi_no_3p=[&](int v,int d){
};

int in() {
	int a;
	scanf("%d ", &a);
	return a;
}

ll inv(ll a) {
	ll ret = 1;
	ll t = a;
	ll n = MOD - 2;
	while (n > 0) {
		if (n % 2 == 1) ret = (ret * t) % MOD;
		t = t * t % MOD;
		n /= 2;
	}
	return ret;
}

int main() {
	assert(inv(42) * 42 % MOD == 1);
	ll N;
	cin >> N;
	ll minN = (N + 1) / 2;
	vector<ll> cums(N + 1);
	vector<ll> fact(N + 1);
	fact[0] = 1;
	repr(i, 1, N) fact[i] = fact[i - 1] * i % MOD;
	cums[minN] = fact[minN - 1] * fact[minN] % MOD * inv(fact[2 * minN - N]) % MOD;
	repr(k, minN, N - 2) {
		cums[k + 1] = cums[k] * k % MOD * (k + 1) % MOD * inv(2 * k - N + 1) % MOD * inv(2 * k - N + 2) % MOD;
	}
	//pra(cums);
	ll ans = 0;
	repr(k, 1, N - 1) {
		ans += k * (cums[k] - cums[k - 1] + MOD) % MOD;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}

int hoge() {
	int N;
	cin >> N;
	vint P(N - 1);
	rep(i, N - 1) P[i] = i;
	ll ans = 0;
	do {
		vint box(N);
		int n = 0;
		int i;
		for (i = 0; i < N - 1; i++) {
			if (box[P[i]] == 0) n++, box[P[i]]++;
			if (box[P[i] + 1] == 0) n++, box[P[i] + 1]++;
			if (n == N) break;
		}
		ans = (ans + i + 1) % MOD;
	} while (next_permutation(P.begin(), P.end()));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 15872
package main

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

// Scan Standard Input
var sc = bufio.NewScanner(os.Stdin)

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

func main() {

	n, _ := strconv.Atoi(nextLine())
	xs := strings.Split(nextLine(), " ")
	ys := strings.Split(nextLine(), " ")

	M := manhattan(xs, ys, n)
	E := euclid(xs, ys, n)
	M3 := minkowski_3(xs, ys, n)
	C := chebychev(xs, ys, n)

	fmt.Printf("%.8f\n", M)
	fmt.Printf("%.8f\n", E)
	fmt.Printf("%.8f\n", M3)
	fmt.Printf("%.8f\n", C)
}

func manhattan(xs, ys []string, n int) (distance float64) {
	for i := 0; i < n; i++ {
		x, _ := strconv.ParseFloat(xs[i], 64)
		y, _ := strconv.ParseFloat(ys[i], 64)

		distance += math.Abs(x - y)
	}
	return
}

func euclid(xs, ys []string, n int) (distance float64) {
	tmp := 0.0
	for i := 0; i < n; i++ {
		x, _ := strconv.ParseFloat(xs[i], 64)
		y, _ := strconv.ParseFloat(ys[i], 64)

		a := math.Abs(x - y)
		tmp += a * a
	}
	distance = math.Sqrt(tmp)
	return
}

func minkowski_3(xs, ys []string, n int) (distance float64) {
	tmp := 0.0
	for i := 0; i < n; i++ {
		x, _ := strconv.ParseFloat(xs[i], 64)
		y, _ := strconv.ParseFloat(ys[i], 64)

		a := math.Abs(x - y)
		tmp += a * a * a
	}
	distance = math.Pow(tmp, 1.0/3.0)
	return
}

func chebychev(xs, ys []string, n int) (distance float64) {

	for i := 0; i < n; i++ {
		x, _ := strconv.ParseFloat(xs[i], 64)
		y, _ := strconv.ParseFloat(ys[i], 64)

		a := math.Abs(x - y)
		if distance < a {
			distance = a
		}
	}
	return
}



Measured memory_bytes: 1152
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <tuple>

#define INF 10010010010
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

 
int main(){
    int a, b ,t;
    cin >> a >> b >> t;
    int ans = t/a * b;
    cout << ans << endl;
    
}


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

int k;
long long int n;
long long int num=0;
int r1,d1;

int main(){

    cin>>n>>k;

if(k==0){
    num=n*n;
}
else{
    for(int i=k+1;i<=n;i++){
        r1=n%i;
        d1=n/i;
        num+=(d1*(i-k)+max(r1-k+1,0));
    }
}

   
    cout<<num<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MAX max<ll>
#define MIN min<ll>
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define drop(x) cout << (x) << '\n', exit(0)
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vector<ll>> vec2;
typedef vector<vector<vector<ll>>> vec3;
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 devc(ll x, ll y) { return (x + y - 1) / y; }

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

    ll N, C;
    cin >> N >> C;
    vec2 grid(N, vec(N));
    vec2 D(C, vec(C));
    rep(i, C) rep(j, C) cin >> D[i][j];
    rep(i, N) rep(j, N) cin >> grid[i][j], --grid[i][j];

    map<ll, ll> x0, x1, x2;
    rep(i, N) rep(j, N){
        if((i + j) % 3 == 0) ++x0[grid[i][j]];
        else if((i + j) % 3 == 1) ++x1[grid[i][j]];
        else ++x2[grid[i][j]];
    }

    ll ans = INF;
    rep(i, C) rep(j, C) rep(k, C){
        if(i == j or j == k or k == i) continue;
        ll tot = 0;
        for(auto x : x0){
            ll c = x.first, v = x.second;
            tot += D[c][i] * v;
        }
        for(auto x : x1){
            ll c = x.first, v = x.second;
            tot += D[c][j] * v;
        }      
        for(auto x : x2){
            ll c = x.first, v = x.second;
            tot += D[c][k] * v;
        }   

        chmin(ans, tot);
    }
    print(ans);

    return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
long double EPS=1E-8;
////////////////////////////////////////

bool prime(ll n){
    for(ll i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }return true;
}

int main(){
    ll N=55555;
    vector<ll>v;
    rep(i,2,N){
        if(prime(i)&&i%5==1)v.pb(i);
    }
    ll n;cin>>n;
    rep(i,0,n-1)cout<<v[i]<<" ";
    
    return 0;
}




Measured memory_bytes: 256
import std.stdio;
import std.regex;

void main(){
	auto io = new IO();
	
	auto N = io.line()[0];
	auto K = io.line()[0];
	auto X = io.line()[0];
	auto Y = io.line()[0];
	
	size_t fee = 0;
	
	if( N>K ){
		fee += K*X;
		fee += (N-K)*Y;
	}else{
		fee += N*X;
	}
	writeln(fee);
	return;
}

import std.stdio,std.conv,std.string;
import std.algorithm,std.array,std.math;

immutable PRIME = 1_000_000_007;
immutable alphaB = "abcdefghijklmnopqrstuvwxyz";
immutable alphaU = "ABCDRFGHIJKLMNOPQRSTUVWXYZ";
class IO
{
	T[] line( T = size_t , string token = " " )( size_t m = 1 ){
		T[] arr = [];
		foreach( i ; 0..m ){
			arr ~= this.read!T();
		}
		return arr;
	}
	T[][] rect( T = size_t , string token = " " )( size_t m = 1 ){
		T[][] arr = new T[][](m);
		foreach( i ; 0..m ){
			arr[i] = this.read!T(token);
		}
		return arr;
	}
	private T[] read( T = size_t )( string token = " " ){
		T[] arr;
		foreach( elm ; readln().chomp().split(token) ){
			arr ~= elm.to!T();
		}
		return arr;
	}
	void swap( T )( ref T x , ref T y ){
		x = x^y;
		y = x^y;
		x = x^y;
	}
}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define sz(s) ((int) ((s).size()))

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

typedef long long ll;
typedef long double ld;

const int inf = (int) 1.01e9;
const ld eps = 1e-11;
const ld pi = acos(-1.0L);

mt19937 mrand(random_device{} ());
int rnd(int x) {
  return mrand() % x;
}

const int mod = (int) 1e9 + 7;

void add(int & x, int y) {
  if ((x += y) >= mod) {
    x -= mod;
  }
}

int sum(int x, int y) {
  add(x, y);
  return x;
}

int mult(int x, int y) {
  return (ll) x * y % mod;
}

int power(int x, ll p) {
  int res = 1;
  while (p) {
    if (p & 1) {
      res = mult(res, x);
    }
    x = mult(x, x);
    p >>= 1;
  }
  return res;
}

int inv(int x) {
  return power(x, mod - 2);
}

void precalc() {
}

const int maxn = 1e6 + 100;
int n, m;
int cnt[maxn];

bool read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return false;
  }
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--, b--;
    cnt[a]++, cnt[b]++;
  }
  return true;
}

void solve() {
  bool ok = true;
  for (int i = 0; i < n; i++) {
    if (cnt[i] & 1) {
      ok = false;
      break;
    }
  }
  printf(ok ? "YES\n" : "NO\n");
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen("text.in", "r", stdin));
  assert(freopen("text.out", "w", stdout));
#endif

  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time: %.3f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}



Measured memory_bytes: 4096
n = int(input())
ans = 1
flag = 0
A = map(int,input().split())
A = list(A)
list.sort(A)
for a in A:
    ans *= a
    if ans == 0:
        print(0)
        flag = 1
        break
    if ans > 1e18:
        print(-1)
        flag = 1
        break

if flag == 0:
    print(ans)



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

bool is_prime[100000];
double prime[10000];

int main() {
	memset(is_prime, 1, sizeof(is_prime));
	is_prime[0] = is_prime[1] = false;
	int p = 0;
	for (int i = 2; i < 100000; i++) {
		if (is_prime[i]) {
			prime[p++] = i;
			for (int j = i * 2; j < 100000; j += i)is_prime[j] = false;
		}
	}
	int m; double a, b;
	while (scanf("%d%lf%lf", &m, &a, &b), m) {
		int Max = 0, P, Q;
		for (int i = 0; prime[i] * prime[i] <= m; i++) {
			int j = upper_bound(prime, prime + p, prime[i] / a*b) - prime - 1;
			int k = upper_bound(prime, prime + p, m / prime[i]) - prime - 1;
			j = min(j, k);
			if (j < 0)continue;
			if (Max < prime[i] * prime[j] && prime[j] / (double)prime[i] >= a / b) {
				Max = prime[i] * prime[j]; P = prime[i]; Q = prime[j];
			}
		}
		printf("%d %d\n", P, Q);
	}
}

Measured memory_bytes: 3280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846264338327950;
inline int newline() { putchar('\n'); return 0; }

int main() {
    ll n, k;
    cin(n); cin(k);

    vector<ll> a(n);
    rep2(i, n) cin(a[i]);

    ll left = 0, right = 1e9;

    while (left + 1 < right) {
        ll center = (left + right) / 2;

        ll count = 0;
        ll ok = true;

        rep2(i, n) {
            count += ceil(double(a[i]) / double(center)) - 1;
            if (count > k) {
                ok = false;
                break;
            }
        }

        if (ok) right = center;
        else left = center;
    }

    print(right);
    return 0;
}

Measured memory_bytes: 4844
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
const int maxn = 1000010;
const int inf = 1e9;
/*** TEMPLATE CODE * * STARTS HERE ***/
int n, k, s;
int main()
{
	//freopen("D:\\code\\text\\input.txt","r",stdin);
	//freopen("D:\\code\\text\\output.txt","w",stdout);
	n = readint();
	k = readint();
	s = readint();
	repd(i, 1, n)
	{
		if (k)
		{
			printf("%d%c", s, i == n ? '\n' : ' ' );
			k--;
		} else
		{
			if (s == inf)
			{
				printf("%d%c", inf - 1, i == n ? '\n' : ' ' );
			} else
			{
				printf("%d%c", inf, i == n ? '\n' : ' ' );
			}
		}
	}
	return 0;
}




Measured memory_bytes: 1280
input = gets.chomp.split(" ").map{|i|i.to_i}
a = input[0] - 1 
b = input[1]
c = input[2]
d = input[3]
k=c.lcm(d)
m = b - b/c - b/d + b/k
n = a - a/c - a/d + a/k
ans = m - n
print ans

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<pair<int, int>> c;
    for(int i = 0; i < m; i++){
        int a,b;
        cin >> a >> b;
        if(a > b){
            c.push_back(make_pair(a, b));
        }
        else{
            c.push_back(make_pair(b, a));
        }
    }
    sort(c.begin(),c.end());
    int now = 0;
    int ans = 0;
    for(int i = 0; i < m; i++){
        if(now <= c[i].second){
            now = c[i].first;
            ans++;
        }
    }
    cout << ans << endl;
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{
	int A, B, C;
	cin >> A >> B >> C;
	ce(max(C-(A-B),0))
    return 0;
}



Measured memory_bytes: 256
"""
https://atcoder.jp/contests/abc136/tasks/abc136_e
"""

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


def calc_divisor(x):
    divisor = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            divisor.append(i)
            if i != x // i:
                divisor.append(x // i)
    return divisor


divisor = calc_divisor(sum(X))
ans = 0
for v in divisor:
    cand = sorted(x % v for x in X)
    cs1 = [0] * (N + 1)
    for i in range(N):
        cs1[i + 1] = cs1[i] + cand[i]

    cs2 = [0] * (N + 1)
    for i in reversed(range(N)):
        cs2[i] = cs2[i + 1] + v - cand[i]

    for a, b in zip(cs1, cs2):
        if a <= K and a == b:
            ans = max(ans, v)
            break

print(ans)


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

int main()
{
    int n, l;
    cin >> n >> l;
    string s[n];
    for (int i = 0; i < n; i++)
    {
        cin >> s[i];
    }

    sort(s, s + n);

    for (int i = 0; i < n; i++)
    {
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256