akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>
#define INF 100000000.0f
using namespace std;
double dp[12][1<<12];
int s[12];
double min(double a,double b){return a<b?a:b;}
int main(){
	int l;
	while(scanf("%d",&l)!=EOF){
		int i=0,j,k;
		while(1){
			char c;
			scanf("%d%c",&s[i],&c);
			i++;
			if(c=='\n')break;
		}
		int n=i;
		for(i=0;i<1<<n;i++)for(j=0;j<n;j++)dp[j][i]=INF;
		for(i=0;i<n;i++)dp[i][(1<<n)-1-(1<<i)]=s[i];
		for(i=(1<<n)-2;i>=0;i--){
			for(j=0;j<n;j++){
				if(i>>j&1)continue;
				for(k=0;k<n;k++)dp[j][i]=min(dp[j][i],dp[k][i|1<<j]+2*sqrt(s[j]*s[k]));
			}
		}
		double ans=INF;
		for(i=0;i<n;i++)ans=min(ans,dp[i][0]+s[i]);
		if(ans<=l)printf("OK\n");
		else printf("NA\n");
	}
	return 0;
}

Measured memory_bytes: 1392
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
	int n, m;
	cin >> n >> m;
	int h[n + 1];
	int g[n + 1] = { 0 };
	for (int i = 1; i <= n; ++i)
		cin >> h[i];
	int a, b;
	for (int i = 0; i < m; ++i) {
		cin >> a >> b;
		g[a] = max(g[a], h[b]);
		g[b] = max(g[b], h[a]);
	}
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		ans += (h[i] > g[i]) ? 1 : 0;
	}
	cout << ans << "\n";

	//cout << ct;

}


Measured memory_bytes: 5192
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back
#define pp pair<int,int>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define inf 1000000000000000000
#define int long long
int dp[405][405];
 main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt.txt","r",stdin);
	// freopen("output.txt.txt","w",stdout);
	// #endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin>>n;
	vi a(n);
	rep(i,0,n) cin>>a[i];
	
	vi pref(n,0);
	rep(i,0,n)
	{
		pref[i] = a[i];
		if(i>0) pref[i]+=pref[i-1];
	}
	rep(len,1,n+1)
	{
		rep(i,0,n-len+1)
		{
			int j = i+len-1;
			dp[i][j] = inf; 
			if(i==j)
			{
				dp[i][j] = 0;continue;
			}
			
			rep(k,i,j)
			{
				int s = pref[j];
				if(i>0) s-=pref[i-1];

				dp[i][j] = min(dp[i][j],dp[i][k]+dp[k+1][j]+s);
			}
		}
	}
	cout<<dp[0][n-1]<<endl;

}

Measured memory_bytes: 1536
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include <fstream>
#include <time.h>
#include <iterator>




#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
using namespace std;
int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;

int expr(string& s, int& i);
int term(string& s, int& i);
int factor(string& s, int& i);
int number(string& s, int& i);

int expr(string& s, int& i) {
	int val = term(s, i);
	while (s[i]=='+'||s[i]=='-')
	{
		char op = s[i];
		i++;
		int val2 = term(s, i);
		if (op == '+')val += val2;
		else val -= val2;
	}
	return val;
}

int term(string &s, int &i) {
	int val = factor(s, i);
	while (s[i]=='*'||s[i]=='/')
	{
		char op = s[i];
		i++;
		int  val2 = factor(s, i);
		if (op == '*')val *= val2;
		else val /= val2;
	}
	return val;
}

int factor(string &s, int &i) {
	if (isdigit(s[i]))return number(s, i);
	i++;
	int ret = expr(s, i);
	i++;
	return ret;
}

int number(string &s, int &i) {
	int n = s[i++] - '0';
	while (isdigit(s[i])) {
		n = n * 10 + s[i++] - '0';
	}
	return n;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	REP(i, N) {
		string str;
		cin >> str;
		int j = 0;
		print(expr(str, j));
	}
}



Measured memory_bytes: 3072
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

int main(){
	int n;
	cin >> n;
	map<string, int> res;
	rep(i,n){
		string s;
		cin >> s;
		res[s]++;
	}
	cout << "AC x " << res["AC"] << endl;
	cout << "WA x " << res["WA"] << endl;
	cout << "TLE x " << res["TLE"] << endl;
	cout << "RE x " << res["RE"] << endl;
}

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

using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
#define inf 1ll<<60
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
#define int llong
#define be(x) x.begin(), x.end()
typedef pair<int, int> P;


signed main(){
	int n, m;
	vector<int> x, dis;
	cin >> n >> m;
	x.resize(m);
	for(int i = 0; i < m; i++)
		cin >> x[i];
	sort(be(x));
	for(int i = 1; i < m; i++)
		dis.pb(x[i] - x[i-1]);
	sort(be(dis));
	int ans = 0;
	for(int i = 0; i < m-n; i++)
		ans += dis[i];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2168
#include <stdio.h>
#include <algorithm>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x1f3f3f3f3f3f3f3f;
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)

const int MX = 200005;

vector<int> G[MX];
vector<int> H[MX];
vector<int> P, ans;
int sz = 0;

void dfs(int x, int b = -1){
	int nxt = -1;
	if(H[x].size() == 2) nxt = H[x][0] ^ H[x][1] ^ b;
	if(b == -1 && H[x].size() == 1) nxt = H[x][0];
	int cur = ++sz;
	for(int c : G[x]){
		if(nxt == c || c == b) continue;
		P.push_back(++sz);
	}
	P.push_back(cur);
	if(nxt != -1) dfs(nxt, x);
}

int main()
{
	int N;
	scanf("%d", &N);
	if(N == 2) return !printf("1 2\n");
	for(int i = 1; i < N; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		G[a].push_back(b);
		G[b].push_back(a);
	}
	for(int i = 1; i <= N; i++){
		if(G[i].size() == 1) continue;
		for(int c : G[i]){
			if(G[c].size() == 1) continue;
			H[i].push_back(c);
		}
	}
	vector<int> st;
	for(int i = 1; i <= N; i++){
		if(H[i].size() >= 3) return !printf("-1\n");
		if(H[i].size() == 1) st.push_back(i);
	}
	if(st.size() > 2) return !printf("-1\n");
	if(st.size() == 0){
		printf("1 ");
		for(int i = 2; i < N-1; i++) printf("%d ", i+1);
		printf("2 %d\n", N);
		return 0;
	}

	for(int &c : st){
		for(int d : G[c]){
			if(G[d].size() == 1){
				H[c].push_back(d);
				H[d].push_back(c);
				c = d;
				break;
			}
		}
	}

	for(int c : st){
		sz = 0; dfs(c);
		if(ans.empty() || ans > P) ans = P;
		P.clear();
	}
	for(int c : ans) printf("%d ", c); puts("");
}


Measured memory_bytes: 23548
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int flag=0,i,j,n;
	scanf("%d",&n);
	for(i=0;i<=n&&!flag;i++)
		for(j=0;j<=n&&!flag;j++)
			if(i*4+j*7==n)
				flag=1;
	if(flag)
		printf("Yes");
	else
		printf("No");
	return 0;
}

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

using namespace std;

int N, A, B, C;
int CalorieInfo[101];

void solve() {
	int maxSum, curSum;

	maxSum = -1;
	for (int k = 0; k <= N; ++k) {
		curSum = C;
		for (int i = 1; i <= k; ++i) {
			curSum += -CalorieInfo[i];
		}
		maxSum = max(maxSum, curSum / (A + k*B));
	}
	cout << maxSum << endl;
}

int main() {
	int num;

	memset(CalorieInfo, 0, sizeof(CalorieInfo));
	cin >> N >> A >> B >> C;
	for (int i = 1; i <= N; ++i) {
		cin >> num;
		CalorieInfo[i] = -num;
	}
	sort(CalorieInfo + 1, CalorieInfo + N + 1);
	solve();

	return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof a)
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    int x,y;
    cin>>x>>y;
    for(int i=0,j=x;i<=x,j>=0;i++,j--)
        if(2*i+4*j==y)
    {
        cout<<"Yes";
        return 0;
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define rep(i, f, n) for (int i = (f); i < (int)(n); i++)
#define repe(i, f, n) for (int i = (f); i <= (int)(n); i++)
using namespace std;
using ll = long long;
using pint = pair<int, int>;

const int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  int dp[2][101];
  dp[0][0] = 0;
  dp[1][0] = 0;
  repe(i, 1, n) {
    cin >> dp[0][i];
    dp[0][i] += dp[0][i - 1];
  }
  repe(i, 1, n) {
    cin >> dp[1][i];
    dp[1][i] += max(dp[1][i - 1], dp[0][i]);
  }
  cout << dp[1][n] << endl;

  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
using namespace std;
int main(void){
    int n,i;
    cin >> n;
    int a[n];
    for (i=0;i<n;i++){
        cin >> a[i];
    }
    cout << a[n-1];
    for (i=n-2;i>=0;i--){
        cout << " " << a[i];
    }
    cout << endl;
}


Measured memory_bytes: 3072
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define repe(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF 100000000

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

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    IO;

    ll q; cin >> q;
    vector<ll> A;

    ll s, t;

    rep(i, q) {
        cin >> s;
        if (s == 0) {
            cin >> t;
            A.push_back(t);
        }
        else if (s == 1) {
            cin >> t;
            cout << A[t] << endl;
        }
        else {
            A.pop_back();
        }
    }

}


Measured memory_bytes: 5000
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "debug" << endl;
#define pb push_back
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; }

int N;
vector<vector<ll>> V(1010,vector<ll>(1010,0));
int MOD = 1000000007;

void so(int i,vector<vector<ll>> &V){
    int a = 2;
    int u = i;
    while(i >= a*a){
        if(i % a == 0){
            V[u][a]++;
            V[u][a] %= MOD;
            i /= a;
        }
        else a++;
    }
    V[u][i]++;
    return;
}

int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    cin >> N;
    ll sum = 1;
    REPP(i,2,1001) so(i,V);
    vector<ll> num(1010,0);
    REPP(i,2,N+1){
        REPP(j,2,N+1){
            num[j] += V[i][j];
            num[j] %= MOD;
        }
    }
    REPP(j,2,N+1){
            sum *= num[j]+1;
            sum %= MOD;
    }
    cout << sum << endl;
}

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

#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 reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;
using i32 = int;
using i64 = long long;
using f64 = double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf64 = vector<f64>;
using vstr = vector<string>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  int a, b, c;
  cin >> a >> b >> c;
  if (a < c && c < b || b < c && c < a) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
s = input()
length = range(0, len(s))
first_A = -1

for i in length:
    if s[i] == 'A':
        first_A = i
        break
    else:
        continue

last_Z = -1

for j in list(reversed(length)):
    if s[j] == 'Z':
        last_Z = j
        break
    else:
        continue

max_diff = last_Z - first_A
print(max_diff + 1)


Measured memory_bytes: 11240
#include <cstdio>
#include <cstdlib>
#include <algorithm>

using ll = long long;

constexpr ll MAX_N = 1000000000;
constexpr ll MAX_K = 1000;

int main(){
	ll N, K;
	scanf("%llu%llu", &N, &K);

	for(int i = 0; i < K; ++i){
		ll a, b;
		std::scanf("%llu%llu", &a, &b);
		ll x = std::min(a, std::abs(N - a) + 1);
		ll y = std::min(b, std::abs(N - b) + 1);
		ll tmp = std::min(x, y) % 3;
		if(tmp == 0){
			tmp = 3;
		}
		std::printf("%llu\n", tmp);
	}

	return 0;
}

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


int main() 
{
   int n;
   cin >> n;
   int a[n];
   for(int i=0; i<n; i++){
       cin >> a[i];
       if(a[i]%2==0){
           if(a[i]%3==0 || a[i]%5==0){
               
           } else {
               cout << "DENIED";
               return 0;
           }
       }
   }
   cout << "APPROVED";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define mset(x,y) memset(x,y,sizeof(x))
#define rep(i,n) for(int i=0;i<int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
#ifdef LOCAL
#define dmp(...) _dmp(#__VA_ARGS__, __VA_ARGS__)
#else
#define dmp(...) (__VA_ARGS__)
#endif
template<class T> using vt=vector<T>;
template<class T> using vvt=vt<vt<T>>;
template<class TA,class TB> void chmax(TA&a,TB b){if(a<b)a=b;}
template<class TA,class TB> void chmin(TA&a,TB b){if(b<a)a=b;}
template<class TA,class TB>
ostream& operator<<(ostream& os,const pair<TA,TB>& p){
	return os<<"{"<<p.fi<<","<<p.se<<"}";
}
template<class T> ostream& operator<<(ostream& os,const vt<T>& v){
	os<<"{";for(auto& e:v)os<<e<<",";return os<<"}";
}
template<class TH> void _dmp(const char *sdbg, TH h){cout<<sdbg<<"="<<h<<endl;}
template<class TH, class... TA> void _dmp(const char *sdbg, TH h, TA...a){
while(*sdbg!=',')cout<<*sdbg++;cout<<"="<<h<<","; _dmp(sdbg+1, a...);
}
template<class T> void make_unique(vt<T>& v) {
	sort(all(v));v.erase(unique(all(v)),v.end());
}
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
int ri(){int x;cin>>x;return x;}
ll rll(){ll x;cin>>x;return x;}
vi rvi(int n){vi v;rep(i,n)v.pb(ri());return v;}
ll a,b,c;
void MAIN() {
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b;
}
int main() {
	ios::sync_with_stdio(false);cin.tie(0);
	int T=1;
	//cin>>T;
	for(int tt=1;tt<=T;tt++) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 384
object Main extends App {
  val line = scala.io.StdIn.readLine()
  val num = line.toInt
  println(new candy(num).toInt)

  class candy(n: Int) {
    val num = n
    val result = 0
    def calc(num: Int, r: Int): Int =
      if (num == 0) r else calc(num - 1, r + num)
    def toInt = calc(num, result)
  }
}


Measured memory_bytes: 25268
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
#include <cmath>
using namespace std;
 
 
int main() {
    int N;
    cin >> N;
    
    int table[9] = {111, 222, 333, 444, 555, 666, 777, 888, 999};
    
    int div = N/100;
    
    int n = (N > table[div-1]) ? div : div -1;

    cout << table[n] << endl;
    
    return 0;
}

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

int main(){
    string s,t;
    cin >> s >> t;
    int max=0;
 
    for(int i=0; i<s.size()-t.size()+1; i++){
            int count = 0;
        for(int j=0; j<t.size(); j++){
            if(s[i+j] == t[j])count++;
        }
        if(count > max)max = count;
    }
  
    cout << t.size()-max << endl;
    return 0;
}

Measured memory_bytes: 3588
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        long[] list = new long[n];
        for (int i = 0; i < n; i++) {
            list[i] = sc.nextLong();
        }

        Arrays.sort(list);

        long min = list[0];

        for (int i = 1; i < n; i++) {
            long value = gcd(list[0], list[i]);
            if(value < min) {
                min = value;
            }
            if (min == 1) {
                break;
            }
        }

        System.out.println(min);
    }

    private static long gcd (long a, long b) {
        long temp;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return b;
    }
}

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

const int maxn = 2e5 + 5;
const LL mod = 1e9 + 7;

LL quickpow(LL m, LL p)
{
    LL res = 1;
    m %= mod;
    while (p) {
        if (p & 1)
            res = res * m % mod;
        m = m * m % mod;
        p >>= 1;
    }
    return res;
}

LL inv[maxn + 5];
void init()
{
    inv[1] = 1;
    for (int i = 2; i < maxn; i++) {
        inv[i] = (mod - mod / i) * (LL)1 * inv[mod % i] % mod;
    }
}
LL comb(LL n, LL m)
{
    LL res = 1;
    for (LL i = n; i >= n - m + 1; i--)
        res = res * i % mod;
    for (int i = 1; i <= m; i++)
        res = res * inv[i] % mod;
    return res;
}

int main()
{
    init();

    int n, x, y;
    scanf("%d%d%d", &n, &x, &y);

    LL ans = (quickpow(2, n) - 1 + mod) % mod;
    ans = (ans - comb(n, x) + mod) % mod;
    ans = (ans - comb(n, y) + mod) % mod;

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, m;
    cin >> n >> m;
    int INF = 1001001001;
    vector<vector<int>> d(n, vector<int>(n, INF));
    vector<P> p;
    rep(i, m){
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        d[a][b] = c;
        d[b][a] = c;
        p.push_back(make_pair(a, b));
    }
    rep(i, n)d[i][i] = 0;
    vector<vector<int>> dd = d;
    rep(k, n)rep(i, n)rep(j, n){
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    }

    int ans = 0;
    rep(i, m){
        bool valid = false;
        int l = p[i].first;
        int r = p[i].second;
        rep(j, n)rep(k, n){
            if(valid)break;
            if(j == k)continue;
            if(d[j][k] == d[j][l] + dd[l][r] + d[r][k])valid = true;
        }
        if(!valid)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	int n,x;
	cin>>n>>x;
	vector<LL> l(n);
	FOR(i,0,n)cin>>l[i];
	LL nn=0;
	int cnt=1;
	FOR(i,0,n){
		nn+=l[i];
		if(x<nn)break;
		cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long MOD = 998244353;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n, m;
    cin >> n >> m;
    int sum = 0;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
        sum += v[i];
    }
    int c = sum / (4 * m);
    if (sum % (4 * m) != 0) c++;

    int ct = 0;
    for (int i = 0; i < n; i++)
        if (v[i] >= c) ct++;

    if (ct >= m)
        cout << "Yes";
    else
        cout << "No";

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

//-------------------- Modulo --------------------//
#define MOD (1000000007LL)
#define SIZE (500000LL)

long long fac[SIZE + 1];
long long inv[SIZE + 1];
long long finv[SIZE + 1];

void modinit(void) {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i <= SIZE; ++i) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i ) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;  
}

long long modcom(long long n, long long k) {
  assert(n >= k);
  assert(n <= SIZE);
  assert(k <= SIZE);
  return fac[n] * finv[n - k] % MOD * finv[k] % MOD;
}
//-------------------- Modulo --------------------//



int main() {
  modinit();
  
  int N;
  cin >> N;
  vector<ll> x(N);
  for (int i = 0; i < N; ++i) {
    cin >> x[i];
  }

  ll ans = 0;  
  for (int i = 0; i < N - 1; ++i) {
    ll factor = fac[N - 1] * inv[i + 1] % MOD;
    ans += factor * (x[N - 1] - x[i]) % MOD;
    ans %= MOD;
  }

  cout << ans << endl;

  return 0;
}


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


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

	vector<vector<int>> G(N);
	for(int i=0;i<M;i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}

	int Q;
	cin >> Q;

	vector<int> v(Q), d(Q), c(Q);
	for(int i=0;i<Q;i++) {
		cin >> v[i] >> d[i] >> c[i];
		v[i]--;
	}

	vector<int> color(N, 0);
	vector<int> same_rad(N, -1);
	for(int i=Q-1;i>=0;i--) {
		if (same_rad[v[i]] >= d[i]) continue;
		same_rad[v[i]] = d[i];

		// (vertex, rest)
		queue<pair<int, int>> que;
		que.emplace(v[i], d[i]);
		while(que.size()) {
			auto p = que.front();
			que.pop();
			if(color[p.first] == 0) {
				color[p.first] = c[i];
			}
			if(p.second > 0) {
				for(int to : G[p.first]) {
					if(same_rad[to] < p.second - 1) {
						same_rad[to] = p.second - 1;
						que.emplace(to, p.second - 1);
					}
				}
			}
		}
	}
	for(int a : color) {
		cout << a << endl;
	}

	return 0;
}


Measured memory_bytes: 8912
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful -----

#include<bits/stdc++.h>
using namespace std;

#define NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define dloop(i,n) for(int i=n-1;i>=0;i--)
#define iii tuple<int,int,int>
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define int long long
#define pb push_back
#define endl "\n"
#define setbits __builtin_popcountll
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007
#define inf (int)1e18

int32_t main(){
	NINJA;

	int n,x; cin >> n >> x;
	set<int> a;
	fo(i,x){
		int t; cin >> t;
		a.insert(t);
	}

	int mn  =inf;
	int ans;
	for(int i=-1000;i<=1000;i++){
		if(a.find(i)==a.end()){
			if(abs(i-n)<mn){
				mn = abs(i-n);
				ans = i;
			}
		}
	}

	cout << ans << endl;
	

	

	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    int res=0;
    bool can=false;
    rep(i,n){
        int a,b; cin >> a >> b;
        if(a==b){
            res++;
            if(res>=3){
                can=true;
            }
        }else res=0;
    }
    yn(can);
    
}

Measured memory_bytes: 3652
/*
Till the roof comes off, till the lights go out
Till my legs give out, can’t shut my mouth.
Till the smoke clears out. Am I high? Perhaps
I'ma rip this shit till my bones collapse.
*/
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <stack>
#include <string.h>
#include <map>
#include <vector>
#include <queue>
#include <math.h>
#include <stack>
#include <complex>

#define pb push_back
#define f first
#define s second
#define ll long long
#define sz(v)      ((int)((v).size()))
#define X real()
#define Y imag()
#define angle(a)                (atan2((a).imag(), (a).real()))
#define vec(a,b)                ((b)-(a))
#define same(p1,p2)             (dp(vec(p1,p2),vec(p1,p2)) < EPS)
#define dp(a,b)                 ( (conj(a)*(b)).real() )	// a*b cos(T), if zero -> prep
#define cp(a,b)                 ( (conj(a)*(b)).imag() )	// a*b sin(T), if zero -> parllel
#define len(a)               (hypot((a).imag(), (a).real()))
#define normalize(a)            (a)/length(a)

using namespace std;

typedef pair<int,ll>ii;
typedef pair<ii,int>node;
typedef complex<double>point;


const int N=1005;
const int M=101;
const double EPS = 1e-9;
const int INF =1e9;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
double getDist(point a,point b){return sqrt((a.X-b.X)*(a.X-b.X)+(a.Y-b.Y)*(a.Y-b.Y));}
int dcmp(double x, double y) {return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1;}

ll mod=1000000007;
ll power(ll base,int p){if(!p)return 1;ll ret=power(base,p/2);ret*=ret;ret%=mod;if(p&1)ret*=base,ret%=mod;return ret;}
ll modInverse(int a){return power(a,mod-2);}

vector<ll>v;
int n;
bool can(ll l){
 for(ll total=l;total>=max(l-n,0ll);total--){
   ll sum=total;
   for(int i=0;i<n;i++){
        ll k = v[i] - n*1ll + total +n;
        k/=((n+1)*1ll);
        if(v[i]-k*n*1ll+total-k>=n)k++;
        sum-=k;
   }
   if(sum>=0)return 1;
 }return 0;
}
int main()
{
    //freopen("test.in","r",stdin);
    // freopen("test.out","w",stdout);
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        ll a;
        cin>>a;
        v.pb(a);
    }
    sort(v.begin(),v.end());
    if(v[n-1]<n){
        cout<<0;
        return 0;
    }
    reverse(v.begin(),v.end());
    ll low=0,high=1e18;
    while(low+1<high){
        ll mid=(low+high)/2;
        if(can(mid))
            high=mid;
        else
            low=mid+1;
    }
    if(can(low))cout<<low;
    else cout<<high;
  return 0;
}

/*
100% reason to Remember THE NAME
*/


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  ll N;
  cin >> N;
  vector<ll> X(N);
  rep(i,N) cin >> X[i];
  vector<ll> Y = X;
  sort(all(Y));
  ll l = Y[N/2-1];
  ll r = Y[N/2];
  rep(i,N){
    if(X[i]<=l) cout << r << endl;
    else cout << l << endl;
  }
  return 0;
}


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

#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,b,a)     for(int i=b;i>=a;i--)

int n,i;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
   

    cin>>n;
    if(n==1||n==2||n==4)
        cout<<4;
    else
    {
        i=1;
        while(true)
        {
            if(n&1)
                n=3*n+1,i++;
            else
            {
                if(n==4)
                {
                    cout<<i+3;
                    break;
                }
                else
                    n/=2,i++;
            }
        }
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    int N;
    cin >> N;
    string base = "", end = "";
    
    for (int i = 0; i < N; i++) {
        base += 'a';
        end += 'a'+i;
    }
    
    cout << base << endl;
    while (base != end) {
        int keta = N-1;
        char b = 'a';
        vector<char> keta_max(N);
        keta_max[0] = 'a';
        
        for (int i = 0; i < N; i++) {
            if (i > 0)
                keta_max[i] = b;
            if (base[i] > b)
                b = base[i];
        }
        base[keta]++;
        while (base[keta] > keta_max[keta]+1) {
            base[keta] = 'a';
            keta--;
            base[keta]++;
        }
        
        cout << base << endl;
    }
}

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

int main(){
 int n;
 cin >> n;
 vector<int> p(n);
 for(int i=0;i<n;i++){
   int pin;
   cin >> pin;
   p.at(i) = pin - 1; 
 }
 vector<int> index(n);
 for(int i=0;i<n;i++){
   index.at(p.at(i)) =  i;
 }
 set<int> s;
 long long ans = 0;
 long long c;

 for(int x=n-1;x>=0;x--){
  int i = index.at(x);
  s.insert(i);
  {//calc c
    vector<int> l(2,-1);
    vector<int> r(2,n);
    {//calc l
    auto it = s.find(i);
    for(int j=0; j<2;j++){
      if(it == s.begin()) break;
      it--;
      l.at(j) = *it;
    }
    }
    {//calc r
    auto it = s.find(i);
    for(int j=0; j<2;j++){
      it++;
      if(it == s.end()) break;
      r.at(j) = *it;
    }
    }
    vector<int> ls(2,0);
    vector<int> rs(2,0);
    ls.at(0)= i - l.at(0);
    ls.at(1)= l.at(0) - l.at(1);
    rs.at(0)= r.at(0) - i;
    rs.at(1)= r.at(1) - r.at(0);
    c = (long long)ls.at(0) * rs.at(1) + (long long)ls.at(1) * rs.at(0);
  }
  ans += c * (x+1);
 }
 cout << ans << endl;
}


Measured memory_bytes: 5760
#include<stdio.h>
#define N 500000
void maxHeapify(int [],int);

int H;
int main(){
    int i;
    int A[N+1];

    scanf("%d",&H);
    for(i=1;i<=H;i++){
        scanf("%d",&A[i]);
    }
    for(i=H/2;i>=1;i--){
        maxHeapify(A,i);
    }
    for(i=1;i<=H;i++){
        printf(" %d",A[i]);
    }
    printf("\n");

    return 0;
}
void maxHeapify(int A[],int i){
    int l,r,largest,tmp;

    l = i*2;
    r = i*2+1;
    if(l<=H && A[l]>A[i]){
        largest = l;
    }
    else largest = i;
    if(r<=H && A[r]>A[largest]){
        largest = r;
    }

    if(largest != i){
        tmp = A[i];
        A[i] = A[largest];
        A[largest] = tmp;
        maxHeapify(A,largest);
    }
}


Measured memory_bytes: 3672
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e6+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

void add(ll &a, ll b)
{
    a += b;
    if(a >= MOD) a -= MOD;
}
void sub(ll &a, ll b)
{
    a -= b;
    if(a < 0)a += MOD;
}

ll dp[MAXn], fac[MAXn];

int main()
{
    IOS();
    fac[0] = 1;
    for(ll i = 1;i < MAXn;i ++)fac[i] = fac[i-1] * i % MOD;
    ll N, H, D;
    cin>>N>>H>>D;
    dp[0] = 1;

    ll tt = 1, factt = 0;
    for(int i = 1;i <= N;i ++)add(factt, fac[i]);

    for(int i = 1;i <= H;i ++)
    {
        if(i != H)dp[i] = tt * factt % MOD;
        else dp[i] = tt * fac[N] % MOD;
        if(i >= D)sub(tt, dp[i - D]);
        add(tt, dp[i]);
    }
    cout<<dp[H]<<endl;
}


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

int n, a[2][105];

int main() {
    cin >> n;
    for (int i=0; i<n; i++) cin >> a[0][i];
    for (int i=0; i<n; i++) cin >> a[1][i];

    int ans = 0;
    for (int i=0; i<n; i++) {
        int tmp = 0;
        for (int j=0; j<=i; j++) {
            tmp += a[0][j];
        }
        for (int k=i; k<n; k++) {
            tmp += a[1][k];
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using CompLib.Util;

public class Program
{
    int N, M, Q;
    int[] A, B, C, D;

    int[] Ar;

    long Ans = 0;
    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        M = sc.NextInt();
        Q = sc.NextInt();
        A = new int[Q];
        B = new int[Q];
        C = new int[Q];
        D = new int[Q];
        for (int i = 0; i < Q; i++)
        {
            A[i] = sc.NextInt() - 1;
            B[i] = sc.NextInt() - 1;
            C[i] = sc.NextInt();
            D[i] = sc.NextInt();
        }

        Ar = new int[N];
        DFS(0, 1);
        Console.WriteLine(Ans);
    }

    public void DFS(int i, int a)
    {
        if (i >= N)
        {
            long sum = 0;
            for (int j = 0; j < Q; j++)
            {
                if (Ar[B[j]] - Ar[A[j]] == C[j]) sum += D[j];
            }

            Ans = Math.Max(Ans, sum);
            return;
        }
        for (int j = a; j <= M; j++)
        {
            Ar[i] = j;
            DFS(i + 1, j);
        }
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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


int main() {
	int H, W;
	cin >> H >> W;
	char c[100][100];
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> c[i][j];
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cout << c[i][j];
		}
		cout << endl;
		for (int j = 0; j < W; j++) {
			cout << c[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
//chandigarh university
//shivamkr21
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	int n,a,b;
  cin>>n>>a>>b;
  if((n*a)<b)
  {
    	cout<<n*a<<endl;
  }
  else
  {
    	cout<<b<<endl;
  }
  	return 0;
}


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

int main(){
    ll x;
    int t=0;
    cin>>x;
    for(ll i=-200;i<=200;i++){
        for(ll j=-200;j<=200;j++)
        if(j*j*j*j*j==i*i*i*i*i+x){
            printf("%lld %lld",j,i);
            return 0;
        }
    }
}


Measured memory_bytes: 3748
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A=new int[N];
        for(int i=0; i<N; i++){
            A[i]=sc.nextInt();
        }

        long money=1000;
        long kabu=0;
        
        for(int i=0; i<N-1; i++){
            if(A[i]<A[i+1]){
                kabu = money/A[i];
                money = money + kabu*(A[i+1]-A[i]);
            }

        }

        System.out.println(money);
        
        
        
        
        
        }
    }

Measured memory_bytes: 35924
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
typedef vector<int> vi;
typedef long long lint;
typedef unsigned int uint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
typedef unsigned long long ulint;
#define endl '\n'
#define fst first
#define sed second
#define pb push_back
#define mp make_pair
#define rint register int
#define SZ(x) (int((x).size()))
#define all(x) (x).begin(), (x).end()
#define reveal(x) cerr << #x << " = " << (x) << endl
#define rep(it, f, e) for (rint it = (f); it <= (e); ++it)
#define per(it, f, e) for (rint it = (f); it >= (e); --it)
#define repe(it, x) for (auto it = (x).begin(); it != (x).end(); ++it)
const int MAXN = 1e5 + 20;
lint a[MAXN], L[MAXN], R[MAXN];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
	int n;
	cin >> n;
	rep (i, 0, n) {
		cin >> a[i];
	}
	L[n] = R[n] = a[n];
	per (i, n, 1) {
		R[i - 1] = R[i] + a[i - 1];
		L[i - 1] = (L[i] + 1) / 2 + a[i - 1];
	}
	lint res = 0;
	lint l = 1, r = 1;
	rep (i, 0, n) {
		l = max(l, L[i]);
		res += (r = min(r, R[i]));
		if (l > r || r < a[i]) {
			cout << -1 << endl; return 0;
		}
		l -= a[i], r -= a[i]; r <<= 1;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 5932
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n) 
{ v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i]; }
template<class T, class U> void read_n(vector<pair<T, U>>& v, size_t n)
{ v = vector<pair<T, U>>(n); 
  for (lli i=0; i<n; ++i) cin >> v[i].first >> v[i].second; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli n, h, w;
int main() {
  cin >> n >> h >> w;
  lli ans = (n-w+1) * (n-h+1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9+7;

int main(void) {

    int N; cin>>N;
    map<int,int> mp;
    int maximum = 0;
    for (int i = 0; i < N; ++i) {
        int tmp; cin>>tmp;
        mp[tmp-1]++, mp[tmp]++, mp[tmp+1]++;
        maximum = max({maximum, mp[tmp-1], mp[tmp], mp[tmp+1]});
    }
    cout<<maximum<<endl;

    return 0;
}

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

typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;	
const ll MAX_N=100;

ll N;
ll a[MAX_N];
int main(){
	cin>>N;
	REP(i,N){
		cin>>a[i];
	}
	ll ans=0;
	ll inx=1;
	while(inx<N){
		if (a[inx]==a[inx-1]){
			ans++;
			inx++;
		}
		inx++;
	}
	cout<<ans<<endl;
	return 0;
}

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

signed main(){
	int N, M, i, ans = 0;
	scanf("%lld%lld", &N, &M);
	vector<pair<int, int>> AB(N);
	for(i = 0; i < N; i++){
		scanf("%lld%lld", &AB[i].first, &AB[i].second);
	}
	sort(AB.begin(), AB.end());
	for(i = 0; i < N; i++){
		if(AB[i].second < M){
			ans += AB[i].second * AB[i].first;
			M -= AB[i].second;
		}
		else{
			printf("%lld\n", ans + M * AB[i].first);
			return 0;
		}
	}
}

Measured memory_bytes: 1792
function Main(input) {
  input = input.split("\n");
  var X = parseInt(input[0].split(" ")[0]);
  var A = parseInt(input[0].split(" ")[1]);
  if(X<A){
    var ans=0;
  }else{
    var ans=10;
  }

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21956
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int main(){
long long a,b;
cin>>a>>b;
long long ans=0;
if(b/2>a){
b-=a*2;
cout<<a+b/4;}
else
cout<<b/2;
system("pause");
return 0;
}

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

int main() {
	int n;
    double ans = 0;

    cin >> n;
    for (int i = 0; i < n; ++i){
    	double x;
    	string u;
    	cin >> x >> u;
    	ans += (u == "JPY" ? x : 380000 * x);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
    
int main() {
int H, W;
string edge, middle = "#";
while (cin >> H >> W && H!=0 && W != 0) {
for(int j = 0; j < W; j++) {
edge = edge + "#";
}
for (int k = 0; k < W-2; k++) {
middle = middle + ".";
}
middle = middle + "#";
cout << edge << endl;
for(int i = 0; i < H-2; i++) {
cout << middle << endl;
}
cout << edge << endl;
cout << endl;
edge = "";
middle = "#";
} 
}


Measured memory_bytes: 3160