akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A = [int(x) for x in input().split()]
cnt = 0

for i in range(N):
    mini = i
    for j in range(i, N):
        if A[j] < A[mini]:
            mini = j
    if i != mini:
        A[i], A[mini] = A[mini], A[i]
        cnt +=1

print(" ".join(map(str, A)))
print(cnt)



Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
typedef long long ll;
bool debug=false;
int main(){
  ll n,k; cin >> n >> k;
  vector<ll> vp;
  vector<ll> vm;
  rep(i,n){
    ll x; cin >> x;
    if(x<0) vm.push_back(x);
    else vp.push_back(x);
  }
  ll np=vp.size();
  ll nm=vm.size();

  ll ans=3*pow(10,8)+1;
  for(ll i=0;i<=k;i++){
    // iは負の数の数とする
    ll cnp=k-i;
    if(cnp>np || i>nm) continue;
    ll p=0;
    if(cnp>=1)p=vp[cnp-1];
    ll m=0;
    if(i>0) m= vm[nm-i];
    ans=min(ans, 2*min(p,abs(m))+max(p,abs(m)));
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 1656
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() { int r, g, b;
  cin >> r >> g >> b;
  int num = r * 100 + g * 10 + b;
  if(num%4==0){
    puts("YES");
  }else{
    puts("NO");
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
void solve()
{
   ll n,m,sz;
   
   cin>>n>>m>>sz;
   
    ll row[n+1]={0};
    
    ll col[m+1]={0};
    
    map<pii,ll>mp;
    
    
    pair<ll,ll>p[sz+1];
    
    for(ll i=1;i<=sz;i++){
        ll x,y;
        cin>>x>>y;
        
        
        p[i]={x,y};
        row[x]++;
        
        col[y]++;
        
        mp[{x,y}]++;
    }
    
    ll mx1=0;
    
    ll mx2=0;
    
    for(ll i=1;i<=sz;i++){
        mx1=max(mx1,row[p[i].ff]);
        mx2=max(mx2,col[p[i].ss]);
    }
    
    ll ans=mx1+mx2;
    
    ll cnt_x=0;
    ll cnt_y=0;
    
    for(ll i=1;i<=n;i++){
        if(row[i]==mx1)
        cnt_x++;
    }
    
    for(ll j=1;j<=m;j++)
    {
        if(col[j]==mx2)
        cnt_y++;
    }
    
    if(cnt_x*cnt_y>sz){
        cout<<ans<<endl;
    }
    else{
        ll cnti=0;
        
        for(ll i=1;i<=sz;i++){
            ll x,y;
            x=p[i].ff;
            
            y=p[i].ss;
            
            if(row[x]==mx1&&col[y]==mx2)
            cnti++;
        }
        
        
        if(cnti==cnt_x*cnt_y)
        ans--;
        
        cout<<ans<<endl;
        
    }
   
   
    
}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     
//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();
  
//Good Bye!
    return 0;
}

Measured memory_bytes: 31772
import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNextInt()){
			int n = sc.nextInt();
			if(n == 0)break;
			LinkedList<Integer> list = new LinkedList<Integer>();
			for(int i = 0; i < n; i++)
				list.add(sc.nextInt());
				
			Collections.sort(list);
			list.remove(0);
			list.remove(list.size()-1);
			
			int sum = 0;
			for(int i = 0; i < list.size(); i++)
				sum += list.get(i);
			sum = sum / list.size();
			
			System.out.println(sum);
		}
		}
}

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

int main(){
    int n;
    cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++) cin>>h[i];
    int cnt=0;
    for(int i=0;i<n;i++){
        bool isok=true;
        for(int j=0;j<i;j++){
            if(h[j]>h[i]) isok=false;
        }
        if(isok) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            args = reader.readLine().split(" ");
            int N = Integer.parseInt(args[0]);
            int Y = Integer.parseInt(args[1]);

            for (int i = 0; i <= (Y / 10000); i++) {
                for (int j = 0; j <= ((Y - 10000 * i) / 5000); j++) {
                    int y = 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (y == Y) {
                        System.out.println(i + " " + j + " " + (N - i - j));
                        System.exit(0);
                    }
                }
            }

            System.out.println("-1 -1 -1");
        }
    }

}


Measured memory_bytes: 22996
#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 <cctype> // isupper, islower, isdigit, toupper, tolower
#include <stdlib.h>
#include <stdio.h>

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 my_abs_A(int num) {
    if (num > 0)
        return num;
    else
        return -num;
}

int my_abs_B(long long num,long long numb) {
    if (num - numb >= 0)
        return num - numb;
    else
        return -1 * (num - numb);
}

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

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

long long DP_min(long long a, long long b) {
    if (a > b) {
        return a;
    }
    else {
    }
}

const long long INF = 1LL << 60;

int main() {
    int N;
    cin >> N;
    vector<long long> cost(100010);
    vector<long long> dp(100010);
    for (int i = 0; i < N; i++) {
        cin >> cost.at(i);
    }
    for (int i = 0; i < 100010; i++) {
        dp.at(i) = INF;
    }
    dp.at(0) = 0;
    long long input = 0;
    for (int j = 0; j < N; j++) {

        chmin(dp.at(j + 1), dp.at(j) + my_abs_A(cost.at(j) - cost.at(j + 1)));
        chmin(dp.at(j + 2), dp.at(j) + my_abs_A(cost.at(j) - cost.at(j + 2)));
    }
    cout << dp.at(N-1) << endl;
    

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define eps 1e-8
#define INF 0x3f3f3f3f
#define MX 1005

int n,m;
map<int,int> mp;

int main()
{
    scanf("%d",&n);
    for (int i=0;i<n;i++)
    {
        int x;
        scanf("%d",&x);
        mp[x]++;
    }
    int ok=1;
    scanf("%d",&m);
    for (int i=0;i<m;i++)
    {
        int x;
        scanf("%d",&x);
        if (mp[x]>0)
        {
            mp[x]--;
        }
        else ok=0;
    }
    if (ok) printf("YES\n");
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 9600
#include<stdio.h>
using namespace std;

int main () {
  int a, b, c, d;
  scanf("%d %d %d", &a, &b, &c);
  if (a > b) {
    d = a;
    a = b;
    b = d;
  } else {}
  if (b > c) {
    d = b;
    b = c;
    c = d;
  } else {}
  if (a > b) {
    d = a;
    a = b;
    b = d;
  } else {}

  printf("%d %d %d\n", a, b, c);
  return 0;
}


Measured memory_bytes: 2760
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    x, mod = 1, 10**9 + 7
    for i in range(1, N + 1):
        x *= i
    result = 1

    for i in range(2, N + 1):
        cnt = 1
        while x % i == 0:
            x = x // i
            cnt += 1
        result *= cnt

    result = result % mod
    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define Mod 1000000007
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
#define INF 999999999999999999
#define NN (ll)(1e6+5)
int mod(string s,int a) 
{ 
    int ans=0; 
    for (int i=0;i<s.length();i++) 
         ans=(ans*10+(int)s[i]-'0')%a; 
    return ans; 
}
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {    
       ll a,b,c,d;
       cin>>b>>a>>d>>c;
       a=(d/a)+(d%a?1:0);
       c=(b/c)+(b%c?1:0);
       //cout<<a<<" "<<c<<" ";
       cout<<(a<=c?"Yes\n":"No\n");   
   }
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    int max = -99999999;
    if(max < a * b){
        max = a*b;
    }
    if(max < a + b){
        max = a + b;
    }
    if(max < a - b){
        max = a - b;
    }
    cout << max << endl;
}


Measured memory_bytes: 256
N = int(input())
mydic = {}
mynumdic = {} 
mymax = 0

for n in range(N):
    s = input()
    if s in mydic:
        mydic[s] += 1
    else:
        mydic[s] = 1
    
    if mymax <= mydic[s]:
        mymax = mydic[s]
        
        if mydic[s] in mynumdic:
            mynumdic[mydic[s]] += [s]
        else:
            mynumdic[mydic[s]] = [s]

mylist = mynumdic[mymax]
mylist.sort()
for d in mylist:
    print(d)

Measured memory_bytes: 53152
#include <stdio.h>
#define N 200000

int main(void){
    int n, i;
    int p[N];
    int pmin[N];
    int count = 0;
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d", &p[i]);
    }
    
    pmin[0] = p[0];
    count++;
    for(i = 1; i < n; i++){
        if(p[i] <= pmin[i-1]){
            pmin[i] = p[i];
            count++;
        }else{
            pmin[i] = pmin[i-1];
        }
    }
    
    printf("%d", count);
    return 0;
}

Measured memory_bytes: 1664
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

class UnionFind {
public:
    UnionFind(ll n) {
        par_.resize(n, -1);
    }

    //根を求める
    ll find(ll x) {
        return (par_[x] < 0 ? x : par_[x] = find(par_[x]));
    }

    //xとyの属する集合を併合
    void unite(ll x, ll y) {
        x = find(x);
        y = find(y);
        if (x == y) {
            return;
        }
        par_[x] += par_[y];
        par_[y] = x;
    }

    //xが属する集合のサイズを取得
    ll size(ll x) {
        return -par_[find(x)];
    }

    //xとyが同じ集合に属するか否かを判定
    bool same(ll x, ll y) {
        return (find(x) == find(y));
    }
private:
    vector<ll> par_;
};

int main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> A(M), B(M);
    for (ll i = 0; i < M; i++) {
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }

    UnionFind uf(N);
    vector<ll> ans(M);
    ans[M - 1] = N * (N - 1) / 2;
    for (ll i = M - 1; i > 0; i--) {
        if (uf.same(A[i], B[i])) {
            ans[i - 1] = ans[i];
            continue;
        }
        ll size1 = uf.size(A[i]);
        ll size2 = uf.size(B[i]);
        ans[i - 1] = ans[i] - size1 * size2;
        uf.unite(A[i], B[i]);
    }

    for (auto a : ans) {
        cout << a << endl;
    }
}

Measured memory_bytes: 4480
def seek(value):
    right = len(color_list) - 1
    left = 0
    while(True):
        mid = (right + left) // 2
        if(value > color_list[mid]):
            right = mid
        else:
            left = mid
        if(right - left <= 1):
            return right

N = int(input())    
color_list =  [int(input())]
for i in range(N-1):
    new_value = int(input())
    if(new_value > color_list[0]):
        color_list[0] = new_value
    elif(new_value <= color_list[-1]):
        color_list.append(new_value)
    else:
        new_index = seek(new_value)
        color_list[new_index] = new_value
print(len(color_list))

Measured memory_bytes: 7072
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    string a;
    cin >> a;
    set<char> s;
    for(int i = 0; i < 4; i++){
        s.insert(a[i]);
    }
    if(s.size() == 2){
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    
    
    cout << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

using namespace std;

#define LL long long

const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};

int n, r;

int main() {
	cin >> n >> r;
	if (n >= 10) {
		cout << r << endl;
	}
	else {
		cout << (r + 100 * (10 - n)) << endl;
	}
	return 0;
}

Measured memory_bytes: 764
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <bitset>
using namespace std;

#define rep(i, n) for (int i=0; i<int(n); i++)
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using ll = long long;


int main() {
	int n;
	cin >> n;
	vector<vector<int> > vec(n, vector<int>(10));
	vector<vector<int> > p(n, vector<int>(11));
	rep(i, n) {
		rep(j, 10) cin >> vec.at(i).at(j);
	}
	rep(i, n) {
		rep(j, 11) cin >> p.at(i).at(j);
	}
	int res = -(1<<30);
	for (int bit=1; bit<(1<<10); bit++){

		int total = 0;
		for (int shop=0; shop<n; shop++) {
			int cnt = 0;
			rep(i, 10) {
				if ((bit & (1<<i)) && vec.at(shop).at(i)==1) cnt++;
			}
			int sales = p.at(shop).at(cnt);
			total += sales;
		}
		res = max(res, total);
	}
	cout << res << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  string s;
  cin >> n >> s >> k;
  for(int i = 0;i < n;i++){
    if(s[i] != s[k - 1])cout << "*";
    else cout << s[k - 1];
  }
  cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename Val>
bool bitcheck(Val bit, size_t idx) {
    return bit & (1 << idx);
}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr); ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH) cout << unitbuf;
    }
} PROCON_INIT;

void solve() {
    ll n; cin >> n;
    vector<ll> a(n); 
    FOR(i, 0, n) {
        cin >> a[i];
        if (a[i] == 0) {
            cout << 0 << endl;
            return;
        }
    }
    ll ans = 1;
    FOR(i, 0, n) {
        ll before = ans;
        ans *= a[i];
        
        if (ans >= 1'000'000'000'000'000'001) {
            cout << -1 << endl;
            return;
        } else if (ans < 1) {
            cout << -1 << endl;
            return;
        }
        
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 3976
<?php
list($n, $m) = ints();
$P = ints();
$tree = new UFT($n);
for($i = 0; $i < $m; $i++){
    list($x, $y) = ints();
    $tree->unite($x,$y);
}
foreach($P as $i => $p){
    $groupMap[$tree->getRoot($i+1)][$p] = 1;
}
$count = 0;
foreach($P as $i => $p){
    $count+=isset($groupMap[$tree->getRoot($i+1)][$i+1]);
}
echo $count,"\n";

class UFT{
    public $parent;
    public $size;
    public $rank;
    public function __construct($size){
        for($i = 1; $i <= $size; $i++){
            $this->size[$i] = 1;
            $this->rank[$i] = 1;
            $this->parent[$i] = 0;
        }
    }
    public function dump(){
        o("--------------");
        o($this->parent);
        o($this->size);
        o($this->rank);
    }
    public function getRoot($i){
        if($this->parent[$i] == 0){
            return $i;
        }else{
            return $this->getRoot($this->parent[$i]);
        }
    }
    public function unite($i, $j){
        $rootI = $this->getRoot($j);
        $rootJ = $this->getRoot($i);
        if($rootJ == $rootI)return false;//元から同じグループ
        if($this->rank[$rootI] > $this->rank[$rootJ])list($rootI, $rootJ) = [$rootJ, $rootI];//Rank(J)>Rank(I)に揃えておく
        $this->parent[$rootI] = $rootJ;
        if($this->rank[$rootI] == $this->rank[$rootJ]){
            $this->rank[$rootJ]++;
        }
        $this->size[$rootJ]+=$this->size[$rootI];
        $this->size[$rootI] = '*';//不要な情報となるので潰す/デバッグ出力向けに*を入れている
        $this->rank[$rootI] = '*';//同上
    }
    public function size($i){return $this->size[$this->getRoot($i)];}
    public function isUnion($i, $j){return $this->getRoot($i) == $this->getRoot($j);}
}

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;}
function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;}

function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array: ";
            echo implode(" ", addIndex($val))."\n";
        }else{
            echo "array:array\n";
            if(isCleanArray($val)){
                foreach($val as $row)echo implode(" ", addIndex($row))."\n";
            }else{
                foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row))."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}
function addIndex($val){
    if(!isCleanArray($val)){
        $val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);
    }
    return $val;
}
function isCleanArray($array){
    $clean = true;
    $i = 0;
    foreach($array as $k => $v){
        if($k != $i++)$clean = false;
    }
    return $clean;
}

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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	int N, u, v;
	cin >>N >>u >>v;
	// Input
	vector<vector<int>>	bridge(N-1, vector<int> (2));
	for (int i=0; i<N-1; i++) 
		for (int j=0; j<2; j++)
			cin >> bridge.at(i).at(j);
	// Struct for each node
	struct Node {
		vector<int> to_node;
		bool fix;
		int cost;
	};
	vector<Node> nodeT(N);
	// Initialize
	for (int i=0; i<N; i++) {
		nodeT.at(i).fix=false;
		nodeT.at(i).cost=INF;
	}
	// Data for each nodeT
	for (int i=0; i<N-1; i++) {
		int F=bridge.at(i).at(0)-1;
		int T=bridge.at(i).at(1)-1;
		nodeT.at(F).to_node.push_back(T);
		nodeT.at(T).to_node.push_back(F);
	}
	// Start
	// Start Node == Cost=0
	nodeT.at(u-1).cost=0;
	priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;
	q.push({nodeT.at(u-1).cost, u-1});
	// till Goal fixed
	while (!q.empty()) {
		// Pickup the Node with minimum cost
		int c=q.top().at(0);
		int ii=q.top().at(1);
		q.pop();
		// If fixed, skip
		if(nodeT.at(ii).fix)
			continue;
		// Change it to fixed and search for near-by nodeTs
		nodeT.at(ii).fix=true;
		for (int i=0; i<nodeT.at(ii).to_node.size(); i++) {
			int o_node=nodeT.at(ii).to_node.at(i);
			// Update cost
			int o_cost=c+1;
			// Process only when smaller
			if (o_cost>=nodeT.at(o_node).cost)
				continue;
			nodeT.at(o_node).cost=o_cost;
			// Push into queue
			q.push({o_cost, o_node});
		}
	}
	vector<Node> nodeA(N);
	// Initialize
	for (int i=0; i<N; i++) {
		nodeA.at(i).fix=false;
		nodeA.at(i).cost=INF;
	}
	// Data for each nodeA
	for (int i=0; i<N-1; i++) {
		int F=bridge.at(i).at(0)-1;
		int T=bridge.at(i).at(1)-1;
		nodeA.at(F).to_node.push_back(T);
		nodeA.at(T).to_node.push_back(F);
	}
	// Start
	// Start Node == Cost=0
	nodeA.at(v-1).cost=0;
	//priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;
	q.push({nodeA.at(v-1).cost, v-1});
	// till Goal fixed
	while (!q.empty()) {
		// Pickup the Node with minimum cost
		int c=q.top().at(0);
		int ii=q.top().at(1);
		q.pop();
		// If fixed, skip
		if(nodeA.at(ii).fix)
			continue;
		// Change it to fixed and search for near-by nodeAs
		nodeA.at(ii).fix=true;
		for (int i=0; i<nodeA.at(ii).to_node.size(); i++) {
			int o_node=nodeA.at(ii).to_node.at(i);
			// Update cost
			int o_cost=c+1;
			// Process only when smaller
			if (o_cost>=nodeA.at(o_node).cost)
				continue;
			nodeA.at(o_node).cost=o_cost;
			// Push into queue
			q.push({o_cost, o_node});
		}
	}
	int S=0;
	for (int i=0; i<N; i++) {
		int s=nodeA.at(i).cost-nodeT.at(i).cost;
		if (s>0)
			S=max(S, nodeA.at(i).cost-1);
	}
	cout <<S <<endl;
	return 0;
}



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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int A[220000], B[220000];
pint BA[220000];
signed main() {
    cin >> N;
    rep(i, N) { cin >> A[i] >> B[i], BA[i] = {B[i], A[i]}; }
    sort(BA, BA + N);
    reverse(BA, BA + N);
    int t = LLONG_MAX;
    rep(i, N) {
        t = min(t, BA[i].first) - BA[i].second;
        if (t < 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

}


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

using ll = long long;
using tpl = tuple<string, int, int>;

int main(){
  int n;
  cin >> n;

  vector<tpl> t(n);
  rep(i,n){
    string s;
    int x;
    cin >> s >> x;
    x=-x;
    t.at(i)=make_tuple(s,x,i+1);
  }

  sort(t.begin(),t.end());
  rep(i,n){
    string s;
    int x;
    int j;
    tie(s,x,j)=t.at(i);
    t.at(i)=make_tuple(s,-x,j);
  }
  
  rep(i,n){
    int res;
    tie(ignore,ignore,res)=t.at(i);
    cout << res << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#define rep(i,l,n) for(i=l;i<n;i++)

void print(char str[],int a,int b){
	int i;
	rep(i,a,b+1) printf("%c",str[i]);
	printf("\n");
}

void reverse(char str[],int a,int b){
	int i;
	char str2[1010];
	rep(i,0,b-a+1) str2[a+i]=str[b-i];
	rep(i,a,b+1) str[i]=str2[i];
}

void replace(char str[],int a,int b,char p[]){
	int i;
	rep(i,0,b-a+1) str[a+i]=p[i];
}

int main(void){
	char str[1010],od[10],p[1010];
	int q,i,a,b;
	
	scanf("%s",str);
	scanf("%d",&q);
	
	rep(i,0,q){
		scanf("%s",od);
		if(strcmp(od,"print")==0){
			scanf("%d %d",&a,&b);
			print(str,a,b);
		}else if(strcmp(od,"reverse")==0){
			scanf("%d %d",&a,&b);
			reverse(str,a,b);
		}else if(strcmp(od,"replace")==0){
			scanf("%d %d %s",&a,&b,p);
			replace(str,a,b,p);
		}
	}
	
	return 0;
}


Measured memory_bytes: 2104
n = int(input())
h = list(map(int, input().split()))

dp = [float('inf')] * n

dp[0] = 0
for i in range(1, n):
  if i == 1:
    dp[i] = dp[0] + abs(h[i]-h[i-1])
  else:
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2])) 
  
print(dp[n-1])

Measured memory_bytes: 20404
n, m=map(int,input().split())
ac = 0
ans=[True] * n
wa=[0] * n

for i in range(m):
    question, result=input().split()
    num = int(question) - 1
    if result == "AC" and ans[num]:
        ans[num]=False
        ac+=1
    # WAかつACされていない場合
    elif result == "WA" and ans[num]:
        wa[num] += 1
 
wa_sum = 0

for i in range(n):
    # 問題がACされている場合、その問題番号のWA回数を足す
    if not ans[i]:
        wa_sum += wa[i]
 
print(ac, wa_sum)


Measured memory_bytes: 4596
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

#define ll long long int
#define pb push_back
#define RONALDO            \
  ios::sync_with_stdio(0); \
  cin.tie(0);              \
  cout.tie(0);
#define endl "\n"
#define pii pair<ll, ll>
#define ff first
#define ss second
#define mod 1000000007
#define vi vector<ll>
#define mi map<ll, ll>
#define Max(x, y, z) max(x, max(y, z))
#define Min(x, y, z) min(x, min(y, z))
//LOVE U MESSI && CRistiano !!

//INSPIRATIONAL MICHAEL PHELPS && USAIN BOLT !!

int main()
{
  RONALDO;
  // ll t;
  // cin >> t;
  // while (t--)
  // {
  ll n;
  cin >> n;
  if(n)
    cout << "0";
  else
    cout << "1";
  }

Measured memory_bytes: 3608
N = int(input())
Bs = list(map(int, input().split()))

As = [0] * N

ans = Bs[0]
mae = Bs[0]
# print(ans)

for b in Bs[1:]:
    if mae < b:
        ans += mae
    else:
        ans += b
    mae = b

    # print(ans)
ans += Bs[-1]

print(ans)


Measured memory_bytes: 3060
import java.io.*;
import java.util.*;


class Main {
    static final long MOD = 1000000007;

    // Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        long K;
        K = sc.nextLong();
        long[] a = new long[(int)(N)];
        for(int i = 0 ; i < N ; i++){
                a[i] = sc.nextLong();
        }
        solve2(N, K, a);
    }

    static void solve(long N, long K, long[] a){
        long[][] dp = new long[(int)N][(int)(K+1)];
        
        for (int i = 0; i <= a[0]; i++){
            dp[0][i] = 1;
        }

        for (int i = 1; i < N; i++){
            for (int j = 0; j <= K; j++){
                long sum = 0;
                for (int k = 0; k <= a[i]; k++){
                    if (j >= k){
                        sum = (sum + dp[i-1][j-k]) % MOD;
                    }
                }
                dp[i][j] = sum;
            }
        }

        System.out.print(dp[(int)(N-1)][(int)(K)]);
    }

    static long add(long a, long b){
        return (a + b) % MOD;
    }

    static long minus(long a, long b){
        long rst;
        rst = a - b;
        if (rst < 0) rst += MOD;
        return rst;
    }

    // optimize with prifix sum
    static void solve2(long N, long K, long[] a){
        long[][] dp = new long[(int)N][(int)(K+1)];
        long[][] prefix = new long[(int)N][(int)(K+1)];
        
        for (int i = 0; i <= a[0]; i++){
            dp[0][i] = 1;
            prefix[0][i] = i > 0 ? (prefix[0][i-1] + 1) : 1;
        }
        for (int i = (int)a[0] + 1; i <= K; i++){
            prefix[0][i] = prefix[0][i-1];
        }

        for (int i = 1; i < N; i++){
            for (int j = 0; j <= K; j++){
                if (j-(int)(a[i])-1 >= 0){
                    dp[i][j] = minus(prefix[i-1][j], prefix[i-1][j-(int)a[i]-1]);
                }else{
                    dp[i][j] = prefix[i-1][j];
                }

                prefix[i][j] = j > 0 ? add(prefix[i][j-1], dp[i][j]) : dp[i][j];
            }
        }

        System.out.print(dp[(int)(N-1)][(int)(K)]);
    }
}


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

void solve() 
{
    char s;cin>>s;
    cout<<(s>='a'?'a':'A')<<endl;
}

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

Measured memory_bytes: 3632
x,y = map(int, input().split())

l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]


if x in l1 and y in l1:
    print("Yes")
elif x in l2 and y in l2:
    print("Yes")
elif x == 2 and y == 2:
    print("Yes")
else:
    print("No")

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

using namespace std;

#define min3(a, b, c)           min((a), min((b), (c)))
#define max3(a, b, c)           max((a), max((b), (c)))
#define lcm(a,b)                (a / __gcd(a,b) ) *b
#define gcd(a,b)                __gcd(a,b)
#define dist(x1,y1,x2,y2)       sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
#define distl(x1,y1,x2,y2)      sqrtl((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
#define sqr(a)                  ((a)*(a))
#define FOR(a, b)               for(int i=a; i<b; i++)
#define fRead(x)                freopen(x,"r",stdin)
#define fWrite(x)               freopen (x,"w",stdout)
#define pb                      push_back
#define mk                      make_pair
#define ff                      first
#define ss                      second
#define lb                      lower_bound
#define ub                      upper_bound
#define all(a)                  a.begin(), a.end()
#define FASTIO                  ios_base::sync_with_stdio(0);cin.tie(NULL);

bool cmp(pair<int, int> A, pair<int, int> B)
{
    if ((A.ss+A.ff != B.ss+B.ff))
        return A.ss+A.ff > B.ss+B.ff;
    else
        return A.ff > B.ff;
}

bool bmp(pair<int, int> A, pair<int, int> B)
{
    return A.ff > B.ff;
}

int main()
{
    FASTIO

    int n, m;
    vector<int> v[100005];

    cin >> n >> m;

    FOR (0, n)
    {
        int buf, bbuf;
        cin >> buf >> bbuf;
        v[buf].push_back(bbuf);
    }

    priority_queue<int> q;

    long long ans = 0, day = 1;
    for ( ; day <= m; day++)
    {
        for (int k:v[day])
            q.push(k);
        if(!q.empty())
        {
            ans += q.top();
            q.pop();
        }
    }

    cout << ans;
}




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

const int maxn = 1e5+5;
int n;
pair<int,int> a[maxn];

int main(){
	scanf("%d", &n);
	for(int i = 0; i<n; i++){
		scanf("%d %d", &a[i].first, &a[i].second);
	}
	sort(a, a+n, [&](pair<int,int>&x, pair<int,int>&y) { return x.second < y.second; });
	int lim = -1;
	int ans = 0;
	for(int i = 0; i<n; i++){
		if (a[i].first > lim) lim = a[i].second, ans++;
	}
	printf("%d\n", ans);


	return 0;
}


Measured memory_bytes: 3996
#include<bits/stdc++.h>
using namespace std;
string a,b;
int n;
int main()
{
    cin>>a>>b;
    int l1=a.size();
    int l2=b.size();
    if(l1<l2) n=l1;
    else n=l2;
    for(int i=0;i<n;i++)
    cout<<a[i]<<b[i];
    if(l1>l2) for(int i=n;i<l1;i++) cout<<a[i];
    else      for(int i=n;i<l2;i++) cout<<b[i];
    cout<<endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    
    if is_prime(N):
        print(N-1)
        sys.exit()
        
    ll = factorize(N)
    ll.sort()
    
    if len(ll) == 2:
        a = ll[0] -1
        b = ll[1] -1
        print(a + b)
        sys.exit()
        
    tmp = math.sqrt(N)
    max = (tmp // 1) + 1
    ans = INF
    for i in range(1, int(max)):
        b = N / i
        if b.is_integer():
            tmp = (i-1) + (b-1)
            if ans > tmp:
                ans = tmp
                
    print(int(ans))
    
def is_prime(n): 
    i = 2
    while i * i <=n:
        if n % i == 0:
            return False
        i += 1
    return True
    
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
    
if __name__ == "__main__":
	main()


Measured memory_bytes: 40592
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String Smozi = scan.next();
		String Tmozi = scan.next();
		int Aball = scan.nextInt();
		int Bball = scan.nextInt();
		String Umozi = scan.next();

		if(Smozi.equals(Umozi)) {
			Aball -= 1;
		}else if(Tmozi.equals(Umozi)) {
			Bball -= 1;
		}

		System.out.println(Aball+ " "+Bball);
		scan.close();

	}

}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back
#define sz(a) int((a).size())
#define all(a)  a.begin(), a.end()
#define	debug(ccc)	cout << #ccc << " = " << ccc << endl;
#define present(c,x) ((c).find(x) != (c).end())
const double eps = 1e-8;
#define EQ(a,b) (fabs((a)-(b))<eps)
inline int max(int a,int b){return a<b?b:a;}
inline int min(int a,int b){return a>b?b:a;}
inline ll max(ll a,ll b){return a<b?b:a;}
inline ll min(ll a,ll b){return a>b?b:a;}
const int mod = 1e9+7;
const int N = 1e6+10;
const ll inf = 1e18;

ll power(ll a,ll n){
	if(n==0){
		return 1;
	}
	ll b = power(a,n/2);
	b = b*b%mod;
	if(n%2) b= b*a%mod;
	return b;
}

int add(int a,int b){ return (a+b)%mod;}
int mul(int a,int b){ return (ll)a*b%mod;}


int n,k;
ll dp[2005][2005][2];

ll f(int pos,int left,int ch){
	if(pos+left==0){
		if(ch==0)
			return 1;
		return 0;
	}
	ll &ret = dp[pos][left][ch];
	if(ret!=-1) return ret;
	ret = 0;
	if(ch==1){
		if(pos==1){
			if(left==n-k) ret = f(pos-1,left,0);
			else ret = 0;
			return ret;
		}
		if(pos==0) return ret = 0;
		ret = (f(pos-1,left,0) + f(pos-1,left+1,1))%mod;
		return ret;
	}
	if(pos==0 && left>1){
		if(left>0) ret = (ret + 2*f(pos,left-1,ch))%mod;
		return ret;
	}
	if(left>0) ret = (ret + f(pos,left-1,ch))%mod;
	ret = (ret + f(pos,left,1))%mod;
	return ret;
}


int main(){
 // 	freopen("nice.in","r",stdin);
 // freopen("nice.out","w",stdout);
	scanf("%d %d",&n,&k);
	FILL(dp,-1);
	printf("%lld\n",f(n,0,0));
	return 0;
}




Measured memory_bytes: 63360
x,k,d=[int(i) for i in input().strip().split(" ")]
x=abs(x) if x<0 else x
if x//d>=k:
    print(x-d*k)
else:
    if (k-x//d)%2==0:
        print(x%d)
    else:
        print(d-(x%d))
    
    

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

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop0(i,n) for(int i=0; i<(n); i++)
#define loop1(i,n) for(int i=1; i<=(n); i++)
#define fori(a,b,i) for(int i=(a); i<=(b); i++)
#define ford(a,b,i) for(int i=(a); i>=(b); i--)
#define fast_io ios_base::sync_with_stdio(false), cin.tie(NULL)
#define ign cin.ignore(numeric_limits<streamsize>::max(),'\n')

#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define endl "\n"
#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef long long int ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<vector<int>> MAT;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef map<int,int> MCI;
typedef unordered_map<int,int> UMII;
typedef unordered_map<ll,ll> UMLL;
typedef unordered_map<char,int> UMCI;
typedef set<int> SI;
typedef unordered_set<int> USI;

// Display Map
//~for (auto const& pair: m) {
//~std::cout << "{" << pair.first << ": " << pair.second << "}\n";
//~}

// Extract word(w) from sentence(s)
//~stringstream str(s);
//~string w;
//~while(str >> w){
//~// w is your word
//~}

//Memset Syntax
// memset(array, value,sizeof(array)) val is 0,-1 or bool only

// To get accurate precision
//~cout.precision(20);

// Concatinate Vectors
//~

int main() {
    fast_io;
	ll n, d;
	cin >> n >> d;
	int count = 0;
	while(n--){
		ll a,b;
		cin >> a >> b;
		if(a*a + b*b <= d*d) count++;
	}
	cout << count << endl;
	
}


Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.ABC_108
{
    class A
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int k = int.Parse(Console.ReadLine());
            int odd = (k + 1) / 2;
            int even = k / 2;
            Console.WriteLine(odd * even);
        }
    }
}


Measured memory_bytes: 11092
import java.util.Scanner;


public class Main {

    public static String Y = "Yes";
    public static String N = "No";
    public static String I = "IMPOSSIBLE";
    public static String B = "Bad";
    public static String G = "Good";
    public static long MOD = (long) (Math.pow(10, 9) + 7);
    public static Scanner sc = new Scanner(System.in);

    static int n;
    static int m;
    static int x;
    static int loopCount = 0;
    static int[][] a;
    static int[] c;
    static int sum_c = 0;
    static int[] sum_c_save;
    static int[] understand;

    public static void main(String[] args) {

        out(ni() < ni() ? "0" : "10");
    }

    /*
     * 以下メソッド集
     */
    static int ni() {

        return sc.nextInt();
    }

    static long nl() {

        return sc.nextLong();
    }

    static String n() {

        return sc.next();
    }

    static char[] nc() {

        return sc.next().toCharArray();
    }

    static int kaijo(int n) {

        if (n == 0 || n == 1) {
            return 1;
        } else {
            return n * kaijo(n - 1);
        }
    }

    static int fib(int n) {

        return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
    }

    static long lcm(long m, long n) {

        return m * n / gcd(m, n);
    }

    static int lcm(int m, int n) {

        return m * n / gcd(m, n);
    }

    static long gcd(long a, long b) {

        return (b == 0) ? a : gcd(b, a % b);
    }

    static int gcd(int a, int b) {

        return (b == 0) ? a : gcd(b, a % b);
    }

    static void out(String info) {

        System.out.println(info);
    }

    static void out(int info) {

        System.out.println(info);
    }

    static void out(double info) {

        System.out.println(info);
    }

    static void out(long info) {

        System.out.println(info);
    }

    static void out(char info) {

        System.out.println(info);
    }

    static void outn(String info) {

        System.out.print(info);
    }

    static void outn(int info) {

        System.out.print(info);
    }

    static void outn(double info) {

        System.out.print(info);
    }

    static void outn(long info) {

        System.out.print(info);
    }

    static void outn(char info) {

        System.out.print(info);
    }

    static int max(int a, int b) {

        return Math.max(a, b);
    }

    static long max(long a, long b) {

        return Math.max(a, b);
    }

    static int min(int a, int b) {

        return Math.min(a, b);
    }

    static long min(long a, long b) {

        return Math.min(a, b);
    }
}


Measured memory_bytes: 22996
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[n];
        int sum = 0;
        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
            sum += a[i];
        }
        double border = sum * (1d / (4 * m));
        int count = 0;
        for(int i = 0; i < n; i++){
            if(a[i] >= border){
                count++;
            }
        }
        if(count >= m){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23764
fun main(args: Array<String>) {
    val (A, B) = readInputLine().split(" ").map { it.toInt() }

    for (i in 1..100000) {
        if (i * 8 / 100 == A && i * 10 / 100 == B) {
            println(i)
            return
        }
    }

    println(-1)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 38040
def main():
    X = int(input())
    A = 1
    B = 0
    while A <= 10**9:
        for B in range(A-1, A*(-1)-1, -1):    
            x = A ** 5 - B ** 5
            if x == X:
                print(A, B, sep=" ")
                return
            elif x > X:
                break
        # break
        A += 1

if __name__ == "__main__":
    main()


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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

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

  string alphas = "abcdefghijklmnopqrstuvwxyz";

  REP(i, alphas.size()) {
    if(s.find(alphas[i]) == string::npos) {
      cout << alphas[i] << endl;
      return 0;
    }
  }
  cout << "None" << endl;

  return 0;
}


Measured memory_bytes: 512
//header{{{
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#include <boost/sort/spreadsort/spreadsort.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
//#include <boost/graph/graph_utility.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/trie_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
//using namespace boost::multiprecision;
//using namespace boost::math;

typedef boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS,
        boost::no_property, boost::property<boost::edge_weight_t, int> > Graph;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define bsort boost::sort::spreadsort::spreadsort
#define int int_fast64_t
using pii = pair<int,int>;

constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
template <class Func>

class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}
 
    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};
 
template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;

template <typename T> using Set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename K, typename V> using Umap = gp_hash_table<K, V>;
using Trie = trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};

struct negrightshift {
    inline int operator() (const int &x, const unsigned offset) {
        return -(x >> offset);
    }
};
//}}}


signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout.setf(ios_base::fixed);
    cout.precision(10);

    string n;
    cin >> n;

    int res = 0;

    while(!n.empty()){
        res += n.back() - '0';
        n.pop_back();
    }

    if(res % 9 == 0){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;
}

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

typedef vector<int> vi;
typedef long long int ll;
#define clr(v, d)           memset(v, d, sizeof(v))
#define all(v)   (v.begin()),(v.end())
#define lp(i,n)     for(int i=0;i<n;i++)
#define sz(v)       v.size()
#define f           first
#define s           second
#define pb           push_back
#define MP           make_pair

ll m,n;
int arr[50];


int convert(ll num){
    int idx=0;
    while(num>0){
        arr[idx]=num%3;
        num=num/3;
        idx++;
    }
    return idx;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int n;
    cin>>n;
    vi v(n,0);
    lp(i,n) cin>>v[i];
    ll sum=0;
    lp(i,n){
        for(int j=i+1;j<n;j++){
            sum+=v[i]*v[j];
        }
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 256