akhauriyash/Code-Regression huggingface dataset:
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <ll MOD>
class Combination {
private:
    ll N;
    V<ll> factv, ifactv;

public:
    Combination<MOD>(ll N) : N(N), factv(N + 1, 1), ifactv(N + 1) {
        for(ll i = 1; i <= N; i++) factv[i] = factv[i - 1] * i % MOD;
        ifactv.back() = inv(factv.back());
        for(ll i = N - 1; 0 <= i; i--) ifactv[i] = (i + 1) * ifactv[i + 1] % MOD;
    }

    ll fact(ll n) { return factv[n]; }

    ll ifact(ll n) { return ifactv[n]; }

    ll pow(ll a, ll b) { return b ? (b & 1 ? a : 1) * pow(a * a % MOD, b / 2) % MOD : 1; }

    ll inv(ll a) { return pow(a, MOD - 2); }

    ll comb(ll n, ll k) { return factv[n] * ifactv[n - k] % MOD * ifactv[k] % MOD; }
};

const ll mod = 1e9 + 7;

Combination<mod> C(2e6 + 10);

int main() {
    ll X, Y;
    cin >> X >> Y;
    ll ans = 0;
    for(ll i = 0; 2 * i <= X; i++) {
        ll j = X - 2 * i;
        if(i + 2 * j != Y) continue;
        (ans += C.comb(i + j, j)) %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 31488
#include <bits/stdc++.h>
using namespace std;
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
 
const int N = 2e5+10;
 
int seg[4*N];
int lazy[4*N];
 
void push(int ss,int se,int node)
{
    seg[node]+=lazy[node];
    
    if(ss != se)
    {
        lazy[node*2+1]+=lazy[node];
        lazy[node*2+2]+=lazy[node];
    }
    
    lazy[node] = 0;
}
 
void update(int node,int ss,int se,int l,int r,int x)
{
    push(ss,se,node);
    
    if(ss > r || se < l) return;
    
    if(l <= ss && se <= r)
    {
        lazy[node]+=x;
        push(ss,se,node);
        return;
    }
    
    int mid = (ss+se)/2;
    
    update(node*2+1,ss,mid,l,r,x);
    update(node*2+2,mid+1,se,l,r,x);
    
    seg[node] = max(seg[node*2+1],seg[node*2+2]);        
}
 
int query(int node,int ss,int se,int id)
{
    push(node,ss,se);
    
    if(se < id || ss > id) return 0;
    
    if(ss == id && se == id) return seg[node];
    
    int mid = ( ss + se)/2;
    
    return query(node*2+1,ss,mid,id) + query(node*2+2,mid+1,se,id);
}
 
pair<pii,int> a[N];
int adder[N];
int dp[N];
int n,m;
 
signed main()
{
    fast;
    
    cin >> n >> m;
    
    f(i,m) cin >> a[i].F.F >> a[i].F.S >> a[i].S;
    
    f(i,m)
    {
         adder[a[i].F.F]+=a[i].S;
         adder[a[i].F.S+1]-=a[i].S;
    }
    
    f(i,m) swap(a[i].F.F,a[i].F.S);
    sort(a,a+m);
    f(i,m) swap(a[i].F.F,a[i].F.S);
    
    int id = 0;
    
    for(int i=1;i<=n;i++)
    {
        adder[i]+=adder[i-1];
        
        dp[i] = seg[0] + adder[i];
        
        update(0,0,n-1,i,i,dp[i]  - adder[i]);
        
        while(id < m && a[id].F.S <= i)
        {
            update(0,0,n-1,a[id].F.F,a[id].F.S,a[id].S);
            id++;
        }
    }
    
    int res = 0;
    
    for(int i=1;i<=n;i++) res = max(res,dp[i]);
    
    cout << res;
}

Measured memory_bytes: 18688
#include <stdio.h>		// standard input output
#include <iostream>		// input output stream, cin cout( console in console out)
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>		// input output manipulation
#include <queue> 

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

int main() {
  int N,K;
  cin >> N >> K;
  priority_queue<int, vector<int>, greater<int>> pq;
  int p;
  rep(i,N){
    cin >> p;
    pq.push(p);
  }
  
  int sum = 0;
  rep(i,K){
    sum += pq.top();
    pq.pop();
    //cout << "sum = " << sum << endl;
  }
  cout << sum << endl;
}

Measured memory_bytes: 3628
#include<iostream>

int main()
{
    int n, y;
    std::cin >> n >> y;
    for(int yukichi = 0; 10000 * yukichi <= y; yukichi++){
        for(int ichiyou = 0; (10000 * yukichi + 5000 * ichiyou + 1000 * (n - yukichi - ichiyou) <= y) && (yukichi + ichiyou <= n); ichiyou++){
            if (10000 * yukichi + 5000 * ichiyou + 1000 * (n - yukichi - ichiyou) == y){
                std::cout << yukichi << " " << ichiyou << " " << n - yukichi - ichiyou << std::endl;
                return 0;
            }
        }
    }
    std::cout << -1 << " " << -1 << " " << -1 << std::endl;
    return 0;
}

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N, K;
  IN(N, K);
  vll H(N);
  REP(i,N) IN(H[i]);
  sort(ALL(H));
  reverse(ALL(H));
  chmin(K, N);
  ll ans = 0;
  REP(i,K){
    H[i] = 0;
  }
  FOR(i,K,N){
    ans += H[i];
  }

  OUT(ans);

  return 0;
}


Measured memory_bytes: 1792
#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.at(i);
  }
  sort(a.begin(), a.end());
  cout << a.at(n / 2) - a.at(n / 2 - 1) << endl;
}

Measured memory_bytes: 640
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

void main() {
    long n;
    scan(n);

    if (n == 1) {
        writeln(0);
        return;
    }

    long ans;
    for (long i = 1; i * i <= n; i++) {
        if (n % i != 0)
            continue;
        auto m = n / i - 1;
        if (n / m == n % m)
            ans += m;
    }
    writeln(ans);
}

void scan(T...)(ref T args) {
    auto line = readln.split; // @suppress(dscanner.suspicious.unmodified)
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args)
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args)
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


Measured memory_bytes: 2724
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;

int x, y;
string s;

int main(){
    cin >> s;
    for(int i = 0; i < s.length(); i++){
        if(s[i] == '0'){
            x++;
        } else{
            y++;
        }
    }

    cout << s.length() - abs(x-y);



}


//g++ -std=c++14 comp.cpp; ./a.exe


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

int a[200005];
int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i ++) cin >> a[i], a[i] -= (i + 1);
	sort(a, a + n);
	int b = a[n / 2];
	long long ans = 0;
	for(int i = 0; i < n / 2; i ++){
		ans += (b - a[i]);
	}
	for(int i = n / 2; i < n; i ++) ans += a[i] - b;
	cout << ans << '\n';
}

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

int main() {
  int N;
  
  cin >> N;
  
  vector<int> mirror(N);
  
  for (int i = 0; i < N; i++) cin >> mirror.at(i);
  
  for (int i = 0; i < N; i++) {
    
    for (int j = 0; j < N; j++) {
      if (mirror.at(i) == mirror.at(j) && i != j) mirror.at(i) = 0;
    }
    
  }
  
    int count = 0;
  for (int i = 0; i < N; i++) {
    if (mirror.at(i) == 0) count++;
  }
  
  cout << N - count << endl;
}


Measured memory_bytes: 3612
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

template <class T> void get_max(T& a, const T b) { a = max(a, b); }
template <class T> void get_min(T& a, const T b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		int res = 0;
		stack<int> pos[2];
		for (int i = 1; i <= n; ++i)
		{
			for (int j = 0; j < 2; ++j)
				if (pos[j].empty())
					pos[j].push(0);

			int c;
			scanf("%d", &c);

			if (!c)
				++res;

			if (i & 1)
			{
				if (pos[c].top() == i - 1)
					pos[c].top() = i;
				else
					pos[c].push(i);
			}
			else
			{
				if (pos[c].top() == i - 1)
					pos[c].top() = i;
				else
				{
					int replaced = i - pos[c].top() - 1;
					pos[0].pop();
					pos[1].pop();
					pos[c].push(i);
					res += (c ? -1 : 1) * replaced;
				}
			}
		}
		printf("%d\n", res);
	}
}

Measured memory_bytes: 0
from collections import deque
K = int(input())
q = deque([])
cnt = 0
for i in range(1,10):
    q.append(str(i))

prev_c = 'a'
while cnt < 10**6:
    c = q.popleft()
    if c != prev_c:
        cnt += 1
        # print(c)
    prev_c = c
    if cnt == K:
        print(int(c))
        break
    if c[-1] != '0':
        q.append(c+str(int(c[-1])-1))
    q.append(c+str(int(c[-1])))
    if c[-1] != '9':
        q.append(c+str(int(c[-1])+1))


Measured memory_bytes: 17012
import java.util.*;
public class Main {
 
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		String c = sc.next();
		System.out.println(a.charAt(0)+""+b.charAt(0)+""+c.charAt(0));
	}
		
}

Measured memory_bytes: 23764
import scala.io.StdIn

object Main extends App {

  val literal = StdIn.readLine()
  val result = literal.map{ x =>
    if(x.isLetter && x.isLower) x.toUpper
    else if (x.isLetter && x.isUpper) x.toLower
    else x
  }
  println(result)
}


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

int main(){
    long long  i,n;
    double x,ss=0,has;
    string s;

    cin>>n;


    for(i=0; i<n; i++){
        cin>>x;
        cin>>s;

        if(s == "BTC"){
            has = x*380000;
            ss  = ss+has;
        }else if(s == "JPY"){
            ss = ss + x;
        }
    }

    cout<<ss<<endl;
}


Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.*;
import java.io.*;
import java.text.*;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
    static PrintWriter out = new PrintWriter(System.out);
    static StringTokenizer t;

    static String sn() {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    }

    static int ni() {
        return Integer.parseInt(sn());
    }

    static long nlo() {
        return Long.parseLong(sn());
    }

    public static void main(String args[]) {
        int t = 1;
        while (t-- > 0) {
            solve();
        }
        out.close();
    }

    static long mod = (long) 998244353;

    static long pro(long a, long b) {
        return (a % mod * b % mod) % mod;
    }

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

    static long sub(long a, long b) {
        return ((a % mod - b % mod) + mod) % mod;
    }

    static int maxn = 1000005;

    static int pow(int n) {
        return (int) (Math.log10(n) / Math.log10(2));
    }

    static long modpow(long x, long y) {
        long res = 1l;
        x %= mod;
        while (y > 0) {
            if (y % 2 != 0)
                res = pro(res, x);
            x = pro(x, x);
            y /= 2;
        }
        return res;
    }

    static class pair {
        String a;
        int b;

        pair(String x, int y) {
            a = x;
            b = y;
        }
    }

    static long modInverse(long n) {
        BigInteger n1 = new BigInteger(Long.toString(n));
        String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();
        return Long.parseLong(s);
    }

    static boolean v[] = new boolean[1000005];

    static void seive() {
        v[1] = true;
        for (int i = 2; i < 1000005; i++) {
            if (!v[i]) {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            }
        }
    }

    static boolean isprime(long n) {
        if (n == 1)
            return false;
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0)
                return false;
        }
        return true;
    }

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

    static void solve() {
        int k = ni();
        String s = sn();
        int n = s.length();
        if (n <= k)
            out.println(s);
        else {
           out.println(s.substring(0,k)+"...");
        }
    }
}



Measured memory_bytes: 37532
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	ll ans=0;
	ll n,a,b; cin >> n >> a >> b;
	vector<ll> x(n);
	for(int i=0;i<n;i++){
		cin >> x[i];
	}
	for(int i=0;i<n-1;i++){
		ans+=min((x[i+1]-x[i])*a,b);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a,b,x,ans;
		
		a=sc.nextInt();
		b=sc.nextInt();

		ans=-1;
		for (x=10*b+9; x>=10*b;x--){
			if(25*a <= 2*x && 2*x < 25*a+25){
				ans=x;
			}
		}

		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
using namespace std;

const long long mod = 998244353 ;



int main()
{
    long long n;scanf("%lld",&n);
    long long ans=n-1;
    for (long long i=1;i*i<=n;++i)
    {
        if (n%i==0){
            if (i+n/i-1<ans)
                ans=i+n/i-2;
        }
    }
    printf("%lld\n",ans);



}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define LL long long
using namespace std;

int main() {
	LL x,bas; cin>>x;
	bas = (x / 11LL) << 1LL; 
	x %= 11LL;
	if (x > 6) bas += 2;
	else if (x) bas++;
	cout<<bas<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define int long long


using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

ll pow2(ll a, ll n) {//aのn乗を計算します。
	ll x = 1;
	while (n > 0) {//全てのbitが捨てられるまで。
		if (n & 1) {//1番右のbitが1のとき。
			x = x * a;
		}
		a = a * a;
		n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
	}
	return x;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


const int MOD = 1000000007;

bool arr[1050000];
int sosuu[100010];
void Eratosthenes() {
	ll N = 1050000;
	int c = 0;
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (int i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (int j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for (int i = 2; i < N; i++) {
		if (arr[i]) {
			sosuu[c] = i;
			//cout << sosuu[c] << " ";
			c++;
		}
	}
	//cout << endl;
	//cout << c << endl;
}


map<ll, int>mp;
signed main() {
	ll N, P;
	cin >> N >> P;
	if (N == 1) {
		cout << P << endl;
		return 0;
	}
	ll X = P;
	Eratosthenes();
	for (int i = 0; sosuu[i] * sosuu[i] <= X; i++) {
		while (X % sosuu[i] == 0) {
			mp[sosuu[i]]++;
			X /= sosuu[i];
		}
	}
	//cout << X << endl;
	ll ans = 1;
	for (auto x : mp) {
		int e = x.second / N;
		ans *= pow2(x.first, e);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1920
N = int(input())

L = [[0]*10 for _ in range(10)]
for n in range(1, N+1):
    i = int(str(n)[0])
    j = int(str(n)[-1])
    L[i][j] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += L[i][j]*L[j][i]

print(ans)


Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    c = Counter(A)
    ans = []
    D = {}
    T = 0
    for k, v in c.items():
        D[k] = (((v-1) * (v-2)) // 2, ((v) * (v-1)) // 2)
        T += ((v) * (v-1)) // 2
    for a in A:
        ans.append(T-D[a][1] + D[a][0])
    return ans


def main():
    N = read_int()
    A = read_int_n()
    print('\n'.join(map(str, slv(N, A))))


if __name__ == '__main__':
    main()


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    int N,K; cin >> N >> K;
    string S; cin >> S;
    int ans = 0;

    char s = S[0];
    int cnt = 1;
    int len = 0;
    REP(i,S.size()){
        if(S[i] != s){
            cnt++;
            ans += len-1;
            len = 1;
            s = S[i];
        }else{
            len ++;
        }
    }
    ans += len-1;

    cout << min(ans+2*K, N-1) << endl;
    return 0;
}

Measured memory_bytes: 3708
#include<iostream>

using namespace std;

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

int main(){
  long long a,b;
  while(cin >> a >> b){
    long long g = gcd(a,b);
    cout << g << endl;
  }
  return 0;
}

Measured memory_bytes: 3100
//Solution by Zhusupov Nurlan
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef map<string , int> MSI;
typedef vector<int> VI;
typedef pair<int, int> PII;

#define endl '\n'
#define pb(x) push_back(x)
#define sqr(x) ((x) * (x))
#define F first
#define S second
#define SZ(t) ((int) t.size())
#define len(t) ((int) t.length())
#define base LL(1e9 + 7)
#define fname ""
#define sz 1000 * 1000
#define EPS (1e-8)
#define INF ((int)1e9 + 9)
#define mp make_pair

LL n, a[sz];

LL sign(LL x) {
  if (x < 0) return -1;
  if (x > 0) return 1;
  return 0;
}

LL calc() {
  LL res = 0, last = 0, s = 0;

  for (int i = 1; i <= n; i++) {
    s += a[i];
    if (sign(s) != sign(last) && sign(s) != 0) {
      last = s;
    } else {
      res += abs(s) + 1;
      last = -sign(last);
      s = last;
    }
  }

  return res;
}

int main()
{
//    freopen(fname"in", "r", stdin);
//    freopen(fname"out", "w", stdout);

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  LL ans = 1e18, w = a[1];
  if (w)
    ans = min(ans, calc());
  a[1] = -1;
  ans = min(ans, calc() + abs(w + 1));
  a[1] = 1;
  ans = min(ans, calc() + abs(w - 1));
  cout << ans;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

struct uftree{
	int par[200005];
	int rank[200005];
	uftree(){
	}
	void init(int n){
		for(int i=0;i<n;i++){
			par[i]=i;
			rank[i]=0;
		}
	}
	int find(int x){
		if(par[x]==x)return x;
		return par[x]=find(par[x]);
	}

	void unite(int x,int y){
		x=find(x);
		y=find(y);
		if(x==y)return;
		if(rank[x]<rank[y]){
			par[x]=y;
		}else{
			if(rank[x]==rank[y])rank[x]++;
			par[y]=x;
		}
	}

	bool same(int x,int y){
		return find(x)==find(y);
	}
};


struct edge{
	int u,v;
	ll w;
	edge(){}
	edge(int uu,int vv,ll ww){
		u=uu;
		v=vv;
		w=ww;
	}
	bool operator<(const edge &e)const{
		return w<e.w;
	}
};

int n,m;
ll x;
edge e[2005];
bool flag[2005];
uftree uf;
ll twop[5005];
int col[5005];

ll check(int v,ll c){
	uf.init(n);
	ll minc=e[v].w;
	uf.unite(e[v].u,e[v].v);
	int cnt=1;
	for(int i=0;i<m;i++){
		if(!uf.same(e[i].u,e[i].v)){
			uf.unite(e[i].u,e[i].v);
			minc+=e[i].w;
			cnt++;
			flag[i]=true;
		}
	}
	if(cnt<n-1)return c+1LL;
	return minc;
}

int main(void){
	twop[0]=1;
	for(int i=0;i<5000;i++){
		twop[i+1]=twop[i]*2LL%MOD;
	}
	scanf("%d%d",&n,&m);
	scanf("%lld",&x);
	for(int i=0;i<m;i++){
		int u,v;
		ll w;
		scanf("%d%d%lld",&u,&v,&w);
		u--;
		v--;
		e[i]=edge(u,v,w);
	}
	uf.init(n);
	sort(e,e+m);
	ll minc=0;
	int cnt=0;
	for(int i=0;i<m;i++){
		if(!uf.same(e[i].u,e[i].v)){
			uf.unite(e[i].u,e[i].v);
			minc+=e[i].w;
			cnt++;
			flag[i]=true;
		}
	}
	if(cnt<n-1){
		printf("%d\n",0);
		return 0;
	}
	if(minc>x){
		printf("0\n");
	}else if(minc==x){
		int cnt=n-1;
		for(int i=0;i<m;i++){
			if(!flag[i] && check(i,x)==x){
				flag[i]=true;
				cnt++;
			}
		}
		printf("%lld\n",twop[m-cnt]*((twop[cnt]-2LL+MOD)%MOD)%MOD);
	}else{
		for(int i=0;i<m;i++){
			if(!flag[i] && check(i,x)<x){
				flag[i]=true;
				col[i]=1;
			}else if(flag[i]){
				col[i]=1;
			}
		}
		int cnt=0;
		int cnt2=0;
		for(int i=0;i<m;i++){
			if(!flag[i] && check(i,x)==x){
				cnt++;
			}else if(!flag[i]){
				cnt2++;
			}
		}
		//printf("%d %d\n",cnt,cnt2);
		if(cnt==0){
			printf("0\n");
		}else{
			printf("%lld\n",twop[cnt2+1]*(twop[cnt]-1LL)%MOD);
		}
	}
	return 0;
}

Measured memory_bytes: 512
// Template
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;
const int MOD = 1000000007;

#define v_exists(elem, v) find(v.begin(),v.end(),elem)!=v.end()
#define s_exists(elem, s) s.find(elem)!=s.end()
#define mod_mul(x, y) x*y%MOD
#define mod_add(x, y) (x+y)%MOD
#define mod_sub(x, y) (x-y)%MOD
#define INF_INT 2147483647

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

long lcm( long m, long n ){
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;

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


long nCr(long n, long r){
    if(n==r || r==0){
        return 1;
    } else {
        return mod_add(nCr(n-1,r),nCr(n-1,r-1));
    }
}



int main(){
    
    long long N; cin >> N;
    std::multiset<long long> s;
    for(long long i=0;i<N;i++){
        long long temp; cin >> temp;
        s.insert(temp);
    }

    long long cnt = 0;

    while(!s.empty()){
        multiset<long long>::iterator it = std::prev(s.end());
        long long x = *it; s.erase(it);
        long long k = 1LL;
        while(x >= k) k <<= 1;
        it = s.find(k-x);
        if(it!=s.end()){
            ++cnt;
            s.erase(it);
        }
    }

    cout << cnt << endl;
    
    return 0;

}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  int c = 0;
  rep(i, n) {
    cin >> a[i];
    if (a[i] < 0) {
      c ^= 1;
      a[i] *= -1;
    }
  }
  sort(a.begin(), a.end());
  if (c == 1) a[0] *= -1;
  ll ans = 0;
  rep(i, n) ans += a[i];
  cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
	public static void main(String[] args) {
		new Main().execute();
	}

	public void execute() {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();

		int[] dpTable = new int[N + 1];

		HashSet<Integer> sixPow = new HashSet<>();
		HashSet<Integer> ninePow = new HashSet<>();

		int sp = 6;
		while (sp <= N) {
			sixPow.add(sp);
			sp *= 6;
		}

		int np = 9;
		while (np <= N) {
			ninePow.add(np);
			np *= 9;
		}
		dpTable[1] = 1;
		for (int i = 2; i <= N; i++) {
			if (sixPow.contains(i) || ninePow.contains(i)) {
				dpTable[i] = 1;
				continue;
			}

			dpTable[i] = dpTable[i - 1] + 1;
			for (Integer s : sixPow) {
				if (s < i) {
					dpTable[i] = Math.min(dpTable[i], dpTable[i - s] + 1);
				}
			}

			for (Integer n : ninePow) {
				if (n < i) {
					dpTable[i] = Math.min(dpTable[i], dpTable[i - n] + 1);
				}
			}
		}
		System.out.println(dpTable[N]);

		sc.close();
	}

}


Measured memory_bytes: 36288
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int W[N];
    int r = 0, l = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> W[i];
        r += W[i];
    }
    int ans = 100;
    for (int i = 0; i < N; i++)
    
    {
        r -= W[i];
        l += W[i];
        ans = min(ans, abs(r- l));
    }
    cout << ans << endl;
    
    return 0;
    
}


Measured memory_bytes: 256
import numpy as np
import sys
x,N = map(int, input().split())

P = list(map(int, input().split()))

abs_list = []

for p in P:
  abs_list.append(np.abs(x-p))
  
if len(abs_list) == 0:
  print(x)
  sys.exit()
   
abs_max = max(abs_list)
for i in range(100):
  if abs_list.count(i) == 0:
    print(x-i)
    sys.exit()
  elif abs_list.count(i) == 1 and x+i in P and i !=0:
    print(x-i)
    sys.exit()
  elif abs_list.count(i) == 1 and x-i in P and i != 0:
    print(x+i)
    sys.exit()

Measured memory_bytes: 27144
import java.util.Scanner;

class Main{
    public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	
    	int[] coefX = new int[2];
    	int[] coefY = new int[2];
    	int[] num = new int[2];
    	double resultX = 0;
    	double resultY = 0;
    	while(scan.hasNextInt()){
    		for(int i = 0; i < 2; i++){
        		coefX[i] = scan.nextInt();
    			coefY[i] = scan.nextInt();
    			num[i] = scan.nextInt();
    		}
    		
    		resultX = (double) (num[0]*coefY[1] - coefY[0]*num[1]) / (coefX[0]*coefY[1] - coefY[0]*coefX[1]);
    		resultY = (double) (num[0]*coefX[1] - coefX[0]*num[1]) / (coefY[0]*coefX[1] - coefX[0]*coefY[1]);
    		if(resultX == -0.000){
    			resultX = 0.000;
    		}
    		if(resultY == -0.000){
    			resultY = 0.000;
    		}
    		System.out.printf("%.3f %.3f\n",resultX, resultY);
    	}
    }
}

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

const int MOD = 1000000007;
const int MAX = 5100000;
ll gcd(ll a, ll b) {
    return (b==0) ? a : gcd(b, a%b);
}

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

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

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// 以下から
const int MAX_N = 100000;
struct Edge {
    int to;
    int id;
};

const int D = 80 * 160 + 10;
const int D2 = D*2;
typedef bitset<D2> bs;
int a[100][100];
bs dp[90][90];



const int N = 20;
int h;
int w;
vector<vector<char>> maze(N, vector<char>(N,'#'));

const int MAX_WH = 21;
int d[MAX_WH][MAX_WH];
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
const int INF = 1001001001;
int bfs(int x, int y) {
    queue<P> que;
    rep(i,MAX_WH) {
        rep(j,MAX_WH) {
            d[j][i] = INF;
        }
    }
    que.push(P(x,y));
    d[x][y] = 0;

    while (que.size()) {
        P p = que.front(); que.pop();
        for (int i=0; i< 4; i++) {
            int nx = p.first + dx[i];
            int ny = p.second + dy[i];
            if (0 <= nx && nx < w && 0 <= ny && ny < h && maze[nx][ny] != '#' && d[nx][ny] == INF) {
                que.push(P(nx,ny));
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }
    int mx = 0;
    rep(i,h) rep(j,w) {
            if (d[j][i] == INF) continue;
            mx = max(mx, d[j][i]);
        }
    return mx;
}

bool pairCompare(const P& firstElof, const P& secondElof)
{
    return firstElof.first < secondElof.first;
}
void dfs(){

}
const int MX = 100000;
vector<int> G[MX];

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



Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD =  1000000007;
const int INF = 1e11;
using Graph = vector<vector<int>>;

signed main(){
  int N;
  cin >> N;

  int cnt = 0;
  for( int i = 0; i < N; i++ ){
    int A, B;
    cin >> A >> B;
    if( A == B ) cnt++;
    else cnt = 0;
    if( cnt == 3 ){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

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

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	
	vector<int> num(5);
	for(int i = 0; i < 5; i++){
		cin>>num[i];
	}
	int k;
	cin>>k;
	cout<<(num[4]-num[0]<=k?"Yay!":":(")<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;

ll x[200000];
ll y[200000];

int main(){
  ll n;
  cin >> n;
  ll a;
  rep(i, n){
    cin >> a;
    if (i + a < n) x[i + a]++;
    if (i - a > 0) y[i - a]++;
  }
  ll ans = 0;
  rep(i, n){
    ans += x[i] * y[i];
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 6752
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
int main() {
	ll N, M;
	cin >> N >> M;
	map<ll, ll>mp;
	for (ll i = 0; i < M; i++) {
		ll a, b;
		cin >> a >> b;
      	a--; b--;
		mp[a]++;
		mp[b]++;
	}
	for (ll i = 0; i < N; i++) {
		cout << mp[i] << endl;
	}
}











Measured memory_bytes: 256
object Main extends App {
  import scala.io.StdIn.{readLine}
  for (testCase← 0 until readLine().toInt){
    val field = Field()
    for (y ← 0 until 10){
      readLine().split(' ').map(_.toInt).zipWithIndex.foreach{
        case (0, x) ⇒ field(x, y) = Off
        case (1, x) ⇒ field(x, y) = On
      }
    }
    val raw = Field()
    (0 until 1024).flatMap(canResetField(field, _)).flatten.flatten.foreach(c ⇒ raw(c) = On)
    print((0 until 10).map(y ⇒ (0 until 10).map(x ⇒ raw(x, y) match {case Off ⇒ 0 case On ⇒ 1}).mkString(""," ","\n")).mkString)
  }
  case class Coordinate(x:Int, y:Int){
    def +(that:Coordinate):Coordinate = Coordinate(x + that.x, y + that.y)
  }
  def BeamLine(initial:Int):Iterable[Coordinate] = (0 until 10).filter{x ⇒ ((1 << x) & initial) != 0}.map{Coordinate(_, 0)}
  sealed trait Lamp{
    def switch:Lamp
  }
  object On extends Lamp{
    override def switch:Lamp = Off
  }
  object Off extends Lamp{
    override def switch:Lamp = On
  }
  object Field{
    def apply():Field = new Field()
    private val relationalEffectArea:Iterable[Coordinate] = Coordinate(0, -1)::Coordinate(-1, 0)::Coordinate(0, 0)::Coordinate(1, 0)::Coordinate(0, 1)::Nil
  }
  class Field{
    private val mArray:Array[Array[Lamp]]= Array.tabulate(10){_ ⇒ Array.tabulate(10){_ ⇒ Off}}
    def apply(x:Int, y:Int):Lamp = mArray(x)(y)
    def apply(coordinate: Coordinate):Lamp = mArray(coordinate.x)(coordinate.y)
    def update(x:Int, y:Int, value:Lamp):Unit = mArray(x)(y) = value
    def update(coordinate: Coordinate, value:Lamp):Unit = mArray(coordinate.x)(coordinate.y) = value
    def shootBeam(beam:Coordinate):Unit = Field.relationalEffectArea.map{_ + beam}.filter{case Coordinate(x, y) ⇒ (0 until 10).contains(x) && (0 until 10).contains(y)}.foreach{case Coordinate(x, y) ⇒ mArray(x)(y) = mArray(x)(y).switch}
  }
  def canResetField(field: Field, initial:Int):Option[Iterable[Iterable[Coordinate]]] = {
    var res:List[Iterable[Coordinate]] = BeamLine(initial)::Nil
    res.foreach{_.foreach{field.shootBeam(_)}}
    for (y ← 1 until 10){
      val l = (0 until 10).filter{field(_, y - 1) == On}.map{Coordinate(_, y)}
      l.foreach{field.shootBeam(_)}
      res = l::res
    }
    (0 until 10).forall{field(_, 9) == Off} match{
      case true ⇒ {
        res.foreach(_.foreach(c ⇒ field.shootBeam(c)))
        Some(res)
      }
      case false ⇒ {
        res.foreach(_.foreach(c ⇒ field.shootBeam(c)))
        None
      }
    }
  }
}



Measured memory_bytes: 451684
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    cin >> n;
    int a = n;


    int f = 0;

    while(a > 0){
        f += a%10;
        a/=10;
    }

    if(n%f == 0)cout << "Yes" << endl;
    else cout << "No" << endl;

}

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

struct unionfind {
	vector<int> par;
	
	void init(int n)
	{
		par.resize(n);
		for (int i = 0; i < n; ++i) {
			par[i] = i;
		}
	}
	
	int find(int x)
	{
		if (par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
	
	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);
		par[y] = x;
	}
} uf;

int N;
int x[16], y[16];
double a[16];
double d[16][16];
double af[1<<15];
double dp[1<<15];

int main() {
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> x[i] >> y[i] >> a[i];
	}
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < i; ++j) {
			double t = (double)(x[i]-x[j]) * (x[i]-x[j]) + (double)(y[i]-y[j]) * (y[i]-y[j]);
			t = sqrt(t);
			d[i][j] = d[j][i] = t;
		}
	}
	
	for (int i = 1; i < (1 << N); ++i) {
		vector<pair<double, pair<int, int> > >vec;
		
		double sm = 0.0;
		int num = 0;
		
		for (int j = 0; j < N; ++j) if ((i >> j) & 1) {
			sm += a[j];
			++num;
			for (int k = 0; k < j; ++k) if ((i >> k) & 1) {
				vec.push_back(make_pair(d[j][k], make_pair(j, k)));
			}
		}
		sort(vec.begin(), vec.end());
		
		uf.init(N);
		
		double c = 0.0;
		for (auto e : vec) {
			int x = uf.find(e.second.first);
			int y = uf.find(e.second.second);
			if (x == y) continue;
			uf.unite(x, y);
			c += e.first;
		}
		
		af[i] = max(0.0, (sm-c) / num);
	}
	
	dp[0] = 1e12;
	
	for (int i = 1; i < (1<<N); ++i) {
		for (int j = i; j > 0; --j &= i) {
			dp[i]=max(dp[i],min(dp[i^j],af[j]));
		}
	}
	printf("%.10f\n", dp[(1<<N)-1]);
	return 0;
}

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

using Int = long long int;
using UInt = unsigned long long int;


int main(void) {
    string s;
    cin >> s;
    if (s[0] == '9' || s[1] == '9') {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3620
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
	while (true) {
		int n = -1, k = -1;
		cin >> n >> k;
		if (n <= 0 || k <= 0) break;
		string s;
		cin >> s;
		int d = 0;
		for (int i = 1; i < n; ++i) {
			d += s[i - 1] != s[i];
		}
		int ans = n - 1 - max(0, d - 2 * k);
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 512
n=int(input())
a,b=list(map(int,input().split())),list(map(int,input().split()))
c,d=a[0]+sum(b),a[0]+sum(b)
for i in range(1,n):
    c=c+a[i]-b[i-1]
    d=max(c,d)
print(d)

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int n;
int main()
{
	cin>>n;
	if(n==1) cout<<1<<endl;
	else if(n>=2&&n<4) cout<<2<<endl;
	else if(n<8) cout<<4<<endl;
	else if(n<16) cout<<8<<endl;
	else if(n<32) cout<<16<<endl;
	else if(n<64) cout<<32<<endl;
	else cout<<64<<endl;
	return 0;
}

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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }
typedef long long ll;

int main() {
  int N; cin >> N;
  int cnt=1;
  while (true) {
    if (2*cnt>N) break;
    else cnt *=2;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define R register
using namespace std;
inline ll read(){
	ll pa=1,f=0;char ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')pa=-1;ch=getchar();}
	while(ch<='9'&&ch>='0'){f=(f<<3)+(f<<1)+(ch^48);ch=getchar();}
	return f*pa;
}
inline void write(ll x){
     if(x<0) putchar('-'),x=-x;
     if(x>9) write(x/10);
     putchar(x%10+'0');
}
ll a,b;
int main(){
	cin>>a>>b;
	cout<<a*b;
	return 0;
} 

Measured memory_bytes: 3632
// 未解決

#include <bits/stdc++.h>

#include <iostream>
using namespace std;

#define EACH(i, a) for (auto &&i : a)
#define FOR(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RFOR(i, a, b) for (int i = (int)b - 1; i >= (int)a; --i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREPS(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(x) (x).begin(), (x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define debug(x) cout << #x << ": " << x << endl

#define pb push_back
#define mp make_pair
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define INF (1L << 30)
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

template <class T>
void pv(T a, T b) {
  for (T i = a; i != b; ++i) cout << *i << " ";
  cout << endl;
}
template <class T>
void pvp(T a, T b) {
  for (T i = a; i != b; ++i)
    cout << "(" << i->first << ", " << i->second << ") ";
  cout << endl;
}
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;
}
int in() {
  int x;
  scanf("%d", &x);
  return x;
}

using ll = long long;
#define int ll

template <typename Sequence, typename BinaryPredicate>
struct IndexCompareT {
  IndexCompareT(const Sequence &seq, const BinaryPredicate comp)
      : seq_(seq), comp_(comp) {}
  bool operator()(const size_t a, const size_t b) const {
    return comp_(seq_[a], seq_[b]);
  }
  const Sequence seq_;
  const BinaryPredicate comp_;
};

template <typename Sequence, typename BinaryPredicate>
IndexCompareT<Sequence, BinaryPredicate> IndexCompare(
    const Sequence &seq, const BinaryPredicate comp) {
  return IndexCompareT<Sequence, BinaryPredicate>(seq, comp);
}

template <typename Sequence, typename BinaryPredicate>
std::vector<size_t> ArgSort(const Sequence &seq, BinaryPredicate func) {
  std::vector<size_t> index(seq.size());
  for (int i = 0; i < index.size(); i++) index[i] = i;

  std::sort(index.begin(), index.end(), IndexCompare(seq, func));

  return index;
}
//**********

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

  int n, m;
  cin >> n >> m;
  int h[100010], a[100010], b[100010];
  REP(i, n) { cin >> h[i]; }
  REP(i, m) { cin >> a[i] >> b[i]; }

  int flag[100010];
  MEMSET(flag, 0);

  REP(i, m) {
    if (h[a[i] - 1] < h[b[i] - 1]) {
      flag[a[i] - 1] = 1;
    } else if (h[a[i] - 1] == h[b[i] - 1]) {
      flag[a[i] - 1] = 1;
      flag[b[i] - 1] = 1;
    } else if (h[a[i] - 1] > h[b[i] - 1]) {
      flag[b[i] - 1] = 1;
    }
  }
  int ans = 0;

  REP(i, n) {
    if (flag[i] == 0) {
      ans += 1;
    }
  }
  cout << ans << endl;
  return 0;
};


Measured memory_bytes: 6704
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        String[] values = line.split(" ");
        int a = Integer.parseInt(values[0]);
        int b = Integer.parseInt(values[1]);
        for (int i = 1; i <= 1101; i++) {
            if (i == 1101) {
                System.out.println("-1");
                return;
            }
            int taxa = (int) (i * 0.08);
            int taxb = (int) (i * 0.1);
            if (taxa == a && taxb == b) {
                System.out.println(i);
                return;
            }
        }
    }
}

Measured memory_bytes: 25172
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <deque>
#include <string>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    scanInt(M);
    scanInt(K);
    loop(a, N + 1){
        loop(b, M + 1){
            if (a * (M - b) + b * (N - a) == K){
                puts("Yes");
                return 0;
            }
        }
    }
    puts("No");
}


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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int[] x = new int[n];
		int cnt = 0;
		for(int i = 0;i < n; i++) {
			x[i] = stdIn.nextInt();
			cnt += x[i];
		}
		int a =(int) Math.round((double)cnt/n);
		int ans = 0;
		for(int i = 0; i < n; i++) {
			ans += (a-x[i])*(a-x[i]);
		}
		System.out.println(ans);
		
	}

}


Measured memory_bytes: 21716