akhauriyash/Code-Regression huggingface dataset:
import std;

void main() {
  int N, M;
  scan(N, M);
  auto to1 = new bool[](N);
  auto toN = new bool[](N);
  foreach (i; 0 .. M) {
    int ai, bi;
    scan(ai, bi);
    ai--, bi--;
    if (ai == 0) {
      to1[bi] = true;
    }
    if (bi == N - 1) {
      toN[ai] = true;
    }
  }
  bool ok;
  foreach (i; 0 .. N) {
    if (to1[i] && toN[i]) ok = true;
  }
  yes(ok, "POSSIBLE", "IMPOSSIBLE");
}

void scan(T...)(ref T args) {
    auto line = readln.split; // @suppress(dscanner.suspicious.unmodified)
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}
 
void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}
 
bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args)
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    return isChanged;
}
 
bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args)
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    return isChanged;
}
 
void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}

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

#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795
#define INF 9223372036854775807LL


int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int a1,a2,a3;
	cin >> a1 >> a2 >> a3;
	if(a1 > a2) {
		swap(a1,a2);
	}
	if(a2 > a3) {
		swap(a3,a2);
	}
	if(a1 > a2) {
		swap(a1,a2);
	}
	cout << a3-a1;
	return 0;
}



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

bn = min([a, b, c, d, e])

if n % bn == 0:
    tp = n // bn
else:
    tp = (n // bn) + 1

print(5 + tp - 1)



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

int main() {
  int H,W,ave=0,sum=0;
  cin >> H>>W;
  vector<string> vec(H*W);

  for(int i=0; i<H; i++){
    cin>>vec.at(i);
  }
 
  for(int i=0; i<=H; i++){
    if(i==0||i==H){
      for(int n=0; n<=W+1;n++){
        cout << '#';
        if(n==W+1){
          cout <<endl;
        }
      }
    }else{
      cout << '#'<<vec.at(i) <<'#'<< endl;
    }
    if(i==0){
      cout << '#'<<vec.at(i) <<'#'<< endl;  
    }
  }
}


Measured memory_bytes: 384
// ooooo      ooo                     
// `888b.     `8'                     
//  8 `88b.    8   .ooooo.   .oooo.   
//  8   `88b.  8  d88' `88b `P  )88b  
//  8     `88b.8  888   888  .oP"888  
//  8       `888  888   888 d8(  888  
// o8o        `8  `Y8bod8P' `Y888""8o 
// C++ Conpetitive Programming Template 
// Ver 2.0 (codename: Noa)
// Last Modified : 2019-06-07
// Created       : 2019-05-25
// Auther        : shirataki3
#include <bits/stdc++.h>
using namespace std;
// typename alias
template <class T> using vec = vector<T>;
template <class T, class U> using vep = vec<pair<T,U> >;
template <class T> using PQ = priority_queue<T>;
using ll = long long;
using vll = vec<ll>;
using pll = pair<ll, ll>;
using vpll = vec<pll>;
using str = string;
// あくまのちから
//#define int ll

// const
static const long long INF = 1LL<<59;
static const long long MOD = (ll)1e9+7;
static const double PI = 3.14159265358979323846;

// accelerate stdin, stdout
#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
// repeat macro
#define FOR(i, a, b) for(ll (i)=(a);(i)<=(b);i++)
#define rFOR(i, a, b) for(ll (i)=(b);(i)>=(a);i--)
#define REP(i, n) for(ll i=0;i<n;i++)
// vector macro
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort(WHOLE(v))
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse(WHOLE(v))
#define FOLDL(src, dst, lambda) partial_sum(WHOLE(src), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum(WHOLE(src), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate(WHOLE(v), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

// io helper
template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}
template <typename T>istream& operator>>(istream &is, vec<T> &v) {for(auto &a:v) is >> a; return is;}
template <typename T>ostream& operator<<(ostream &os, vec<T> &v) {os << "[";REP(i, v.size() - 1) os << v[i] <<", "; os << v[v.size()-1]<<"]";return os;}
template <typename T, typename U>ostream& operator<<(ostream &os, pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")";return os;}
template <typename T, typename U>ostream& operator<<(ostream &os, map<T, U> &mp) {os << "{ ";for(auto &p:mp) os << p.first << ": " << p.second << ", "; os << "}";return os;}

void solve() {
    ll N;
    cin >> N;
    set<ll> s;
    REP(i, N) {
        ll t;cin >> t;
        s.insert(t);
    }
    ll sz = s.size();
    if(sz % 2 == 0) {
        out(sz - 1);
    }else {
        out(sz);
    }
}

signed main() {
    fast_io;
    cout << setprecision(20) << fixed;
    solve();
    return 0;
}


Measured memory_bytes: 4992
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    s = input().split()
    for i in range(3):
        print(s[i][0], end ='')
    
    print()
        

solve()


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int num = sc.nextInt();
			int[] j = new int[num];
			for (int i = 0; i < num; i++) {
				int cur = sc.nextInt() - 1;
				j[cur] = i + 1;
			}
			for (int i = 0; i < num; i++) {
				System.out.print(j[i] + " ");
			}
		}
	}
}


Measured memory_bytes: 64668
import bisect
N = int(input())
A = [int(i) for i in input().split()]
rank = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
memo = [0] * 9

for i in range(N):
    if A[i] >= 3200:
        memo[8] += 1
    else:
        memo[bisect.bisect_right(rank, A[i])] = 1
    
color = sum(memo[:8])
minc = max(color, 1)
maxc = color + memo[8]

print(minc, maxc)

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

int main() {
  int a, b, k;
  cin >> a >> b >> k;

  vector<int> ans = {a, b};
  if (a == b) {
    cout << a << endl;
  } else if (b - a >= 2 * k) {
    for (int i = 1; i < k; i ++) {
      ans.push_back(a + i);
      ans.push_back(b - i);
    }
    sort(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); i ++) {
      cout << ans.at(i) << endl;
    }
  } else {
    for (int i = 1; i < b - a; i ++) {
      ans.push_back(a + i);
    }
    sort(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); i ++) {
      cout << ans.at(i) << endl;
    }
  }
}


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

int main(){
	int n;
	int Y, M, D;
	int ans;
	cin >> n;
	while (n--){

		ans = 0;
		cin >> Y >> M >> D;
		if (Y % 3 == 0){
			ans = 21 - D;
			ans += 20 * (10 - M);
		}
		else{
			if (M & 1){
				ans = 21 - D;
				ans += ((10-M) / 2) * 20 + ((10-M) / 2) * 19 + 19;
			}
			else{
				ans = 20 - D;
				ans += ((10-M)/2) * 20 + ((10-M) / 2) * 19;
			}
		}
		for (int i = Y + 1; i < 1000; ++i){
			if (i % 3 == 0){
				ans += 200;
			}
			else{
				ans += 195;
			}
		}
			cout << ans << endl;
		

	}
	return 0;
}

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

int main() {
	// your code goes here
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    int b[n];
    int sum = 0;
    for(int i = 0; i < n; i++){
        cin >> b[i];
        sum += b[i];
    }
    int c[n - 1];
    for(int i = 0; i < n - 1; i++){
        cin >> c[i];
    }
    for(int i = 1; i < n; i++){
        if((a[i] - a[i - 1]) == 1){
            sum += c[a[i -1] - 1];
        }
    }
    
    cout << sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
using namespace std;
int main(void){
int a,b,c,d,e=0,f=0,g=0;
cin>>a>>b>>c>>d;
e=a*b;
f=c*d;
g=max(e,f);
if(e==f) cout<<e<<endl;
else cout<<g<<endl;


return 0;
}

Measured memory_bytes: 256
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var n int
    var s string
    fmt.Scan(&n,&s)
    ans := 0
    x := 0
    for i:=0;i<n;i++{
        if s[i]=='I'{
            x++
            ans = max32(ans,x)
        } else {
            x--
        }
    }
    fmt.Println(ans)
}





// Pairsort
type Pair struct {
    first,second int64
}

type By func(p1, p2 *Pair) bool

func (by By) Sort(pairs []Pair) {
    ps := &pairSorter{
            pairs : pairs,
            by: by,
    }
    sort.Sort(ps)
}

type pairSorter struct {
    pairs []Pair
    by func(p1, p2 *Pair) bool
}

func (s *pairSorter) Len() int {
    return len(s.pairs)
}

func (s *pairSorter) Swap(i, j int) {
    s.pairs[i], s.pairs[j] = s.pairs[j], s.pairs[i]
}

func (s *pairSorter) Less(i, j int) bool {
    return s.by(&s.pairs[i], &s.pairs[j])
}

func first (p1, p2 *Pair) bool {
        return p1.first < p2.first
}

func second (p1, p2 *Pair) bool {
        return p1.second < p2.second
}
// end



func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

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

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

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

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

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func makeTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func sortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}

func reverseString(s string) string{
    t := []rune(s)
    for i,j := 0, len(s)-1 ; i < j ; i, j = i+1, j-1 {
        t[i], t[j] = t[j], t[i]
    }
    return string(t)
}

func inside(h,w,H,W int) bool{
    if h>=0 && h<H && w>=0 && w<W{
        return true
    }
    return false
}


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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

struct BinaryIndexedTree {
private:
    int n,b;
    vector<int> bit;
public:
    BinaryIndexedTree(int n_) {
        n = n_+10;
        b = 1;
        while (b < n) b <<= 1;
        b >>= 1;
        bit = vector<int>(n,0);
    }

    void add(int a,int w) {
        a++;
        for (int x = a;x < n;x += x&-x) bit[x] += w;
    }

    int sum(int a) {
        a++;
        int ret = 0;
        for (int x = a;x > 0;x -= x&-x) ret += bit[x];
        return ret;
    }

    void update(int a,int w) {
        a++;
        int v = w-sum(a)+sum(a-1);
        add(a,v);
    }

    int lower_bound(int w) {
        if (w <= 0) return 0;
        int x = 0;
        for (int k = b;k > 0;k /= 2) {
            if (x+k < n && bit[x+k] < w) {
                w -= bit[x+k];
                x += k;
            }
        }
        return x;
    }
};

int main() {
    int n,k;
    cin >> n >> k;
    vector<ll> a(n),sums(n+1,0);
    BinaryIndexedTree bit(2*n+1);
    map<ll,int> mp;
    for (int i = 0;i < n;++i) cin >> a[i],a[i] -= k,sums[i+1] = sums[i]+a[i];
    for (int i = 0;i < n+1;++i) mp[sums[i]] = 0;
    {
        int j = 0;
        auto it = mp.find(0);
        for (;it != mp.end();++it) it->second = j,j++;
        j = 0;
        it = mp.find(0);
        for (;;--it) {
            it->second = j;
            j--;
            if (it == mp.begin()) break;
        }
    }
    ll ans = 0;
    for (int i = 0;i < n+1;++i) {
        ans += bit.sum(mp[sums[i]]+n);
        bit.add(mp[sums[i]]+n,1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 11512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=10005,INF=1<<29;
vector<int> G[MAX];
int cnt[MAX],used[MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    
    for(int i=0;i<2*N*N-2*N;i++){
        int a,b;cin>>a>>b;
        cnt[a]++;
        cnt[b]++;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    vector<vector<int>> ans(N,vector<int>(N));
    
    for(int i=1;i<=N*N;i++){
        if(cnt[i]==2){
            ans[0][0]=i;
            used[i]=1;
            break;
        }
    }
    
    for(int i=0;i<N;i++){
        for(int j=0;j+1<N;j++){
            for(int a:G[ans[i][j]]){
                if(used[a]==1) continue;
                if(i==0&&cnt[a]==4) continue;
                bool ok=false;
                
                if(i) for(int b:G[a]) if(b==ans[i-1][j+1]) ok=true;
                if(i&&!ok) continue;
                ans[i][j+1]=a;
                used[a]=1;
                break;
            }
        }
        if(i+1<N){
            for(int a:G[ans[i][0]]){
                if(used[a]==1) continue;
                ans[i+1][0]=a;
                used[a]=1;
            }
        }
    }
    
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(j) cout<<" ";
            cout<<ans[i][j];
        }
        cout<<endl;
    }
}



Measured memory_bytes: 3832
#include <iostream>

using namespace std;

int main() {
  int a, b, x;
  cin >> a >> b >> x;
  if (x < a) {
    cout << "NO" << endl;
  } else if (a + b < x) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
  return 0;
}


Measured memory_bytes: 3012
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#include<stack>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;
//set<int>::iterator it;



int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int n,i;
	cin>>n;
	ll sum=0;
	int a[n*3];
	for(i=0;i<n*3;i++)cin>>a[i];
	sort(a,a+n*3);
	for(i=n;i<3*n;i++)if((i-n)%2==0)sum+=a[i];
	cout<<sum<<endl;
	
	
	
	return 0;
}

Measured memory_bytes: 1408
s=input()
t=input()

l_s=len(s)
l_t=len(t)

m=[]

for i in range(0,l_s-l_t+1):
    s_b=s[i:i+l_t]
    x=0
    for j in range(0,l_t):
        if t[j]!=s_b[j]:
            x+=1
        else:
            continue
    m.append(x)
    
print(min(m))

Measured memory_bytes: 9136
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<int, P> P1;

//#define int long long

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i, x) for (int i = 0; i < x; i++)
#define rep1(i, x) for (int i = 1; i <= x; i++)
#define rrep(i, x) for (int i = x - 1; i >= 0; i--)
#define rrep1(i, x) for (int i = x; i > 0; i--)
#define sor(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define lb(vec, a) lower_bound(vec.begin(), vec.end(), a)
#define ub(vec, a) upper_bound(vec.begin(), vec.end(), a)
#define uniq(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define mp1(a, b, c) P1(a, P(b, c))

const int INF = 100000000;
const int M = 100000000;
const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const int dir_8[8][2] = {{1, 0},  {1, 1},   {0, 1},  {-1, 1},
                         {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

/*----------------------------------------------/
/- char         : %c  | char *       : %s  | short        : %hd
/- int          : %d  | long         : %ld | long long    : %lld
/- unsigned short:%hu | unsigned int : %u  | unsigned long: %lu
/- u_long long  : %llu| (octal)      : %o  | (hexadecimal): %x
/- float        : %f  | double       : %lf |
/----------------------------------------------*/

/*----------------------------------------------/
/- INT_MAX, LONG_MAX   : 1<<15 = 2.1*pow(10, 9)       (= 2147483647)
/- UINT_MAX, ULONG_MAX : 1<<16 = 4.2*pow(10, 9)       (= 4294967295)
/- LLONG_MAX           : 1<<63 = 9.2*pow(10, 18)      (= 9223372036854775807)
/- ULLONG_MAX          : 1<<64 = 1.8*pow(10, 19)      (= 18446744073709551615)
/----------------------------------------------*/

bool isACGT(char c) {
    if (c == 'A' || c == 'C' || c == 'G' || c == 'T') {
        return true;
    } else {
        return false;
    }
}

int main() {
    string s;
    cin >> s;
    int mn, mi;
    int sl = s.size();
    mn = -1;
    rep(i, sl) {
        int num = 0;
        rep(j, sl - i) {
            if (isACGT(s[j + i])) {
                num++;
            } else {
                break;
            }
        }
        if (num > mn) {
            mi = i;
            mn = num;
        }
    }
    cout << mn;

    /* ====================================== */
    cout << endl;
    return 0;
}

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

namespace Paiza.CRank
{
    public class PictureMatching
    {
        //private static int[] Item;
        private static LinkedList<int> gameObj = new LinkedList<int>();

        public static void Main(string[] args)
        {
            Input();
            //Method();
            ConsoleWrite();
            System.Console.ReadLine();
        }

        private static void Input()
        {
            var num = int.Parse(System.Console.ReadLine());
            for (int i = 0; i < num; i++)
            {
                var ope = System.Console.ReadLine().Split(' ');
                string param = ope.Count() > 1 ? ope[1] : null;
                Operation(ope[0], param);
            }
        }

        private static void Operation(string ope, string param)
        {
            var value = param != null ? int.Parse(param) : 0;

            if (ope.Equals("insert"))
            {
                gameObj.AddFirst(value);
            }
            else if (ope.Equals("delete"))
            {
                gameObj.Remove(value);
            }
            else if (ope.Equals("deleteFirst"))
            {
                gameObj.RemoveFirst();
            }
            else if (ope.Equals("deleteLast"))
            {
                gameObj.RemoveLast();
            }
        }

        private static void ConsoleWrite()
        {
            var sb = new StringBuilder();
            int[] result = gameObj.ToArray();
            for (int i = 0; i < gameObj.Count; i++)
            {
                sb.Append(result[i]);
                if (i < gameObj.Count - 1)
                {
                    sb.Append(" ");
                }
            }
            System.Console.WriteLine(sb.ToString());
        }
    }
}

Measured memory_bytes: 87576
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i,m,n) for(int i = m;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl;
#define Vecpr vector<pair<lli,lli>>
int main() {
  lli A,B=0,C=0,D=0,F=0;
  string S;
  cin >> S;
  A=S.size();
  for(int i=0;i<A;i+=2)NeOut(S[i]);
  cout << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


int main(){
    ll n; cin >> n;
    ll sum = 0,ans =  0;
    vector<ll> a(n);

    rep(i,n) cin >> a[i];

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

    sum = a[0];

    for(int i = 1; i < n; i ++){
        if(sum*2 < a[i]){
            ans = i;
        }
        sum += a[i];
    }

    if(n == 2) cout << ((a[0]*2 >= a[1])?2:1);
    else cout << n-ans;
}

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

#define nl '\n'
#define F fisrt
#define S second
#define pb push_back
#define mp make_pair
#define REP(i,a,b) for(int i = a; i < b; i++)
#define ForeachTC int t; cin >> t; while(t--)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef stack<int> si;
typedef deque<int> di;
typedef pair<int,int> pi;

class Solution {
public:
    int climbStairs(int n) {
		if(n <= 2)
			return n;
		else{
			return climbStairs(n-1) + climbStairs(n-2);
		}
    }
};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	//code here
	int s, w;
	cin >> s >> w;
	w >= s ? cout << "unsafe" : cout << "safe";
}


Measured memory_bytes: 3636
/*
17/10/2017
*/
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
ll a[4];
for(int i=0;i<4;i++)
{
cin>>a[i];
}
ll ans=-1e18;
ans=a[0]*a[2];
ans=max(ans,a[0]*a[3]);
ans=max(ans,a[1]*a[2]);
ans=max(ans,a[1]*a[3]);
cout<<ans;
}

Measured memory_bytes: 3672
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
 {
	public static void main (String[] args)
	 {
	 Scanner s=new Scanner(System.in);
	 long a=s.nextLong();
	 long b=s.nextLong();
	 long k=s.nextLong();
	 if(k>a)
	 {
	 k=k-a;a=0;}
	 else
	 {a=a-k;
	 k=0;}
	 b=b-k;
	 if(b<0)
	 b=0;
	 System.out.println(a+" "+b);}}

Measured memory_bytes: 23764
#include <cstdio>
#define MOD 998244353
typedef long long ll; 
inline ll quick_pow(ll a, int n)
{
	ll res = 1; 
	while (n)
	{
		if (n & 1)
			res = res * a % MOD; 
		a = a * a % MOD; 
		n >>= 1; 
	}
	return res; 
}
ll fact[500005], inv[500005], ans; 
inline ll C(int n, int m)
{
	if (n < m || m < 0)
		return 0; 
	return fact[n] * inv[m] % MOD * inv[n - m] % MOD; 
}
int main()
{
	// freopen("AGC021-E.in", "r", stdin); 
	fact[0] = inv[0] = 1;
	for (int i = 1; i <= 5e5; i++)
	{
		fact[i] = fact[i - 1] * i % MOD; 
		inv[i] = quick_pow(fact[i], MOD - 2); 
	}
	int n, k; 
	scanf("%d%d", &n, &k); 
	for (int r = n; r <= k; r++)
	{
		if (r << 1 < k)
			continue; 
		(ans += C(k, r) - C(k, 2 * r - n + 1)) %= MOD;
		if (r << 1 == k)
			(ans -= C(k - 1, r) - C(k - 1, 2 * r - n)) %= MOD;
	}
	printf("%lld\n", (ans + MOD) % MOD);
	return 0;
}


Measured memory_bytes: 8064
#include <stdlib.h>
#include <math.h>
#include <stdio.h>

int main(){
int a,b;
scanf("%d",&a);
scanf("%d",&b);
if(a < b){
printf("a < b\n");
}
else if(a > b){
printf("a > b\n");
}
else {
printf("a == b\n");
  }
return 0;
}

Measured memory_bytes: 2540
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;

int n,cnt;
int a[500000];
//llじゃなくて大丈夫か？
int main(){
  int n,t,a;cin>>n>>t>>a;
  int ans = 0;
  double ansa=INF;
  rep(i,n){
    int h;cin>>h;
    if(abs(a-(t-0.006*h))<ansa){
      ansa = abs(a-(t-0.006*h));
      ans = i;
    }
  }
  cout << ans+1 << endl;
}


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

class DisjointSet{
private:
  vector<int> rank, p;
  void link(int x,int y){
    if(rank[x] > rank[y]){
      p[y] = x;
    }else{
      p[x] = y;
      if(rank[x] == rank[y]) rank[y]++;
    }
  }
public:
  DisjointSet(int size){
    rank.resize(size,0);
    p.resize(size,0);
  }
  void build(){
    for(int i = 0; i < rank.size(); i++){
      makeSet(i);
    }
  }
  void makeSet(int x){
    p[x] = x, rank[x] = 0;
  }
  void Union(int x,int y){
    link(findSet(x),findSet(y));
  }
  int findSet(int x){
    return( x != p[x] ? p[x] = findSet(p[x]) : p[x]);
  }
};
struct edge{
  int u, v;
  double cost;
  bool operator<(const edge& hoge)const{
    return cost < hoge.cost;
  }
};
typedef vector< edge > Edges;
void add_edge(Edges& info, int u, int v, double cost){
  info.push_back( (edge){ u, v, cost});
}
double kruskal(Edges& edges, int V){
  sort( edges.begin(), edges.end());
  DisjointSet uf_tree(V); uf_tree.build();
  double ret = 0.0;
  for(int i = 0; i < edges.size(); i++){
    edge& e = edges[i];
    if(uf_tree.findSet(e.u) != uf_tree.findSet(e.v)){
      uf_tree.Union( e.u, e.v);
      ret += e.cost;
    }
  }
  return ret;
}

double GetDist( double x1, double y1, double z1, double r1,
                double x2, double y2, double z2, double r2){
  double dx = fabs( x2 - x1), dy = fabs( y2 - y1), dz = fabs( z2 - z1);
  double dist = max(sqrt( dx * dx + dy * dy + dz * dz) - r1 - r2, 0.0);
  return dist;
}

int main(){
  int n;
  double x[100], y[100], z[100], r[100];
  while(cin >> n, n){
    for(int i = 0; i < n; i++){
      cin >> x[i] >> y[i] >> z[i] >> r[i];
    }
    Edges edges;
    for(int i = 0; i < n; i++){
      for(int j = i + 1; j < n; j++){
        add_edge( edges, i, j, GetDist( x[i], y[i], z[i], r[i], x[j], y[j], z[j], r[j]));
      }
    }
    cout << fixed << setprecision(3) << kruskal(edges, n) << endl;
  }
}

Measured memory_bytes: 1440
#![allow(unused_imports, unused_variables, unused_macros, unused_mut, dead_code)]
use std::io::*;
use std::str::FromStr;

fn read_line<T: FromStr>(stdin_lock: &mut StdinLock) -> T {
    let mut line: String = String::new();
    stdin_lock.read_line(&mut line).expect("input error");
    line.trim().to_string().parse().ok().expect("parse error")
}

fn sep_line<T: FromStr>(stdin_lock: &mut StdinLock, sep: char) -> Vec<T> {
    let mut line: String = String::new();
    stdin_lock.read_line(&mut line).expect("input error");
    line = line.trim().to_string();
    let res: Vec<&str> = line.split(sep).collect();
    res.iter().map(|s| s.to_string().parse::<T>()
                   .ok().expect("parse error")).collect()
}

fn main() {
    let stdin = stdin();
    let mut stdin_lock = stdin.lock();
    let d:Vec<i32> = read_line::<String>(&mut stdin_lock).chars()
        .map(|c| c as i32 - '0' as i32).collect();
    let n = d.len();
    for i in 0..(1<<(n-1)) {
        let mut p = vec![' '];
        let mut x: i32 = d[0];
        for j in 0..(n-1) {
            if (i & (1<<j)) != 0 {
                x += d[j+1];
                p.push('+');
            } else {
                x -= d[j+1];
                p.push('-');
            }
        }
        if x == 7 {
            print!("{}", d[0]);
            for j in 1..d.len() {
                print!("{}{}", p[j], d[j]);
            }
            println!("=7");
            break;
        }
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 100010
#define inf 0x7fffffff
/*------------------------------------------------------------*/
int a[maxn];
int main(){
	int n;
	in(n);
	FOR(i,1,n)in(a[i]);
	sort(a+1,a+n+1);
	int k=0,ans=0;
	FOR(i,1,n){
		if(a[i]==a[i-1]){
			k++;
			if(k>a[i])ans++;;
		}
		 else {if(k<a[i-1])ans+=k;k=1;}
	}
	if(k<a[n])ans+=k;
	out(ans);
} 

Measured memory_bytes: 640
#include <stdio.h>

int main(void) {

	int i = 0;
	int n;
	int x;
	char ch;
	int s[13],h[13],c[13],d[13];

	for(i = 0;i < 13;i++){
		s[i] = 0;
		h[i] = 0;
		c[i] = 0;
		d[i] = 0;
	}
	scanf("%d",&n);	
	for(i = 0;i<= n;i++){
		scanf("%c %d ",&ch,&x);
		switch(ch){
			case 'S':
				s[x - 1] = 1;
				break;
			case 'H':
				h[x - 1] = 1;
				break;
			case 'C':
				c[x - 1] = 1;
				break;
			case 'D':
				d[x - 1] = 1;
				break;
			default:
				break;
		}
	}

	for(i = 0;i < 13;i++){
		if(s[i] == 0 ){
			printf("S %d\n",i + 1);	
		}
	}
	for(i = 0;i < 13;i++){
		if(h[i] == 0 ){
			printf("H %d\n",i + 1);	
		}
	}
	for(i = 0;i < 13;i++){
		if(c[i] == 0 ){
			printf("C %d\n",i + 1);	
		}
	}	

	for(i = 0;i < 13;i++){
		if(d[i] == 0 ){
			printf("D %d\n",i + 1);	
		}
	}	

	return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <unordered_map>
#include <map>
#include <set>
#include <unordered_set>
#include <sstream>
typedef long long ll;
#define F first
#define S second
#define PB push_back
#define MP make_pair

using namespace std;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    //for writing to files
    //freopen('input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int N, K;
    cin >> N >> K;
    vector<int> disliked;
    for (int i = 0; i < K; i++) {
        int d;
        cin >> d;
        disliked.PB(d);
    }
    sort(disliked.begin(), disliked.end());
    vector<int> liked;
    for (int i = 0; i < 10; i++) {
        if (find(disliked.begin(), disliked.end(), i) == disliked.end()) {
            liked.PB(i);
        }
    }
    for (int i = N; i < 100001; i++) {
        int T = i;
        bool worked = true;
        while (T != 0) {
            int digit = T % 10;
            if (find(liked.begin(), liked.end(), digit) == liked.end()) {
                worked = false;
                break;
            }
            T /= 10;
        }
        if (worked) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


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

#define rep(i, n) for(int i=0; i < (n); ++i)
#define ll long long

template<class T> using v = std::vector<T>;
template<class T> using vv = v<v<T>>;

const int mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
//const int mod = 998244353;

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

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


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

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

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

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

    int k; cin >> k;
    int a, b; cin >> a >> b;
    while (a <= b) {
        if (a % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
        a++;
    }
    cout << "NG" << endl;
    return 0;
}


Measured memory_bytes: 3656
#include<stdio.h>
int main(void)
{
	char a[5],b[5];
	scanf("%s %s",&a,&b);
	if(a[0] == b[2] && a[1] == b[1] && a[2] == b[0]){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
n,k = map(int, input().split())
li = list(map(int, input().split()))

dic = {}
for i in li:
  if i in dic:
    dic[i] += 1
  else:
    dic[i] = 1

val = sorted(dic.values())

ans = 0
if k > len(val):
  print(ans)
else:
  a = len(val) - k
  ans = sum(val[:a])
  print(ans)

Measured memory_bytes: 34720
import java.util.*;

class Main{
 public static void main(String[]args){
  Scanner sc = new Scanner(System.in);
   int R = sc.nextInt();
   int B = sc.nextInt();
   int W = sc.nextInt();
   int G = sc.nextInt();

   System.out.println(R + B + W + G);
 }
}


Measured memory_bytes: 26224
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(f) (f).begin(),(f).end()
#define allr(f) (f).rbegin(),(f).rend()
const int mod = 1e9+7, A = 1e5+5;

int main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n, m;
  cin >> n >> m;
  cout << n/m + (n%m == 0?0:1);
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define endl '\n'
#define int long long

int n,m,x;
int arr[13][13];
int c[13];

int32_t  main()
{
    IOS; 
    cin>>n>>m>>x;
    for(int i=0;i<n;i++)
    {
        cin>>c[i];
        for(int j=0;j<m;j++)
            cin>>arr[i][j];
    }
    int ans=1e18;
    for(int i=0;i<=((1<<n)-1);i++)
    {
        int ch[m];
        memset(ch,0,sizeof(ch));
        int cost=0;
        for(int j=0;j<n;j++)
        {
            if(((i>>j)&1))
            {
                cost+=c[j];
                for(int k=0;k<m;k++)
                    ch[k]+=arr[j][k];
            }
        }
        int flg=0;
        for(int j=0;j<m;j++)
        {
            if(ch[j]<x)
            {
                flg=1;
                break;
            }
        }
        if(flg==0)
            ans=min(ans,cost);
    }
    if(ans==1e18)
        ans=-1;
    cout<<ans;
}

Measured memory_bytes: 3660
import java.util.Scanner;
import java.util.Set;

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

        long cnt = 0;
        if(n*2 > m){
            cnt += m/2;
        }else{
            cnt += n;
            m-=n*2;
            cnt+=m/4;
        }
        
        System.out.println(cnt);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vl(p) vector<p>
#define W while
#define For(i,s,x) for(i=s;i<x;i++)
#define Fore(i,s,x) for(i=s;i<=x;i++)
#define FOR(i,x) for(i=0;i<x;i++)
#define Rof(i,s,x) for(i=s;i>=x;i--)
#define all(v) v.begin(),v.end()
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define pb push_back
#define in insert
#define sz size()
#define F first
#define S second
#define nl cout<<"\n"
#define pr(a) cout<<a<<" "
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define mod 1000000007

  int main()
  {
    char s[3];
    cin>>s;
    ll i,count=0;
    FOR(i,3)
    {
        if(s[i]=='7')
        count++;
    }
    if(count>=1)
    cout<<"Yes";
    else
    cout<<"No";
  }


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

A = [list(map(int, input().split()))[1:] for _ in range(N)]

ans = 0

for i in range(1, M + 1):
    for K in A:
        if K.count(i) == 0:
            break
    else:
        ans += 1

print(ans)

Measured memory_bytes: 9184
import sys
sys.setrecursionlimit(10**7)

N = int(input())

claim = []

for _ in range(N):
    memo = []
    A = int(input())
    for _ in range(A):
        x, y = map(int, input().split())
        memo.append((x,y))
    claim.append(memo)

maximam = 0
for bit in range(2**N):
    flag = True
    count = 0
    for i in range(N):
        if bit & (1<<i):
            count+=1
            for x, y in claim[i]:
                if (bit & (1<<(x-1)) and y==0) or (not (bit & (1<<(x-1))) and y==1):
                    flag = False
    if flag:
        maximam = max(maximam,count)
print(maximam)

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

int main() {
	int X;
	int n;
	int p;


	cin >> X;
	n=1;
	p=360;
	while (p>0) {
		p%=X;
		if (p>0) {
			p+=360;
          n++;
		}
	}
	cout << (n * 360) / X << endl;
	return 0;
}



Measured memory_bytes: 3596
from math import ceil

def meguru_bisect(ng, ok):
    """
    初期値のng,okを受け取り, check=>Trueを満たす最大値(最小値)を返す
    条件を満たす最大値を求める場合、初期値は(ng:上限の外, ok:下限の外)   例) 10**9+1, -1
    条件を満たす最小値を求める場合、初期値は(ng:下限の外, ok:上限の外)   例) -1, 10**9+1
    上限の外や下限の外が返ってくる場合は条件を満たす値が範囲内になかったことを示すので、例外処理が必要
    """
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    return ok

def check(x):
    count = 0
    for a in A:
        count += ceil(a / x) - 1
    return count <= k

n, k = (int(x) for x in input().split())
A = list(int(x) for x in input().split())
ans = meguru_bisect(0, 10**9 + 1)
print(ans)


Measured memory_bytes: 94016
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int n;
	ll k;
	cin >> n >> k;
	
	vector<ll> cnt(1e5 + 1, 0);
	for(int i = 0; i < n; ++i) {
		ll a, b;
		cin >> a >> b;
		cnt[a] += b;
	}
	
	int ans = 0;
	for(int i = 1; i <= 1e5; ++i) {
		if( cnt[i] >= k ) {
			ans = i;
			break;
		}
		
		k -= cnt[i];
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 4024
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


def primes(n):
    is_prime = [1] * (n + 1)
    is_prime[0] = 0
    is_prime[1] = 0
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = 0
    return {i for i in range(n + 1) if is_prime[i]}


n = I()
prime_set = primes(n)
prime_cnt = Counter()
for p in prime_set:
    pi = p
    while pi < n:
        prime_cnt[p] += n // pi
        pi *= p


prime_cnt = [v for k, v in prime_cnt.most_common()][::-1]
m = len(prime_cnt)
print(m - bisect_left(prime_cnt, 74) + (m - bisect_left(prime_cnt, 24)) * (m - bisect_left(prime_cnt, 2) - 1)
    + (m - bisect_left(prime_cnt, 14)) * (m - bisect_left(prime_cnt, 4) - 1)
    + (m - bisect_left(prime_cnt, 4)) * ((m - bisect_left(prime_cnt, 4)) - 1) // 2 * ((m - bisect_left(prime_cnt, 2)) - 2))

Measured memory_bytes: 39152
//////////////////////////
//      _        ____   //
//  U  /"\  u U /"___|  //
//   \/ _ \/  \| | u    //
//   / ___ \   | |/__   //
//  /_/   \_\   \____|  //
//   \\    >>  _// \\   //
//  (__)  (__)(__)(__)  //
//  Compro by NULL_CT©  //
//////////////////////////
//STL libs
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(I, LIM) for (int I = 0; I < (LIM); I++)
#define ALL(LIST) (LIST.begin()), (LIST.end())

using namespace std;

constexpr int MOD = 10000007;
constexpr long INF = LONG_MAX;

vector<long> divisor(long n) {
  vector<long> head, tail;
  for (long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      head.push_back(i);
      if (i * i != n)
        tail.push_back(n / i);
    }
  }
  head.insert(head.end(), tail.rbegin(), tail.rend());
  return (head);
}

void execute();

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

  execute();

  return (0);
}

void execute() {
  int n, m;
  cin >> n >> m;

  vector<pair<long,long>> sds(n);
  vector<pair<long,long>> chk(m);

  REP(i, n) { cin >> sds[i].first >> sds[i].second; }
  REP(i, m) { cin >> chk[i].first >> chk[i].second; }

  for (int i = 0; i < n; i++) {

    int ans=0;//most minimum chk

    for (int j = 0; j < m; j++) {
      if (abs(sds[i].first - chk[j].first) + abs(sds[i].second - chk[j].second) <
          abs(sds[i].first - chk[ans].first) + abs(sds[i].second - chk[ans].second)) {
        ans = j;
      }
    }

    cout<<ans+1<<"\n";
    
  }

}

Measured memory_bytes: 3180
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
struct node
{
    double w , v , u ;
};
vector <node> list ;
bool cmp(node A,node B)
{
    return A.u > B.u ;
}
int main()
{
    //freopen("input.txt","r",stdin);
    int N ;
    double W ;
    while(scanf("%d%lf",&N,&W)==2)
    {
        list.clear();
        double ans = 0.0 ;
        for(int i=0;i<N;i++)
        {
            node obj ;
            scanf("%lf%lf",&obj.w,&obj.v);
            obj.u = obj.v / obj.w ;
            if(obj.w<=0&&obj.v>=0) { W-=obj.w; ans+=obj.v; continue ; }
            if(obj.w>=0&&obj.v<=0) continue ;
            if(obj.w<=0&&obj.v<=0) { W-=obj.w; ans+=obj.v; obj.w*=-1.0; obj.v*=-1.0; }
            list.push_back(obj);
        }
        sort(list.begin(),list.end(),cmp);
        for(int i=0;i<list.size();i++)
        {
            if(list[i].w<=W)
            {
                W-=list[i].w;
                ans+=list[i].v;
            }
            else
            {
                ans+=list[i].u*W;
                W=0.0;
            }
        }
        printf("%.8lf\n",ans);
    }
    return 0;
}

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

int main() {
    int H, W, N;
    cin >> H >> W >> N;
    int A[N];
    rep(i, N) cin >> A[i];

    int mapping[H][W];
    int idx = 0; //利用中のAのIndex
    int count = 0; //現在のAを使った回数。
    rep(i, H) {
        int dj = (i % 2 == 0) ? 1 : -1;
        int st = (dj > 0) ? 0 : W - 1;
        for (int j = st; j >= 0 && j < W; j += dj) {
            mapping[i][j] = (idx + 1);
            count++;
            if (count >= A[idx]) {
                count = 0;
                idx += 1;
            }
        }
    }
    //表示
    rep(i, H) {
        rep(j, W) {
            cout << mapping[i][j];
            if (j < W - 1) {
                cout << " ";
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 384