akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
using namespace std;

int arr[4][4];
pair<int,int> pos[150];
int stats[4][4];

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	for(int i = 1;i <= 3;i++) {
		for(int j = 1;j <= 3;j++) {
			cin>>arr[i][j];
			pos[arr[i][j]] = {i, j};
		}
	}
	int q;
	cin>>q;
	while(q--) {
		int x;
		cin>>x;
		stats[pos[x].F][pos[x].S] = 1;
	}
	bool ada = 0;
	for(int i = 1;i <= 3;i++) {
		int tot = 0;
		for(int j = 1;j <= 3;j++) tot += stats[i][j];
		if(tot == 3) ada = 1;
	}
	
	for(int i = 1;i <= 3;i++) {
		int tot = 0;
		for(int j = 1;j <= 3;j++) tot += stats[j][i];
		if(tot == 3) ada = 1;
	}
	
	int tot = 0;
	for(int i = 1;i <= 3;i++) tot += stats[i][i];
	if(tot == 3) ada = 1;
	tot = 0;
	for(int i = 1;i <= 3;i++) tot += stats[i][4 - i];
	if(tot == 3) ada = 1;
	
	cout<<((ada == 1)?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mp  make_pair
#define pb  push_back
#define endl "\n"
#define rep(i,a,n) for(int i=a;i<n;i++)
const int mod = 1e9 + 7;
void solve() {
	string s;
	cin >> s;
	int k = 0;
	int n = s.size();
	rep(i, 0, n) {
		k += (int)(s[i] - '0');
	}
	if (k % 9 == 0) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}
int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	int t;
	t = 1;
	//cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}


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

#define ARC(i, a, b) for(int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)

template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; }
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; }
template<class T> T &anth(T &a, const T &b){ return a = ant(a, b); }
template<class T> T &onth(T &a, const T &b){ return a = ont(a, b); }

int main(){
	int r, g, b, n;
	std::cin >> r >> g >> b >> n;
	int count = 0;
	for(int i = 0; i * r <= n; ++i){
		for(int j = 0; i * r + j * g <= n; ++j){
			if((n - i * r - j * g) % b == 0){
				++count;
			}
		}
	}
	printf("%d\n", count);
}


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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

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

    cout << (abs(a - x) < abs(b - x) ? 'A' : 'B') << endl;

    return 0;
}


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

int main(int argc, const char * argv[]) {
    int wi[100] = {0};
    int i = 0;
    int N, T;
    int SumW = 0;
    int SumT = 0;
    int minimam = 0;
    int Tabs = 0;
    
    scanf("%d",&N);
    for(i=0; i<N; i++){
        scanf("%d",&wi[i]);
        SumW += wi[i];
    }
    minimam = SumW;
    
    for(T=1; T<N; T++){
        for(i=0; i<=T; i++){
            SumT += wi[i];
        }
        Tabs = abs(SumT - (SumW-SumT));
        if(Tabs < minimam){
            minimam = Tabs;
        }
        SumT = 0;
    }
    
    printf("%d\n", minimam);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD =1000000007;

ll modPow(ll a, ll n) {
  if (n == 0) return 1; // 0乗にも対応する場合
  if (n == 1) return a % MOD;
  if (n % 2 == 1) return (a * modPow(a, n - 1)) % MOD;
  ll t = modPow(a, n / 2);
  return (t * t) % MOD;
}
ll modComb(ll n,ll a){
  ll x=1,y=1;
  rep(i,a){
    x*=n-i;
    x%=MOD;
    y*=i+1;
    y%=MOD;
  }
  y=modPow(y,MOD-2);
  return (x*y)%MOD;
}

int main(){
  ll X,Y,m,n;
  cin >> X >> Y;
  if((X+Y)%3!=0){
    cout << 0 << endl;
    return 0;
  }
  m=(2*X-Y)/3;
  n=(2*Y-X)/3;
  if(n<0||m<0){
    cout << 0 << endl;
    return 0;
  }
  cout << modComb(n+m,n) << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;

int main()
{
    int bar[1010][110] = {};
    while (1) {
        fill(bar[0], bar[1009]+110, 0);
        int n, m, a; cin >> n >> m >> a;
        if (!n) break;
        loop (m, i) {
            int h, p, q; cin >> h >> p >> q;
            bar[h][p] = q;
            bar[h][q] = p;
        }
        loop (1010, i) {
            if (bar[1009-i][a]) a = bar[1009-i][a];
        }
        cout << a << endl;
    }
    return 0;
}

Measured memory_bytes: 1600
#pragma region include
    #include <iostream>
    #include <vector>
    #include <algorithm>
    #include <map>
    #include <string>
    #include <queue>
    #include <stack>
    #include <cmath>
    #include <set>
    #include <cstdio>
    #include <tuple>
    #define ALL(obj) (obj).begin(),(obj).end()
    #define RALL(obj) (obj).rbegin(),(obj).rend()
    #define REP(i, n) for(int i = 0; i < (int)(n); i++)
    #define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
    #define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
    #define MOD (1e9+7)
    #define INF (1e9)
    #define LLINF (4e18)
    using namespace std;
    typedef long long ll;
    typedef pair<int, int> PII;
    typedef vector<int> VI;
    typedef vector<VI> VVI;
    void input() {}
    template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
    template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); }
    template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); }
    template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); }
    template<typename... R> void input(string& f, R&... r) { cin >> f; input(r...); }
    template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())input(f[i]); input(r...); }
    #pragma endregion
     
    int main() {
        int N; input(N);
        vector<pair<ll,ll>> a(N);
        REP(i, N) {
            input(a[i].second, a[i].first);
        }
        sort(ALL(a));
        ll sum = 0;
        REP(i, N) {
            sum += a[i].second;
            if (sum > a[i].first) {
                puts("No");
                return 0;
            }
        }
        puts("Yes");
        getchar(); getchar();
    }

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

#define PI acos(-1.0)
#define INF 2e9
#define INFLL 9e18
#define EPS 1e-9
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll a[300000],b[300000],c[300000];


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(0);
    cout << fixed;
    //freopen("a.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll t,cnt=0,ans=0,i;
    string s;
    cin >> s;
    ll n=s.size();
    for(i=0;i<n;i++){
        if(s[i]=='R')cnt++;
        else cnt=0;
        ans=max(cnt,ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int sum = 0;
		if (n >= 2) {
			sum += n * n / 2 - (n / 2);
		}
		if (m >= 2) {
			sum += m * m / 2 - (m / 2);
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 22612
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
typedef pair<int, int> PII;
typedef long long ll;
template<typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int a, b, m, mina = 1000000000, minb = 1000000000, ans;
int ma[100005], mb[100005];

int main() {

	cin >> a >> b >> m;

	rep(i, a) {
		cin >> ma[i];
		mina = min(mina, ma[i]);
	}
	rep(i, b) {
		cin >> mb[i];
		minb = min(minb, mb[i]);
	}

	ans = mina + minb;

	rep(i, m) {
		int x, y, c;
		cin >> x >> y >> c;
		ans = min(ans, ma[x - 1] + mb[y - 1] - c);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	
	public static void main (String[] args) throws java.lang.Exception
	{
		BufferedReader input = new BufferedReader (new InputStreamReader (System.in));
		
		String totalStr = input.readLine();
		
		int total = Integer.parseInt(totalStr);
		
		String[][] infoStr = new String[total][4]; 
		
		int[][] info = new int[total][4];
		
		for(int number = 0; number < total; number++)
		{
			infoStr[number] = input.readLine().split(" ");
			
			for(int infoNum = 0; infoNum < infoStr[number].length; infoNum++)
			{
				info[number][infoNum] = Integer.parseInt(infoStr[number][infoNum]);
			}
		}
		
		int[][][] officialHouse = {{{0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}},
				{{0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}},
				{{0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}},
				{{0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}}};
		
		for(int infoNum = 0; infoNum <total; infoNum++)
		{
			officialHouse[info[infoNum][0] - 1][info[infoNum][1] - 1][info[infoNum][2] - 1] =
					officialHouse[info[infoNum][0] - 1][info[infoNum][1] - 1][info[infoNum][2] - 1] + info[infoNum][3];
		}
		
		for(int build = 0; build < officialHouse.length; build++)
		{
			for(int floor = 0; floor < officialHouse[build].length; floor++, System.out.println())
				{
					for(int room = 0; room < officialHouse[build][floor].length; room++)
					{
						System.out.print(" " + officialHouse[build][floor][room]);
					}
					
				}
			if(build < officialHouse.length - 1)
			{
				System.out.println("####################");
			}
		}
	}

}



Measured memory_bytes: 24660
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    int n, m;
    ll l;
    cin >> n >> m >> l;
    vector<vector<ll>> d(n, vector<ll>(n, inf));
    for (int i = 0; i < n; ++i) {
        d[i][i] = 0;
    }
    for (int i = 0; i < m; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        --a;
        --b;
        d[a][b] = d[b][a] = c;
    }
    // わーしゃるふろいど
    for (int k = 0; k < n; k++) {         // 経由する頂点
        for (int i = 0; i < n; i++) {     // 始点
            for (int j = 0; j < n; j++) { // 終点
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    //
    vector<vector<ll>> d2(n, vector<ll>(n, inf));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (d[i][j] <= l) {
                d2[i][j] = 1;
            }
        }
    }

    for (int k = 0; k < n; k++) {         // 経由する頂点
        for (int i = 0; i < n; i++) {     // 始点
            for (int j = 0; j < n; j++) { // 終点
                d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
            }
        }
    }

    int q;
    cin >> q;
    vector<ll> ans;
    for (int i = 0; i < q; ++i) {
        int s, t;
        cin >> s >> t;
        ans.push_back(d2[s - 1][t - 1]);
    }

    for (auto k : ans) {
        if (k != inf)
            cout << k - 1 << endl;
        else
            cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 2808
#include <algorithm>
#include <iostream>
#include <string>
#include <queue>
#include <utility>
#include <vector>

using namespace std;

typedef pair<int, int> P;

int n, m;
int h[110000];
vector<int> edge[110000];
long long ans;

int main(void) {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  
  for (int u = 0; u < n; u++) {
    bool f = true;
    for (int v: edge[u]) {
      if (h[u] <= h[v]) {
        f = false;
      }
    }
    if (f) ans++;
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9340
//file_name:ABC52_B.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int n;
    scanf("%d",&n);
    string s;
    cin >> s;
    


    int ans = 0;
    int count = 0;
    rep(i,n){
        if(s[i]=='I'){
            count++;
        }else{
            count--;
        }
        ans = max(ans,count);
    }

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



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

using namespace std;

//typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)



string s, t;
int dp[3001][3001];


string backtrack(int i, int j){
	if (i == 0 || j == 0)
		return string("");
	if (s[i] == t[j])
		return backtrack(i - 1, j - 1) + s[i];
	if (dp[i][j - 1] > dp[i - 1][j])
		return backtrack(i, j - 1);
	return backtrack(i - 1, j);
}

signed main(){

	cin >> s >> t;

	int ss = s.length();
	int tt = t.length();


	s = ' ' + s;
	t = ' ' + t;
	for (int i = 0; i <= ss; i++) dp[i][0] = 0;
	for (int j = 1; j <= tt; j++) dp[0][j] = 0;

	for (int i = 1; i <= ss; i++){
		for (int j = 1; j <= tt; j++){
			if (s[i] == t[j]){
				dp[i][j] = dp[i - 1][j - 1] + 1;
			}
			else{
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			}
		}
	}

	cout << backtrack(ss, tt) << endl;

	
	return 0;
}


Measured memory_bytes: 70912
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int i,n,x;
        n=scan.nextInt();
        
        for(i=3;i<=n;i++){
        	x=i;
        	if(x%3==0){
        		System.out.print(" "+i);
        	}
        	else{
        		while(x>0){
        			if(x%10==3){
        				System.out.print(" "+i);
        				break;
        			}
        			x/=10;
        		}
        	}
        }
        System.out.println("");
    }
}

Measured memory_bytes: 28648
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
#define MAX 500000
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll COM(ll n, ll k) {
    if(n < k)
        return 0;
    if(n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    COMinit();
    for(ll i = 0; i <= min(k, n); i++) {
        ll disk = COM(n, i);
        ll disn = COM(i + n - i - 1, i);
        ans += (disk * disn) % MOD;
        ans %= MOD;
        // cout << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 11904
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int, int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
bool isPrime(ll n){
    for(int i = 2; i <= sqrt(n); i++){
        if(n%i==0) return false;
    }
    return true;
}
bool isSquare(ll n){
    ll s = sqrt(n);
    if(s*s == n) return true;
    return false;
}
vector<pair<ll, ll> > factor(ll n){
    vector<pair<ll, ll> > ans;
    for(ll i = 1; i <= sqrt(n); i++){
        if(n%i==0) ans.pb(mp(n/i, n/(n/i)));
    }
    return ans;
}
int main(){
    ll n;
    cin >> n;
    vl v;
    if(isPrime(n)){
        while(n!=0){
            v.pb(n%10);
            n = n/10;
        }
        cout << v.size();
        return 0;
    }
    else if(isSquare(n)){
        n = sqrt(n);
        while(n!=0){
            v.pb(n%10);
            n = n/10;
        }
        cout << v.size();
        return 0;
    }
    else{
        vector<pair<ll, ll> > ans = factor(n);
        ll q;
        if(ans[ans.size()-1].first > ans[ans.size()-1].second){
            q = ans[ans.size()-1].first;
        }
        else q = ans[ans.size()-1].second;
        while(q!=0){
            v.pb(q%10);
            q = q/10;
        }
        cout << v.size();
        return 0;
    }

}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    string s;
    int k;
    cin >> s >> k;
    vector<vector<vector<ll>>> dp(s.size()+1, vector<vector<ll>>(k+1, vector<ll>(2, 0)));
    dp[0][0][1] = 1;
    REP(i, s.size()){
        ll now = s[i-1] - '0';
        rep(j, k+1){
            dp[i][j][0] += dp[i-1][j][0];
            if(now == 0)dp[i][j][1] = dp[i-1][j][1];
            else{
                dp[i][j][0] += dp[i-1][j][1];
                if(j != 0){
                    dp[i][j][0] += dp[i-1][j-1][1] * (now-1);
                    dp[i][j][1] += dp[i-1][j-1][1];
                }
            }
            if(j != 0)dp[i][j][0] += dp[i-1][j-1][0] * 9;
        }
    }
    cout << dp[s.size()][k][0] + dp[s.size()][k][1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int N,A,B;cin>>N>>A>>B;
  if(A>B)cout<<"0"<<endl;
  else if(A==B)cout<<"1"<<endl;
  else if(N==1)cout<<"0"<<endl;
  else cout<<(N-2)*(B-A)+1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>   
using namespace std;
using namespace __gnu_pbds;
typedef long long ll; 
#define int long long
typedef unsigned long long lu;
typedef vector<ll> v;
typedef vector<vector<ll> > vv;
typedef vector<string>  vs;
typedef vector<pair<ll,ll>> vpr;
typedef long double ld;
#define f(i,n) for(ll i = 0; i < n; i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define amax(x,y) if(y>x) x=y;
#define amin(x,y) if(y<x)x=y;
#define bg(x) x.begin()
#define sz(x) (ll)x.size()
#define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
#define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" " 
#define mxt(a) *(max_element(a.begin(),a.end()))
#define mnt(a) *(min_element(a.begin(),a.end())
#define tc ll t;cin>>t;while(t--)
typedef pair<ll,ll> pi;
#define yes cout<<"Yes\n";
#define no cout<<"No\n";
#define yesno(f) if(f) yes else no
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
const ll mod=1e9+7;
const ld PI = 2 * acos(0.0);
ll m(ll a){ return (a+mod)%mod;}
ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    ll d=power(a,b/2,m);
    d=(d*d)%m;
    if(b&1)
        d=(d*a)%m;
    return d;
}
// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */
int32_t main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    string s,t;cin>>s>>t;
    string t1=t.substr(0,sz(s));
    yesno(t1==s);
    return 0;
}

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

const int N = pow(10,5);

vector<bool> isp(N+1, true);

void sieve() {
  isp[0] = false;
  isp[1] = false;
  for (int i=2; pow(i,2)<=N; i++) {
    if (isp[i]) for(int j=2; i*j<=N; j++) isp[i*j] = false;
  }
}

int main() {
  long long N,a,b;
  long long counter=0;
  cin>>N>>a>>b;
  vector<long long>vec(100005);
  vector<long long>ves(100005);
  // N以下の整数に対して素数判定をしてくれます。
  // nが素数ならば isp(n)=true、そうでなければ isp(n)=false
  sieve();
  // ex. 51から80までの素数を出力
  for (long long i=0; i<100005; i++) {if (isp[i]&&isp[(i+1)/2]) vec.at(i)=1;}
  for (long long i=0; i<100005; i++){
  counter+=vec.at(i);
  ves.at(i)+=counter;}
  for (long long i=0; i<N; i++){
  cout<<ves.at(b)-ves.at(a-1)<<endl;
  cin>>a>>b;}}


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

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
using vi = vector<int>;
using vchar = vector<char>;
using vstr = vector<string>;
using pii = pair<int,int>;
using pll =  pair<ll,ll>;

const ll mod = 1000000007;

#define pi acos(-1)
#define pb push_back
#define mp make_pair
#define test int TEST;cin>>TEST;while(TEST--)
#define all(x) x.begin(),x.end()
#define vrevsort(x) sort(x.rbegin(),x.rend())
#define opy cout<<"Yes"
#define opn cout<<"No"
#define flush fflush(stdout)
#define NL cout<<'\n'
#define SP cout<<' '

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

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;

void solve(){
	int n;
	cin>>n;
	vll a(n);
	ll ans=0,fans=0;;
	for(auto &x:a) cin>>x;
	for(int i=1;i<n;i++){
		if(a[i]<a[i-1]) {
			ans=a[i-1]-a[i];
			a[i]+=ans;
			fans+=ans;
		}
	} 
	
	cout<<fans;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
   // test{solve();cout<<'\n';}
	solve();
    
}


Measured memory_bytes: 4740
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long ll;
#define print(x) cout<<(x)<<endl


#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007


// DONT USE "int", USE "ll" !!!!!!!!!!!!
int main() {
	int N; cin >> N;
	int l[2000]; int r[2000];
	int out = 0;
	for (int i = 0; i < N; i++) {
		cin >> l[i] >> r[i];
		out += r[i] - l[i] + 1;
	}
	print(out);
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
const int inf = 1000000000; //10^9
const ll MOD = 1e9 + 7;
//加算代入演算子は+=！！！！！
//int 2^31 10^9まで

//桁数の計算
int calc_digit(ll n)
{
	int res = 0;
	while (n > 0)
	{
		res++;
		n /= 10;
	}
	return res;
}

int main()
{
	ll n;
	cin >> n;
	ll res = inf;
	for (ll a = 1; a * a <= n; ++a) //素数か調べる ルートnまで順に試し割
	{
		if (n % a != 0) //割り切れなければ以降飛ばす
		{
			continue;
		}
		ll b = n / a; //a * b = n の変換
		ll temp = max(calc_digit(a), calc_digit(b)); //大きい方を取得
		res = min(res, temp); //結果は最小値
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n;
  cin >> n;
  cout << (n + 1) / 2 << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
class Main {     
	public static void main(String[] args) throws IOException {
		doit(args, System.in, System.out);
	}     
	static void doit(String[] args, InputStream in, PrintStream out) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(in));
		String line = null;        
		while ((line = reader.readLine()) != null) {
			String[] values = line.split(" ");
			if (values.length < 8) {
				break;
			}
			double x1 = Double.parseDouble(values[0]);
			double y1 = Double.parseDouble(values[1]);
			double x2 = Double.parseDouble(values[2]);
			double y2 = Double.parseDouble(values[3]);
			double x3 = Double.parseDouble(values[4]);
			double y3 = Double.parseDouble(values[5]);
			double xp = Double.parseDouble(values[6]);
			double yp = Double.parseDouble(values[7]);
			double area12 = area(xp, yp, x1, y1, x2, y2);
			double area23 = area(xp, yp, x2, y2, x3, y3); 
			double area31 = area(xp, yp, x3, y3, x1, y1); 
			double area123 = area(x1, y1, x2, y2, x3, y3); 
			String result = area12 + area23 + area31 - area123 < 0.0001 ? "YES"
					: "NO";            out.println(result);        }
		} 
	static double area(double x1, double y1, double x2, double y2, double x3,    double y3) {
			return 0.5 * Math.abs((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1));    }}

Measured memory_bytes: 9780
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
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> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
#define mp make_pair
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
//
//
//
 

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  string s;
  cin >> s;
  rep(i,s.length()){
    cout << 'x';
  }
  cout << '\n';
  return 0;
}


Measured memory_bytes: 256
// Daniel Grzegorzewski15
// while (clock()<=69*CLOCKS_PER_SEC)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace __gnu_pbds;
using namespace std;

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

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}

const int N = 5*(int)1e5 + 3;
int SQ = 700;

int n, q, wyn, c[N], cnt[N], res[N];
vector<pair<PII, int>> que;

bool cmp(pair<PII, int> x, pair<PII, int> y) {
  if (x.ST.ST/SQ != y.ST.ST/SQ)
    return x.ST.ST < y.ST.ST;
  return x.ST.ND > y.ST.ND;
}

int main() {
  init_ios();
  cin >> n >> q;
  SQ = max(4, n/(int)sqrt(q));
  for (int i = 1; i <= n; ++i)
    cin >> c[i];
  for (int i = 1; i <= q; ++i) {
    int l, r;
    cin >> l >> r;
    que.PB({{l, r}, i});
  }
  sort(que.begin(), que.end(), cmp);
  int l = 1, r = 1;
  wyn = cnt[c[l]] = 1;
  for (auto el: que) {
    int le = el.ST.ST;
    int ri = el.ST.ND;
    int id = el.ND;
    while (le < l) {
      --l;
      ++cnt[c[l]];
      if (cnt[c[l]] == 1)
        ++wyn;
    }
    while (r < ri) {
      ++r;
      ++cnt[c[r]];
      if (cnt[c[r]] == 1)
        ++wyn;
    }
    while (l < le) {
      --cnt[c[l]];
      if (cnt[c[l]] == 0)
        --wyn;
      ++l;
    }
    while (ri < r) {
      --cnt[c[r]];
      if (cnt[c[r]] == 0)
        --wyn;
      --r;
    }
    res[id] = wyn;
  }
  for (int i = 1; i <= q; ++i)
    cout<<res[i]<<"\n";
}

Measured memory_bytes: 15536
N = int(input())
lis_h = list(map(int, input().split())) + [10**10]

move_log = 0
lis_move = []
for i in range(N):
    if lis_h[i] >= lis_h[i + 1]:
        move_log += 1
    else:
        lis_move.append(move_log)
        move_log = 0
    before = i

print(max(lis_move))

Measured memory_bytes: 14252
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A.begin(), A.end(), [](int a, int b){return a > b;});
  int sum = 0;
  for (int i = 0; i < K; i++) {
    sum += A[i];
  }
  cout << sum << endl;
  return 0;
}

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

using namespace std;

const int N = 50 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int n, k;
long long dp[N][N][N * N];

bool read() {
    if (!(cin >> n >> k))
        return false;

    return true;
}

void solve() {
    if (k % 2 == 1) {
        cout << 0 << endl;
        return ;
    }

    k /= 2;
    dp[1][0][0] = dp[1][1][0] = 1;

    auto add = [](long long& a, long long b) { if ((a += b) >= MOD) a -= MOD; };

    for (int i = 1; i < n; ++i)
        for (int j = 0; j <= i; ++j)
            for (int s = 0; s < N * N; ++s) {
                if (s + j < N * N) add(dp[i + 1][j][s + j], dp[i][j][s]);
                if (s + j + 1 < N * N) add(dp[i + 1][j + 1][s + j], dp[i][j][s]);
                if (j > 0 && s + j - 1 < N * N) add(dp[i + 1][j - 1][s + j], dp[i][j][s] * j * j % MOD);
                if (s + j < N * N) add(dp[i + 1][j][s + j], 2ll * dp[i][j][s] * j % MOD);
            }

    cout << dp[n][0][k] << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    while (read())
        solve();

    return 0;
}



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

int n,A[50];
int solve(int i,int m){
    if(m==0)return 1;
    if(i>=n)return 0;
    int res=solve(i+1,m) || solve(i+1,m-A[i]);
    return res;
}

int main(){
    int q,M,i; 
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&A[i]);
    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d",&M);
        if(solve(0,M))printf("yes\n");
        else printf("no\n");
    }
    return 0;
}


Measured memory_bytes: 3152
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t H,W;

char map[1000][1000];

#include <queue>
#include <vector>
#include <functional>
#include <utility>
#include <algorithm>
#include <iterator>

using COST_T = uint32_t;
constexpr uint32_t N_MAX = 500;
constexpr COST_T INF = 500500500;//std::numeric_limits<double>::infinity()


template<typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T& arr, const U& v) {
	arr = v;
}
template<typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR& arr, const U& v) {
	for (auto& i : arr) {
		fill_all(i, v);
	}
}

//ダイクストラ
COST_T D[N_MAX][N_MAX];
void Dijkstra()
{
	using P = std::pair<COST_T, std::pair<uint32_t, uint32_t>>;//cost pos
	std::priority_queue<P, std::vector<P>, std::greater<>> que;
	fill_all(D, INF);

	D[0][0] = 0;
	que.push({ 0, {0,0} });
	while (!que.empty())
	{
		auto p = que.top(); que.pop();
		const auto& nowpos = p.second;
		const auto& nowcost = p.first;
		if (D[nowpos.first][nowpos.second] < nowcost) { continue; }

		//for (int32_t to = 0; to < N; ++to)
		//{
		//	auto cost = nowcost + graph[nowpos][to];
		//	if (cost < D[to]) {
		//		D[to] = cost;
		//		que.emplace(D[to], to);
		//	}
		//}

		auto nchar = map[nowpos.first][nowpos.second];
		if (nowpos.first+1 < H)
		{
			auto cost = nowcost + (map[nowpos.first + 1][nowpos.second] == nchar? 0 : 1);
			if (cost < D[nowpos.first + 1][nowpos.second]) {
				D[nowpos.first + 1][nowpos.second] = cost;
				que.push({ cost, { nowpos.first + 1 , nowpos.second } });
			}
		}
		if (nowpos.second + 1 < W)
		{
			auto cost = nowcost + (map[nowpos.first][nowpos.second + 1] == nchar ? 0 : 1);
			if (cost < D[nowpos.first][nowpos.second + 1]) {
				D[nowpos.first][nowpos.second + 1] = cost;
				que.push({ cost, { nowpos.first , nowpos.second + 1 } });
			}
		}
	}
}



int main()
{
    using std::endl;
    in.sync_with_stdio(false);
    out.sync_with_stdio(false);
    in.tie(nullptr);
    out.tie(nullptr);

    in >> H>>W;
	for (size_t i = 0; i < H; i++)
	{
		in >> map[i];
	}
	Dijkstra();
	auto res = (D[H - 1][W - 1] + 1) / 2;
	if (map[0][0] == '#') {
		res = (D[H - 1][W - 1] + 2) / 2;
	}
	out << res << endl;

    return 0;
}
#endif


Measured memory_bytes: 1912
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	static Main instance = new Main();

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		BigDecimal A = scan.nextBigDecimal();
		BigDecimal B = scan.nextBigDecimal();

		//WK変数
		BigDecimal result = A.multiply(B).setScale(0, BigDecimal.ROUND_DOWN);

		//演算


		//結果出力
			System.out.println(result);
	}
}

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

typedef long long ll;
typedef vector<ll> vl;      typedef vector<int> vi;
typedef vector<vl> vvl;     typedef vector<vi> vvi;
typedef pair<ll, ll> pll;   typedef pair<int, int> pii;
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define MOD 1000000007
#define F first
#define S second
#define INF ll(1e18)
#ifdef SHUBHAM107
#include "../trace.h"
#else
#define trace(args...)
#endif
const int N = 3005;

long long dp[N][N][4];
long long mat[N][N];
int r, c, k;

long long get(int i, int j, int state) {
    if (i >= r && j >= c)
        return 0;
    if (dp[i][j][state] != -1) {
        return dp[i][j][state];
    }
    trace(i, j, state);
    if (i == 0 && j == 2 && state == 1)
        trace(i, j, state);
    long long ret = 0;
    if (j < c) {
        trace('a');
        if (state == 3) {
            ret = get(i, j + 1, state);
        } else {
            ret = max(get(i, j + 1, state), get(i, j + 1, state + 1) + mat[i][j]);
        }
    } 
    if (i < r) {
        if (state == 3) {
            ret = max(ret, get(i + 1, j, 0));
        } else {
            ret = max(ret, max(get(i + 1, j, 0), get(i + 1, j, 0) + mat[i][j]));
        }
    }
    return dp[i][j][state] = ret;
}
void solve() {
    cin >> r >> c >> k;

    for (int i = 0; i < k; i++) {
        int ri, ci, vi;
        cin >> ri >> ci >> vi;
        ri--, ci--;
        mat[ri][ci] = vi;
    }
    memset(dp, -1, sizeof dp);
    cout << get(0, 0, 0);
    // trace(get(0, 3, 1));
    // cout << '\n';
    // for (int i = 0; i < r; i++) {
    //     for (int j = 0; j < c; j++) {
    //         for (int l = 0; l < 4; l++) {
    //             cout << dp[i][j][l] << ' ';
    //         }
    //         cout << '\n';
    //     }
    // }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifdef SHUBHAM107
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("err.txt", "w", stderr);
#endif
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}


Measured memory_bytes: 356616
#include <bits/stdc++.h>
#define ll long long
#define inf 0x6fffffff
using namespace std;
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
string s;
int main()
{
    int n=read();
    int n1=0,n2=0,n3=0;
    int ans=0;
    while(n--)
    {
        cin>>s;
        for(int i=1;i<s.length();i++)ans+=((s[i]=='B')&&(s[i-1]=='A'));
        int L=s.length()-1;
        n1+=((s[0]=='B')&&(s[L]!='A'));
        n2+=((s[0]!='B')&&(s[L]=='A'));
        n3+=((s[0]=='B')&&(s[L]=='A'));
    }
    //cout<<ans<<endl;
    //cout<<n1<<' '<<n2<<' '<<n3<<endl;
    if(n1<n2)swap(n1,n2);
    if(n3!=0)
    {
        ans+=n3-1;
        if(n1!=0)ans+=n2+1;
    }
    else ans+=n2;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;
ll gcd(ll a, ll b){
  if(a==0LL)return b;
  return gcd(b%a, a);
}
int main(){
  ll a, b;cin>>a>>b;
  if(a>b){ll tmp=a;a=b;b=tmp;}
  cout<<a*b/gcd(a, b)<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();

		List<Integer[]> list = new ArrayList<Integer[]>();
		for(int i = 0; i < m; i++) {
			int k = scan.nextInt();
			Integer[] sk = new Integer[k];
			for(int j = 0; j < k; j++) {
				sk[j] = scan.nextInt();
			}
			list.add(sk);
		}

		int[] p = new int[m];

		for(int i = 0; i < m; i++) {
			p[i] = scan.nextInt();
		}

		int ans = 0;
		for(int i = 0; i < 1 << n; i++) {
			boolean f = true;
			for(int k = 0; k < m; k++) {
				int res = 0;
				for(int l = 0; l < list.get(k).length; l++) {
					if((1 & i >> list.get(k)[l] - 1) == 1) {
						res++;
					}
				}
				if(res % 2 == p[k]) {

				}else {
					f= false;
					break;
				}
			}
			if(f) {
				ans++;
			}
		}

		System.out.println(ans);

	}
}

Measured memory_bytes: 23764
a,b,m = (int(x) for x in input().split())

aa = list(map(int, input().split()))
bb = list(map(int, input().split()))

#xyc = [[0]*3]*m

xyc = [list(map(int,input().split())) for i in range(m)]
#for i in range(m):
#    xyc[i][0],xyc[i][1],xyc[i][2] = map(int,input().split())

ma = min(aa)
mb = min(bb)
ans = ma+mb

#print(xyc)

for i in range(m):
    sum = aa[xyc[i][0] -1] + bb[xyc[i][1] -1] - xyc[i][2]
    #print(sum)
    if ans > sum:
        ans = sum

print(ans)



Measured memory_bytes: 38564
#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

ll knapsack(vector<pair<int,int>>& items, const int W) {
    int N = items.size();
    vector<vector<ll>> dp(W+1, vector<ll>(N+1,0));
    for (int w = 0; w < dp.size(); ++ w) {
        for (int i = 1; i <= N; ++ i) {
            if (w-items[i-1].first>=0) {
                if (i>1) dp[w][i] = max(dp[w][i], max(dp[w][i-1], dp[w-items[i-1].first][i-1] + items[i-1].second));
                else dp[w][i] = max(dp[w][i], (ll)items[i-1].second);
            }
            else dp[w][i] = dp[w][i-1];
            //cout<<"dp "<<w <<","<<i<<" "<<dp[w][i]<<endl;
        }
    }
    return dp[W][N];
}

int main()
{
    int N, W;
    cin>>N>>W;
    vector<pair<int,int>> items(N);
    for (auto& p : items) {
        cin>>p.first>>p.second;
    }
    cout<<knapsack(items, W);
    return 0;
}


Measured memory_bytes: 82304
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,s[100005]={0},e=0,t;
	cin>>a;
	int i;
	for(i=0;i<a;i++)
	{cin>>b;
	if(b==0)
	{e++;
	s[b]++;
	s[b+1]++;
	}
	else
	{s[b-1]++;
	s[b]++;
	s[b+1]++;
	}
	}
	t=e;
	for(i=0;i<=100000;i++)
	{
		if(t<s[i])
		t=s[i];
	}
	cout<<t<<endl;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int pi = 3.1415926536;
const int MOD = 1000000007;
const int MAX = 510000;

void Main() {
  int H, W;
  cin >> H >> W;
  string S[H];
  rep(i, 0, H) { cin >> S[i]; }

  //  八方向で隣接しているマスに'#'があるか調べる。
  rep(i, 0, H) {    // 行
    rep(j, 0, W) {  //　列
      if (S[i][j] == '#') {
        cout << '#';
        continue;
      }
      int cnt = 0;
      rep(k, j - 1, j + 2) {
        if (S[i - 1][k] == '#') cnt++;
        if (S[i + 1][k] == '#') cnt++;
      }
      if (S[i][j - 1] == '#') cnt++;
      if (S[i][j + 1] == '#') cnt++;
      cout << cnt;
    }
    cout << endl;
  }
}

int main() {
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示
  Main();
}

Measured memory_bytes: 256