akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <unordered_map>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;
 
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define y1 abcde
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
#define BUG cout << "acdsfas" << endl
#define int long long

const int mod = 1e9 + 7;
const int inf = 2e9;
const int N = 5e5 + 15;
int h, w, n, dp[N], fact[N];
pii a[N];

inline int multiply(int a, int b) {
    return (a * b) % mod;
}

inline int binpow(int n, int k) {
    int res = 1;
    while(k) {
        if(k & 1)
            res = multiply(res, n);
        n = multiply(n, n);
        k >>= 1;
    }
    return res;
}

inline int divide(int a, int b) {
    return multiply(a, binpow(b, mod - 2));
}

inline int C(int n, int k) {
    return divide(fact[n], multiply(fact[n-k], fact[k]));
}

inline void add(int &a, int b) {
    a = (a + b) % mod;
    a = (a + mod) % mod;
}

main() {
    fact[0] = 1;
    for(int i = 1; i < N; ++i)
        fact[i] = multiply(fact[i-1], i);
    cin >> h >> w >> n;
    for(int i = 1; i <= n; ++i)
        cin >> a[i].f >> a[i].se;
    a[++n] = mp(h, w);
    sort(a + 1, a + 1 + n);
    for(int i = 1; i <= n; ++i) {
        dp[i] = C(a[i].f + a[i].se - 2, a[i].se - 1);
        for(int j = 1; j < i; ++j)
            add(dp[i], -C(a[i].f - a[j].f + a[i].se - a[j].se, a[i].f - a[j].f) * dp[j]);
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 6400
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset

#include <math.h>
#include <stdlib.h>


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

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

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  int maxX = X;
  for(int i = 0; i < N; i++){
    int x; cin >> x;
    maxX = max(maxX, x);
  }
  int minY = Y;
  for(int i = 0; i < M; i++){
    int y; cin >> y;
    minY = min(minY, y);
  }

  if(maxX < minY) cout << "No War" << endl;
  else cout << "War" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <vector>

using namespace std;

typedef unsigned long long ull;
typedef pair<int, int> P;

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

	int size = S.size();
	for (int i = 0; i < size; i++)
	{
		cout << 'x';
	}
	cout << endl;
}

Measured memory_bytes: 256
# 二つの操作で増える総数は同じ
# 最も小さい数を2ずつ増やし、小さい数が同数なら1ずつ増やす

def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools

    nums = list(map(int, input().split()))
    i = 0
    while True:
        if len(set(nums)) == 1:
            print(i)
            break

        nums.sort()
        if nums[0] == nums[1]:
            nums[0] += 1
            nums[1] += 1
        else:
            nums[0] += 2
        
        i += 1

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <stdio.h> 
int main() {
 int n, a[100];
 scanf("%d", &n);
 for(int i = 0; i < n; ++i) {
 scanf("%d", &a[i]); }
 for(int i = n-1; i >= 0; --i) {
 printf("%d", a[i]);
 if(i != 0) { printf(" "); }
 else {
 printf("\n"); } }
 return 0; } 


Measured memory_bytes: 2064
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
//typedef pair<int, int> P;

/** Problem0588 : Simple Calculator **/
int main()
{
	int ans=0, n;
	char c;
	cin>>ans;
	while (cin>>c, c!='=') {
		cin>>n;
		if (c == '+') {
			ans += n;
		} else if (c == '-') {
			ans -= n;
		} else if (c == '*') {
			ans *= n;
		} else if (c == '/') {
			ans /= n;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <queue>
#include <functional>

using namespace std;

typedef long long ll;

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

    // 素数生成
    vector<int> primes;
    for (int i = 2; i <= 100; ++i) {
        for (int j = 0; j < primes.size(); ++j) {
            int pi = primes[j];
            if (i % pi == 0) {
                goto END;
            }
        }

        primes.push_back(i);

    END:;

    }

    int N; cin >> N;
    vector<int> count(100);

    for (int i = 0; i < primes.size(); ++i) {
        int pi = primes[i];
        int div = pi;

        while (div <= N) {
            count[pi] += N / div;
            div *= pi;
        }
    }

    int result = 0;

    for (int i = 0; i < primes.size(); ++i) {
        int pi = primes[i];
        int ci = count[pi];

        result += (int)(ci >= 74);

        for (int j = i + 1; j < primes.size(); ++j) {
            int pj = primes[j];
            int cj = count[pj];

            result += (int)(ci >= 2 && cj >= 24)
                + (int)(ci >= 4 && cj >= 14)
                + (int)(ci >= 14 && cj >= 4)
                + (int)(ci >= 24 && cj >= 2);

            for (int k = j + 1; k < primes.size(); ++k) {
                int ck = count[primes[k]];

                result += (int)(ci >= 2 && cj >= 4 && ck >= 4)
                    + (int)(ci >= 4 && cj >= 2 && ck >= 4)
                    + (int)(ci >= 4 && cj >= 4 && ck >= 2);
            }
        }
    }

    cout << result << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
bool isPrime(int n){
    if(n==1||n==1){
        return false;
    }
    for(int i=2;i<n;++i){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
int fact(int n){
    int ans = 1;
    for(int i = 1; i<= n; ++i){
        ans *= i;
    }
    return ans;
}


int main()
{
    long long n, i = 0, ans = 100;;
    cin>>n;
    while(ans < n){
        ans += ans/100;
        i ++;
    }
    cout<<i<<endl;
}

Measured memory_bytes: 3636
#include<stdio.h>

int main(void){
	unsigned long long N=0,M=0,sum=0,hen=0;

	
	scanf("%llu %llu", &N, &M);
	if(M >= 4 && (N*2 <= M-4)){
		hen += (M-N*2)/4;
		M -= hen*2;
		N += hen;
	};
	if(N <= M/2){
		sum += N;
	}else{
		sum += M/2;
	};
	printf("%llu\n", sum);
	
}




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

int main() {
    string s;cin>>s;
    if(s=="SUN")cout<<"7";
    else if(s=="MON")cout<<"6";
    else if(s=="TUE")cout<<"5";
    else if(s=="WED")cout<<"4";
    else if(s=="THU")cout<<"3";
    else if(s=="FRI")cout<<"2";
    else if(s=="SAT")cout<<"1";
	return 0;
}

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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    Int n, a, b;
    cin >> n >> a >> b;
    if (n == 1) {
        if (a != b) {
            dump(0);
        } else {
            dump(1);
        }
    } else {
        if (a <= b) {
            dump((n - 2) * b - (n - 2) * a + 1);
        } else {
            dump(0);
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int

using namespace std;

const ll MOD = 998244353 ;
const int MAXN = 55;
//EAZY..PIZZIIEE

string s; 

bool check(int i , int j){

    while( i <= j){
        if( s[i] != s[j]) return false;
        i++; j--;
    }
    return true;
}

void solve(){
    cin >> s;
    bool p1= check(0, s.size() - 1);
    bool p2= check(0, (s.size() - 1) / 2 - 1);
    bool p3 = check( (s.size() + 3)/2 - 1, s.size() - 1 );
    if(!p1 or !p2 or !p3) cout << "No\n";
    else cout << "Yes\n";
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long double LD;
LD Ef[605], Eb[605], Pf[605], Pb[605], E[605];
bool vis[605];
vector<int> g[605];
int n, m, a, b;
int main(){
    scanf("%d%d", &n, &m);
    for(int i=1;i<=m;i++){
        int a, b;
        scanf("%d%d", &a, &b);
        g[a].push_back(b);
    }   

    Pb[n] = 1;
    for(int i=n-1;i>=0;i--){
        for(int j=0;j<g[i].size();j++){
            int v = g[i][j];
            Ef[i] += (Ef[v]+1)/g[i].size();
            Pb[i] *= Pb[v]/g[i].size();
        }
    }

    for(int pos=n-1;pos>=1;pos--){
        memset(vis, 0, sizeof(vis));
        memset(E, 0, sizeof(E));
        vis[pos] = 1;
        E[pos] = 0;
        for(int i=pos-1;i>=0;i--){
            for(int j=0;j<g[i].size();j++){
                int v = g[i][j];
                if(!vis[v]) continue;
                E[i] += (E[i]+1)/g[i].size();
            }
        }
        Eb[pos] = E[1];
    }

    Pf[1] = 1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<g[i].size();j++){
            int v = g[i][j];
            Pf[v] += Pf[i]/g[i].size();
        }
    }

    LD ans = Ef[1];
    for(int i=1;i<=n;i++){
        if(g[i].size() <= 1) continue;
        LD res = Ef[1], mx = 0;
        for(int j=0;j<g[i].size();j++){
            int v = g[i][j];
            LD Ex1 = (Ef[v]+1)*Pf[i]/g[i].size() + Eb[i]*Pb[i]/g[i].size();
            LD Ex2 = (Ef[v]+1)*Pf[i]/(g[i].size()-1) + Eb[i]*Pb[i]/(g[i].size()-1);
            mx = max(mx, Ex2);
            res += Ex2-Ex1;
        }
        res -= mx;
        ans = min(ans, res);
    }
    printf("%.10Lf\n", ans);
}

Measured memory_bytes: 1408
<?php

ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING);
ini_set('display_errors', 'Off');

// define('DEBUG', true);
define('DEBUG', false);

fscanf(STDIN, "%s", $s);

$num = strlen($s) - 2;
$arr = str_split($s);

echo $arr[0];
echo $num;
echo $arr[count($arr) - 1];
echo PHP_EOL;

Measured memory_bytes: 4604
n,k= map(int, input().split())
a= list(map(int, input().split()))
a=[0]+a
x=[0]*(n+1)
s=a[1]
x[1]=1
v1=[1]
cnt1=1
v2=[]
cnt2=0
for i in range(10**7):
    if x[s]==0:
        x[s]+=1
        cnt1+=1
        v1.append(s)
        s=a[s]

    elif x[s]==1:
        cnt2+=1
        x[s] += 1
        v2.append(s)
        s = a[s]
    else:
        break

if k<cnt1:
    print(v1[k])
else:
    q=(k-cnt1)%cnt2
    print(v2[q])

Measured memory_bytes: 107480
N = int(input())
H = list(map(int,input().split()))

INF = float('inf')

def chmin(a,b):
    if a > b:
        return b
    else:
        return a

dp = [INF]*(10**5+10)
dp[0] = 0

for i in range(1,N):
    dp[i] = chmin(dp[i], dp[i-1] + abs(H[i] - H[i-1]))
    if i == 1:
        continue
    dp[i] = chmin(dp[i], dp[i-2] + abs(H[i] - H[i-2]))

print(dp[N-1])


Measured memory_bytes: 13928
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
    int N, M;
    std::cin >> N >> M;

//    if (N >= M) {
//        std::cout << 0 << std::endl;
//        return 0;
//    }

    std::vector<int> X(M);
    for (int i = 0; i < M; i++) {
        std::cin >> X[i];
    }

    std::sort(std::begin(X), std::end(X));

    std::vector<int> D(M);
    D[0] = 0;
    for (int i = 1; i < M; i++) {
        D[i] = X[i] - X[i-1];
    }

    std::sort(std::begin(D), std::end(D));

    int ans = 0;
    for (int i = 0; i < M-(N-1); i++) {
        ans += D[i];
    }


    std::cout << ans << std::endl;



    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	//0141
	static class SpiralPattern {
		//左から順に上移動(0)、右移動(1)、下移動(2)、左移動(3)
		// ()内の数字はsetDirectionNum
		int[][] xy_dir = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
		int y, x; //現在位置を記録する

		void print_a_spiral() {
			int inputNum = sc.nextInt();
			int[] spiralLen = new int[inputNum];
			for(int i=0; i<inputNum; i++) {
				spiralLen[i] = sc.nextInt();
			}
			for(int i=0; i<inputNum; i++) {
				char[][] field = new char[spiralLen[i]][spiralLen[i]];
				for(int j=0; j<spiralLen[i]; j++) {		// 拡張for文だと半角スペースが無視される？
					for(int k=0; k<spiralLen[i]; k++) {
						field[j][k] = ' ';
					}
				}

				y = spiralLen[i]-1;
				x = 0;
				field[y][x] = '#';
				int setNum_dir = 0; //初期値は上移動
				int dirChangeNum = 0; // 方向転換した回数
				for(;;) {
					if(dirChangeNum >= spiralLen[i] || spiralLen[i] == 1){
						break;
					}else if(y + xy_dir[setNum_dir][1]*2 < 0 || y + xy_dir[setNum_dir][1]*2 > spiralLen[i]-1 ||
							 x + xy_dir[setNum_dir][0]*2 < 0 || x + xy_dir[setNum_dir][0]*2 > spiralLen[i]-1) {
						y += xy_dir[setNum_dir][1];
						x += xy_dir[setNum_dir][0];
						field[y][x] = '#';
						dirChangeNum++;
						setNum_dir = dirChangeNum % 4;
					}else if(field[y + xy_dir[setNum_dir][1] * 2]
								  [x + xy_dir[setNum_dir][0] * 2] == '#') {
						dirChangeNum++;
						setNum_dir = dirChangeNum % 4;
					}else {
						y += xy_dir[setNum_dir][1];
						x += xy_dir[setNum_dir][0];
						field[y][x] = '#';
					}
				}

				for(int j=0; j<spiralLen[i]; j++) {
					for(int k=0; k<spiralLen[i]; k++) {
						System.out.print(field[j][k]);
					}
					System.out.println("");
				}
				if(i != inputNum-1) System.out.println("");
			}
		}
	}

	public static void main(String[] args) {
		SpiralPattern sp = new SpiralPattern();
		sp.print_a_spiral();
	}
}

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

#define M 200005
#define MOD 1000000007
#define PI 3.14159265358979323846
#define ep emplace_back
#define mk make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> PII;
typedef pair<lli,lli> PLL;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

//    freopen("input.txt","r",stdin);

    int x;
    cin>>x;
    
    if(x>=400 && x<=599)
        cout<<"8\n";
    else if(x>=600 && x<=799)
        cout<<"7\n";
    else if(x>=800 && x<=999)
        cout<<"6\n";
    else if(x>=1000 && x<=1199)
        cout<<"5\n";
    else if(x>=1200 && x<=1399)
        cout<<"4\n";
    else if(x>=1400 && x<=1599)
        cout<<"3\n";
    else if(x>=1600 && x<=1799)
        cout<<"2\n";
    else if(x>=1800 && x<=1999)
        cout<<"1\n";
}


Measured memory_bytes: 3604
import java.math.BigDecimal;
import java.util.Scanner;

public class Main{
	public Main(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		for(int i = 0; i < n; i++){
			BigDecimal f = new BigDecimal(sc.next());
			BigDecimal s = new BigDecimal(sc.next());
			
			f = f.add(s);
			String str = f.toString();
			if(str.length() > 80){
				System.out.println("overflow");
			} else {
				System.out.println(str);
			}
		}
	}
	
	public static void main(String[] args){
		Main test = new Main();
	}
}

Measured memory_bytes: 11000
#include<stdio.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
int main(){int x=0;char c=getchar();while(c>47&&c<58){x=x*10+c-48,x%=9,c=getchar();}return x?puts("No"):puts("Yes"),0;}

Measured memory_bytes: 1532
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {
  std::string S; std::cin >> S;
  std::string ans;

  for(auto&& s : S ) {
    if ( s == '1' ) ans += "9";
    else if ( s == '9' ) ans += "1";
    else ans += s;
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
n=gets.to_i
as=gets.split.map(&:to_i).sort
ans=0
cur=1
num=as[0]
for i in 0..n-1
  if as[i]==as[i+1]
    cur+=1
  else
    if num<cur
      ans+=cur-num
    elsif num>cur
      ans+=cur
    end
    num=as[i+1]
    cur=1
  end
end
puts ans


Measured memory_bytes: 10104
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 998244353
#define all(v) (v).rbegin(),(v).rend()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tihs if(fopen("inp.txt","r"))freopen("inp.txt", "r", stdin),freopen("out.txt", "w", stdout);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 

#define M 200010


int main(){
	IOS;
	tihs;

	ll n,m;cin>>n>>m;
	ll a[n];
	ll ans=0;
	ld sum=0.0;
	rep(i,0,n){
		cin>>a[i];sum+=a[i];
	}
	sum=sum/(ld)(4.00*(ld)m);
	rep(i,0,n)if((ld)a[i]>=sum)ans++;
	if(ans>=m)cout<<"Yes";
	else cout<<"No";


	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    map<string, long long> count_map;
    for(int i=0; i<n; i++){
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        count_map[s]++;
    }
    long long ans = 0;
    for(auto e: count_map){
        ans += e.second*(e.second - 1)/2;
    }
    cout << ans << endl;    
    return 0;
}


Measured memory_bytes: 11136
#include<stdio.h>



int main(void){
  float a,b,c,d,e,f;
  float x,y;
  // a((f - ey) / d) + by = c

  //y(- ae  +bd) =cd -af 

  for(;;){

    if(scanf("%f%f%f%f%f%f",&a,&b,&c,&d,&e,&f)!= 6)
      break;
    
    if(a == 0){
      y = c / b;
      x =  (f - e*(c/b)) / d;
    }else{
      y = (c*d - a*f) / (b*d - a*e);
      x = (c - b*y) / a;
    }
    
    printf("%.3f %.3f\n",x,y);
  }

  return 0;
}

Measured memory_bytes: 648
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)
	b := make([]int, len(a))
	copy(b, a)
	sort.Sort(sort.Reverse(sort.IntSlice(b)))

	lb, ub := int(-1e18), int(1e18)
	for ub-lb > 1 {
		mid := (lb + ub) / 2
		cnt := 0
		for i := 0; i < len(a); i++ {
			tmp := a[i+1:]
			if a[i] < 0 {
				tmp = b[:n-i-1]
			}
			l, r := -1, len(tmp)
			for r-l > 1 {
				m := (l + r) / 2
				if a[i]*tmp[m] < mid {
					l = m
				} else {
					r = m
				}
			}
			cnt += r
		}

		if cnt < k {
			lb = mid
		} else {
			ub = mid
		}
	}

	fmt.Println(lb)
}


Measured memory_bytes: 7680
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let mut seq = vec![("".to_string(), 0, 0); n];
    for i in 0..n {
        seq[i].0 = read::<String>();
        seq[i].1 = -read::<i64>();
        seq[i].2 = i + 1;
    }
    seq.sort();
    for i in 0..n {
        println!("{}", seq[i].2);
    }
}


Measured memory_bytes: 4352
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;

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

	if (s[0]=='R'&&s[1] == 'R'&&s[2] == 'R') {
		cout << 3 << endl;
	}
	else if (s[0] == 'R'&&s[1] == 'R' || s[2] == 'R'&&s[1] == 'R') {
		cout << 2 << endl;
	}
	else if (s[0] == 'S'&&s[1] == 'S'&&s[2] == 'S') {
		cout << 0 << endl;
	}
	else {
		cout << 1 << endl;
	}

	return 0;
}

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

int main()
{
	string s,t;
	cin >> s >> t;
	int n = s.length(), m = t.length();
	vector<vector<pair<int,int>>> dp(n+1, vector<pair<int,int>>(m+1));
	for (int q = 1; q <= n; q++)
	{
		dp[q][0].second = 2;
	}
	for (int q = 1; q <= m; q++)
	{
		dp[0][q].second = 3;
	}
	for (int q = 1; q <= n; q++)
	{
		for (int w = 1; w <= m; w++)
		{
			if (s[q-1] == t[w-1])
			{
				dp[q][w] = {dp[q-1][w-1].first + 1, 1};
			}
			else
			{
				if (dp[q-1][w] > dp[q][w-1])
				{
					dp[q][w] = {dp[q-1][w].first, 2};
				}
				else
				{
					dp[q][w] = {dp[q][w-1].first, 3};
				}
			}
		}
	}
	vector<char> ans;
	int x = n, y = m;
	while (x != 0 || y != 0)
	{
		if (x > 0 && y > 0)
		{
			if (s[x-1] == t[y-1])
			{
				ans.push_back(s[x-1]);
			}
		}
		if (dp[x][y].second == 1)
		{
			x--;
			y--;
		}
		else if (dp[x][y].second == 2)
		{
			x--;
		}
		else
		{
			y--;
		}
	}
	for (int q = ans.size()-1; q >= 0; q--)
	{
		cout << ans[q];
	}
	cout << "\n";
	return 0;
}


Measured memory_bytes: 70784
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define mc map<char, int>
#define ms map<string, int>
#define vi vector<int>
#define test int t; cin >> t;
using namespace std;
 
//*insayn ka code*  (凸ಠ益ಠ)凸
 
signed main() {
    quickie 
    int n, k ;
    cin >> n >> k ;
    int a[n], b[n] ;
    b[n-1] = 0 ;
    rep(i, 0, n) {
        cin >> a[i] ;
    }
    for(int i=n-2; i>=0; i--) {
        int c = 0, j = 1, min = 100000000000000 ;
        while(c<k && i+j < n) {
            if(abs(a[i]-a[i+j])+b[i+j] < min) {
                min = abs(a[i]-a[i+j])+b[i+j] ;
            }
            j++ ;
            c++ ;
        }
        b[i] = min ;
    }
    cout << b[0] << endl ;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

const long long int MAX_N = 100000;

int main(int argc, char const *argv[]) {
  long long int n, k;
  vector<long long int> a(MAX_N,0);
  cin >> n >> k;
  a.resize(n);
  for (size_t i = 0; i < n; i++) cin >> a[i];

  long long int ans = 0;

  ans += ((n-1) + (k-2)) / (k-1);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll k;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>k;
    ll tmp = 0;
    repi(i,1,k+1){
        repi(j,1,k+1){
            repi(s,1,k+1){
                tmp += __gcd(i,__gcd(j,s));
            }
        }
    }
    print(tmp);
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
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;} //最小公倍数

//-------------------------------------------------
//
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
//




//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s, t ;
  cin >> s >> t ;
  int a, b ;
  cin >> a >> b ;
  string u ;
  cin >> u ;
  if(u==s){
    cout << a-1 << " " << b <<endl ;
  }
  else{
    cout << a << " " << b-1 <<endl ;
  }
  
  
  
  return 0 ;
}

Measured memory_bytes: 256
#include <algorithm>  //sort,二分探索,など
#include <array>
#include <bitset>         //固定長bit集合
#include <cmath>          //pow,logなど
#include <complex>        //複素数
#include <deque>          //両端アクセスのキュー
#include <functional>     //sortのgreater
#include <iomanip>        //setprecision(浮動小数点の出力の誤差)
#include <iostream>       //入出力
#include <map>            //map(辞書)s
#include <numeric>        //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>          //キュー
#include <set>            //集合
#include <stack>          //スタック
#include <string>         //文字列
#include <unordered_map>  //イテレータあるけど順序保持しないmap
#include <unordered_set>  //イテレータあるけど順序保持しないset
#include <utility>        //pair
#include <vector>         //可変長配列

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 1; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())  // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main() {
  int k;
  cin >> k;
  ll ans = 0;
  REP(a, k+1)
  REP(b, k+1)
  REP(c, k+1){ans += gcd(a, gcd(b, c));} cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3576
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int[] p = new int[A];
		Arrays.setAll(p, i -> sc.nextInt());
		Arrays.sort(p);
		int[] q = new int[B];
		Arrays.setAll(q, i -> sc.nextInt());
		Arrays.sort(q);
		int[] r = new int[C];
		Arrays.setAll(r, i -> sc.nextInt());
		Arrays.sort(r);
		long ans = 0;
		int red = A-X, green = B-Y;
		for(int i = C-1; i >= 0; i--) {
			if(r[i] < p[red] && r[i] < q[green])
				break;
			ans += r[i];
			if(p[red] > q[green])
				green++;
			else 
				red++;
			if(red == A) {
				red = 0;
				p[0] = 1_000_000_001;
			}
			if(green == B) {
				green = 0;
				q[0] = 1_000_000_001;
			}
		}
		if(p[0] != 1_000_000_001) {
			for(int i = red; i < A; i++)
				ans += p[i];
		}
		if(q[0] != 1_000_000_001) {
			for(int i = green; i < B; i++)
				ans += q[i];
		}
		System.out.println(ans);

	}

}


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




int arr[101];

int main() {
  vector<int> bs;
  int n; cin >> n;
  for(int i = 0; i< n-1; i++) {
    int x; cin >> x; bs.push_back(x);
  }
  arr[0] = bs[0];
  for(int i = 1; i < n-1; i++) {
    arr[i] = min(bs[i], bs[i-1]);
  }
  arr[n-1] = bs[n-2];
  int res = 0;
  for(int i = 0; i <n; i++) res += arr[i];
  cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n, m; cin>>n>>m;
	vector<long long>assign(m);
	long long tot=0;
	for (int i = 0; i < m; ++i){
		cin>>assign[i];
		tot+=assign[i];
	}
	if(n-tot<0){
		cout<<-1<<endl;
	}
	else{
		cout<<n-tot<<endl;
	}
	return 0;
}

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

#define ll long long
#define arrInput(arr, start, end)    \
    for (ll i = start; i < end; i++) \
        cin >> arr[i];

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

    ll res = 1e9;
    for (ll i = 0; i + t.size() - 1 < s.size(); i++)
    {
        string tmp = s.substr(i, t.size());

        ll ne = 0;
        for (ll j = 0; j < t.size(); j++)
            ne += (tmp[j] != t[j]);

        res = min(res, ne);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 3592
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Array as A

main :: IO ()
main = do
  (n : m : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    switchPatterns = map (A.listArray (1, n)) . sequence . replicate n $ [False, True] :: [A.Array Int Bool]
  sss <- sequence . replicate m $ tail . map unsafeSignedDecimal . T.words <$> T.getLine :: IO [[Int]]
  ps <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    f :: A.Array Int Bool -> Bool
    f bs = all ((==) <$> (`mod` 2) . length . filter (== True) . map (bs A.!) . fst <*> snd) $ zip sss ps
  print . length . filter f $ switchPatterns

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 1020
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
int main(){
	double a,b,c,d,e,f,x,y;
	while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF){
		x=(c*e-b*f)/(a*e-b*d);
		y=(c*d-a*f)/(b*d-a*e);
		if(x==-0)x=0;
		if(y==-0)y=0;
		printf("%.3lf %.3lf\n",x,y);
	}
    return 0;
	
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define Int long long
#define rep(i,n) for(int i=0; i<n; ++i)
using namespace std;
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;}
int main() {
  int W, H; cin >> H >> W;
  vector<string> S(H);
  rep(i,H) cin >> S[i];
  rep(i,W+2) cout << "#";
  cout << endl;
  rep(i,H) cout << "#" << S[i] << "#" << endl;
  rep(i,W+2) cout << "#";
  cout << endl;
}


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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  if(n== 1){
    cout << "YES" << endl;
    return 0;
  }
  map<int, int> mp;
  rep(i,n){
    int a = s[i] - 'a';
    mp[a]++;
  }
  if(n == 2){
    if(mp.size() == 2){
      cout << "YES" << endl;
      return 0;
    }else {
      cout << "NO" << endl;
      return 0;
    }
  }
  if(mp.size() ==2){
    cout << "NO" << endl;
    return 0;
  }
  ll mn = min(mp[0], min(mp[1], mp[2]));
  mp[0] -= mn;
  mp[1] -= mn;
  mp[2] -= mn;
  if(mp[0] + mp[1] + mp[2] > 2){
    cout << "NO" << endl;
  }else if( mp[0] + mp[1] + mp[2] == 2){
    if(mp[0] == 2 || mp[1] == 2 || mp[2] == 2){
      cout << "NO" << endl;
    }else{
      cout << "YES" << endl;
    }
  }else {
    cout << "YES" << endl;
  }
}

Measured memory_bytes: 512
n,m = map(int,input().split())
h = list(map(int,input().split()))
ab = [list(map(int,input().split())) for _ in range(m)]

place = [True]*n

for i in range(m):
    a,b = ab[i][0],ab[i][1]
    if h[a-1] < h[b-1]:
        place[a-1] = False
    elif h[a-1] == h[b-1]:
        place[a-1] = False
        place[b-1] = False
    else:
        place[b-1] = False

print(place.count(True))


Measured memory_bytes: 32060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int a; cin>>a;
    cout<<a+a*a+a*a*a<<endl;
}

Measured memory_bytes: 3620
#include <stdio.h>

int main(void){
	
	double a,b;
	scanf("%lf\n%lf",&a,&b);
	
	if(a>b)printf("GREATER\n");
	if(a<b)printf("LESS\n");
	if(a==b)printf("EQUAL\n");
	return 0;
}


Measured memory_bytes: 128
function main()
n=parse(Int,readline())
a=parse.(Int,split(readline()))
pushfirst!(a,0)
push!(a,0)
d=[abs(a[i]-a[i-1]) for i=2:n+2]
∑=sum(d)
pushfirst!(d,0)
d2=[abs(a[i+1]-a[i-1]) for i=2:n+1]
push!(d2,0)
pushfirst!(d2,0)
for i=2:n+1
  ∑-d[i]-d[i+1]+d2[i]|>println end
end
main()

Measured memory_bytes: 207232
#include <iostream>
using namespace std;
const int maxn = 100000;
string S; int res[maxn],ans[maxn];
int main() {
    cin.sync_with_stdio(0); cin.tie(0); cin>>S;
    for (int i = 0,j,k;i < S.size();i = j) {
        for (j = i;j < S.size() && S[j] == 'R';j++);
        for (j--,k = j;j >= i;j--) res[j] = k-j&1?k+1:k;
        for (j = k+1;j < S.size() && S[j] == 'L';j++) res[j] = j-k&1?k+1:k;
    }
    for (int i = 0;i < S.size();i++) ans[res[i]]++;
    for (int i = 0;i < S.size();i++) printf("%d ",ans[i]); printf("\n");
}


Measured memory_bytes: 1488
import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        StringBuilder sb = new StringBuilder();
        for (int i = 0;i < 3;i++) {
            sb.append(sc.next().charAt(0));
        }
        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 9684
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
long long mod = 1e9+7;

int main(void) {
  int n; cin >> n;
  vector<pair<int, int>> p(n);
  for(int i=0; i<n; i++) {
    cin >> p[i].second >> p[i].first;
  }
  sort(p.begin(), p.end());

  long long sum = 0;
  for(int i=0; i<n; i++) {
    sum += p[i].second;
    if(sum > p[i].first) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
}

// EOF


Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100005
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int cmp(const void* a,const void* b){return *(int*)a-*(int*)b;}

int main() {
  int N,K,ans=0;
  scanf("%d%d",&N,&K);
  if(K==1)ans=0;
  else ans=N-K;

  printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N;
    cin >> N;
    ll count = 0;
    REPS(i,10000000){
        if(i == 1)continue;
        int as = i;
        for(int l = 1;;l++){
            if(N % as == 0){
                count++;
                N/=as;
            }else{
                break;
            }
            as *= i;
        }
        for(;;){
            if(N % i == 0){
                N/=i;
            }else{
                break;
            }
        }
    }
    if(N != 1)count++;
    cout << count << "\n";
}

Measured memory_bytes: 3652
### main

while true
  n = gets.strip.to_i
  break if n == 0

  pls = gets.strip.split(' ').map{|s| s.to_i}

  diffs = []
  dhash = Hash.new(0)

  for i in (1...pls.length)
    diffs[i - 1] = d = pls[i] - pls[i - 1]
    dhash[d] += 1
  end

  md = dhash.keys.max{|a, b| dhash[a] <=> dhash[b]}

  for i in (0...pls.length)
    if diffs[i] != md
      if i < pls.length - 1 && diffs[i + 1] != md
        puts pls[i + 1]
      else
        puts pls[i]
      end
      break
    end
  end
end

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

public class MainClass
{
	public const long Giri = 1000000007;
	
	public static void Main(string[] args)
	{
		int n = Console.ReadLine().ToInt();
		Console.WriteLine(((n - (n / 2)) / (double)n));
	}
	
	public static long GCD(long a, long b)
	{
		if(b == 1) return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		int[] r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
	
}

Measured memory_bytes: 11092
#include <iostream>
#include <cstdlib>
#include <sstream>

using namespace std;

int main(int, char ** const) {
  int n,j = 0;
  string line, item;
  cin >> n;
  int a[n];
  cin.ignore();
  getline(cin, line);
  stringstream ss(line);
  while(getline(ss, item, ' '))
    a[j++] = atoi(item.c_str());
  for(int i = n - 1; i >= 0; i--) {
    cout << a[i];
    if(i != 0)
      cout << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3148
#pragma GCC optimize("Ofast,fast-math,unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()
#define fi first
#define se second
#define sqrt(x) sqrt(abs(x))
#define sqr(x) ((x) * (x))
#define unq(x) (x.resize(unique(all(x)) - x.begin()))
#define fill(x, y) memset(x, y, sizeof(x))
#define mp make_pair
#define pb emplace_back
#define popcnt __builtin_popcount
#define ctz __builtin_ctz

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;

template <class T> using indexed_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

template <class T, class U>
istream& operator >> (istream &in, pair <T, U> &p) {
    in >> p.first >> p.second;
    return in;
}

template <class T, class U>
ostream& operator << (ostream &out, pair <T, U> &p) {
    out << p.first << ' ' << p.second;
    return out;
}

template <class T>
istream& operator >> (istream &in, vector <T> &a) {
    for (T &i: a) in >> i;
    return in;
}

template <class T>
ostream& operator << (ostream &out, vector <T> &a) {
    for (T i: a) out << i << ' ';
    out << '\n';
    return out;
}

template <class T>
ostream& operator << (ostream &out, set <T> &a) {
    for (T i: a) out << i << ' ';
    out << '\n';
    return out;
}

void fastIO() {
    ios_base:: sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
}

ll n;

ll cnt_div(ll x) {
    ll ans = 1;

    for (ll i = 2; i * i <= x; ++i) {
        ll cur = 0;

        while (x % i == 0) {
            x /= i;
            ++cur;
        }

        ans *= (cur + 1);
    }

    if (x != 1) ans *= 2;

    return ans;
}

bool check(ll a, ll b) {
    while (a % b == 0) a /= b;

    return a == 1 || a % b == 1;
}

signed main() {
    fastIO();

    cin >> n;
    ll ans = cnt_div(n - 1);

    for (ll i = 2; i * i <= n; ++i) {
        if (n % i == 0) {
            if (i * i == n) {
                if (check(n, i)) ++ans;
            }

            else {
                if (check(n, i)) ++ans;
                if (check(n, n / i)) ++ans;
            }
        }
    }

    cout << ans;

    return 0;
}

/// ЗАПУСКАЕМ ГУСЯ:
/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐
    ▐░░░░░▐
    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌        */



Measured memory_bytes: 256
import java.util.*;

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

        while(true){
            String ts = sc.nextLine();
            if(ts.equals(".")) break;

            String s = "";

            for(int i = 0; i < ts.length(); i++){
                if(ts.charAt(i) == '(' || ts.charAt(i) == ')' ||
                   ts.charAt(i) == '[' || ts.charAt(i) == ']'){
                    s += ts.charAt(i);
                }
            }

            while(true){
                boolean flg = true;
                ts = s;

                s = s.replaceAll("\\(\\)", "");
                s = s.replaceAll("\\[\\]", "");

                if(ts.length() == s.length()){
                    break;
                }
            }

            if(s.length() == 0){
                System.out.println("yes");
            }
            else{
                System.out.println("no");
            }
        }
    }
}

Measured memory_bytes: 13000
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
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 int dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

vector<ll> a;
map<ll,ll> m;

int main()
{
	int x, y, z;
	int ans;
	int cnt = 0;
	cin >> x >> y >> z;
	ans = z;

	while (1) {
		ans += y + z;
		if (ans > x) {
			break;
		}
		cnt++;
	}
	
	cout << cnt << endl;
	
	return 0;
}



Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))
lst = []
cnt = 0
for i in range(n - 2):
    lst = [p[i], p[i + 1], p[i + 2]]
    lst.sort()
    if lst[1] == p[i + 1]:
        cnt += 1

print(cnt)

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

int main(){
	vector<int> h(10);
	for(int i=0;i<10;i++){
		cin >> h[i];
	}

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

	for(int i=9;i>=7;i--){
		cout << h[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 3128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    array<int, 6> di{1, 1, 0, 0, -1, -1}, dj{0, 1, -1, 1, -1, 0};
    int t, n;
    while(cin >> t >> n, t){
        map<pair<int, int>, int> v, visited;
        for (int i = 0; i < n; ++i) {
            int a, b;
            scanf("%d %d", &a, &b);
            v[{b, a}] = 1;
        }
        int x, y;
        cin >> x >> y;
        queue<pair<int, int>> q;
        q.emplace(y, x);
        int ans = 0;
        v[{y, x}] = 0;
        while(!q.empty()){
            int a, b; tie(a, b) = q.front(); q.pop();
            visited[{a, b}] = 1;
            if(v[{a, b}] == t) continue;
            for (int k = 0; k < 6; ++k) {
                if(!v.count({a+di[k], b+dj[k]}) && !visited.count({a+di[k], b+dj[k]})){
                    v[{a+di[k], b+dj[k]}] = v[{a, b}]+1;
                    ans++;
                    q.emplace(a+di[k], b+dj[k]);
                }
            }
        }
        cout << ans+1 << "\n";
    }
    return 0;
}


Measured memory_bytes: 3560