akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<queue>
//#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	int A[100000];
	ll S[100001];
	S[0] = 0;
	ll kari = 0;
	priority_queue<int, vector<int>, greater<int>> que;
	priority_queue<int> que2;
	int saishou = 1e9;
	int saidai = 0;
	rep(i, N) {
		int a = getint();
		que.push(a);
		S[0] += a;
		chmin(saishou, a);
	}
	rep(i, N) A[i] = getint();
	rep(i, N) {
		int a = getint();
		que2.push(a);
		kari += a;
		chmax(saidai, a);
	}

	rep(i, N) {
		if (saishou < A[i]) {
			que.push(A[i]);
			int k = que.top();
			chmax(saishou, k);
			S[i + 1] = S[i] + A[i] - k;
			que.pop();
		}
		else S[i + 1] = S[i];
	}
	ll kotae = S[N] - kari;
	for (int i = N - 1; i >= 0; i--) {
		if (saidai > A[i]) {
			que2.push(A[i]);
			int k = que2.top();
			chmin(saidai, k);
			kari += A[i] - k;
			que2.pop();
		}
		chmax(kotae, S[i] - kari);
	}

	printf("%lld", kotae);

	Would you please return 0;
}

Measured memory_bytes: 2424
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

int main() {
	string w;
	cin >> w;
	transform(w.begin(), w.end(), w.begin(), ::tolower);
	int count = 0;
	while (true) {
		string str;
		cin >> str;
		if (str == "END_OF_TEXT") break;
		transform(str.begin(), str.end(), str.begin(), ::tolower);
		if (str == w) count++;
	}
	cout << count << endl;
	return 0;
}



Measured memory_bytes: 3160
while True:
    h,w = map(int,input().split())
    if(h+w == 0):
        break
    li = list()
    for i in range(h):
        s = input()
        li.append(s)
    d = dict()
    for i,l in enumerate(li):
        for j,char in enumerate(l):
            d[char] = (i,j)
    target = input()
    ans = 0
    now = (0,0)
    for t in target:
        next = d[t]
        ans += abs(now[0]-next[0]) + abs(now[1]-next[1])
        now=next
    print(ans + len(target))


Measured memory_bytes: 5612
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define fir first
#define sec second
#define mod 998244353
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
int add(int x,int y){return x+y>mod?x+y-mod:x+y;}
int sub(int x,int y){return x-y<0?x-y+mod:x-y;}

signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int H,A;
	cin>>H>>A;
	cout<<(H+A-1)/A<<endl;
#ifdef __LOCAL__
	cout<<"Time Used : "<<clock()<<endl;
#endif
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
const int mxn = 100010;
const ll mod = 1e9+7;
ll dp[2][mxn];
int sz[mxn];
vector<int> adj[mxn];

void dfs(int v, int p)
{
	dp[0][v] = dp[1][v] = 1ll;
	for(auto x:adj[v])
		if(x!=p) dfs(x, v);
	for(auto x:adj[v])
		if(x!=p) 
		{
			dp[0][v]*=(dp[0][x]+dp[1][x])%mod, dp[0][v]%=mod;
			dp[1][v]*=dp[0][x], dp[1][v]%=mod;
		}
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int N; cin>>N;
	for(int i=0; i<N-1; i++)
	{
		int u, v; cin>>u>>v;
		adj[v].push_back(u); adj[u].push_back(v);
	}
	int root = N;
	dfs(root, -1);
	ll ret = (dp[0][root]+dp[1][root])%mod;
	cout << ret << '\n';
	return 0;
}

Measured memory_bytes: 12416
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

int main() {
  string s;
  cin>>s;
  int ans = 0;
  int temp = 0;
  for(int i=0;i<s.length();i++){
    if(s[i]=='A'||s[i]=='T'||s[i]=='G'||s[i]=='C'){
        temp++;
    }else{
        ans=max(ans,temp);
        temp = 0;
    }
  }
  ans=max(ans,temp);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip> 
#include <cstdlib>
#include <cmath>
#include<map>
#include<string.h>
#include <algorithm>
#include <bits/stdc++.h> 
#include<vector>
 
using namespace std;
#define rep(i,a,b)    for(long long int i=a;i<b;i++)
#define repn(i,a,b)   for(long long int i=a;i>=b;i--)
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vl vector<long long int>
#define F first
#define S second
#define sortA(arr)   sort(arr.begin(),arr.end())
#define sortC(arr,n)   sort(arr,arr+n,comparefunc())
#define search(arr,c)  binary_search(arr.begin(),arr.end(),c)
#define pb   push_back
#define ll long long int
#define LCM(a,b) boost::math::lcm(a,b)
#define mp make_pair
#define pll pair<long long int,long long int>
 vb isprime(1e6+6,true);
 
struct node{
     ll val;
     ll index;
    
};
        
void Sieve(ll maxn){ 
    ll j;isprime[0]=isprime[1]=false;
    rep(i,2,sqrt(maxn)+1)
    {
        if(isprime[i]){
            for(j=i*i;j<=maxn;j+=i){
                isprime[j]=false;
            }
        }
    }
} 
 struct comparefunction{
bool operator()(const pll c,const pll d)const{
    ll lenc=c.second-c.first+1;
    ll lend=d.second-d.first+1;
    if(lenc!=lend)
    return lenc>lend;
    else
    return c.first<d.first;
   
     
}};
 bool cmp(node a,node b){
     if(a.val!=b.val)
     return a.val<b.val;
     if(a.index!=b.index)
     return a.index<b.index;
 }
  


 void dfs2(ll v,vi adj[],ll e) {
  //  vis[v] = true;
  
        //cout<<v<<"\n";}
    
    for (int u : adj[v]) {
       
       if (u==e)
       continue;
            dfs2(u,adj,v);
        
           
            
    }
    
   
    
}

 
 ll modpow(ll x, ll n,ll p){
     if(n==0)
     return 1;
     if(n==1)
     return x%p;
     if(n%2==0)
     return (modpow(x,n/2,p)%p)*(modpow(x,n/2,p)%p);
     else
     return (x%p)* (modpow(x,n/2,p)%p)*(modpow(x,n/2,p)%p);
 }
 vb vis(1e5+1,false);
 void bfs(int v,vi adj[]){
     queue <int> q;
     q.push(v);
     vis[v]=true;
     while(!q.empty()){
         ll s=q.front();
         q.pop();
         for(auto x: adj[s]){
             if(!vis[x]){
                 vis[x]=true;
                 cout<<x<<" "<<s<<"\n";
                 q.push(x);
             }
         }
     }//cout<<vis[1]<<"\n";
 }


 
 
 void solve(){
ll n,k;
cin>>n;
if(n%1000==0)
cout<<"0\n";
else
cout<<1000-(n%1000)<<"\n";





}
int main()
{
    
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
    ll t;
   //cin>>t;
//while(t--){
    solve();

 //}
    
}
  



 
   
 
 

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
#define i64 long long
#define input freopen("input.txt", "r", stdin)
#define output freopen("output.txt", "w", stdout)
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0);
#define pi 2.0*acos(0.0)
#define mp make_pair
#define pii pair<int,int>
#define pss pair<string,string>
#define fi first
#define se second
#define pb push_back
#define sortVA(v) sort(v.begin(),v.end())
#define sortVD(v) sort(v.begin(),v.end(),greater<int>())
#define ASC(a,n) sort(a,a+n);
#define DESC(a,n) sort(a,a+n,greater<int>());
#define out(x) cout <<x<<endl
#define outt(x,y) cout <<x<<" "<<y<<endl
#define mem(array,value) memset(array,value,sizeof(array))
int main()
{
    fast_io
    int x,a,b;
    cin >>x>>a>>b;
    int baki= x-a;
    int k = baki/b;
    out(baki-(k*b));
    return 0;
}






Measured memory_bytes: 256
N = int(input())

if N%4==0 or N%7==0:
    print("Yes")
    exit()


for i in range(25):
    if (N - (i+1)*4) < 0:
        print("No")
        break
    if ((N - (i+1)*4) % 7)==0:
        print("Yes")
        break

Measured memory_bytes: 3060
from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
a.sort()
center = len(a) // 2
cnt = 0
for i in range(1, 10 ** 5 + 1):
    if a[center - 1] < i <= a[center]:
        cnt += 1
print(cnt)


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

const int MAXN = 300010;

int n, k, a[MAXN];
int dp[MAXN];

int main()
{
	scanf("%d", &n);
	k = (1 << n);
	for(int i = 0; i < k; ++i) scanf("%d", &a[i]);
	dp[1] = a[0] + a[1];
	for(int i = 2; i < k; ++i)
	{
		int mx1 = 0, mx2 = 0;
		for(int j = i; ; j = (j - 1) & i)
		{
			if(a[j] > mx1) mx2 = mx1, mx1 = a[j];
			else if(a[j] > mx2) mx2 = a[j];
			if(!j) break;
		}
		dp[i] = max(dp[i - 1], mx1 + mx2);
	}
	for(int i = 1; i < k; ++i) printf("%d\n", dp[i]);
	return 0;
}

Measured memory_bytes: 5120
n = int(input())
tmp = 0
if(n == 1 or n == 2): print(4) 
else:
    while n != 4:
        if(n%2 == 0):
            n /= 2
        else:
            n = 3*n +1
        tmp+=1
        #print(n)
    print(tmp+4)

Measured memory_bytes: 2940
/*https://atcoder.jp/contests/abc094/tasks/abc094_b*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	int n, m, x, a[100], b[100], costA = 0, costB = 0;
	cin >> n >> m >> x;
	for (int i = 0; i < n; i++)
		b[i] = 0;
	for (int i = 0; i < m; i++)
		cin >> a[i], b[a[i] - 1] = 1;
	for (int i = x - 1; i < n; i++)
		costA += b[i];
	for (int i = x - 1; i >= 0; i--)
		costB += b[i];
	cout << min(costA, costB);
}

Measured memory_bytes: 3628
import numpy as np

N = int(input())

V = np.array(list(map(int,input().split())))
C = np.array(list(map(int,input().split())))
XY = V - C

ans = 0

for i in range(len(XY)):
    if XY[i] > 0:
        ans += XY[i]

print(ans)

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

int main(){
  int n,q,m,i,j,memo;
  while(1){
    int x[1000]={0};
    int day[150]={0};
  cin >> n >> q;
  if(n==0 && q==0)break;
  for(i = 0; i < n; i++){
    cin >> m;
    for(j = 0; j < m; j++){
      cin >> x[j];
      day[x[j]]++;
    }
  }
  int min=100;
  memo = 0;
  for(i = 1; i <= 149; i++){
    if(day[i]>=q){
       if(day[i]>memo){
      	memo = day[i];
	min = i;
	//	break;
	 }
    }
  }
  
  if(min==100){
    cout << "0" << endl;
  }else{
    cout << min << endl;
  }
  }
  return 0;
}

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

int main(){
    string str;
    cin >> str;
    if(str[2] == str[3] && str[4] == str[5]){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#a = gets.split(" ").map{|x| x.to_i}
=begin
s = gets.chomp
if s == "Sunny"
  puts "Cloudy"
elsif s == "Rainy"
  puts "Sunny"
else
  puts "Rainy"
end
=end

=begin
s = gets.chomp.split("")

guusuu = 0
flag = 0
(s.size).times do |i|
  if guusuu == 0
    if s[i] == "L"
      flag = 1
      break;
    end
    guusuu = 1

  else
    if s[i] == "R"
      flag = 1
      break;
    end
    guusuu = 0
  end
end

if flag == 0
  puts "Yes"
else
  puts "No"
end
=end

nkq = gets.split(" ").map{|x| x.to_i}
n = nkq[0]
k = nkq[1]
q = nkq[2]

point = Array.new(n, k)
hito = Array.new(n, 0)

sum = 0
q.times do |i|
  hito[gets.to_i - 1] += 1
end

n.times do |i|
  sum += hito[i]
end

n.times do |i|
  if k - sum + hito[i] <= 0
    puts "No"
  else
    puts "Yes"
  end
end


Measured memory_bytes: 3964
#include <iostream>
#include <algorithm>
using namespace std;
int n,m,x,y; int xx[100],yy[100];
int main()
{
  cin>>n>>m>>x>>y;
  for (int i = 0;i<n;i++)
    cin >> xx[i];
  for (int i = 0; i < m;i++)
    cin >> yy[i];
  sort(xx, xx + n);
  sort(yy, yy + m);
  int a = max(x, xx[n - 1]);
  if (a < yy[0] && y>xx[n-1])
  {
    cout << "No War" << endl;
    return 0;
  }
  else
    cout << "War" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int n,i,a;
    int max = 0, min = 1000000000;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a);
        if(a>max){
            max = a;
        }
        if(a<min){
            min = a;
        }
    }
    printf("%d",max-min);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#define PI 3.141592653589793238
using namespace std;
int main()
{
  long long n,m,sum;
  cin>>n>>m;
  int a[m];
  for(int i=0;i<m;i++)
  {
    cin>>a[i];
  }
sum=0;
for(int i=0;i<m;i++)
  {
    sum = sum + a[i];
  }

if(sum<=n)
cout<<n-sum;
else
cout<<"-1";
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define rrep(i,a,b) for(int i = b; i --> (a);)
#define all(v) v.begin(),v.end()
#define trav(x,v) for(auto &x : v)
#define sz(v) (int)(v).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

int main(){
	
	ll n,a,b,c,d;
	cin >> n >> a >> b >> c >> d;
	b -= a;
	//ga fran 0 till b
	int s = n-1;
	rep(i,0,s+1){
		ll j = s-i;
		if(i*c - j*d <= b && b <= i*d - j*c){
			puts("YES");
			return 0;
		}
	}
	puts("NO");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S moddw_L(S a, const T b){
  a %= b;
  if(a < 0){
    a += b;
  }
  return a;
}
int K;
int X;
int Y;
int cx;
int cy;
int ress;
int resx[200000];
int resy[200000];
int main(){
  int dx, dy, fx, fy, i, j, r, res;
  rd(K);
  rd(X);
  rd(Y);
  if(K%2 == 0 &&moddw_L((X+Y),2)== 1){
    wt_L(-1);
    wt_L('\n');
    return 0;
  }
  while(X != cx || Y != cy){
    dx = abs(cx - X);
    dy = abs(cy - Y);
    if(cx < X){
      fx =1;
    }
    else{
      fx =-1;
    }
    if(cy < Y){
      fy =1;
    }
    else{
      fy =-1;
    }
    if(dx+dy == K){
      cx = X;
      cy = Y;
    }
    else if( dx+dy >= 2*K || (K%2==1 && (dx+dy)%2==1) ){
      i =min_L(K, dx);
      cx += fx * i;
      cy += fy * (K - i);
    }
    else{
      r = (2*K - dx - dy) / 2;
      if(dx <= K - r){
        i = dx + r;
        j = K - i;
      }
      else{
        j = dy + r;
        i = K - j;
      }
      cx += fx * i;
      cy += fy * j;
    }
    resx[ress] = cx;
    resy[ress] = cy;
    ress++;
  }
  wt_L(ress);
  wt_L('\n');
  for(i=0;i<ress;i++){
    wt_L(resx[i]);
    wt_L(' ');
    wt_L(resy[i]);
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// int K, X, Y;
// 
// int cx, cy;
// int ress, resx[200000], resy[200000];
// 
// {
//   int i, j, r, res;
//   int dx, dy, fx, fy;
//   rd(K,X,Y);
// 
//   if(K%2 == 0 && (X+Y)%%2 == 1){
//     wt(-1);
//     return 0;
//   }
// 
//   while(X != cx || Y != cy){
//     dx = abs(cx - X);
//     dy = abs(cy - Y);
//     fx = if[cx < X, 1, -1];
//     fy = if[cy < Y, 1, -1];
// 
//     if(dx+dy == K){
//       cx = X;
//       cy = Y;
//     } else if( dx+dy >= 2K || (K%2==1 && (dx+dy)%2==1) ){
//       i = min(K, dx);
//       cx += fx * i;
//       cy += fy * (K - i);
//     } else {
//       r = (2K - dx - dy) / 2;
// 
//       if(dx <= K - r){
//         i = dx + r;
//         j = K - i;
//       } else {
//         j = dy + r;
//         i = K - j;
//       }
// 
//       cx += fx * i;
//       cy += fy * j;
//     }
// 
//     resx[ress] = cx;
//     resy[ress] = cy;
//     ress++;
//   }
// 
//   wt(ress);
//   rep(i,ress) wt(resx[i], resy[i]);
// }


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

using namespace std;

long int n, k;
long int w[(int)1e5];

int check(int p) {
  int count = 0;
  int size = 0;

  for (int i = 0; i < n; i++) {
    if(size + w[i] > p) {
      count++;
      size = w[i];
    } else {
      size += w[i];
    }
  }

  return count + 1;
}

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

  long int sum = 0;
  long int m = 0;
  for (int i = 0; i < n; i++) {
    cin >> w[i];
    m = max(m, w[i]);
    sum += w[i];
  }

  int p = max(m, sum/k);
  while(true) {
    if(check(p) <= k) {
      cout << p << endl;
      break;
    }

    p++;
  }

  return 0;
}



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

int main(){
  int D, N; cin >> D >> N;
 
	int S = 1; for (int i = 0; i < D; i++) S *= 100;
	if (N <= 99) {
		cout << S * N << endl;
	}
	else {
		cout << S * 101 << endl;
	}
	return 0;
}

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

signed main() {
	int a, b;
	cin >> a >> b;
	if(a * b % 2 == 0) {
		cout << "Even" << endl;
	}
	else {
		cout << "Odd" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

int n, bit[N];

void update(int idx, int val) {
	while(idx <= n) {
		bit[idx] = max(bit[idx], val);
		idx += idx & -idx;
	}
}

int prefMax(int idx) {
	int ans = -2e9;
	while(idx > 0) {
		ans = max(ans, bit[idx]);
		idx -= idx & -idx;
	}
	return ans;
}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	cin >> n;
	int h[n + 1], a[n + 1];
	for(int i = 1; i <= n; i++) {
		cin >> h[i];
	}
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for(int i = 1; i <= n; i++) {
		if(h[i] == 1) {
			update(h[i], a[i]);
		}
		else {
			int mx = prefMax(h[i] - 1);
			update(h[i], mx + a[i]);
		}
	}
	cout << prefMax(n);

	return 0;
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}


template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

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




template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;

    set<char> dir;

    rep(i, s.size()){
        dir.insert(s[i]);
    }

    Judge(dir.count('N') == dir.count('S') && dir.count('W') == dir.count('E'));


    return 0;
}


Measured memory_bytes: 256
#define rep(i,n) for (int i = 0; i < n; i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 1e18;


int main() {
	int a, b, c, d, e; cin >> a >> b >> c >> d >> e;
	int ans = min(a*d + b * e, max(d, e)*c * 2);
	if (d > e) ans = min(ans, 2 * c*e + (d - e)*a);
	else ans = min(ans, 2 * c*d + (e - d)*b);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
ll N;
  cin>>N;
  string S=to_string(N);
  ll A=0;
 for(auto x:S) {
A+=x-'0';
 }
  if(N%A==0) {
cout<<"Yes"<<endl;
  }
  else {
cout<<"No"<<endl;
  }
}
  
  

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x, n;
    cin >> x >> n;
    map<int,int>a;
    int k;
    for(int i=0;i<n;i++){cin >> k;a[k]=1;}
    if(n==0) cout << x ;
    else
    {
        for(int i=x,j=x;;i--,j++)
        {
            if(a[i]==0) {cout <<i;break;}
            else if(a[j]==0) {cout<< j;break;}
        }
    }
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD;
#define MODSUB(SUB_X,SUB_Y)  (SUB_X-SUB_Y)+MOD)%MOD;
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD;
#define LCM(LCM_X,LCM_Y) (LCM_X*LCM_Y)/__gcd(LCM_X,LCM_Y);
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};
int arr[MAX],ans[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);

    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>arr[i];
    }
    vector<int>v;
    for(int i=n; i>=1; i--)
    {
        int cnt=0;
        for(int j=i*2; j<=n; j+=i)
        {
            cnt+=ans[j];
        }
        if((cnt%2)!=arr[i])
        {
            ans[i]=1;
            v.push_back(i);
        }
    }
    cout<<v.size()<<endl;
    for(auto i:v)
        cout<<i<<" ";




    return 0;
}


Measured memory_bytes: 5296
K, N = map(int, input().split())
A = list(map(int, input().split()))

distance = []
for i in range(N):
    if i != N-1:
        diff = A[i+1] - A[i]
    else:
        diff = K - A[i] + A[0]
    distance.append(diff)

del distance[distance.index(max(distance))]

print(sum(distance))

Measured memory_bytes: 32252
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;
int N;
int mount;
int tallest=0;
int num=0;

signed main(void) {
cin >> N;
rep(i,N){
    cin >> mount;
    if(mount>=tallest){
        num++;
        tallest= mount;
    }
}
cout << num <<endl;


    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);



int main(){
	FAST_IO
	
	int N; cin >> N;
	vector<LL> lucas(90);
	lucas[0] = 2, lucas[1] = 1;
	for(int idx = 2; idx <= N; ++idx) lucas[idx] = (lucas[idx - 1] + lucas[idx - 2]);
	
	cout << lucas[N] << "\n"; 
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
    int n, t, ci[10000], ti[10000], i, c, a;
    
    scanf("%d%d",&n,&t);
    for(i=0;i<n;i++) scanf("%d%d",&ci[i],&ti[i]);
    
    c=10000;
    for(i=0;i<n;i++){
        if((ti[i]<=t)&&(ci[i]<c)){
            c=ci[i];
            a=i;
        }
    }
    if(c==10000) printf("TLE\n");
    else printf("%d\n",ci[a]);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;

vector< pair< string,int> > abc(int N){
    vector< pair < string,int> > a,b;
    if(N==1){
        string c="a";
        a.push_back(make_pair(c,1));
    }else{
        b=abc(N-1);
        for(int i=0; i<b.size(); i++){
            string d=b.at(i).first;
            int f=b.at(i).second;
            char e='a';
            for(int j=0; j<=f; j++){
                int h=f;
              	if(j==f) h++;
                string g = d;
                g+=e;
                a.push_back(make_pair(g,h));
                e++;
            }
        }
    }
    return a;
}

int main(){
    int N;
    cin >> N;
    vector< pair < string,int> > a;
    a=abc(N);
    for(int i=0; i<a.size(); i++){
        cout << a.at(i).first << endl;
    } 
    return 0;
}

Measured memory_bytes: 10080
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    vector<ll> v(5);
    rep(i, 5) {
        cin >> v[i];
    }
    sort(all(v));
    ll mi = MOD;
    do {
        ll sum = 0;
        for(ll i = 0; i < 5; i ++) {
            while(sum % 10 != 0) sum++;
            sum += v[i];
        }
        mi = min(mi, sum);
    } while(next_permutation(all(v)));
    print(mi);
    return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    a, b = map(int, input().split())
    r = 0
    for i1 in range(a, b + 1):
        stri1 = str(i1)
        r += stri1 == stri1[::-1]

    print(r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9164
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, k = map(int, input().split())
    H = sorted(list(int(input()) for _ in range(n)))

    res = f_inf
    for i in range(n - k + 1):
        diff = H[i + k - 1] - H[i]
        res = min(res, diff)

    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 8260
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

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

int main(){
    int m1,d1,m2,d2;
    cin >> m1 >> d1;
    cin >> m2 >> d2;

    if(d2 - d1 != 1){
        cout << 1 << endl;
    }else {
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
li = gets.split.map(&:to_i)
li.sort!
material = (li[0] + li[1]) / 2.0
if n < 3
  puts material
else
  for i in (2..n-1)
    material = (material + li[i]) / 2.0
  end
  puts material
end


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n=5;
  REP(i, n){
    int x;
    cin>>x;
    if(x==0){
      cout<<i+1<<'\n';
    }
  }
  return 0;
}


Measured memory_bytes: 3608
#include<stdio.h>

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

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

  int ans=0;
  for(int i=1;i<=N;i++){
    if(i%2==1){
      if(a[i]%2==1){
	ans++;
      }
    }
  }

  printf("%d\n", ans);
  
  return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
#define ll long long
bool check(ll c[],ll x,ll k,ll n,ll a[])
{
    for(ll i=0;i<n;i++)
    {
        if(c[i]>x)
        {
            long double temp=double((c[i]-x))/double(a[i]);
           // cout<<temp<<endl;
            k=k-ceil(temp);
        }
    }
    return k >= 0;
}

void binarySearch(ll arr[],ll c[], ll l, ll r, ll& x,ll k,ll n) {
    if (r >= l) {
        ll mid;
        mid = (l + r) / 2;
        if (check(c, mid, k, n, arr)) {
            x = mid;
            binarySearch(arr, c, l, mid-1 , x, k, n);

        } else {
            binarySearch(arr, c, mid+1, r, x, k, n);

        }


    }
}
int main() {
    ll n,k;
    cin>>n>>k;
    ll a[n];
    ll b[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(ll j=0;j<n;j++)
    {
        cin>>b[j];
    }
    sort(a,a+n);
    sort(b,b+n,greater<>());
    ll c[n];
    for(ll i=0;i<n;i++)
    {
        c[i]=a[i]*b[i];
    }
    ll ans=0;
    binarySearch(b,c,0,100000000000000000,ans,k,n);
//    priority_queue<pair<ll,ll>> c;
//    for(ll i=0;i<n;i++)
//    {
//        c.push(make_pair(a[i]*b[i],i));
//    }
//    for(ll i=0;i<k;i++)
//    {
//        ll x=c.top().first;
//        ll y=c.top().second;
//        if(x-b[y]>=0)
//        {
//            c.pop();
//            c.push(make_pair(x-b[y],y));
//        }
//    }
//    cout<<c.top().first<<endl;
cout<<ans<<endl;
//cout<<check(c,1,k,n,b);

    return 0;
}

Measured memory_bytes: 4992
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        x: usize,
        y: usize,
    }

    let mut cnt = 0;
    let mut ret = 1;
    loop {
        debug!(cnt);
        debug!(ret);
        if y/x >= ret {
            cnt += 1;
            ret *= 2;
        } else {
            break;
        }
    }

    println!("{}", cnt);

}


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

using namespace std;


template< typename T >
struct edge
{
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
template< typename T >
using UnWeightedGraph = vector< vector< T > >;
template< typename T >
using Matrix = UnWeightedGraph< T >;


struct UnionFind
{
  vector< int > data;

  UnionFind(int sz)
  {
    data.assign(sz, -1);
  }

  bool unite(int x, int y)
  {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }

  int find(int k)
  {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k)
  {
    return (-data[find(k)]);
  }
};

template< class T >
T kruskal(Edges< T > &edges, int V)
{
  sort(begin(edges), end(edges), [](const edge< T > &a, const edge< T > &b)
  {
    return (a.cost < b.cost);
  });
  UnionFind tree(V);
  T ret = 0;
  for(auto &e : edges) {
    if(tree.unite(e.src, e)) ret += e.cost;
  }
  return (ret);
}

int main()
{
  int V, E;
  cin >> V >> E;
  Edges< int > g;
  for(int i = 0; i < E; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    g.emplace_back(x, y, z);
  }
  cout << kruskal(g, V) << endl;
}


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

using namespace std;

using ll = long long;

constexpr char newl = '\n';

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

    ll n, x, m;
    cin >> n >> x >> m;

    vector<ll> memo(m + 10, x % m);
    vector<ll> sums(m + 11, 0);
    map<ll, int> ids;
    ids[memo[0]] = 0;
    ll ans = 0;
    for (ll i = 1; i <= m + 9; i++) {
        sums[i] = sums[i - 1] + memo[i - 1];
        if (i == n) {
            ans = sums[i];
            break;
        }

        memo[i] = memo[i - 1] * memo[i - 1] % m;
        if (ids.find(memo[i]) != ids.end()) {
            n -= ids[memo[i]];
            ll hoge = i - ids[memo[i]];
            ll loop_num = n / hoge;
            ans = sums[ids[memo[i]]] + loop_num * (sums[i] - sums[ids[memo[i]]]) + (sums[ids[memo[i]] + n % hoge] - sums[ids[memo[i]]]);
            break;
        }
        ids[memo[i]] = i;
    }
    cout << ans << newl;

    return 0;
}

Measured memory_bytes: 7892
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    
    vector<int> C(13, 0);
    C[0] = 1;
    rep(i, N){
        int a;
        cin >> a;
        C[a]++;
    }
    
    if(C[0] >= 2 || C[12] >= 2){
        output(0);
        return 0;
    }
    rep(i, 1, 12){
        if(C[i] >= 3){
            output(0);
            return 0;
        }
    }
    
    vector<int> tmp(24, 0);
    tmp[0] = 1;
    rep(i, 1, 12){
        if(C[i] == 2){
            tmp[i] = tmp[24 - i] = 1;
        }
    }
    if(C[12]){
        tmp[12] = 1;
    }
    
    rep(i, 1, 12){
        if(C[i] == 0){
            tmp[i] = tmp[24 - i] = -1;
        }
    }
    if(C[12] == 0){
        tmp[12] = -1;
    }
    
    int ans = 0;
    rep(i, (1 << 11)){
        vector<int> B = tmp;
        rep(j, 11){
            if(B[j + 1] == 0){
                if((i >> j) & 1){
                    B[j + 1] = 1;
                }
                else {
                    B[23 - j] = 1;
                }
            }
        }
        
        
        vector<int> C;
        rep(j, 24){
            if(B[j] == 1){
                C.pb(j);
            }
        }
        int m = 12;
        rep(k, 1, C.size()){
            m = min(m, C[k] - C[k - 1]);
        }
        m = min(m, 24 - C.back());
        ans = max(ans, m);
    }
    
    output(ans);
    
    
    
    return 0;
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

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


void solve()
{
    ll X, Y; cin >> X >> Y;
    ll A = X;
    int ans = 1;
    while(A <= Y)
    {
        A = A * 2;
        ans++;   
    }
    cout << ans-1 << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

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

void DBG() { cerr << endl; }
template<typename Head, typename... Tail>
void DBG(Head H, Tail... T) { cerr << ' ' << H; DBG(T...); }
#ifdef NAIM
#define dbg(...) cerr << "(" << (#__VA_ARGS__) << "):", DBG(__VA_ARGS__)
#else 
#define dbg(...)
#endif

template<typename... Args>
void read(Args&... args) { ((cin >> args), ...); }

template<typename... Args>
void show(Args... args) { ((cout << args << " "), ...); }

#define ll long long
#define ints(a...) int a; read(a)
#define IN(a) for (auto &it : a) cin >> it

void solve() {
    ll a;
    string b;
    read(a, b);
    int pos = b.find('.');
    b = b.substr(0, pos) + b.substr(pos + 1, 2);
    show(a * stoi(b) / 100); 
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1; 
    // cin >> T;
    while (T--) solve();
    return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<map>
#include<stack>
#include<set>
#include<queue>
#include<vector>
#include<stdlib.h>

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cstdlib>

#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int maxn=2e5+100;
const int mod=1e9+7;
int n,a[maxn],b[maxn];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=n;i>=1;i--)
		cin>>b[i];
	for(int i=1;i<=n;i++){
		if(a[i]==b[i]){
			bool flag=0;
			for(int j=1;j<=n;j++){
				if(b[j]!=a[i]&&b[i]!=a[j]){
					swap(b[i],b[j]);
					flag=1;
					break;
				}
			}
			if(!flag){
				cout<<"No";
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
	for(int i=1;i<=n;i++) cout<<b[i]<<" ";
	system("pause");
    return 0;
}

Measured memory_bytes: 5212
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<sstream>
#include<queue>
#include<set>
#include<cmath>
#define LL long long
#define INF 0x3f3f3f3f
using namespace std;
int dp[105][105];
int T;
int n,v;
int k;
int a[100000+100];
int gcd(int c,int d)
{
    return d==0?c:(gcd(d,c%d));
}
int main()
{
    while(~scanf("%d%d",&n,&k))
    {
        int mx = -1;
        for(int i = 0;i<n;i++)
        {
            scanf("%d",&a[i]);
            mx =max(a[i],mx);
        }
        int tmp = a[0];
        for(int i = 1;i<n;i++)
        {
                tmp = gcd(tmp,a[i]);
        }
        if(k%tmp==0&&mx>=k){
            puts("POSSIBLE");
        }
        else
            puts("IMPOSSIBLE");
    }
}


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

int main() {
  int N; cin >> N;
  vector<int> a(N); for (int i = 0; i < N; ++i) cin >> a[i];
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    while(a[i] % 2 == 0) {
      ++ans;
      a[i] /= 2;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()

int main() {
   string s;
   cin >> s;
   string ans="AC";
   if(s[0]!='A')
   ans="WA";

   int cnt=0;
   for(int i=2;i<s.size()-1;i++){
      if(s[i]=='C')
      cnt++;
   }
   if(cnt!=1)
   ans="WA";

   cnt=0;
   rep(i,s.size()){
      if(s[i]>='A'&&s[i]<='Z')
      cnt++;
   }
   if(cnt!=2)
   ans="WA";

   cout << ans << endl;  
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int n,X; cin >> n >> X;
    vl x(n);
    rep(i,n)cin>>x[i];
    ll res = 0;
    rep(i,n){
        res = __gcd(res,abs(X-x[i]));
    }
    out(res);
}


Measured memory_bytes: 1024
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	public static void Main()
	{
		long N = GetLong();
		long[,] gsb = new long[2, 3];
		for(int i = 0; i < 2; i++)
			for(int j = 0; j < 3; j++)
				gsb[i, j] = GetLong();

		long[] dpAB = new long[N + 1];
		long maxAB = long.MinValue;
		for(long i = 1; i <= N; i++)
		{			
			dpAB[i] = i;
			for(int j = 0; j < 3; j++)
			{
				if(i < gsb[0, j])
					continue;

				dpAB[i] = Math.Max(dpAB[i], dpAB[i - gsb[0, j]] + gsb[1, j]);
			}			
			maxAB = Math.Max(maxAB, dpAB[i]);
		}

		long[] dpBA = new long[maxAB + 1];
		long maxBA = long.MinValue;
		for(long i = 1; i <= maxAB; i++)
		{
			dpBA[i] = i;
			for(int j = 0; j < 3; j++)
			{
				if(i < gsb[1, j])
					continue;

				dpBA[i] = Math.Max(dpBA[i], dpBA[i - gsb[1, j]] + gsb[0, j]);
			}
			maxBA = Math.Max(maxBA, dpBA[i]);
		}

		Console.WriteLine(maxBA);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}





Measured memory_bytes: 206176
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<long long> tab(n);
	for(int i = 0; i < n; i++){
        cin >> tab[i];
	}
	sort(tab.begin(), tab.end());
	long long a = 0, b = 0;
	for(int i = 0; i < n-1; i++){
        if(tab[i] == tab[i+1]){
            if(a < b){
                a = tab[i];
            }
            else{
                b = tab[i];
            }
            i++;
        }
	}
	cout << (long long)a*b << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
	int a[10],s,d,f,i;
	for(i=1;i<=10;i++){
		scanf("%d",&a[i]);
	}
	for(i=1;i<=10;i++){
		for(f=i+1;f<=10;f++){
			if(a[i]<a[f]){
				s=a[i];
				a[i]=a[f];
				a[f]=s;
			}
		}
	}
	printf("%d\n",a[1]);
	printf("%d\n",a[2]);
	printf("%d\n",a[3]);
	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char C;
  cin >> C;
  if (C == 'a' || C == 'i' || C == 'u' || C == 'e' || C == 'o')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
  
}

Measured memory_bytes: 256
a, b, c, x, y = [int(x) for x in input().split()]

if x <= y:
    ans = min(a + b, 2 * c) * x
    ans += min(b, 2 * c) * (y - x)
else:
    ans = min(a + b, 2 * c) * y
    ans += min(a, 2 * c) * (x - y)

print(ans)

Measured memory_bytes: 3060
#include<cstdio>
#include<cstring>
#include<algorithm>
long long int dp[10][1000][101],sum;
using namespace std;
int main(void)
{
	int i,j,k,ii,n,s;
	while(1)	{
		scanf("%d %d",&n,&s);
		if(n==0 && s==0)	break;
		for(i=0;i<=n;i++)
			for(j=0;j<=s;j++)	
				for(k=0;k<=100;k++)	dp[i][j][k]=0;
		for(i=0;i<=100;i++)	{
			if(i<=s)	dp[0][i][i]=1;
		}
		for(i=0;i<n-1;i++)	{
			for(j=0;j<s;j++)	{
				for(k=0;k<100;k++)	{
					for(ii=k+1;ii<=100;ii++)	{
						if(dp[i][j][k]!=0)	{
							if(j+ii>s)	break;
							else {
								dp[i+1][j+ii][ii]+=dp[i][j][k];
							}
						}
					}
				}
			}
		}
/*		for(i=0;i<=n;i++)	{
			for(j=0;j<=s;j++)	{
				for(k=0;k<=6;k++)	{
					printf("%lld",dp[i][j][k]);
				}
				printf("  ");
			}
			printf("\n");
		}
*/		
		
		sum=0;
		for(k=0;k<=100;k++)	sum+=dp[n-1][s][k];
		printf("%lld\n",sum);
	}
	
	return 0;
}


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

typedef long long ll;
typedef pair<ll, ll> pll;

vector<pll> divs(ll n) {
    vector<pll> res;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            ll cnt = 0;
            while (n % i == 0) {
                cnt++;
                n /= i;
            }
            res.push_back({i, cnt});
        }
    }

    if (n > 1)
        res.push_back({n, 1});

    return res;
}

ll power(ll n, ll m) {
    ll res = 1;
    if (m) {
        res = power(n, m / 2);
        res = res * res;
        if (m % 2)
            res *= n;
    }
    return res;
}

int main() {
    ll n, p;
    cin >> n >> p;
    vector<pll> v = divs(p);
    ll ans = 1;
    
    for (int i = 0; i < v.size(); i++)
        ans *= power(v[i].first, v[i].second / n);

    cout << ans << '\n';
    return 0;
}



Measured memory_bytes: 256