akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */

string task3()
{
    string str;
    size_t k;
    cin >> str >> k;

    for(size_t i = 0; i < str.size(); ++ i)
        if(str[i] != 'a' && 'z' < k + str[i])
        {
            k -= 'z' - str[i] + 1;
            str[i] = 'a';
        }

    {
        const auto i = str.find('a');
        if(i != string::npos)
            k %= 26;
    }

    str.back() += k;
    if('z' < str.back())
        str.back() -= 'z';

    return str;
}

int main(const int argc, char * argv [])
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout << task3() << '\n';

    return EXIT_SUCCESS;
}


Measured memory_bytes: 592
#include <stdio.h>
#include <iostream>
int main()
{
    char s[4];
    scanf("%s",s);
    bool flag=0;
    int i,c=1;;
    for(i=0; i<3; i++){
        if(s[i]==s[i+1]){
            c++;
        }
        else{
            c=1;
        }
        if(c==3){
            flag=1;
            break;
        }
    }
    if(flag){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i < n - 2; i++) {
        if (s[i] == 'A' and s[i + 1] == 'B' and s[i + 2] == 'C') {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

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

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

    int v[n],c[n];
    for(i,n)
    cin>>v[i];

    for(i,n)
    cin>>c[i];

    int sum = 0;
    for(i,n){
        if(v[i] - c[i] > 0)
        sum += v[i] - c[i];
    }

    cout<<sum<<endl;
}

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

int main()
{
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  
  if(k >= (a + b)){
   int ans1 = a - (k - a - b);
   cout << ans1;
  }
  
  else if(a <= k){
   int ans2 = a;
   cout << ans2;
  }
  
  else if(k < a){
   int ans3 = k;
   cout << ans3;
  }
  return 0;
}

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

using namespace std;
typedef long long ll;

#define INF (long long)(10e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

int main(void)
{
    string s;
    cin >> s;
    cout << ((s[0] == '9' || s[1] == '9')? "Yes":"No") << endl;
    
}


Measured memory_bytes: 256
/*input
100 4 16
*/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii; 


#define FileIn(file) freopen(file, "r", stdin)
#define FileOut(file) freopen(file, "w", stdout)
#define syso(n) cout<<n<<endl;
#define sysom(message, n) cout<<message<<n<<endl;
#define all(c) c.begin(), c.end() 
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define present(container, element) (container.find(element) != container.end())  //map, set
#define cpresent(container, element) (find(all(container),element) != container.end()) //vector
#define what_is(x) cout << #x << " is " << x << endl; 


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

ll lcm(ll fir, ll sec){
	return (fir*sec)/(gcd(fir, sec));
}


const int MOD = 1e9 + 7;
const string small_alphabets = "abcdefghijklmnopqrstuvwxyz";
const int month_days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
// --
// -- 
// -- 
// std::cout << std::fixed;
// std::cout << std::setprecision(5) << f << '\n';

int get_digits_sum(int x){
	int ret = 0;
	while(x>0){
		ret+=x%10;
		x/=10;
	}
	return ret;
}


int main(){
	int n,a,b;
	cin>>n>>a>>b;
	int ans = 0;
	for (int i = 1; i <= n; ++i){
		int sum = get_digits_sum(i);
		// what_is(i);
		// what_is(sum);
		if(sum>=a && sum<=b){
			ans+=i;
		}
	}
	syso(ans);
	return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
ans = 0
a.sort()
amax = a[-1]
dp = [1]*(amax+1)
for i in range(len(a)-1):
    p = a[i]
    if dp[p] == 1:
        for j in range(amax//p + 1):
            dp[p*j] = 0
        if a[i] != a[i+1]:
            ans += 1
if dp[amax] == 1:
    ans += 1
print(ans)

Measured memory_bytes: 32064
#x=int(input())
n,m=map(int,input().split())
xl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
ans=0
if n>=m:
    pass
else:
    cum=[]
    xl.sort()
    ans=xl[m-1]-xl[0]
    for i in range(m-1):
        cum.append(xl[i+1]-xl[i])
    cum.sort(reverse=True)
    for i in range(n-1):
        ans-=cum[i]

print(ans)

Measured memory_bytes: 13964
import java.util.*;

class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=10;
int[] k=new int[n];
for(int i=0;i<n;i++){
k[i]=sc.nextInt();
}
Arrays.sort(k);
for(int i=0;i<3;i++){
System.out.println(k[n-i-1]);
}
}
}

Measured memory_bytes: 17168
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

typedef long long ll;

int main(){
	int n;
	cin>>n;
	bool ok=false;
	for(int i=1;i<=n;i++){
		if((int)(i*1.08)==n){
			cout<<i<<endl;
			ok=true;
			break;
		}
	}
	if(!ok){
		cout<<":("<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
k = int(input())
x_L = list(map(int,input().split()))

x_L = sorted(x_L)

center = int(k/2)

a_L,b_L = [],[]

for i in x_L:
    if i <= center:
        a_L.append(i)
    else:
        b_L.append(i)

a_dis,b_dis = 0,0

for i in a_L:
    a_dis += 2*i
for i in b_L:
    b_dis += 2*(k-i)

#print(a_L,b_L)
#print(a_dis,b_dis)
print(a_dis+b_dis)

Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <map>
#include <queue>
#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 <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
ll mod = 1e9 + 7;

int main()
{
	int h, w, n;
	cin >> h >> w >> n;
	vector<int> palette;
	rep(i, n)
	{
		int a;
		cin >> a;
		rep(j, a) palette.push_back(i + 1);
	}
	int c[105][105] = {};
	rep(i, h)
	{
		if (i % 2 == 0)
		{
			for (int j = 0; j < w; j++)
			{
				c[i][j] = palette.back();
				palette.pop_back();
			}
		}
		else
		{
			for (int j = w-1; j >= 0; j--)
			{
				c[i][j] = palette.back();
				palette.pop_back();
			}
		}
	}

	rep(i, h)
	{
		rep(j, w)
		{
			cs(c[i][j]);
		}
		cout << endl;
	}
	return 0;
}

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

int main() {
	int A, B;
	cin >> A >> B;

	if (B == 1)
		cout << 0 << endl;
	else if (B < A)
		cout << 1 << endl;
	else if ((B - A) % (A - 1) == 0)
		cout << (B - A) / (A - 1) + 1 << endl;
	else
		cout << (B - A) / (A - 1) + 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;

bool graph[55][55];
bool seen[55];

void dfs(int i,int n){
  seen[i] = true;
  for(int j = 0;j < n;j++){
    if(graph[i][j] == false) continue;
    if(seen[j] == true) continue;
    dfs(j,n);
  }
  return;
}

int main(){
  int n;cin >> n;
  int cnt[20][20];
  rep(i,20)rep(j,20) cnt[i][j] = 0;
  ll ans = 0;
  rep(z,n){
    string a;cin >>a;
    if(a.find('.') == string::npos) a += '.';
    int dot_ind = int(a.find('.'));
    while(a.size() - dot_ind - 1 < 9) a += '0';
    a.erase(a.begin() + dot_ind);
    ll v = stoll(a);
    int num2 = -9,num5 = -9;
    for(;v%2==0;v/=2)num2++;
    for(;v%5==0;v/=5)num5++;
    num2 = min(num2,9);
    num5 = min(num5,9);
    // cout << a << " " << num2 << " " << num5 << endl;

    for(int i=-num2;i<=9;i++)for(int j=-num5;j<=9;j++) ans += cnt[i+9][j+9];
    cnt[num2+9][num5+9]++;
  }
  cout << ans << endl;
  // rep(i,20){
  //   rep(j,20) cout << cnt[i][j] << " ";
  //   cout << endl;
  // }

}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std; 
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int
#define ld long double
#define fi first 
#define se second 
#define mp make_pair
#define pb push_back
#define ull unsigned long long int
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define mo 1000000007
/*int const nmax = 1000006; 
vector<int> v[nmax]; 
void dfs(int i , int p)
{
	for(int j = 0; j<v[i].size(); j++)
	{
		int node = v[i][j]; 
		if(node!=p)
		{
			dfs(node,i); 
		}
	}
}*/
/////////////////////////////
ll gcd(ll a ,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll poww(ll a,ll n){if(n==0)return 1;ll p=poww(a,n/2);p=(p*p)%mo;if(n%2)p=(a*p)%mo;return p;}
////////////////////////////////////////////////////


void solve()
{
 ll a, b , n ; cin>>a>>b>>n; 
 if(b-1<=n)
 {
 	ll ans = a*(b-1); 
 	ans = ans/b; 
 	cout<<ans<<endl; return; 
 }
 ll ans = a*n; 
 ans = ans/b; 
cout<<ans<<endl; return; 
}
int main()
{ ios; 

ll t =1;
 while(t--)
	solve(); 
	return 0 ; 
}

Measured memory_bytes: 3508
#include <stdio.h>

int main(void)
{
    int a, b;

    scanf("%d %d", &a, &b);

    if (a == b)
    {
        puts("a == b");
    }
    else if (a > b)
    {
        puts("a > b");
    }
    else
    {
        puts("a < b");
    }

    return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD (ll)(1e9+7)
ll N,S;
ll i, j;
vector<pll> vc;
int main(){
    scanf("%lld", &N);
    if(N%2){
        S = N;
    }else{
        S = N + 1;
    }
    fornum(i,1,N+1){
        fornum(j,i+1,N+1){
            if(S-i==j)
                continue;
            vc.push_back({i, j});
        }
    }
    printf("%d\n", vc.size());
    fornum(i,0,vc.size()){
        printf("%lld %lld\n", vc[i].first, vc[i].second);
    }
    return 0;
}

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

using namespace std;
int main(int argc, char *argv[]) {
	int a, b;
	cin >> a >> b;
	
	if (a >= 13) {
		cout << b << endl;
	} else if (a >= 6) {
		cout << b / 2 << endl;
	}  else {
		cout << 0 << endl;
	}
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

//素因数分解
vector<pair<ll, ll>> prime_factor(ll n) {
    vector<pair<ll, ll>> res;

    for (ll i = 2; i * i <= n; ++i) {
        if (n % i != 0) continue;

        ll num = 0;

        while (n % i == 0) {
            ++num;
            n /= i;
        }

        res.push_back(make_pair(i, num));
    }

    if (n != 1) res.push_back(make_pair(n, 1));

    return res;
}

int main() {

    ll n; cin >> n;

    vector<pair<ll, ll>> prime = prime_factor(n);

    ll ans = 0;
    for (auto p : prime) {
        ll sum = 0;
        ll cnt = 1;

        ll t = p.second;
        while (t > 0) {
            if (t - cnt < 0) {
                break;
            }

            t -= cnt;
            ++sum;
            ++cnt;
        }

        ans += sum;
    }

    cout << ans << endl;
}

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

int main(void) {
  int i, j, n, m, max = 0, now, a;
  scanf("%d%d", &m, &n);
  for(i = 0; i < m; ++i) {
    now = 0;
    for(j = 0; j < n; ++j) {
      scanf("%d", &a);
      now += a;
    }
    if(max < now) max = now;
  }
  printf("%d\n", max);
  return 0;
}


Measured memory_bytes: 2752
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))

a = []
b = []
for i in range(m):
    ai, bi = list(map(int, input().split()))
    a.append(ai)
    b.append(bi)

losers = []

for i in range(m):
    if h[a[i]-1] > h[b[i]-1]:
        losers.append(b[i])
    elif h[a[i]-1] < h[b[i]-1]:
        losers.append(a[i])
    else:
        losers.append(a[i])
        losers.append(b[i])

l = len(set(losers))
print(n-l)

Measured memory_bytes: 24884
n, t = map(int, input().split())

ct = []
for i in range(n):
    cti = list(map(int, input().split()))
    ct.append(cti)

ct0 = [ i[0] for i in ct if i[1]<=t ]

if len(ct0)>0:
    print(min(ct0))
else:
    print("TLE")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (int i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int>> pipii;
typedef priority_queue<pii, vector<pii>, greater<pii>> minpq;
typedef priority_queue<pii> maxpq;
//const double PI = acos(-1);
const int mod = 998244353;

// ----------------------DEBUG TEMPLATE--------------------------
void __print(int x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x)
{
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x)
{
    int f = 0;
    cerr << '{';
    for (auto &i : x)
        cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v)
{
    __print(t);
    if (sizeof...(v))
        cerr << ", ";
    _print(v...);
}
#ifndef ONLINE_JUDGE
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif
// ----------------------DEBUG TEMPLATE--------------------------
// bool check(int &x,int &y){
//     if((x==0 && y==0) || (x==0 && y==1) || (x==1 && y==0) ){
//         return true;
//     }
//     return false;
// }
#define N 3001
vi arr(N);
int dp[N][N][2];
int solve(int i,int j,int turn)
{
    if (i > j)
    {
        return 0;
    }
    if(dp[i][j][turn]>-1){
        return dp[i][j][turn];
    }
    if(!turn){
       return dp[i][j][turn] = max(arr[i] + solve(i + 1,j,1), arr[j] + solve(i,j - 1,1));

    }
    else{
        return dp[i][j][turn] = min(solve(i + 1,j,0),  solve(i,j - 1,0));
    }
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    int sum=0;
    fo(i, n)
    {
        cin >> arr[i];
        sum+=arr[i];
    }
    memset(dp, -1, sizeof(dp));
    cout << 2*solve(0,n-1,0)-sum << endl;
}

Measured memory_bytes: 144528
#include <stdio.h>

#define ROWS 2
#define COLS_MAX 128

int N;
int A[ROWS + 1][COLS_MAX];

int dp[ROWS + 1][COLS_MAX];

int main(void) {
	int i, j;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 1; i <= ROWS; i++) {
		for (j = 1; j <= N; j++) {
			if (scanf("%d", &A[i][j]) != 1) return 1;
		}
	}
	for (i = 1; i <= ROWS; i++) {
		for (j = 1; j <= N; j++) {
			dp[i][j] = A[i][j] + (dp[i - 1][j] > dp[i][j - 1] ? dp[i - 1][j] : dp[i][j - 1]);
		}
	}
	printf("%d\n", dp[ROWS][N]);
	return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<iostream> 
#include<vector>
using namespace std;
int pw[105],to;
string getnw(string s,int b)
{
	string ans;
	to=b;
	int sz=s.size();
	for(int i=0;i<sz;i++)
	{
		if(s[i]=='S')
		{
			if(to==1) to=2;
			else if(to==2) to=1;
			if(ans.empty()||*(--ans.end())!='S') ans.push_back('S');
			else ans.resize(ans.size()-1);
		}
		else
		{
			if(to<2)
				to++;
			else
			{
				to=0;
				ans.push_back('R');
			}
		}
	}
	return ans;
}
vector<int> solve(int n,string s)
{
	vector<int> ans,ans2;
	ans.resize(pw[n]);
	if(!n)
	{
		ans[0]=0;
		return ans;
	}
	string s2;
	for(int i=0;i<3;i++)
	{
		string tmp=getnw(s,i);
		int nto=to;
		ans2=solve(n-1,tmp);
		for(int j=0;j<pw[n-1];j++)
			ans[j*3+i]=ans2[j]*3+nto;
	}
/*	printf("n=%d,sz=%d\n",n,(int)ans.size());
	for(int i=0;i<pw[n];i++)
		printf("%d ",ans[i]);
	printf("\n");*/
	return ans;
}
int n;
string s;
vector<int> v;
int main()
{
	pw[0]=1;
	for(int i=1;i<=13;i++)
		pw[i]=3*pw[i-1];
	scanf("%d",&n);
	cin>>s;
	v=solve(n,s);
	for(int i=0;i<pw[n];i++)
		printf("%d ",v[i]);
	return 0;
}

Measured memory_bytes: 8212
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>

using namespace std;
typedef long long ll;

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

int main() {

    ll N,K;
    cin >> N >> K;
    ll S[N];
    rep(i,N) S[i]=0;
    rep(i,K){
        ll d = 0;
        cin >> d;
        ll A = 0;
        rep(i,d){
            cin >> A;
            S[A-1]++;
        }
    }
    ll out = 0;
    rep(i,N){
        if(S[i]==0) out++;
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include<set>
#include<queue>
#include <iomanip>

typedef long long ll;

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

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 long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, m; string s;
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> > & v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]) % ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
ll Combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> numerator(r);
	vector<ll> denominator(r);

	for (int k = 0; k < r; k++)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	for (int p = 2; p <= r; p++)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	for (int k = 0; k < r; k++)
	{
		if (numerator[k] > 1) result *= numerator[k];
		result %= ma;
	}

	return result;
}

int main() {
	ll x, y, a, b, ans = 0;
	cin >> x >> y;
	a = 2 * y - x;
	b = 2 * x - y;
	if (a % 3 == 0 && b % 3 == 0&&a>=0&&b>=0) {
		a /= 3;
		b /= 3;
		ans = Combination(a + b, b);
		ans %= 1000000007;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;


typedef long long ll;

const int MAX = 3e3+5;
const int mod = 1e9+7;
int dp[MAX][MAX];

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;

    string s;
    cin>>s;
    s = " " + s;

    dp[1][1] = 1;

    for( int i = 2 ; i <= n ; i++ ) {
        for( int j = 1 ; j <= i ; j++ ) {
            if( s[i-1] == '<') {
                dp[i][j] += dp[i-1][j-1];
                dp[i][j] %= mod;
            } else {
                dp[i][j] += ( dp[i-1][i-1] - dp[i-1][j-1] + mod ) % mod;
                dp[i][j] %= mod;
            }

        }
        for( int j = 1 ; j <= i ; j++ )
            dp[i][j] = ( dp[i][j] + dp[i][j-1] ) % mod;

    }


    cout<<dp[n][n]<<"\n";


}


Measured memory_bytes: 34176
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;

const int N = 100010;
int n , ans[2][N] , vis[N];
vector<int> to[N];

inline int read() {
    int x = 0 ; char c = getchar(); bool f = 0;
    while(c < '0' || c > '9') f |= (c=='-') , c = getchar();
    while(c >= '0' && c <= '9') x = x * 10 + (c^48) , c = getchar();
    return f ? -x : x;
}

int dep[N] , f[N];
void DFS(int x , int fa) {
    dep[x] = dep[f[x] = fa] + 1;
    for(auto &y : to[x]) if(y != fa) DFS(y , x);
}

int main() {
    n = read();
    for(int i = 1 ; i < n ; ++i) {
        int x = read() , y = read();
        to[x].push_back(y) , to[y].push_back(x);
    }
    int rt1 , rt2;
    DFS(1 , 0);
    rt1 = max_element(dep + 1 , dep + 1 + n) - dep;
    DFS(rt1 , 0);
    rt2 = max_element(dep + 1 , dep + 1 + n) - dep;
    memset(vis , -1 , sizeof(vis));
    for(int x = rt2 ; x ; x = f[x]) vis[x] = 0;
    for(int i = 1 ; i <= n ; ++i) if(vis[i] == -1) {
        int t = -1;
        for(auto y : to[i]) if(vis[y] != -1) {
            t = y ; break;
        }
        if(t == -1) return puts("-1") & 0;
        vis[t]++;
    }
    for(int k = 0 ; k < 2 ; ++k) {
        int x = k==0 ? rt1 : rt2 , cnt = 1 , nxt = 0, las = 0;
        while(x) {
            for(int i = 1 ; i <= vis[x] ; ++i) ans[k][cnt + i - 1] = cnt + i;
            ans[k][cnt + vis[x]] = cnt , cnt += vis[x] + 1;
            
            nxt = 0;
            for(auto y : to[x]) if(vis[y] != -1 && y != las) {nxt = y ; break;}
            las = x , x = nxt;
        }
    }
    int k = (memcmp(ans[0]+1 , ans[1]+1 , n*sizeof(int)) < 0) ? 0 : 1;
    for(int i = 1 ; i <= n ; ++i) printf("%d " , ans[k][i]);
    return 0;
}

Measured memory_bytes: 12928
#include <iostream>
#include <cstdio>
#include <map>

using namespace std;

typedef long long ll;

ll n, ans;
map<ll, ll> ma;

int main()
{
    scanf("%lld", &n);
    for(ll i = 1; i <= n; i++)
    {
        ll t;
        scanf("%lld", &t);
        ll tt = t - i;
        ans += ma[-tt];
        ma[t + i]++;
    }
    printf("%lld\n", ans);
    return 0;
}


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

int gcd(int a,int b){
  /* 自然数 a > b を確認・入替 */
  int tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 int r;
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

int main(){
  int i,j,k;
  int N,X;
  scanf("%d %d",&N,&X);
  int A[N],B[N];
  
  for(i=0;i<N;i++){
    scanf("%d ",&A[i]);
    B[i]=abs(A[i]-X);
  }
  int gcdd=B[0];
  for(i=1;i<N;i++){
    gcdd = gcd(gcdd,B[i]);
  }
  printf("%d\n",gcdd);
  return 0;
}
  

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

int main(){
  int n;
  cin >> n;
  int a[220];
  for(int i = 0; i < n; ++i) cin >> a[i];
  
  int res = 0;
  
  while(true){
    bool odd = false;
    for(int i = 0; i < n; ++i){
      if(a[i]%2 != 0) odd = true;
    }
    
    if(odd) break;
    
    for(int i = 0; i < n; ++i){
      a[i] /= 2;
    }
    ++res;
  }
  
  cout << res << endl;
  
  return 0;
}

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

const int MOD = 998244353;
const int maxn = 2e5 + 5;
int Bit[maxn], A[maxn], n;
pair<int, int> p[maxn];

void Update(int i) {
    while(i <= n) {
        Bit[i]++;
        i += i&(-i);
    }
}
int Getsum(int i) {

    int res = 0;
    while(i) {
        res += Bit[i];
        i -= i&(-i);
    }
    return res;
}

int main() {

    scanf("%d", &n);
    for(int i = 0; i < n; i++)
        scanf("%d%d", &p[i].first, &p[i].second);

    sort(p, p+n);
    for(int i = 0; i < n; i++) {
        p[i].first = p[i].second;
        p[i].second = i;
    }

    sort(p, p+n);
    A[0] = 1;
    for(int i = 1; i <= n; i++) {
        A[i] = A[i-1]<<1;
        if(A[i] >= MOD) A[i] -= MOD;
    }
    int ans = 0;
    for(int i = 0; i < n; i++) {
            
        int t = Getsum(p[i].second+1);
        int a = A[t], b = A[p[i].second-t], c = A[i-t], d = A[n-1-(i+p[i].second-t)];
        ans = ((long long)(a+d-1)*(b+c-1)%MOD + ans) % MOD;
        Update(p[i].second+1);
    }

    ans = ((long long)n*A[n] - ans) % MOD;
    printf("%d", (ans+MOD)%MOD);
	return 0;
}

Measured memory_bytes: 3328
#include<stdio.h>
int main(){
	long long int n,s,i,j,max,d[100010],a;
	while(scanf("%lld",&n),n){
		for(i=s=0;i<n;i++){
			scanf("%lld",&a);
			s+=a;
		}
		for(i=0;i<n-1;i++){
			scanf("%lld",&a);
			for(j=i;j&&d[j-1]<a;j--)d[j]=d[j-1];
			d[j]=a;
		}
		//for(i=0;i<n-1;i++)printf("%d ",d[i]);printf("\n");
		for(i=max=0;i<n;i++){
			if(max<s*(n-i))max=s*(n-i);
			s+=d[i];
		}
		printf("%lld\n",max);
	}
	return 0;
}

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

using ll = long long;
using pii = pair<int, int>;

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

const int maxn = 5e3 + 1;
bool vis[maxn][maxn];

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

    int n;
    string s;
    cin >> n >> s;

    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (vis[i][j]) continue;

            for (int k = 0; i + k < j && j + k < n; k++) {
                vis[i + k][j + k] = true;
                if (s[i + k] == s[j + k]) ans = max(ans, k + 1);
                else break;
            }
        }
    }

    cout << ans;
}


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

using Graph=vector<vector<int>>;

int ans;int N,M;

void dfs(Graph &G,bool *seen,int v){
    
    bool ok=true;
    for(int i=1;i<N+1;i++){if((!seen[i])&&(i!=v)){ok=false;}}
    if(ok){ans++;return;}
    seen[v]=true;
    for(auto next_v:G[v]){
        if(seen[next_v]){continue;}
        dfs(G,seen,next_v);
    }

    seen[v]=false;

}

int main(){
    ans=0;
    cin >> N>>M;
    Graph G(N+1);
    G.assign(N+1,vector<int>());
    bool seen[N+1]={};
    for(int i=0;i<M;i++){
        int a,b;
        cin >>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs(G,seen,1);
    cout << ans<<endl;
    return 0;
}

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

using namespace std;

#define ll long long

#define inf 1e15

int main(){
	ll n;
	scanf("%lld",&n);
	vector<ll> arr(n);
	for(int i=0;i<n;i++)scanf("%lld",&arr[i]);
	
	vector<vector<ll> > dp(n+1,vector<ll>(n+1));
	
	ll size[n][n];
	
	for(int i=0;i<n;i++){
		for(int j=i;j<n;j++){
			if(i==j)
				size[i][i]=arr[i];
			else
				size[i][j]=size[i][j-1]+arr[j];
		}
	}
	
	for(int l=n;l>=0;l--){
		for(int r=l;r<n;r++){
			ll v=inf;
			for(int i=l;i<r;i++){
				v=min(v,size[l][i]+size[i+1][r]+dp[l][i]+dp[i+1][r]);
				
			dp[l][r]=v;
			}
		}
	}
	printf("%lld",dp[0][n-1]);
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,K,a,b,counter=0;
    cin>>N>>K;
    int c[N]={};
    cin>>a;
    for(int i=0;i<K;i++){
    for(int j=0;j<a;j++){
    cin>>b;
    c[b-1]++;}
    cin>>a;}
    for(int i=0;i<N;i++){
    if(c[i]==0){counter++;}}
    
    cout<<counter<<endl;
  return 0;
    }

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

class Node{
public:
 	Node* prev;
	Node* next;
	int data; 
	Node(){
		prev = 0; next = 0; data = 0;
	}
};
class List{
private:
 	Node head;
public:
	List(){
		head.prev = &head; head.next = &head;
	} 
	int insert(int x); 	// 挿入
	int del(int x); 	// 削除
	int deleteFirst(); 	// 先頭を削除
	int deleteLast(); 	// 末尾を削除 
	void print(); 		// 表示
};
int List::insert(int x){
	Node* p = new Node();
	if(p==0) 
		return -1;
	Node* q = &head;
	Node* r = head.next;
	p->prev = q;
	p->next = r;
	p->data = x;	
	q->next = p;
	r->prev = p;
 	return 0; 
}
// delメソッド（削除）
int List::del(int x)
{
	Node* p;
	for(p=head.next; p!=&head; p=p->next){ 
		if(p->data==x) 
			break;
	}
	if(p==&head) 
		return -2; // 探索エラー
	Node* q = p->prev;
	Node* r = p->next;
	q->next = r;
	r->prev = q;
	delete p;
 	return 0; // 正常終了
}
// deleteFirstメソッド（先頭を削除）
int List::deleteFirst()
{
	Node* p = head.next;
	if(p==&head) 
		return -2; // エラー
	Node* q = p->prev;
	Node* r = p->next;
	q->next = r;
	r->prev = q;
	delete p;
 	return 0; // 正常終了
}
// deleteLastメソッド（末尾を削除）
int List::deleteLast()
{
	Node* p = head.prev;
	if(p==&head) 
		return -2; // エラー
	Node* q = p->prev;
	Node* r = p->next;
	q->next = r;
	r->prev = q;
	delete p;
 	return 0; // 正常終了
}
// printメソッド（表示）
void List::print()
{
	for(Node* p=head.next; p!=&head; p=p->next){ 
		cout << p->data;
 		if(p->next!=&head){ 
			cout << ' '; 
		} 
		else{ 
			cout << endl; 
		}
	}
}
// main関数
int main(){
	List L;
	int n;
	cin >> n;
	for(int i=0; i<n; i++){ 
		char com[20]; // C文字列 
		cin >> com;
 		if(com[0]=='i'){ 
			int x;
			cin >> x;
 			L.insert(x); 
		} 
		else if(com[6]=='F'){ 
			L.deleteFirst(); 
		} 
		else if(com[6]=='L'){ 
			L.deleteLast(); 
		} 
		else{ 
			int x;
			cin >> x;
 			L.del(x); 
		}
	}
	L.print();
	return 0;
}


Measured memory_bytes: 34328
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int n;
  cin>>n;
  vector<double>a(n);
  rep(i,n)cin>>a[i];
  sort(a.begin(),a.end());
  double ans=a[0];
  rep(i,n-1){
   ans=(ans+a[i+1])/2;
  }
  printf("%.10f\n",ans);
  return(0);
}


Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import Counter
import heapq

N, M = map(int, input().split())

A = list(map(int, input().split()))

counter_A = Counter(A)

lis = []
for v,c in counter_A.items():
    heapq.heappush(lis, (-v, c))

for i in range(M):
    b, c = map(int, input().split())
    heapq.heappush(lis, (-c, b))

cnt = 0
ans = 0    

while cnt <= N:
    v, c = heapq.heappop(lis)
    v *= -1

    if cnt + c > N:
        ans += v*(N-cnt)
        break
    else:
        ans += v*c
        cnt += c
print(ans) 

Measured memory_bytes: 105984
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int N, T;
    cin >> N >> T;
    vector<int> A(N), B(N);
    for(int i = 0; i < N; i++) cin >> A[i] >> B[i];
    vector<int> ind(N);
    for(int i = 0; i < N; i++) ind[i] = i;
    sort(ind.begin(), ind.end(), [&](int i, int j){
        return A[i] < A[j];
    });
    vector<vector<int>> dp(N + 1, vector<int> (T + 1, 0));
    for(int k = 0; k < N; k++){
        int i = ind[k];
        for(int j = 0; j <= T; j++){
            dp[k + 1][j] = max(dp[k + 1][j], dp[k][j]);
            if(j == T) continue;
            if(j + A[i] > T) dp[k + 1][T] = max(dp[k + 1][T], dp[k][j] + B[i]);
            else dp[k + 1][j + A[i]] = max(dp[k + 1][j + A[i]], dp[k][j] + B[i]);
        }
    }
    cout << dp[N][T] << endl;
}

Measured memory_bytes: 38620
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Sum
{
    int n;
    vector<int> data;
    void query(int a, int b, int k, int l, int r, int x){
        if(r < a || b < l)
            return;
        if(a <= l && r <= b)
            data[k] += x;
        else{
            query(a, b, k*2+1, l, (l+r)/2, x);
            query(a, b, k*2+2, (l+r+1)/2, r, x);
        }
    }
public:
    Sum(int n0){
        n = 1;
        while(n < n0)
            n *= 2;
        data.assign(2*n-1, 0);
    }
    void add(int a, int b, int x){
        query(a, b, 0, 0, n-1, x);
    }
    int get(int k){
        k += n-1;
        int ret = data[k];
        while(k > 0){
            k = (k - 1) / 2;
            ret += data[k];
        }
        return ret;
    }
};

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

    Sum sum(n+2);
    for(int i=0; i<n; ++i){
        int a, b;
        cin >> a >> b;
        sum.add(a, b, 1);
    }

    int i = n;
    for(;;){
        if(sum.get(i+1) >= i){
            cout << i << endl;
            break;
        }
        -- i;
    }

    return 0;
}

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


Measured memory_bytes: 2008
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
a,b,k = map(int, input().split())
l=[]
for i in range(a,min(b,a+k)):
  l.append(i)
for i in range(max(a,b-k+1),b+1):
  if not i in l:
    l.append(i)
l.sort()
for i in l:
  print(i)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)

//小文字=大文字+32
int main() {
	int n;
	int left, right;
	cin >> n;
	right = n - 1;
	left = 0;//城である可能性のある
	int ans=0;
	vector<char>c(n);
	rep(i, n) {
		cin >> c[i];

	}
	for (int i = n - 1; i >= 0; i--) {
		if (c[i] == 'R') {
			right = i;
			while (left != right) {
				if (c[left] == 'W') {
					swap(c[i], c[left]);
					ans++;
					left++;
					break;
				}
				left++;
			}
		}
		if (i == left) {
			break;
		}
	}
	cout << ans;
}
	



Measured memory_bytes: 3616
#include <stdio.h>
#include <string.h>
#define buf 100

int main(void){
     
	int i,l;
	double time,sum,dis,n,A[buf];
	char str[buf],*line;
	
	for( ;fgets(str,sizeof(str),stdin)!=NULL; ){
		line=strtok(str,",");
		sscanf(line,"%lf",&n);
		A[0]=n; sum=A[0];
		for(i=1;i<12;i++){
			line=strtok(NULL,",");
			sscanf(line,"%lf",&n);
			A[i]=n;
			if(10>i)
				sum+=A[i];
		}
		time=sum/(A[10]+A[11]);
		dis=A[10]*time;
		for(i=0;i<10;i++){
			dis-=A[i];
			if(0>=dis){
				printf("%d\n",i+1);
				break;
			}		
		}		
	}
	return 0;
}

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

int main() {
    int n, d;
    cin >> n >> d;
    long long ans = 0;
    int pt = 0, pf = 1;
    long long m = 0;
    for (int i = 0; i < n; ++i) {
        int t, f;
        cin >> t >> f;
        if (abs(f - pf) > t - pt) {
            cout << -1 << "\n";
            return 0;
        }
        if (f - 1 + pf - 1 <= t - pt) {
            ans += m * (pf - 1);
            m = 1;
        }
        else {
            ans += m * max(abs(f - pf), t - pt);
            ++m;
        }
        if (m > d) {
            cout << -1 << "\n";
            return 0;
        }
        pt = t;
        pf = f;
    }
    ans += m * (pf - 1);
    cout << ans << "\n";
    return 0;
}



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

using namespace std;
using ll = long long;

int main() {
    int N, K;
    cin >> N >> K;

    double ans = (N - K + 1)*(N - K + 1 > 0);
    //cout << ans << endl;
    for(int i = 1; i < min(N + 1, K); i++) {
        //cout << ans << endl;
        for(int j = 0; j < 30; j++) {
            if(i*(ll)pow(2, j) >= (ll)K) {
                ans += pow(2, -1*j);
                break;
            }
        }
        //cout << ans << endl;
    }

    cout << fixed << setprecision(15) << (double)ans/(double)N << endl;


    return 0;
}

Measured memory_bytes: 4136
#include<bits/stdc++.h>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
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;
}


ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}
 
ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}

using namespace std;

void solve()
{
	ll a;
	string b;
	cin>>a>>b;
	b.erase(b.begin()+1);
	ll y=stoll(b);
	ll ans=a*y;
	cout<<ans/100;
}

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


Measured memory_bytes: 3592
n = int(input())
t = input()

new_pos = [0]
new_w = [0]*len(t)

for i in range(1, n+1):
    ith_bit = [0]*(3**i)  # ith_bit[p] : 位置 (p mod 3**i) のi番目bit
    for k in range(3):
        for l in range(3**(i-1)):
            ith_bit[k*3**(i-1)+l] = k

    pos = new_pos
    w = new_w  # 繰り上がりが起きても ith_bit を正確に捉えるため、j 曲流したあとの "222..22" の位置を把握しておく

    q = 0
    already = [0]*3**i
    new_w = [0]*len(t)

    for j in range(len(t)):
        mark = w[j]
        for k in range(3):
            cand = mark + k*3**(i-1)
            if ith_bit[cand] and (q - already[cand]) % 2:
                # "122..22", "222..22" の最上位 bit のみ Salsa を流す
                ith_bit[cand] = 3 - ith_bit[cand]
            already[cand] = q  # 位置 cand に何回 Salsa を流したか記憶しておく
            if ith_bit[cand] == 2:
                new_w[j] = cand

        if t[j] == 'S':
            q += 1
        else:
            for k in range(3):
                ith_bit[mark + k*3**(i-1)] = (ith_bit[mark + k*3**(i-1)]+1) % 3

    new_pos = [0]*(3**i)
    for j in range(3**i):
        if ith_bit[j] and (q - already[j]) % 2:
            # 全ての位置に Salsa を流す。
            # 曲の途中で "*22..22" が位置 j に訪れている場合、上で Salsa を流してしまっている。
            # その分 already[j] を引く。
            ith_bit[j] = 3-ith_bit[j]
        new_pos[j] = pos[j % 3**(i-1)] + ith_bit[j]*3**(i-1)

print(*new_pos)


Measured memory_bytes: 130076
from collections import Counter


def comb_2(x):
    if x < 2:
        return 0
    return x * (x - 1) // 2


n = int(input())
arr = list(map(int, input().split()))

c = Counter(arr)
s = 0
for item, cnt in c.items():
    s += comb_2(cnt)

for a in arr:
    print(s - comb_2(c[a]) + comb_2(c[a] - 1))


Measured memory_bytes: 26780
import sys
from collections import defaultdict
from functools import lru_cache

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

MOD = 10**9 + 7
P = 2 ** 61 - 1

N = int(readline())
m = map(int, read().split())
A, B = zip(*zip(m, m))

pow2 = [1] * (N + 10)
for n in range(1, N + 10):
    pow2[n] = pow2[n - 1] * 2 % MOD

@lru_cache(None)
def inv_mod(a):
    b = P
    u, v = 1, 0
    while a:
        t = b // a
        a, b = b - t * a, a
        u, v = v - t * u, u
    if b < 0:
        v = -v
    return v % P

def to_key(a, b):
    if a == 0:
        return -1
    x = inv_mod(a) * b % P
    return x

def pair_key(key):
    if key == -1:
        return 0
    if key == 0:
        return -1
    return P - inv_mod(key)
  
counter = defaultdict(int)
origin = 0
for a, b in zip(A, B):
    if a == b == 0:
        origin += 1
        continue
    key = to_key(a, b)
    counter[key] += 1

answer = origin
k = 1
for key, cnt in counter.items():
    key1 = pair_key(key)
    if key1 not in counter:
        k *= pow(2, cnt, MOD)
    elif key < key1:
        x, y = cnt, counter[key1]
        k *= pow(2, x, MOD) + pow(2, y, MOD) - 1
    k %= MOD
answer += k - 1
answer %= MOD
print(answer)


Measured memory_bytes: 231760
/*  TAHMID RAHMAN
    DAMIAN FOREVER
     MATH LOVER
    NEVER GIVE UP
*/
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define pb push_back
#define fi first
#define se second
#define in insert
#define mp make_pair
#define GCD(a,b) __gcd(a,b);
#define endl "\n"
#define FRU freopen("out.txt","w",stdout)
#define FRO freopen("in.txt","r",stdin)
#define INFLL 9223372036854775807
#define debug 0
#define MAXN   100001
#define ar array
const int mxN=2e5;
const int MOD=1e9+7;
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
//Don't hesitate to ask me if you don't understand my code.......Happy coding,Tahmid...;
int main()
{
    fastio;
    ll n,k,i,j;
    cin>>n>>k;
    string ye="Yes",no="No";
    vector<ll>v(n);
    for(i=0;i<n;i++)cin>>v[i];
    for(i=0;i<(n-k);i++)
    {
        if(v[i]<v[i+k])
            cout<<ye<<endl;
        else
            cout<<no<<endl;
    }


}



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

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    bool have[N]; fill(have, have + N, false);
    for(int i=0; i<K; i++){
        int d;
        cin >> d;
        for(int j=0; j<d; j++){
            int a;
            cin >> a;
            a--;
            have[a] = true;
        }
    }
    int ans = 0;
    for(int i=0; i<N; i++){
        if(have[i]) ans++;
    }
    cout << N - ans << endl;
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  
  for(int i = 0;i < s.size();i++){
    if(s[i] == ','){
		cout << " ";
    }
    else{
      	cout << s[i];
    }
  }
  cout << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define MAX_HW 2000

using namespace std;
typedef pair<int, int> ipair;

int mp[MAX_HW + 2][MAX_HW + 2];

int sp1[MAX_HW + 2][MAX_HW + 2];

int H, W;
int main(int argc, char **argv) {
    cin >> H >> W;
    for(int i = 0; i <= H + 1; ++i)
        for(int j = 0; j <= W + 1; ++j) {
            if(i == 0 || j == 0 || i == H + 1 || j == W + 1) {
                mp[i][j] = 1;
                continue;
            }

            char ch;
            cin >> ch;
            mp[i][j] = (ch == '#' ? 1 : 0);
        }
    
    for(int i = 0; i <= H + 1; ++i) {
        int cur = 0;
        for(int j = 0; j <= W + 1; ++j) {
            if(mp[i][j] == 1) {
                cur = 0;
            } else {
                sp1[i][j] += cur;
                cur++;
            }
        }
    }

    for(int i = 0; i <= H + 1; ++i) {
        int cur = 0;
        for(int j = W + 1; j >= 0; --j) {
            if(mp[i][j] == 1) {
                cur = 0;
            } else {
                sp1[i][j] += cur;
                cur++;
            }
        }
    }


    for(int j = 0; j <= W + 1; ++j) {
        int cur = 0;
        for(int i = 0; i <= H + 1; ++i) {
            if(mp[i][j] == 1) {
                cur = 0;
            } else {
                sp1[i][j] += cur;
                cur++;
            }
        }
    }

    for(int j = 0; j <= W + 1; ++j) {
        int cur = 0;
        for(int i = H + 1; i >= 0; --i) {
            if(mp[i][j] == 1) {
                cur = 0;
            } else {
                sp1[i][j] += cur;
                cur++;
            }
        }
    }

    int res = -INF;
    
    for(int i = 0; i <= H + 1; ++i)
        for(int j = 0; j <= W + 1; ++j)
            res = max(res, sp1[i][j]);
    
    cout << (res + 1) << endl;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> b(N);
  for(int i=1;i<=N;i++)cin >> b[i];
  for(int i=1;i<=N;i++){
    if(b[i]>i){cout << -1 << endl; return 0;}
  }
  vector<int> a;
  for(int i=1;i<=N;i++){
    if(b[i]==1){a.push_back(1);}
    else{a.insert(a.begin()+i-b[i],b[i]);}
  }
  reverse(a.begin(),a.end());
  for(int i=0;i<N;i++){cout << a[i] << endl;}
}

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

if len(str(N))<4:
    ans = 0
    
    for i in range(1, N+1):
        for j in range(1, N+1):
            if str(i)[0]==str(j)[-1] and str(i)[-1]==str(j)[0]:
                ans += 1
    
    print(ans)
    exit()
    
L = len(str(N))
n = int(str(N)[1:])
ans = 0
F = int(str(N)[0])
L2 = int(str(N)[-1])
S = str(N)
M = int(S[1:len(S)-1])

for i in range(1, N+1):
    f = int(str(i)[0])
    l = int(str(i)[-1])

    if f==0 or l==0:
        continue
    
    for k in range(1, L+1):
        
        if k==1 and f!=l:
            continue
        
        if k==1:
            ans += 1
            continue
        
        if k<L:
            ans += 10**(k-2)
        else:
            if F<l:
                continue
                
            if l<F:
                ans += 10**(k-2)
            else:
                if len(S)<=2:
                    continue
                
                ans += M
                
                if L2>=f:
                    ans += 1

print(ans)

Measured memory_bytes: 42220