akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main()
    {
        Scanner cin = new Scanner();
        long X = cin.Long();

        long sum = 0, cnt = 1;
        while(sum < X)
        {
            sum += cnt;
            cnt++;
        }

        Console.WriteLine(cnt - 1);
        Console.ReadLine();
    }

}

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

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

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

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

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

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

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

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


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


Measured memory_bytes: 11092
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(IN())
mod=1000000007

#+++++

def main():
	#a = int(input())
	#b , c = tin()
	s = input()
	ret=0
	for i in range(len(s)):
		for j in range(i, len(s)):
			#print(i,len(s)-j-1,s[i:j+1])
			v = int(s[i:j+1])
			if i >= 1:
				na =2 ** (i-1)
			else:
				na=1
			
			if len(s)-j-1 >= 1:
				nb= 2**(len(s)-j-2)
			else:
				nb=1
			ret += v*na*nb
			#print(na,nb)
	print(ret)
			
		
		
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 38384
#![allow(non_snake_case,unused_imports)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;

struct SegmentTree<N>{
    n: usize,
    T: Vec<N>,
    func: fn(N,N) -> N,
    identity: N,
}

impl<N:Copy> SegmentTree<N> {
    fn new(n:usize,func:fn(N,N) -> N,identity:N) -> SegmentTree<N>{
        let mut T = SegmentTree { n:n,T:Vec::new(),func:func,identity:identity};
        T.init();
        T
    }
    fn init(&mut self){
        self.n = 1<<format!("{:b}",self.n-1).len();
        self.T = (0..(2*self.n-1)).map(|_| self.identity).collect();
    }
    fn set(&mut self,index:usize,value:N){
        let i = index + self.n - 1;
        self.T[i] = value;
        self._update_parent((i-1)/2);
    }
    fn _update_parent(&mut self,i:usize){
        self.T[i] = (self.func)(self.T[i*2+1],self.T[i*2+2]);
        if i>0 { self._update_parent((i-1)/2)}
    }
    fn get(&self,l:usize,r:usize) -> N{
    self._get(l,r,0,0,self.n)
    }
    fn _get(&self,l:usize,r:usize,i:usize,a:usize,b:usize) -> N{
        if l<=a && b<=r {
            self.T[i]
        } else if b<=l || r<=a {
            self.identity
        } else{
            (self.func)(self._get(l,r,2*i+1,a,(a+b)/2),
                        self._get(l,r,2*i+2,(a+b)/2,b))
        }
    }
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let N = iter.next().unwrap().parse::<usize>().unwrap();
    let M = iter.next().unwrap().parse::<usize>().unwrap();
    
    let mut LRC = (0..M).map(|_| (
        iter.next().unwrap().parse::<usize>().unwrap(),
        iter.next().unwrap().parse::<usize>().unwrap(),
        iter.next().unwrap().parse::<i64>().unwrap()
    )).collect::<Vec<_>>();

    LRC.sort();
    let INF = 1e16 as i64;

    let mut d = SegmentTree::new(N+1,min,INF);
    d.set(1,0);

    for &(l,r,c) in &LRC{
        let mut tmp = d.get(r,r+1);
        tmp = min(tmp,c+d.get(l,r+1));
        d.set(r,tmp);
    }
    let mut ans = d.get(N,N+1);
    if ans == INF {ans = -1;}
    println!("{}",ans);


}

Measured memory_bytes: 14328
n,m,l = gets.split(" ").map(&:to_i)
a = []
b = []
c = Array.new(n).map{Array.new(l,0)}
n.times do
  a<<gets.split(" ").map(&:to_i)
end
m.times do
  b<<gets.split(" ").map(&:to_i)
end
bt = b.transpose
n.times do |i|
  c = []
  l.times do |j|
    c<<[a[i],bt[j]].transpose.map{|t| t.inject(:*)}.inject(:+)
  end
  puts c.join(" ")
end

Measured memory_bytes: 9136
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in).useDelimiter("[,\n]");
		while(sc.hasNext())
		{
			int n = sc.nextInt();
			double w = sc.nextDouble();
			double h = sc.nextDouble();
			if (25.0 <= w / (h * h))
			{
				System.out.println(n);
			}
		}
	}
}

Measured memory_bytes: 12000
s = input()
ans = 0

for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        count = 0
        j = i
        while s[j] == "A" or s[j] == "C" or s[j] == "G" or s[j] == "T":
            j = j + 1
            count = count + 1
            if j == len(s):
                break

        ans = max(ans, count)

print(ans)

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

int main() {
  int n,k,x,tot;
  cin >> n;
  cin >> k;
  tot=0;
  for(int i = 0; i < n; i++){
     cin >> x;
    if(x>=k-x){
      tot+=(k-x)*2;
    }
    else{
      tot+=x*2;
    }
  }
  cout<<tot;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n, c;
  cin >> n >> c;
  vector<vector<int>> d(c, vector<int>(c));
  rep(i, c){
    rep(j, c){
      cin >> d.at(i).at(j);
    }
  }
  vector<vector<int>> vc(n, vector<int>(n));
  rep(i, n)rep(j, n){
    cin >> vc.at(i).at(j);
    vc.at(i).at(j)--;
  }

  vector<map<int, int>> mpv(3);
  rep(i, n){
    rep(j, n){
      mpv.at((i+j) % 3)[vc.at(i).at(j)]++;
    }
  }
  ll ans = 1e18;
  rep(i, c)rep(j, c)rep(k, c){
    if(i == j || j == k || i == k) continue;
    ll add = 0;
    for(auto p : mpv.at(0)){
      add += (ll)p.second * d.at(p.first).at(i);
    }
    for(auto p : mpv.at(1)){
      add += (ll)p.second * d.at(p.first).at(j);
    }
    for(auto p : mpv.at(2)){
      add += (ll)p.second * d.at(p.first).at(k);
    }
    // cerr << add << endl;
    ans = min(ans, add);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4636
fn main() {
    let mut sc = Scanner::new();
    let n = sc.read::<f64>();
    let m = sc.read::<f64>();
    let d = sc.read::<f64>();
    if d == 0.0 {
        println!("{}", (m - 1.0) / n);
    } else if n < d {
        println!("0");
    } else {
        println!("{}", (n - d) / n / n * (m - 1.0) * 2.0);
    }
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read_vec<T>(&mut self, n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        (0..n).map(|_| self.read()).collect()
    }

    fn usize_read(&mut self) -> usize {
        self.read()
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


Measured memory_bytes: 4352
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <list>
#include <numeric>
using namespace std;


long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}


int main(){    
   long long N,M,sum=0;
  cin >> N >> M;
  if(N==1 && M==1){
    cout << "0" << endl;
    return 0;
  }
  if(N>1){
    sum += combi(N,2);
  }
  if(M>1){
    sum += combi(M,2);
  }
  cout << sum << endl; 
}


Measured memory_bytes: 256
n = int(input())
for a in range(1,3501):
    for b in range(1,3501):
        if 4*a*b-n*a-n*b == 0:
            continue
        if 1 <= n*a*b//(4*a*b-n*(a+b)) <= 3500 and (n*a*b)%(4*a*b-n*a-n*b) == 0:
            print(a,b,n*a*b//(4*a*b-n*(a+b)))
            exit()


Measured memory_bytes: 40924
s = input()
ans = [0] * len(s)
cnt = 1
prev = -1
for i in range(1,len(s)+1):
    if i == len(s) or s[i] != s[i-1]:
        if s[i-1] == 'L':
            ans[prev-1] += cnt // 2
            ans[prev] += (cnt+1) // 2
        else:
            ans[i] += cnt // 2
            ans[i-1] += (cnt+1) // 2
        prev = i
        cnt = 1
    else:
        cnt += 1
        
print(" ".join(map(str,ans)))

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

int main() {
long N,A,K=0;
  cin>>N;
  	for(int i=0;i<N;i++){
      cin>>K;
      A+=K;
    }
  if(A%2==0){
    cout<<"YES"<<endl;
  }
    else{
      cout<<"NO"<<endl;
    }
}

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

int main (){
	ios_base::sync_with_stdio(false);
	int n;
	string s;cin>>n>>s;
	int cnt=0;
	for(int i=1;i<n;i++) {
		int a[26]={0},b[26]={0},ans=0;
		for(int j=0;j<i;j++){
			for(int k=0;k<26;k++){
				if(s[j]-'a'==k) a[k]=1;
			}
		}
		for(int j=i;j<n;j++){
			for(int k=0;k<26;k++){
				if(s[j]-'a'==k) b[k]=1;
			}
		}
		for(int k=0;k<26;k++) if(a[k]==1&&b[k]==1) ans++,cnt=max(ans,cnt);
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int n,m,c,i,j,a[20],b[20],x,cnt;
	cnt=0;
	cin>>n>>m>>c;
	for(i=0;i<m;i++) {
		cin>>b[i];
	}
	for(i=0;i<n;i++){
		x=0;
		for(j=0;j<m;j++){
			cin>>a[j];
			x=x+a[j]*b[j];
		}
		x=x+c;
	//	cout<<x<<endl;
		if(x>0){
			cnt=cnt+1;
		}
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <thread>
#include <bitset>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

static int64_t kRem = 1000000007;

bitset<31624> primes;

void create_primes(int n) {
	primes.flip();

	int u_b = sqrt(n + 1);
	{
		for (int j = 4; j < u_b; j += 2) {
			primes.reset(j);
		}
	}
	for (int i = 3; i < u_b; i += 2) {
		if (!primes.test(i)) continue;

		for (int j = i * 2; j < u_b; j += i) {
			primes.reset(j);
		}
	}
}

struct FactorInfo {
	int v;
	int c;
};

vector<FactorInfo> make_factors(int n, int l)
{
	int v = n;
	vector<FactorInfo> ans;
	FOR_LE(i, 2, l) {
		if (!primes.test(i)) continue;

		int count = 0;
		while (v % i == 0) {
			v /= i;
			count++;
		}

		if (count != 0) {
			ans.push_back({ i, count });
		}
	}


	if (v != 1) {
		ans.push_back({ v , 1 });
	}

	return ans;
}


int64_t pow_rem(int64_t val, int64_t mul, int64_t rem)
{
	if (mul == 1) return val;

	int64_t ret = pow_rem(val, mul / 2, rem);
	ret *= ret;
	ret %= rem;

	if (mul & 1) {
		ret *= val;
		ret %= rem;
	}

	return ret;
}

int64_t pow_remdiv(int64_t val, int64_t rem)
{
	return pow_rem(val, rem - 2, rem);
}

uint64_t nCr(uint64_t n, uint64_t r) {
	if (n == 0) return 0;
	if (r > n) return 0;

	uint64_t ret = 1;
	for (uint64_t i = 0; i < r; i++) {
		ret = ret * (n - i);
		ret %= kRem;
		ret = ret * pow_remdiv(i + 1, kRem);
		ret %= kRem;
	}
	return ret;
}

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

	create_primes(m);
	vector<FactorInfo> factors = make_factors(m, sqrt(m + 1));

	int64_t ans = 1;
	for (auto& factor : factors) {
		ans *= nCr(n + factor.c - 1, factor.c);
		ans %= kRem;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include <iomanip>
#include<stdio.h>
using namespace std;
int main(){
   int a[1001];
   int n;
   double sum=0,ave=0;
   cout << setprecision(12);
   while(1){
      sum = 0;
      ave = 0;
      cin >> n;
      if(!n)break;
   for(int i=0;i<n;i++){
cin >> a[i];
ave += a[i];
 }
ave /= n;
for(int i=0;i<n;i++){
   sum += pow(a[i] - ave,2);
   }
printf("%.8f\n",sqrt(sum/n));
   }
   return 0;
}



Measured memory_bytes: 3144
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	static int time;

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		time = Integer.parseInt(br.readLine());
		int h, m, s;
		h = time / 3600;
		m = time % 3600 / 60;
		s = time % 60;
		System.out.println(h + ":" + m + ":" + s);
	}
}


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

int main()
{
    ll h;
    cin>>h;
    ll p=1,sum=0;
    while(h>0){
        if(h==1){
            sum++;
            break;
        }
        else{
            p*=2;
            sum+=p;
            h/=2;
        }
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=a;i--)
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define de(x) cout << #x << "=" << x << endl
#define dd(x) cout << #x << "=" << x << " "
#define pw(x) (1ll<<(x))
#define pq priority_queue
#define endl "\n"
int main()
{
    ios::sync_with_stdio(false);
    string s;
	cin >> s;
	for(int i=0;i<3;i++)
		cout << s[i]; 
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define fi           first
#define se           second
#define ll           long long
#define pb           push_back
#define mp           make_pair
#define pll          pair<ll,ll>
#define pii          pair<int,int>
#define all(x)       (x).begin(),(x).end()
#define isWorking()  cout<<"Wroking"<<endl
#define FOR(i,x,y)   for(int i=x; i<y; i++)
#define SORT(x)      sort(x.begin(),x.end())
#define PRINT(ok)    cout<<(ok? "YES":"NO")<<endl
#define Fast_Input   ios_base :: sync_with_stdio(false), cin.tie(NULL);
typedef vector < int > VI;
const ll mod= 1e9+7,INF=1e18,mx= 5e6+5,mn=100;
int testCase=1,cas=0;

int main() {
    Fast_Input

    //cin>>testCase;
    while(testCase--) {
        ll n,k; cin>>n>>k;

        map <ll,ll> Ar;
        map <ll,ll> ::iterator it;

        for(int i=0; i<n; i++){
            ll a,b; cin>>a>>b;
            Ar[a]+=b;
        }
        ll tmp=0;

        for(it= Ar.begin(); it!=Ar.end(); it++){
            tmp+=it->se;
            if(k<=tmp){
                cout<<it->fi<<endl;
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 4224
#include <stdio.h>
#include <string.h>

/** Application main entry point. */
int main (
  int argc,
  char *argv[ ]
  )
{
  char buf[ 1024 ];
  char *p;
  
  fgets ( buf, sizeof ( buf ), stdin );

  p = strchr ( buf, '\n' );
  while ( p > buf )
  {
    putchar ( *(--p) );
  }
  puts ( "" );

  return ( 0 );
}

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

using namespace std;

int n,m;
vector<int > adj[15];
int p[15];
bool bitmask[15];

int dp(int pos, bool mask[]){

    if(pos==n+1){
        int on = 0;

        for(int i = 1;i<=m;i++){
            int check1=0;
            //cout << i << ':';
            for(int j : adj[i]){
                //cout << mask[j]<< ' ';
                if(mask[j]){
                    check1++;
                }
            }
            //cout << ':' << p[i] << ' ' << check1;
            //cout << endl;

            //cout << on  <<endl;

            if(check1%2 == p[i]){
                on++;
            }
        }



        return on==m? 1:0;
    }
    mask[pos]=0;
    int op1 = dp(pos+1,mask);
    mask[pos]=1;
    int op2 = dp(pos+1,mask);

    return op1+op2;

}


int main() {
    cin >> n>>m;
    for(int i=1;i<=m;i++){
        int k ;
        cin >> k;
        for(int j = 0;j<k;j++){
            int u;
            cin >> u;
            adj[i].push_back(u);
        }
    }

    for(int i = 1;i<=m;i++){
        cin >> p[i];
    }

    cout << dp(1,bitmask);


    return 0;
}

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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

using namespace std;
#define ll  long long
#define PI  acos(-1)
#define pb  push_back
#define ins insert
#define INF 5000000000000000007 //1e18+7
#define mk  make_pair
#define ff  first
#define ss  second
#define endl "\n"
#define max3(x,y,z)  max(x,max(y,z))
#define min3(x,y,z)  min(x,min(y,z))
#define sz(a) (ll)a.size()
#define double long double
#define coud(a,b) cout << fixed << setprecision((b)) << (a)
#define mset(x,y)  memset(x,y,sizeof(x))
#define all(x)   (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bp(n)  __builtin_popcountll(n)
#define mxt(a)  *(max_element(a.begin(),a.end()))
#define mnt(a)  *(min_element(a.begin(),a.end()))
#define unique_sort(c) (sort(all(c)), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define trav(a, x)    for(auto &a : x)

const double eps=1e-7;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int d8x[8]={+1, +1, +1, 0, 0, -1, -1, -1};
int d8y[8]={+1, 0, -1, +1, -1, +1, 0, -1};
int d4x[4]={1, 0, 0, -1};
int d4y[4]={0, -1, 1, 0};
ll power(ll x,ll y){ll ans=1;x=x;while(y>0){if(y&1)ans=(ans*x);y=y>>1;x=(x*x);}return ans;}
ll sqr(ll x) { return x * x;}

template <typename T> T gcd(T a,T b){ if(a==0) return b; return gcd(b%a,a); }
template <class T> inline void chmax(T &x,T y){ x = max((x), (y));}
template <class T> inline void chmin(T &x,T y){ x = min((x), (y));}
template <class T> T abs(T x) { return x>0 ? x : -x;}
template <typename T> T powm(T a,T b, ll m){T cnt=1; while(b>0) { if(b%2==1) cnt=(cnt*a)%m; b/=2; a=(a*a)%m; }return cnt%m;}
typedef pair<int,int>  pii;
typedef pair<ll,ll>  pll;
typedef vector<pll>  vpll;
typedef vector<pii>  vpii;
typedef vector<ll>   vll;
typedef vector<int>  vii;
#define minpq priority_queue<T,vector<T>,greater<T> >;
// #define T int
// #define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
//*X.find_by_order(k) returns the kth largest element (0-based).
//X.order_of_key(val) returns the no. of values less than val.
ll ncr(ll n,ll r) {ll ans=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){ans*=(n-i);ans/=(i+1);}return ans;}
const int MOD = 1000000007;   
const int N = 100100;

// 🎲

int32_t main() {
  cin.sync_with_stdio(0);cin.tie(0);
  cin.exceptions(cin.failbit);
  
  ll d, t, s;
  cin >> d >> t >> s;
  double time = 1.0*d/s ;
  if(time <= t) cout << "Yes";
  else cout << "No";
  return 0; 
}

/* 
    stuff you shoulds look for
    * int overflow,array bounds.
    * special cases (n=1?).
    * N,MOD value.
*/

Measured memory_bytes: 3608
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

int main(void){
	int n,k;
	string s;
	cin>>n>>k;
	cin>>s;
	s[k-1] = s[k-1] - 'A' + 'a';
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n, a, c = 1;
int main(){
	scanf("%d", &n);
	rep(i,n){
		scanf("%d", &a);
		if(a == c) c++;
	}
	printf("%d\n", c == 1 ? -1 : n-c+1);
}

Measured memory_bytes: 256
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>

using namespace std;

typedef pair<long long, long long> pl;

long long N, M, k, a, b, c, d, e, H, W,X;
long long A[200000] = {};
long long B[20000] = {};
long long C[20000] = {};
bool f;
bool ff;
string S, SS;
set <long long>sll;
pl buf;
vector <long long>vl;


int main() {

	cin >> N;
	a = 0;
	b = 0;
	c = 0;
	d = 0;

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

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

	for (int i = 0; i < N; i++) {
		if (A[i] - B[i] > 0) {
			c += A[i] - B[i];
		}
	}

	cout << c << endl;

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
void __dump(int x){cerr << x;}
void __dump(long long x){cerr << x;}
void __dump(long double x){cerr << fixed << setprecision(3) << x;}
void __dump(char x){cerr << '\'' << x << '\'';}
void __dump(const string &x){cerr << '"' << x << '"';}
void __dump(const char *x){cerr << '"' << x << '"';}
void __dump(bool x){cerr << (x ? "true" : "false");}
void _dump(){cerr << "\n";}
template <typename T, typename U> void __dump(const pair<T, U> &x){cerr << '{'; __dump(x.first); cerr << ','; __dump(x.second); cerr << '}';}
template <typename T, typename U, typename V> void __dump(const tuple<T, U, V> &x){cerr << '{'; __dump(get<0>(x)); cerr << ',';  __dump(get<1>(x)); cerr << ',';  __dump(get<2>(x)); cerr << '}';}
template <typename T> void __dump(const T& x){int f=0; cerr << '{'; for(auto&i:x) cerr << (f++ ? "," : ""), __dump(i); cerr << "}";}
template <typename T, typename ... U> void _dump(T t, U ... u){__dump(t); if(sizeof...(u)) cerr << ", "; _dump(u...);}
#define dump(x ...) cerr  <<  "|| "  <<  # x  <<  "  =  ", _dump(x) 
//#define int long long
#define FAST ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define size(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define ln '\n'
#define __ ' '
#define LL long long
#define LD long double
#define pii pair<int,int>
const int INF = 2e9;
const int NN = 1e3;
int n,m;
set<int> in[NN+3], out[NN+3];
int curSt, vis[NN+3];
set<int> curList;
bool done;

void dfs(int u, int prv){
	if(done) return;
	if(vis[u]) return;
	
	for(int v: out[u]) if(v != curSt && curList.count(v)) return;
	for(int v: in[u]) if(v != prv && curList.count(v)) return;

	curList.insert(u);
	vis[u] = true;
	if(out[u].count(curSt)){
		done = true;
		return;
	}

	for(int v: out[u]) {
		dfs(v, u);
		if(done) return;
	}

	curList.erase(u);
}

int main(){ FAST
	cin >> n >> m;
	for(int e=1; e<=m; ++e){
		int u,v; cin >> u >> v;
		out[u].insert(v);
		in[v].insert(u);
	}

	for(curSt=1; curSt<=n; ++curSt){
		curList.clear();
		fill(vis+1, vis+n+1, false);
		dfs(curSt, -1);
		if(done) break;
	}

	if(!done) cout << -1 << ln;
	else{
		cout << size(curList) << ln;
		for(int u: curList) cout << u << ln;
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

int main()
{
  ll w,h,x,y;
  cin>>w>>h>>x>>y;
  double s=w*h;
  s/=2.0;
  cout<<setprecision(10)<<fixed<<s<<' '<<(w==x*2&&h==y*2)<<endl;
  return 0;
}


Measured memory_bytes: 256
import math

n = int(input())
xs = list(map(float, input().split()))
ys = list(map(float, input().split()))


def mink(p):
    return math.pow(sum([
        math.pow(math.fabs(xs[i] - ys[i]), p)
        for i in range(n)
    ]), 1 / p)


def mink_inf():
    return max([math.fabs(xs[i] - ys[i]) for i in range(n)])


def float_print(v):
    print('{:.5f}'.format(v))


float_print(mink(1))
float_print(mink(2))
float_print(mink(3))
float_print(mink_inf())

Measured memory_bytes: 7868
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;


public class Test
{	
    public static void Main()
	{
	    int[] nums = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
	    
	    if(nums[0] <= nums[2] && nums[2] <= nums[1])
	    {
	        Console.WriteLine("Yes");
	    }
	    else
	    {
	        Console.WriteLine("No");
	    }
	} 
}

Measured memory_bytes: 11348
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N,Y,x,y,z,f=0;
	cin>>N>>Y;
	Y/=1000;
	x=0; y=(Y-Y%5)/5;z=Y%5;
	while(x+y+z>N){x++; y-=2;}
	while(x+y+z<N){x--; y+=2;}
	while(x<0||z<0){x+=4; z+=5; y-=9;}
	if(x+y+z!=N||10*x+5*y+z!=Y||x<0||y<0||z<0)x=y=z=-1;
	cout<<x<<" "<<y<<" "<<z<<endl;
	return 0;
}


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

using namespace std;

#define ll long long
#define endl '\n'

bool isPalindrome(string &s) {
    int l = 0;
    int h = s.length() - 1;

    while (h > l) {
        if (s[l++] != s[h--]) {
            return false;
        }
    }
    return true;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s, l, r;
    cin >> s;
    int n = s.length();
    l = s.substr(0, n / 2);
    r = s.substr(n / 2 + 1, n / 2);
    if (isPalindrome(s) && isPalindrome(l) && isPalindrome(r)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    int ans = 0;
    rep(i,2,n-1){
        if(s[i-2]=='A' && s[i-1]=='B' && s[i]=='C')++ans;
    }

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

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

int main()
{
	int a, b, c;
	cin >> a >> b >> c;

	if (a == 1 && b == 0 && c == 0)
	{
		cout << "Close" << endl;
	}
	
	if (a == 0 && b == 1 && c == 0)
	{
		cout << "Close" << endl;
	}
	
	if (a == 1 && b == 1 && c == 0)
	{
		cout << "Open" << endl;
	}
	
	if (a == 0 && b == 0 && c == 1)
	{
		cout << "Open" << endl;
	}

	if (a == 0 && b == 0 && c == 0)
	{
		cout << "Close" << endl;
	}

}

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

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    for(int i = 0; i < s.length(); i++){
		cout << "x";		
	}
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define AB_BHI_NI_DEGI                \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
#define int long long
#define pb push_back
#define N 100009
#define inf 1e18
const double PI = 3.141592653589793238462643383279;
int mod = 1e9 + 7;
//int mod = 998244353;
#define P pair<int, int>
#define F first
#define S second
#define ll long long
#define all(v) v.begin(), v.end()
#define vi vector<int>
#define ld long double

#define ordered_set tree<P, null_type, less<P>, rb_tree_tag, tree_order_statistics_node_update>

void end(int n = -1)
{
	cout << n << "\n";
	exit(0);
}
int n, m;
int a[1009][1009];
int dp[1009][1009];

int fun(int i, int j)
{
	if (i == n - 1 and j == m - 1)
		return 1;
	if (i >= n or j >= m)
		return 0;
	if (!a[i][j])
		return 0;
	if (dp[i][j] != -1)
		return dp[i][j];
	int ans = fun(i + 1, j) + fun(i, j + 1);
	return dp[i][j] = ans % mod;
}

int32_t main()
{
	AB_BHI_NI_DEGI
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			char c;
			cin >> c;
			if (c == '.')
				a[i][j] = 1;
		}
	}
	memset(dp, -1, sizeof(dp));
	cout << fun(0, 0) << "\n";

	return 0;
}

Measured memory_bytes: 16256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	a := getNextInt64(scanner)
	b := getNextInt64(scanner)
	_ = getNextInt(scanner)
	k := getNextInt64(scanner)
	if k%2 == 0 {
		fmt.Println(a - b)
		return
	}
	fmt.Println(b - a)
	writer.Flush()
}


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

int main()
{
  int n, b;
  vector<vector<int>> a(3, vector<int>(3));
  vector<vector<bool>> flag(3, vector<bool>(3, false));

  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
      cin >> a[i][j];
  }
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> b;
    for (int i = 0; i < 3; i++)
    {
      for (int j = 0; j < 3; j++)
      {
        if (b == a[i][j])
          flag[i][j] = true;
      }
    }
  }
  cout << ((flag[0][0] && flag[0][1] && flag[0][2]) ||\
          (flag[1][0] && flag[1][1] && flag[1][2]) ||\
          (flag[2][0] && flag[2][1] && flag[2][2]) ||\
          (flag[0][0] && flag[1][0] && flag[2][0]) ||\
          (flag[0][1] && flag[1][1] && flag[2][1]) ||\
          (flag[0][2] && flag[1][2] && flag[2][2]) ||\
          (flag[0][0] && flag[1][1] && flag[2][2]) ||\
          (flag[2][0] && flag[1][1] && flag[0][2]) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define Set set<int>
#define int long long
#define P pair<int,int>
const int maxn = 1e6;
const int INF = 1e18 +6;
using namespace std;
int n,m,a[maxn],b[maxn],c[maxn];

int32_t main() {
    IOS;
    cin>>n>>m;
    cout<<n+m/2;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    string s,t;
    char u;
    cin >> s >> t;
    bool flag=false;
    for(int i=0;i<s.size();i++){
        u=s.at(s.size()-1);
        for(int j=s.size()-1;j>0;j--)s.at(j)=s.at(j-1);
        s.at(0)=u;
        if(s==t)flag=true;
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
void call(int n){

	for(int i=1;i<=n;i++) {
		if(i%3==0) cout<<" "<<i;
		else {
			int x = i;
			while(x) {
				if(x%10==3) {
					cout<<" "<<i;
					break;
				}
				x /= 10;
			}
		}
	}
	cout<<endl;
}

int main() {
	
	int n; cin>>n;
	call(n);
	
	return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  string s;cin >> s;
  sort(all(s));
  s.erase(unique(all(s)),s.end());
  bool isNone = true;
  rep(i,26){
    char out = 'a'+i;
    if(i==s.length()){
      cout << out << endl;
      isNone = false;
      break;
    }
    if(s[i] != 'a'+i){
      cout << out << endl;
      isNone = false;
      break;
    }
  }
  if(isNone) cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 512
(let* ((n (read))
       (bcard (loop :repeat n :collect(read-line)))
       (m (read))
       (rcard (loop :repeat m :collect(read-line)))
       (ans nil))
  (setf ans (loop :for k :in bcard :maximize(- (count k bcard :test #'string=) (count k rcard :test #'string=))))
  (if (> 0 ans)
      (princ 0)
      (princ ans)))

Measured memory_bytes: 18920
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N;
    cin >> N;
    vec<lint> H_list(N);
    range(i, 0, N) cin >> H_list.at(i);
    lint max_steps = 0, cur_steps = 0, prev = -(1LL << 58);
    for (const lint& H : H_list) {
        if (prev >= H) cur_steps += 1;
        else cur_steps = 0;
        max_steps = max(max_steps, cur_steps);
        prev = H;
    }
    cout << max_steps << "\n";
}

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

const int mod = 998244353;

int main(){
  int a, b; cin >> a >> b;
  if (a == b) cout << a+b;
  else{
    if (a > b) cout << 2*a - 1;
    else cout << 2*b - 1;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int M = scanner.nextInt();
    int[] digits = new int[N];
    Arrays.fill(digits, -1);
    for (int i = 0; i < M; i++) {
      int s = scanner.nextInt() - 1;
      int c = scanner.nextInt();
      if (digits[s] >= 0 && digits[s] != c) {
        System.out.println(-1);
        return;
      }
      digits[s] = c;
    }
    if (digits[0] == 0 && N != 1) {
      System.out.println(-1);
      return;
    }

    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < N; i++) {
      if (digits[i] >= 0) sb.append(digits[i]);
      else {
        if (i == 0) sb.append(N == 1 ? "0" : "1");
        else sb.append("0");
      }
    }
    System.out.println(sb.toString());
  }
}


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

const ll mod = 1000000007;

ll modPow(int a, int n);
ll inv(int x);

int main()
{
    ll H, W, A, B;
    ll fact[200005];
    ll ans = 0;

    cin >> H >> W >> A >> B;
    fact[0] = fact[1] = 1;
    for(int i = 2; i < 200005; i++) fact[i] = (fact[i - 1] * i) % mod;
    for(int i = 1; i <= W - B; i++) {
        int h = H-A-1, w = W-i;
        ll val = ((fact[h + w] * inv(fact[h])) % mod * inv(fact[w])) % mod;
        (ans += (((val * fact[H-h+W-w-3]) % mod * inv(fact[H-h-2])) % mod * inv(fact[W-w-1]))) %= mod;
    }

    cout << ans << endl;

    return (0);
}
ll inv(int x) { return (modPow(x, mod - 2)); }
ll modPow(int a, int n)
{
    ll ans = 1, g = a;
    while(n > 0) {
        if(n & 1) (ans *= g) %= mod;
        (g *= g) %= mod;
        n >>= 1;
    }
    return (ans);
}


Measured memory_bytes: 1920
#define _CRT_SECURE_NO_WARNINGS

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

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef map<int, string> mis;
typedef pair<int, ii> edge;


#define sc(x)  scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,end) for(int i=0; i<end; i++)
#define rlop(i,start) for(int i=start-1; i>=0; i--)
#define loop(i,start,end) for(int i=start; i<end; i++)
#define rloop(i,start,end) for(int i=start-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define mP make_pair
#define f first
#define s second

const ll OO = (4e18) + 9;
const int MOD = (1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);

//enum dir { r, d, l, u };
int dx[] = { 0, 1, 0,-1 };
int dy[] = { 1, 0,-1, 0 };

//enum diR { d, r, u, l , dr, ur, dl, ul };
int dX[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dY[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiou"; //and sometimes "aeiouy"

int dcmp(ld d1, ld d2) { return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1; } //Compare Double Numbers
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
//convert index from 2D matrix to 1D array. (Zero-indexed)
int ord(int r, int c, int nCol) { return (nCol*r) + c + 1; }
//convert index from 1D array to 2D matrix . (One-indexed)
ii rord(int n, int nCol) {
	int r = n%nCol, c = n / nCol;
	if (n%nCol == 0) c--, r = nCol;
	return ii(r, c);
}

ll poww(ll num, ll p, ll md = MOD) {
	num %= md;
	ll ret = 1;
	while (p > 0) {
		if (p & 1) ret = (ret * num) % md;
		num = (num * num) % md;
		p >>= 1;
	}
	return ret;
}

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

const int N = 3100;
ll dp[N][N];
int coins[N], n;
ll solve(int i, int j) {
	if (i > j) return 0;
	ll& ret = dp[i][j];
	if (~ret) return ret;
	return ret = max(coins[i] + min(solve(i + 1, j - 1), solve(i + 2, j)), coins[j] + min(solve(i + 1, j - 1), solve(i, j - 2)));
}


int main()
{
#ifndef ONLINE_JUDGE

#else
	//freopen("pyramid.in", "r", stdin);
#endif
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	ll sum = 0;
	lop(i, n) cin >> coins[i], sum += coins[i];
	mem(dp, -1);
	ll ans = solve(0, n - 1);
	cout << ans - (sum-ans) << endl;


	return 0;
}


Measured memory_bytes: 75520
s=int(input())
a=[s]
v=s
for i in range(10**6):
    if v%2==0:
        if int(v/2) in a:
            print(i+2)
            break
        a.append(int(v/2))
        v=v/2
    elif v%2==1:
        if int(3*v+1) in a:
            print(i+2)
            break
        a.append(int(3*v+1))
        v=3*v+1


Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int k = sc.nextInt();
		ArrayList<String> strs = new ArrayList<String>();

		for (int i = 0; i < s.length(); i++) {
			for (int j = 0; j < Math.min(k, s.length() - i); j++) {
				if (!strs.contains(s.substring(i, i + j + 1))) {
					strs.add(s.substring(i, i + j + 1));
				}
			}
		}

		Collections.sort(strs);

		System.out.println(strs.get(k - 1));
	}
}


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

void solve()
{
	string n;
	cin >> n;
	
	int s = 0;
	
	for(char c :n)
	{
		s += c-'0';
		s%=9;
	}
	
	if(s==0)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	
	
}

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


Measured memory_bytes: 3744
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
string s;
int ans;
int main()
{
	cin >> s;
	for (int i = 0; i < s.size(); i++)
		ans += s[i] - '0';
	if (ans % 9 == 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
#define ll long long int

int main() {
	// your code goes here
	ll n;
	cin>>n;
	ll cnt=0;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		if(x%2 && i%2) cnt++;
	}
	cout<<cnt<<endl;
	// while(t--){
	// 	ll n;
	// 	cin>>n;
	// 	if(n%2==0) cout<<(n/2)<<endl;
	// 	else cout<<((n+1)/2)<<endl;
	// }	
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >>s;

    if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]){
        cout<<"Bad" <<endl;
    }
    else {
        cout <<"Good"<<endl;
    }
}


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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; i++){
    cin >> d.at(i);
  }
  
  sort(d.begin(), d.end());
  d.erase(unique(d.begin(), d.end()), d.end());
  
  cout << d.size() << endl;

  return 0;
}


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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;

ll mod = 1000000007ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll inf = 1ll << 60;

int gcc(int n, int m) {
    int a = max({n, m});
    int b = min({n, m});
    if(b == 0) return a;
    int c;
    while(a % b != 0){
        c = a % b;
        a = b;
        b = c;
    }
    return b;
}

int main() {
    int D, G;
    scanf("%d%d", &D, &G);
    vector<int> p(D);
    vector<int> c(D);
    rp(i, 0, D) scanf("%d%d", &p.at(i), &c.at(i));
    int ans = 5000;
    for(int bit = 0; bit < (1<<D); ++bit){
        int score = 0;
        int num = 0;
        int max = -1;
        for(int i = 0; i < D; i++){
            if(bit & (1<<i)){
                score += (i+1) * 100 * p.at(i) + c.at(i);
                num += p.at(i);
            } else chmax(max, i);
        }
        if(score < G){
            int lack = G - score;
            if(lack > (max+1) * 100 * (p.at(max) - 1)) num += 3000;
            else{
                while(lack > 0){
                    lack -= (max+1) * 100;
                    num += 1;
                }
            }
        }             
        chmin(ans, num);
    }
    printf("%d", ans);
    return 0;     
}

Measured memory_bytes: 256
n = int(input())
*A, = map(int, input().split())
ans = 0

for i in range(n):
  minj = i
  for j in range(i, n):
    if A[j] < A[minj]:
      minj = j
  if i != minj:
    A[i], A[minj] = A[minj], A[i]
    ans += 1

print(*A)
print(ans)


Measured memory_bytes: 5608