akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

#define ll  long long
#define ld  double

#define all(x)  x.begin(),x.end()
#define sz(x)   (int)x.size()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 5005;

typedef pair<int,int>   ii;

int ask(int a,int b)    {
    cout << "? " << a;
    cout << " "  << b << endl;

    char c; cin >> c;

    return  (c == 'Y');
}

vector<int> S[N];

int p[N];

int init(int n) {
    for(int i = 0 ; i < n ; ++i)
        p[i] = i,
        S[i].pb(i);
    return  1;
}
int lead(int x) {
    return p[x] == x ? x : p[x] = lead(p[x]);
}
int join(int x,int y)   {
    x = lead(x);
    y = lead(y);

    if (x == y) return  0;
    if (S[x].size() < S[y].size())
        S[x].swap(S[y]);

    p[y] = x;

    while (S[y].size())
        S[x].pb(S[y].back()),
        S[y].pop_back();

    return  1;
}

int Type[N];

bool solve(vector<int> vec) {
    if (vec.empty())
        return  0;

    vector<int> nxt;

    for(int i = 1 ; i < sz(vec) ; i += 2)   {
        if(!ask(vec[i - 1],vec[i])) continue;
        if(!ask(vec[i],vec[i - 1])) continue;

        join(vec[i],vec[i - 1]);
        nxt.pb(vec[i]);
    }
    bool t = solve(nxt);

    if (vec.size() & 1) {
        int x = vec.back();

        if (!t) Type[x] = 1;
        if (!t && nxt.size())   {
            Type[x] = 1;
            int y = nxt[0];

            if (ask(x,y) != Type[y])
                for(int u : nxt)
                    if (Type[u] >= 0)
                        Type[u] ^= 1;
        }
        else    {
            for(int u : nxt)
                if (Type[u] > 0)    {
                    Type[x] = ask(u,x);
                    break;
                }
        }
        nxt.pb(vec.back());
        t = 1;
    }
    return  t;
}

int main()  {
    ios_base::sync_with_stdio(0);
    //cin.tie(0); cout.tie(0);

    int A;  cin >> A;
    int B;  cin >> B;

    if (A <= B) {
        cout << "Impossible";
        return  0;
    }
    memset(Type,-1,sizeof Type);

    init(A + B);

    vector<int> vec(A + B);

    iota(all(vec),0);
    assert(solve(vec));

    for(int i = 0 ; i < A + B ; ++i)
        if (Type[i] > 0)    {
            for(int j = 0 ; j < A + B ; ++j)
                if (Type[j] < 0 && j == lead(j))
                    Type[j] = ask(i,j);
            break;
        }
    cout << "! ";

    for(int i = 0 ; i < A + B ; ++i)
        cout << Type[lead(i)];
}

Measured memory_bytes: 1104
#include<iostream>
//#include <bits/stdc++.h>
using namespace std;
#include<algorithm>
#include<map>
#include<vector>
#include <iomanip>
#include <set>
#include<cmath>
#define F first
#define S second
#define pii pair<int,int>
#define pb push_back
#define int long long
#define mp make_pair
#define error(x) cout<<#x<<"="<<(x)<<endl;
void sp(double y,int x){cout<<fixed<<setprecision(x)<<y;}
int inf=1e9+10;
int const M=2e5+10;
int const M2=1e6+10;
int const M3=1e3+10;
int mod=1e9+7;
char t;
int a[M3][M3],ans[M3][M3];
int sa(int x,int y){if(x%y==0)return x/y;return x/y+1;}
int binp(int x,int y){int ans=1;int t=x;while(y!=0){if(y%2==1){ans*=t;ans;}y/=2;t*=t;t;}return ans;}
main(){
	ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>t;
            if(t!='.')
                a[i][j]=1;
        }
	}
	for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            for(int k=-1;k<=1;k++)
            {
                for(int l=-1;l<=1;l++)
                {
                    ans[i][j]+=a[i+k][j+l];
                }
            }
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(a[i][j])
                cout<<"#";
            else
                cout<<ans[i][j];
        }
        cout<<endl;
    }
}


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

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<vector<int>> G(N);
    for(int i = 0; i < N - 1; ++i) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }
    vector<int64> ans(N);
    rep(i, Q) {
        int p, x;
        cin >> p >> x;
        --p;
        ans[p] += x;
    }
    auto dfs = [&](auto &&dfs, int cur, int pre) -> int {
        for(auto &to : G[cur]) {
            if(pre == to) continue;
            ans[to] += ans[cur];
            dfs(dfs, to, cur);
        }
    };
    dfs(dfs, 0, -1);
    for(auto &a : ans) cout << a << " ";
    cout << '\n';
    return 0;
}


Measured memory_bytes: 21504
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    int h, w, m;
    cin >> h >> w >> m;
    using P = pair<int, int>;
    set<P> st;
    vector<int> cnty(h), cntx(w);
    rep(i, m) {
        int y, x;
        cin >> y >> x;
        y--, x--;
        st.insert(P(y, x));
        cnty[y]++;
        cntx[x]++;
    }
    vector<int> ys, xs;
    int MAXY = *max_element(all(cnty));
    int MAXX = *max_element(all(cntx));
    rep(i, h) if (cnty[i] == MAXY) ys.push_back(i);
    rep(i, w) if (cntx[i] == MAXX) xs.push_back(i);

    if ((ll)(sz(ys)) * (ll)(sz(xs)) > (ll)m) {
        cout << MAXY + MAXX << endl;
        return 0;
    }

    for (int y : ys) {
        for (int x : xs) {
            if (st.count(P(y, x)) == 0) {
                cout << MAXY + MAXX << endl;
                return 0;
            }
        }
    }
    cout << MAXY + MAXX - 1 << endl;
}

Measured memory_bytes: 23872
#include<bits/stdc++.h>                          
using namespace std;                                               
int main(){
	int j,i;
	string s,t;
	cin>>s>>t;
    for(i=s.size()-t.size();i>=0;i--)
	{
		for(j=0;j<t.size();j++)      
		{if(s[j+i]!=t[j]&&s[i+j]!='?') break;}
	    if(j==t.size()) break;
    }
    if(i<0) cout<<"UNRESTORABLE";                                      
    else{
    	for(j=0;j<t.size();j++) s[i+j]=t[j];
		for(i=0;i<s.size();i++) if(s[i]=='?') s[i]='a';
		cout<<s;
	}
	return 0;
}                    

Measured memory_bytes: 256
#include <iostream>

using namespace std;

//
// 123 -> 120 + 3
// 103 -> 100 + 3
// 120 -> 100 + 20
// 100 -> 90 + 10 = 50 + 50
// 200 -> 100 + 100
// 211 -> 100 + 111 = 200 + 11 
// 210 -> 200 + 10
// 9 	 -> 3 + 6
// 99  -> 90 + 9  


int main() {
	int N;
	cin >> N;
	int power = 1;
	int sum = 0;
	int temp = N;
	while (temp / 10 > 0) {
		sum += temp % 10;
		temp /= 10;
		power *= 10;	
	}
	sum += temp % 10;
	int max_digit = N / power; 
	// 10...0
	if (power > 1 && N % power == 0) {
		cout << "10" << endl;	
	} else {
		cout << sum << endl;
	}	
	return 0;
}


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

using namespace std;

main(){
   int n;
   int dp[301];
   fill(dp, dp+301, 0);
   dp[0] = 1;
   for(int j=1;j<18;++j){
      for(int i=0;i+j*j<=300;++i){
         dp[i+j*j] += dp[i];
      }
   }
   while(cin >> n && n){
      cout << dp[n] << endl;
   }
   return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

void func(int a, int b)
{
	int d, r;
	double f;

	d = a / b;
	r = a%b;
	f = (double)a / b;

	printf("%d %d %f\n", d, r, f);
}

int main(void)
{
	int a, b;

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

	func(a, b);

	return 0;
}

Measured memory_bytes: 632
#include<bits/stdc++.h>
using namespace std;
const int N=510*510;
pair<int,int> f[N];
int x[N];
int res[N];
int n;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&x[i]);
		f[i]=make_pair(x[i],i);
		res[x[i]]=i;
	}
	sort(f+1,f+n+1);
	int pos=1;
	for(int i=1;i<=n;i++){
		int id=f[i].second;
		for(int j=1;j<f[i].second;j++){
			while(pos<=n*n&&res[pos])pos++;
			res[pos]=id;
		}
		if(pos>f[i].first){puts("No");return 0;}
	}
	for(int i=1;i<=n;i++){
		int id=f[i].second;
		for(int j=n-id;j;j--){
			while(pos<=n*n&&res[pos])pos++;
			if(pos<x[id]){puts("No");return 0;}
			res[pos]=id;
		}
	}
	puts("Yes");
	for(int i=1;i<=n*n;i++)printf("%d ",res[i]);
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
int main (){
  long long int i;
  long long int n,a,b;
  cin>>n>>a>>b;
  long long int x = n/(a+b);
  if(a==0)
  cout<<0<<endl;
  else{

    cout<<x*a+min(n%(a+b),a);
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  int a = 700;
  string s;
  cin >> s;
  rep(i,3)
    if (s[i] == 'o')
      a += 100;
  cout << a;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int k = sc.nextInt();
		
		// 計算
		String result = "Yay!";
		if(e - a > k) result = ":(";
		
		// 出力
		System.out.println(result);
        
	}
}

Measured memory_bytes: 21716
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<string>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define MAXN 205
#define LL long long
LL a,b,c,d;
LL gcd(LL x,LL y)
{
	if(y==0) return x;
	return gcd(y,x%y);
}
LL lcm(LL x,LL y)
{
	return x/gcd(x,y)*y;
}
int main()
{
    scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
	LL ans=b-a+1,t=lcm(c,d);
	//printf("%d \n",b/c-a/c);
	ans=ans-(b/c-a/c)-(b/d-a/d);
	if(a%c==0) ans--;
	if(a%d==0) ans--;
	ans+=b/t-a/t;
	if(a%t==0) ans++;
	printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

//int solve(int n,int m,int s)
//{
//	static int dp[2][2001][3001];
//	memset(dp,0,sizeof(dp));
//	
//	m=min(m,s);
//	repi(i,1,m+1)
//		repi(j,1,i+1)
//			dp[1][i][j]=1;
//	
//	repi(i,2,n*n+1){
//		memset(dp[i&1],0,2001*3001*sizeof(int));
//		//repi(j,1,m+1){
//		//	repi(k,1,s+1){
//		repi(j,i,m+1){
//			repi(k,i*(i+1)/2,s+1){
//				dp[i&1][j][k]=dp[i&1][j-1][k];
//				if(j<=k)
//					dp[i&1][j][k]+=dp[(i-1)&1][j-1][k-j];
//				dp[i&1][j][k]%=100000;
//			}
//		}
//	}
//	
//	return dp[(n*n)&1][m][s];
//}

int solve(int n,int m,int s)
{
	static int dp[2][50][3001];
	memset(dp,0,sizeof(dp));
	
	m=min(m,s);
	
	repi(i,1,m+1){
		//memset(dp[i&1],0,50*3001*sizeof(int));
		repi(j,1,i+1)
			dp[i&1][1][j]=1;
		repi(j,2,n*n+1){
			//repi(k,1,s+1){
			repi(k,j*(j+1)/2,s+1){
				dp[i&1][j][k]=dp[(i-1)&1][j][k];
				if(i<=k)
					dp[i&1][j][k]+=dp[(i-1)&1][j-1][k-i];
				dp[i&1][j][k]%=100000;
			}
		}
	}
	
	return dp[m&1][n*n][s];
}

int main()
{
	for(int n,m,s;cin>>n>>m>>s,n|m|s;){
		//clock_t begin=clock();
		cout<<solve(n,m,s)<<endl;
		//printf("time: %ldms\n",clock()-begin);
	}
	
	return 0;
}

Measured memory_bytes: 2040
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

s = input()
if s[-1] == "s":
    s += "es"
else:
    s += "s"
print(s)



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

#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200001
#define LIMIT2 500001
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define ffor(i, a, b, c) for(i=(int)(a);i<=(int)(b);i+=(int)c)
#define rep(i, n) for(i=0;i<(int)n;i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define bit(n) (1LL<<(n))
#define median(a, b) (a+b)/2.0
ll swap(ll *a,ll *b){ll tmp;tmp=*a;*a=*b;*b=tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll sum(ll *a,ll n){if(n<=0){return 0;}else{return sum(a,n-1)+a[n-1];}}
ld avg(ll *a,ll n){if(n<=0){return 0;}else return (ld)sum(a,n)/n;};
ld ABS(ld a){if(a>=0){return a;}else{return -a;}}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int stack[LIMIT2];//stack[0]=count;
int queue[LIMIT2];//stack[0]=start,stack[1]=length;
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
//qsort(s,n,sizeof(s[0]),upchar);
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
//qsort(s,n,sizeof(s[0]),downchar);
int push(int n){
    if(stack[0]>=LIMIT2) return -1;
    stack[0]++;
    stack[stack[0]] = n;
    return 1;
}
int pop(){
    if(stack[0]<=0) return -1;
    stack[0]--;
    return stack[stack[0]+1];
}
int enqueue(int n){
    if(queue[0]+queue[1]>=LIMIT2) return -1;
    queue[queue[0]+queue[1]] = n;
    queue[1]++;
    return 1;
}
int dequeue(){
    int result;
    if(queue[1]<=0) return -1;
    result = queue[queue[0]];
    queue[0]++;
    queue[1]--;
    if(queue[1]==0){
        queue[0] = 2;//queue reset
    }else if(queue[1]==1){
        queue[2] = queue[queue[0]];//only oneth
        queue[0] = 2;
    }
    return result;
}
void initialize(){
    stack[0] = 0;//stack size
    queue[0] = 2;//queue start
    queue[1] = 0;//queue length
}

int isKaibun(char *s, int n){
  int i,result=1;
  //rep(i,n) printf("%c",s[i]);
  //printf("\n");
  for(i=0;i<n/2;i++){
    if(s[i]!=s[n-1-i]){
      result=0;
      break;
    }
  }
  return result;
}

int main(void){
    initialize();
    int n,m,p,i,j,result=0;
    char s[LIMIT1];
    ll a[LIMIT1],b[LIMIT1];
    scanf("%s", s);
  
    n = strlen(s);
    if(isKaibun(s,n) && isKaibun(s,(n-1)/2) && isKaibun(&s[(n+3)/2-1],(n-1)/2)){
      printf("Yes");
    }else{
      printf("No");
    }
    
    return 0;
}



Measured memory_bytes: 128
N, x = map(int, input().split())
a = sorted(map(int, input().split()))
cnt = 0
for i in range(N):
  if a[i] <= x:
    cnt += 1
    x -= a[i]
  else:
    break
if cnt == N and x > 0:
  cnt -= 1
print(cnt)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 200000000000
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}
bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}

const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};
int main() {
    ll H,W;
    cin>>H>>W;
    vector<vector<char>> G(H,vector<char>(W));
    ll cnt = 0;
    rep(i,H){
        rep(j,W){
            cin>>G[i][j];
            if(G[i][j] == '.'){
                cnt++;
            }
        }
    }

    vector<vector<ll>> dist(H,vector<ll>(W,-1));
    queue<Pi> que;

    dist[0][0] = 0;
    que.push(mp(0,0));
    ll dis=-1;

    while(!que.empty()){
        Pi v =que.front();
        que.pop();
        if(v.first == H-1 && v.second == W-1){
            //flag =1;
            dis = dist[v.first][v.second];
            break;
        }
        rep(dir,4){
            ll ny = v.first + dy[dir];
            ll nx = v.second + dx[dir];

            if(!In_map(ny,nx,H,W)) continue;
            if(dist[ny][nx] != -1) continue;
            if(G[ny][nx] == '#') continue;
            dist[ny][nx] = dist[v.first][v.second]+1;
            que.push(mp(ny,nx));
        }

    }


    if(dis == -1){
        cout<<-1<<endl;
    }else{
        cout<<cnt-dis-1<<endl;
    }




    return 0;
    

}

Measured memory_bytes: 3648
#define _CRT_SECURE_NO_WARNINGS
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

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

using namespace std;

int main() {
	int N, p[100000];
	cin >> N;
	REP(i, N) {
		cin >> p[i];
	}

	int s = 0, ans = 0;
	REP(i, N) {
		if (s == 0 && p[i] == i + 1) {
			ans++;
			s = 1;
		}
		else if (s == 1) {
			s = 0;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
N,M=map(int,input().split())
ac=[False]*N
wa={}
for i in range(N):
    wa[i]=0

AC=0
WA=0
for _ in range(M):
    temp,S=input().split()
    p=int(temp)-1
    if ac[p]:
        continue
    elif S=="AC":
        ac[p]=True
        AC+=1
    else:
        wa[p]+=1

for i in range(N):
    if ac[i]:
        WA+=wa[i]
print(AC,WA)

Measured memory_bytes: 15852
/*
 * Author:  heyuhhh
 * Created Time:  2020/5/31 20:11:10
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <assert.h>
#include <functional>
#include <numeric>
#define MP make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << std::endl; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
  template <template<typename...> class T, typename t, typename... A> 
  void err(const T <t> &arg, const A&... args) {
  for (auto &v : arg) std::cout << v << ' '; err(args...); }
#else
  #define dbg(...)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 1e5 + 5;
const double eps = 1e-7;

void run() {
    ll A;
    double B;
    cin >> A >> B;
    ll C = ll(B * 100 + 0.5);
    ll ans = A * C;
    cout << ll(ans / 100) << '\n';
}

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

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

int main()
{
	long long n;
	cin >> n;
	vector<int> h;
	int m = 0;
	for (int i = 0; i < n; i++) {
		int input;
		cin >> input;
		h.push_back(input);
		m = max(m, input);
	}
	
	int ans = 0;
	for (int i = 0; i < m; i++) {
		int flag = 0;
		for (int j = 0; j < h.size(); j++) {
			if (flag == 0 && h[j] != 0) {
				flag = 1;
				ans++;
			}
			else if (h[j] == 0) {
				flag = 0;
			}

			if (h[j] > 0) {
				h[j]--;
			}
		}

	}


	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1e9;
#define put(n) cout<<(n)<<endl
#define rep(i,N) for(int(i)=0;(i)<(N);++(i))
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()
#define pb(n) push_back(n)
#define int long long 

int dp[110][100100];
signed main(){
    int N,W;
    cin >> N >> W;
    vector<int> v(N),w(N);
    rep(i,N) cin >> w[i] >> v[i];

    int ans = 0;
    for(int i=0;i<N;++i){
        for(int wei=0;wei<=W;++wei){
            dp[i+1][wei] = max(dp[i+1][wei],dp[i][wei]);
            if(wei-w[i] < 0) continue;  
            dp[i+1][wei] = max(dp[i+1][wei],dp[i][wei-w[i]]+v[i]);
            ans = max(ans,dp[i+1][wei]);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 79360
#include<iostream>
using namespace std;
#define MAX 100000+10
typedef long long llong;

int n, k;
llong T[MAX];

//k辆最大运载量为P的卡车能装多少货物
int check(llong P) {
	int i = 0;
	for ( int j = 0; j < k; j++ ) {
		llong s = 0;
		while (s + T[i] <= P ) {
			s += T[i];
			i++;  
			if ( i == n ) return n;
		}
	}
	return i;
} 

int solve() {
	llong left = 0;
	llong right = 100000 * 10000; //货物数*1件货物的最大重量
	llong mid;
	while ( right - left > 1 ) {
		mid = (left + right ) / 2;
		int v = check(mid); //mid == 检查mid == P 时能装多少货物
		if ( v >= n ) right = mid;
		else left = mid; 
	} 
	return right;
}

int main() {
	cin >> n >> k;
	for ( int i = 0; i < n; i++ ) cin >> T[i];
	llong ans = solve();
	cout << ans <<endl;
	return 0;
}


Measured memory_bytes: 3884
<?php
# 入力
fscanf(STDIN, '%d', $n);
$a = [];
$max = 0;
$max2 = 0;
$max_key = [];
foreach(range(0, $n - 1) as $i) {
    $n = intval(trim(fgets(STDIN)));
    $a[] = $n;
    if ($max < $n) {
        $max2 = $max;
        $max = $n;
        $max_key = [$i];
    } elseif($max2 < $n) {
        $max2 = $n;
    } elseif($max === $n) {
        $max_key[] = $i;
    }
}
$cnt_max = count($max_key);
foreach($a as $i => $v) {
    if ($cnt_max === 1 && in_array($i, $max_key)) {
        echo($max2.PHP_EOL);
    } else {
        echo($max.PHP_EOL);
    }
}
?>

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

int main() {
  int N;
  cin >> N;
  vector<int> x(N), y(N);
  for (int i = 0; i < N; i++) {
    cin >> x[i];
    y[i] = x[i];
  }  
  sort(x.begin(), x.end());

  for (int i = 0; i < N; i++) {
    if (y[i] <= x[(N-1)/2]) cout << x[N/2] << endl;
    else cout << x[N/2 - 1] << endl;
  } 
}

Measured memory_bytes: 4840
/// In the name of God
#include <bits/stdc++.h>
//#define int long long
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;

#define y1 def1
#define X first
#define Y second
#define endl '\n'
#define all(o) o.begin(), o.end()
#define IOS ios::sync_with_stdio(0), cin.tie(0)
const int maxn = 2000 + 10;
const int S = maxn * maxn;
int a[maxn];
bitset<S> dp;
int32_t main(){
    IOS;
    int n, s = 0;
    cin >> n;
    for(int i=0; i<n; i++)
        cin >> a[i];
	dp[0] = 1;
	for(int i=0; i<n; i++)
		dp |= (dp<<a[i]), s += a[i];
	for(int i=(s+1)/2; ; i++)
		if(dp[i]){
			cout << i << endl;
			return 0;
		}
	
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;

int n,i,l,r,ans;

int main()
{
    cin>>n;
    for (i=0;i<n;i++) 
    {
        cin>>l>>r;
        ans=ans+r-l+1;
        }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int N, K ,output = 1; // N = jumlah operasi, K= nilai yang dioperasikan
	scanf("%d %d", &N, &K);
	
	for ( int i = 0; i < N; i++){
		(output + K > output * 2) ? output*=2 : output += K; // apakah op2 > op1
	}
	printf("%d\n", output);
	return 0;
}

Measured memory_bytes: 1688
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;







int main() {
    ll n, k;
    cin >> n >> k;
    map <ll, ll> mp;
    map <ll, ll> mp2;
    
    ll r = 0;
    
    rep(i, n) {
        ll a;
        cin >> a;
        mp[a] ++;
    }
    
    ll kind = mp.size();
    if (kind <= k) {
        mes(0);
        re0;
    }
    
    for (auto i: mp) {
        mp2[i.second]++;
    }
    
    for (auto i: mp2) {
        rep(j, i.second) {
            r += i.first;
            kind --;
            if (kind <= k) {
                mes(r);
                re0;
            }
        }
    }
    
    
    
    
}

Measured memory_bytes: 16060
L,R = map(int,input().split())

L_waru = L // 2019
R_waru = R // 2019

#答えは2019以上にはならないので2019で初期化
ans = 2019

#両方同じ商のとき
if L_waru == R_waru :
    #i*j mod 2019 の最小値を探す
    for i in range(L,R):
        for j in range(i+1,R+1):
            if (ans > ( (i * j) % 2019)):
                ans = (i * j) % 2019
            if ( ( (i * j) % 2019) == 0 ):
                print(0)
                exit()
    print(ans)
#商が違うときは割り切れる数が間にあるので(i*j)は0
else:
    print(0)


Measured memory_bytes: 38896
#include <bits/stdc++.h>
using namespace std;
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;
typedef pair <int,int> P;

int main(int argc, char *argv[])
{
  int h,w;
  char field[52][52];
  int d[52][52];
  int dx[4] = {0,0,1,-1};
  int dy[4] = {1,-1,0,0};
  
  const int INF = -1;
  scanf("%d %d",&h,&w);
  for (int i = 0; i < h; i++) {
      scanf("%s",field[i]);
  }

  int sum=0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      d[i][j]=INF;
      if(field[i][j]=='.')sum++;
    }
  }
  field[0][0]='#';
  d[0][0]=0;
  
  queue<P> que;
  que.push(P(0,0));

  while( !que.empty() ){
    P tmp = que.front();que.pop();
    int x = tmp.first;int y = tmp.second;
    for (int i = 0; i < 4; i++) {
      int mx = x+dx[i];int my = y+dy[i];
      if(mx>=0&&my>=0&&mx<h&&my<w){
	if(field[mx][my]=='.'){
	  que.push(P(mx,my));
	  d[mx][my]=d[x][y]+1;
	  field[mx][my]='#';
	}
      }
    }
  }
  if(d[h-1][w-1]==-1){
    printf("-1\n");
  }else{
    printf("%d\n",sum-d[h-1][w-1]-1);
  }
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{
    
    class Program
    {

        
        static void Main(string[] args) 
        {
            int s = int.Parse(Console.ReadLine());

            var h = new HashSet<long>();

            int i = 1;
            long f = s;
            while (true)
            {

                if (h.Contains(f))
                {
                    Console.WriteLine(i);
                    return;
                }
                else
                {
                    h.Add(f);
                }

                if (f % 2 == 0)
                {
                    f /= 2;
                    i++;
                }
                else
                {
                    f = f * 3 + 1;
                    i++;
                }

                
            }




        }
    }
}


Measured memory_bytes: 13396
S=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(S[K-1])

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

int main() {
  int p, q, r;
  cin >> p >> q >> r;
  
  int maximum = max(max(p, q), r);
  if (maximum == p) {
  	cout << q + r << endl;
  }
  else if (maximum == q) {
  	cout << p + r << endl;
  }
  else {
  	cout << p + q << endl;
  }
}


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

template<typename A, typename B> bool chmin(A &a, const B &b){ return b < a && (a = b, true); }
template<typename A, typename B> bool chmax(A &a, const B &b){ return a < b && (a = b, true); }

int main(){
  int n,q,a,t = 0;
  string s;
  cin >> n >> q;
  queue<pair<string, int> >que;
  for (int i = 0; i < n; i++){
    cin >> s >> a;
    que.push({s,a}); 
  }
  while (!que.empty()){
    if (que.front().second - q <= 0){
      t += que.front().second;
      cout << que.front().first << ' ' << t << '\n';
      que.pop();
    }
    else{
      s = que.front().first;
      a = que.front().second;
      a -= q;
      que.pop();
      que.push({s,a});
      t += q;
    }
  }
  return 0;
}


Measured memory_bytes: 6336
a,b,c = map(int, input().split())
if max(a,b,c)%2 == 0:
    print(0)
else:
    big = (((max(a,b,c)//2)+1)*a*b*c)//max(a,b,c)
    small = ((max(a,b,c)//2)*a*b*c)//max(a,b,c)
    print(big-small)

Measured memory_bytes: 9092
# dfsで解く
def dfs_mat(v):
    global adjacency_mat, ans, visited
    # 全部訪れたか判定
    if sum(visited) == N:
        ans += 1
        return
    for i in range(N):
        if adjacency_mat[v][i]:
            # 訪れたことがあるなら何もしない
            if visited[i] == True:
                continue
            # 訪れたことがないなら
            else:
            # 訪れたことにする
                visited[i] = True
                dfs_mat(i)    
            # 頂点aを未訪問にする
                visited[i] = False


if __name__ == "__main__":
    # input
    N, M = map(int, input().split())
    # 隣接行列を作る
    adjacency_mat = [[None]* N for _ in range(N)]
    for _ in range(M):
        a, b = map(int, input().split())
        adjacency_mat[a-1][b-1] = 1
        adjacency_mat[b-1][a-1] = 1
    # 訪れたかどうか
    visited = [False] * N
    visited[0] = True # 0を訪れたことにする
    ans = 0 # 答え
    dfs_mat(0)
    print(ans)




Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <iomanip>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}


int main() {
  int sx, sy, gx, gy;
  scanf("%d %d %d %d",&sx,&sy,&gx,&gy);
  int dx = gx-sx;
  int dy = gy-sy;
  rep(i,dx) cout << "R";
  rep(i,dy) cout << "U";
  rep(i,dx) cout << "L";
  rep(i,dy) cout << "D";
  
  cout<< "D";
  rep(i,dx+1) cout << "R";
  rep(i,dy+1) cout << "U";
  cout << "L";
  cout<< "U";
  rep(i,dx+1) cout << "L";
  rep(i,dy+1) cout << "D";
  cout << "R" << endl;
}

  



Measured memory_bytes: 256
n = int(input())
li = list(map(int, input().split()))
total = sum(li)
min_abs = 9999999999
for i in range(n):
    head = sum([li[j] for j in range(i + 1)])
    tail = total - head
    if abs(tail - head) < min_abs:
        min_abs = abs(tail - head)

print(min_abs)


Measured memory_bytes: 3060
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
 
public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		int l = s.length;
		int count = 0;
		for(int i = 0; i < l; i++) {
			if(s[i]!=t[i]) count++;
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 41828
import sys

def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

n = int(input())
a = list(map(int, sys.stdin.readline().split()))

ans = gcd(a[0], a[1])
for x in a[2:]:
    tmp = gcd(ans, x)
    if tmp < ans:
        ans = tmp
print(ans)


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int A=in();
	out(A*A*A);
	
	return 0;
}



Measured memory_bytes: 3124
import java.io.*;
import java.util.*;

public class Main{

    static Node nil;
    
    public static void main(String args[]) throws IOException{
	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));


	init();
	
	int n=Integer.parseInt(br.readLine());

	for(int i=0;i<n;i++){
	    String str[]=br.readLine().split(" ");

	    if(str[0].equals("insert")){
		insert(Integer.parseInt(str[1]));
		
	    }else if(str[0].equals("delete")){
		delete(Integer.parseInt(str[1]));
		
	    }else if(str[0].equals("deleteFirst")){
		deleteFirst();
		
	    }else{
		deleteLast();
	    }
	}
	printList();
    }

    static void init(){
	nil=new Node();
    }

    static void printList(){
	Node cur=nil.next;
	int isf=1;

	while(true){
	    if(cur.equals(nil))
		break;

	    if(isf==0)
		System.out.print(" ");

	    System.out.print(cur.key);
	    cur=cur.next;
	    isf=0;
	}
	System.out.print("\n");
    }


    static void deleteFirst(){
	Node t = nil.next;
	if ( t == nil )
	    return;
	delete(t.key);
    }

    static void deleteLast(){
	Node del=nil.prev;
	nil.prev=del.prev;
	del.prev.next=nil;

	del.next=null;
	del.prev=null;
    }

    static void delete(int key){
        Node del=nil.next;

	while(del != nil){
	    if(del.key==key){
		del.prev.next=del.next;
		del.next.prev=del.prev;

		del.next=null;
		del.prev=null;
		return;
		
	    }
	    del=del.next;
	}
    }


    static void insert(int key){
	Node x=new Node(key);

	x.next=nil.next;
	x.prev=nil;

	x.next.prev=x;
	nil.next=x;
	
    }
}


class Node{
    int key;
    Node next;
    Node prev;

    public Node(){
	this.next=this;
	this.prev=this;
    }

    public Node(int key){
	this.key=key;
    }
}



Measured memory_bytes: 186612
def main():
    n = int(input())
    q = []
    for i in range(0, n):
        q.append([int(x) for x in input().split()])

    is_prime = eraatosthenes()

    a = []
    for i in range(0, 100000):
        a.append(0)

    for i in range(0, len(is_prime)):
        if i % 2 == 0:
            continue
        if is_prime[i] == 1 and is_prime[int((i + 1) / 2)] == 1:
            a[i] = 1

    s = [0]
    for i in range(0, len(a)):
        s.append(s[i] + a[i])

    for i in range(0, len(q)):
        l, r = q[i][0], q[i][1]
        print(s[r+1] - s[l])


def eraatosthenes():
    list = []
    for i in range(0, 100000):
        list.append(0)

    for i in range(2, len(list)):
        list[i] = 1

    for i in range(2, len(list)):
        if list[i] == 1:
            j = i * 2
            while j < len(list):
                list[j] = 0
                j += i
    return list

if __name__ == "__main__":
    main()


Measured memory_bytes: 26564
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;

#define Endl endl

/*--------------------template--------------------*/

int main() {
    cin >> n;
    vi v(n);
    REP(i, n) {
        cin >> v[i];
    }
    sort(ALL(v));
    cout << v.back() - v[0] << endl;
}

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

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

/*
 string -> int : stoi(S);
 int -> string : to_string(N);
 Sのn文字以降をm文字取り出す : S.substr(n,m)

 int: -2,147,483,648 ～ 2,147,483,647 (2×10^9)
 ll: -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 (9×10^18)

*/

int main() {

 ll n,m,k,a,p, count=0, ans=0;
 cin >> n >> m;

 vector<int>  s(n,0);
 rep(i,m){
   cin >> k;
   rep(l,k){
     cin >> a;
     a--;
     s[a] |= (1<<i);
   }
 }
 rep(i,m){
   cin >> p;
   if(p) ans |= 1<<i;
 }

 rep(i,1<<n){
   int t=0;
   rep(l,n){
     if(i>>l&1) t ^= s[l];
   }
   if(t==ans) count++;
 }

 cout << count << endl;
}

Measured memory_bytes: 256
<?php
 fscanf(STDIN,"%d%d%d%d",$a,$b,$c,$d);
 $re1 = $a*$c;
 $re2 = $a*$d;
 $re3 = $b*$c;
 $re4 = $b*$d;

 echo max($re1,$re2,$re3,$re4);


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

using namespace std;

#define M 1000000007

int main() {
    int h, w;
    cin >> h >> w;

    vector<vector<char>> grid(h, vector<char>(w, '.'));
    vector<vector<int>> dp(h, vector<int>(w, 0));

    for(int i=0; i<h; ++i) for(int j=0; j<w; ++j) cin >> grid[i][j];

    dp[0][0] = 1;
    for(int i=1; i<w; ++i) dp[0][i] = (grid[0][i] == '#') ? 0 : dp[0][i-1];
    for(int i=1; i<h; ++i) dp[i][0] = (grid[i][0] == '#') ? 0 : dp[i-1][0];

    for(int i=1; i<h; ++i)
    {
        for(int j=1; j<w; ++j)
        {
            if(grid[i][j] == '#') dp[i][j] = 0;
            else dp[i][j] = ((dp[i-1][j]%M) + (dp[i][j-1]%M)) % M;
        }
    }

    cout << dp[h-1][w-1] << endl;

    return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	REP(i, N) scanf("%d", &A[i]);
	sort(ALL(A), greater<int>());
	
	ll ans = A[0];
	int cnt = 1;
	FOR(i, 1, N) {
		if (cnt < N - 1) { ans += A[i]; ++cnt; }
		if (cnt < N - 1) { ans += A[i]; ++cnt; }
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 4048
#pragma region 宣言部分
#include <iostream>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define rep(i,m,n) for(int i = (m);i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
#define Vec(a) vector <int> a
const int INF = 1 << 20;
const int MOD = 1e9+7;

#pragma endregion



int main(){
  int n;
  ll x;
  cin >> n >> x;
  vector <int> a(n);
  ll s = 0;
  REP(i,n){
      cin >> a[i];
      s += a[i];
  }
  sort(a.begin(), a.end());
  int sum = 0;
  if(s < x){
      cout << n-1 << endl;
      return 0;
  }else if(s == x){
      cout << n << endl;
      return 0;
  }
  REP(i,n){
      x -= a[i];
      if(x >= 0){
          sum++;
      }else{
          
          break;
      }
  }
  cout << sum << endl;
  return 0;
}


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

using namespace std;

int main() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long ac = a * c;
    long long ad = a * d;
    long long bc = b * c;
    long long bd = b * d;
    cout << max(ac, max(ad, max(bc, bd))) << endl;
    return 0;
}


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

#define ll long long int
#define INFTY (1<<21)

using namespace std;

int main(void){
    cin.sync_with_stdio(false);
    ll N,K;
    cin>>N>>K;
    vector<ll> hh;
    vector<ll> ans;
    for(ll i = 0; i < N; i++){
        ll tmp;
        cin>>tmp;
        hh.emplace_back(tmp);
    }
    sort(hh.begin(), hh.end());

    for(ll i = 0; i < N-K+1; i++){
        ans.emplace_back(hh[i+K-1]-hh[i]);
    }
    sort(ans.begin(), ans.end());
    cout<<ans[0]<<endl;

    return 0;
}

Measured memory_bytes: 2548
n = int(input())


def isprime(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0:
        return False
    i = 3
    while i <= x ** 0.5:
        if x % i == 0:
            return False
        i += 2
    return True


a = n
while 1:

    if isprime(a):
        print(a)
        break
    # print(a)
    a += 1

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,n,x,y,z;
    int a[100010];
    bool flag;
    cin>>n;x=y=z=0;
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        if (a[i]%4==0) x++;
        else
         if (a[i]%2==0) y++;
         else z++;
    }
    if (y)
    {
        if (x>=z) flag=true;
        else flag=false;
    }
    else
    {
        if (x+1>=z) flag=true;
        else flag=false;
    }
    if (flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 640
s = int(input())
def f(n):
  if n % 2 == 0:
    return n / 2
  else:
    return 3 * n + 1
count = 0
i = 0
j = 0
a = 0
list1 = [1, 2, 4]
while True:
  i += 1
  if i == 1:
    a = s
  else:
  	a = f(a)
  if a in list1:
    j = a
    list1 = []
  if a == j:
    count += 1
  if count == 2:
    print(i)
    break

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] c = new int[n];
        int[] v = new int[n];
        for(int i=0;i<n;i++){
            v[i] = Integer.parseInt(sc.next());
        }
        for(int i=0;i<n;i++){
            c[i] = Integer.parseInt(sc.next());
        }
        sc.close();
        int val = 0;
        for(int i=0;i<n;i++){
            if(v[i]-c[i]>0){
                val+=v[i]-c[i];
            }
        }
        System.out.println(val);
    }

}

Measured memory_bytes: 23764
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9+7
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

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;
}

//想定解答との絶対誤差または相対誤差が 10−6以下の場合+1以上だしておく。適当に15とかでもおｋ．
//cout << fixed << setprecision(15);

int main() {
    int N;
    cin >> N;
    if (N % 2 == 0) {
        cout << N/2 << endl;
    } else {
        cout << N/2+1 << endl;

    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main (String[] args){
        Scanner sc = new Scanner(System.in);
        while(true) {
            int H = sc.nextInt(), W = sc.nextInt();
            if(H == 0 && W == 0) break;
            for(int i = 0; i < H; i++) {
                for(int j = 0; j < W; j++) {
                    if((i%2==0)&&(j%2==0)||(i%2==1)&&(j%2==1)) {
                        System.out.print("#");
                    }else{
                        System.out.print(".");
                    }
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 34140