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

class Main{
	static Scanner s=new Scanner(System.in);
	public static void main(String[] $){
		int n=s.nextInt(),k=s.nextInt();
		int[]x=new int[n],y=new int[n];
		for(int i=0;i<n;++i) {
			x[i]=s.nextInt();
			y[i]=s.nextInt();
		}
		long res=Long.MAX_VALUE;
		for(int i=0;i<n;++i) {
			for(int j=i+1;j<n;++j) {
				long l=Math.min(x[i],x[j]);
				long r=Math.max(x[i],x[j]);
				
				for(int p=0;p<n;++p) {
					for(int q=p+1;q<n;++q) {
						long t=Math.min(y[p],y[q]);
						long b=Math.max(y[p],y[q]);
						
						int c=0;
						for(int o=0;o<n;++o) {
							if(l<=x[o]&&x[o]<=r&&t<=y[o]&&y[o]<=b){
								++c;
							}
						}
						if(c>=k)
							res=Math.min(res,(r-l)*(b-t));
					}
				}
			}
		}
		System.out.println(res);
	}
}


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

int main()
{
	int a,b[100],c,d;
	cin>>a;
	d=c=0;

	for(int i=0;i<a;i++)
	{
		cin>>b[i];
		d+=b[i];
		c=(c>=b[i]?c:b[i]);
	}
	if(c<d-c){cout<<"Yes";}
	else{cout<<"No";}
}

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

int main() {
  string x;
  cin >> x;
  string a = "AAA";
  string b = "BBB";

  if (x == a || x == b) {
    cout << "No" << endl;
  }

  else {
  cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N; cin >> N;
  int sum = 0;
  vector<int> W(N);
  cin >> W.at(0);
  
  for(int i = 1; i < N; ++i){
    int x; cin >> x;
    W.at(i) = W.at(i-1) + x; 
  }
  
  int min_ans = 100000;
  for(int i = 0; i < N; ++i){
    if(W.at(i) >= W.at(N-1) - W.at(i)) min_ans = min(min_ans, W.at(i) * 2 - W.at(N-1));
    if(W.at(i) < W.at(N-1) - W.at(i)) min_ans = min(min_ans, W.at(N-1) - W.at(i) * 2);
  }
  
  cout << min_ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int k,s; cin>>k>>s;
  int ans=0;
  rep(x,k+1){
    rep(y,k+1){
      int z=0;
      z=s-x-y;
      if(0<=z&&z<=k) ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]
    def find(self, x):
        """
        x が属するグループを探索して親を出す。
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]
    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)
    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]


N,M = map(int,input().split())
R = []
for i in range(M):
  a,b = map(int,input().split())
  a-=1;b-=1
  R.append((a,b))

R.reverse()
#print(R)
uf = UnionFind(N)
ans = [N*(N-1)//2]
for i in range(M-1):
  a,b = R[i]
  if uf.is_same(a,b):
    ans.append(ans[-1]);continue
  temp = ans[-1] - uf.get_size(a)*uf.get_size(b)
  ans.append(temp)
  uf.union(a,b)
ans.reverse()
print(*ans,sep="\n")

Measured memory_bytes: 99772
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        Integer[] button = {a, b, a - 1, b - 1};

        Arrays.sort(button);
        int result = button[3] + button[2];

        System.out.println(result);
    }
}

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


int main(){
	string s;
	cin >> s;
	if( (s[0]!=s[2]&&s[0]==s[1]&&s[2]==s[3]) || (s[0]!=s[1]&&s[0]==s[2]&&s[1]==s[3]) || (s[0]!=s[1]&&s[0]==s[3]&&s[1]==s[2]) ) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    typedef long long ll;
    #define pr pair<int,int>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    #define GG(x) if(x) puts("error")
    #define rep(i,l,r) for(int i=(l);i<=(r);i++)
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    inline int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> inline void add(T &x,const T y){x=mm(x+y);}
    inline ll qpower(ll x,ll e)
    {
        ll ans=1;GG(e<0);
        while(e){if(e&1)ans=ans*x%MOD;x=x*x%MOD;e>>=1;}return ans;
    }
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=1e6+10;

    struct DSU
    {
        int fa[N],siz[N];DSU(){for(int i=0;i<N;i++)fa[i]=i,siz[i]=1;}
        int findfa(int x){return x==fa[x]?x:fa[x]=findfa(fa[x]);}
        void merg(int fx,int fy){fa[fx]=fy;siz[fy]+=siz[fx];}
    }dsu,dsu2;
    vc<pr> A,B;
    void gg(){puts("No");exit(0);}
    void main()
    {
        int n=qread();ll m=qread();int q=qread();
        while(q--)
        {
            int x=qread()+1,y=qread()+1,op=qread();
            if(!op) A.PB(MP(x,y)); else B.PB(MP(x,y));
        }
        for(int t=0;t<sz(A);t++)
        {
            int x=A[t].FR,y=A[t].SE,fx=dsu.findfa(x),fy=dsu.findfa(y);if(fx!=fy) dsu.merg(fx,fy),m--;
        }
        for(int t=0;t<sz(B);t++)
        {
            int x=B[t].FR,y=B[t].SE,fx=dsu.findfa(x),fy=dsu.findfa(y);if(fx==fy) gg();
            fx=dsu2.findfa(fx),fy=dsu2.findfa(fy);if(fx!=fy) dsu2.merg(fx,fy);
        }
        ll cnt=0,mx=0;
        for(int i=1;i<=n;i++) if(dsu2.findfa(i)==i and dsu2.siz[i]==1 and dsu.findfa(i)==i) mx+=cnt,cnt++;
        for(int i=1;i<=n;i++) if(dsu2.findfa(i)==i and dsu2.siz[i]>2) m-=dsu2.siz[i],mx=mx+cnt*dsu2.siz[i]+1ll*dsu2.siz[i]*(dsu2.siz[i]-1)/2-dsu2.siz[i],cnt+=dsu2.siz[i];
        for(int i=1;i<=n;i++) if(dsu2.findfa(i)==i and dsu2.siz[i]==2) m-=3,mx=mx+2ll*(cnt-1),cnt+=2;
        if(m<0 or m>mx) gg();puts("Yes");
    }
};//(ans+MOD)%MOD
int main()
{
    srand(time(0));
    mine::main();
}


Measured memory_bytes: 17272
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e8;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	string s;
	while(cin >> s) {
		int n = s.size();
		unordered_map<int,int> dp;
		dp[0] = 0;
		using bs = bitset<26>;
		bs tmp = 0;
		int ans;
		REP(i,n){
			int c = s[i]-'a';
			tmp[c] = !tmp[c];
			int mi = INF;
			REP(i,n) {
			}
			REP(j,26){
				auto t = tmp;
				t[j] = !t[j];
				auto ite = dp.find(t.to_ulong());
				if(ite != dp.end()) {
					chmin(mi, ite->S+1);
				}
			}
			{
				auto ite = dp.find(tmp.to_ulong());
				if(dp.find(tmp.to_ulong()) != dp.end()){
					chmin(mi,ite->S+1);
				}
			}
			ans = mi;

			{
				auto ite = dp.find(tmp.to_ulong());
				if(ite == dp.end()) {
					dp[tmp.to_ulong()] = mi;
				}
			}
			chmin(dp[tmp.to_ulong()], mi);
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 8668
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2,tune=native")

#include <x86intrin.h>
#include <bits/stdc++.h>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin >> S;
    int even, odd;
    even = odd = 0;
    for (int i = 0; i < S.length(); i++) {
	if(!(i % 2) && S[i] == '1') even++;
	if(i % 2 && S[i] == '1') odd++;
    }
    if (even <= odd) cout << (S.length() >> 1) - odd + even;
    else cout << (S.length() >> 1) + odd - even + (S.length() % 2);
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    string S;
    int Q;
    bool flag = true;

    cin >> S >> Q;

    string be = "", af = "";
    rep(i, Q) {
        int q;
        cin >> q;
        if (q == 2) {
            int F;
            char C;
            cin >> F >> C;
            if (F == 1) {
                if (flag) {
                    be += C;
                }
                else {
                    af += C;
                }
            }
            else {
                if (flag) {
                    af += C;
                }
                else {
                    be += C;
                }
            }
        }
        else {
            flag = (flag ? false : true);
        }
    }

    string ans = "";
    if (flag) {
        reverse(all(be));
        cout << be << S << af << endl;
    }
    else {
        reverse(all(af));
        reverse(all(S));
        cout << af << S << be << endl;
    }

    return 0;
}

Measured memory_bytes: 1088
#include<bits/stdc++.h>
#define LL long long
#define REP(i, n) for(int i=0;i<(n);++i)
#define REPA(i, n) for(int i=1;i<(n);++i)
#define lp(i, n) for(int i=-;i<(n);++i)
#define PII pair<int, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define DEKAI ((int)1e9+7)
#define ALL(x) (x).begin(), (x).end()
#define BIT(x) (1<<(x))
#define foreach(i, n) for(auto &i:(n))
using namespace std;

int main(){
  while(1){
    string s,t,a;
    cin>>t;
    if(t=="-") break;
    cin>>s>>a;
    int sit=0,tit=0,ait=0;
    while(ait!=a.size()){
      if(s[sit]!=a[ait]){
	cout<<s[sit];
	sit++;
      }
      else{
	sit++;
	ait++;
	while(tit!=t.size()){
	  if(t[tit]==a[ait]){
	    ait++;
	    tit++;
	  }
	  else{
	    cout<<t[tit];
	    tit++;
	    break;
	  }
	}
      }
    }
    for(int i=sit;i<s.size();i++){
      cout<<s[i];
    }
    for(int i=tit;i<t.size();i++){
      cout<<t[i];
    }
    cout<<endl;
  }
  return 0;
}



Measured memory_bytes: 3216
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("1118");
            //Yes
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("7777");
            //Yes
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("1234");
            //No
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        string N = InputList[0];

        if (Regex.IsMatch(N, @"([0-9])\1\1"))
            Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
}


Measured memory_bytes: 15960
/********************    I am only one, but still I am one.    **************************************/
/**************    I cannot do everything, but still I can do something.    *************************/
/***   And because I cannot do everything I will not refuse to do the something that I can do.    ***/
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) {cerr << (#x) <<"="<< x << endl;}
#define bug2( x , y ) {cerr << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;}
#define bug3( x , y , z ) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;}
#define bug4( x , y , z , w) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;}
#define bug5( x , y , z , w ,p) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;}
#define bug6( x , y , z , w ,p , q) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;}
#define bugn( x , n ) {cerr << (#x) <<":";for(int i=0;i<n;i++)cerr << x[i] <<"  "; cerr << endl;}
#define bugnm( x , n , m ) {cerr << (#x)<<endl;for(int i=0;i<n;i++){cerr << "Row #" << i<< ":";for(int j=0;j<m;j++)cerr << x[i][j] << "   ";cerr << endl;}}
typedef long long ll;
typedef long double ld;
using namespace std;

struct box{
	int v,d,c;
};
const int maxn = 1e5+5;
vector<int>g[maxn],lst(maxn),clr(maxn);
int vis[maxn][11];
vector<box>q(maxn);
int n,m,t;
void dfs(int u,int d,int c){
	if( vis[u][d] )return;
	vis[u][d]=1;
	if( !clr[u] ){
		clr[u] = c;
	}
	if(d == 0 )return;
	for(auto v:g[u]){
		dfs(v,d-1,c);
	}
}
int32_t main(){
	IOS
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int u,v;cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	cin>>t;
	for(int i=1;i<=t;i++){
		cin>>q[i].v>>q[i].d>>q[i].c;
	}
	reverse(q.begin()+1,q.begin()+t+1);
	memset(vis,0,sizeof(vis));
	for(int i=1;i<=t;i++){
		dfs(q[i].v,q[i].d,q[i].c);
	}
	for(int i=1;i<=n;i++){
		cout << clr[i] << endl;
	}
	
	
}
/*
 * long long or int?
 * index out of bound? 
 * Tested on own test case?corner?
 * Make more general solution.
 * Read Read Read Read ....
 */


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

int dp[100005];

int main() {
	int n; cin >> n;
	for (int i = 0; i < 100005; i++)dp[i] = 0;

	int x = 1, y = 6, z = 9;
	for (int i = 1; i <= n; i++) {
		if (i >= y * 6)y *= 6;
		if (i >= z * 9)z *= 9;
		if (i < 6)dp[i] = i;
		else if (i < 9) dp[i] = min(dp[i - x] + 1, dp[i - y] + 1);
		else  dp[i] = min({ dp[i - x] + 1,dp[i - y] + 1,dp[i - z] + 1 });
	}
	cout << dp[n] << endl;

	return 0;
}

Measured memory_bytes: 3852
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];
int d[100100];
ll rec(int num) {
	if (num == 0) return 0;
	return rec(num - 1) + num;
}
ll gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll calc(ll b,ll n) {
	if (n < b) return n;
	return calc(b, n / b) + n % b;
}
string fn(string s,int n,char p,bool t){

	string res(n, ' ');
	res[0] = p;
	if (t) {
		res[1] = 'S';
	}
	else {
		res[1] = 'W';
	}

	for (int i = 1; i < n ; i++)
	{
		char necc;
		if ((s[i] == 'o' && res[i] == 'S') ||
			(s[i] == 'x' && res[i] == 'W')) {
			necc = res[i - 1];
		}

		if((s[i] == 'x' && res[i] == 'S') ||
			(s[i] == 'o' && res[i] == 'W')){
			necc = (res[i - 1] == 'W') ? 'S' : 'W';
		}

		int next = (i + 1) % n;
		if (next == 0) {
			if (res[0] != necc) return "-1";
		}
		else {
			res[next] = necc;
		}
	}


	if (s[0] == 'o') {
		if ((res[0] == 'S' && res[1] == res[n - 1]) ||
			(res[0] == 'W' && res[1] != res[n - 1])) {
			return res;
		}
		else return "-1";
	}
	else {
		if ((res[0] == 'W' && res[1] == res[n - 1]) ||
			(res[0] == 'S' && res[1] != res[n - 1])) {
			return res;
		}
		else return "-1";
	}

}
void Solve() {

	int n;
	cin >> n;
	string s;
	cin >> s;
	string res = fn(s, n, 'S', true);
	if (res != "-1") {
		cout << res << endl;
		return;
	}
	res = fn(s, n, 'S', false);
	if (res != "-1") {
		cout << res << endl;
		return;
	}
	res = fn(s, n, 'W', true);
	if (res != "-1") {
		cout << res << endl;
		return;
	}
	res = fn(s, n, 'W', false);
	cout << res << endl;
}


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



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


int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,m,ans=1;
    cin>>n>>m;
    
    forx(i,1,m/2+1){
        if(m%i==0)if(m/i>=n)ans=i;
    }
    if(n==1)ans=m;
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public void Run()
        {
            N = Input.ReadInt();
            bool success = false;
            for (int i = 0; i < 30; i++)
            {
                for (int j = 0; j < 30; j++)
                {
                    if (i * 4 + j * 7 == N) success = true;
                }
            }

            Console.WriteLine(success ? "Yes" : "No");
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13140
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define vi vector<int>
#define printv(v) for(int i = 0;i < v.size();i++)P(v[i]);
#define printt(a,b) cout << a << " " << b << endl; 
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0};
int dy[] = { 0,  0,  1, -1};
int MOD = 1e9 + 7;

void solve() {
    double a,b;
    cin >> a >> b;
    sP(a/b);
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
#define MP make_pair
#define PB push_back
#define SZ(a) ((int)a.size())
typedef long long ll;

ll a, b;

ll fac (ll i) {
        ll r = 1;
        for (int j = 2; j <= i; j++) {
                r = r * j % MOD;
        }
        return r;
}

int main () {
        scanf("%lld %lld", &a, &b);
        if (abs(a-b) > 1) {
                puts("0");
                return 0;
        }
        ll x = fac(a) * fac(b) % MOD;
        if (a == b) x = x * 2 % MOD;
        printf("%lld\n", x);
        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define NL << endl
using namespace std;
using ll = long long;
int INFINT = 1 << 30;
ll INFLL = 1LL << 60;
int gcd(int a, int b) {return b ? gcd(b, a%b) : a;}

int main() {

	int n;
	int ans = 0;
	map<int, int> a;
			
	cin >> n;

	REP(i, n) {
		int t;
		cin >> t;
		a[t]++;
	}

	for(auto m : a) {
		if (m.first > m.second) {
			ans += m.second;
		}
		else {
			ans += m.second - m.first;
		}
	}

	ans = min(ans, n);

	cout << ans NL;

	return 0;

}


Measured memory_bytes: 4736
import math


def combi(a, b):
    ans = math.factorial(a) / (math.factorial(a - b) * math.factorial(b))
    return ans


N = int(input())
S = [0] * 5

for i in range(N):
    s = input()
    temp = s[0]
    if temp == "M":
        S[0] += 1
    elif temp == "A":
        S[1] += 1
    elif temp == "R":
        S[2] += 1
    elif temp == "C":
        S[3] += 1
    elif temp == "H":
        S[4] += 1

c = 0
N = 0
for i in range(5):
    N += S[i]
    if S[i] != 0:
        c += 1

if c <= 2:
    print(0)

else:
    ans = 0
    for i in range(3):
        for j in range(i + 1, 4):
            for k in range(j + 1, 5):
                ans += S[i] * S[j] * S[k]
    print(ans)


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

// Segment tree {{{
// O(N) 構築
// O(log(N)) update, query
// verified AOJ DSL_2_A
template <typename T>
struct SGT {
    vector<T> v;
    int n;
    T init;
    function<T(T, T)> f;
    SGT(vector<T> a, T init, function<T(T, T)> f){
        int m = a.size();
        n = 1;
        while(n < m) n <<= 1;
        this->init = init;
        this->f = f;
        v.resize(2*n-1, init);
        for(int i=0;i<m;i++) v[n-1+i] = a[i];
        for(int i=n-2;i>=0;i--) v[i] = f(v[i*2+1], v[i*2+2]);
    }
    void update(int i, T x) {
        i += n-1;
        v[i] = x;
        while(i>0){
            i = (i-1)/2;
            v[i] = f(v[i*2+1], v[i*2+2]);
        }
    }
    T query(int a, int b, int k, int l, int r) {
        if(r <= a || b <= l) return init;
        if(a <= l && r <= b) return v[k];
        T vl = query(a, b, k*2+1, l, (l+r)/2);
        T vr = query(a, b, k*2+2, (l+r)/2, r);
        return f(vl, vr);
    }
    T query(int a, int b) {
        return query(a, b, 0, 0, n);
    }
};
// }}}

// 座標圧縮 {{{
// O(N*log(N))
template <typename T>
vector<int> compress(vector<T> v){
    int n = v.size();
    vector<int> res(n);

    auto u = v;
    sort(u.begin(), u.end());
    map<T, int> m;

    T b = u[0];
    int now = 0;
    inc(i, 0, n){
        if(b != u[i]) now++;
        m[u[i]] = now;
        b = u[i];
    }

    inc(i, 0, n){
        res[i] = m[v[i]];
    }

    return res;
}// }}}


int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    LL n;cin >> n;
    LL k;cin >> k;
    vector<LL> a(n);
    inc(i, 0, n) cin >> a[i];

    vector<LL> b(n+1, 0);
    inc(i, 0, n){
        b[i+1] = b[i] + a[i];
    }
    inc(i, 0, n+1){
        b[i] -= i*k;
    }

    auto c = compress(b);
    //inc(i, 0, n+1){
        //cout << b[i] << endl;
    //}
    //cout << endl;
    //inc(i, 0, n+1){
        //cout << c[i] << endl;
    //}

    vector<LL> cnt(n+1, 0);
    SGT<LL> sgt(cnt, 0, [](LL a, LL b){return a+b;});

    LL ans = 0;

    inc(i, 0, n+1){
        ans += sgt.query(0, c[i]+1);

        auto d = sgt.query(c[i], c[i]+1);
        sgt.update(c[i], d+1);
    }

    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 19840
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int k;
	cin>>k;
	string s;
	cin>>s;
	int a=s.size();
	if(a>k){
		string t=s.substr(0,k);
		t+="...";
		cout<<t<<endl;
	}
	else
	cout<<s<<endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define up(a,b) (((a)%(b)==0)?((a)/(b)):((a)/(b))+1)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) (a>b)?(a>c)?a:c:(b>c)?b:c
#define min3(a,b,c) (a<b)?(a<c)?a:c:(b<c)?b:c
#define avg(a,b) ((a)+(b))/2
#define push push_back
#define pop pop_back
#define mp make_pair
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
typedef long long ll;

ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll gcd(ll a, ll b)
{
    if(b==0)
    {
        return a;
    }
    return gcd(b, a%b);
}
bool prime[3001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=3000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=3000; i += p) 
                prime[i] = false; 
        } 
    } 
}
ll powe[20];
void power()
{
	powe[0]=1;
	REP(i,1,20)
	{
		powe[i]=(powe[i-1]*10)%num;
        if(powe[i]<0)
        powe[i]+=num;
	}
}
struct vertex
{
	vll adj;
};
void dfs(ll i,vertex V[], bool vis[], ll dist[])
{
	vis[i]=true;
	//cout<<i<<" ke liye\n";
	for(auto x : V[i].adj)
	{
		if(!vis[x])
		{
			dfs(x,V,vis,dist);
		}
		dist[i]=max(dist[i],1+dist[x]);
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    ll A[n];
    REP(i,0,n)
    {
        cin>>A[i];
    }
    ll dp[k+1];
    REP(i,0,A[0])
    {
        dp[i]=2;
    }
    REP(i,A[0],k+1)
    {
        sf;
        REP(j,0,n)
        {
            if(A[j]>i)
            break;
            if(dp[i-A[j]]==2)
            {
                flag++;
                break;     
            }
        }
        if(flag)
        {
            dp[i]=1;
        }
        else
        {
            dp[i]=2;
        }
    }
    if(dp[k]==1) cout<<"First\n";
    else cout<<"Second\n";
	return 0;
}




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

using namespace std;

const double ESP=1e-8;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
#define eq(a,b) a-b<ESP

double x[3],y[3];
double xp,yp;

int main(){
  while (cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp){
    bool r=false,l=false;
    REP(i,3){
      double ax,ay,bx,by;
      ax=x[(i+1)%3]-x[i];
      ay=y[(i+1)%3]-y[i];
      bx=xp-x[i];
      by=yp-y[i];
      if (ax*by-bx*ay<0){
	r=true;
      }
      else{
	l=true;
      }
    }
    cout<<(r^l ? "YES" : "NO")<<endl;
  }
  return 0;
}

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

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

ll dp[3030][3030][4];
ll v[3030][3030];

int main() {
    int r, c, k;
    cin >> r >> c >> k;

    rep(i, k) {
        int a, b, va;
        cin >> a >> b >> va;
        a--; b--;
        v[a][b] = va;
    }

    rep(i, 3030) rep(j, 3030) rep(k, 4) dp[i][j][k] = -INF;
    dp[0][0][0] = 0;

    rep(i, r) {
        rep(j, c) {
            for (int k = 2; k >= 0; --k) {
                if (dp[i][j][k] >= 0) {
                    dp[i][j][k+1] = max(dp[i][j][k+1], dp[i][j][k] + v[i][j]);
                }
            }

            rep(k, 4) {
                if (dp[i][j][k] >= 0) {
                    if (i + 1 < r) {
                        dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][k]);
                    }
                    if (j + 1 < c) {
                        dp[i][j+1][k] = max(dp[i][j+1][k], dp[i][j][k]);
                    }
                }
            }
        }
    }
    ll ans = -INF;
    rep(k, 4) ans = max(ans, dp[r-1][c-1][k]);
    cout << ans << endl;
}


Measured memory_bytes: 361408
#include <iostream>

using namespace std;

#define INPUT_MIN 0
#define INPUT_MAX 86400

int main()
{
	int inTime     = 0;		// Valiable for input time
	int outTime[3] = {0};	// Array for output time
	
	cin >> inTime;
	
	if( (INPUT_MIN > inTime) || (INPUT_MAX < inTime) )
	{
		return 1;
	}
	
	for(int i = 0; i < 2; i++)
	{
		outTime[2 - i] = inTime % 60;
		inTime /= 60;
	}
	
	outTime[0] = inTime;
	
	cout << outTime[0] << ":" << outTime[1] << ":" << outTime[2] << endl;
	
	return 0;
}


Measured memory_bytes: 3108
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main{

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int n = sc.nextInt();
            if (n == 0) {
                break;
            }
            int[][] sec = new int[n][2];
            for (int i = 0; i < sec.length; i++) {
                String s = sc.next();
                String t = sc.next();
                sec[i][0] = convert(s);
                sec[i][1] = convert(t);
            }

            if (true) {
                imos(sec);
                continue;
            }

            Arrays.sort(sec, new Comparator<int[]>() {
                @Override
                public int compare(int[] o1, int[] o2) {
                    if (o1[1] == o2[1]) {
                        return o1[0] - o2[0];
                    }
                    return o1[1] - o2[1];
                }
            });

            int ans = 1;
            for (int i = 0; i < sec.length; i++) {
                int cnt = 1;
                int ss = sec[i][0];
                for (int j = 0; j < sec.length; j++) {
                    if (i == j)
                        continue;
                    int s = sec[j][0];
                    int t = sec[j][1];
                    if ((s <= ss && ss < t)) {
                        cnt++;
                        continue;
                    }
                }
                ans = Math.max(ans, cnt);
                ss = sec[i][1];
                cnt = 1;
                for (int j = 0; j < sec.length; j++) {
                    if (i == j)
                        continue;
                    int s = sec[j][0];
                    int t = sec[j][1];
                    if ((s < ss && ss <= t)) {
                        cnt++;
                        continue;
                    }
                }
                ans = Math.max(ans, cnt);
            }
            System.out.println(ans);
        }
    }

    static void imos(int[][] sec) {
        List<int[]> list = new LinkedList<int[]>();
        for (int i = 0; i < sec.length; i++) {
            list.add(new int[] { sec[i][0], 1 });
            list.add(new int[] { sec[i][1], -1 });
        }
        Collections.sort(list, new Comparator<int[]>() {
            @Override
            public int compare(int[] o1, int[] o2) {
                if(o1[0]==o2[0]){
                    return o1[1]-o2[1];
                }
                return o1[0] - o2[0];
            }
        });
        int sum = 0;
        int ans = 0;
        for (int[] a : list) {
            sum+=a[1];
            ans=Math.max(ans,sum); 
                    
        }
        System.out.println(ans);

    }

    static int convert(String s) {
        String[] ss = s.split(":");
        int h = Integer.parseInt(ss[0]);
        int m = Integer.parseInt(ss[1]);
        int se = Integer.parseInt(ss[2]);
        return h * 3600 + m * 60 + se;
    }
}

Measured memory_bytes: 110048
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 C = sc.nextInt();
    
    System.out.println(A <= C && C <= B ? "Yes" : "No");
  }
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define N 200005
using namespace std;
struct edge{
    int t,next;
}e[N*2];int ecnt,head[N];
void addedge(int f,int t){
    e[++ecnt]=(edge){t,head[f]};head[f]=ecnt;
    e[++ecnt]=(edge){f,head[t]};head[t]=ecnt;
}
int dmn[N],pts[N];
int dis[2][N];//0>1
char s[N];int n;
long long ans;

void DFS1(int u,int fr){
    dmn[u]=s[u]=='1'? (pts[u]=1),0:1e9;
    for(int i=head[u];i;i=e[i].next)
        if(e[i].t!=fr){
            DFS1(e[i].t,u);
            pts[u]+=pts[e[i].t];
            int d=dis[0][e[i].t]+1;
            if(d>dis[0][u]) dis[1][u]=dis[0][u],dis[0][u]=d;
            else if(d>dis[1][u]) dis[1][u]=d;
            if(pts[e[i].t]!=0&&s[u]=='0') dmn[u]=min(dmn[u],d);
        }
}

void DFS2(int u,int fr,int d){
    if(d>dis[0][u]) dis[1][u]=dis[0][u],dis[0][u]=d;
    else if(d>dis[1][u]) dis[1][u]=d;
    if(pts[u]!=pts[1]) dmn[u]=min(dmn[u],d);
    ans+=max(0,min(dis[1][u]+1,dis[0][u]-1) - dmn[u] +1 );  
    for(int i=head[u];i;i=e[i].next){
        if(e[i].t!=fr){
            if(dis[0][u]==dis[0][e[i].t]+1) DFS2(e[i].t,u,dis[1][u]+1);
            else DFS2(e[i].t,u,dis[0][u]+1);
        }
    }      
}

int main(){
    scanf("%d",&n);
    for(int i=1,f,t;i<n;i++) scanf("%d%d",&f,&t),addedge(f,t);
    scanf("%s",s+1);
    DFS1(1,0);
    DFS2(1,0,0);
    cout<<ans+1<<endl;
    return 0;
}

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

int main() {
	long long int a[6];
	int min = 1;
	for(int i = 0; i < 6; i++) {
		scanf("%Ld", &a[i]);
		if((i > 0) && (a[i]< a[min])) min = i;
	}
	long long int ans;
	ans = (a[0] + a[min] - 1)/a[min] + 4;
	cout << ans;
	return 0;
};

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

using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL << 62)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
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 countDigit(ll n) { return floor(log10(n) + 1); } 
typedef pair <ll,ll> P;
static const ll dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    for (int i = 0; i < (int)v.size(); ++i) { 
        os << v[i]; 
        if (i != (int)v.size() - 1) 
            os << " "; 
    } 
    return os; 
} 

ll nCrModp(ll n, ll r, ll p)
{
    ll C[r+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;

    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, r); j > 0; j--)
            C[j] = (C[j] + C[j-1])%p;
    }
    return C[r];
}

int main()
{
    ll N, K;
    cin >> N >> K;
    ll cnt = 0;
    rep(i, N) {
        ll h;
        cin >> h;
        cnt += h >= K;
    }
    print(cnt);
    return 0;
}

Measured memory_bytes: 256
A,B,M = map(int, input().split())
a = list(map(int, input().split())) 
b = list(map(int, input().split())) 


x = [0] * M
y = [0] * M
c = [0] * M
for i in range(M):
    x[i], y[i], c[i] = map(int, input().split())


#  A種類の冷蔵庫とB種類の電子レンジ
 
cost = 10**25
for i in range (M):
    reizouko = x[i]-1
    densirenge = y[i]-1
    nedan = ((a[reizouko] + b[densirenge]) - c[i])
    
    if nedan <= cost:
        cost = nedan

print(min(cost,(min(a) + min(b))))

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

int main(){
	int n;
	cin >> n;
	int A[4][3][10] = {0};
	for(int i = 0; i < n; i++){
		int b, f, r, v;
		cin >> b >> f >> r >> v;
		A[b-1][f-1][r-1] += v;
		if(A[b-1][f-1][r-1] < 0) A[b-1][f-1][r-1] = 0;
		if(A[b-1][f-1][r-1] > 9) A[b-1][f-1][r-1] = 9;
	}
	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < 10; k++) cout << ' ' << A[i][j][k];
			cout << endl;
		}
		if(i < 3){
			for(int j = 0; j < 20; j++) cout << '#';
			cout << endl;
		}
	}
	return 0;
}

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

#define FOR(i, a, n) for (int i = a; i < (int)n; i++)
#define REP(i, n) REP(i, 0, n)

int main()
{
  string S;
  cin >> S;
  if (S.size() <= 3) {
    cout << "No" << endl;
  } else if (S.substr(0, 4) == "YAKI") {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import numpy as np
import math

a=input()
b=input()

if(len(a)<len(b)):
    print("LESS")
elif(len(a)>len(b)):
    print("GREATER")
elif(a<b):
    print("LESS")
elif(a==b):
    print("EQUAL")
else:
    print("GREATER")


Measured memory_bytes: 12828
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		long k = Long.parseLong(sa[1]);
		sa = br.readLine().split(" ");
		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = Long.parseLong(sa[i]);
		}
		br.close();

		Arrays.parallelSort(a);
		long ng = -1000000000000000001L;
		long ok = 1000000000000000001L;

		while (Math.abs(ok - ng) > 1) {
			long mid = (ok + ng) / 2;
			long cnt = 0;
			for (int i = 0; i < a.length; i++) {
				int c = calc(a, i, mid);
				cnt += c;
			}
			cnt /= 2;
			if (cnt < k) {
				ng = mid;
			} else {
				ok = mid;
			}
		}
		System.out.println(ok);
	}

	static int calc(long[] a, int i, long mid) {
		if (mid >= 0 && a[i] >= 0 ||
				mid < 0 && a[i] > 0) {
			int ok = -1;
			int ng = a.length;

			while (Math.abs(ng - ok) > 1) {
				int m = (ng + ok) / 2;
				if (a[m] * a[i] <= mid) {
					ok = m;
				} else {
					ng = m;
				}
			}
			if (ng > i) {
				return ng - 1;
			} else {
				return ng;
			}

		} else {
			int ok = a.length;
			int ng = -1;

			while (Math.abs(ng - ok) > 1) {
				int m = (ng + ok) / 2;
				if (a[m] * a[i] <= mid) {
					ok = m;
				} else {
					ng = m;
				}
			}
			if (ok <= i) {
				return a.length - ok - 1;
			} else {
				return a.length - ok;
			}
		}
	}
}


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

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

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

using mint = Mint<>;

int main() {

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

	Int N, M;
	cin >> N >> M;

	priority_queue<Int> pq;
	Int temp;
	for (Int i = 0; i < N; i++) {
		cin >> temp;
		pq.push(temp);
	}

	while (M) {
		temp = pq.top();
		temp /= 2;
		pq.pop();
		pq.push(temp);
		M--;
	}

	Int ans = 0;
	while (!pq.empty()) {
		ans += pq.top();
		pq.pop();
	}

	cout << ans << "\n";

}

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

int main() {
  string s;
  cin >> s;
  bool istrue = true;
  int n = s.size();
  for(int i = 0; i < n; i++) {
    if(s[i] != s[s.size() - i - 1]) {
      istrue = false;
    }
  }
  int jazz = ((n - 1) / 2) - 1;
  for(int i = 0; i <= ((n - 1) / 2) - 1; i++) {
    if(s[i] != s[jazz]) {
      istrue = false;
    }
    jazz--;
  }
  int hold = n - 1;
  for(int i = ((n + 3) / 2) - 1; i < n; i++) {
    if(s[i] != s[hold]) {
      istrue = false;
    }
    hold--;
  }
  if(!istrue) {
    cout << "No";
  } else {
    cout << "Yes";
  }
}

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

long long int answ(long long int x){
  if(x==1) return 1;
  if(x>1) return 2*answ(x/2)+1;
}
 
int main() {
  long long int h;
  cin>>h;
  cout<<answ(h)<<endl;
}

Measured memory_bytes: 256
import heapq

inf = 10 ** 9


def dijkstra(a):
    color = ["white" for _ in range(n + 1)]
    D = [inf for _ in range(n + 1)]
    P =[-1 for _ in range(n+1)]

    P[a]=-1
    D[a] = 0
    color[a] = "gray"
    queue = [[0, a]]
    heapq.heapify(queue)

    while len(queue) > 0:
        u = heapq.heappop(queue)[1]
        if color[u] == "black": continue
        color[u] = "black"

        V = [[i, j] for i, j in M[u] if color[j] != "black"]
        if len(V) > 0:
            for i, j in V:
                if D[u] + i < D[j]:
                    D[j] = D[u] + i
                    color[j] = "gray"
                    P[j]=u
                    heapq.heappush(queue, [D[j], j])

    return P,D


n,m=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(m)]
M=[[] for _ in range(n+1)]
for a,b in AB:
    M[a].append([1,b])
    M[b].append([1,a])
P,D=dijkstra(1)
if inf not in D[1:]:
    print("Yes")
    for i in P[2:]:
        print(i)
else:print("No")

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

const int SIZE=100010;
bool used[SIZE];

bool bfs(int s,vector<vector<int> >& G)
{
   used[s]=true;
   queue<int> Q;
   Q.push(s);

   bool ok=true;
   bool all2=true;
   while(!Q.empty()){
      int v=Q.front(); Q.pop();
      //check
      if((int)G[v].size()>=3) ok=false;
      if((int)G[v].size()<2) all2=false;

      for(int u:G[v]){
         if(!used[u]){
            used[u]=true;
            Q.push(u);
         }
      }
   }
   return (ok and !all2);
}

signed main()
{
   while(true){
      int N,M; cin>>N>>M;
      if(N==0 and M==0) break;

      vector<vector<int> > G;
      G.resize(N);
      REP(i,M){
         int a,b; cin>>a>>b;
         a--; b--;
         G[a].push_back(b);
         G[b].push_back(a);
      }

      REP(i,N) used[i]=false;
      bool ok=true;
      REP(i,N){
         if(!used[i]){
            if(!bfs(i,G)) ok=false;
         }
      }
      cout<<(ok? "yes":"no")<<endl;
   }
}




Measured memory_bytes: 8428