akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
    int n;
    cin>>n;
    if(n%2)cout<<"0\n";
    else
    {
        int cnt = 0;
        while(n)
        {
            cnt+=n/10;
            n/=5;
        }
        cout<<cnt;
    }
    
}   
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i >= n; --i)
typedef long long ll;
#define mod 1000000007
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>
int part(const T& s,int l, int r){return s[r] - s[l];};

int main() {
  int N, Q;
  string S;
  cin >> N >> Q;
  cin >> S;
  vector<int> memo(N + 1);
  rep(i, 1, N + 1) {
    memo[i] += memo[i - 1];
    if(S[i] == 'C') {
      if(S[i - 1] == 'A') memo[i]++;
    }
  }
  vector<int> l(Q), r(Q);
  rep(i, 0, Q) {
    cin >> l[i] >> r[i];
    l[i]--, r[i]--;
  }
  rep(i, 0, Q) {
    cout << part(memo, l[i], r[i]) << endl;
  }
  return 0;
}


Measured memory_bytes: 2176
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;

const int MAX = 1e5+5;



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

	map<char, int> m;
	for (int i = 0; i < h; i++) {
		string s;
		cin >> s;
		for (char c : s) {
			m[c]++;
		}
	}

	int cnt1 = 0;
	int cnt2 = 0;
	for (auto it = m.begin(); it != m.end(); it++ ) {

		int num = it->second;
		num%= 4;
		if (num % 2 == 1) {
			cnt1++;
			num--;
		}

		if (num == 2) {
			cnt2++;

		}

	}

	if (cnt1 > 1) {
		cout << "No" << endl;
		return 0;
	}



	if ((h * w) % 2 == 0 && cnt1 > 0) {
		cout << "No" << endl;
		return 0;
	}

	cnt2 -= (h / 2) * (w % 2) + (w / 2) * (h % 2);
	
	if (cnt2 > 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}



}

Measured memory_bytes: 3596
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

typedef long long ll;

int main(void)
{
    int n;
    cin >> n;
    int a[n];
    map<ll, ll> mp;

    REP(i, n)
    {
        int t;
        cin >> t;
        a[i] = t;
        mp[t]++;
    }
    long long ans = 0;
    for (auto i : mp)
    {
        if (i.second >= 2)
        {
            ans += i.second * (i.second - 1) / 2;
        }
    }

    REP(i, n)
    {
        int t = a[i];
        if (mp[t] >= 2)
        {
            cout << ans - mp[t] * (mp[t] - 1) / 2 + (mp[t] - 1) * (mp[t] - 2) / 2 << endl;
        }
        else
        {
            cout << ans << endl;
        }
    }
}

Measured memory_bytes: 10240
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;
			
void solve() {		
	string s;
	cin >> s;
	int cnt = 0, ans = 0;
	for(int i = 0; i < s.length(); ++i) {
		if(s[i] == 'R') cnt++;
		else {
			ans = max(ans, cnt);
			cnt = 0;
			}
		}
		if(cnt) ans = max(ans, cnt);
		cout << ans << endl;		
}


	

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(35);
	solve();
	return 0;
}






Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;
using ll = long long;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

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;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
///////////////////////////////////////////////

const ll inf = 5000;
ll dp[50][410][410];

int main() {
    int n, ma, mb; cin >> n >> ma >> mb;
    vector<int> a(n), b(n), c(n);
    rep(i,n) cin >> a[i] >> b[i] >> c[i];

    rep(i,n+1) rep(j,401) rep(k,401) {
        dp[i][j][k] = inf;
    }

    dp[0][0][0] = 0;
    rep(i,n) rep(j,400) rep(k,400) {
        if (a[i]+j<=400 && b[i]+k<=400) {
            chmin(dp[i+1][a[i]+j][b[i]+k], dp[i][j][k]+c[i]);
        }
        chmin(dp[i+1][j][k], dp[i][j][k]);
    }

    ll ans = inf;
    int aa=ma, bb=mb;
    while(aa<=400 && bb<=400) {
        chmin(ans, dp[n][aa][bb]);
        aa+=ma, bb+=mb;
    }

    if (ans == inf) cout << -1 << endl;
    else cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 55552
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<map>

using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
int main(){
    int h, w;
    cin >> h >> w;
    char a[h][w];
    rep(i, h)rep(j, w)cin >> a[i][j];

    bool dh[100] = {false};
    bool dw[100] = {false};
    rep(i, h){
        bool flag = true;
        rep(j, w)if(a[i][j] == '#')flag = false;
        if(flag)dh[i] = true;
    }
    rep(i, w){
        bool flag = true;
        rep(j, h)if(a[j][i] == '#')flag = false;
        if(flag)dw[i] = true;
    }

    rep(i, h)if(!dh[i]){
        rep(j, w){
            if(dw[j])continue;
            cout << a[i][j];
        }cout << endl;
    }
}

Measured memory_bytes: 256
N = int(input())
D1 = [0] * N
D2 = [0] * N
count = 0
continues = [0] * N

for i in range(N):
    D1[i], D2[i] = [int(x) for x in input().split()]

for i in range(N):
    if D1[i] == D2[i]:
        continues[i] = 1

for i in range(N):
    if continues[i] == 1:
        count = count + 1
    else:
        count = 0
    if count == 3:
        break

if count < 3:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 9192
n=int(input())
w=list()
for i in range(n):
    w.append(input())
ws=set(w)
if len(ws)!=n:
    print("No")
    exit()
x=0
for i in range(n-1):
    x=i+1
    if w[i][-1]!=w[x][0]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    cin>>s>>t;
    int a,b;
    cin>>a>>b;
    string u;
    cin>>u;
    if(s == u)a--;
    if(t == u)b--;
    cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;

ll k;

long long x[100006];

deque <int> q;

int main() {
	memset(x,inf,sizeof x);
	scanf("%lld",&k);
	x[1]=1;
	q.push_front(1);
	while (q.size()) {
	    int tmp=q.front();
		q.pop_front();
		if (x[(tmp*10)%k]>x[tmp]){
			x[(tmp*10)%k]=x[tmp];
			q.push_front((tmp*10)%k);
		}
		if (x[(tmp+1)%k] > x[tmp]+1){
			x[(tmp+1)%k]=x[tmp]+1;
			q.push_back((tmp+1)%k);
		}
	}
	printf("%lld",x[0]);
}

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

using namespace std;

int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	long long ans = 0;
	for (int i = k + 1; i <= n; i++) {
		int l = k, r = (i - 1);

		int x = (n - l) / i + 1;
		int y = (n - r) / i + 1;

		int range = (i - 1 - k + 1);

		ans += 1LL * y * range;
		if (x > y) {
			// int d = ((n - l + 1) / i) * i + l;
			// int d = n - ((i - 1) * x + l);
			int d = (n - l) / i * i + l;

			// printf("--> %d %d %d %d %d\n", i, x, y, d, n - d + 1);
			ans += n - d + 1;
		}

	}
	if (k == 0) ans -= n;
	printf("%lld\n", ans);
	return 0;
}

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

//#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>PII;
typedef vector<PII>Vll;
typedef vector<pair<int,pair<int,int> > >Vlll;
typedef priority_queue<int>PQL;
typedef map<int,int>MP;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) scanf("%lld",&n)
#define pl(n) printf("%lld",n)
const int mod=1e9+7;
const int sze=1e5+2;
signed main(){
   int a,b;
   sl(a);sl(b);
   int mn=min(a,b);
   int mx=max(a,b);
   for(int i=1;i<=mx;i++)cout<<mn;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int N;
	cin >> N;
	vector<ll> L(N + 1);
	L[0] = 2;
	L[1] = 1;
	for (int i = 2;i <= N;i++) L[i] = L[i - 1] + L[i - 2];
	cout << L[N] << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

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

	if (n % 10 == 9 || n / 10 == 9) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
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; }

string W[110];

int main() {
	int n;
	cin >> n;
	rep(i, n) {
		cin >> W[i];
	}
	bool ans = true;
	for (int i = 0;i < n-1;++i) {
		if (W[i].back() != W[i + 1].front()) {
			ans = false;
		}
	}
	for(int i=0;i<n;++i){
		for (int j = 0;j < i;++j) {
			if (W[i] == W[j]) {
				ans = false;
			}
		}
	}
	if (ans)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

int main()
{
    int n,m;//N個のスイッチ M個の電球
    cin>>n>>m;
    //a()への入力
    vector<int>a(n);//縦軸はN個のスイッチ　横軸はM個の電球
    REP(i,m)//i番目の電球
    {
        int k;//ki個のスイッチ
        cin>>k;
        REP(j,k)//電球iはki個のスイッチに繋がっておる
        {
            int s;
            cin>>s;
            s--;
            a[s]|=1<<i;//!!ビットa[s]にi番目のフラグを立てる
        }
    }
    int p=0;//スイッチのうちonになっているスイッチの個数を2で割った余りがpiに等しい時に点灯します。
    REP(i,m)
    {
        int x;
        cin>>x;
        p|=x<<i;//!!ビットpにi番目のフラグを立てる
    }
//入力部分完了
    int ans=0;
    REP(s,(1<<n))//０~n-1の集合を全探索
    {
         int t=0;//ｔはスイッチの状態sで電球の状態　初期化
        REP(i,n)//0~n-1探索
        {
            if(s>>i&1)//スイッチを押したかどうかを確認  i∈Sかどうか or if(S&(1<<i))
            {
                 t^=a[i];//押したら電球状態更新　^は排他的論理和(XOR)　2で割った余りの状態
            }
        }
      if(t==p)
        {
            ans++;
        }
    }
    cout<<ans<<endl;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

#define PI (2*acos(0.0))
#define eps 1e-9
#define pb push_back
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define show(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi] << " "; cout << endl;
#define showpair(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi].first << " " << v[fi].second << endl;
#define ff first
#define ss second
#define fu cout << "lol" << endl;
#define precision(n) cout << fixed << setprecision(n);
#define lb lower_bound
#define up upper_bound
#define vscan for(i = 0;i<n;i++){cin>>in; v.pb(in);}
#define all(a) a.begin(), a.end()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mem(a,val) memset(a,val,sizeof(a))
#define loop(i,n) for(i = 0; i < n; i++)
#define TC() ull T; cin>>T; while(T--)
#define IN(x) {scanf("%d",&x);}
#define LL(x) {scanf("%lld",&x);}
#define CC(x) {scanf("%c",&x);}
#define pfl(x) printf("%d\n",x)
#define pfll(x) printf("%lld\n",x)
#define newl puts("")
#define space printf(" ")
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL);

const int N = 1e5 + 100;
int arr[N][3];
int dp[N][3];

int main()
{
    int i = 0, j = 0, cs = 0, in;
    int n; cin>>n;
    for(i = 0; i < n; i++) cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
    dp[0][0] = max(arr[0][1], arr[0][2]);
    dp[0][1] = max(arr[0][0], arr[0][2]);
    dp[0][2] = max(arr[0][1], arr[0][0]);
    for(i = 1; i < n; i++){
        dp[i][0] = max(arr[i][1] + dp[i-1][1], arr[i][2] + dp[i-1][2]);
        dp[i][1] = max(arr[i][0] + dp[i-1][0], arr[i][2] + dp[i-1][2]);
        dp[i][2] = max(arr[i][1] + dp[i-1][1], arr[i][0] + dp[i-1][0]);
    }
    cout << max3(dp[n-1][0], dp[n-1][1], dp[n-1][2]) << endl;
    return 0;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;};
void qmod(ll &a,ll b){a=(a*b)%MOD;};
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}   


ll MAX_V = 10; //頂点数
struct edge {
    ll to;
    ll cost;
};
vector<vector<struct edge>> G(MAX_V); //隣接リスト
vector<ll> d(MAX_V); //各頂点への最短距離
void bellmanford(ll s){
  fill(ALL(d), INF);
  d[s]=0;
  for(ll i=0;i<MAX_V;i++){
    for(ll j=0;j<G.size();j++){
      for(ll k=0;k<G[j].size();k++){
        struct edge e=G[j][k];
        chmin(d[e.to],d[j]+e.cost);
      }
    }
  }
}

int main(){
  ll i,j,o;
  ll result=0,buf=0,buf1=0,buf2=0,buf3=0,buf4=0;
  bool judge = true;
  ll h,w; cin>>h>>w;
  for(i=0;i<10;i++){
    for(j=0;j<10;j++){
      cin>>buf;
      struct edge e ={j,buf};
      G[i].push_back(e);
    }
  }
  vector<ll> r(10);
  for(i=0;i<10;i++){
    bellmanford(i);
    r[i]=d[1];
  }
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      cin>>buf;
      if(buf!=-1)
      result+=r[buf];
    }
  }
  cout<<result<<endl;



  return 0;
}

Measured memory_bytes: 256
#include <math.h>

#include <algorithm>
#include <cassert>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846264338327950L
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

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

int main() {
  int K;
  cin >> K;
  int sum = 0;
  rep(i, K) {
    rep(j, K) {
      rep(l, K) { sum += gcd(gcd(i + 1, j + 1), l + 1); }
    }
  }
  cout << sum << endl;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n;
string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin >> s;
    n = (int)s.size();
    int le = 0;
    int ri = n - 1;
    int ans = 0;
    while (le <= ri) {
        if (s[le] == s[ri]) {
            ++le;
            --ri;
        } else if (s[le] == 'x') {
            ++le;
            ++ans;
        } else if (s[ri] == 'x') {
            --ri;
            ++ans;
        } else {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, N) for(int i=0; i<(N); i++)
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

vector<bool> seen;
vector<vector<int>> dist(2100, vector<int>(2100));

int main(){
    ll a, b, n, x;
    cin >> a >> b >> n;
    x = min(b-1, n);
    ll ans = a*x/b;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 20492
const int N = 400005;
const int LG = 21;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <bitset>
#include <deque>

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(N);
    __ufact.resize(N);
    __rev.resize(N);
    __rev[1] = 1;
    for (int i = 2; i < N; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < N; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

void __fast_IO()
{
    #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // ONLINE_JUDGE
}

//##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**
//##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**##**

int n, a[N], nz[N];
ll ans = 0;

signed main()
{
    __fast_IO();
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    int p = n;
    for (int i = n - 1; i >= 0; i--)
    {
        nz[i] = p;
        if (a[i] != 0) p = i;
    }
    for (int l = 0; l < n; l++)
    {
        ll si = 0, xo = 0;
        for (int r = l; r <= n; r = nz[r])
        {
            si += a[r];
            xo ^= a[r];
            if (r == n || si != xo)
            {
                ans += r - l;
                break;
            }
        }
    }
    cout << ans;
}

/* Note:
Check constants at the beginning of the code.
N is set to 4e5 but be careful in problems with large constant factor.
Check corner cases.
No def int long long for now.
*/


Measured memory_bytes: 1792
// ITP1_4_A: A / B Problem
// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4444811#1 にも掲載
// coutを用いた解法例

#include <iostream>
#include <iomanip>
using namespace std;

int main(){
    int a , b = 0;
    cin >> a >> b ;

    cout << a / b << " ";
    cout << a % b << " " ;

    cout << fixed;			//出力時の小数点以下の有効数字を6桁に設定
    cout << setprecision(6);
    cout << (double) a / b << endl;	//(double)はint→doubleの型変換
    return 0;
}


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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	int N,K; cin >> N >> K;
	vector<LL> s(K+1,0);
	s[K] = 1;
	const LL mod = 1e9+7;
	repp(i,0,N){
		int a; cin >> a;
		vector<LL> nx(K+1);
		nx[0] = s[a];
		repp(j,1,K+1) nx[j] = s[min(K,j+a)] - s[j-1];
		s[0] = nx[0];
		repp(j,0,K) s[j+1] = (s[j]+nx[j+1])%mod;
	}
	cout << (s[0]+mod)%mod << endl;
	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n,m,s;
	while(cin>>n>>m>>s,n){
		int N=n*n;
		int MOD=100000;
		vvi dp(N+1,vi(s+1));
		dp[0][0]=1;
		loop(x,1,m+1)for(int i=N-1;i>=0;i--)rep(j,s)if(j+x<=s){
			(dp[i+1][j+x]+=dp[i][j])%=MOD;
		}
		cout<<dp[N][s]<<endl;
	}
}
 
 

Measured memory_bytes: 1796
s = input()
a = []

for i in range(len(s)):
    if s[i] == '0':
        a.append('0')
    elif s[i] == '1':
        a.append('1')
    elif s[i] == 'B':
        if bool(a):
            a.pop(-1)

result = ''.join(a)

print(result)




Measured memory_bytes: 2940
//in the name of GOD//

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie();
#define sz(s) s.size()

int main(){
  fast;
  int n,q,b;
  ll m;
  cin >> n >> m >> q;
  int a[n];
  for(int i = 0;i < n;i++){
    a[i] = m;
  }
  for(int i = 0;i < q;i++){
    cin >> b;
    a[b - 1]++;
  }
  for(int i = 0; i < n;i++){
    if(a[i] > q)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5,inf=0x3f3f3f3f;
string s="AKIHABARA";
string a;
int main()
{
	cin>>a;
	int n=a.length(),m=s.length();
	if(n>m)
		puts("NO");
	else if(n==m)
		puts(a==s?"YES":"NO");
	else
	{
		int c[30],mk[30]={0};
		memset(c,inf,sizeof(c));
		for(int i=0;a[i];i++)
			c[a[i]-'A']=i,mk[a[i]-'A']++;	
		int k=c['K'-'A'],i=c['I'-'A'],h=c['H'-'A'];
		int b=c['B'-'A'],r=c['R'-'A'];
		bool flag=true;
		for(int i=0;i<26;i++)
		{
			if(mk[i]>1&&i!=0)
				flag=false;
			if(c[i]==inf)
				continue;
			if(i!='A'-'A'&&i!='K'-'A'&&i!='I'-'A'&&i!='H'-'A'&&i!='B'-'A'&&i!='R'-'A')
				flag=false;
		}
		for(int i=1;a[i];i++)
			if(a[i]==a[i-1])
				flag=false;
		if(flag&&i-k==1&&h-i==1&&b-h<=2&&r-b<=2)
			puts("YES");	
		else
			puts("NO");
	}
    return 0;
}




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

int main(){
  string s;
  cin >> s;

  int ans = 0;

  for(int i = 0; i < s.size()-1; i++)
  {
    if(s[i]==s[i+1]){
        if(s[i]=='0') s[i+1] = '1';
        else s[i+1] = '0';
        ans++;
    }
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 512
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    L=[2,1]
    n=int(input())
    for x in range(2,n+1):
        L.append(L[x-1]+L[x-2])
    print(L[n])

main()

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

int main()
{
    char c;
    cin>>c;
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
        cout<<"vowel"<<endl;
    }else{
        cout<<"consonant"<<endl;
    }
}

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

int main() {
	int ans = 0;
	string s = "";
	cin >> s;
	if (s == "MON")ans = 6;
	if (s == "TUE")ans = 5;
	if (s == "WED")ans = 4;
	if (s == "THU")ans = 3;
	if (s == "FRI")ans = 2;
	if (s == "SAT")ans = 1;
	if (s == "SUN")ans = 7;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

int main(void)
{
    std::string s;
    std::cin >> s;

    for (int i = 0; i < (1 << (s.length() - 1)); i++) {
        int sum = s[0] - '0';
        for (int j = 0; j < (s.length() - 1); j++) {
            if ((1 << j) & i) {
                sum += s[j + 1] - '0';
            } else {
                sum -= s[j + 1] - '0';
            }
        }

        if (sum == 7) {
            for (int j = 0; j < (s.length() - 1); j++) {
                std::cout << s[j];
                if ((1 << j) & i) {
                    std::cout << '+';
                } else {
                    std::cout << '-';
                }
            }
            std::cout << s[3] << "=7" << std::endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include<queue>
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
#define Spa putchar(32)
int read()
{
	int s=0,c=getchar(),f=1;
	while(c<48||c>57)
	{
		if(c==45) f=-1;
		c=getchar();
	}
	while(c>=48&&c<=57) s=(s<<3)+(s<<1)+(c^48),c=getchar();
	return s*f;
} 
void write(int x)
{
	if(x>=10) write(x/10);
	putchar(x%10+48);
}
void W(int x)
{
	if(x<0) x=-x,putchar(45);
	write(x);
}
int main()
{
	int a=read(),b=read(),c=read();
	write(min(b/a,c));
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007
template<typename ty1,typename ty2>
inline int add(ty1 x, ty2 y) {
	if(y>=MOD)y%=MOD;
	if(x>=MOD)x%=MOD;
    x += y; return x < MOD ? x : x - MOD;
}
template<typename ty1,typename ty2>
inline void addto(ty1 &x, ty2 y) {
		  if(y>=MOD)y%=MOD;
		  if(x>=MOD)x%=MOD;
	      x += y; if (x >= MOD) x -= MOD;
}
template<typename ty1,typename ty2>
inline int sub(ty1 x, ty2 y) {
		if(y>=MOD)y%=MOD;
		 if(x>=MOD)x%=MOD;
        x -= y; return x < 0 ? x + MOD : x;
}
template<typename ty1,typename ty2>
inline void subto(ty1 &x, ty2 y) {
	if(y>=MOD)y%=MOD;
	if(x>=MOD)x%=MOD;
    x -= y; if (x < 0) x += MOD;
}
template<typename ty1,typename ty2>
inline int mul(ty1 x, ty2 y) {
        if(y>=MOD)y%=MOD;
		if(x>=MOD)x%=MOD;
        return 1ll * x * y % MOD;
}
template<typename ty1,typename ty2>
void multo(ty1 &x, ty2 y) {
        if(y>=MOD)y%=MOD;
		if(x>=MOD)x%=MOD;
        x=1ll * x * y % MOD;
}
  
long long int gcd(long long int a, long long int b){
	if (a > b){
		swap(a, b);
	}
	while (a){
		swap(a, b);
		a %= b;
	}
	return b;
}
long long int lcm(long long int a, long long int b){
	return a / gcd(a, b)*b;
}
long long int ppow(long long int i, long long int j){
		long long int res = 1LL;
		while (j){
			if ((j & 1LL)){
				res *= i;
				if (res >= MOD){
					res %= MOD;
				}
			}
			j >>= 1;
			i *= i;
			if (i >= MOD){
				i %= MOD;
			}
		}
		return res;
	}
class Combination{
	
public:
	vector<long long int> k;
	vector<long long int> r;
	void resize(int N){
		k.resize(N + 2);
		r.resize(N + 2);
		k[0] = 1;
		for (int i = 1; i < N+2; i++){
			k[i] = k[i - 1];
			k[i] *= i;
			if (k[i] >= MOD)k[i] %= MOD;
		}
		long long int al = k[k.size() - 1];
		long long int iv = ppow(k[k.size() - 1],MOD-2);
		r[k.size() - 1] = iv;
		for (int i = (int)(r.size()) - 2; i >= 0; i--){
			r[i] = r[i + 1] * (i + 1);
			if (r[i] >= MOD){
				r[i] %= MOD;
			}
		}
	}
	long long int C(int a, int b){
		if (a < b)return 0;
		long long int up = k[a];
		long long int dw = r[b] * r[a - b];
		dw %= MOD;
		up *= dw;
		up %= MOD;
		return up;
	}
	long long int H(int a, int b){
		return C(a + b - 1, b);
	}
	long long int catalan_number(int n){
		return (C(2 * n, n) + MOD - C(2 * n, n - 1)) % MOD;
	}
};
Combination C;

#define MAX 100002

int n;
vector<int> v;
int main(){
	cin>>n;
	long long int sum=0;
	for(int i=0;i<n;i++){
		int a;
		scanf("%d",&a);
		v.push_back(a);
		sum+=a%2;
	}
	if(sum){
		puts("first");
	}
	else{
		puts("second");
	}
	return 0;
}


Measured memory_bytes: 892
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = list(input(""))

stra = {"r":"p","s":"r","p":"s"}
point = {"r":R,"s":S,"p":P}
c = 0
result = []
for i in range(K):
    c += point[stra[T[i]]]
    result.append(stra[T[i]]) 
    

for i in range(K,N):
    before = result[i-K]
    if i <= N - K - 1:
        after = stra[T[i+K]]
    if stra[T[i]] == before:
        result.append("ok")
    else:
        c += point[stra[T[i]]]
        result.append(stra[T[i]])
        
print(c)

Measured memory_bytes: 49676
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>

bool check(int n, int m, int k) {
  if (k % n == 0 || k % m == 0)
    return true;
  for (int i = 1; i <= m; ++i) {
    for (int j = 1; j < n; ++j) {
      if (i * n + j * m - 2 * i * j == k)
        return true;
    }
  }
  return false;
}

int main() {
  int n, m, k;
  std::cin >> n >> m >> k;
  std::cout << (check(n, m, k) ? "Yes" : "No") << std::endl;
}


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


int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	for(int i = 1; ; i++) {
		int x, y;
		cin >> x >> y;

		if(x == 0 && y == 0) break;
		cout << min(x, y) << " " << max(x, y) << "\n";

	}

	return 0;
}

Measured memory_bytes: 1204
#include<iostream>
#include<algorithm>
#define LL long long
LL N;
LL A[100010];
LL sum;

int main() {
	std::cin >> N;
	for (int i = 1; i <= N; i++) {
		std::cin >> A[i];
		sum += A[i];
		if (i == N)A[0] = A[N];
	}
	LL D = ((N + 1)*N) / 2;
	if (sum%D) {
		std::cout << "NO" << std::endl;
		return 0;
	}
	LL ave = sum / D;
	for (int i = 1; i < N; i++) {
		LL tmp = A[i] - A[i - 1];
		if (tmp > ave || (ave - tmp) % N) {
			std::cout << "NO" << std::endl;
			return 0;
		}
	}
	std::cout << "YES" << std::endl;
	return 0;
}

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

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

  vector<ll> a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }

  deque<ll> colors;
  for (ll i = 0; i < n; i++) {
    auto it = lower_bound(colors.begin(), colors.end(), a[i]);
    if (it == colors.begin()) {
      colors.push_front(a[i]);
    } else {
      *(it - 1) = a[i];
    }
  }

  cout << colors.size() << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

int main() {
    int a, b, c; cin >> a >> b >> c;
    out(min({a + b, b + c, c + a}));
}


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

// #include "debug.h"
#define debug(...) 42

void solve() {
   int a, b, c, k;
   cin >> a >> b >> c >> k;

   for(int i = 0; i <= k; i++) {
      int b_ = b * (1 << i);
      int c_ = c * (1 << (k - i));
      if((a < b_) && (b_ < c_)) {
         cout << "Yes" << endl;
         return;
      }
   }
   cout << "No" << endl;

} 

int main() {
   cin.tie(0);
   cin.sync_with_stdio(0);
   int testcase = 1;
   // cin >> testcase;

   for(int i = 0; i < testcase; i++) {
      solve();
   }
   return 0;
}


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

constexpr int N = 999999;
vector<bool> primes( N+1, true );

void make_table() {
	primes[0] = false;
	primes[1] = false;

	int nr = (int)sqrt( N );
	for( int i = 2; i <= nr; ++i ) {
		if( primes[i] ) {
			for( int j = i+i; j <= N; j += i ) {
				primes[j] = false;
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio( false );

	make_table();

	int n;
	while( cin >> n ) {
		cout << count( primes.begin()+1, primes.begin()+1 + n, true ) << endl;
	}
}



Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)
#define pii pair<int, int>

/////////////////////////////////////////////////////////

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
T1 mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  T1 tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

/////////////////////////////////////////////////////////

void Main(){
  int N, K; cin >> N >> K;
  int res = 0;
  rep(i, 0, N){
    int tmp; cin >> tmp;
    if(tmp >= K) res++;
  }
  cout << res << endl;
}

/////////////////////////////////////////////////////////

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

  Main();
}


Measured memory_bytes: 256
N, L = map(int,input().split())
def f(i):
	return L+i-1
def eat(bad):
	return sum([f(i) for i in range(1,N+1) if i!=bad])
best = 10**18
best_val = -1
for i in range(1,N+1):
	x = abs(eat(i)-eat(-1))
	if x < best:
		best = x
		best_val = eat(i)
print(best_val)

Measured memory_bytes: 66740
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stdio.h>

using namespace std;

long long l[90];

int main()
{
   l[0]=2;
   l[1]=1;
   for(int i=2;i<100;i++)
   {
      l[i]=l[i-1]+l[i-2];
   }
   int k;
   cin>>k;
   cout<<l[k]; 
   //system("pause");
    return 0;
} 

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

typedef long long ll;

const int MAXN = 1e5 + 7;

int a[MAXN], b[MAXN];
int main(){
    int n;
    cin >> n;
    n++;
    for(int i = 1; i <= n; ++i){
        cin >> a[i];
    }
    for(int i = 1; i < n; ++i){
        cin >> b[i];
    }
    ll ans = 0;
    for(int i = 1; i < n; ++i){
        if(b[i] >= a[i]){
            ans += a[i];
            b[i] -= a[i];
        } else {
            ans += b[i];
            b[i] = 0;
        }
        if(b[i]){
            ans += min(a[i+1], b[i]);
            a[i+1] -= min(a[i+1], b[i]);
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(void)
{
    string s;
    cin >> s;
    map<char, int> mp;
    int dai = 0, syou = 0;
    rep(i, s.length())
    {
        if (i == 0)
        {
            if (s[i] != 'A')
            {
                cout << "WA" << endl;
                return 0;
            }
        }
        else if (1 < i && i < s.length() - 1)
        {
            if ('a' <= s[i] - 'a' && s[i] - 'z' <= 'Z')
            {
                cout << "WA" << endl;
                return 0;
            }
            mp[s[i]]++;
        }
        if (s[i] >= 'A' && s[i] <= 'Z')
            dai++;
        else
            syou++;
    }
    if (mp['C'] != 1 || dai != 2)
    {
        cout << "WA" << endl;
        return 0;
    }
    cout << "AC" << endl;
}


Measured memory_bytes: 3612
fn main() {
  let x: f64 = read();
  
  for h in 1 .. 3501 {
    for n in 1 .. 3501 {
      let w = x / (4.0 - x/(h as f64) - x/(n as f64));
      let w2 = w.round();
      if w > 0.0 && w <= 3500.0 && (w-w2).abs() < 0.0000001 {
        println!("{} {} {} ", h, n, w2);
        return;
      }
    }
  }
}

fn read<T: std::str::FromStr>() -> T {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  buf.trim().parse::<T>().ok().unwrap()
}

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


int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  int j1 = 0, j2 = 0;
  for(int x : a) {
    if(x == 5)
      j1++;
    if(x == 7)
      j2++;
  }
  if(j1 == 2 && j2 == 1)
    cout << "YES";
  else
    cout << "NO";

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
#define si short int
using namespace std;
const int N=101;
si n,m,x,y,ans,dp[N][N][N][N],sum[N][N];
char g[N][N];
template<typename I> inline void read(I &ot){
	I ch=getchar(), x=0, f=1;
	while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();	}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();	}
	ot=x*f;}
template<typename I, typename... U> inline void read(I &x,U&... y){read(x); read(y...);}
template<typename I>inline I mx(const I&a,const I&b){return a>b ? a : b;}
template<typename I>inline I mi(const I&a,const I&b){return a<b ? a : b;}
template<typename I>inline void swp(I&a,I&b){I t=a; a=b; b=t;}
inline void cmx(si &a,si b){if(b>a) a=b;}
inline si s(int a,int b,int c,int d){
	if(a>c) swp(a,c); if(b>d) swp(b,d);
	return sum[c][d]-sum[c][b-1]-sum[a-1][d]+sum[a-1][b-1];
}
int main()
{
//	freopen("Salvage Robots.in","r",stdin);
	read(n,m);
	for(RG int i=1;i<=n;i++) 
	{
		scanf("%s",g[i]+1);
		for(RG int j=1;j<=m;j++)
		{
			if(g[i][j]=='o') sum[i][j]=1;
			else if(g[i][j]=='E') x=i, y=j;
			sum[i][j]+=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
		}
	}
	for(int i=x;i;i--)
	 for(int j=y;j;j--)
	  for(int k=x;k<=n;k++)
	   for(int l=y;l<=m;l++)
	   {
			ans=mx(ans,dp[i][j][k][l]);
			int li=l-y+1, ri=m-y+j, us=k-x+1, ds=n-x+i;
			if(i-1>=us) cmx(dp[i-1][j][k][l],dp[i][j][k][l]+s(i-1,mx(li,j),i-1,mi(ri,l)));
			if(j-1>=li) cmx(dp[i][j-1][k][l],dp[i][j][k][l]+s(mx(i,us),j-1,mi(k,ds),j-1));
			if(k+1<=ds) cmx(dp[i][j][k+1][l],dp[i][j][k][l]+s(k+1,mx(li,j),k+1,mi(ri,l)));
			if(l+1<=ri) cmx(dp[i][j][k][l+1],dp[i][j][k][l]+s(mx(i,us),l+1,mi(k,ds),l+1));
	   }
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 201088
//nani?
#include<bits/stdc++.h>
#define pi acos(-1);
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define f(i,a,b) for( int i = a; i < b ; i++ ) 
#define sor(a) sort( a.begin(), a.end() )
#define rsor(a) sort( a.rbegin(), a.rend() )
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
//#define inf 1LL<<62
typedef long long ll;
typedef double ld;
using namespace std;
const ll inf=1e9;
const ll MOD=1e9+7;
// ac cmtr;
const ll MAX_N = 1e5;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);}
#else
#define trace(...)
#endif
//---------------------------
 

char c[1005][1005];
ll dp[1005][1005];

int main(){
    fastio;
    ll h,w;
    cin>>h>>w;
    f(i,0,h){
        f(j,0,w){
            cin>>c[i][j];
            if(c[i][j]=='#') dp[i][j]=0;
        }
    }
  	dp[0][0]=1;
    f(i,1,h){
      if(c[0][i]=='#') continue;
        dp[0][i]+= (dp[0][i-1])%MOD;
    }
    f(i,1,w){
      if(c[i][0]=='#') continue;
        dp[i][0]+=(dp[i-1][0])&MOD;
    }
    
    f(i,1,h){
        f(j,1,w){
          if(c[i][j]=='#') continue;
            dp[i][j]=(dp[i][j-1]+dp[i-1][j])%MOD;
        }
    }
  
  	/*f(i,0,h){
        f(j,0,w){
            cout<<dp[i][j]<<" ";
        }
      cout<<endl;
    }*/
    cout<<dp[h-1][w-1]%MOD<<endl;



    return 0;
}   

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

using namespace std;


int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++) {
        cin >> p[i];
    }
    int ans = 0;
    for(int i = 1; i < n - 1; i++) {
        if(p[i-1] < p[i] && p[i] < p[i+1]) {
            ans++;
        }
        else if(p[i+1] < p[i] && p[i] < p[i-1]) {
            ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3624
n = int(input())
l = []
for _ in range(n):
    a, b = map(int, input().split())
    l.append([a, b])

l.sort(key=lambda x: x[1])
time = 0
for w, t in l:
    time += w
    if t < time:
        print("No")
        exit()
else:
    print("Yes")


Measured memory_bytes: 84568
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m;
  cin>>n>>m;
  int a[n];int q=0;
  for(int i=0;i<n;i++)
  { cin>>a[i];
   q+=a[i];
  }
  int p=0;
  int t=4*m;
  q=(int)ceil((double)q/t);
  for(int i=0;i<n;i++)
    if(a[i]>=q)
      p++;
  if(p>=m)
    cout<<"Yes\n";
  else
    cout<<"No\n";
  return 0;
}
  


Measured memory_bytes: 256
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

N = int(input())
a_list = []
b_list = []

for i in range(N):
	A,B = map(int,input().split(" "))

	a_list.append((A,B))

a_list.sort()

print(a_list[-1][1] + a_list[-1][0])

Measured memory_bytes: 16988
#include<stdio.h>
char c;
int N, A, i;
int main(void){
	c=getchar();
	while(c!=10){N=N*10+(c-'0'); c=getchar();}
	for(i=0; i<N; i++){
		c=getchar();
		while(c!=10){A=c; c=getchar();}
		if(A&1){
			printf("first\n");
			return 0;
		}
	}
	printf("second\n");
	return 0;
}


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


Measured memory_bytes: 32596