akhauriyash/Code-Regression huggingface dataset:
/*
  Esteban Arango Medina
*/
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <tuple>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
using namespace std;

using ll=long long;
#define int ll

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<string,int> si;
typedef pair<int,ii> iii;
typedef vector <si> vsi;
typedef vector <ii> vii;
typedef vector <int> vi;
typedef vector <char> vc;
typedef vector <string> vs;
typedef map <string,vs> msvs;
typedef map <string,int> msi;
typedef map <char,int> mci;
typedef map <int,int> mii;
typedef map <string,string> mss;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define endl '\n' // Normal `cout << endl` flushes the output every time wich hit performance badly
#define INF 1000000000
#define deb(x) cout<<#x<<": "<<x<<endl;
#define printArray(arr) for(auto x: arr) { cout<<x<<", "; }
#define printMatrix(mat) for(auto x: mat) { cout<<" "; printArray(x); cout<<endl; }
#define printMap(mmap) for(auto p: mmap) { cout<< p.first<<": "<<p.second<<endl; }

signed main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL); // Fast input
  #ifdef LOCAL_PROJECT
    freopen("in.in", "r", stdin);
    // freopen("out.out", "w", stdout);
  #endif

  int T = 1; //cin>>T;
  while(T--) {
    int ans = 0;
    int n; cin>>n;
    rep(i, 1, n+1){
      if(i %3 != 0 && i %5 != 0) { ans += i;}
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];

  // case1
  bool flag = true;
  rep(i,n) {
    if (a[i] != 0) {
      flag = false;
      break;
    }
  }

  if (flag){
    cout << "Yes" << endl;
    return 0;
  }

  // case2
  int c_0 = 0;
  set<ll> s;
  rep(i,n){
    if (a[i] == 0) {
      c_0++;
      continue;
    }
    s.insert(a[i]);
  }    
  if (c_0 == n/3 && n%3 == 0 && s.size() == 1) {
    cout << "Yes" << endl;
    return 0;
  }

  // case3
  vector<pair<ll,ll>> v(0);
  set<ll> r;
  rep(i,n){
    if (r.count(a[i])) {
      rep(j,v.size()) if (v[j].first == a[i]) {
        v[j].second++;
        break;
      }
      continue;
    }
    r.insert(a[i]);
    v.push_back(make_pair(a[i],0));
    if (r.size() > 3) {
      cout << "No" << endl;
      return 0;
    }
  }  

  if (r.size() != 3) {
    cout << "No" << endl;
    return 0;
  }

  if ((v[0].second == v[1].second) && (v[1].second == v[2].second)){
    if (((v[0].first ^ v[1].first) ^ v[2].first) == 0){
        cout << "Yes" << endl;
        return 0;
    }
  }

  cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 7392
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n, m, u, v;
    cin >> n >> m;
    vector<int> ans(n, 0);
    for(int i = 0; i < m; i++) {
        cin >> u >> v;
        ans[u-1] += 1;
        ans[v-1] += 1;
    }
    for(int i = 0; i < n; i++)
        cout << ans[i] << endl;

    return 0;
}


Measured memory_bytes: 3656
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <queue>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<string> vs;

int main() {
  int n;
  cin >> n;
  vi l(2*n);
  for (int i = 0;i < l.size(); ++i) cin >> l[i];
  sort(l.begin(), l.end());
  ll res = 0;
  for (int i = 0; i < l.size(); i += 2) res += l[i];
  cout <<res << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<string>
#include<set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0; i<n; i++)
#define per(i, n) for(int i=n-1; i>=0; i--)
#define reps(i, n) for(int i=1; i<n; i++)
#define pers(i, n)  for(int i=n-1; i>=1; i--)

const int INF = 1001001001;

void solve(){
  string s; cin >> s;
  cout << (s[2]==s[3] && s[4]==s[5] ? "Yes" : "No") << endl;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <complex>
typedef long long int LL;
using namespace std;

// 插入此處
int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++) {
        int tmp;
        scanf("%d", &tmp);
    }
    printf("%d\n", (n - k) % (k-1) == 0 ? (n - k) / (k-1) + 1 : (n - k) / (k-1) + 2);
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <sstream>
#include <cassert>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <chrono>
#include <ctime>

using namespace std;

#define en '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) int((x).size())

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;

const int INF = 1e9 + 7;
const ll INFLL = 1e18;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int MAX_SIZE = 5e5;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

bool IS_ONE_TEST = 1;
ld START_TIME, TIME;

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

ll get(ll n) {
    ll res = 0;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ++res;
            if (n / i != i) {
                ++res;
            }
        }
    }
    return res;
}

void solve() {
    int n;
    cin >> n;
    vector<ll> kek(n + 1, 1);
    ll ans = 1;
    for (ll i = 2; i <= n; ++i) {
        for (ll j = i; j <= n; j += i) {
            ++kek[j];
        }
        ans += i * kek[i];
    }
    cout << ans << en;
}

int main() {
    START_TIME = clock();
    fast_in_out();
    int TESTS = 1;
    if (!IS_ONE_TEST) cin >> TESTS;
    while (TESTS--) { solve(); }
#ifdef __APPLE__
    TIME = (clock() - START_TIME) / CLOCKS_PER_SEC;
    cerr << en << TIME * 1000 << " ms." << en;
#endif
    return 0;
}

/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐
    ▐░░░░░▐
    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌        */


Measured memory_bytes: 81328
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define inf (int)(3e18)
#define P pair<int,int>
#define mod (int)(1e9+7)

template<class T> inline void chmin(T &a, T b) {
	a = min(a, b);
}
template<class T> inline void chmax(T &a, T b) {
	a = max(a, b);
}


signed main() {
	int N,K;
	int ans=0;
	cin>>N>>K;
	while(N){
		ans++;
		N/=K;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<stdio.h>

int judge(long);

int main(void){
  long work;
  int cnt=0,N;
  int i;

  scanf("%d",&N);

  for(i=0;i<N;i++){
    scanf("%d",&work);
    if(judge(work)==1) cnt++;
  }

  printf("%d\n",cnt);

  return 0;
}


int judge(long work){
  long i;

  for(i=2;i*i<=work;i++){
    if(work%i==0) return -1;
  }
  return 1;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    rep(i, 5) {
        int x; cin >> x;
        if (x == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }
}


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



int main() { // claudio van
  int n, k; cin >> n >> k;
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    int x; cin >> x;
    if (x >= k) {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
typedef struct {/*parent,left child ,right sibling*/
int p,l,r;
} node;
int degree(int );
int height(int );
int depth(int );
int sibling(int );
void Print(int );
node T[100000];
int main()
{
int n,i,id,l,r;
scanf("%d",&n);

for(i=0;i<n;i++)
{
T[i].p = T[i].l = T[i].r = -1;
}

for(i=0;i<n;i++)
{
scanf("%d%d%d",&id,&l,&r);
T[id].l = l;
T[id].r = r;
T[l].p = id;
T[r].p = id;
}

for(i=0;i<n;i++)
{
Print(i);
}
return 0;
}

int depth(int id)
{
  if(T[id].p == -1) return 0;
  return 1+depth(T[id].p);
}

int degree(int id)
{
if(T[id].l != -1 && T[id].r != -1)  return 2;
else if(T[id].l != -1 || T[id].r != -1) return 1;
else return 0;
}
int height(int id)
{
int leftHigh=0,rightHigh=0;
if(id== -1) return 0;
if (T[id].l != -1) leftHigh = height(T[id].l)+1;
if(T[id].r != -1) rightHigh = height(T[id].r)+1;

if(rightHigh < leftHigh) return leftHigh;
else return rightHigh;
}
int sibling(int id)
{
int parent = T[id].p;
if(T[id].p == -1) return -1;
else if(T[parent].l != id) return T[parent].l;
else return T[parent].r;
}
void Print(int id)
{
  printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",id,T[id].p,sibling(id),degree(id),depth(id),height(id));
  if(T[id].p == -1) printf("root\n");
  else if(T[id].l == -1 && T[id].r == -1) printf("leaf\n");
  else printf("internal node\n");
}

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

int main(){
    int n;
    int h[100000], dp[100000];
    cin >> n;
    for(int i=0;i<n;i++) cin >> h[i];
    dp[0] = 0;
    for(int i=1;i<n;i++){
        if(h[i-1] >= h[i]) dp[i] = dp[i-1]+1;
        else dp[i] = 0;
    }
    int ans = 0;
    for(int i=0;i<n;i++) ans = max(ans, dp[i]);
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mem(a,b) memset((a),(b),sizeof(a))
#define MP make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
using namespace std;
#define _GLIBCXX_PERMIT_BACKWARD_HASH
#include <ext/hash_map>
using namespace __gnu_cxx;
struct str_hash{size_t operator()(const string& str)const{return __stl_hash_string(str.c_str());}};
typedef long long ll;
typedef unsigned long long ull;
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDD pair<double,double>
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-6;
const int MAX=2e5+10;
const ll mod=1e9+7;
int a[MAX];
int main()
{
	int n,i;
	ll ans;
	while(~scanf("%d",&n))
	{
		for(i=1;i<=n;i++)
		{
			scanf("%d",&a[i]);
		}
		if(a[1])
		{
			puts("-1");
			continue;
		}
		ans=0;
		for(i=1;i<n;i++)
		{
			if(a[i+1]<=a[i])
			{
				ans+=a[i];
			}
			else if(a[i+1]>a[i])
			{
				if(a[i+1]>a[i]+1)
				{
					puts("-1");
					goto end;
				}
			}
		}
		ans+=a[n];
		printf("%lld\n",ans);
		end:;
	}
	return 0;
} 


Measured memory_bytes: 1024
N, M = list(map(int, input().split()))
C = []
for n in range(N):
  A, B = list(map(int, input().split()))
  C.append([A,B])
  
C = sorted(C, key=lambda x:x[0])

S = 0
num = 0
n1 = 0
n2 = 0
while num < M:
  if n2 == C[n1][1]:
    n1 += 1
    n2 = 0
  S += C[n1][0]
  num += 1
  n2 += 1
 
print(S)

Measured memory_bytes: 22492
#include <cstdio>
#include <vector>
#include <set>
#include <numeric>

using namespace std;

vector<int> parent, urank;

int root(int x) { return (parent.at(x) == x ? x : parent.at(x) = root(parent.at(x))); }

bool in_same(int x, int y) { return root(x) == root(y); }
void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) {
        if (urank.at(x) < urank.at(y)) parent.at(x) = y;
        else {
            parent.at(y) = x;
            if (urank.at(x) == urank.at(y)) ++(urank.at(x));
        }
    }
}

int main() {
    int n, m, x, y;
    scanf("%d%d", &n, &m);
    parent.resize(n + 1);
    urank.resize(n + 1);
    iota(parent.begin(), parent.end(), 0);
    for (int i = 0; i < m; ++i) {
        scanf("%d%d%*d", &x, &y);
        unite(x, y);
    }
    set<int> ans;
    for (int i = 1; i <= n; ++i) ans.insert(root(i));
    printf("%d\n", int(ans.size()));
    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
template<class C>constexpr int sz(const C&c){return int(c.size());}
using ll=long long;constexpr const char nl='\n',sp=' ';

int main() {
  // freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);
  // freopen("err.txt", "w", stderr);
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  string S, T;
  cin >> S >> T;
  int ans = sz(S);
  for (int i = 0; i + sz(T) <= sz(S); i++) {
    int cnt = 0;
    for (int j = 0; j < sz(T); j++) cnt += S[i + j] != T[j];
    ans = min(ans, cnt);
  }
  cout << ans << nl;
  return 0;
}


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

// input
ll N, Q;
vector<P> query;


void input() {
    cin >> N >> Q;
    query = vector<P>(Q);
    rep(i, Q) cin >> query[i].first >> query[i].second;
}


struct SegmentTree {
    int n;
    vector<int> left, right;
    vector<ll> dat;

    SegmentTree(int n_) {
        n = 1;
        while (n < n_) n *= 2;
        left = right = vector<int>(2 * n - 1);
        dat = vector<ll>(2 * n - 1, N - 1);
        set_range(0, 0, n);
    }

    void set_range(int i, int l, int r) {
        left[i] = l;
        right[i] = r;
        if (i < n - 1) {
            set_range(2 * i + 1, l, (l + r) / 2);
            set_range(2 * i + 2, (l + r) / 2, r);
        }
    }

    void chmin_recur(int i, int l, int r, ll x) {
        if (left[i] == l && right[i] == r) {
            dat[i] = min(dat[i], x);
            return;
        }
        int c = (left[i] + right[i]) / 2;
        if (l < c) chmin_recur(2 * i + 1, l, min(c, r), x);
        if (c < r) chmin_recur(2 * i + 2, max(c, l), r, x);
    }

    void chmin(int l, int r, ll x) {
        chmin_recur(0, l, r, x);
    }

    ll val(int i) {
        i += n - 1;
        ll ret = dat[i];
        while (i > 0) {
            i = (i - 1) / 2;
            ret = min(ret, dat[i]);
        }
        return ret;
    }
};


int main() {
    input();
    SegmentTree w1 = SegmentTree(N);
    SegmentTree w2 = SegmentTree(N);
    ll ans = (N - 2) * (N - 2);
    for (P p : query) {
        int x = p.second;
        if (p.first == 1) {
            int v = w1.val(x - 1);
            ans -= v - 1;
            w1.chmin(x - 1, x, 0);
            w2.chmin(0, v, x - 1);
        } else {
            int v = w2.val(x - 1);
            ans -= v - 1;
            w2.chmin(x - 1, x, 0);
            w1.chmin(0, v, x - 1);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 21228
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
int main(){
    int k,x;cin>>k>>x;
    for(int i=x-k+1;i<=x+k-1;i++)cout<<i<<" ";
    cout<<endl;
}


Measured memory_bytes: 256
// Problem : B - Product Max
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define vi vector<int>
#define vb vector<bool>
#define vp vector<pair<int,int>>
#define mod 1000000007
#define M_PI 3.14159265358979323846
#define pint pair<int,int>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,b,a) for(int i=b; i>=a ;--i)
#define mms(a,n) memset(a,n,sizeof(a))
#define fill(a,value) fill(a.begin(),a.end(),value)
#define all(a) a.begin(),a.end()
#define n_ones(x) __builtin_popcountll(x)
#define pb push_back
#define fi first
#define se second
#define see(args...)                       \
{                                            \
    cerr<<"LINE "<<__LINE__;                 \
    string _s = #args;                       \
    replace(_s.begin(), _s.end(), ',', ' '); \
    stringstream _ss(_s);                    \
    istream_iterator<string> _it(_ss);       \
    err(_it, args);                          \
    cerr<<endl;                              \
}
void err(istream_iterator<string> it){}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
  cerr<<' '<< *it << " = " << a ;
  err(++it, args...);
} 
template <typename T, typename U>inline void min_self(T &x, U y){if (y < x)x = y;}
template <typename T, typename U>inline void max_self(T &x, U y){if (x < y)x = y;}
template<class T1, class T2>ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class T> ostream& operator<<(ostream& out, set<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class L, class R> ostream& operator<<(ostream& out, map<L, R> vec) { out<<"("; for (auto& v: vec) out<<"["<<v.first<<", "<<v.second<<"]"; return out<<")"; }
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
template <class Container>
void split(const std::string& str, Container& cont, char delim = ',')
{
    stringstream ss(str);
    string token;
    while (std::getline(ss, token, delim)) {
        cont.push_back(token);
    }
}

// cout << fixed << setprecision(10) << pi <<" "<<npi<<endl; 
// INT64_MAX
// transform(all(s), s.begin(), ::tolower);

int px[4] = {-1,0,1,0};
int py[4] = {0,-1,0,1};


void solve(){
    int n,a,b,c,d, res = INT64_MIN;
    cin>>a>>b>>c>>d ;
    max_self(res,a*c);
    max_self(res,a*d);
    max_self(res,b*c);
    max_self(res,b*d);
    cout<<res<<'\n';
	return;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3648
process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function (chunk) {
    var lines = chunk.toString().split(' ');
    var first = Number(lines[0]);
    var sqrt = Math.floor(Math.sqrt(first));
    
    while(first % sqrt !== 0){
        sqrt--;
    }
    
    var a = sqrt;
    var b = first / sqrt;
    var a_string_length = String(a).length;
    var b_string_length = String(b).length;
    var result = Math.max(a_string_length, b_string_length);
//    console.log(a);
//    console.log(b);
    console.log(result);
    
//    console.log(lines);
});

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

int main(){
    int n;
    cin >> n;
    vector<queue<char>> s(n);
    for(int i = 0; i < n; i++){
        string a;
        cin >> a;
        for(char b : a){
            s.at(i).push(b);
        }
    }

    for(int i = 1; i < n; i++){
        int t = s.at(0).size();
        for(int j = 0; j < t; j++){
            char tmp = s.at(0).front();
            s.at(0).pop();
            int u = s.at(i).size();
            for(int k = 0; k < u; k++){
                char tar = s.at(i).front();
                s.at(i).pop();
                if(tmp == tar){
                    s.at(0).push(tmp);
                    break;
                }
                s.at(i).push(tar);
            }
        }
    }
    vector<char> ans;
    while(s.at(0).size() > 0){
         ans.push_back(s.at(0).front());
        s.at(0).pop();
    }
    sort(ans.begin(), ans.end());
    for(char c : ans){
        cout << c;
    }
    cout << endl;
}

Measured memory_bytes: 3640
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_vec::<u64>();
    let (n, _) = (line[0], line[1]);
    let d = read_as_vec::<u64>();

    'outer: for i in 1..n*10+1{
        if i < n{
            continue;
        }

        let mut x = i;
        while x > 0{
            if d.contains(&(x%10)){
                continue 'outer;
            }
            x /= 10;
        }
        println!("{}", i);
        return;
    }

    // let line = read_as_string();
    // let line: Vec<&str> = line.split_ascii_whitespace().collect::<Vec<&str>>();
    // let n: String = String::from(line[0]);
    // let k: u64 = u64::from_str(line[1]).unwrap();
    // let d = read_as_vec::<u64>();

    // let mut ans = 0;
    // let mut is_already_bigger = false;
    // for c in n.chars(){
    //     match d.iter().filter(|x| **x>= c.to_digit(10).unwrap() as u64).nth(0){
    //         Some(number) => {
    //             if is_already_bigger{
    //             }
    //             ans = ans*10+number;
    //             if *number > c.to_digit(10).unwrap() as u64{
    //                 is_already_bigger = true;
    //             }
    //         },
    //         None => {
    //             ans = ans*10
    //         }
    //     }
    // }

    // if ans >= n.parse().unwrap(){
    //     println!("{}", ans);
    //     return;
    // }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <string>
#include <sstream>
#include <cstdio>
#include <cstring>
#define INF 0x3f3f3f3f
#define lb long double
#define LINF 0x3f3f3f3f3f3f3f3f
#define ull unsigned long long
#define random(x) (rand()%x)
#define rep(i, a, b) for(int i=a;i<b;i++)
#define req(j, a, b) for(int j=a;j<b;j++)
#define mem(a, b) memset(a, b, sizeof(a))
#define PI 3.14

using namespace std;
typedef long long ll;
const int maxn = 1e6+5;
const double eps = 1e-14;
const double pi = acos(-1);
const ll mod = 1e9 + 7;
const int hash_mod = 19260817;

int gw; //个位
int d[9];
int cf(int x)
{
    while(x!=0)
    {
        gw=x%10;
        x=(x-gw)/10;
        d[gw]++;//计数器加1
    }
}

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b + c >= 22)
        cout << "bust" << endl;
    else
        cout << "win" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

ll f(ll &x, ll k) {
    if( x > abs(x - k)) {
        x = abs(x - k);
        cout << x << endl;
        f(x, k);
    }
    return x;
}


int main() {
    ll n,k;
    cin >> n >> k;
    /*ll ans = f(n, k);*/
    if(n > k){
        n = n % k;
    }
    
    while(n > abs(n - k)){
        n = abs(n - k);
    }
    cout << fixed << n << endl;

}

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

int main() {
	// your code goes here
	int n, i, j, k;
	cin >> n;
	int abc[n][3];
	for(i=0; i<n; i++){
		for(j = 0; j<3; j++)
			cin >> abc[i][j];
	}
	int dp[n][3];
	memset(dp, -1, sizeof(dp));
	dp[0][0] = abc[0][0];
	dp[0][1] = abc[0][1];
	dp[0][2] = abc[0][2];
	for(i=1; i<n; i++){
		dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + abc[i][0];
		dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + abc[i][1];
		dp[i][2] = max(dp[i-1][1], dp[i-1][0]) + abc[i][2];
	}
	
	cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));
	return 0;
}

Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long a = sc.NextLong();
        long b = sc.NextLong();

        long answer = 0;

        long now = 1;
        while (now <= b)
        {
            long count = 0;
            count += (b + 1) / (now * 2) * now + Math.Max(0, (b + 1) % (now * 2) - now);
            count -= a / (now * 2) * now + Math.Max(0, a % (now * 2) - now);
            if (count % 2 == 1)
            {
                answer += now;
            }
            now *= 2;
        }

        Console.WriteLine(answer);
    }

    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: 27416
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll


int t, n, m, k, a[300010], q, l, r;
bool sv[10000010];
int f[10000010];

int32_t main(){
INIT
cin>>n;

f[1]=1;
for(int i=2; i<=n; i++){

    if(!sv[i]){
            int p=0;
        for(int g=i; g<=n; g*=i){
            p++;
            for(int j=g; j<=n ; j+=g){
                    if(!sv[j]){f[j]=1;}
               if( (j%(g*i))!=0 ){
               f[j]*=(p+1); sv[j]=true;}
            }
        }

    }
}


int res=0;
for(int i=1; i<=n; i++){
    res+=f[i]*i;
}cout<<res;


return 0;
}


Measured memory_bytes: 91552
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>	tree_set;
typedef long long ll;
typedef long double ld;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

ll mod=1e9 + 7;

int main()
{
    fast();
    ll n,m;
    cin>>n>>m;
    //first->days second->reward
    vector<pair<ll,ll> >arr;
    for(ll i=0;i<n;i++){
        ll d,r;
        cin>>d>>r;
        arr.push_back(make_pair(d,r));
    }
    sort(arr.begin(),arr.end());
    priority_queue<ll> pq;
    ll ans=0,pos=0;
    for(ll i=1;i<=m;i++)
    {
        while(pos<n && arr[pos].first<=i)
        {
            pq.push(arr[pos].second);
            pos++;
        }

        if(!pq.empty()){
            ans = ans + pq.top();
            pq.pop();
        }
    }
    cout<<ans;
}



Measured memory_bytes: 3568
#include<string>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int a,b,x,y,z;
    cin>>a>>b;
    x=a+b;
    y=a-b;
    z=a*b;
    if(x>y){
        if(x>z){
            cout<<x<<endl;
            return 0;
        }else{
            cout<<z<<endl;
            return 0;
        }
    }else{
        if(y>z){
            cout<<y<<endl;
            return 0;
        }else{
            cout<<z<<endl;
            return 0;
        }
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <limits.h>
#include <assert.h>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long int
#define db double
#define ldb long double
#define MOD 1000000007
#define Fi first
#define Se second
#define INF INT_MAX
#define NINF INT_MIN
#define L_INF LLONG_MAX
#define L_NINF LLONG_MIN
#define gc getchar
#define sz(x) (int)(x).size()
#define pii pair<int,int>
#define pll pair<ll,ll>

void fsscan(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

void scani(int &x)
{
    register int c = gc();x = 0;int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}

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

int main()
{
    fsscan();
    int a[100003];
    memset(a,0,sizeof(a));
    
    int n,m;
    cin>>n>>m;
    a[0]=0;
    
    int M=m;
    while(m--)
    {
        int l,r;
        cin>>l>>r;
        a[l]+=1;
        a[r+1]+=-1;
    }
    
    int c=0;
    for(int i=1;i<=n;i++)
    {
        a[i]=a[i]+a[i-1];
        if(a[i]==M)
        c++;
    }
    
    cout<<c;
    
    return 0;
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
import sys

def main():
	B = []
	N, M, C = map(int, input().split(" "))
	tmp = input().split(" ")
	B = [int(s) for s in tmp]
	
	src = []
	for _ in range(N):
		tmp = input().split(" ")
		src.append([int(s) for s in tmp])
		
	ans = 0
	for i, val in enumerate(src):
		total = 0
		for j, vol in enumerate(val):
			total = total + (vol * B[j])
		total = total + C
		
		if total > 0: ans = ans + 1
	
	print(ans)
			
if __name__ == "__main__":
	main()
	

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

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).bigin(), (c).end())

typedef long long ll;

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

    for (int i = 0; i < s.size(); i++)
    {
        bool a = true;
        for (int j = 0; j < s.size(); j++)
        {
            if (s[(i + j) % s.size()] != t[j])
            {
                a = false;
                break;
            }
        }
        if (a)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int count=0;
  for(int i=0;i<s.size();i++){
    if(i%2==0){
      if(s.at(i)=='L') count++;
    }
    else{
      if(s.at(i)=='R') count++;
    }
  }
  if(count==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

int main() {
  int a, b;
  cin>>a>>b;
  for (int i=1; i<=20000; i++) {
    double aa = 0.08 * i;
    double bb = 0.1 * i;
    if (a <= aa && aa < a + 1 && b <= bb && bb < b + 1) {
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
}

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

vector<int> vec(0,0);

int Count(int a){
    int ans=0;
    for(int i=0;i<vec.size();i++){
        if(vec[i]<=a) ans++;
        else break;
    }
    return ans;
}

int main(){
    int N,A,B;
    cin >> N >> A >> B;
    for(int i=0;i<N;i++){
        int p;
        cin >> p;
        vec.push_back(p);
    }
    sort(vec.begin(),vec.end());
    int x,y,z;
    x = Count(A);
    y = Count(B)-x;
    z = N-x-y;

    cout << min(x,min(y,z)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  vector<ll> A(N);
  for(int i=0;i<N;++i) cin>>A[i];
  sort(A.begin(), A.end());
  ll ans = 0;
  if(N==2) {
    ans = A[1]-A[0];
    cout<<ans<<endl;
    return 0;
  }
  else{
    ll a=A[0], b=A[N-1];
    ans += b-a;
    int l=1, r=N-2;
    ll c, d;
    ll tmp1, tmp2, tmp3, tmp4;
    while(l<=r){
      c = A[l];
      d = A[r];
      tmp1 = abs(c-a);
      tmp2 = abs(c-b);
      tmp3 = abs(d-a);
      tmp4 = abs(d-b);
      if(tmp1>=tmp2 && tmp1>=tmp3 && tmp1>=tmp4){
        ans += abs(c-a);
        a = c;
        l++;
      }
      else if(tmp2>=tmp1 && tmp2>=tmp3 && tmp2>=tmp4){
        ans += abs(c-b);
        b = c;
        l++;
      }
      else if(tmp3>=tmp1 && tmp3>=tmp2 && tmp3>=tmp4){
        ans += abs(d-a);
        a = d;
        r--;
      }
      else{
        ans += abs(d-b);
        b = d;
        r--;
      }
    }
    cout<<ans<<endl;
    return 0;
  }
}


Measured memory_bytes: 4060
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(true){
		c-=b;
		if(c<=0){
			printf("Yes\n");
			break;
		}
		a-=d;
		if(a<=0){
			printf("No\n");
			break;
		}
	}
}

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

int main()
{
  int N;
  char c;
  bool flag = false;
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    cin >> c;
    if (c == 'Y')
    {
      flag = true;
      break;
    }
  }
  
  if (flag)
  {
    cout << "Four" << endl;
  }
  else
  {
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unordered_map<long long, int, custom_hash> safe_map;

const int BITS = 22;
const int MAXN = (1<<BITS);
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int a[BITS][BITS];
ll dp[MAXN];

void add( ll &x, ll y )
{
    x += y;
    if( x >= MOD )
        x -= MOD;
}

int main()
{
    fastio();

    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cin>>a[i][j];
        }
    }
    dp[0] = 1;
    for(int mask=0;mask<MAXN;mask++)
    {
        int i = __builtin_popcount(mask);
        for(int j=0;j<n;j++)
        {
            if( a[i][j] == 0 ) continue;
            if( ( mask & (1<<j) ) ) continue;
            add( dp[mask|(1<<j)], dp[mask] );
        }
    }

    ll ans = dp[(1<<n)-1];
    cout<<ans,nl;

    return 0;
}

Measured memory_bytes: 33024
import math

A,B,H,M=map(int, input().split())
while H>=12:
   H=H-12
theta=abs((H+M/60)*30-M*6)

if theta>=180:
   theta =360-theta

theta=theta*math.pi/180
l=math.sqrt(A**2+B**2-2*A*B*math.cos(theta))
print(l)


Measured memory_bytes: 9436
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <algorithm>

#define REP(i,n) for(int i=0; i<n; i++)
#define FOR(i,a,b) for(int i=a; i<=b; i++)

using namespace std;

int main(void) {	
	int n;
	map<char, char> m;
	while (cin >> n && n > 0) {
		m.clear();
		REP(i, n) {
			char c1, c2;
			cin >> c1 >> c2;
			m[c1] = c2;
		}
		cin >> n;
		REP(i, n) {
			char c;
			cin >> c;
			if (m.find(c) == m.end())
				cout << c;
			else
				cout << m[c];
		}
		cout << endl;
		
	}
	
				  
	return 0;
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll, ll> pii;
ll mod=998244353;
int main() {
    int mx=0;
    int k,n;
    cin>>k>>n;
    int a[n];
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    for(int i=0;i<n-1;i++){
        mx=max(mx,a[i+1]-a[i]);
      
    }
    mx=max(mx,k-a[n-1]+a[0]);
    cout<<k-mx<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

struct UnionFind {
  std::vector<int> parent;
  int __size;
  UnionFind(int size_) : parent(size_, -1), __size(size_) {}
  void unite(int x, int y) {
    if ((x = root(x)) != (y = root(y))) {
      if (parent[y] < parent[x]) std::swap(x, y);
      parent[x] += parent[y];
      parent[y] = x;
      __size--;
    }
  }
  bool same(int x, int y) { return root(x) == root(y); }
  int root(int x) { return parent[x] < 0 ? x : parent[x] = root(parent[x]); }
  int size(int x) { return -parent[root(x)]; }
  int size() { return __size; }
};

int main() {
  int n, m;
  cin >> n >> m;
  UnionFind tree(n);
  for (int i = 0; i < m; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    x--; y--;
    tree.unite(x, y);
  }
  cout << tree.size() << endl;
  return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int x = sc.nextInt();
    int[] a = new int[N];
    for(int i = 0; i < N; i++) {
      a[i] = sc.nextInt();
    }
    long count = 0;
    for(int i = 1; i < N; i++) {
      if(a[i - 1] + a[i] > x) {
        count += (a[i] + a[i - 1] - x);
        if(a[i - 1] > x) {
          a[i] = 0;
        } else {
          a[i] = x - a[i - 1];
        }
      }
    }
    System.out.println(count);
  }
}

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

using namespace std;


#define PI 3.14159265
#define int long long




main(){

	int n; cin >> n;

	vector <int> w(n);

	for(int i = 0; i < n; i++){
		cin >> w[i];
	}

	// sort(w.begin(), w.end());

	int sum = accumulate(w.begin(), w.end(), 0);


	int ans = 1e9, current = 0;

	for(int i = 0; i < n; i++){
		current += w[i];
		ans = min(ans, abs(sum - 2 * current));
	}
	

	cout << ans << endl;


	
	
	return 0;
}

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

typedef long long ll;
#define pb push_back

// int gcd(int a, int b) {   if (b == 0) return a; return gcd(b, a % b);  }
// int lcm(int a,int b){return a/gcd(a,b)*b;}

int main(){
    string s;
    int cnt = 0;
    cin>>s;
    if(s[0]=='R' && s[1]=='R' && s[2]=='R') cnt=3;
    else if((s[0]=='R' && s[1]=='R')||(s[1]=='R' && s[2]=='R')) cnt = 2;
    else if(s[0]=='R' || s[1]=='R' || s[2]=='R') cnt=1;
    cout<<cnt;

    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
/*
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <set>
#include <cmath>
#include <cstring>

#include <stdio.h>
#include <string.h>
#include <sstream>
#include <stdlib.h>
#include <vector>
#include <iomanip>
#include <ctime>
*/
#define nl "\n"
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define p_un(a) ((void)a)
#define p_st(a) string(a)
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define naj ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define NL cout << endl;
#define sqr(x) (sqrt(x) * 1LL)
#define pcnt(i) __builtin_popcount(i)
#define up_b upper_bound
#define low_b lower_bound
#define lcm(a,b) (a * b) / __gcd(a, b)
#define REVERSE(a, n) reverse(a + 1, a + n + 1);
#define SORT(a, n) sort(a + 1, a + n + 1);
#define rsz resize

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ul;
typedef vector <ll> vl;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <int> vi;
typedef vector <string> vs;
typedef pair <ll, ll> pll;
typedef map <ll, ll> mll;
typedef set <ll> sl;
typedef set <char> sc;
typedef map <string, ll> msl;
typedef map <string, bool> msb;
typedef map <char, ll> mcl;
typedef map <string, string> mss;
typedef vector <vl> vvl;

const ll mxn = 1e6 + 1;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ld eps = 1e-9;
const ld PI = acos(-1);
const ld E = 2.71828;

#define int int64_t
#define FLN "inverse"

//int dx[]= {1,0,-1,0}; int dy[]= {0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1}; int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2}; int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={-1,-1,+0,+1,+1,+0}; int dy[]={-1,+1,+2,+1,-1,-2}; //Hexagonal Direction

inline void joji(bool ok = 0) {naj;if(ok){freopen(FLN".in","r",stdin);freopen(FLN".out","w",stdout);}}

vector <pair <int, int> > v;

main () {

	joji();
	string s;
	cin >> s;
	int n = sz(s);
	while(n --) {
		cout << 'x';
	}
	return 0;
}





        
                                                             


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 100005
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int in[maxn] = {};
	int dp[maxn] = {};
	vector<int> e[maxn];
	for(int i=0; i<m; i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		e[a].push_back(b);
		in[b]++;
	}
	queue<int> q;
	for(int i=1; i<=n; i++)
		if(!in[i]) q.push(i);
	while(!q.empty())
	{
		int u = q.front();
		q.pop();
		for(int uu:e[u])
		{
			in[uu]--;
			dp[uu] = max(dp[uu],dp[u]+1);
			if(!in[uu]) q.push(uu);
		}
	}
	int ans = 0;
	for(int i=1; i<=n; i++)
		ans = max(ans, dp[i]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 6528
package main

import "fmt"

func main() {
  var n int
  fmt.Scan(&n)
  switch (n % 10) {
    case 2,4,5,7,9:
      fmt.Println("hon")
    case 0,1,6,8:
      fmt.Println("pon")
    case 3:
      fmt.Println("bon")
	}
}

Measured memory_bytes: 1752
n,k = map(int,input().split())

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

res = 0

for i in range(n+1):
    for j in range(n-i+1):
        if k < i+j:
            continue
        memo = v[:i] + v[n-j:]
        memo.sort()

        for _ in range(k-i-j):
            if memo and memo[0] < 0:
                memo.pop(0)
            else:
                break
        res = max(res,sum(memo))
print(res)
        

Measured memory_bytes: 68432
inp=[int(x) for x in list(input())]
length=len(inp)
x,y=(0,length-2)

if (not inp[0]==inp[length-2]==1) or inp[length-1]==1:
  print(-1)
  exit()

while x<y:
  if inp[x]!=inp[y]:
    print(-1)
    exit()
  else:
    x+=1
    y-=1

now=1
num=1
if length<=4:
  for x in inp:
    num+=1
    if x:
      print (now,num)
      now=num
    else:
      print (now,num)
    if num==length:
      break
else:
  for x in inp:
    num+=1
    if x:
      print (now,num)
      if num!=length-1:
        now=num
    else:
      print (now,num)
    if num==length:
      break

Measured memory_bytes: 5396
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt(), m = sc.nextInt();

        int[] liked = new int[m];

        for (int i = 0; i < n; i++) {
            int k = sc.nextInt();

            for (int j = 0; j < k; j++) {
                int food = sc.nextInt() - 1;

                liked[food]++;
            }
        }

        int count = 0;

        for (int i = 0; i < m; i++) {
            if (liked[i] == n)
                count++;
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 22100
# coding: utf-8
# Your code here!

import math

a,b,C = map(int, input().split())
S = a * b * math.sin(math.radians(C)) /2
c2 = a*a + b*b - 2 * a * b * math.cos(math.radians(C))
c = math.sqrt(c2)
L = a + b + c
h = 2 * S / a

print(S)
print(L)
print(h)


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
int mod = 1000000000+7;

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

int main(){

	int k;
	cin>>k;
	int gcdl[201][201]={};
	int ans=0;

	int s=0;
	for(int a=1;a<=k;a++){
		for(int b=1;b<=k;b++){
			if(gcdl[a][b]==0){
				gcdl[a][b]=gcd(a,b);
				s=gcdl[a][b];
			}
			else s=gcdl[a][b];
			for(int c=1;c<=k;c++){
				if(gcdl[s][c]==0){
					gcdl[s][c]=gcd(s,c);
				}
				ans+=gcdl[s][c];

			}
		}
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 3756
# -*- coding: utf-8 -*-
#ABC088C
import sys

tmp = input().split()
a = list(map(lambda a: int(a), tmp))
tmp = input().split()
b = list(map(lambda a: int(a), tmp))
tmp = input().split()
c = list(map(lambda a: int(a), tmp))

if(a[0]-b[0]==a[1]-b[1])and(a[1]-b[1]==a[2]-b[2]):
	if(a[0]-c[0]==a[1]-c[1])and(a[1]-c[1]==a[2]-c[2]):
		if(c[0]-b[0]==c[1]-b[1])and(c[1]-b[1]==c[2]-b[2]):
			if(a[0]-a[1]==b[0]-b[1])and(b[0]-b[1]==c[0]-c[1]):
				if(a[2]-a[1]==b[2]-b[1])and(b[2]-b[1]==c[2]-c[1]):
					if(a[0]-a[2]==b[0]-b[2])and(b[0]-b[2]==c[0]-c[2]):
						print("Yes")
						sys.exit()
print("No")

Measured memory_bytes: 3064