akhauriyash/Code-Regression huggingface dataset:
class BinaryIndexedTree:
    def __init__(self, size):
        size = 1 << (size-1).bit_length()
        self.data = [0] * (size+1)
        self.size = size
    
    def add(self, i, w):
        i += 1
        while i <= self.size:
            self.data[i] += w
            i += i & -i

    def sum(self, i):
        """
        [0,i)
        """
        result = 0
        while i > 0:
            result += self.data[i]
            i -= i & -i
        return result

    __getitem__ = sum

    def lower_bound(self, v):
        """
        return smallest i such that v < sum(data[:i])
        """

        s,pos = 0,0
        N = self.size
        k = N
        while k > 0:
            i = pos+k
            if i <= N:
                x = s+self.data[i]
                if x < v:
                    s = x
                    pos = i
            k >>= 1
        return pos


def naive(P):
    def it():
        for i in range(len(P)-1):
            for j in range(i+1,len(P)):
                yield sorted(P[i:j+1])[-2]
    return sum(it())

def solve(P):

    def it():
        bit = BinaryIndexedTree(len(P))
        for cnt, (v,i) in enumerate(sorted(((v,i) for i,v in enumerate(P)), reverse=True)):
            bit.add(i,1)
            c = bit.sum(i)
            
            low1 = -1 if c <= 0 else bit.lower_bound(c)
            low2 = -1 if c <= 1 else bit.lower_bound(c-1)
            up1 = len(P) if c > cnt-1 else bit.lower_bound(c+2)
            up2 = len(P) if c > cnt-2 else bit.lower_bound(c+3)
            yield v*((up1-i)*(low1-low2)+(i-low1)*(up2-up1))
    return sum(it())


if __name__ == '__main__':
    N = int(input())
    P = list(map(int,input().split()))
    print(solve(P))

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


const int VAL = 30000;

vector<int> countingSort(vector<int> &A, int k){
    vector<int> C(k+10,0), B(A.size()+10);
    rep(i,A.size()-1){
        ++C[A[i+1]];
    }
    rrep(i,k){
        C[i] += C[i-1];
    }
    for(int i = A.size()-1;i>=1;--i){
        B[C[A[i]]] = A[i];
        --C[A[i]];
    }
    return B;
}

int main(){
    int n;
    cin >> n;
    vector<int> A(n+1,0);
    rrep(i,n)cin >> A[i];
    vector<int> B = countingSort(A,VAL);
    rrep(i,n){
        if(i!=1)cout << " " << B[i];
        else cout << B[i];
    }
    
    cout << endl;
    return 0;
}


Measured memory_bytes: 18600
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e9;
const long long LINF = 1LL << 50;
#define int long long
bool G[10][10];
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m; cin >> n >> m;
	rep(i, m) {
		int a, b; cin >> a >> b; a--; b--;
		G[a][b] = G[b][a] = true;
	}
	VE ord(n);
	rep(i, n)ord[i] = i;
	int res = 0;
	do {
		if (ord[0] != 0)break;
		bool ok = true;
		for (int i = 0; i + 1 < n; i++) {
			int from = ord[i];
			int to = ord[i + 1];
			if (!G[from][to])ok = false;
		}
		if (ok)res++;
	} while (next_permutation(ALL(ord)));
	COUT(res);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s[3];
    rep(i,0,3) cin >> s[i];
    cout << "A" << s[1][0] << "C" << endl;

}


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int X = scan.nextInt()-1;
        int Y = scan.nextInt()-1;
        Graph G[] = new Graph[N];
        G[0] = new Graph(-1, 1);
        for(int i = 1; i < N-1; i++) {
            G[i] = new Graph(i-1, i+1);
        }
        G[N-1] = new Graph(N-2, -1);
        G[X].g[2] = Y;
        G[Y].g[2] = X;

        boolean[] counted = new boolean[20000000];
//        Set<Integer> counted = new HashSet<>(8000000*4/3+1);
        int ans[] = new int[N-1];
//        long countTimes = 0;
//        long visitTimes = 0;
//        long strTimes = 0;
//        int count = 0;
        for(int i = 0; i < N; i++) {
            int dist = 0;
            boolean[] visited = new boolean[2000];
//            Set<Integer> visited = new HashSet<>(2000*4/3+1);
            Set<Integer> q = new HashSet<>();
            for(int j = 0; j < 3; j++){
                if(G[i].g[j] != -1)
                    q.add(G[i].g[j]);
            }

            while(!q.isEmpty()) {
                Set<Integer> q2 = new HashSet<>();
                dist += 1;
                for (Integer next : q) {
//                    count++;
                    int small = Math.min(i, next);
                    int big = Math.max(i, next);
//                    long time = System.nanoTime();
                    Integer temp = small*10000+big;
//                    strTimes += System.nanoTime() - time;
                    if (small != big && !visited[next]) {
//                        time = System.nanoTime();
                        visited[next] = true;
//                        visitTimes += System.nanoTime() - time;
                        if(!counted[temp]) {
//                            time = System.nanoTime();
                            counted[temp] = true;
//                            countTimes += System.nanoTime() - time;
                            ans[dist - 1]++;
                        }
                        for(int j = 0; j < 3; j++){
                            if(G[next].g[j] != -1)
                                q2.add(G[next].g[j]);
                        }
                    }
                }
                q = q2;
            }
        }

//        System.out.println(count);
//        System.out.println(countTimes/1000000);
//        System.out.println(visitTimes/1000000);
//        System.out.println(strTimes/1000000);
        for(int i = 0; i < N-1; i++) {
            os.println(ans[i]);
        }

    }


    static class Graph {
        int g[] = new int[3];
        Graph(int prev, int next){
            g[0] = prev;
            g[1] = next;
            g[2] = -1;
        }
    }
}

Measured memory_bytes: 290368
#include<bits/stdc++.h>
using namespace std;
#define int long
#define popcount __builtin_popcount
signed main(){
  int h,w,k,res;
  cin>>h>>w>>k;
  res=h+w;
  vector<vector<bool>> ch(h,vector<bool>(w));
  for(int i=0;i<h;++i){
    string s;
    cin>>s;
    for(int j=0;j<w;++j)ch[i][j]=s[j]=='1';
  }
  for(int i=0;i<1<<(h-1);++i){
    vector<int> cnt(popcount(i)+1,0),rst(cnt);
    int cut=popcount(i);
    bool flw=false,first=true;
    for(int j=0;cut<res&&j<w;++j){
      int c=i,cl=0;
      for(int l=0;l<h;c>>=!!l++){
        if(l&&c&1)++cl;
        if(k<(cnt[cl]+=ch[l][j]))flw=true;
      }
      if(flw){
        if(first){
          cut=res;
          continue;
        }
        ++cut;
        cnt=rst;
        --j;
        first=true;
        flw=false;
      }
      else first=false;
    }
    if(cut<res)res=cut;
  }
  cout<<res;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,count=0;cin>>N;
  vector<int> a(N);
  for(int i=0;i<N;i++)cin>>a.at(i);
  for(int i=0;i<N-2;i++){
    if(a.at(i)>a.at(i+1) && a.at(i+1)>a.at(i+2))count++;
    else if(a.at(i)<a.at(i+1) && a.at(i+1)<a.at(i+2))count++;
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN,'%s',$S);
$Array=str_split($S);
$A=0;
$Z=0;
for ($i=0; $i <count($Array) ; $i++) {
  // code...
  if($Array[$i]=='A'){
    $A=$i;
    break;
  }
}
for ($i=0; $i <count($Array) ; $i++) {
  // code...
  if($Array[$i]=='Z'){
    $Z=$i;
  }
}
echo $Z-$A+1;
 ?>


Measured memory_bytes: 38700
using System;
using System.Linq;

namespace ABC146B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());

            Console.WriteLine(new string(Console.ReadLine().Select(x => (char)('A' + (N + x - 'A') % 26)).ToArray()));
        }
    }
}

Measured memory_bytes: 11328
import sys
t='X'
for e in sys.stdin:
 for i in'0123456789'[(e[0]==t and'+'!=e[1]) or('+X='not in e and'+X'in e )or(e[-1]==t and'=X'in e):]:
  l,r=e.replace(t,i).split('=')
  if sum(map(int,l.split('+')))==int(r):print(i);break
 else:print('NA')


Measured memory_bytes: 5620
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#define fi first
#define se second
#define pb(i) push_back(i)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define mes(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e6+10;
const int INF = 0x3f3f3f3f;
const int inf = - INF;
const int mod = 1e9+7;
const double pi = acos(-1.0);


int main(){
    std::ios::sync_with_stdio(false);
    ll a,b,x;
    cin>>a>>b>>x;
    ll ra,rb;
    ra=(a==0)?0:(a-1)/x;
    rb=(b==0)?0:b/x;
    if(a==0) rb++;
    ll res=rb-ra;
    cout<<res<<endl;
    return 0;
} 

Measured memory_bytes: 256
import numpy as np
N = int(input())
A_list =[0]*N
B_list =[0]*N
for i in range(N):
    A_list[i],B_list[i] = map(int,input().split())
x = np.argsort(B_list)
A_list = np.array(A_list)[x]
B_list = np.array(B_list)[x]
ans = 0
for i,j in zip(A_list,B_list):
    ans +=i
    if(ans<=j):
        pass
    else:
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 45812
#include <bits/stdc++.h>
#define R register
#define mp make_pair
#define ll long long
#define pii pair<int, int>
using namespace std;

int n, m, x;

template <class T>
inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
    while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}

int main() {
    read(n), read(m), read(x);
    printf("%d\n", (x - 1) / max(n, m) + 1);
    return 0;
}

Measured memory_bytes: 256
from collections import deque

def main():
    H,W = list(map(int,input().split()))
    A = [["#"]*(W+2)]
    for i in range(H):
        A.append(list("#"+input()+"#"))
    A.append(["#"]*(W+2))

    queue = deque()
    for i in range(1,H+1):
        for j in range(1,W+1):
            if A[i][j] == "#":
                queue.append((i,j,0))

    ans = 0
    while queue:
        point = queue.popleft()
        ans = max(ans,point[2])
        for y,x in ((1,0),(0,1),(-1,0),(0,-1)):
            if A[point[0]+y][point[1]+x] == ".":
                A[point[0]+y][point[1]+x] = "#"
                queue.append((point[0]+y,point[1]+x,point[2]+1))
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 161372
#![allow(
  non_snake_case,
  unused_variables,
  unused_assignments,
  unused_mut,
  unused_imports,
  dead_code,
  unused_macros
)]
//use proconio::fastout;
use proconio::input;
use proconio::marker::*;
//use std::collections::HashSet;
use petgraph::unionfind::UnionFind;
use std::cmp::*;
use std::collections::*;
macro_rules! debug {
  ($($a:expr),* $(,)*) => {
      #[cfg(debug_assertions)]
      eprintln!(concat!($("| ", stringify!($a), "={:?} "),*, "|"), $(&$a),*);
  };
}
fn main() {
  input! {
     N:usize,
     M:usize,
     AB:[(Usize1, Usize1);M]
  }

  let mut t: UnionFind<usize> = UnionFind::new(N);
  for &(a, b) in AB.iter() {
    t.union(a, b);
  }
  let mut tops = vec![0; N];
  for i in 0..N {
    tops[t.find(i)] += 1;
  }
  let mut ans = 0;
  for i in 0..N {
    ans = max(ans, tops[i]);
  }
  println!("{}", ans);
}


Measured memory_bytes: 10048
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
#include <string>
#define pb push_back
#define mod 1000000007
using namespace std;
typedef long long int ll;
bool ok[222222];
int main(void){
  ll n,m;
  cin>>n>>m;
  ll a,b;
  vector<pair<int,int> >v;
  for(int i=0;i<m;i++){
    cin>>a>>b;
    if(a==1) ok[b]=true;
    v.pb(pair<int,int>(a,b));
  }
  for(int i=0;i<m;i++){
    if(v[i].second!=n) continue;
    if(ok[v[i].first]){
      cout<<"POSSIBLE"<<endl;
      return 0;
    }
  }
  cout<<"IMPOSSIBLE"<<endl;
  return 0;
}


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

int main(void){
    string s;
    cin >> s;
    int ans=0;
    for (size_t i = 0; i < s.size(); i++)
    {
        if(s[i]=='1')ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

// 1-indexed
template<typename T>
struct BIT{
    int n;
    vector<T> bit;
    BIT(int n_=0):n(n_),bit(n+1){}
    T sum(int i){
        T res=0;
        for(;i>0;i-=(i&-i))res+=bit[i];
        return res;
    }
    void add(int i,T a){
        if(i==0)return;
        for(;i<=n;i+=(i&-i)){bit[i]+=a;}
    }
    int lower_bound(T k){ // k<=sum(res)
        if(k<=0)return 0;
        int res=0,i=1;
        while((i<<1)<=n)i<<=1;
        for(;i;i>>=1){
            if(res+i<=n&&bit[res+i]<k)k-=bit[res+=i];
        }
        return res+1;
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    vector<int> y=a;
    sort(y.begin(), y.end());
    int l=0,r=n;
    ll m=n*(n+1)/2;
    while(r-l>1){
        BIT<int> bit(2*n+1);
        int mid=(l+r)/2;
        int x=y[mid];
        vector<int> b(n,1);
        for(int i=0;i<n;i++){
            if(a[i]<x){
                b[i]=-1;
            }
        }
        vector<int> sum(n+1);
        for(int i=0;i<n;i++){
            sum[i+1]=sum[i]+b[i];
        }
        for(int i=0;i<=n;i++){
            sum[i]+=n+1;
        }
        ll res=0;
        for(int i=0;i<=n;i++){
            res+=bit.sum(sum[i]);
            bit.add(sum[i],1);
        }
        if(res>=(m+1)/2){
            l=mid;
        }
        else{
            r=mid;
        }
    }
    printf("%d\n",y[l]);
}

/*

二分探索 x以上のものが, M=n*(n+1)/2 として (M+1)/2個以上含まれれば左端に　最終的なlが答え
x以上→ b[i]=(x<=a[i]?1:-1) として　区間和が0以上となるものが中央値x以上の区間


*/



Measured memory_bytes: 5564
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int n = ir.nextInt();
		int m = ir.nextInt();
		out.println((1900 * m + 100 * (n - m)) * (1 << m));
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}


Measured memory_bytes: 21076
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <iostream>
#include <string>

#include <algorithm>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define PB push_back
#define MP make_pair

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

#define ALL(v) (v).begin(),(v).end()

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VPII;

const int MOD = 1000000007;
const int INF = 1e9;

const double EPS = 1e-9;
const double PI = acos(-1.0);

const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }

int main() {
    string S;
    cin >> S;
    if (S.size() % 2 == 1) {
        cout << "No" << endl;
        return 0;
    }
    REP (i, S.size() / 2) {
        if (S[2 * i] == 'h' && S[2 * i + 1] == 'i') {
            continue;
        }
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){

    long double a, b, c;
    cin >> a >> b >> c;
//    if(sqrt(a) + sqrt(b) - sqrt(c) < 0) {
    if(a+b+2*sqrt(a*b) < c) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    
//    cout << a+b+2*sqrt(a*b) << endl;
//    cout << c << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

ll r,D,x;
int main(){
    cin >> r >> D >> x;
    rep1(i,10) x = r*x - D, cout << x << '\n';
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 1
check = 10 ** 18

for i in range(N):
    num = A[i]
    ans *= num
    if ans > check:
        ans = -1
        break
    elif ans == 0:
        break

print(ans)

Measured memory_bytes: 21660
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

int M, D, ans = 0;

int main(){
	getint(M), getint(D);
	for(register int m = 1; m <= M; m++)
		for(register int d = 1; d <= D; d++){
			const int d1 = d % 10, d10 = d / 10;
			if(d1 >= 2 && d10 >= 2 && d1 * d10 == m) ans++;
		}
	return printf("%d\n", ans), 0;
}

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

int main(){
	int a, n, i, j, z, s[10000], ans;
	while(scanf("%d", &n) != 0){
		if(n == 0) break;
		if(n == 0){
			printf("1\n");
			continue;
		}
		ans = 0;
		s[0] = 2;
		a = 1;
		for(i = 3; i <= 104729; i += 2){
			z = 0;
			for(j = 0; s[j] * s[j] <= i; j++){
				if(i % s[j] == 0){
					z = 1;
					break;
				}
			}
			if(z == 0){
				s[a] = i;
				a++;
				if(a == n) break;
			}
		}
		for(i = 0; i < a; i++) ans += s[i];
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 636
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cstring>
#include <cstdlib>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 15
#define mp make_pair
#define pb push_back
#define ll long long
#define uint unsigned int
#define pii pair<int, int>
#define ull unsigned long long
#define sz(v) ((int)(v).size())
#define gc() fgetc(stdin)
template<typename T> void read(T &a) {
	register int b = 1, c; a = 0;
	for (c=gc(); c > 57 || c < 48; c=gc()) if (c == 45) b = -1;
	for (; c >= 48 && c <= 57; c=gc()) a = a * 10 + c - 48;
	a *= b;
}
#ifdef DEBUG
struct Timer {
	int Stime;
	Timer() { Stime = clock(); }
	~Timer() {
		printf("\nTimer Report : Current Running Time = %dms\n", clock() - Stime);
		system("pause");
	}
}Timer0;
#endif

int n, m, r[N];
string s[N], ss[N], t[N];

void check() {
	for (int i = 0; i < n; i++) if (t[i] == "") return;
	map<string, int> M;
	for (int i = 0; i < m; i++) {
		string str;
		for (int j = 0; j < n; j++) {
			str += t[j][i];
		}
		M[str]++;
	}
	bool f = m & 1;
	for (map<string, int>::iterator it = M.begin(); it != M.end(); it++) {
		string str = it->first;
		string str1 = str;
		reverse(str1.begin(), str1.end());
		if (it->second != M[str1]) return;
		if (str == str1) {
			if (!f && it->second & 1) return;
			if (it->second & 1) f = 0;
		}
	}
	printf("YES\n");
	exit(0);
}

void solve(int row, int rownum, bool f) {
//	printf("solve %d %d %d\n", row, rownum, f);
	if (row == n && rownum == n) { check(); return; }
	if (t[rownum] != "") { solve(row, rownum + 1, f); return; }
	if (r[row]) { solve(row + 1, rownum, f); return; }
	r[row] = 1;
	for (int i = row + 1; i < n; i++) {
		if (ss[i] != ss[row] || r[i]) continue;
		r[i] = 1;
		t[rownum] = s[row];
		t[n - 1 - rownum] = s[i];
		solve(row + 1, rownum + 1, f);
		t[n - 1 - rownum] = "";
		t[rownum] = "";
		r[i] = 0;
	}
	if (f) {
		t[n / 2] = s[row];
		solve(row + 1, rownum, 0);
		t[n / 2] = "";
	}
	r[row] = 0;
}

int main() {
	read(n); read(m);
	for (int i = 0; i < n; i++) cin >> s[i];
	for (int i = 0; i < n; i++) {
		ss[i] = s[i];
		sort(ss[i].begin(), ss[i].end());
	}
	solve(0, 0, n & 1);
	printf("NO\n");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

#define rep(i,n) for(ll i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;
//	std::cout<<std::fixed<<std::setprecision(10);

int main() {
	ll N, M;
	cin >> N >> M;
	priority_queue<double> A;
	double tmp;
	rep(i, N) {
		cin >> tmp;
		A.push(tmp);
	}

	rep(i, M) {
		tmp = A.top();
		A.pop();
		tmp = tmp/2.0;
		A.push(tmp);
	}

	ll sum = 0;
	rep(i, N) {
		sum += (ll)(A.top());
		A.pop();
	}

	cout << sum << endl;

	return 0;
}

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

using namespace std;

const long long MOD = 1e9+7;
long long pows[64];
long long ones[64];

int main() {
    ios_base::sync_with_stdio(false);
    cout.precision(15);
    cout << fixed;
    cin.tie(0);

    for (int i = 0; i < 64; i++) {
        pows[i] = (1LL<<i) % MOD;
    }

    long long ans = 0;

    int n;
    cin >> n;
    vector<long long > v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
        for (int bit = 0; bit < 62; bit++) {
            if ((v[i]>>bit)&1) {
                ones[bit]++;
            }
        }
    }

    for (int i = 0; i < n-1; i++) {
        int rest = n - 1 - i;
        for (int bit = 0; bit < 62; bit++) {
            if ((v[i]>>bit)&1) {
                ones[bit]--;
                ans += pows[bit] * (rest - ones[bit]);
            } else {
                ans += pows[bit] * ones[bit];
            }
            ans %= MOD;
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
#define M 200005
#define ll long long
using namespace std;
const int mod=1e9+7;
int n,col[M],num[M];
ll dp[M],sum[M];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&col[i]);
	int len=0;
	for(int i=1;i<=n;++i)
		if (col[i]!=col[i-1]) num[++len]=col[i];
	for(int i=1;i<=len;++i){
		dp[i]=sum[num[i]];
		sum[num[i]]=(sum[num[i]]+dp[i-1]+1)%mod;
		dp[i]=(dp[i]+dp[i-1])%mod;
	}
	printf("%lld\n",(dp[len]+1)%mod);
}

Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    vl a(n);
    rep(i, n) {
        cin >> a[i];
    }

    vl rui(n+1);  // rui[i+1] : a[0]からa[i]までの累積和
    rep(i, n) {
        rui[i+1] = rui[i] + a[i];
    }

    vvl dp(n+1, vl(n+1));  // dp[l][r] : 区間[l,r)のスライムたちを1匹に合成するのに必要なコストの最小値
    exrep(len, 2, n) {  // 区間の長さが1のときはdp[l][r]=0なので区間の長さが2以上のときを考える 
        for(ll l = 0; l + len <= n; l++) {
            ll r = l + len;

            /* 区間[l,r)のスライムたちを1匹に合成する手順は以下。
               まず区間[l,x)と区間[x,r)に分ける。
               次にコストdp[l][x]で[l,x)のスライムたちを1匹のスライムAに合成する。
               同様にコストdp[x][r]で[x,r)のスライムたちも1匹のスライムBに合成する。
               スライムAとスライムBの大きさの合計は区間[l,r)のスライムたちの重さの合計に等しい。
               よって、最初に位置x (l < x < r) で区間[l,r)を分けたときの最小コストは dp[l][x] + dp[x][r] + (sum_{l <= i < r} a[i]) となる。
               あとは位置xを全て試して、(sum_{l <= i < r} a[i]) は rui[r] - rui[l] と累積和で高速に求めればよい。 */

            ll u = INF;  // dp[l][x] + dp[x][r] の最小値
            exrep(x, l+1, r-1) {  
                chmin(u, dp[l][x] + dp[x][r]);
            }
            
            dp[l][r] = u + rui[r] - rui[l];
        }
    }
    
    out(dp[0][n]);
    re0;
}

Measured memory_bytes: 1536
import std.stdio;
import std.string;
import std.format;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.concurrency;
import std.traits;
import std.uni;
import std.regex;
import core.bitop : popcnt;
alias Generator = std.concurrency.Generator;

enum long INF = long.max/5;

void main() {
  long N, K;
  scanln(N, K);
  writeln(min(N%K, K-N%K));
}

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


void times(alias fun)(long n) {
  // n.iota.each!(i => fun());
  foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(long n) {
  // return n.iota.map!(i => fun()).array;
  T[] res = new T[n];
  foreach(ref e; res) e = fun();
  return res;
}

T ceil(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  // `(x+y-1)/y` will only work for positive numbers ...
  T t = x / y;
  if (y > 0 && t * y < x) t++;
  if (y < 0 && t * y > x) t++;
  return t;
}

T floor(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  T t = x / y;
  if (y > 0 && t * y > x) t--;
  if (y < 0 && t * y < x) t--;
  return t;
}

ref T ch(alias fun, T, S...)(ref T lhs, S rhs) {
  return lhs = fun(lhs, rhs);
}
unittest {
  long x = 1000;
  x.ch!min(2000);
  assert(x == 1000);
  x.ch!min(3, 2, 1);
  assert(x == 1);
  x.ch!max(100).ch!min(1000); // clamp
  assert(x == 100);
  x.ch!max(0).ch!min(10); // clamp
  assert(x == 10);
}

mixin template Constructor() {
  import std.traits : FieldNameTuple;
  this(Args...)(Args args) {
    // static foreach(i, v; args) {
    foreach(i, v; args) {
      mixin("this." ~ FieldNameTuple!(typeof(this))[i]) = v;
    }
  }
}

void scanln(Args...)(auto ref Args args) {
  enum sep = " ";
  enum n = Args.length;
  enum fmt = n.rep!(()=>"%s").join(sep);

  string line = readln.chomp;
  static if (__VERSION__ >= 2074) {
    line.formattedRead!fmt(args);
  } else {
    enum argsTemp = n.iota.map!(
      i => "&args[%d]".format(i)
    ).join(", ");
    mixin(
      "line.formattedRead(fmt, " ~ argsTemp ~ ");"
    );
  }
}

// fold was added in D 2.071.0
static if (__VERSION__ < 2071) {
  template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
      static if (S.length < 2) {
        return reduce!fun(seed, r);
      } else {
        return reduce!fun(tuple(seed), r);
      }
    }
  }
}

// popcnt with ulongs was added in D 2.071.0
static if (__VERSION__ < 2071) {
  ulong popcnt(ulong x) {
    x = (x & 0x5555555555555555L) + (x>> 1 & 0x5555555555555555L);
    x = (x & 0x3333333333333333L) + (x>> 2 & 0x3333333333333333L);
    x = (x & 0x0f0f0f0f0f0f0f0fL) + (x>> 4 & 0x0f0f0f0f0f0f0f0fL);
    x = (x & 0x00ff00ff00ff00ffL) + (x>> 8 & 0x00ff00ff00ff00ffL);
    x = (x & 0x0000ffff0000ffffL) + (x>>16 & 0x0000ffff0000ffffL);
    x = (x & 0x00000000ffffffffL) + (x>>32 & 0x00000000ffffffffL);
    return x;
  }
}


Measured memory_bytes: 256
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
B = np.array([list(sr()) for _ in range(H)])
A = [[1 if x == '#' else 0 for x in b] for b in B]
row = np.sum(A, axis=1)
column = np.sum(A, axis=0)
r = row != 0
c = column != 0
answer = B[r]
answer = answer[:, c].tolist()
for a in answer:
    print(''.join(a))


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

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var str = IO.GetIntList();
            var ans = Enumerable.Range(str[1] - str[0] + 1, str[0]*2-1);
            IO.WriteStrings(ans);
           // Console.WriteLine(ans);
        }
    }


    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef vector<int> vi;
const int MX = 2e5 + 5;
#define f(i, x, n) for (int i = x; i < n; i++)
#define int long long
#define w(t) int t;cin>>t;while(t--)
#define pb push_back
#define endl "\n"
#define yes cout << "YES" << endl
#define no cout << "NO" << endl

int32_t main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    // online submission
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    string a,b;
    cin>>a>>b;
    reverse(a.begin(),a.end());
    if(a==b)
    {
        yes;
    }
    else
    {
        no;
    }
    

    return 0;
}


Measured memory_bytes: 3608
#include<stdio.h>
#include<stdlib.h>
int solve(int,int,int *,int);
int main(){
  int i,j,n1,n2,*A,m;
  scanf("%d",&n1);
  A = (int *)malloc(n1 * sizeof(int));
  for(i=0;i<n1;i++) scanf("%d",&A[i]);
  scanf("%d",&n2);
  for(i=0;i<n2;i++){
    scanf("%d",&m);
    if(solve(0,m,A,n1)) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int solve(int i,int m,int *A,int n){
  int res;
  if(m==0) return 1;
  if(i>=n) return 0;
  res = solve(i+1,m,A,n) || solve(i+1,m-A[i],A,n);
  return res;
}



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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> xs(m);
    for (auto& x : xs) {
        cin >> x;
    }
    sort(xs.begin(), xs.end());
    vector<int> ds(m-1);
    for (int i = 0; i + 1 < m; ++i) {
        ds[i] = xs[i + 1] - xs[i];
    }
    sort(ds.begin(), ds.end());
    int answer = 0;
    for (int i = 0; i < m-n; ++i) {
        answer += ds[i];
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int w, n;
    cin >> w >> n;
    VI a(w);
    REP(i,w) a[i] = i+1;
    while (n--){
        int x, y;
        scanf("%d,%d", &x, &y);
        swap(a[x-1], a[y-1]);
    }
    REP(i,w) cout << a[i] << endl;

    return 0;
}

Measured memory_bytes: 3224
#include<bits/stdc++.h>
using namespace std;
#define rp(i,j) for(long long i=0;i<j;i++)
#define rep(i,j,k) for(long long i=j;i<k;i++)
#define mod 1000000007
#define NIL -1
typedef long long ll;
vector<int>c[101];
int a[101][101]={0};
int main(){
    int n,u,k,v;cin>>n;
    rp(i,n){
        cin>>u>>k;
        rp(j,k){
            cin>>v;
            c[u].push_back(v);
        }
    }
    rep(i,1,n+1){
        for(auto j:c[i]){
            a[i][j]=1;
        }
    }
    rep(i,1,n+1){
        rep(j,1,n+1){
            if(j!=1)cout<<" ";
            cout<<a[i][j];
        }
        cout<<endl;
    }
}


Measured memory_bytes: 3172
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define PI          3.14159265358979323846
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ld          long double
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;
const ll M = 1e9 + 7;
ll mul(ll a, ll b){
    return ((a % M) * (b % M)) % M;
}
ll sub(ll a, ll b){
    return ((a % M) - (b % M) + M) % M;
}
void tc(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    map<char, ll> mp;
    for(auto x : s){
        mp[x]++;
    }
    ll ans = 1;
    for(auto x : mp){
        ans = mul(ans, x.S + 1);
    }
    ans = sub(ans, 1LL);
    cout << ans;
}
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int t = 1;
    // cin >> t;
    while(t--) tc();
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<set>
#include<functional>
#include<iomanip>

#define LLI long long int

using namespace std;

int main(){
	int N;cin>>N;
	vector<int>H(N);
	for(int i=0;i<N;i++)cin>>H[i];
	int ans=0,tmp=0;
	for(int i=1;i<N;i++){
		if(H[i-1]>=H[i]){
			tmp++;
			ans=max(ans,tmp);
		}else{
			tmp=0;
		}
	}
	cout<<ans<<endl;
	return 0;
}



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

#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair

using namespace std;

typedef long long ll;

const ll inf = (ll)1e18 + 7;
const int N = (int)2e6 + 7;

ll n,a;
ll mn = inf;

ll bpow (ll x,ll o) {
        ll res = 1;
        for (int i = 1; i <= o; i ++) {
                res = res * 1ll * x;
        }
        return res;
}
bool check (ll x,int o) {
        ll res = 1;
        for (int i = 1; i <= o + 1; i ++) {
                res *= x;
                if (res >= n)
                        return true;
        }
        return false;
}
 main () {
        cin >> n >> a;

        mn = n;

        for (int i = 0; i <= 40; i ++) {
                ll l = 1,r = 1e6 + 1;

                while (r - l > 1) {
                        ll m = (r + l) >> 1;

                        if (check(m,i))
                                r = m;
                        else
                                l = m;
                }
                for (int j = 1; j <= i + 1; j ++) {
                        if (bpow(r,j) * 1ll * bpow(r - 1,(i + 1 - j)) >= n) {
                                mn = min(mn,i * 1ll * a + j * 1ll * r + (r - 1) * 1ll * (i + 1 - j));
                                break;
                        }
                }
        }
        cout << mn << endl;
}


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

int main(){
	int N, y, x, sum=0;
	cin >> N;
	x =N;
	while(x>0){
		y = x%10;
		sum += y;
		x = x/10;
	}
	if ( N%sum == 0 ){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}

}


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

int main()
{
	int n, i, *a , max  , min ,t;

	scanf("%d", &n);

	a = (int *)malloc(n * sizeof(int));

	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);

	max = a[0];
	min = a[0];
	for (i = 1; i < n; i++) {
		if (max < a[i]) {
			t = max;
			max = a[i];
			a[i] = t;
		}
		if (min > a[i]) {
			t = min;
			min = a[i];
			a[i] = t;
		}
	}

	printf("%d\n", max - min);


}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int m, d;
	int count;
	char week[7][16] = {"Thursday", "Friday", "Saturday",
	"Sunday", "Monday", "Tuesday", "Wednesday"};
	
	while (scanf("%d %d", &m, &d)*m){
		count = d;
		while (--m > 0){
			switch (m){
				case 3: case 5: case 7:
				case 8: case 10: case 12:
					count += 31;
					break;
				case 1:
				case 4: case 6: case 9: case 11:
					count += 30;
					break;
				case 2:
					count += 29;
					break;
			}
		}
		puts(week[count % 7]);
	}
	return 0;
}

Measured memory_bytes: 584
def conv(num,b):
    convStr = "0123456789abcdefghijklmnopqrstuvwxyz"
    if num<b:
        return convStr[num]
    else:
        return conv(num//b,b) + convStr[num%b]

first_line = input().split(" ")

print(len(conv(int(first_line[0]), int(first_line[1]))))

Measured memory_bytes: 38384
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1

bool lesser(const string& l, const string& r) {
  return l.size() != r.size() ? l.size() < r.size() : l < r;
}

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  array<int, 10> ns = { INT32_MAX, 2,5,5,4,5,6,3,7,6 };

  //cout << (lesser("abca","def"));

  int N, M;
  cin >> N >> M;
  vector<int> as(M);
  F0R(i, M) {
    cin >> as[i];
  }

  vector<string> dp(N + 1, "0");
  dp[0] = "";

  F0R(i, N) {
    if (dp[i] == "0") continue;

    F0R(j, M) {
      int n = i + ns[as[j]];
      if (n > N) continue;
      string s = dp[i];
      s.push_back('0' + as[j]);
      if (lesser(dp[n], s)) {
        dp[n] = s;
      }
    }
  }
  cout << dp.back();
}
#endif


Measured memory_bytes: 54456
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++){cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++){for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>vector<vector<T>>vec(ll x, ll y, T w){vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<typename T1, typename T2>ostream &operator<<(ostream &os, const pair<T1, T2>&p){return os << p.first << " " << p.second;}
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v){for(auto &z:v)os << z << " ";cout<<"|"; return os;}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll k;cin>>k;
  string s;
  rep(i,0,k)s+="ACL";
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 3616