akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#include <boost/multiprecision/cpp_int.hpp>
#define FASTIO
using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

template <typename T1, typename T2>
bool chmin(T1& a, const T2& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <typename T1, typename T2>
bool chmax(T1& a, const T2& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(const Args&... args) const { print(args...); }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(const T& head, const Tail&... tail) const { std::cout << head, print_rest(tail...); }
        template <class T, class... Tail>
        void print_rest(const T& head, const Tail&... tail) const { std::cout << sep << head, print_rest(tail...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    boost::multiprecision::cpp_int a;
    cin >> a;
    prints()(a % 9 == 0 ? "Yes" : "No");
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    cout << setprecision(18) << fixed;
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3784
program ABC163_D
  integer(8),allocatable::A(:)
  read(*,*)N,M
  allocate(A(N+1))
  A(1)=N+1
  do i=2,N+1
     A(i)=A(i-1)+N+2-2*i
  end do
  write(*,*)mod(sum(A(M:N+1)),10**9+7)
end program ABC163_D

Measured memory_bytes: 4352
#include<stdio.h>
#include<string.h>
int main(){
	char a[50],b[50];
	gets(a);
	gets(b);
	int i,flag=1,n=strlen(a);
	for(i=0;i<n;i++){
		if(a[i]!=b[i])flag=0;
	}
	if(flag)printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 1644
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        mut ab: [(i64, i64); n],
    }

    ab.sort_by_key(|&(a, b)| a + b);
    ab.reverse();

    let mut ans = 0;

    for i in 0..n {
        if i % 2 == 0 {
            ans += ab[i].0
        } else {
            ans -= ab[i].1
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		String T_changed = T.substring(0,T.length()-1);

		if(T_changed.equals(S)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 35680
N, M = map(int, input().split())
a = list(map(int, input().split()))
for k in range(N):
  a[k] //= 2

foo = 1
while a[0]%2 == 0:
  foo *= 2
  a[0] //= 2
for k in range(1, N):
  if a[k] % foo == 0 and a[k]%(2*foo) !=0:
    a[k] //= foo
    continue
  else:
    print(0)
    exit()
ans = 0

for odd in [3, 5, 7, 11]:
  flag = False
  for k in range(N):
    if a[k]%odd == 0:
      a[k] //= odd
      flag = True
  if flag:
    foo *= odd
 
 
import math

lcm = a.pop()
for k in range(1, N):
  b = a.pop()
  lcm = lcm * b // math.gcd(lcm, b)
  if lcm* foo > M:
    print(0)
    exit()
lcm *= foo
ans = int((M / lcm -1)//2 + 1)
print(ans)

Measured memory_bytes: 20152
#include<stdio.h>
#include<stdlib.h>

#define NMAX 2000001

int n;
int A[NMAX],B[NMAX],C[NMAX];

void CountingSort(int k);

int main(void){
  int i,k;

  scanf("%d",&n);

  k=0;
  for(i=0; i<n; i++){
    scanf("%d",&A[i]);
    if(k <= A[i]) k=A[i];
  }

  CountingSort(k);

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

  return 0;
}

void CountingSort(int k){
  int i,j;

  for(i=0; i<=k; i++) C[i]=0;

  for(j=0; j<n; j++)C[A[j]]=C[A[j]]+1;

  for(i=1; i<=k; i++) C[i]+=C[i-1];

  for(j=n-1; j>=0; j--){
    B[C[A[j]]-1] = A[j];
    C[A[j]] = C[A[j]]-1;
  }

}

Measured memory_bytes: 17892
#include<bits/stdc++.h>
using namespace std;
int l[105];
int main(){
	int n,ans=0;scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",l+i);
	sort(l,l+n);
	for(int i=0;i<n;i++){
		int j=i+1;while(l[j]==l[i])j++;
		for(;j<n;j++){
			int k=j+1;while(l[j]==l[k])k++;
			for(;k<n;k++)if(l[i]+l[j]>l[k])ans++;
		}
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 3800
parseInt(x) = parse(Int,x)
parseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)

function main()
  (H,A) = map(parseInt, split(readline()))
  c = 0
  for i = 1:10^4
    if H > 0
      H -= A
      c += 1
    end
  end
  println(c)
end

main()

Measured memory_bytes: 166448
x=int(input())
A=[i**5 for i in range(-1000,1000)]
B=[i**5 for i in range(-1000,1000)]

for a in A:
    for b in B:
        if a-b==x:
            if a<0:
                a=abs(a)
                a=a**0.2
                ans_a=int(-a)
            else:
                a=abs(a)
                a=a**0.2
                ans_a=int(a)
            if b<0:
                b=abs(b)
                b=b**0.2
                ans_b=int(-b)
            else:
                b=abs(b)
                b=b**0.2
                ans_b=int(b)                
print(ans_a,ans_b)

Measured memory_bytes: 9604
using System;
 using System.Linq;
 
 class Program {
     public static void Main(string[] args) {
         var n = Console.ReadLine();
         var l = Console.ReadLine().Split(' ')
             .Select(int.Parse).ToList();
         l.Sort();
         var total = l.Where((a, i) => i % 2 == 0).Sum();
         Console.WriteLine(total);
     }
 }

Measured memory_bytes: 13396
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#define ll long long
#define ull long long unsigned
using namespace std;
#define foru(i,a,n) for (int i=(a); i<=(n); i++)
#define ford(i,n,a) for (int i=(n); i>=(a); i--)
#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define bit1cnt(x) (__builtin_popcountll(x))
#define bit0dau(x) (__builtin_clzll(x))
#define bit0cuoi(x) (__builtin_ctzll(x))
#define sqr(x) ((x) * (x))
#define sz(x) ((int)(x.size()))
#define Pi 3.14159265358979
#define ii pair<int,int>
#define LL pair<ll,ll>
#define vi vector<int>
#define vl vector<long long>
const int N = 200;
ll a, b, hai[N];
///25 50 100
int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    hai[0] = 1; foru(i,1,63) hai[i] = hai[i-1]*2;
    cin >>a >>b;
    int vt = upper_bound(hai, hai+63, b/a) - hai;
    cout <<vt;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

ll factorial(ll k) {
	ll sum = 1;
	for (ll i = 1; i <= k; ++i)
	{
		sum *= i;
	}
	return sum;
}


void solve_abc105_d() {
	ll N, M;

	cin >> N >> M;

	ll A;
	vector<ll> sum(N+1,0);
	multimap<ll,ll> ms;
	rep(i, N) {
		cin >> A;
		sum[i + 1] = (sum[i] + A) % M;
		if (ms.find(sum[i + 1])!=ms.end()) {
			ms.find(sum[i + 1])->second++;
		}
		else {
			ms.emplace(sum[i + 1], 1);
		}
	}

	ll ans = 0;
	for (auto itr = ms.begin(); itr != ms.end(); itr++) {
		if (itr->first == 0) {
			ans += ((ll)itr->second * ((ll)itr->second - 1)) / 2 + (ll)itr->second;
		}
		else if (itr->second > 1) {
			if (itr->second == 2) {
				ans += 1;
			}
			else {
				ans += ((ll)itr->second * ((ll)itr->second - 1)) / 2;
			}
		}
	}
	
	cout << ans << "\n";
}

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

	solve_abc105_d();

	return 0;
}

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

int main() {
	int n;
	cin >> n;
	int arr[n];
	int count = 0;
	int small = 2*(1e5) + 1;
	for (int i = 0; i < n; ++i) {
		cin >> arr[i];
		if (arr[i] < small) {
			small = arr[i];
			count++;
		}
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 1024
package main

import (
	"fmt"
	"math"
)

func main() {
	Pow := math.Pow
	var c1x, c1y, c1r int
	var c2x, c2y, c2r int

	fmt.Scanf("%d %d %d", &c1x, &c1y, &c1r)
	fmt.Scanf("%d %d %d", &c2x, &c2y, &c2r)

	d := math.Sqrt(Pow(float64(c2x-c1x), 2) + Pow(float64(c2y-c1y), 2))

	if d < math.Abs(float64(c2r-c1r)) {
		fmt.Println(0)
	} else if d == math.Abs(float64(c2r-c1r)) {
		fmt.Println(1)
	} else if math.Abs(float64(c2r-c1r)) < d && d < math.Abs(float64(c1r+c2r)) {
		fmt.Println(2)
	} else if d == math.Abs(float64(c1r+c2r)) {
		fmt.Println(3)
	} else if d > math.Abs(float64(c1r+c2r)) {
		fmt.Println(4)
	}
}




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

int main()
{
	ll x,y,a,b,c,temp;
	cin>>x>>y>>a>>b>>c;
	priority_queue <ll> red,gre,col;
	
	for(int i=1;i<=a;i++){
		cin>>temp;
		red.push(temp);
	}
	for(int i=1;i<=b;i++){
		cin>>temp;
		gre.push(temp);
	}
	for(int i=1;i<=c;i++){
		cin>>temp;
		col.push(temp);
	}
	
	priority_queue <ll> ans;
	for(int i=1;i<=x;i++){
		if(red.empty()){
			ans.push(col.top());
			col.pop();
		}
		else{
			ans.push(red.top());
			red.pop();
		}
	}
	for(int i=1;i<=y;i++){
		if(gre.empty()){
			ans.push(col.top());
			col.pop();
		}
		else{
			ans.push(gre.top());
			gre.pop();
		}
	}
	
	ll cnt = x+ y;
	ll maxx =0;
	while(cnt--)
	{
		if(!ans.empty() && !col.empty()){
			if(ans.top()>=col.top()){
				maxx +=ans.top();	ans.pop();
			}
			else{	maxx += col.top(); col.pop();	}
		}
		else if(!ans.empty()){
			maxx +=ans.top();	ans.pop();
		}
		else if(!col.empty()){
			maxx +=col.top();	col.pop();
		}
	}
	cout<<maxx;
	
}

Measured memory_bytes: 4852
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
using namespace std;

#define int long long

string s;
int k;

int toCost(char a, char b) {
	return ((int)b + 26 - (int)a) % 26;
}

signed main() {
	cin >> s >> k;
	
	int i, j;
	int rem = k;
	
	string ans;
	for (i = 0; i < s.length(); i++) {
		for (j = 0; j < 26; j++) {
			if (toCost(s[i], 'a' + j) <= rem) {
				ans += 'a' + j;
				rem -= toCost(s[i], 'a' + j);
				break;
			}
		}
	}
	
	//余った操作を一番左の文字に対して行う
	for (i = 0; i < (rem % 26); i++) {
		char c = ans[(int)ans.length() - 1];
		if (c == 'z') ans[(int)ans.length() - 1] = 'a';
		else ans[(int)ans.length() - 1] = (char)(c + 1);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>

long long lucas[86];

long long calc_lucas(int elem){

	if(elem >= 2){

		if(lucas[elem - 1] == -1){
			lucas[elem - 1] = calc_lucas(elem - 1);
		}

		if(lucas[elem - 2] == -1){
			lucas[elem - 2] = calc_lucas(elem - 2);
		}
		return lucas[elem - 1] + lucas[elem - 2];
	}

	return (elem == 0) ? 2 : 1;
}


int main(){

	int n;
	std::cin >> n;

	for(int i = 0; i < 86; i++){
		lucas[i] = -1;
	}

	std::cout << calc_lucas(n) << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll 				long long
#define ld 				long double
#define fastio 			ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define debug(x) 		cerr<<#x<<" "<<x<<endl
#define cina(a,n) 		for(ll i = 0;i<n;i++)	cin>>a[i];
#define couta(a,n) 		for(ll i = 0;i<n;i++) cout<<a[i]<<" ";
#define fauto(ar)		for(auto x : ar)	cout<<x<<" ";
#define mod 			1000000007
#define siz 			105
#define f 				first
#define s 				second
#define pb 				push_back
#define endl 			"\n"
#define ci 				cin.ignore()
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(auto x : s)
	cout<<'x';
	
}

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

int main(){
  int s,ai,cnt=1;
  cin>>s;
  for(int i=0;;i++){
    if(s==4||s==2||s==1){
      cout<<cnt+3<<endl;
      return 0;
    }
    if(s%2){
      ai=3*s+1;
      s=ai;
    }else{
      ai=s/2;
      s=ai;
    }
    cnt++;
    if(ai==4||ai==2||ai==1){
      cout<<cnt+3<<endl;
      return 0;
    }
  }
}

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

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];

    int x = 1;
    for (int i = 0; i < N; i++) {
        if (a[i] == x) x++;
    }

    if (x == 1) cout << -1 << endl;
    else cout << N - x + 1 << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
    int a,b,c,i,sum=0;
    scanf("%d %d %d",&a,&b,&c);
    for(i=a;i<=b;i++){
        if(c%i==0){
            sum++;
        }
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 2132
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
            int a = scan.nextInt();
            int b = scan.nextInt();
            int c = scan.nextInt();
            int d = scan.nextInt();
            int e = scan.nextInt();
            int f = scan.nextInt();
            double y = (a * f - d * c) / (double)(a * e - d * b);
            double x = (c - b * y) / a;
            System.out.println(String.format("%.3f", x) + " " + String.format("%.3f", y));
        }
    }
}



Measured memory_bytes: 26168
#include<vector>
#include<stdio.h>
#include<sstream>
#include<map>
#include<algorithm>
#include<string>
#include<iostream>
#include<queue>
#include<fstream>

using namespace std;

int main(){
	int N;
	cin >> N;
	vector<int>answer;
	int sum = 0;
	for (int i = 1; i < N+1; i++){
		sum += i;
		answer.push_back(i);
		if (sum >= N){
			break;
		}
	}
	int diff = sum - N;
	int ignore = -1;
	if (diff != 0){
		for (int i = 0; i < answer.size(); i++){
			if (answer[i] == diff){
				ignore = i;
			}
		}
	}
	for (int i = 0; i < answer.size(); i++){
		if (i != ignore){
			cout << answer[i] << endl;
		}
	}

}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

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

ll N, M;
string S;
ll ans = (ll)1e18;

void solve() {
    cin >> S >> N;
    rep(i,S.size()) if (i % N == 0) cout << S[i];
    cout << endl;
}

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


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

vector<char> ans;

inline void rec(ll n) {
    if (n / 26 == 0) {
        char c = 'a' + (n % 26);
        ans.push_back(c);
        return ;
    }
    rec(n % 26);
    rec(n / 26 - 1);
}

int main() {
    cin.tie(0)->sync_with_stdio(false);
    ll n; cin >> n;
    n--;

    rec(n);
    reverse(ans.begin(), ans.end());
    for (auto x : ans) cout << x;
    cout << '\n';
    return 0;
}


Measured memory_bytes: 3696
#include "bits/stdc++.h"
using namespace std;
#define REP(i,a) for(int i = 0; i < (a);i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using Graph = vector < vector<int>>;
long int sum[200020] = {};
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x) {
	return(x + 9) / 10 * 10;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

int main() {
	int A, B;
	cin >> A >> B;
	int D;
	D = lcm(A, B);
	vector<int> s;
	for (int i = 1; i <= D; i++) {
		if (D % i == 0) {
			s.push_back(i);
		}
	}
	sort(s.begin(), s.end(), greater<int>());
	int K;
	cin >> K;
	cout << s[K - 1];

}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, xx = 0, ans = 0;
	string ss;
	cin >> nn >> ss;
	for(int64 ii = 0;ii < nn;ii++)
	{
		if(ss[ii] == 'I')
		{
			xx++;
		}
		else
		{
			xx--;
		}
		ans = max(ans, xx);
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3572
#include <iostream>

using namespace std;

int main() {
   int a,b;
   cin>>a>>b;
   int arr[b];
   int sum=0;
   for(int i=0;i<b;i++)
   {
       cin>>arr[i];
       sum = sum + arr[i];
   }
   
  if(sum>=a)
  {
      cout<<"Yes";
  }
  else
  {
      cout<<"No";
  }
}

Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

ll mod(ll a){
  return (a % 1000000007);
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

ll nCr(ll n,ll r){
  if(r == 1) return n;
  else if(r == 0) return 1;
  else return nCr(n-1,r-1)*n/r;
}

int main(){
  ll n; cin >> n; ll ans = 1e10;
  
  while(n > 99){
    ans = min(abs(753 -(n % 1000)),ans);
    n /= 10;
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

template <int M> class ModInt {
    int x;

  public:
    constexpr ModInt() : x(0) {}
    constexpr ModInt(int64_t y) : x(y >= 0 ? y % M : (M - (-y) % M) % M) {}
    constexpr ModInt &operator+=(const ModInt p) {
        if((x += p.x) >= M) x -= M;
        return *this;
    }
    constexpr ModInt &operator-=(const ModInt p) {
        if((x += M - p.x) >= M) x -= M;
        return *this;
    }
    constexpr ModInt &operator*=(const ModInt p) {
        x = (int)(1LL * x * p.x % M);
        return *this;
    }
    constexpr ModInt &operator/=(const ModInt p) {
        *this *= p.inverse();
        return *this;
    }
    constexpr ModInt operator-() const { return ModInt(-x); }
    constexpr ModInt operator+(const ModInt p) const {
        return ModInt(*this) += p;
    }
    constexpr ModInt operator-(const ModInt p) const {
        return ModInt(*this) -= p;
    }
    constexpr ModInt operator*(const ModInt p) const {
        return ModInt(*this) *= p;
    }
    constexpr ModInt operator/(const ModInt p) const {
        return ModInt(*this) /= p;
    }
    constexpr bool operator==(const ModInt p) const { return x == p.x; }
    constexpr bool operator!=(const ModInt p) const { return x != p.x; }
    constexpr ModInt inverse() const {
        int a = x, b = M, u = 1, v = 0, t = 0;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }
    constexpr ModInt pow(int64_t k) const {
        ModInt ret(1), mul(x);
        while(k > 0) {
            if(k & 1) ret *= mul;
            mul *= mul;
            k >>= 1;
        }
        return ret;
    }
    constexpr friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }
    constexpr friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t = 0;
        is >> t;
        a = ModInt(t);
        return (is);
    }
};
using mint = ModInt<mod>;

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

    int n;
    cin >> n;
    vector<mint> a(n);
    rep(i, n) cin >> a[i];

    mint ans;
    rep(i, n) ans -= a[i] * a[i];

    mint sum = 0;
    rep(i, n) sum += a[i];
    ans += sum * sum;
    cout << ans / 2 << endl;

    return 0;
}

Measured memory_bytes: 3988
#include<stdio.h>
#include<math.h>
int main()
{
    long long int a,b,c,temp,gcd;
    int i;
    scanf("%lld%lld",&a,&b);
    c=a*b;
    if(a>b)
        temp=b;
    else
        temp=a;
    for(i=1;i<=temp;i++)
    {
        if(a%i==0 && b%i==0)
        {
        gcd=i;
        }

    }
    printf("%lld",(c/gcd));
    return 0;
}

Measured memory_bytes: 128
K = int(input())
N = 50

A = K // N + 1
B = A * N - K
a = [49+A] * N
for i in range(B):
  a[i] -= N
  for j in range(N):
    if j == i: continue
    a[j] += 1
    
print(N)
print(' '.join(map(str, a)))

Measured memory_bytes: 3064
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, readline().split())
A = np.array(read().split(), np.int64)

def f(A, N, K):
    A.sort()
    I = (np.abs(A)).argsort()
    A = A[I][::-1]
    if N == K:
        return A
    # 全部負
    if np.all(A < 0):
        if K % 2 == 0:
            return A[:K]
        else:
            return A[-K:]
    # これ以外の場合は、必ず正を実現できる
    pos = A[A >= 0]
    neg = A[A < 0]
    nums = [1]
    if K & 1:
        nums = [pos[0]]
        pos = pos[1:]
        K -= 1
    # K は偶数
    # pos, neg から偶数個ずつセットにする
    if len(pos) & 1:
        pos = pos[:-1]
    if len(neg) & 1:
        neg = neg[:-1]
    pos = pos[::2] * pos[1::2]
    neg = neg[::2] * neg[1::2]
    A = np.concatenate([pos, neg])
    A.sort()
    A = A[::-1]
    return np.concatenate([nums, A[:K // 2]])

MOD = 10**9 + 7
B = f(A, N, K).tolist()
ans = 1
for x in B:
    ans = ans * x % MOD
print(ans)

Measured memory_bytes: 40376
#include <stdio.h>
#include <ctype.h>
  
int par[100000];
  
void init(int);
int dep(int);
int inp(void);
 
char *p;
char in[1500000];
int tree[100000][15],idx[100000];
 
int main(){
  int n,i,j,id,k,c;
 
  fread(in,sizeof(in),1,stdin);  
  p = in;
 
  n = inp(); init(n);
  for(i = 0 ; i < n ; i++){
    id = inp();
    k = inp();
    for(j = 0 ; j < k ; j++){
      c = inp();
      par[c] = id;
      tree[id][idx[id]++] = c;
    }
  }
  
  for(i = 0 ; i < n ; i++){
    printf("node %d: parent = %d, depth = %d, "
           ,i,par[i],dep(i));
     
    if(par[i] == -1){
      printf("root, [");
    }else if(!idx[i]){
      printf("leaf, [");
    }else{
      printf("internal node, [");
    }
 
    for(j = 0 ; j < idx[i] ; j++){
      printf("%d",tree[i][j]);
      if(j < idx[i]-1) printf(", ");
    }
    puts("]");
  }
  return 0;
}
 
void init(int n){
  int i;
  for(i = 0 ; i < n ; i++){
    par[i] = -1;
  }
}
 
int dep(int x){
  if(par[x] == -1) return 0;
  return dep(par[x]) + 1;
}
 
int inp(){
  int v = 0;
  while(!isdigit(*p)) ++p;
  v = *p++&15;
  while(isdigit(*p)){
    v = (v<<3)+(v<<1)+(*p++&15);
  }
  return v;
}

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

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static int Solve(int H, int W, int[][] C, int[][] A)
        {
            var costs = new int[10];
            for (int i = 0; i < 10; ++i)
            {
                if (i != 1)
                {
                    int[] d = Enumerable.Repeat(int.MaxValue, 10).ToArray();
                    var q = new Queue<int>();
                    d[i] = 0;
                    q.Enqueue(i);
                    while (q.Count > 0)
                    {
                        int j = q.Dequeue();
                        for (int k = 0; k < 10; ++k)
                        {
                            if (j != k && d[k] > d[j] + C[j][k])
                            {
                                d[k] = d[j] + C[j][k];
                                q.Enqueue(k);
                            }
                        }
                    }
                    costs[i] = d[1];
                }
            }
            return A.Sum(a => a.Select(i => (i < 0) ? 0 : costs[i]).Sum());
        }
        static void Main(string[] args)
        {
            int[] v = ReadInts();
            int H = v[0];
            int W = v[1];
            var C = new int[10][];
            for (int i = 0; i < 10; ++i) { C[i] = ReadInts(); }
            var A = new int[H][];
            for (int i = 0; i < H; ++i) { A[i] = ReadInts(); }
            Console.WriteLine(Solve(H, W, C, A));
        }
    }
}


Measured memory_bytes: 15572
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,b=1,cnt=0;
  cin >>N;
  vector<int> vec(N);
  
  for(int i=0;i<N; i++){
    cin >> vec.at(i);
  }
  for(int j=0; j<N; j++){
    if(vec.at(b-1)==2){
      cnt++;
      break;
    }
    else{
      b = vec.at(b-1);
      cnt++;
    }
  }
  if(vec.at(b-1)==2)
    cout <<cnt <<endl;
  else
    cout <<-1 <<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int MX=3*1e5+100;
const long long INF = 1e18;
int N, M, k;
int arr[MX];
int main()
{
    cin>>N;
    cout<<24+24-N;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<string>

using namespace std;

int w,h;
int dx[2]={1,0};
int dy[2]={0,1};
int memo[105][105][3]; 
int fd(int x,int y,int ang);

main(){
  while(1){
    cin >> w >> h;
    if(w==0 && h==0) break;
    memset(memo,0,sizeof(memo));
    cout<<(fd(1,0,0)+fd(0,1,1))%100000<<endl;
    //    cout << memo[1][0][0] <<"  "<< memo[0][1][1]<<endl;
  }
}

int fd(int x,int y,int ang){
  int i;
  int f;
  if(x+1==w && y+1==h) return 1;

  if(memo[x][y][ang]>0){
    return memo[x][y][ang];
  }


  for(i=0;i<2;i++){
    if(x+dx[i] < w && y+dy[i] < h){
      if(x+dx[i]*2 < w && y+dy[i]*2 < h){
	if(i!=ang)
	  memo[x][y][ang]+=(fd(x+(dx[i]*2),y+(dy[i]*2),i))%100000 ;
	else
	  memo[x][y][ang]+=(fd(x+dx[i],y+dy[i],i))%100000;
      }
      else if(ang==i || (x+dx[i]+1==w && y+dy[i]+1==h)){
	  memo[x][y][ang]+=(fd(x+dx[i],y+dy[i],i))%100000;
      }
    }
  }
  memo[x][y][ang]=memo[x][y][ang]%100000;
  return memo[x][y][ang];
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program {
    static void Main() {
        Scanner cin = new Scanner();
        string S = Console.ReadLine();

        int cnt = 0;
        bool B = true;
        for(int i = 0; i < S.Length; i++) {
            if (S[i] == 'B') B = true;
            else {
                if (B) {
                    cnt++;
                    B = false;
                }
                else continue;
            }
        }
        Console.WriteLine(cnt * 2 - (S[0] == 'W' ? 1 : 0) - (S[S.Length - 1] == 'W' ? 1 : 0));
        Console.ReadLine();
    }
}

class Scanner //標準入力
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Long() + add;
        }
        return Array;
    }

    public double Double()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Double() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13116
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<P>>
#define fi first
#define se second
constexpr ll mod=1000000007;
constexpr ll INF=(1ll<<60);
constexpr double pi=3.14159265358979323846;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<typename T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}

ll keta(ll n){
    ll ret=0;
    while(n){
        n/=10;
        ret++;
    }
    return ret;
}

ll mypow(ll a,ll b){
    ll ret=1;
    while(b--){
        ret*=a;
    }
    return ret;
}

int main(){
    ll n;cin>>n;
    ll num;num=keta(n);
    ll ans=0;
    
    for(ll i=1;i<=num;i++){
        if(i==1){
            ans+=min(n,9ll);
        }else if(i%2==1){
            ans+=min(n+1,mypow(10,i))-mypow(10,i-1);
        }
    }

    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> b(m);
	for (int i = 0; i < m; i++)cin >> b[i];
	int res = 0;
	for (int p = 0; p < n; p++) {
		vector<int> a(m);
		for (int i = 0; i < m; i++)cin >> a[i];
		int sum = 0;
		for (int i = 0; i < m; i++)sum += a[i] * b[i];
		if (sum + c > 0)res++;
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

double mod = 1e9 + 7;
#define REP(i, n)  for(int i = 0; i < (int)n; ++i)
#define REP1(i, n)  for(int i = 1; i < (int)n; ++i)

bool IsPrime(int n){
    switch(n){
        case 0: 
        case 1: return false;
        case 2: return true;
    }
    if(n%2 == 0) return false;

    for(int i=3;i*i<=n;i+=2){
        if(n%i == 0) return false;
    }

    return true;
}


int main() {
    long  n=0;
    cin >> n;
    double *uni = new double[n];
    double tmp;
    REP1(i, n+1) {
        uni[i] = 0;
        if(!IsPrime(i))continue;
        REP1(j,n+1){
            tmp = floor(n/pow(i,j));
            if(tmp <= 0){
                break;
            }
            uni[i] += tmp;
        }
    }
    long sum = 1;
    REP1(i,n+1){
        if(uni[i]==0)continue;
        sum = fmod(sum * (uni[i]+1),mod);
    };
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int R, C, k;
    cin >> R >> C >> k;
    vector<ll> tmp(C+1, 0);
    vector<vector<ll>> v(R+1, tmp), tmp2(R+1, tmp), ans(R+1, tmp);
    vector<vector<vector<ll>>> dp(4, tmp2);
    rep(i, k){
        ll x, y, z;
        cin >> x >> y >> z;
        v[x][y] = z;
    }

    rep2(i, 1, R+1){
        rep2(j, 1, C+1){
            dp[0][i][j] = max(dp[0][i][j-1], ans[i-1][j]);
            if (v[i][j]) {
                rep2(k, 1, 4) {
                  dp[k][i][j] = max(dp[k][i][j - 1], max(dp[k-1][i][j - 1], ans[i - 1][j]) + v[i][j]);
                }
            }else{
                rep2(k, 1, 4) { dp[k][i][j] = max(dp[k][i][j - 1], ans[i - 1][j]); }
            }
            rep(k, 4) { ans[i][j] = max(ans[i][j], dp[k][i][j]); }
        }
    }

    cout << ans[R][C] << endl;
    return 0;
}

Measured memory_bytes: 496808
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    
    int ans = (h2-h1)*60 + (m2-m1) - k;

    cout << ans << endl;
    return 0;
}

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

using namespace std;
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = 10e15;
const ll MINF = -10e10;
const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

vector<vector<int>> dp(13, vector<int>(13, -1));

int dfs(int from, set<int> &route, int max_cost, int current_cost) {
    int ans = min(max_cost, current_cost + dp[from][1]);
    for (int i = 0; i <= 9; i++) {
        if (i == 1) continue;
        if (i == from)continue;
        if (route.find(i) != route.end()) continue;
        int next_cost = dp[from][i];
        if (current_cost + next_cost >= max_cost) continue;

        route.insert(i);
        int now = dfs(i, route, max_cost, current_cost + dp[from][i]);
        cmin(ans, now);
        route.erase(i);
    }
    return ans;
}

int main() {
    int h, w;
    cin >> h >> w;

    for (int y = 0; y <= 9; y++) {
        for (int x = 0; x <= 9; x++) {
            cin >> dp[y][x];
        }
    }
    set<int> route;

    vector<int> costs(10);
    for (int i = 0; i <= 9; i++) {
        if(i == 1) continue;
        route.insert(i);
        int now = dfs(i, route, dp[i][1], 0);
        route.erase(i);
        costs[i] = now;
    }

    int ans = 0;
    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w; x++) {
            int i;
            cin >> i;
            if(i == -1 || i == 1)continue;
            ans += costs[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N, M = [int(t) for t in input().split()]
R = []
for i in range(M):
    a, b = [int(t) for t in input().split()]
    R.append((a, b))

last  = -1  # the last broken bridge
count = 0   # the number of broken bridges
for a, b in sorted(R, key=lambda r: r[1]):
    if last < a:
        last = b - 1
        count += 1
print(count)

Measured memory_bytes: 18988
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

int main() {
  ll N;

  cin >> N;

  vector<double> lst(N);
  for (int i = 0; i < N; i++) {
    cin >> lst[i];
  }

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

  double ans = lst[0];
  for (int i = 1; i < N; i++) {
    ans += lst[i];
    ans /= 2;
  }
  
  printf("%.10e\n", ans);

  return 0;
}

Measured memory_bytes: 256
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#pragma region macro
#include <bits/stdc++.h>
typedef long long int64;
using namespace std;
using P = pair<int64, int64>;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const int64 INF = 1LL << 62;
const int inf = 1<<30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
#define bn '\n'
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, pair<T,S> const&P){
    os << "(";
    os << P.first;
    os << " , ";
    os << P.second;
    os << ")";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
#pragma endregion
//fixed<<setprecision(10)<<ans<<endl;


bool low_cnt_less_than_K(int64 X);
bool is_low(int64 X);

int64 K;
vector<int64> A;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N >> K;
    
    A.resize(N);
    REP(i,N)  cin >> A[i];
    sort(ALL(A));

    int64 low = -1e18-1, high = 1e18+1;
    while(high-low>1){
        int64 mid = (high+low)/2;
        if(low_cnt_less_than_K(mid)) low = mid;
        else high = mid;
    }

    int64 ans=high;
    cout << ans << endl;
}


//X"以下"の数がk-1個以下
bool low_cnt_less_than_K(int64 X){
    int N = A.size();
    int64 low_cnt = 0;
    REP(i,N-1){
        int64 a = A[i];
        if(a==0){
            if(X>=0) low_cnt+=N-i-1;
        }else if(a > 0){
            int64 lower_b = i, upper_b = N;
            while(upper_b-lower_b>1){
                int64 mid = (upper_b+lower_b)/2;
                if(A[mid] * a <= X){
                    lower_b = mid;
                }else{
                    upper_b = mid;
                }
            }
            low_cnt += upper_b - i - 1;   
        }else{
            int64 lower_b = i, upper_b = N;
            while(upper_b-lower_b>1){
                int64 mid = (upper_b+lower_b)/2;
                if(A[mid] * a <= X){
                    upper_b = mid;
                }else{
                    lower_b = mid;
                }
            }
            low_cnt += N - upper_b;
        }
    }
    
    return low_cnt < K;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
int n,q,k;
string s;
long long solve()
{
	long long D=0,M=0,DM=0,DMC=0;
	for(int i=0;i<s.size();i++)
	{
		if(i-k>=0&&s[i-k]=='D')
		{
			D--;
			DM-=M;
		}
		if(i-k>=0&&s[i-k]=='M')
			M--;
		if(s[i]=='D')
			D++;
		if(s[i]=='M')
		{
			M++;
			DM+=D;
		}
		if(s[i]=='C')
			DMC+=DM;
	}
	return DMC;
}
int main()
{
	cin>>n>>s>>q;
	while(q--)
	{
		cin>>k;
		cout<<solve()<<endl;
	}
	return 0;
}

Measured memory_bytes: 1412
#include <stdio.h>
#include <math.h>

int main(void){
    int i,j,w,h,temp_h;

	while(1){
		scanf("%d %d", &w, &h);
		temp_h = h;
		j = 0;
		
		for(;w != 0;w--){
			if(j == 0){
				i = 0;
				j = 1;
			}else{
				i = 1;
				j = 0;
			}
			for(;h != 0;h--){
				if(i == 0){
					printf("#");
					i = 1;
				}else{
					printf(".");
					i = 0;
				}
			}
			printf("\n");
			h = temp_h;
		}
		if(w == 0 && h == 0){
			break;
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include <cstdio>
#include <cctype>
#include <cstdlib>

using namespace std;

char s[25];
int a, b;

void err() {
    puts("No");
    exit(0);
}

int main(int argc, char* argv[]) {
    scanf("%d%d", &a, &b);
    scanf("%s", s);

    for (int i = 0; i < a; ++i) {
        if (!isdigit(s[i]))
            err();
    }
    if (s[a] != '-')
        err();
    for (int i = a + 1; i < a + b + 1; ++i) {
        if (!isdigit(s[i]))
            err();
    }

    puts("Yes");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

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

using namespace std;

int main()
{
    int Z;           //入力待ち
    int j, k;        //for文用
    string to = ","; //デバッグ用
    int e_count = 0; //演算回数を数える
    int count = 0;   //よくあるカウント
    //----------

    int n;
    cin >> n;
    long nums[200];
    REP(i, n)
    {
        cin >> nums[i];
    }

    //2で割ったものに置き換える
    int flag = 1;
    while (flag == 1) //1である限り続く
    {
        count++;
        REP(i, n)
        {
            if (nums[i] % 2 == 0)
            {
                nums[i] /= 2; //わって置き換え
            }
            else
            {
                flag = 0;
                count--;
                break;
            }
        }
    }
    cout << count << endl;

    //-----------
    cin >> Z;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
typedef long long int ll;

ll gcd(ll x, ll y){
    if(y == 0) return x;
    return gcd(y, x%y);
}

ll lcm(ll x, ll y){
    ll g = gcd(x, y);
    return x / g * y;
}

int main(void){
    ll n;
    scanf("%lld", &n);
    ll t[n];
    for(int i=0; i<n; i++){
        scanf("%lld", &t[i]);
    }

    ll ans = 1;
    for(int i=0; i<n; i++){
        ans = lcm(ans, t[i]);
    }
    
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

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

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n,m; cin >> n >> m; ll ans = 0;
  vvl nicecake(3,vl(n));
  
  rep(i,n){
    cin >> nicecake[0][i] >> nicecake[1][i] >> 
      nicecake[2][i];
  }
  
  vvl diff(3,vl(8));
  diff[0] = {1,1,1,1,-1,-1,-1,-1};
  diff[1] = {1,1,-1,-1,1,1,-1,-1};
  diff[2] = {1,-1,1,-1,1,-1,1,-1};
  
  rep(i,8){
    vl cakeval(n);
    
    rep(j,n){
      rep(k,3){
        cakeval[j] += diff[k][i]*nicecake[k][j];
      }
    }
    
    sort(all(cakeval));
    
    ll sum = 0;
    
    rep(j,m) sum += cakeval[n-1-j];
    
    ans = max(sum,ans);
  }
  
  cout << ans << endl;
  
  
}

Measured memory_bytes: 3744
s=int(input())
List=[]
List.append(s)
n=s
while(1):
    if List.count(n)>1:
        break
    if n%2==0:
        n=n//2
        List.append(n)
    else:
        n=3*n+1
        List.append(n)
print(len(List))

Measured memory_bytes: 9092