akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  ll n;
  cin >> n;
  vi k;
  int m=0;
  orep(i,50) {
    m+=i;
    k.eb(m);
  }
  int ans=0;
  if(n==1) {
    cout << 0 << endl;
    return 0;
  }
  bool flag = false;
  orep(i,1200001) {
    if(i==1) continue;
    int tmp=0;
    while(n%i==0) {
      n /= i;
      tmp++;
      flag = true;
    }

    int jj;
    if(tmp==0) continue;
     rep(j,50) if(tmp>=k.at(j)) {
       jj=j;
     }
     ans+=(jj+1);
  }
  if(n!=1) ans++;
  if(flag) cout << ans << endl;
  else cout << 1 << endl;

  return 0;
}


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

int q;
int main()
{
  cin >> q;
  for(int i = 0; i < q; i++){
    int c, a, n, ans = 0;
    cin >> c >> a >> n;

    while(c && a && n){
      ans++;
      c--, a--, n--;
    }
    while(c >= 2 && a){
      ans++;
      c-=2, a--;
    }
    while(c >= 3){
      ans++;
      c-=3;
    }

    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int n;
ll m;
vector<int> a;

bool check(int x) {
  ll res = 0;
  for (int i = 0; i < n; ++i) {
    res += a.end() - lower_bound(a.begin(), a.end(), x - a[i]);
  }
  return m <= res;
}

int main() {
  cin >> n >> m;
  a.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int ok = 0, ng = 1000000;
  while (1 < abs(ok - ng)) {
    int mid = (ok + ng) / 2;
    if (check(mid)) {
      ok = mid;
    } else {
      ng = mid;
    }
  }
  vector<ll> sum(n + 1);
  for (int i = 0; i < n; ++i) {
    sum[i + 1] = sum[i] + a[i];
  }
  ll ans = 0;
  ll t = m;
  for (int i = 0; i < n; ++i) {
    int pos = upper_bound(a.begin(), a.end(), ok - a[i]) - a.begin();
    ans += 1ll * (n - pos) * a[i] + (sum[n] - sum[pos]);
    t -= 1ll * (n - pos);
  }
  ans += t * ok;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1408
import sys
import numpy as np 
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

I = np.array(sys.stdin.read().split(), dtype=np.int64)
h, w = I[:2]
c = I[2:102].reshape(10, 10).T
a = I[102:].reshape(h, w)
                                                              
def main():
    cost = dijkstra(csr_matrix(c), directed=True, indices=1).astype(np.int64)

    return np.sum(cost[a[a != -1]])

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 19788
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse::<T>().ok().expect("failed to parse token")
}

fn main() {
    let s: String = read();
    println!("{}", s.chars().filter(|&c| c == '1').count());
}

Measured memory_bytes: 4352
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    string s; cin>>s;
    map<char,ll>mp;
    rep(i,s.size()){
        mp[s[i]]++;
    }
    for(char c='a';c<='z';c++){
        if(mp[c]>=1)continue;
        s+=c;
        cout<<s<<endl;
        return 0;
    }
    if(s=="zyxwvutsrqponmlkjihgfedcba"){
        cout<<-1<<endl;
        return 0;
    }
    int change;
    for(int i=s.size()-1;0<i;i--){
        if(s[i-1]>s[i])continue;
        change=i-1;
        break;
    }
    //cout<<s[change]<<endl;
    char mn='z';
    char kaeru=s[change];
    for(int i=change+1;i<s.size();i++){
        if(s[i]<=kaeru)continue;
        mn=min(mn,s[i]);
    }
    string ans=s.substr(0,change);
    ans+=mn;
    cout<<ans<<endl;
}



















































Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <string> vs;
typedef vector <long long> vll;
typedef vector <pii> vpii;
typedef vector <vi> vvi;
typedef vector <vll> vvll;

#define forn(i, n) for((i) = 0; (i) < (n); (i)++)
#define form(i, m, n) for((i) = m; (i) < (n); (i)++)
#define vsort(v) sort((v).begin(), (v).end())

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s, t;
    ll l, i, k = 0;

    cin >> s >> t;
    l = s.size();

    forn(i, l)
    {
        if (s[i] != t[i]) k++;
    }

    cout << k;

    return 0;
}

Measured memory_bytes: 3912
N = gets.to_i
A = gets.split.map(&:to_i)

if N == 2
  puts (A[0] - A[-1]).abs
else
  sum = A.reduce(:+)

  accum = A[0]

  min = A[1..-2].map do |a|
    accum += a
    (accum - (sum - accum)).abs
  end.min

  puts min
end


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

int main(){
  int X;
  int t1,t2;
  cin >> X;
  t1 = X / 500;
  t2 =( X % 500 )/ 5;
  cout << t1 * 1000 + t2 * 5 << endl;
  return 0;
  
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int n, t, a, b;
    while(cin >> t, t){
	cin >> n;
	int sum = 0;
	for(int i = 0;i < n;i++){
	    cin >> a >> b;
	    sum += b - a;
	}
	if(sum >= t){
	    cout << "OK" << endl;
	}
	else{
	    cout << t - sum << endl;
	}
    }
    return 0;
}

Measured memory_bytes: 1160
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <ccomplex>
#include <unordered_map>
#include <cstring>
#include <iostream>
#include <numeric>
#include <sstream>
#include <set>
#include <map>
#include <tuple>
#include <iomanip>

using namespace std;
#define MAX 1LL << 60
#define MOD 1000000007

typedef long long ll;

#define rep(i, s, e) for(unsigned int i = s; i < e; i++)
#define repR(i, s, e) for(ll i = s; i > e; i--)
#define reft0(i, j) setfill('0') << setw(i) << j
#define fix(i) fixed << setprecision(i)
#define so(a) sort(begin(a), end(a))
#define soR(a) sort(begin(a), end(a), greater<ll>())
#define sum(a) accumulate(begin(a), end(a), 0)


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

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

int gcd(ll a, ll b, ll c) {
	return gcd(a, gcd(b, c));
}


int main() {
	ll N;
	vector<char> RGB;
	cin >> N;
	rep(i, 0, N) {
		char temp;
		cin >> temp;
		RGB.push_back(temp);
	}
	ll ans = (ll)count(begin(RGB), end(RGB), 'R')
		* (ll)count(begin(RGB), end(RGB), 'G')
		* (ll)count(begin(RGB), end(RGB), 'B');

	rep(i, 1, N / 2 + 1) {
		rep(ii, 0, N - i - i) {
			if (RGB[ii] != RGB[ii + i]
				&& RGB[ii + i] != RGB[ii + i + i]
				&& RGB[ii + i + i] != RGB[ii]) {
				ans--;
			}
		}
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3584
from collections import defaultdict

d = defaultdict(int)

def trial_division(n):
    
    tmp = int(n ** 0.5) + 1
    for num in range(2, tmp):
        while n % num == 0:
            d[num] += 1
            n //= num
    if n > 1:
        d[n] += 1

    return

N = int(input())

for i in range(1, N+1):
    trial_division(i)

ans = 1
for k, v in d.items():
    ans *= v + 1
    
print(ans % (10 ** 9 + 7))


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

 
void solve()
{
    int n,k;cin>>n>>k;
    int ans=0;
    REP(i,n)
    {
        int h;cin>>h;
        if(h>=k)ans++;
    }
    cout<<ans<<endl;
}
int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
import sys

def solve():
    input = sys.stdin.readline
    s = input().strip("\n")
    s += "T"
    lens = len(s)
    x, y = map(int, input().split())
    direc = 0 #0はx軸方向、１はy軸方向への移動
    move = 0
    init = True
    xPossible = {0}
    yPossible = {0}
    for i in range(lens):
        if s[i] == "F": move += 1
        else:
            if direc == 0: 
                newSet = set()
                for item in xPossible:
                    if init:
                        newSet |= {item + move}
                    else:
                        newSet |= {item + move}
                        newSet |= {item - move}
                xPossible = newSet
                #print("X:", xPossible)
                
            else: 
                newSet = set()
                for item in yPossible:
                    newSet |= {item + move}
                    newSet |= {item - move}
                yPossible = newSet
                #print("Y:", yPossible)
            move = 0
            direc = (direc + 1) % 2
            if init: init = False

    if x in xPossible and y in yPossible: print("Yes")
    else: print("No")

    return 0

if __name__ == "__main__":
    solve()


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

vector<long long> ret;
void divisor(long long n) {
  for(long long i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
}

int main() {
    long long N, ans=0, tmp;
    cin >> N;

    divisor(N);
    for(long long i=0; i<ret.size(); i++){
	if(ret[i]==1)
	    continue;
	tmp=ret[i]-1;
	if(N/tmp == N%tmp)
	    ans+=tmp;
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <cmath>
#include <iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  double l, ans;
  cin >> l;
  double x = l / 3;
  ans = pow(x, 3);
  printf("%.12f\n", ans);
  return 0;
}

Measured memory_bytes: 256
# include<bits/stdc++.h>
# define LL long long
using namespace std;
string a,b;
map<char,int> ma,ma1;
char A[201];
int main() 
{
	cin>>a>>b;
	a+=a;
	if(a.find(b)==string::npos) 
		cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
}


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

int asc(const void *a, const void *b) {
  long long *A = (long long *)a;
  long long *B = (long long *)b;
  if (*A > *B) return 1;
  if (*A < *B) return -1;
  return 0;
}

int main(void){
    long long int n, k, r, i, j, ans=0, po=0, posimin;
    scanf("%lld", &n);
    long long int a[n];
    for(i=0; i<n; i++) scanf("%lld", &a[i]);
    qsort(a, sizeof(a) / sizeof(long long int), sizeof(long long int), asc);
    if(a[0]>=0){
        for(i=1; i<n; i++) ans += a[i];
        ans -= a[0];
        printf("%lld\n", ans);
        po = a[0];
        for(i=1; i<n-1; i++){
            printf("%lld %lld\n", po, a[i]);
            po = po - a[i];
        }
        printf("%lld %lld", a[n-1], po);
    }else if(a[n-1]<=0){
        for(i=0; i<n-1; i++) ans -= a[i];
        ans += a[n-1];
        printf("%lld\n", ans);
        po = a[n-1];
        for(i=n-2; i>=0; i--){
            printf("%lld %lld\n", po, a[i]);
            po = po - a[i];
        }
    }else{
        for(i=0; i<n; i++){
            if(a[i]>0){
                posimin = i;
                break;
            }
        }
        for(i=0; i<n; i++) ans += abs(a[i]);
        printf("%lld\n", ans);
        po = a[posimin-1];
        for(i=posimin; i<n-1; i++){
            printf("%lld %lld\n", po, a[i]);
            po = po - a[i];
        }
        printf("%lld %lld\n", a[n-1], po);
        po = a[n-1] - po;
        for(i=posimin-2; i>=0; i--){
            printf("%lld %lld\n", po, a[i]);
            po = po - a[i];
        }
    }
    
}

Measured memory_bytes: 2548
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb push_back
#define mp make_pair
#define nt _ll128
#define ld double
long double PI =3.14159265;
using ll = long long;

const ll modo=1e9+7;
const ll ms=1e6+5;
const int inf=1e9+9;

int trie[ms][26]={0};
int ct[ms][26]={0};
int tim=1;
int ar[26]={0};
string br[ms];

int query(string s)
{
    int n=s.length();
    int i=0;
    int v=0;
    n--;
    int p=1;
    while(i<n)
    {
        v=trie[v][s[i]-97];
        if(!v){return 0;}
        i++;
    }
    return ct[v][s[i]-97];
    cout<<s<<" "<<p<<"\n";

    return p;
}


void add(string s)
{
    int i=0;
    int v=0;
    int n;
    n=s.length();
    for(char e:s)ar[e-97]++;
    i=0;
    v=0;
    int j;
    while(i<n)
    {
        for(j=0;j<26;j++)
        {
            if(ar[j])ct[v][j]++;
        }
        if(!trie[v][s[i]-97])
        {
            trie[v][s[i]-97]=tim;
            tim++;
        }
        v=trie[v][s[i]-97];
        ar[s[i]-97]--;
        i++;
    }
}


int main()
{
    idfc;


    int n;
    cin>>n;
    int i;
    ll ans=0;
    string s;
    for(i=1;i<=n;i++)
    {
        cin>>s;
        reverse(s.begin(),s.end());
        br[i]=s;
        add(s);
    }
    for(i=1;i<=n;i++)
    {
        ans+=(query(br[i])-1);
    }
    cout<<ans;

    return 0;
}

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

int main(){

    int k,s;
    cin>> k>> s;

    ll ans=0;

    for(int i=0;i<=k;i++){
        for(int j=0;j<=k;j++){
            if(s-i-j<=k&&s-i-j>=0){
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
use std::io::{self,BufRead};

fn main() {
    let mut s = String::new();
    let stdin = io::stdin();

    let _ = stdin.read_line(&mut s);

    let n:usize = s.trim().parse().unwrap();

    s.clear();

//    let _ = stdin.lock().lines(&mut s);
    let nums = stdin.lock().lines()
        .take(n)
        .map(|s| s.ok().unwrap().trim().parse().unwrap_or(0));

    let answer = nums
        .filter(|&x| {
            let m = f64::sqrt(x as f64).ceil() as u64;
            //println!("m {}", m);
            x == 2 ||( 2..(m+1)).all(|y| x % y != 0)
        })
        .count();

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



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

int main() {
  int n, m, q;
  cin >> n >> m >> q;
  list<int> lst;
  for (int i = 0; i < n; ++i) lst.emplace_back(i);
  auto itr = begin(lst);
  for (int i = 0; i < m; ++i) {
    int a;
    cin >> a;
    if (a % 2 == 0) {
      for (int j = 0; j < a; ++j) {
        if (next(itr) == end(lst)) {
          itr = begin(lst);
        } else {
          itr = next(itr);
        }
      }
    } else {
      for (int j = 0; j < a; ++j) {
        if (itr == begin(lst)) {
          itr = prev(end(lst));
        } else {
          itr = prev(itr);
        }
      }
    }
    auto t = itr;
    itr = next(t) == end(lst) ? begin(lst) : next(t);
    lst.erase(t);
  }

  unordered_set<int> st;
  for (auto&& t : lst) {
    st.insert(t);
  }

  for (int i = 0; i < q; ++i) {
    int query;
    cin >> query;
    cout << (st.count(query) ? 1 : 0) << endl;
  }
}

Measured memory_bytes: 9316
#include<iostream>
using namespace std;
class sort{
private:
  void swap(int* a,int* b){
    int temp=*a;
    *a=*b;
    *b=temp;
  }
public:
  void sort_insert(int data[],int num){
    
   for(int j=0;j<num;j++){
	cout<<data[j];
	if(j!=num-1)
	  cout<<" ";
      }
      cout<<endl;
    for(int i=1;i<num;i++){
      for(int j=i;j>0;j--){
	if(data[j]<data[j-1])
	  swap(&data[j],&data[j-1]);
      }
      for(int j=0;j<num;j++){
	cout<<data[j];
	if(j!=num-1)
	  cout<<" ";
      }
      cout<<endl;
    }
  }
};

int main(){
  sort Sort;
  int n;
  cin>>n;
  int data[n];
  for(int i=0;i<n;i++)
    cin>>data[i];
  Sort.sort_insert(data,n);
  return 0;
}

Measured memory_bytes: 3088
N,M = map(int,input().split())
L_list = []
R_list = []
count = 0
min_mn=float('inf')
max_mn=0
for i in range(M):
    L,R=map(int,input().split())
    min_mn = min(min_mn,R)
    max_mn = max(max_mn,L)

for i in range(1,N+1):
    if(i>=max_mn and i<=min_mn):
        count += 1
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int h, w;
    cin >> h >> w;
    string s[110];
    rep(i, 0, h){
        cin >> s[i];
    }
    rep(i, 0, h){
        cout << s[i] << endl << s[i] << endl;
    }
}

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

const int INF = 1001001001;
const int NV=100100;

int main() {
  int64_t a,b,k,z=0,aa,bb;
  cin>>a>>b>>k;
  aa=max(a-k,z);
  bb=max(b-max(k-a,z),z);
  cout<<aa<<" "<<bb<< endl;
}

Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;





int main(){
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll q;
    cin>>q;
    while(q--){
        ll k;
        cin>>k;
        ll DC=0,MC=0;
        ll mid=0;
        ll ans=0;
        ll l=0;
        for(int i=0;i<n;i++){
            if(i-l==k){
                if(s[l]=='D'){mid-=MC; DC--;}
                else if(s[l]=='M'){MC--;}
                l++;
            }
            if(s[i]=='D'){DC++;}
            else if(s[i]=='M'){mid+=DC; MC++;}
            else if(s[i]=='C'){ans+=mid;}
        }
        cout<<ans<<endl;
    }
    
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll,pair<ll,ll>> pii;
typedef pair<ll,ll> pi;
typedef vector<ll> vl;

#define matrix vector<vector<ll>>
#define llmax LLONG_MAX
#define llmin LLONG_MIN
#define rep(i,n) for(ll (i)=0;(i)<n;++(i))
#define crep(i,m,n) for(ll (i)=m;(i)<n;++(i))
#define zero(a) memset((a),0,sizeof((a)))
#define minus(a) memset((a),-1,sizeof((a)));
#define sq(a) ((a)*(a))
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define ff first
#define ss second

ll global=0;

// return nCr value
long long C(int n, int r) {
	if(r>n) return 0;
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;
    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }
    return ans;
}

// return whether number is prime or not
vector<ll> sieve(ll n){
    vector<ll> is_prime(n+1, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++) {
        if (is_prime[i] && (long long)i * i <= n) {
            for (int j = i * i; j <= n; j += i)
                is_prime[j] = false;
        }
    }
    return is_prime;
}


void test_case();
int main(){
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    ll t=1;
    // cin >> t;
    for(ll T=0;T<t;T++){
        test_case();
    }
    //**************************************************************************//
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

void test_case(){
    ll n;cin>>n;

    double phead;
    vector<double>dp(n+1,0.0);
    dp[0] = 1;

    for(ll i=1;i<=n;++i){
        cin>>phead;
        for(ll j=i;j>=1;--j){
            dp[j] = dp[j-1]*phead + dp[j]*(1-phead);
        }
        dp[0]*=(1-phead);
    }

    double ans = 0;
    for(ll j=n;j>n/2;--j){
        ans += dp[j];
    }
    cout<<fixed<<setprecision(10)<<ans;
}


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

int main() {
  ll d, g;
  cin >> d >> g;
  g /= 100;
  vector<int> p(d), c(d);
  rep (i, d) {
    cin >> p[i] >> c[i];
    c[i] /= 100;
  }

  ll ans = INT_MAX;
  rep (i, (1<<d)) {
    ll cnt = 0, sum = 0;
    rep (j, d) {
      if (i & (1<<j)) {
        cnt += p[j];
        sum += p[j]*(j+1) + c[j];
      }
    }
    for (ll j = d-1; j >= 0; j--) {
      if (~i>>j & 1) {
        for (ll k = 0; k < p[j] && sum < g; k++) {
          sum += j+1;
          cnt++;
        }
      }
    }
    if (sum >= g) {
      ans = min(cnt, ans);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main (int argc,const char * arg[]){
int a;
int b;
int c;
int emp;
   scanf("%d %d %d",&a,&b,&c);
   if(a > b){
   emp = b;
   b = a;
   a = emp;
   }
   if(b>c){
   emp = c;
   c = b;
   b = emp;
   }
   if(a > b){
   emp = b;
   b = a;
   a = emp;
   } 
   printf("%d %d %d\n",a,b,c);
return 0;
}

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

int l[Max / 2 +2], r[Max / 2 + 2];
int cnt;

void merge(int a[], int n, int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;
	rep(i, n1) l[i] = a[left + i];
	rep(i, n2) r[i] = a[mid + i];
	l[n1] = r[n2] = Sentinel;
	int i = 0, j = 0;
	for (int k = left; k < right; k++) {
		cnt++;
		if (l[i] <= r[j]) {
			a[k] = l[i++];
		} else {
			a[k] = r[j++];
		}
	}
}

void mergeSort(int a[], int n, int left, int right) {
	if (left+1 < right) {
		int mid = (left + right) / 2;
		mergeSort(a, n, left, mid);
		mergeSort(a, n, mid, right);
		merge(a, n, left, mid, right);
	}
}


int main() {
	int a[Max], n, i;
	cnt = 0;
	cin >> n;
	rep(i, n) cin >> a[i];

	mergeSort(a, n, 0, n);
	rep(i, n) {
		if (i) cout << " ";
		cout << a[i];

	}
	cout << endl;
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 6900
import math
while True:
    n = int(input())
    if n == 0:
        break
    else:
        arr_s = list(map(int, input().split()))
        m = sum(arr_s) / n
        t = 0
        for si in arr_s:
            t += (si - m) ** 2
        print(math.sqrt(t / n))



Measured memory_bytes: 5692
#include <iostream>
#include <string>
#include <algorithm>
#define MAX 10000
using namespace std;
int n,m,a[MAX],b[MAX];
string S;

int main(){
    while (1) {
        int p;
        cin >> p;
        if (p!=0) {
            int suma=0,sumb=0;
            for (int i = 0; i<p; i++){
                cin >> n >> m;
                if (n>m) {
                    suma += (n+m);
                }
                if (n<m){
                    sumb += (n+m);
                }
                if (n==m) {
                    suma += n;
                    sumb += m;
                }
            }
            cout << suma << " "<<sumb <<"\n";
        }else{
            break;
        }
    }
    
}

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

int main(void){
  char s[104];
	int alpha[256];

	alpha['\0'] = 0;
	alpha['I'] = 1;
	alpha['V'] = 5;
	alpha['X'] = 10;
	alpha['L'] = 50;
	alpha['C'] = 100;
	alpha['D'] = 500;
	alpha['M'] = 1000;

	while(scanf("%s",s) != EOF){
		int sum = 0;
		int len = strlen(s);

		for(int i=0;i<len;i++){
			if(alpha[s[i]] >= alpha[s[i+1]]){
				sum += alpha[s[i]];
			}
			else{
				sum -= alpha[s[i]];
			}
		}
		cout<<sum<<endl;
	}

  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pii pair<int, int>
#define pll pair<long long, long long>
#define rep(i,l,r) for(long long i = l;i<r;i++)

#define fastout  ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
using namespace __gnu_pbds;

typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update> order_set;

const int INF = (int)1e9 + 7;
const long long LLINF = (long long)1e18 + 7;

mt19937 mt('O' + '4' + 'K' + 'O');

void kekek()
{
    
    mt();
    #ifdef EB_UG
        freopen("in.txt", "r", stdin), freopen("out.txt", "w", stdout);
    #endif
    #ifndef EB_UG
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    #endif
}

int main() {
    kekek();
    long double a, b, x;
    cin >> a >> b >> x;
    long double l = 0.0;
    long double r = M_PI / 2;
    while (r - l > 1e-8) {
        long double m = (r + l) / 2;
        // cout << "M: " << m << endl;
        long double x1 = a * a * (b - a * tan(m));
        long double x2 = 0.5 * a * a * a * tan(m);
        if (a * a * b / 2 <= x) {
            if (x1 + x2 < x) {
                r = m;
            }  
            else {
                l = m;
            }
        }
        else {
            if (0.5 * b * b * a * (1 / tan(m)) < x) {
                r = m;
            }
            else {
                l = m;
            }
        }
    }
    cout.precision(20);
    cout << l * 180.0 / M_PI << endl;
    return 0;
}

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

typedef struct node{
  int p;
  int left;
  int right;
}Node;
  
int main(){
  int n,i,j,id,c,k,r,depth;
  Node *tree;
  
  scanf("%d",&n);

  tree = malloc(sizeof(Node)*n);

  for(i = 0;i < n;i++){
    tree[i].p = -1;
    tree[i].left = -1;
    tree[i].right = -1;
  }

  for(i = 0;i < n;i++){
    scanf("%d %d",&id,&k);

    for(j = 0;j < k;j++){
      scanf("%d",&c);
      tree[c].p = id;

      if(j == 0){
	tree[id].left = c;
      }
	else if(j > 0){
	  tree[r].right = c;
	}
	r = c;
      }
    }

  for(j =0;j < n;j++){
    depth = 0;
    i = tree[j].p;

    while(i != -1){
      i = tree[i].p;
      depth++;
    }
  
  if(depth == 0){
    printf("node %d: parent = %d, depth = %d, root, ",j,tree[j].p,depth);
  }
  else if(tree[j].left == -1){
    printf("node %d: parent = %d, depth = %d, leaf, ",j,tree[j].p,depth);
  }
  else{
    printf("node %d: parent = %d, depth = %d, internal node, ",j,tree[j].p,depth);
  }

  i = tree[j].left;
  printf("[");
  if(i != -1){
    printf("%d",i);
  }
  while(i !=-1){
    i = tree[i].right;
    if(i != -1){
      printf(", %d",i);
    }
  }
  printf("]\n");
  }
  return 0;
}

Measured memory_bytes: 1788
#include <iostream>

using namespace std;

int main() {
    int n;
    int index[20];
    int ans = 0;

    cin >> n;
    for (int i = 0; i < n ;i++) {
        cin >> index[i]; 
    }
    
    bool prev, curr;
    curr = index[0] < index[1];

    for (int i = 1; i < n-1 ;i++) {
        prev = curr;        
        curr = index[i] < index[i+1]; 
        if (prev == curr) {
            ans++;
        }
    }
    
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n,t,a;
    cin >> n >> t >> a;
    intl h[n];
    cin(i,h);
    t *= 1000;
    a *= 1000;
    intl idx = 0;
    intl x = INF;
    rep(i,n){
        intl b = (t  - h[i] * 6);
        if(abs(a - x) > abs(a - b)){
            idx = i + 1;
            x = b;
        }
    }
    cout << idx << endl;
    return 0;
}

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

long double cbrt(ll a){
	long double left=0,right=INT_MAX;
	for(int i=0;i<1000;i++){
		long double med=(left+right)/2.0;
		long double cal=med*med*med;
		if(cal<a)	left=med;
		else 	right=med;
	}
	return left;
}
long double sqrt(ll a){
	long double left=0,right=INT_MAX;
	for(int i=0;i<1000;i++){
		long double med=(left+right)/2.0;
		long double cal=med*med;
		if(cal<a)	left=med;
		else 	right=med;
	}
	return left;
}
int main(){
	int n;	cin>>n;
	vector<ll> x(n),y(n);
	for(int i=0;i<n;i++)	cin>>x[i];
	for(int i=0;i<n;i++)	cin>>y[i];
	ll d1=0,d2=0,d3=0,d4=0;
	for(int i=0;i<n;i++){
		d1+=abs(x[i]-y[i]);
		d2+=(x[i]-y[i])*(x[i]-y[i]);
		d3+=abs(x[i]-y[i])*(x[i]-y[i])*(x[i]-y[i]);
		d4=max(d4,abs(x[i]-y[i]));
	}
	printf("%lld\n",d1);
	printf("%.15Lf\n",sqrt(d2));
	printf("%.15Lf\n",cbrt(d3));
	printf("%lld\n",d4);
	return 0;
}
	

Measured memory_bytes: 3148
# coding: utf-8

n, m, c = map(int,input().split())
B = list(map(int,input().split()))
ans = 0

for i in range(n):
    A = list(map(int,input().split()))
    tmp = 0
    for j in range(m):
        tmp += A[j]*B[j]
    tmp += c
    if tmp > 0:
        ans += 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define init_random mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define contests_de_diya_kar 0
#define PB push_back
#define MP make_pair
#define int long long
#define sd(n) scanf("%lld", &n)
#define pd(n) printf("%lld\n", n)
#define MOD ((long long) (1000*1000*1000 + 7))
#define exit(a, b) return cout << a, b;
#define eps (double)1e-9
#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define vi vector<int>
#define vb vector<bool>
#define all(v) v.begin(), v.end()
#define ll long long 
#define pii pair<int, int>
#define mii map<int, int> 
#define print(stuff) cout << stuff << endl
#define len(stuff) stuff.size()

const int N = (int) 1e5 + 100;
int fac[N + 1], invfac[N + 1];
const int M = MOD;

int modexp (int a, int b) {
	if (b == 0) return 1;
	int ans = modexp(a, b/2);
	ans = (ans * ans) % M;
	if (b % 2) ans = (ans * a) % M;
	return ans;
}

inline int inv (int a) {
	return modexp(a, M - 2);
}

void prec () {
	fac[0] = 1;
	for (int i = 1; i <= N; i++) fac[i] = (fac[i - 1] * i) % M;
	invfac[N] = inv(fac[N]);
	for (int i = N - 1; i >= 0; i--) invfac[i] = (invfac[i + 1] * (i + 1)) % M;	
}

int c (int n, int r) {
	int ans = fac[n];
	ans *= invfac[n - r], ans %= M;
	ans *= invfac[r], ans %= M;
	return ans;
}
const int inf = (int) 1e15;

signed main()
{
  start_routine;
  #ifndef ONLINE_JUDGE
 // freopen("input.txt", "r", stdin);
  #endif
  prec();

  int arr[3];
  cin >> arr[0] >> arr[1] >> arr[2];

  sort(arr, arr + 3);
  int mx = -inf;
  do {
  	mx = max(mx, 10*arr[0]+arr[1]+arr[2]);
  }	while (next_permutation(arr, arr + 3));

  cout << mx;
  end_routine;
}

Measured memory_bytes: 1792
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    ans = 0
    p = 0
    for n in range(N):
        a = int(input())
        ans += min(p, a)
        p = max(0, a - p)
        ans += p // 2
        p %= 2
    print(ans)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <map>
using namespace std;
/*
https://atcoder.jp/contests/abc137/tasks/abc137_c
文字列ソートして、配列ごとソートして、比べていく
*/
int main()
{
    long int N, count = 0;
    string temp;
    map<string, long long> mp;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> temp;
        sort(temp.begin(),temp.end());
        mp[temp]++;
    }
    for(auto x: mp){
        count += (x.second * (x.second - 1))/2;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 9856
N, K = map(int, input().split())
A = list(map(int, input().split()))
G = []
visited = [-1]*N
count = 0
v = 0
while visited[v] == -1:
    visited[v] = count
    G.append(v+1)
    v = A[v]-1
    count += 1
if visited[v] >= K:
    print(G[K])
else:
    m = count - visited[v]
    K -= visited[v]
    K %= m
    print(G[K+visited[v]])

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

int main(){
    ll x,y,a,b,c,ans=0; cin>>x>>y>>a>>b>>c;
    vector<ll> p(a),q(b),r(c);
    rep(i,a) cin>>p[i];
    rep(i,b) cin>>q[i];
    rep(i,c) cin>>r[i];
    sort(p.rbegin(),p.rend());
    sort(q.rbegin(),q.rend());
    rep(i,x) r.push_back(p[i]);
    rep(i,y) r.push_back(q[i]);
    sort(r.rbegin(),r.rend());
    rep(i,x+y) ans+=r[i];
    cout << ans << endl;
}

Measured memory_bytes: 7868
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stdio.h>
#include<deque>
#include<map>
#include<queue>
#include<cmath>

typedef long long ll;

#define debug(x) cout << #x << '=' << x << endl;
#define debug_arr(a, n) for(ll i = 0; i < n; i++)cout << a[i] << ' '
#define inf 100000000000
#define loop(i,n) for(ll i = 0; i < n; i++)
#define graph vector<vector<ll>>
#define P pair<ll,ll>

using namespace std;

struct match{
    int num;
    int matchNum;
};

vector<int> maxVec(vector<int> a, vector<int> b){
    if(a.size() > b.size()) return a;
    else if(a.size() < b.size()) return b;

    loop(i,a.size()){
        if(a[i] > b[i]) return a;
        else if(a[i] < b[i]) return b;
    }

    return a;
}

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

    int matchNum[9] = {2,5,5,4,5,6,3,7,6};

    vector<match> a(m);
    loop(i,m){
        cin >> a[i].num;
        a[i].matchNum = matchNum[a[i].num - 1];
    }

    sort(a.begin(),a.end(),[](const match& l, const match& r){
        if(l.matchNum == r.matchNum){
            return l.num > r.num;
        }
        return l.matchNum < r.matchNum;
    });

    vector<match> tmp;
    tmp.push_back(a[0]);
    for(int i = 1; i < m; i++){
        if(a[i-1].matchNum == a[i].matchNum){
            continue;
        }
        tmp.push_back(a[i]);
    }
    a = tmp;

    vector<vector<int>> dp(n);

    loop(i,n){
        vector<int> result;
        loop(j,a.size()){
            vector<int> tmp;
            if(a[j].matchNum == i+1){
                tmp.push_back(a[j].num);
            }else if(a[j].matchNum > i+1){
                continue;
            }else{
                tmp = dp[i - a[j].matchNum];
                if(tmp.size() == 0)continue;
                tmp.push_back(a[j].num);
                sort(tmp.begin(),tmp.end(),[](const int& l, const int& r){
                    return l > r;
                });
            }
            result = maxVec(tmp,result);
        }
        dp[i] = result;
    }
    loop(i,dp[n-1].size()){
        cout << dp[n-1][i];
    }

    return 0;
}

Measured memory_bytes: 110592
import itertools
##print(ord("A"))
n = int(input())
box= list(map(int,input().split()))
ans = 0
for i in range(n):
    l = box.pop(i)
    #print(box)
    for j in range(n-1):
        #print(box,j)
        ans += l*box[j]
    box.insert(i,l)
print(ans//2)


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;

void Main() {
    int X, Y, Z;
    cin >> X >> Y >> Z;
    cout << Z << " " << X << " " << Y << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

int func(int x)
{
    if(x%2==0)
    {
        return x/2;
    }
    else
    {
        return 3*x+1;
    }
}
int main()
{
    int n;
    cin>>n;
    ll x;
    cin>>x;
    vector <int> a(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    int count = 0;
    for(int i=0;i<n;i++)
    {
        if(x>=a[i])
        {
            if(i==(n-1) && a[i]<x)
            {
                break;
            }
            count++;
            x-=a[i];
        }
        
    }
    cout<<count<<endl;
    return 0;
}

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


int main() {
  long long n; cin >> n;
  vector<long long> num(n);
  
  for(int i=0; i < n; i++){
    int x; cin >> x;
    num.at(i) = x;
  }
  
  long long min = 100000000;
  for(int i=0; i < 201; i++){
    long long cost = 0;
    for(int j=0; j < n; j++){
      cost += (num.at(j)-i+100)*(num.at(j)-i+100);
    }
    if(cost < min){
      min = cost;
    }
  }
  
  cout << min << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
struct robot
{
	int l,r;
	friend bool operator < (robot a,robot b){return a.l<b.l;}
}p[100010];
int n,dp[100010],q[100010];
int main()
{
	scanf("%d",&n);
	for(int i=1,x,y;i<=n;++i)
	{
		scanf("%d %d",&x,&y);
		p[i]=robot{x-y,x+y};
		q[i]=i;
	}
	sort(p+1,p+1+n);
	sort(q+1,q+1+n,[&](int x,int y){return p[x].r<p[y].r;});
//	for(int i=1;i<=n;++i)printf("%d %d\n",p[i].l,p[i].r);
	int mx=0,last=1;
	for(int i=1;i<=n;++i)
	{
		while(p[q[last]].r<=p[i].l)mx=max(mx,dp[q[last]]),++last;
		dp[i]=mx+1;
	}
	while(last<=n)mx=max(mx,dp[q[last]]),++last;
	printf("%d",mx);
	return 0;
}


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

#define rep(i, n)	for(int i = 0; i < (int)(n); i++)

int D, N;

int main() {

	cin >> D >> N;

	long a = 1;

	for (int i = 0; i < D; i++) {
		a *= 100;
	}

	cout << (N == 100 ? (a * (N+1)) : (a * N)) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define llu unsigned long long
#define ld double
#define llu unsigned long long
#define rep(i,x,y)  for(int i=int(x);i<int(y);++i)
#define For(i,x,y)  for(int i=int(x);i<=int(y);++i)
#define FOr(i,x,y)  for(int i=int(x);i>=int(y);--i)
#define pi acos(-1) 
#define mk make_pair
#define pa pair<ll,ll>
#define lf else if
#define IL inline
#define max(x,y)    ((x)<(y)?(y):(x))
#define min(x,y)    ((x)<(y)?(x):(y))
#define sqr(x)      ((x)*(x))
#define Mul(x,y)    ((x)=1LL*(x)*(y)%mod)
#define Add(x,y)    ((x)=((x)+(y))%mod)
#define Max(x,y)    ((x)=((x)<(y)?(y):(x)))
#define Min(x,y)    ((x)=((x)>(y)?(y):(x)))
#define E(x)        return writeln(x),0
#define p(x)        printf("~%lld~\n",LL(x))
#define pp(x,y)     printf("~~%lld %lld~~\n",LL(x),LL(y))
#define LL			(long long)
#define ppp(x,y,z)  printf("~~~%lld %lld %lld~~~\n",LL(x),LL(y),LL(z))
#define pppp(a,b,c,d)	printf("~~~%lld %lld %lld %lld\n",LL(a),LL(b),LL(c),LL(d))
#define f_in(x)     freopen(x".in","r",stdin)
#define f_out(x)    freopen(x".out","w",stdout)
#define open(x)     f_in(x),f_out(x)
#define fi first
#define se second
#define GuYue		puts("\nGuYueNa________________________________________________________________________________")
typedef complex<double> E;
namespace SHENZHEBEI{
#ifdef LOCAL
    struct _{_(){freopen("cf.in","r",stdin);}}_; 
#endif 
#define NEG 1
    static const int GYN=2333333;
    char SZB[GYN],*S=SZB,*T=SZB;
    inline char gc(){   if (S==T){  T=(S=SZB)+fread(SZB,1,GYN,stdin); if (S==T) return '\n';  }   return *S++;    }
#if NEG
    inline ll read(){    ll x=0,g=1; char ch=gc();   for (;!isdigit(ch);ch=gc()) if (ch=='-') g=-1;  for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x*g; }
    inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#else
    inline ll read(){    ll x=0; char ch=gc();   for (;!isdigit(ch);ch=gc());    for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x;   }
    inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#endif
    inline char readchar(){ char ch=gc();   for(;isspace(ch);ch=gc());  return ch;  }
    inline ll readstr(char *s){ char ch=gc();   int cur=0;  for(;isspace(ch);ch=gc());      for(;!isspace(ch);ch=gc())  s[cur++]=ch;    s[cur]='\0';    return cur; }
	void Print(long long *a,int s,int t){For(i,s,t)printf("%lld ",a[i]);}
	void Print(int *a,int s,int t){For(i,s,t)printf("%d ",a[i]);}
	void Print(char *a,int s,int t){For(i,s,t)putchar(a[i]);}
	void writeln(ll x){write(x);puts("");}
}using namespace SHENZHEBEI;
const ll N=400100;
ll a[N],opt[N],f[N][4],n;
ll ppow(ll x,ll k){return k?-ppow(x,k-1):x;}
int main(){
	n=read();
	For(i,1,n)	a[i]=read(),opt[i]=a[i]>0,a[i]=abs(a[i]);
	memset(f,-60,sizeof f);
	f[0][0]=0;
	For(i,1,n){
		if (!opt[i])f[i-1][2]=f[i-1][1],f[i-1][1]=f[i-1][0],f[i-1][0]=-1e18;
		For(cur,0,2)For(now,0,cur)Max(f[i][now],f[i-1][cur]+ppow(a[i],cur));
	}
	writeln(max(f[n][0],f[n][1]));
}

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

#define PI 3.14159265358979323846
#define int long long int
#define ff first
#define ss second
#define pb push_back

#define N 100010
#define MOD 1000000007

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);

    int a, b;
    cin >> a >> b;
    if(a + b == 3)
        cout << 3;
    else if(a + b == 4)
        cout << 2;
    else
        cout << 1; 
   	return 0;	
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
using namespace std;

int main() {
    int A, B, ans = 0;
    cin >> A >> B;

    for (int i = A; i <= B; i++) {
        if ((i % 10) == (i / 10000) && (i / 10) % 10 == (i / 1000) % 10)ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int s = sc.nextInt();
        int t = sc.nextInt();
        ArrayList<HashMap<Integer, Integer>> graph = new ArrayList<>();
        for (int i = 0; i <= n; i++) {
            graph.add(new HashMap<>());
        }
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            int d = sc.nextInt();
            if (a != b && (!graph.get(a).containsKey(b) || graph.get(a).get(b) > d)) {
                graph.get(a).put(b, d);
                graph.get(b).put(a, d);
            }
            if (b != c && (!graph.get(b).containsKey(c) || graph.get(b).get(c) > d)) {
                graph.get(b).put(c, d);
                graph.get(c).put(b, d);
            }
            if (c != a && (!graph.get(c).containsKey(a) || graph.get(c).get(a) > d)) {
                graph.get(a).put(c, d);
                graph.get(c).put(a, d);
            }
        }
        PriorityQueue<Path> queue = new PriorityQueue<>();
        queue.add(new Path(s, 0));
        long[] costs = new long[n + 1];
        Arrays.fill(costs, Long.MAX_VALUE);
        while (queue.size() > 0) {
            Path p = queue.poll();
            if (costs[p.idx] <= p.value) {
                continue;
            }
            costs[p.idx] = p.value;
            for (Map.Entry<Integer, Integer> entry : graph.get(p.idx).entrySet()) {
                if (costs[entry.getKey()] > entry.getValue() + p.value) {
                    queue.add(new Path(entry.getKey(), entry.getValue() + p.value));
                }
            }
        }
        System.out.println(costs[t]);
    }
    
    static class Path implements Comparable<Path> {
        int idx;
        long value;
        
        public Path(int idx, long value) {
            this.idx = idx;
            this.value = value;
        }
        
        public int compareTo(Path another) {
            if (value == another.value) {
                return 0;
            } else if (value < another.value) {
                return -1;
            } else {
                return 1;
            }
        }
        
        public String toString() {
            return "idx:" + idx + " value:" + value;
        }
    }
}



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

#define lli long long int
#define mpr make_pair
#define pr pair<lli,lli>
#define pb push_back
#define vl vector<lli>
#define mp map<lli,lli>
#define all(x) x.begin(),x.end()
#define FOR(i,n) for(lli i=0;i<(lli)n;i++)
#define FOR1(i,j,n) for(lli i=j;i<(lli)n;i++)
#define mod 1000000007

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

lli power(lli x,lli n,lli m)
{
	lli res=1;
	while(n>0)
	{
		if(n&1) res=(res*x)%m;
		x=(x*x)%m;
		n=n>>1;
	}
	return res;
}

lli modInverse(lli n,lli  p)
{
	return power(n,p-2,p);
}

lli nCr(lli n,lli r,lli p)
{
	if(r==0)
	return 1;
	lli fac[n+1];
	fac[0]=1;
	for(lli i=1;i<=n;i++)
	fac[i]=fac[i-1]*i%p;
	return ((fac[n]* modInverse(fac[r], p) % p )%p* 
            modInverse(fac[n-r], p) % p) % p; 
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	lli x,n,res=101;
	cin>>x>>n;
	vl v(n);
	mp m;
	for(lli i=0;i<n;i++)
	{
		cin>>v[i];
		m[v[i]]=1;
	}
	lli i=0;
	while(true)
	{
		if(m[x-i]==0)
		{
			cout<<x-i<<endl;
			return 0;
		}
		else if(m[x+i]==0)
		{
			cout<<x+i<<endl;
			return 0;
		}
		i++;
	}
	/*bool vis[150];
	memset(vis,false,sizeof(vis));
	for(lli i=0;i<n;i++)
	{
		cin>>v[i];
		vis[v[i]]=true;
	}
	for(lli i=-150;i<150;i++)
	{
		if(i>=0&&!vis[i])
		{
			vis[i]=true;
			if(res==101||abs(res-x)>abs(x-i))
			res=i;
		}
		else if(i<0)
		{
			if(res==101||abs(res-x)>abs(x-i))
			res=i;
		}
	}
	cout<<res<<endl;*/
	
	
return 0;
}


Measured memory_bytes: 3632