akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int MAX = 1000010;
int d[MAX];

int main() {
    int n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));

    map<ll, int> cnt;
    rep(i, n) cnt[a[i]]++;

    int ans = 0;
    for (ll x: a) {
        if (d[x]) continue;
        if (cnt[x] == 1) ans++;
        ll times = 1;
        while (times * x <= MAX) {
            d[times * x]++;
            times++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 21160
import sys
S = list(input())

ans = len(S)
if len(S)%2 == 1 :
    S = S[0:-1]
    ans -= 1
    if S[0:ans//2] == S[ans//2:] :
        print(ans)
        sys.exit()

while len(S) > 0 :
    S = S[0:-2]
    ans -= 2
    if S[0:ans//2] == S[ans//2:] :
        print(ans)
        sys.exit()
else :
    print(ans)

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

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n;
	cin >> n;
	if(n%2 != 0) cout << (double)(n+1)/(2*n) << "\n";
	else cout << (double)1/2 << "\n";
	return 0;
}

Measured memory_bytes: 256
N=gets.to_i
array=[]
N.times do
    a=gets.to_i
    array.push(a)
end
array=array.sort
ret1=0
array.each_with_index do |a, i|
    if (i+1)*2 < N
        ret1-=2*a
    elsif (i+1)*2 == N
        ret1-=a
    elsif i*2-1<=N
        ret1+=a
    else
        ret1+=2*a
    end
end
ret2=0
array.reverse.each_with_index do |a, i|
    if (i+1)*2 < N
        ret2+=2*a
    elsif (i+1)*2 == N
        ret2+=a
    elsif i*2-1<=N
        ret2-=a
    else
        ret2-=2*a
    end
end
puts ret1 > ret2 ? ret1 : ret2


Measured memory_bytes: 16920
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<string>
#include<cstring>
#include<time.h>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


#define repi(i,a,b) for(ll i = (a); i < (b); i++)
#define rep(i, n) for(ll i = 0; i < (n); ++i)




//最大公約数
template<typename T>
constexpr T gcd(T a, T b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

//正剰余
long long mod(long long a, long long b)
{
	return a - (long long)std::floor((double)a / (double)b) * b;
}

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
unordered_map<ll, unordered_map<ll, int>> mp;

int main() {
	int N;
	int zero = 0;
	int zerox = 0;
	int zeroy = 0;
	cin >> N;
	rep(i, N) {
		ll a, b;
		cin >> a >> b;
		if (a == 0 && b == 0) {
			zero++;
			continue;
		}
		else if (a == 0) {
			zerox++;
			continue;
		}
		else if (b == 0) {
			zeroy++;
			continue;
		}

		if (b < 0) {
			a = -a;
			b = -b;
		}
		ll g = gcd(a, b);
		a /= g;
		b /= g;
		if (mp.count(a) == 0) {
			mp.insert(pair<ll, unordered_map<ll,int>>(a, unordered_map<ll,int>()));
		}
		if(mp[a].count(b) == 0){
			mp[a].insert(pair<ll,int>(b,0));
		}
		mp[a][b]++;
	}
	ll res = 1;
	ll MOD = 1000000007;
	if (zerox > 0) {
		if (zeroy > 0) {
			res *= (modpow(2, zerox, MOD) + modpow(2, zeroy, MOD)) - 1;
		}
		else {
			res *= modpow(2, zerox, MOD);
		}	
		res %= MOD;
	}
	else if (zeroy > 0) {
		res *= modpow(2, zeroy, MOD);
		res %= MOD;
	}
	for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
		for (auto itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2) {
			if (itr2->second == -1) continue;

			if (mp.count(itr2->first) != 0 && mp[itr2->first].count(-itr->first) != 0){
				res *= (modpow(2, itr2->second, MOD) + modpow(2, mp[itr2->first][-itr->first], MOD))-1;
				mp[itr2->first][-itr->first] = -1;
			}
			else if (mp.count(-itr2->first) != 0 && mp[-itr2->first].count(itr->first) != 0) {
				res *= (modpow(2, itr2->second, MOD) + modpow(2, mp[-itr2->first][itr->first], MOD))-1;
				mp[-itr2->first][itr->first] = -1;
}
			else {
				res *= modpow(2, itr2->second, MOD);
			}
			res %= MOD;
		}
	}
	res = mod(res - 1 + zero,MOD);
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 33520
type T a = (a,a,a)
f :: [a] -> T a
f [x,y,z] = (x,y,z)

a # b = abs (a-b)

first cx cy ((x,y,h):xs)
  | h == 0 = first cx cy xs
  | otherwise = h + x#cx + y#cy

p :: Int -> Int -> T Int -> (Int -> Bool)
p cx cy (x,y,h)
  | h==0 = (<=(x#cx + y#cy))
  | otherwise = (==(h+ x#cx + y#cy))

check :: [(Int,Int,Int)] -> Int -> Int -> Int -> Bool
check xs cx cy h = all ($h) (map (p cx cy) xs)

solv xs = go xs [(cx,cy)|cx<-[0..100], cy<-[0..100]] where
  go xs ((cx,cy):cs)
    | check xs cx cy h = [cx,cy,h]
    | otherwise = go xs cs
    where h = first cx cy xs

main = do
  [n] <- map read . words <$> getLine :: IO [Int]
  xs <- map (f.map read.words) . lines <$> getContents
  putStrLn . unwords . map show $ solv xs


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

int main()
{
   int n;
   cin>>n;
   int a[n];
   
   int sum=0;
   for(int i=0;i<n;i++){
   	 cin>>a[i];
   	 sum+=a[i];
   }
   
   int sum1=sum/n;
   int ans1=0;
   for(int i=0;i<n;i++){
   	 ans1+=fabs(a[i]-sum1)*fabs(a[i]-sum1);
   }
   
   int sum2=sum/n+1;
   int ans2=0;
   for(int i=0;i<n;i++){
   	 ans2+=fabs(a[i]-sum2)*fabs(a[i]-sum2);
   }
   
   if(ans1<ans2)
     cout<<ans1;
   else
     cout<<ans2;
     
   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<map>
#include<utility>
#include<cmath>
#include<tuple>
#include<string>
#include<bitset>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
typedef long long ll;

string s;

bool check(int l,int r){
    for(int i=0;i<=(r-l)/2;i++){
        if(s[l+i]!=s[r-i-1]) return false;
    }
    return true;
}

int main(){
    cin>>s;
    int n=s.length();
    if(check(0,n)&&check(0,(n-1)/2)&&check((n+3)/2-1,n)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import sys
from collections import deque

icase=0
if icase==0:
    n,m=map(int,input().split())
    g = [[] for _ in range(n)]
    for i in range(m):
        ai,bi=map(int,input().split())
        g[ai-1].append(bi-1)
        g[bi-1].append(ai-1)
elif icase==1:
    n,m=4,4
    g=[[1], [0, 2, 3], [1, 3], [2, 1]]
elif icase==2:
    n,m=6,9
    g=[[5, 4], [3, 5], [3, 4], [2, 1, 5, 4], [2, 0, 3, 5], [0, 3, 1, 4]]

q=deque([0])

stack=[0]
parent=[-1]*n
parent[0]=0
dist=[-1]*n
dist[0]=0
while q:
    state = q.popleft()
#    print("--- q:",q,"state:",state,"g:",g[state],"p:",parent)
    for v in g[state]:
#        print("  state:",state,"v:",v,"q:",q)
#        if parent[state] == v:
        if parent[v] !=-1:
            continue
        else:
#            print("parent:",parent,"xx:",xx,"stack",stack)
            parent[v]=state
            dist[v]=dist[state]+1
            q.append(v)
#            print(" state:",state,"v:",v,"parent:",parent,"stack",stack,"dist[v]",dist[v])
for i in range(1,n):
    if parent[i]==-1:
        print("No")
        sys.exit()

print("Yes")
for i in range(1,n):
#    print(i+1,dist[i])    
    print(parent[i]+1)
    

Measured memory_bytes: 34772
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(v) for (auto itr = v.begin(), itr != v.end(); ++itr)
#define LB(v, x) lower_bound(v.begin(), v.end(), x) - v.begin()
#define UB(v, x) upper_bound(v.begin(), v.end(), x) - v.begin()
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

class BIT {
    int n;
    vector<ll> node;

public:
    BIT(int N) : n(N), node(N + 1) {}
    void add(int i, ll x) {
        for (++i; i <= n; i += i & -i) { node[i] += x; }
    }
    ll sum(int i) {
        ll s = 0;
        for (; i > 0; i -= i & -i) { s += node[i]; }
        return s;
    }
};
class RSQ {
    int n;
    BIT a, b;

public:
    RSQ(int N) : n(N), a(N), b(N) {}
    void add(int l, int r, ll x) {
        int t = r - l;
        a.add(l, -l * x);
        a.add(r, r * x);
        b.add(l, x);
        b.add(r, -x);
    }
    ll sum(int i) { return a.sum(i) + i * b.sum(i); }
};

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

    int N, K;
    cin >> N >> K;
    ll res = 0;
    for (int b = 1; b <= N; ++b) {
        int q = N / b;
        int r = N % b;
        res += max(0, b - K) * q;
        if (K > 0)
            res += max(0, r - K + 1);
        else
            res += r;
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
#define INF 1e9+7
#define PI 3.141592653
using namespace std;
 


int main() 
{ 
    int n;
    cin>>n;
    string s;
    unordered_map<string,int> mp;
    pan(i,n)
    {
        string s;
        cin>>s;
        sort(s.begin(),s.end());
        mp[s]++;
    }
    ll ct=0;
    for(auto i=mp.begin();i!=mp.end();i++)
    {
        ll x=i->second;
        ct+= (x*(x-1))/2;
    }
    cout<<ct;
} 


Measured memory_bytes: 10660
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Scanner;

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

        int total1 = inp.nextInt();

        int[] list1 = new int[total1];

        for(int i = 0; i < total1; i++){
            list1[i] = inp.nextInt();
        }

        int total2 = inp.nextInt();

        int[] list2 = new int[total2];

        for(int i = 0; i < total2; i++) {
            list2[i] = inp.nextInt();
        }

        int same = 0;

        ArrayList<Integer> sameList = new ArrayList<>();

        if (total2 < total1) {
            for(int i = 0; i < total2; i++) {
                for(int j = 0; j < total1; j++){
                    if (list1[j] == list2[i]) {
                        if (!(sameList.contains(list2[i]))) {
                            sameList.add(list2[i]);
                            same++;
                        }
                    }
                }
            }
        } else {
            for(int i = 0; i < total1; i++){
                for(int j = 0; j < total2; j++){
                    if (list2[j] == list1[i]) {
                        if (!(sameList.contains(list1[i]))) {
                            sameList.add(list1[j]);
                            same++;
                        }
                    }
                }
            }
        }

        System.out.println(same);
    }
}



Measured memory_bytes: 40480
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(void) {
    int N;
    string S;
    cin >> S;
    N=S.size();
    vector<int> sa,sb;
    rep(i,N){
        sa.push_back(int(S[i]=='1'));
        sb.push_back(int(S[i]=='1'));
    }
    DEBUG{
        rep(i,N){
            cout << sa[i] << endl;
        }
    }
    int cnta=0,cntb=1; 
    sb[0]=1-sb[0];
    for(int i=1;i<N;i++){
        if(sa[i]==sa[i-1]){
            sa[i]=1-sa[i];
            cnta++;
        }
        if(sb[i]==sb[i-1]){
            sb[i]=1-sb[i];
            cntb++;
        }
    }
    cout << min(cnta,cntb) << endl;
    return 0;
}


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

int main(){
    int n;
    string a;
    cin>>n;
    cin>>a;
    int y=0;
    int m=0;
    for(int x=0;x<n;x++){
    	if(a[x]=='I'){
    		y++;
		}else(y--);
		if(y>m){
			m=y;
		}
	}
	cout<<m;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <utility>
using namespace std;

typedef struct{
	int t,s; // time gakuseiNo
}dat;

int main(void){
	int N,M;
	int a,b,c,d;
	int ts,te,m;
	int r,q;
	vector<dat> kiroku[10001]; // ??????
	while(cin>>N>>M,N||M){
		cin>>r;
		for(int i=0;i<r;i++){
			cin>>a>>b>>c>>d;
			dat temp;
			temp.t=a;
			temp.s=d;
			kiroku[c].push_back(temp);
		}

		cin>>q;
		for(int XX=0;XX<q;XX++){
			int total=0;
			int start=0;
			int gakuseiuse=0;
			int i=0;
			cin>>ts>>te>>m;

			// prev
			for(i=0;i<kiroku[m].size()&&kiroku[m][i].t<ts;i++){
				if(kiroku[m][i].s==1)gakuseiuse++;
				else  gakuseiuse--;
			}
			if(gakuseiuse>0)start=ts;

			// now
			for(;i<kiroku[m].size()&&kiroku[m][i].t<te;i++){
				// printf("debug %d,%d:%d,%d\n",m,i,kiroku[m][i].t,kiroku[m][i].s);
				if(kiroku[m][i].s==1){
					// login
					gakuseiuse++;
					if(gakuseiuse==1){
						start=kiroku[m][i].t;
					}
				}
				else if(kiroku[m][i].s==0){
					// logout
					gakuseiuse--;
					if(gakuseiuse==0){
						total+=kiroku[m][i].t-start;
					}
				}
			}
			// end
			if(gakuseiuse>=1){
				total+=te-start;
			}
			cout<<total<<endl;
		}
		for(int i=0;i<M;i++)kiroku[i].clear();
	}
	return 0;
}

Measured memory_bytes: 3476
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int sol = 0, x, m = 10;
    for (int i = 0; i < 5; ++i)
    {
        cin >> x;
        if (x % 10)
        {
            m = min(m, x % 10);
            x /= 10, x++, x *= 10;
        }
        sol += x;
    }
    m %= 10;
    if (m)
        sol += m - 10;
    cout << sol;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
constexpr Int MOD = 1000000007;
array<Int, 100001> POW2, K;
int main()
{
    cin.tie(nullptr); ios::sync_with_stdio(false);
    POW2[0] = 1;
    for (int i = 1; i < POW2.size(); i++) POW2[i] = (POW2[i-1] * 2) % MOD;
    string L; cin >> L;
    K[0] = 1;
    for (int i = 1; i < K.size(); i++) {
        K[i] = (K[i-1] + K[i-1] * 2) % MOD;
    }
    Int ans = 0;
    int cnt = 0;
    for (int i = 0; i < L.size(); i++) {
        if (L[i] == '1') {
            ans = (ans + POW2[cnt] * K[L.size() - i - 1]) % MOD;
            cnt++;
        }
    }
    ans = (ans + POW2[cnt]) % MOD;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 2000
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<map>
#include<list>
using namespace std;
#define ll long long

ll judge753(ll a){
  bool flag3=0;
  bool flag5=0;
  bool flag7=0;
  int tmp;
  while(a>0){
    tmp=a%10;
    if(tmp==3)flag3=1;
    if(tmp==5)flag5=1;
    if(tmp==7)flag7=1;
    a=a/10;
  }
  if(flag3*flag5*flag7){
    return 1;
  }else{
    return 0;
  }
}

int main(){
  ll N;
  cin >> N;
  list<ll> v;
  v.push_back(3);
  v.push_back(5);
  v.push_back(7);
  ll cnt=0;
  for(auto itr = v.begin();itr !=v.end(); ++itr){
     if(*itr*10+3<=N)v.push_back(*itr*10+3);
     if(*itr*10+5<=N)v.push_back(*itr*10+5);
     if(*itr*10+7<=N)v.push_back(*itr*10+7);
     cnt+=judge753(*itr);
    }
    cout <<cnt <<endl;
    return 0;
}


Measured memory_bytes: 1152
//@formatter:off
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define rrep(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<P>
#define vvp vector<vector<P>>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << '\n'; }
void YES(bool b) { cout << (b ? "YES" : "NO") << '\n'; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;
//@formatter:on

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int x;
    cin >> x;
    Yes(x >= 30);
}


Measured memory_bytes: 3664
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
using namespace std;
long long a,b,c;
int main()
{
	cin>>a>>b>>c;
	if((a%2)*(b%2)*(c%2)==0){
		puts("0");
		return 0; 
	}
	cout<<min(min(a*b,a*c),b*c)<<endl;
	return 0;
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	n -= 1;
	vector<int> b(n);
	int s = 0;
	for (int i = 0; i < n; ++i) {
		cin >> b[i];
	}
	s += b[0] + b[n - 1];
	for (int i = 1; i < n; ++i) {
		s += min(b[i], b[i - 1]);
	}
	cout << s;
}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		ArrayDeque<Integer> k = new ArrayDeque<Integer>();
		while(stdIn.hasNext()) {
			int tmp = stdIn.nextInt();
			if(tmp == 0) {
				System.out.println(k.pop());
			}
			else {
				k.push(tmp);
			}
		}
	}
}

Measured memory_bytes: 17184
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <random>
#include <functional>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define MAP map<int,int>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;
const ll INF = (ll)1e17;

void ANS(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Ans(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void ans(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

int main() {
	int N;ll T;
	cin >> N >> T;
	VL A(N),B(N),C(N,0);
	REP(i, N) cin >> A[i];
	C[N - 1] = A[N - 1];
	REREP(i, N - 1) C[i] = max(C[i + 1], A[i]);
	REP(i, N) B[i] = C[i] - A[i];
	//REP(i, N) cout << A[i] << " " << B[i] << " " << C[i] << endl;
	ll B_max = *max_element(B.begin(), B.end());
	ll cnt = 0;
	REP(i, N - 1) if (B_max == B[i]) cnt++;
	cout << cnt << endl;
	//cin >> N;
	return 0;
}


Measured memory_bytes: 2560
package main
  
import (
    "fmt"
)

func main() {
    var max, sum int
    for i := 0; i < 5; i++ {
        var t int
        fmt.Scan(&t)
        ct := ceil(t)
        sum += ct
        if ct-t > max {
            max = ct - t
        }
    }

    sum -= max
    fmt.Println(sum)
}

func ceil(n int) int {
    if n%10 > 0 {
        return (int(n/10) + 1) * 10
    } else {
        return int(n/10) * 10
    }
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define MOD 1000000007

int main() {
    int X,A,B; cin >> X >> A >> B;
    cout << (X-A) % B << endl;
}



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

int main(){
  std::priority_queue<int> price;
  int n,m;

  while(std::cin >> n >> m){
    int sum = 0;
    if(n == 0 && m == 0){ break; }
    for(int i = 0; i < n; ++i){
      int temp;
      std::cin >> temp;
      price.push(temp);
    }
    for(int i = 1; i <= n; ++i){
      if(i%m != 0){
        sum += price.top();
        price.pop();
      }
      else{
        price.pop();
      }
    }
    std::cout << sum << std::endl;
  }

  return 0;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h> 
using namespace std; 
int main() {
 long double a,b;
 cin>>a>>b;
 if(a!=0&&b!=0&&a>1&&b<pow(10,100))
 if(a==b)
 cout<<"EQUAL";
 else if(a<b)
 cout<<"LESS";
 else
 cout<<"GREATER";
return 0;
}

Measured memory_bytes: 256
n = int(input())
S = [input().strip() for _ in range(n)]
C = {chr(i):0 for i in range(97,123)}
for i in range(len(S[0])):
    C[S[0][i]] += 1
for j in range(1,n):
    C1 = {chr(i):0 for i in range(97,123)}
    for i in range(len(S[j])):
        C1[S[j][i]] += 1
    for i in range(97,123):
        C[chr(i)] = min(C[chr(i)],C1[chr(i)])
        
A = []
for i in range(97,123):
    A.append(chr(i)*C[chr(i)])
print("".join(sorted(A)))

Measured memory_bytes: 9116
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n = I()
A = LI()
B = [0]*n

for i, x in enumerate(A):
    B[x-1] = i+1

print(" ".join([str(x) for x in B]))


Measured memory_bytes: 63664
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

ans = sum(B)
ao=-1
for i in range(len(A)):
    if A[i]==ao+1 :
        ans+=C[A[i]-2]
    ao=A[i]
print(ans)


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

int main(){
    string s;  cin >> s;
    int N = s.length();
    int c = 1e9, f = -1e9;
    for(int i=0; i<N; i++){
        if(s[i] == 'C'){
            c = min(c, i);
        }else if(s[i] == 'F'){
            f = max(f, i);
        }
    }

    if(c < f){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define ff(i, n) for (int i = 1; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;



void solve(){
    int n;
    cin>>n;
    if(n%2){cout<<fixed<<setprecision(12)<<(double)(n/2 + 1)/n;}
    else cout<<fixed<<setprecision(12)<<(0.5);
}



int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 256
def solve(string):
    h, w, *s = string.split()
    h, w = map(int, [h, w])
    hg = []
    hi = []
    vg = []
    vi = []

    for _s in s:
        gn = 0
        _hi = [0] * w
        _hg = []
        c = 0
        for i, __s in enumerate(_s):
            if __s == "#":
                _hi[i] = -1
                gn += 1
                _hg.append(c)
                c = 0
                continue
            _hi[i] = gn
            c += 1
        _hg.append(c)
        hg.append(_hg)
        hi.append(_hi)
    for _s in zip(*s):
        gn = 0
        _vi = [0] * h
        _vg = []
        c = 0
        for i, __s in enumerate(_s):
            if __s == "#":
                _vi[i] = -1
                gn += 1
                _vg.append(c)
                c = 0
                continue
            _vi[i] = gn
            c += 1
        _vg.append(c)
        vg.append(_vg)
        vi.append(_vi)

    ans = max([max([hg[i][hi[i][j]] + vg[j][vi[j][i]] for j in range(w)]) for i in range(h)])
    return str(ans - 1)


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(solve('{} {}\n'.format(n, m) + '\n'.join([input() for _ in range(n)])))


Measured memory_bytes: 198000
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		//対象の文字列をセット
		String strTgt = sc.next();

		//文字の位置をセット
		long lngCharPos = sc.nextLong();

		char charResult = 0;
		for(int i = 0;  i < lngCharPos; i++) {

			//i番目の文字を取得
			charResult = strTgt.charAt(i);

			//「1」以外の場合
			if(charResult != '1') {
				break;
			}

		}

		//アウトプット
		System.out.println(charResult);

	}

}


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

ll pow_ll(ll a, ll n) {
    if (n == 0LL) {
        return 1LL;
    } else {
        ll half = pow_ll(a, (n / 2));
        if (n % 2 == 0) {
            return half * half;
        } else {
            return half * half * a;
        }
    }
}
int main() {
    ll x;
    cin >> x;
    bool flag_find = false;
    for (ll a = -1000LL; a <= 1000LL; a++) {
        for (ll b = -1000LL; b <= 1000LL; b++) {
            if (pow_ll(a, 5) - pow_ll(b, 5) == x) {
                cout << a << " " << b << endl;
                flag_find = true;
                break;
            }
        }
        if (flag_find) {
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3636
# -*- coding: utf-8 -*-


def bubbleSort(A, N):
    flag = True  # 未ソートの可能性があるか
    i = 0  # 未ソート部分の先頭
    inv_num = 0  # 転倒数
    while flag:
        flag = False
        for j in range(N - 1, i, -1):
            if A[j] < A[j - 1]:
                A[j], A[j - 1] = A[j - 1], A[j]
                flag = True
                inv_num += 1
        i += 1

    return A, inv_num


if __name__ == '__main__':

    N = int(input())
    A = [int(a) for a in input().split(" ")]

    A, inv_num = bubbleSort(A, N)
    print(" ".join(map(str, A)))
    print(inv_num)



Measured memory_bytes: 5604
while True:
    data = input().split()
    h, w = int(data[0]), int(data[1])
    if h == 0 and w == 0:
        break
    elif h == 0 or w == 0:
        print()
    else:
        for i in range(h):
            if i == 0 or i == h-1:
                print("#"*w)
            else:
                print("#"+"."*(w-2)+"#")
        print()

Measured memory_bytes: 7624
n=int(input())
dp=[float("inf")]*100010
dp[0]=0

for i in range(n+1):
    power = 1
    while i + power <= n:
        dp[i + power] = min(dp[i + power],dp[i] + 1)
        power *= 6
    power = 1
    while i + power <= n:
        dp[i + power] = min(dp[i + power],dp[i] + 1)
        power *= 9

print(dp[n])

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

int cmp(const void *a,const void *b){
    if(*(int*)a>*(int*)b){return -1;}
    else if(*(int*)a<*(int*)b){return 1;}
    else {return 0;}
}


int main(void){
int n,a[101],b[101],c[101];
int sum=0;
scanf("%d",&n);

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

for(int i=0;i<n;i++){
    scanf("%d",&b[i]);
}

for(int i=0;i<n-1;i++){
    scanf("%d",&c[i]);
}

sum=sum+b[a[0]-1];




for(int i=1;i<n;i++){
sum=sum+b[a[i]-1];
if(a[i]==a[i-1]+1){sum=sum+c[a[i-1]-1];}
//printf("%d\n",sum);
}
printf("%d",sum);




}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
int ary[21][21];
int dp[1<<21],n;
inline void dfs(int i,int zt){
	if(~dp[zt]) return;
	dp[zt]=0;
	for(int k=0;k<n;++k){
		if(zt&(1<<k)&&ary[i][k]){
			dfs(i+1,zt-(1<<k));
			(dp[zt]+=dp[zt-(1<<k)])%=MOD;
		}
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	for(int i=0;i<n;++i){
		for(int j=0;j<n;++j){
			cin>>ary[i][j];
		}
	}
	memset(dp,-1,sizeof(dp));
	dp[0]=1;
	dfs(0,(1<<n)-1);
	cout<<dp[(1<<n)-1]<<endl;
	return 0;
}

Measured memory_bytes: 8448
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
using namespace std;

typedef pair<int, int> P;
#define INF 1145141919

int N, K;
vector<P> G[100010];
int D[100010];

int main() {
  cin >> N;
  for (int i=0; i<N-1; i++) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(P(1, b));
    G[b].push_back(P(1, a));
  }
  cin >> K;
  for (int i=0; i<K; i++) {
    int v, p;
    cin >> v >> p;
    G[0].push_back(P(p, v));
  }

  for (int i=0; i<=N; i++) D[i] = INF;
  D[0] = 0;

  priority_queue< P, vector<P>, greater<P> > q;
  q.push(P(0, 0));

  bool ok = true;

  while (!q.empty()) {
    int r = q.top().first, s = q.top().second;
    q.pop();
    if (D[s] < r) continue;

    for (auto p2 : G[s]) {
      int t = p2.second;
      if (D[t] > D[s] + p2.first) {
        if (D[t] != INF) {
          ok = false;
          break;
        }
        D[t] = D[s] + p2.first;
        q.push(P(D[t], t));
      }
    }
  }
  for (int s=1; s<=N; s++) {
    for (auto p2 : G[s]) {
      int t = p2.second;
      if (abs(D[s] - D[t]) != 1) {
        ok = false;
        break;
      }
    }
    if (!ok) break;
  }

  if (ok) {
    cout << "Yes\n";
    for (int i=1; i<=N; i++) cout << D[i] << "\n";
  }
  else {
    cout << "No\n";
  }
  return 0;
}



Measured memory_bytes: 9588
import sys

input = sys.stdin.readline

def main():
    N = int(input())
    P = []
    for i in range(N):
        X, L = map(int, input().split())
        S, T = X-L, X+L
        P.append((S, T))
    P.sort(key=lambda x: x[1])

    ans = 0
    r = -float('inf')
    for s, t in P:
        if s >= r:
            ans += 1
            r = t
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 23760
def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:]:
        phU.append(p)
        while(True):
            try :
                if isCLKWISE(phU) : break
                else : del phU[-2]
            except IndexError : break
    phL = [P[-1],P[-2]]
    for p in P[-3::-1]:
        phL.append(p)
        while(True):
            try :
                if isCLKWISE(phL) : break
                else : del phL[-2]
            except IndexError : break
    ph = phU + phL[1:-1]
    return ph
  
n = range(int(input()))
P = [[int(x) for x in input().split()] for _ in n]
Q = ConvexHullScan(P)
Q.reverse()
print(len(Q))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(Q)])[2]
R = Q[idx:] + Q[:idx]
for r in R : print(r[0],r[1])

Measured memory_bytes: 33824
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdlib>
using namespace std;
#define REP(i,n) for(int i = 0;i < (int)(n);i++)

int main() {
	char a[4];
	int ans = 700;
	cin >> a;
	if (a[0] == 'o')ans += 100;
	if (a[1] == 'o')ans += 100;
	if (a[2] == 'o')ans += 100;
	cout << ans;
	return		(0);
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
const int MOD=998244353;
#define SZ 666666
ll fac[SZ],rfac[SZ];
ll qp(ll a,ll b)
{
	ll x=1; a%=MOD;
	while(b)
	{
		if(b&1) x=x*a%MOD;
		a=a*a%MOD; b>>=1;
	}
	return x;
}
ll C(int a,int b)
{
if(b<0||b>a) return 0;
return fac[a]*rfac[a-b]%MOD*rfac[b]%MOD;}
int main()
{
	fac[0]=1;
	for(int i=1;i<SZ;++i) fac[i]=fac[i-1]*i%MOD;
	rfac[SZ-1]=qp(fac[SZ-1],MOD-2);
	for(int i=SZ-1;i;--i) rfac[i-1]=rfac[i]*i%MOD;
	int n,a,b; ll k;
	cin>>n>>a>>b>>k;
	ll ans=0;
	for(int i=0;i<=n;++i)
	{
		ll j=k-(ll)a*i;
		if(j%b) continue;
		j/=b; ans+=C(n,i)*C(n,j)%MOD;
	}
	ans=(ans%MOD+MOD)%MOD;
	cout<<ans<<"\n";
}


Measured memory_bytes: 10624
package main

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

var scanner = bufio.NewScanner(os.Stdin)
var sumValue = 0

// maxValue is the maximum int value.
const maxValue = 2e9

func next() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	num, _ := strconv.Atoi(next())
	return num
}

func nextInts(n int) [][]int {
	ints := make([][]int, n)
	for i := range ints {
		ints[i] = make([]int, 2)
	}
	for i := 0; i < n; i++ {
		ints[i][0], ints[i][1] = nextInt(), nextInt()
		sumValue = sumValue + ints[i][1]
	}
	return ints
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func main() {

	scanner.Split(bufio.ScanWords)
	n, w := nextInt(), nextInt()
	a := nextInts(n)

	// dp[i] : the minimum total weight for the exact value i
	dp := make([]int, sumValue+1)
	for i := range dp {
		dp[i] = maxValue
	}
	dp[0] = 0

	for i := 1; i <= n; i++ {
		weight := a[i-1][0]
		value := a[i-1][1]
		for j := sumValue; j >= value; j-- {
			dontChoose := dp[j]
			choose := weight + dp[j-value]
			dp[j] = min(dontChoose, choose)
		}
	}

	answer := 0
	for i := 1; i <= sumValue; i++ {
		if dp[i] <= w {
			answer = max(answer, i)
		}
	}
	fmt.Println(answer)
}


Measured memory_bytes: 1408
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func powInt(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var D, N int

func main() {
	sc.Split(bufio.ScanWords)

	D, N = nextInt(), nextInt()
	ans := powInt(100, D) * (N)
	if D == 0 && ans%100 == 0 {
		ans++
	} else if D == 1 && ans%10000 == 0 {
		ans += 100
	} else if D == 2 && ans%1000000 == 0 {
		ans += 10000
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
int h, w, d[1010][1010];
int dir[4][2]={0,1,1,0,0,-1,-1,0};
char s[1010][1010];
bool inrange(int x, int y) {
	return x>=1&&y>=1&&x<=w&&y<=h;
}
int main() {
	scanf("%d%d", &h, &w);
	queue<pair<int,int> > q;
	for(int i=1;i<=h;i++) {
		scanf("%s",s[i]+1);
		for(int j=1;j<=w;j++)
			if(s[i][j] == '#') q.push({j,i});
	}
	while(!q.empty()) {
		int x = q.front().first;
		int y = q.front().second; q.pop();
		for(int i=0; i<4; i++) {
			int tx = x + dir[i][0];
			int ty = y + dir[i][1];
			if(!inrange(tx,ty) || s[ty][tx] == '#' || d[ty][tx] != 0) continue;
			d[ty][tx] = d[y][x] + 1;
			q.push({tx, ty});
		}
	}
	int res=0;
	for(int i=1; i<=h; i++) for(int j=1; j<=w; j++)
		if(s[i][j] == '.') res = max(res, d[i][j]);
	printf("%d", res);

	return 0;
}

Measured memory_bytes: 10112
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=1e7+10;
char s[maxn];
int main(){
	scanf("%s",s+1);
	int k=read();
	REP(i,1,strlen(s+1)) if(i%k==1 || k==1) putchar(s[i]);
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n string
	fmt.Scan(&n)

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

	if (s[0] == s[1] && s[0] == s[2]) || (s[1] == s[2] && s[1] == s[3]) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

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

int main()
{
    int people, day, choco;
    cin >> people >> day >> choco;
    vector<int> a(people);
    rep(i, people)
    {
        cin >> a[i];
        int eat_day = a[i] + 1;
        for (int j = 0; a[i] * j < day; j++)
        {
            choco++;
        }
    }

    cout << choco << endl;
    
    return 0;
}

Measured memory_bytes: 256
def MI(): return map(int, input().split())
def LI(): return list(MI())

if __name__ == "__main__":
    N, M = MI()
    H = LI()
    roots = []
    for _ in range(M):
        roots.append(LI())
    result = [True] * N
    for root in roots:
        if H[root[0]-1] > H[root[1]-1]:
            result[root[1]-1] = False
        elif H[root[0]-1] < H[root[1]-1]:
            result[root[0]-1] = False
        else:
            result[root[0]-1] = False
            result[root[1]-1] = False
    print(result.count(True))

Measured memory_bytes: 31972
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=5e5+1;
int main()
{
    FASTINOUT;
    int x;
    cin>>x;
    pair<string,int>p[x];
    for (int i=0;i<x;i++){
        cin>>p[i].first>>p[i].second;
    }
    string s;
    cin>>s;
    bool b=false;
    ll ans=0;
    for (int i=0;i<x;i++){
        if (s==p[i].first){
            b=true;
        }
        else if (b){
            ans+=p[i].second;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        // 標準入力からデータを読み込む準備
        Scanner sc = new Scanner(System.in);
        // 2つの文字の固まりをそれぞれ整数値と想定して読み込む
        int a = sc.nextInt();
        int b = sc.nextInt();
        int area = a*b;
        int length = (a+b)*2;
        System.out.println(area + " " + length);
        sc.close();
    }
}


Measured memory_bytes: 25900
fun main(args: Array<String>)
{
    val n = readInt()
    val a = readNInts()

    val invA = mutableListOf<Double>()
    for (i in 0..n-1) {
        invA.add(1.0/a[i].toDouble())
    }

    var sum = 0.0
    for (item in invA) {
        sum += item
    }

    println(1.0 / sum)

    // val n = readInt()
    // val a = readNInts()

    // val prod = mutableListOf<Double>()
    // for (i in 1..n) {
    //     var tmp = 1.0
    //     for (excluded in 1..n) {
    //         tmp *= if (i == excluded) 1.0 else a[i-1].toDouble()
    //     }
    //     prod.add(tmp)
    // }
    // var allProd = 1.0
    // for (item in a) {
    //     allProd *= item.toDouble()
    // }

    // var sum = 0.0
    // for (item in prod) {
    //     sum += item
    // }

    // println(if (n == 1) a[0] else allProd/sum)

}


// Read an integer
// Usage: val a = readInt()
private fun readInt() = readLine()!!.toInt()

// Read N integers separated by " "
// Usage: val (a, b, c) = readNInts()
private fun readNInts() = readLine()!!.split(" ").map(String::toInt)

// Read a string
// Usage: val a = readString()
private fun readString() = readLine()!!


Measured memory_bytes: 38004
'use strict';

function Main(input) {
  const N = Number(input);

  if(N >= 195) {
    console.log(5);
  } else if(N >= 189) {
    console.log(4);
  } else if(N >= 165) {
    console.log(3);
  } else if(N >= 135) {
    console.log(2);
  } else if(N >= 105) {
    console.log(1);
  } else {
    console.log(0);
  }
  


};

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 7372
#include <stdio.h>

int main(void) {
	double a,b,c,d,e,f;
	double x,y;
	while(!feof(stdin)) {
		scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f);
		if(feof(stdin))break;
		x=(c*e-f*b)/(a*e-d*b);
		y=(c*d-f*a)/(b*d-e*a);
		if(x>-0.001 && x<0.001)x=0;
		if(y>-0.001 && y<0.001)y=0;
		printf("%1.3f %1.3f\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	static int N;
	static String ans;
	static String s;
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		N=cin.nextInt();
		ans=cin.next();
		int cnt=0;
		for(int i=0;i<N;i++){
			s=cin.next();
			if(c(ans,s))cnt++;
		}
		
		System.out.println(cnt);
	}
	static boolean c(String a,String s){
		if(a.equals(s))return true;
//		System.out.println(s);
		for(int i=0;i<s.length();i++){
			for(int j=0;j<=i;j++){
				String n="";
				for(int k=j;k<s.length();k+=1+i){
					n+=s.charAt(k);
				}
//				System.out.println("  "+n);
				if(n.indexOf(a)!=-1){
//					System.out.println(s);
//					System.out.println(n);
					return true;
				}
			}
		}
		return false;
	}
}

Measured memory_bytes: 57440
import java.util.Scanner;

class Main {
    private static boolean[] calcPrimeTable(int n) {
        boolean[] table = new boolean[n + 1];
        for (int i = 2; i <= Math.sqrt(n); i++) {
            if (!table[i]) {
                for (int j = i + i; j <= n; j += i) {
                    table[j] = true;
                }
            }
        }
        return table;
    }

    private static void solve() {
        boolean[] table = calcPrimeTable(1000000);
        Scanner scanner = new Scanner(System.in);
        while (true) {
            int n = scanner.nextInt();
            int counter = 0;
            if (n == 0) {
                break;
            }
            for (int i = 2; i <= n / 2; i++) {
                if (!table[i] && !table[n - i]) {
                    counter++;
                }
            }
            System.out.println(counter);
        }
    }

    public static void main(String... args) {
        solve();
    }
}

Measured memory_bytes: 13000