akhauriyash/Code-Regression huggingface dataset:
import math
A,B,C = (int(i) for i in input().split())  
K = int(input())

res = False

t = 0
while t <= K and A >= B:
    t = t + 1
    B = B * 2
while t <= K and B >= C:
    t = t+ 1
    C = C * 2


if t  <= K:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 61996
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    k = II()
    d = defaultdict(list)
    d[0] = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    i = 0
    l = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    while len(l) < k:
        tmp = d[i]
        tt = []
        for t in tmp:
            st = str(t)
            for i in range(-1, 2):
                x = int(st[-1]) + i
                if 10 > x >= 0:
                    ss = st + str(x)
                    tt.append(int(ss))
        i += 1
        d[i] = tt
        for ttt in tt:
            l.append(ttt)
    l.sort()
    print(l[k - 1])
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 60764
#! /usr/bin/python 
# -*- coding: utf-8 -*- 
#===============================================================================
# Date created  : 2019-03-02T16:27:42+09:00
# Date modified : 2019-03-02T16:32:15+09:00
# Author        : awk
# Description   : unanswered
#===============================================================================

N = int(input())
L = list(map(int,input().split()))
def counter(array):
    from collections import Counter
    return list(Counter(array).most_common())
c=counter(L)
c = list(filter(lambda x:x[1]>1,c))
c = sorted(c,key=lambda x:x[0])[::-1]
if len(c) == 0:
    print(0)
    quit()
ans = 0
try:
    ans = c[0][0] * c[1][0]
except:
    pass
if c[0][1] >= 4:
    try:
        ans = c[0][0] ** 2
    except:
        pass
print(ans)


Measured memory_bytes: 22156
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)
#define fo(i,l,r,x) for(int i=(l);i<=(r);i+=(x))
using namespace std;
const int N=1e5+10;
int n,p[4][N],f[N],b[N],c[2];
inline void cmz(){puts("No");exit(0);}
void add(int i,int x){for(;i<=n;i+=i&(-i)) b[i]+=x;}
int sum(int i){int ans=0;for(;i;i-=i&(-i)) ans+=b[i];return ans;}
int main(){
    scanf("%d",&n);
    rep(i,1,3) rep(j,1,n) scanf("%d",&p[i][j]);
    rep(i,1,n){
        if(p[1][i]%3==0){
            if(p[2][i]==p[1][i]-1&&p[3][i]==p[1][i]-2) f[i]=-p[1][i]/3;
            else cmz();
        }
        else if(p[3][i]%3==0){
            if(p[2][i]==p[3][i]-1&&p[1][i]==p[3][i]-2) f[i]=p[3][i]/3;
            else cmz();
        }
        else cmz();
    }
    fo(i,1,n,2){
        if(f[i]%2==0) cmz();
        if(f[i]<0) c[1]^=1,f[i]=-f[i];
    }
    fo(i,2,n,2){
        if(f[i]%2==1) cmz();
        if(f[i]<0) c[0]^=1,f[i]=-f[i];
    }
    fo(i,1,n,2) c[0]^=(sum(n)-sum(f[i]))&1,add(f[i],1);
    memset(b,0,sizeof(b));
    fo(i,2,n,2) c[1]^=(sum(n)-sum(f[i]))&1,add(f[i],1);
    puts((c[0]||c[1])?"No":"Yes");
    return 0;
}

Measured memory_bytes: 2176
// Problem : B - Frog 2
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize("O3")  
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define pii pair<int,int>
#define S second
#define endl "\n"
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define mem(z,i) memset(z,i,sizeof(z))
#define eps 1e-7
#define I (int)
#define mod 1000000007
#define pb push_back
const long long INF = 1000000000000000000LL;
//const int WASTE=∞
const int N=1e5+5;
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
  	// cout<<fixed;
  	// cout.precision(10);
   	int n,k;
   	cin>>n>>k;
   	int a[N];
   	for(int x=0;x<n;x++) cin>>a[x];
   	int dp[N]; dp[0]=0;
   	for(int x=1;x<k;x++) dp[x]=min(abs(a[x]-a[0]),dp[x-1]+abs(a[x]-a[x-1]));
   	for(int x=k;x<n;x++){
   		dp[x]=mod;
   		for(int y=x-1;y>=x-k;y--) dp[x]=min(dp[x],dp[y]+abs(a[x]-a[y]));
   	}
   	cout<<dp[n-1];
   	
   	
   	
   	
   	
   	
   	
   	
   	
   	
   	
  	return 0;
}



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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

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

    int A, B, X;
    std::cin >> A >> B >> X;
    std::cout << ((A <= X && X < A + B) ? "YES" : "NO") << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
const int MOD = 1e9 + 7;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)

int a[510000];

int main() {
    string s;
    cin >> s;
    int sz = s.size() + 1;
    for(int i = 0; i < sz;i++){
        if (s[i] == '<') a[i+1] = max(a[i+1], a[i]+1);
    }
    for(int i = sz - 1; i > 0;i--){
        if (s[i-1] == '>') a[i-1] = max(a[i-1], a[i]+1);
    }
    ll ans = 0;
    rep(i,sz) ans += a[i];
    cout << ans << endl;

}

Measured memory_bytes: 5840
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func main() {
	coins := []int64{500,5}

	money := readInt64Slice()[0]


	uresisa := []int64{0,0}

	for i, coin := range coins{
			div := int64(money / coin)
			if div > 0 {
				uresisa[i] = div
				money = money - coin * div
		}
	}
	u := uresisa[0] * 1000 + uresisa[1] * 5

	fmt.Println(u)

}

func readInt64Slice() []int64 {
	line := readStringSlice()
	slice := make([]int64, 0, len(line))
	for _, tmp := range line {
		val, err := strconv.ParseInt(tmp, 10, 64)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
		slice = append(slice, val)
	}
	return slice
}
func readFloat64Slice() []float64 {
	line := readStringSlice()
	slice := make([]float64, 0, len(line))
	for _, tmp := range line {
		val, err := strconv.ParseFloat(tmp, 64)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
		slice = append(slice, val)

	}
	return slice
}
func readString() string {
	s, _, _ := in.ReadLine()
	return string(s)
}
func readStringSlice() []string {
	line := readString()
	s := strings.Split(line, " ")
	return s
}
func dump(value ...interface{}) {
	for _, v := range value {
		fmt.Printf("%#v\n", v)
	}
}

Measured memory_bytes: 640
#include "vector"
#include "set"
#include "map"
#include "unordered_map"
#include "string"
#include "iostream"
#include "algorithm"
#include "queue"

using namespace std;

#define ll long long
#define INF 2e9
#define MOD 1000000007

typedef vector<int> vi;
typedef pair<int, int> pii;

struct v {
    int x;
    int i;
    int closed;
};

bool comp(const v& x, const v& y) {
    return (x.x < y.x) || (x.x == y.x && x.closed < y.closed);
};

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    bool first = true;
    for (const auto& x : v) {
        if (!first) {
            os << " ";
        }
        first = false;
        os << x;
    }
    return os;
}

template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
    for (auto& elem : v) {
        is >> elem;
    }
    return is;
}

ll pw(ll x, int n) {
    if (n == 1) {
        return x;
    }
    if (n%2 == 0) {
        return pw((x*x) % MOD, n/2);
    }
    return (pw(x, n-1) * x) % MOD;
}

int get_min(map<int, set<int> >& m) {
    return m.begin()->first;
}

int get_min(set<int>& m) {
    return *m.begin();
}

int get_max(map<int, set<int> >& m) {
    auto it = m.end();
    it--;
    return it->first;
}

int get_max(set<int>& m) {
    auto it = m.end();
    it--;
    return *it;
}

void solve() {
    string s;
    cin >> s;
    cout << ((s[2]==s[3] && s[4]==s[5]) ? "Yes" : "No");
}

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

    if (0) {
        int tests;
        cin >> tests;
        while (tests--) {
            solve();
            cout << endl;
        }
    } else {
        solve();
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <tr1/unordered_map>
//#include"Bignum/bignum.h"
//#define big bignum
#define lowbit(x) (x & -x)
#define debug(x) (cout << "#x = " << (x) << endl)
#define Set(x, i) memset (x, i, sizeof(x))
#define R register
#define For(i, j, k) for(R int i = (j); i <= (int) (k); ++i)
#define Rep(i, j, k) for(R int i = (j); i >= (int) (k); --i)
#define Cross(i, j, k) for(R int i = (j); i; i = (k))
using namespace std;
typedef long long ll;
const ll N = 100011;
const ll INF = 5e16;

namespace IO {

	inline char gc() {
		static char buf[100000], *p1 = buf, *p2 = buf;
		return (p1 == p2) && (p2 = (p1 = buf) +
			fread(buf, 1, 100000, stdin), p1 == p2)? EOF: *p1++;
	}

	#define dd ch = getchar()
	inline ll read() {
		R ll x = 0; R int f = 0; R char dd;
		for (; !isdigit(ch); dd) f ^= (ch == '-');
		for (; isdigit(ch); dd)  x = x * 10 + (ch ^ 48);
		return f? -x: x;
	}
	#undef dd

	inline void write ( ll x ) {
		if (x < 0) x = -x, putchar('-');
		if (x > 9) write(x / 10); putchar(x % 10 | 48);
	}

	inline void wrn ( ll x ) { write(x), putchar(' '); }

	inline void wln ( ll x ) { write(x), putchar('\n'); }

	inline void wlnn ( ll x, ll y ) { wrn(x), wln(y); }

}

using IO::wln;
using IO::read;

namespace Cesare {
	
	/*
		设 f[S] 表示选到第 i 个，钥匙状态为 S 的最小花费。
		f[S | St[i]] =  min(f[S | St[i]], f[S] + a[i])
		Ans = min(f[n][Max])
	*/
	
	const ll M = 2011;
	
	ll n, m, a[M], b[M], T[N], St[M], c[M][M], f[(1 << 12) + 1];
	
	int main() {
		n = read(), m = read();
		ll Max = (1 << n) - 1;
		For ( i, 1, m ) {
			a[i] = read(), b[i] = read();
			For ( j, 1, b[i] ) T[c[i][j] = read()] = 1;
			For ( j, 1, b[i] ) St[i] |= 1 << (c[i][j] - 1);
		} 
//		For ( i, 1, n ) if (!T[i]) return puts("-1"), 0;
		Set (f, 0x3f); f[0] = 0;
		For ( S, 0, Max ) For ( i, 1, m ) {
			f[S | St[i]] = min(f[S | St[i]], f[S] + a[i]);
		} return wln(f[Max] > INF? -1: f[Max]), 0;
	}
	
}

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

	return Cesare :: main();
}

/*

*/






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

const int maxn = 220;

int a[maxn], b[maxn];
vector<int> g[maxn];
int link[maxn];
bool vis[maxn];

inline bool dfs(int x) {
	if(vis[x]) return false;
	vis[x] = true;
	for(auto v : g[x]) {
		if(link[v] == -1 || dfs(link[v])) {
			link[v] = x;
			return true;
		}
	}
	return false;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n; cin >> n;
	for(int i = 0; i < 2 * n; ++ i) cin >> a[i] >> b[i];
	for(int i = 0; i < n; ++ i) for(int j = n; j < 2 * n; ++ j) {
		if(a[i] < a[j] && b[i] < b[j]) g[i].push_back(j);
	}
	memset(link, 0xff, sizeof link);
	memset(vis, false, sizeof vis);
	int ans = 0;
	for(int i = 0; i < n; ++ i) {
		memset(vis, false, sizeof vis);
		if(dfs(i)) ++ ans;
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
 
int main(void){
  int a,b,t;
  int sum=0;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &t);
  
  for(;a>20||a<1||b>20||b<0||t>20||t<0;){
  	printf("入力は1~20の範囲でおこなってください．\n");
  	scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &t);
  }
  
  for(int i=0; i < t/a; i++){
    sum += b;
  }
  printf("%d\n", sum);
 
}

Measured memory_bytes: 128
program main
  implicit none
  integer(8) n, time(5), nekku
  read(*, *) n
  read(*, *) time(1)
  read(*, *) time(2)
  read(*, *) time(3)
  read(*, *) time(4)
  read(*, *) time(5)
  nekku = min(time(1),time(2),time(3),time(4),time(5))
  if (mod(N,nekku) == 0) then
    write(*, '(i0)') (N/nekku)+4
  else
    write(*, '(i0)') (N/nekku)+5
  end if
end program main

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool>    vecbool;
typedef vector<int>     vecint;
typedef vector<ll>      vecll;
typedef vector<string>  vecstr;
typedef vector<vecint>  vec2int;
typedef vector<vecbool> vec2bool;
int dx[4] {-1,+1, 0, 0};
int dy[4] { 0, 0,-1,+1};
void init(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
int main()
{
  init();
  int a;
  cin >> a;
  int a500 = 1000*(a/500);
  int a5 = 5*((a - 500*(a/500))/5) ;
  cout << a500 + a5 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<cstring>
#include<bitset>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<numeric>
#include<set>
#include<math.h>
using namespace std;

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

#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)

long long INF=1e9;
const int mod=10007;
#define ll long long

int main(){
	int n;
	cin>>n;
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			if(i*j==n){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}	
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
L,R=list(map(int,input().split()))
mod=2019

if R-L<mod-1:
  a=[i%mod for i in range(L,R+1)]
  if 0 in a:
    print(0)
  else:
    an=[]
    for i in range(len(a)):
      for j in range(i+1,len(a)):
        an.append((a[i]*a[j])%mod)
    print(min(an))
else:
  print(0)

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

int main(){
    int A[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K; cin >> K;
    cout << A[K-1] << endl;
    return 0;
}

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

using namespace std;
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define sz(a) (int)(a).size()
#define rep(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define frep(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define fwr(x) { cout << x << '\n'; }

typedef complex<ld> cplex;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;

const int inf = 1e9 + 7;
const ll linf = 1ll * inf * inf;
const int N = 1000 + 1;
const int M = 5000;
const int multipleTest = 0;
const double pi = acos(-1);

int n;
int a[2][N];

void solve() {
    cin >> n;
    rep(i, 0, 2) {
        rep(j, 0, n) {
            scanf("%d", &a[i][j]);
            if (i == 0) {
                if (j > 0) {
                    a[i][j] += a[i][j - 1];
                }
            } else {
                if (j == 0) a[i][j] += a[i - 1][j];
                else {
                    a[i][j] += max(a[i - 1][j], a[i][j - 1]);
                }
            }
        }
    }
    cout << a[1][n - 1] << '\n';
}

int main() {
#ifdef _LOCAL_
    freopen("inp.txt", "r", stdin);
    //    freopen("out.txt", "w", stdout);
#endif
    
    int Test = 1;
    if (multipleTest)
        cin >> Test;
    
    for(int i = 0; i < Test; ++i) {
        //        printf("Case #%d: ", i + 1);
        solve();
    }
#ifdef _LOCAL_
    cout<< "\n" << 1.0 * clock() / CLOCKS_PER_SEC << "\n";
#endif
}


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

int main() {
   string N;
   cin >> N;
 
   int K = 0;
 
   for (int i = 0; i < N.size(); i++) {
      if (N.at(i) == '2') {
        K++;
      }
   }
cout << K << endl;
}


Measured memory_bytes: 256
/*
ID: thanhvq1
LANG: C++14
PROB: namenum
*/

#pragma GCC optimize ("O2")
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;
#define int long long
#define double long double
#define vec vector
#define vi vector<int>
#define FZ(n) memset((n),0,sizeof(n))
#define FMO(n) memset((n),-1,sizeof(n))
#define unset unordered_set
#define ii pair<int, int>
#define vii vector<ii>
#define F first
#define S second
#define PB push_back
#define ALL(x) begin(x),end(x)
#define SZ(x) ((int)(x).size())
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first, l.second+r.second};
}
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

void FILEIO() {  freopen("in.txt", "r", stdin);  freopen("out.txt", "w", stdout); }
//void FILEIO() {  freopen("namenum.in", "r", stdin);  freopen("namenum.out", "w", stdout); }

int x, a;

void solve() {
	cin >> x >> a;
	if(x<a) cout << 0 << endl;
	else cout << 10 << endl;
}

//#undef int
signed main() {
//#define int long long
  ios_base::sync_with_stdio(false); cin.tie();
//  FILEIO();
//auto beginProgram = chrono::steady_clock::now();

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

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}


Measured memory_bytes: 256
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=1e5+1000;
struct node{
	int v,nxt,c;
}edge[maxn<<2];
int head[maxn],tot;
int vis[maxn],dist[maxn];
int n,m,len=0;
inline void read(int &x){
	x=0;char tmp=getchar();
	while(tmp<'0'||tmp>'9') tmp=getchar();
	while(tmp>='0'&&tmp<='9') x=(x<<1)+(x<<3)+tmp-'0',tmp=getchar();
}
inline void add_edge(int x,int y,int c){
	edge[tot].nxt=head[x];
	edge[tot].v=y;
	edge[tot].c=c;
	head[x]=tot++;
}
inline bool spfa(int x){
	int maxx=0,minn=0;
	dist[x]=0,vis[x]=1;
	queue<int>q;
	q.push(x);
	while(!q.empty()){
		int u=q.front();q.pop();
		for(int i=head[u];i!=-1;i=edge[i].nxt){
			int v=edge[i].v;
			if(!vis[v]){
				dist[v]=dist[u]+edge[i].c;
				maxx=max(dist[v],maxx);
				minn=min(dist[v],minn);
				vis[v]=1;
				q.push(v);
			}
			else if(dist[v]!=dist[u]+edge[i].c)
				return false;
		}
	}
	len=max(len,maxx-minn);
	if(len>1e9) return false;
	return true;
}
int main(){
	memset(head,-1,sizeof(head));
	memset(vis,0,sizeof(vis));
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int l,r,d;
		read(l),read(r),read(d);
		add_edge(l,r,d);
		add_edge(r,l,-d);
	}
	for(int i=1;i<=n;i++){
		if(!vis[i]){
			if(!spfa(i)){
				printf("No\n");
				return 0;
			}
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MAX   1e9
#define MIN  -1e9
typedef map<int,int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define trav(a, x) for(auto& a : x)
struct Interval {int start, end;};
bool compare(Interval i1, Interval i2) {return (i1.start < i2.start);}
ll dp[100005];
int main()
{
    fio;
    string s;
    cin>>s;
    rep(i,3)
    {
        if(s[i]==s[i+1])
        {
            cout<<"Bad";
            return 0;
        }
    }
    cout<<"Good";
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	long mod=1000000007;
	public long dp(long[][] arr,long[][] dp,int col,int row,int n ) {
		if(row>=n) {
			return 0;
		}
		if(dp[col][row]!=-1) {
			return dp[col][row];
		}
		if(row==n-1) {
			for(int i=0;i<n;i++) {
				if(arr[row][i]==1 && ((col)&((1<<(n-1-i))))>=1) {
					dp[col][row]=1;
					return 1;
				}
			}
			dp[col][row]=0;
			return 0;
		}
		long sum=0;
		for(int i=0;i<n;i++) {
			if(arr[row][i]==1 && ((col)&((1<<(n-1-i))))>=1) {
				
				sum+=this.dp(arr, dp,(col)&(~(1<<(n-1-i))) , row+1, n);
			}
		}
		sum%=mod;
		dp[col][row]=sum;
		return dp[col][row];
	}
	public static void main(String[] args) throws Exception{
        // TODO Auto-generated method stub
        Reader.init(System.in);
        int n=Reader.nextInt();
        
        long[][] dp=new long[(int)Math.pow(2, n)][n];
        int l=(int)Math.pow(2, n);
        long[][] arr=new long[n][n];
        for(int i=0;i<n;i++) {
        	for(int j=0;j<n;j++)
        	arr[i][j]=Reader.nextInt();
        }
        for(int i=0;i<l;i++) {
        	for(int j=0;j<n;j++) {
        		dp[i][j]=-1;
        	}
        }
        Main mm=new Main();
        System.out.println(mm.dp(arr, dp,((int)Math.pow(2, n))-1,0, n));
		
	}
}
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
	
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}


Measured memory_bytes: 560524
def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i-1
        while A[j] > v and j >= 0:
            A[j+1], A[j] = A[j], A[j+1]
            j -= 1


def bubbleSort(A, N):
    flag = 1
    while flag:
        flag = 0
        for j in range(N-1, 0, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                flag = 1


def bubbleSort_card(C, N):
    flag = 1
    while flag:
        flag = 0
        for j in range(N-1, 0, -1):
            if C[j][1] < C[j-1][1]:
                C[j], C[j-1] = C[j-1], C[j]
                flag = 1

def selectionSort_card(A, N):
    for i in range(N):
        minidx = i
        for j in range(i, N):
            if A[j][1] < A[minidx][1]:
                minidx = j
        A[i], A[minidx] = A[minidx], A[i]

def selectionSort(A, N):
    for i in range(N):
        minidx = i
        for j in range(i, N):
            if A[j] < A[minidx]:
                minidx = j
        A[i], A[minidx] = A[minidx], A[i]


N = int(input())
A = list(input().split())
C = A.copy()
bubbleSort_card(C,N)
selectionSort_card(A,N)
print(" ".join(C))
print('Stable')
print(" ".join(A))
for i in range(N):
    if A[i] != C[i]:
        print('Not stable')
        break
else:
    print('Stable')




Measured memory_bytes: 5612
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

type Stack struct {
	s [10000]int
	top int
}

func GenStack() Stack {
	return Stack{top: 0}
}

func (stack *Stack) Push(value int) {
	stack.top++
	stack.s[stack.top] = value
}

func (stack *Stack) Pop() int {
	v := stack.s[stack.top]
	stack.top--
	return v
}

func main() {
	var s string
	sc.Scan()
	s = sc.Text()

	a := strings.Split(s, " ")

	stack := GenStack()

	for _, v := range a {
		if v == "+" {
			v1 := stack.Pop()
			v2 := stack.Pop()
			stack.Push(v1 + v2)
		} else if v == "-" {
			v1 := stack.Pop()
			v2 := stack.Pop()
			stack.Push(v2 - v1)
		} else if v == "*" {
			v1 := stack.Pop()
			v2 := stack.Pop()
			stack.Push(v1 * v2)
		} else if v == "/" {
			v1 := stack.Pop()
			v2 := stack.Pop()
			stack.Push(v2 / v1)
		} else {
			vv, _ := strconv.Atoi(v)
			stack.Push(vv)
		}
	}

	fmt.Println(stack.Pop())
}



Measured memory_bytes: 1396
import java.util.*;

public class Main {
	int N;
	int[] C;
	Map<Integer, List<Integer>> indexes;
	static final long MOD = 1000000007;
	long result;
	long[] memo;

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

	Main() {
		Scanner in = new Scanner(System.in);
		N = Integer.parseInt(in.nextLine());
		C = new int[N];
		int cMax = -1;
		for (int i = 0; i < N; ++i) {
			C[i] = Integer.parseInt(in.nextLine());
			cMax = Math.max(cMax, C[i]);
		}
		in.close();
		this.memo = new long[cMax + 1];
		Arrays.fill(this.memo, 0);
		this.memo[C[0]] = 1;

		for (int i = 1; i < N; ++i) {
			if (C[i - 1] != C[i]) {
				this.memo[C[i]] = this.add(this.memo[C[i]], this.memo[C[i - 1]]);
			}
		}
		this.result = this.memo[C[C.length - 1]];
	}

	public static void main(String[] args) {
		Main ins = new Main();
		System.out.println(ins.result);
	}
}

Measured memory_bytes: 156144
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    else:
        for i in range(1, h+1):
            if i % 2 == 0:
                for j in range(1, w+1):
                    if j % 2 == 0:
                        print("#",end="")
                    else:
                        print(".",end="")
                print("")
            else:
                for j in range(1, w+1):
                    if j % 2 == 0:
                        print(".",end="")
                    else:
                        print("#",end="")
                print("")
        print("")

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

int main(){
    int n,a[110],b[110]={0},cnt=0;
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++) b[a[i]]=a[i];
    for(int i=1;i<=100;i++){
       if(0<b[i]) cnt++;
    }
    cout<<cnt;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
	int N, K; scanf("%d%d", &N, &K);

	int cnt = 0;
	for(int i = 0; i < N; i++){
		int h; scanf("%d", &h);
		if (h >= K)cnt++;

	}
	printf("%d", cnt);

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int N; cin >> N;
	int L; cin >> L;
	vector<string> S(N);
	for (int i = 0; i < N; i++) cin >> S[i];
	sort(S.begin(), S.end());
	for (int i = 0; i < N; i++) {
		cout << S[i];
	}
	cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int arr[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin>>k;
    cout<<arr[k-1];
}

Measured memory_bytes: 256
import random
import time

def search(day, c, s):
    schedule = []
    satisfy = []
    score = 0
    date = [0] * 26
    
    for d in range(day):
        tmp = 0
        contest = 0
        nmax = -float('inf')
        for i in range(26):
            tmp += c[i] * (d + 1 - date[i])
        for i in range(26):
            tmp2 = s[d][i] - tmp + c[i] * (d + 1 - date[i])
            if nmax < tmp2:
                nmax = tmp2
                contest = i
        
        satisfy.append(tmp - c[contest] * (d + 1 - date[contest]))
        date[contest] = d + 1
        schedule.append(contest)
        score += s[d][contest] - satisfy[d]

    return score, schedule, satisfy

def change(day, contest,D, c, s, schedule, satisfy):
    ret = 0
    date = [0] * 26

    for d in range(D):
        if d == day:
            now = contest + 1
            date[now - 1] = d + 1
        else:
            now = schedule[d] + 1
            date[now - 1] = d + 1
        if d < day:
            ret += satisfy[d]
            continue

        tmp = 0
        for i in range(26):
            tmp += c[i] * (d+1 - date[i])
        ret += tmp
        satisfy[d] = tmp

    return ret

def Main():
    D = int(input())
    c = tuple(map(int, input().split()))
    s = [tuple(map(int, input().split())) for _ in range(D)]
    
    dissatisfy=[]
    schedule = []
    score = 0
    start = time.time()

    ans, schedule, dissatisfy = search(D, c, s)
    
    for i in range(D):
        score += s[i][schedule[i]]

    while time.time() - start < 1.85:
        contest = random.randint(0, 25)
        day = random.randint(0, D - 1)
        if schedule[day] == contest:
            continue

        save = dissatisfy.copy()
        dec2 = change(day,contest,D,c, s, schedule, dissatisfy)
        score2 = score - s[day][schedule[day]] + s[day][contest]

        if ans < score2 - dec2:
            ans = score2 - dec2
            score = score2
            schedule[day] = contest
        else:
            dissatisfy = save

    for i in range(D):
        print(schedule[i] + 1)

if __name__ == "__main__":
    Main()

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define MOD 1000000007

int main()
{

    ll x,y,z;
    cin >> x>>y>>z;
    x-=z;
    cout << x/(y+z);
}


Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]


a,b = map(int, input().split())
s = input()

ans = "Yes"
for i in range(len(s)):
    if (i == a):
        if (s[i] != "-"):
            ans = "No"
            break
    else:
        if (s[i] >= "0" and s[i] <= "9"):
            pass
        else:
            ans = "No"
            break
print(ans)





Measured memory_bytes: 8800
def main():
    S = str(input())
    n = len(S)
    frontN = (n - 1) // 2
    backN = (n + 3) // 2
    
    checkFN = frontN // 2
    checkFNW = S[0:frontN]
    for i in range(checkFN):
        temp = (i + 1) * -1
        if checkFNW[i] == checkFNW[temp]:
            continue
        else:
            print('No')
            return
    
    checkBN = n - backN
    checkBNW = S[backN - 1:n]
    for i in range(checkBN // 2):
        temp = (i + 1) * -1
        if checkBNW[i] == checkBNW[temp]:
            continue
        else:
            print('No')
            return

    for i in range(n // 2):
        temp = (i + 1) * -1
        if S[i] == S[temp]:
            continue
        else:
            print('No')
            return
    
    print('Yes')
main()

Measured memory_bytes: 9100
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int MaxN = 1e5;

int n, all;
int pre[2 * MaxN + 5], last[MaxN + 5], other[2 * MaxN + 5];
int deep[MaxN + 5], father[MaxN + 5], size[MaxN + 5];
void build(int x, int y)
{
	pre[++all] = last[x];
	last[x] = all;
	other[all] = y;
}
void Dfs(int x, int fa)
{
	deep[x] = deep[fa] + 1;
	father[x] = fa;
	size[x] = 1;
	int ed = last[x], dr;
	while(ed != -1)
	{
		dr = other[ed];
		if(dr != fa) {
			Dfs(dr, x);
			size[x] += size[dr];
		}
		ed = pre[ed];
	}
}
int main()
{
	while(scanf("%d", &n) != EOF)
	{
		all = -1;
		memset(last, -1, sizeof(last));
		for(int i = 1; i < n; i++) {
			int u, v;
			scanf("%d %d", &u, &v);
			build(u, v); build(v, u);
		}
		Dfs(1, 0);
		int dr_num = deep[n] - deep[1] - 1;
		int p = n;
		for(int i = 1; i <= dr_num / 2; i++)
			p = father[p];
		if(size[p] >= n - size[p]) printf("Snuke\n");
		else printf("Fennec\n");
	}
	return 0;
}

Measured memory_bytes: 7936
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let q: usize = iterator.next().unwrap().parse().unwrap();

    let s: Vec<char> = iterator.next().unwrap().chars().collect();
    let mut memo: Vec<usize> = vec![0; n];
    for i in 1..n {
        if s[i - 1] == 'A' && s[i] == 'C' {
            memo[i] = memo[i - 1] + 1;
        } else {
            memo[i] = memo[i - 1];
        }
    }

    let mut result = String::new();
    for _ in 0..q {
        let l: usize = iterator.next().unwrap().parse().unwrap();
        let r: usize = iterator.next().unwrap().parse().unwrap();
        result.push_str(&format!("{}\n", memo[r - 1] - memo[l - 1]));
    }
    return result.trim().to_string();
}


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

int main() {
    for (int i=0;; i++) {
        int a, b, ans;
        string op;
        cin >> a >> op >> b;
        if (op=="?") break;
        else if (op=="+") ans = a+b;
        else if (op=="-") ans = a-b;
        else if (op=="*") ans = a*b;
        else if (op=="/") ans = a/b;
        cout << ans << endl;
    }
    return 0;
}


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

As = [0] + list(map(int, input().split()))
As.sort(reverse=True)
BCs = [(0,0)]

memo = [0]*N

for _ in range(M):
  b,c = map(int, input().split())
  BCs.append((b,c))
  
BCs.sort(key=lambda x:x[1], reverse=True)

cnt = 0
rlt = 0
i = 0
j = 0
while cnt < N:
  if As[i] >= BCs[j][1]:
    rlt += As[i]
    cnt += 1
    i += 1
  else:
    if cnt + BCs[j][0] < N:
      rlt += BCs[j][0]*BCs[j][1]
      cnt += BCs[j][0]
      j += 1
    else:
      rlt += (N-cnt)*BCs[j][1]
      break
  
print(rlt)

Measured memory_bytes: 28928
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		ArrayList<Integer> list=new ArrayList<Integer>();
		for (int i = 0; i < 10; i++) {
			list.add(scan.nextInt());
		}
		Collections.sort(list,Collections.reverseOrder());
		System.out.println(list.get(0));
		System.out.println(list.get(1));
		System.out.println(list.get(2));
		
	}

}

Measured memory_bytes: 17196
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>

using namespace std;

class Data{
public:
	int w,s;
	string name;
};

int main(){

	int n;
	while(cin>>n&&n!=0){
		Data d[10];
		for(int i = 0; i < n; i++){
			cin>>d[i].name>>d[i].w>>d[i].s;
		}
		vector<int> v;
		for(int i = 0; i < n; i++){
			v.push_back(i);
		}
		double minW=100000000;
		vector<int> p;
		// ツ全ツ津環づィツづ個渉氾板づ計ツ算ツつキツづゥ
		do{
			int sumW=0;
			bool f=true;
			int Bunshi=0;
			for(int i = n-1; i >= 0; i--){
				Bunshi+=(i+1)*d[v[i]].w;
				if(sumW>d[v[i]].s){
					f=false;
					break;
				}
				sumW+=d[v[i]].w;
			}
			// ツづつづ板づェツづ按つ「ツ湘ェツ債、ツ全ツ妥個づ個重ツ心ツづーツ更ツ新ツつキツづゥ
			if(f){
				double G=(double)Bunshi/sumW;
				if(G<minW){
					minW=min(minW,G);
					p=v;
				}
			}
		}while(next_permutation(v.begin(),v.end()));

		for(int i = 0; i < p.size(); i++){
			cout<<d[p[i]].name<<endl;
		}
	//	cout<<endl;
	}

	return 0;
}

Measured memory_bytes: 912
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    mt = 10 ** 10
    mi = min(a)
    ma = max(a)
    for i in range(mi, ma + 1):
        t = 0
        for v in a:
            t += ((i - v) ** 2)
        mt = min(mt, t)
    print(mt)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38512
def count2(x):
    count = 0
    while x % 2**10 == 0:
        x //= 2**10
        count += 10
    while x % 2 == 0:
        x //= 2
        count += 1
    return count

N = int(input())
A = list(map(int, input().split()))

print(sum(count2(a) for a in A))


Measured memory_bytes: 4148
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

a,b =I()
for i in range(1,101):
    if b**i > a:
        print(i)
        sys.exit()


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		var SH = new SkewHeap<long>();
		for(int i=0;i<N;i++) SH.Push(-A[i]);
		for(int i=0;i<M;i++){
			var v = SH.Top; SH.Pop();
			v /= 2;
			SH.Push(v);
		}
		long tot = 0;
		while(SH.Count > 0){
			var v = SH.Top; SH.Pop();
			tot += v;
		}
		Console.WriteLine(-tot);
		
		
	}
	int N,M;
	long[] A;
	public Sol(){
		var d = ria();
		N = d[0]; M = d[1];
		A = rla();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}



class SkewHeap<T> where T:IComparable<T>{
	public int Count{
		get{return cnt;}
		private set{cnt=value;}
	}
	
	public SkewHeap(){
		root=null;
		this.Count=0;
	}
	
	public void Push(T v){
		NodeSH<T> p=new NodeSH<T>(v);
		root=NodeSH<T>.Meld(root,p);
		this.Count++;
	}
	
	public void Pop(){
		if(root==null)return;
		root=NodeSH<T>.Meld(root.L,root.R);
		this.Count--;
	}
	
	public T Top{
		get{return root.Val;}
	}
	
	int cnt;
	NodeSH<T> root;
	
	class NodeSH<S> where S : IComparable<S> {
		public NodeSH<S> L, R;
		public S Val;

		public NodeSH(S v){
			Val = v;
			L = null; R = null;
		}
		public static NodeSH<S> Meld(NodeSH<S> a, NodeSH<S> b){
			if(a == null)return b;
			if (b == null) return a;
			if (a.Val.CompareTo(b.Val) > 0) swap(ref a, ref b);
			a.R = Meld(a.R, b);
			swap(ref a.L, ref a.R);
			return a;
		}

		static void swap<U>(ref U x, ref U y) {
			U t = x; x = y; y = t;
		}
	}
}


Measured memory_bytes: 35672
#include <bits/stdc++.h>
 
#define int long long
 
#define pii pair<int, int>
 
#define x1 x1228
#define y1 y1228
 
#define left left228
#define right right228
 
#define pb push_back
#define eb emplace_back
 
#define mp make_pair                                                                
                                                                                                                                        
#define ff first                                                                  
#define ss second   
 
#define matr vector<vector<int> > 
 
#define all(x) x.begin(), x.end()
 
 
using namespace std;
typedef long long ll; 
typedef long double ld; 
                                                                                                   
const int maxn = 3e5 + 7, mod = 998244353, inf = 1e18, MAXN = 1e6 + 7;
const double eps = 1e-9;
mt19937 rnd(time(0));
int n; 

void solve() { 
    cin >> n; 
    cout << n * n * n; 
}                                
   
signed main() {
#ifdef LOCAL
    freopen("TASK.in", "r", stdin);
    freopen("TASK.out", "w", stdout);
#else 
    
#endif // LOCAL
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20); 
    cout << fixed; 
    int t = 1; 
    for (int i = 0; i < t; ++i) {              
        solve();
    }
    return 0;
}  

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

const ll INF = 1001001001;

const double PI=3.141592653;

const ll sosu = 1000000007;//大きい素数

//提出のときに言語がc＋＋似合っていることを確認する

ll f(ll x){
  if(x==1) return 1;
  return 2*f(x/2)+1;
}
int main(){
  char x,y;
  cin>>x>>y;
  if(x>y) cout<<">"<<endl;
  else if(x==y) cout<<"="<<endl;
  else cout<<"<"<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys


class UnionFind:
    def __init__(self, node_size):
        self._node = node_size
        self.par = [i for i in range(self._node)]
        self.rank = [0] * self._node
        self.size = [1] * self._node

    def find(self, ver):
        if self.par[ver] == ver:
            return ver
        else:
            self.par[ver] = self.find(self.par[ver])
            return self.par[ver]

    def unite(self, ver1, ver2):
        ver1, ver2 = self.find(ver1), self.find(ver2)
        if ver1 == ver2:
            return
        if self.rank[ver1] < self.rank[ver2]:
            ver1, ver2 = ver2, ver1
        self.par[ver2] = ver1
        self.size[ver1] += self.size[ver2]
        if self.rank[ver1] == self.rank[ver2]:
            self.rank[ver1] += 1

    def size(self, ver):
        ver = self.find(ver)
        return self.size[ver]

    def same(self, ver1, ver2):
        return self.find(ver1) == self.find(ver2)

if __name__ == '__main__':
    n, m = map(int, sys.stdin.readline().split())
    uf = UnionFind(n)
    for i in range(m):
        s, t = map(int, sys.stdin.readline().split())
        uf.unite(s, t)
    q = int(sys.stdin.readline())
    for i in range(q):
        s, t = map(int, sys.stdin.readline().split())
        if uf.same(s, t):
            print("yes")
        else:
            print("no")


Measured memory_bytes: 11600
/*map,set,priority_queue,stack,queue*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define el "\n"
#define pb push_back
#define F first
#define S second
#define fo(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
typedef vector<int> vi;
const int inf = (1e18)+7;
const int neginf = -1*((int)1e18 ) + 7 ;
const int mod = (int)1e9 + 7;
//const int N = 500007;
/*int arr[N];
vector<int> adj[N];

void dfs(int x,int par)
{
    arr[x]+=par;
    arr[par] = 0;
    for(auto child:adj[x])
    {
        if(child==par)
            continue;
        dfs(child,x);
    }
}
*/

int32_t main() 
{
fastio
    int t=1;
    //cin>>t;
    while(t--)
    {
        int n,k;
        cin>>n>>k;
        int arr[n],frr[n];
        fo(i,n)
            cin>>arr[i];
        fo(i,n)
            cin>>frr[i];
        sort(arr,arr+n);
        sort(frr,frr+n);
        reverse(frr,frr+n);
        int low = 0,high=1e12,ans=1e12;
        while(low<=high)
        {
            int mid = low+ (high-low)/2;
            int sum = 0;
            fo(i,n)
            {
                sum+= max(0LL,(arr[i]-(mid/frr[i])));
            }
            if(sum<=k)
            {
                high = mid-1;
                ans = mid;
            }
            else
            {
                low = mid+1;
            }
        }
        cout<<ans<<el;
    }
    
    
    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n;
string s1, s2;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n;
    cin >> s1 >> s2;
    ll ans = 0LL;
    bool flagX = false;
    if (s1[0] == s2[0]) {
        ans = 3;
    } else {
        ans = 2;
    }
    for(int i = 0; i < n;) {
        if (s1[i] == s2[i]) {
            ans *= (flagX ? 2 : 1);
            ans %= MOD;
            flagX = true;
            i++;
        } else {
            ans *= (flagX ? 2 : 3);
            ans %= MOD;
            flagX = false;
            i+=2;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256