akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    string s; cin >> s;
    int l = stoi(s.substr(0, 2));
    int r = stoi(s.substr(2, 2));

    if(1 <= l && l <= 12 && 1 <= r && r <= 12) {
        cout << "AMBIGUOUS" << endl;
        return 0;
    } else if((l == 0 ||  12 < l) && (1 <= r && r <= 12)) {
        cout << "YYMM" << endl;
        return 0;
    } else if((1 <= l && l <= 12) && (r == 0 || 12 < r)) {
        cout << "MMYY" << endl;
    } else {
        cout << "NA" << endl;
    }

    return 0;
}


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

int main() {
  string s;
  cin >> s;
  int n = s.size() / 2;
  int count = 0;
  rep(i, s.size() / 2) {
    if (s.at(i) == s.at(s.size() - 1 - i)) count++;
  }
  cout << n - count << endl;
}

Measured memory_bytes: 256
using namespace std;
#include <bits/stdc++.h>
#define fdto(i, r, l) for(int i = r; i >= l; --i)
#define fto(i, l, r) for(int i = l; i <= r; ++i)
#define forit(it, type, var) for(type::iterator it = var.begin(); it != var.end(); it++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ll long long
#define ld long double
#define maxN 1000000000000000000

int main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll l,i,cnt=0;
    string str;
    cin>>str;
    l=str.length();

    for(i=0;i<l;i++)
    {
        if(str[i]=='?')
        str[i]='D';
        
    }
    
    cout<<str<<endl;
    return 0;
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

typedef long long ll;
typedef pair<int, int> P;

#define INF 1e9

struct POINT {
  int x, y;
  char u;
  POINT(int x, int y, char u) : x(x), y(y), u(u) {}
};

int main(int, char**)
{
  int n;
  cin >> n;
  vector<POINT> p;
  int x, y;
  char u;
  rep(i,n) {
    cin >> x >> y >> u;
    p.emplace_back(x,y,u);
  }

  int ans = INF;
  int st;
  sort(p.begin(), p.end(), [&](POINT a, POINT b)->bool{ if (a.x == b.x) return a.y < b.y; else return a.x < b.x; });
  rep(i,n) {
    if (!i || p[i-1].x < p[i].x) st = -1;
    if (p[i].u=='U') st = p[i].y;
    else if (p[i].u=='D') {
      if (st != -1) {
        ans = min(ans, (p[i].y - st) * 5);
      }
      st = -1;
    }
  }

  sort(p.begin(), p.end(), [&](POINT a, POINT b)->bool{ if (a.y == b.y) return a.x < b.x; else return a.y < b.y; });
  rep(i,n) {
    if (!i || p[i-1].y < p[i].y) st = -1;
    if (p[i].u=='R') st = p[i].x;
    else if (p[i].u=='L') {
      if (st != -1) {
        ans = min(ans, (p[i].x - st) * 5);
      }
      st = -1;
    }
  }

  sort(p.begin(), p.end(), [&](POINT a, POINT b)->bool{ if (a.y-a.x == b.y-b.x) return a.x < b.x; else return a.y-a.x < b.y-b.x; });
  rep(i,n) {
    if (!i || p[i-1].y-p[i-1].x < p[i].y-p[i].x) st = -1;
    if (p[i].u=='R') st = p[i].x;
    else if (p[i].u=='D') {
      if (st != -1) {
        ans = min(ans, (p[i].x - st) * 10);
      }
      st = -1;
    }
  }
  rep(i,n) {
    if (!i || p[i-1].y-p[i-1].x < p[i].y-p[i].x) st = -1;
    if (p[i].u=='U') st = p[i].x;
    else if (p[i].u=='L') {
      if (st != -1) {
        ans = min(ans, (p[i].x - st) * 10);
      }
      st = -1;
    }
  }

  sort(p.begin(), p.end(), [&](POINT a, POINT b)->bool{ if (a.y+a.x == b.y+b.x) return a.x < b.x; else return a.y+a.x < b.y+b.x; });
  rep(i,n) {
    if (!i || p[i-1].y+p[i-1].x < p[i].y+p[i].x) st = -1;
    if (p[i].u=='R') st = p[i].x;
    else if (p[i].u=='U') {
      if (st != -1) {
        ans = min(ans, (p[i].x - st) * 10);
      }
      st = -1;
    }
  }
  rep(i,n) {
    if (!i || p[i-1].y+p[i-1].x < p[i].y+p[i].x) st = -1;
    if (p[i].u=='D') st = p[i].x;
    else if (p[i].u=='L') {
      if (st != -1) {
        ans = min(ans, (p[i].x - st) * 10);
      }
      st = -1;
    }
  }
  if (ans==INF) cout << "SAFE" << endl;
  else cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6436
#include<stdio.h>
int main(void) {
	int patern[30] = {1,2,4};
	int i,n,p=0,year = 0;

	for (i = 3; i < 30; i++) 
		patern[i] = patern[i - 1] + patern[i - 2] + patern[i - 3];

	while (1) {
		scanf("%d", &n);
		if (n == 0)break;
		if (patern[n - 1] % 10 == 0)
			p = patern[n - 1] / 10;
		else
			p = (patern[n - 1] / 10) + 1;
		year = p / 365;
		if (p%365==0) 
			printf("%d\n",year);
		else
			printf("%d\n", year+1);
	}
	return 0;
}

Measured memory_bytes: 600
def Convert(N):
    if N>0: return 'Yes'
    else: return 'No'

N,K,Q = (int(x) for x in input().split())
Win = [K-Q]*N
for T in range(0,Q):
    Win[int(input())-1] += 1
print('\n'.join(list(map(Convert,Win))))

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

using namespace std;
using ll = long long;
ll f(ll A, ll B, ll x){
    return ((A*x)/B) - A * (x/B);
}
int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    ll A, B, N; cin >> A >> B >> N;
    cout << max(f(A, B, N) , f(A, B, N - (N % B + 1))) << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
 
#define mo 1000000007
#define inf 1e18
#define rep(i, s, n) for (ll i = s; i < n; i = i + 1)
#define rrep(i,s,n) for(ll i=s;i>=n;i--)
#define adiii \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);  \
  cout.tie(NULL);									
 
ll mod(ll n) { return (n % (ll)mo + (ll)mo)%(ll)mo;}
ll gcd(ll a,ll b) {if (b == 0) return a;return gcd(b, a % b);}
 
ll binpow(ll a, ll b) {ll res = 1;while (b > 0) {if (b & 1) res = res * a;a = a * a;b >>= 1;}return res;}

int main(){
	adiii
	ll n,k;cin>>n>>k;
	vector <ll> h(n+1,0);
	vector <ll> dp(n+1);
	dp[1] = 0;
	rep(i,1,n+1) cin>>h[i];
	rep(i,2,n+1){
		dp[i] = inf;
		rep(j,1,k+1){
			if(i-j>=1){
				dp[i] = min(dp[i],dp[i-j] + abs(h[i] - h[i-j]));
			}
		}
	}
	
	cout<<dp[n]<<endl;

}


Measured memory_bytes: 1792
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

H,W,K = map(int,S().split())
c = [LS2() for i in range(H)]
for i in range(H):
    for j in range(W):
        if c[i][j] == '.':
            c[i][j] = 0
        else:
            c[i][j] = 1

from copy import deepcopy

ans = 0
for i in range(2**H):
    A = []
    for k in range(H):
        if (i>>k)&1:
            A.append(k)
    for j in range(2**W):
        B = []
        for l in range(W):
            if (j>>l)&1:
                B.append(l)
        d = deepcopy(c)
        for k in range(H):
            for l in range(W):
                if k in A or l in B:
                    d[k][l] = 0
        if sum(sum(d[k]) for k in range(H)) == K:
            ans += 1

print(ans)

Measured memory_bytes: 72660
#include <iostream>
#include <string>

int main(){
    std::string str;
    std::cin >> str;
    const int size = str.size();
    for(int i = 0; i < size; ++i){
        if(i != size - 1){
            std::cout << str.back();
        }else{
            std::cout << str.back() << std::endl;
        }
        str.erase(str.size() - 1, 1);
    }
    return 0;
}

Measured memory_bytes: 1176
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
const int INF = (1 << 30);

//毎回変える定数
#define N_MAX 200


//変数
int H, W;
vector<vector<bool>> s;
int ans = 0;


//サブ関数
//入力
void input(){
	cin >> H >> W;
	REP(i, H) {
		vector<bool> tmpv;
		string ss;
		cin >> ss;
		for (auto c : ss) {
			if (c == '.') {
				tmpv.push_back(true);
				ans++;
			}
			else tmpv.push_back(false);
		}
		s.push_back(tmpv);
	}
}




//計算
void calc(){
	queue<pair<int, int>> q;
	vector<vector<int>> dist;
	REP(i, H)dist.push_back(vector<int>(W, INF));
	q.push(make_pair(0, 0));
	dist[0][0] = 0;

	while (!q.empty()) {
		auto now = q.front(); q.pop();
		int nowD = dist[now.first][now.second];
		//上
		if (0 < now.first &&
			s[now.first - 1][now.second] &&
			nowD + 1 < dist[now.first - 1][now.second])
		{
			dist[now.first - 1][now.second] = nowD + 1;
			q.push(make_pair(now.first - 1, now.second));
		}
		//上
		if (now.first< H-1 &&
			s[now.first + 1][now.second] &&
			nowD + 1 < dist[now.first + 1][now.second])
		{
			dist[now.first + 1][now.second] = nowD + 1;
			q.push(make_pair(now.first + 1, now.second));
		}
		//上
		if (0 < now.second &&
			s[now.first][now.second-1] &&
			nowD + 1 < dist[now.first][now.second-1])
		{
			dist[now.first][now.second-1] = nowD + 1;
			q.push(make_pair(now.first, now.second-1));
		}
		//上
		if (now.second<W-1 &&
			s[now.first][now.second+1] &&
			nowD + 1 < dist[now.first][now.second+1])
		{
			dist[now.first][now.second+1] = nowD + 1;
			q.push(make_pair(now.first, now.second+1));
		}
	}

	for (auto row : dist) {
		for (int col : row) {
			//cout << col << " ";
		}
		//cout << endl;
	}


	if (dist[H - 1][W - 1] != INF) {
		ans -= dist[H - 1][W - 1];
		ans -= 1;
	}
	else {
		ans = -1;
	}
}


//出力
void output(){
	DEBUGING(ans);
}

//デバッグ
void debug(){
	int N;
	cin>>N;
}


//メイン関数
int main(){
	
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);



template <typename T>
class Seg_Tree{
public: // 0-index
	vector<T> dat;
	T initial,M;
	int n;
	T unite(T a,T b){//
		return a+b;
	}
	//Seg_Tree(int n0_=1,T initial_=1,T M_=1){
	//	initsize(n0_,initial_,M_);
	//}
	void initsize(int n0,T initial_,T M_){
		M = M_;
		initial = initial_;
		int k=1;
		while(1){
			if(n0<=k){
				n=k;
				dat.resize(2*n-1);
				for(int i=0;i<2*n-1;i++)dat[i]=initial;
				break;
			}
			k*=2;
		}
	}
	//i banme wo x nisuru
	void update(int i,T x){
		i += n-1;
		dat[i] = x;
		while(i>0){
			i = (i-1) / 2;
			dat[i] = unite(dat[i*2+1],dat[i*2+2]);
		}
	}
	//[a,b)
	T query0(int a,int b,int k,int l,int r){
		if(r<=a || b<=l)return initial;
		if(a<=l && r<=b)return dat[k];
		else{
			T vl = query0(a,b,k*2+1,l,(l+r)/2);
			T vr = query0(a,b,k*2+2,(l+r)/2,r);
			return unite(vl,vr);
		}
	}
	//return [a,b)
	T query(int a,int b){
		return query0(a,b,0,0,n);
	}
	T get_except(int ind){
		T vl = query(0,ind);
		T vr = query(ind+1,n);
		return unite(vl,vr);
	}
	T get_all(){
		return query(0,n);
	}
};

int main(){
	vector< Seg_Tree<ll> > a(26);

	ll N,Q;
	string S;
	cin >> N >> S >> Q;
	FOR(i,0,26){
		a[i].initsize(N+1,0,MOD);
	}
	FOR(i,0,N){
		a[S[i]-'a'].update(i,1);
	}

	int x,l,r,i;
	char c;
	FOR(q,0,Q){
		int ans = 0;
		cin >> x;
		if(x==1){
			cin >> i >> c;
			i--;
			l = S[i] - 'a';
			S[i] = c;
			a[l].update(i,0);
			a[c-'a'].update(i,1);
		}else{
			cin >> l >> r;
			l--,r--;
			FOR(j,0,26){
				if(a[j].query(l,r+1)>0)ans++;
			}
			cout << ans << '\n';
		}

	}

}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

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

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

LL modinv(LL a) {
    LL b = MOD, u = 1, v = 0;
    while (b) {
        LL t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

LL moddev(LL a, LL b){
	return a * modinv(b) % MOD;
}

void Main()
{
    int n;cin>>n;
    cout<<(n+1)/2 <<endl;

	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

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

#define INF 0x3f3f3f3f

typedef pair<int, int> P;

int n, m;
int ans;
int f[100][100];

void cnt(int x, int y, int deep) {
  ans = max(ans, deep);
  f[x][y] = 0;
  if (f[x+1][y]) cnt(x+1, y, deep+1);
  if (f[x-1][y]) cnt(x-1, y, deep+1);
  if (f[x][y+1]) cnt(x, y+1, deep+1);
  if (f[x][y-1]) cnt(x, y-1, deep+1);
  f[x][y] = 1;
}

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

  while(true) {
  cin >> n >> m;
  if(n==0) break;
  ans=0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> f[i][j];

  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (f[i][j] == 1) cnt(i, j, 1);

  cout << ans << endl;
  }

	return 0;
}



Measured memory_bytes: 3164
#include<stdio.h>
double func(int,int);
int main(){
    int n;
    scanf("%d",&n);
    int pntx[n];
    int pnty[n];

    for(int i = 0;i < n;i++){
        scanf("%d %d", &pntx[i],&pnty[i]);
    }
    int root_kakuhindo = 2;
    int root_zenntouri = 1;
    long double ans = 0;
    for(int i = 1;i <= n;i++){
        root_zenntouri *= i;
    }
    for(int i = 1;i < n;i++){
        root_kakuhindo *= i;
    }
    double ans__;
    for(int i = 0;i < (n - 1);i++){
        for(int j = (i + 1);j < n;j++){
            ans__ = func((pntx[i] - pntx[j]),(pnty[i] - pnty[j]));
            ans__ /= root_zenntouri;
            ans__ *= root_kakuhindo;
            ans += ans__;
        }
    }
    printf("%llf",ans);
    return 0;
}
double func(int a,int b){
    double ret_num;
    double hoge = (a * a) + (b * b);
    ret_num = sqrt(hoge);
    return ret_num;
}

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

using namespace std;

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

int main(){
  int n;
  string s,t;
  cin >> n >> s >> t;
  for (int i = 0; i < n; i++){
    cout << s[i] << t[i];
  }
  cout << '\n';
  return 0;
}

Measured memory_bytes: 256
N = input()
string = [x for x in input()]
strings = string[:]  # manipulate
stack = []

for i in range(len(strings)):
    if strings[i] == '(':
        stack.append(1)
    elif strings[i] == ')':
        if not stack:
            string.insert(0,'(')
        else:
            stack.pop()

if stack:
    for i in range(len(stack)):
        string.append(')')

print(''.join(string))


Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	int N;
	cin >> N;
	vi v(N);
	for(int i=0; i<N; i++){
		cin >> v[i];
	}

	sort(v.begin(),v.end());

	double ans=v[0];
	for(int i=1; i<N; i++){
		ans+=v[i];
		ans=ans/2;
	}

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

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
// #include "debug.h"
#define debug(...) 42

void solve() {

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

   v.resize(unique(v.begin(), v.end()) - v.begin());
   n = v.size();
   string s(n, '.');
   s[0] = 'b';

   for(int i = 1; i < n; i++) {
      if(v[i] < v[i - 1]) {
         s[i] = 'b';
         if(s[i - 1] == 'b') s[i - 1] = '.';
      } else if(v[i] > v[i - 1]) {
         s[i] = 's';
         if(s[i - 1] == 's') s[i - 1] = '.';
      }
   }

   debug(v);
   debug(s);

   vector <ll> stock = {0, 0, 1000};

   for(int i = 0; i < n; i++) {
      ll cur = stock[0] * stock[1] + stock[2];
      if(s[i] == 'b') {
         stock[0] = cur / v[i];
         stock[1] = v[i];
         stock[2] = cur % v[i];
      } else if(s[i] == 's') { 
         stock[2] += stock[0] * v[i];
         stock[0] = 0;
         stock[1] = 0;
      }
   }
   ll cur = stock[0] * stock[1] + stock[2];
   cout << cur << endl;
} 

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

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


Measured memory_bytes: 3660
#include<bits/stdc++.h>
#include<string>
#include<cctype> 
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
 
int main(){
 
  int A,B;
  
  cin >> A >>B;
  if(A%3==0){
    cout << "Possible" << endl;
  }else if(B%3==0){
    cout << "Possible" << endl;
  }else if((A+B)%3==0){
    cout << "Possible" << endl;
  }else{
    cout << "Impossible" << endl;
  }
        
  return 0;
}



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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
#define PER(i,n) for(int i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }

int n, a, b, c;

int dfs(vi &d, const vi &l) {
  int res = inf;
  if(sz(d) == n) {
    int A = 0, B = 0, C = 0;
    int cnt = 0;
    rep(i,n) {
      if(d[i] == 1) A += l[i], cnt++;
      if(d[i] == 2) B += l[i], cnt++;
      if(d[i] == 3) C += l[i], cnt++;
    }
    if(A == 0 || B == 0 || C == 0) return inf;
    return abs(a-A) + abs(b-B) + abs(c-C) + (cnt-3) * 10;
  }
  rep(i,4) {
    d.push_back(i);
    chmin(res, dfs(d,l));
    d.pop_back();
  }
  return res;
}

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

  cin >> n >> a >> b >> c;
  vi l(n);
  rep(i,n) cin >> l[i];
  vi d;

  int ans = dfs(d, l);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string.h>
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%I64d",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)
#define INF                         (int)1e9
#define EPS                         1e-9
#define bitcount                    __builtin_popcount
#define gcd                         __gcd
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define MOD                         1000000007
typedef long long ll;
/*For you see , each day i love you
 more.Today more than yesterday
  less than tomorrow.*/
using namespace std;

int main()
{
	ll x,k,d;
	cin>>x>>k>>d;
	
	x = abs(x);
	
	if(x/d >= k)
	{
		cout<<x - k*d<<endl;
	}
	else
	{
		k = k - (x/d);
		if(k%2 == 0)
		{
			cout<<x%d<<endl;
		}
		else
		{
			cout<<d - x%d<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n;
int dp[5005][5005];
string s;
int main(){
	cin >> n >> s;
	dp[0][0] = 1;
	for(int i=0;i<n;i++){
		for(int j=0;j<=i;j++){
			dp[i+1][j+1] = (dp[i+1][j+1]+dp[i][j])%mod;
			dp[i+1][max(0,j-1)] = (dp[i+1][max(0,j-1)]+dp[i][j]*(j?2:1)%mod)%mod;
		}
	}
	int hoge = dp[n][s.size()];
	cout << hoge << endl;
}

Measured memory_bytes: 96384
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int fabs(int a);
int main()
{
	int n,t = 0,x = 0,y = 0;
	scanf("%d",&n);
	int i,nx,ny,nt;
	for(i = 1;i <= n; i++)
	{
		scanf("%d %d %d",&nt,&nx,&ny);
		if(fabs(nx - x) + fabs(ny - y) > (nt - t) || nt % 2 != (fabs(nx - x) + fabs(ny - y)) % 2)
		{
			printf("No\n");
			break;
		}
	}
	if(i > n)
		printf("Yes\n");
		return 0;
}
int fabs(int a)
{
	return a > 0 ? a : -a;
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
    
signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    cout << fixed << setprecision(20);
 
    int n;
    cin>>n;
    ll ans = 0;
    ans = n*n*n;
    cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  int V[N];
  for (size_t i = 0; i < N; i++) {
    cin >> V[i];
  }
  int ans = 0;
  for (size_t i = 0; i < N; i++) {
    int cost;
    cin >> cost;
    if (V[i] > cost) ans += V[i]-cost;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
ll int large=(ll int)1e16+7;
ll int mod=(ll int)1e9+7;
ll int const N=(ll int)1e5+10;

ll int mod_exp(ll int x,ll int n)
{
    ll int result=1;
    while(n>0)
    {
        if(n%2==1)
            result=(result*x)%mod;
        x=(x*x)%mod;
        n=n/2;
    }
    return result;
}

ll int mod_inverse(ll int a)
{
    return mod_exp(a,mod-2);
}


ll int finde(ll int a,ll int par[])
{
    if(par[a]<0)
        return a;
    ll int res=finde(par[a],par);
    par[a]=res;
    return res;
}

void unione(ll int a,ll int b,ll int par[])
{
    if((a=finde(a,par))==(b=finde(b,par)))
    return;
    else
    {
       par[a]+=par[b];
       par[b]=a;
    }
}


int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
ll int T,i,j,ij;
T=1;
//cin>>T;
while(T--)
{
  ll int n,m,k;
  cin>>n>>m>>k;
  ll int a[n],b[m];
  rep(i,0,n)
  cin>>a[i];
  rep(i,0,m)
  cin>>b[i];

  vector<ll int>v1;
  vector<ll int >v2;
  v1.pb(a[0]);
  rep(i,1,n)
  {
    v1.pb(v1.back()+a[i]);
  }
  v1.pb(large);

  v2.pb(b[0]);
  rep(i,1,m)
  {
    v2.pb(v2.back()+b[i]);
  }
  v2.pb(large);



  ll int ans=0;

  rep(i,0,n)
  {
    if(v1[i]>k)
      break;
      ll int sum=0;
    ll int val=k-v1[i];
     sum+=i+1;
     sum+=upper_bound(v2.begin(),v2.end(),val)-v2.begin();
     ans=max(ans,sum);
  }

    rep(i,0,m)
  {
    if(v2[i]>k)
      break;
      ll int sum=0;
    ll int val=k-v2[i];
     sum+=i+1;
     sum+=upper_bound(v1.begin(),v1.end(),val)-v1.begin();
     ans=max(ans,sum);
  }

   cout<<ans<<endl;

}
return 0;
}
















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

using namespace std;

int main() {
    int A, B, resultado = -1; 
    cin >> A >> B;
    for (int i = 1; i <= 10000; ++i) {
        if (i * 8 / 100 == A && i * 10 / 100 == B) {
            resultado = i;
            break;
        }
    }
    cout << resultado;
}


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

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

	int i, x;
	for (i = 1; i <= n; ++i)
	{
		x = i;
		if (x % 3 == 0) 
		{
			cout << " " << i;
			continue;
		}
		while (x)
		{
			if (x % 10 == 3) 
			{
				cout << " " << i;
				break;
			}
			x /= 10;
		}
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
using namespace std;
int main()
{
	string s,t;
	cin>>s>>t;
	int len=s.length();
	int sum=0;
	for(int i=0;i<len;i++){
		if(s[i]!=t[i]){
			sum++;
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3856
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long r,d,x[20];
    cin>>r>>d>>x[0];
    for(int i=1;i<=10;i++)
    {
        x[i]=r*x[i-1]-d;
        cout<<x[i]<<endl;
    }
    return 0;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    VI s(m), c(m);
    rep(i,m) cin >> s[i] >> c[i];

    VI ans(n,-1);
    bool none = false;

    rep(i,m){
        if(none) break;

        int id = s[i] - 1;
        if(id==0 && c[i]==0 && n>1){
            none = true;
            break;
        }

        if(ans[id] == -1){
            ans[id] = c[i];
        }else if(ans[id] != c[i]){
            none = true;
        }
    }

    if(none) cout << -1 << endl;
    else{
        rep(i,n){
            if(ans[i]==-1){
                if(i==0 && n>1) ans[i] = 1;
                else ans[i] = 0;
            }
        }
        rep(i,n) cout << ans[i];
        cout << endl;
    }

    return 0;
}

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

int main(){
    int n, ans = 0; cin >> n;
    vector<int64_t> l(n); for (auto i = 0; i < n; i++) cin >> l[i];
    for (auto i = 0; i < n; i++) {
        for (auto j = i + 1; j < n; j++) {
            if(l[i] == l[j]) continue;
            for (auto k = j + 1; k < n; k++) {
                if(l[j] == l[k] or l[i] == l[k]) continue;
                if(l[i] + l[j] > l[k] and l[j] + l[k] > l[i]
                    and l[k] + l[i] > l[j]) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
package main

import (
    "fmt"
)

func main() {
    var (
        a     string
        count = 0
    )
    fmt.Scan(&a)
    for i := 0; i < len(a); i++ {
        if a[i] == '1' {
            count++
        }
    }
    fmt.Println(count)
}

Measured memory_bytes: 512
o=->a,n{n<1?1:a**n[0]*o[a,n/2]**2%M}
eval'N,A,B='+`dd`.split*?,
a=o[A*=t=o[A+B,-2+M=10**9+7],N]
b=o[B*=t,N]
[g=1,*(1...N).map{|i|g=g*i%M}].map{|f|$.=($.+o[g*f,M-2]*(a+b)*100*g*t=t*N%M)%M
N+=1
a=a*B%M
b=b*A%M}
p$.

Measured memory_bytes: 4360
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, A, B; cin >> N >> A >> B;
	int mini = A*(N - 1) + B;
	int maxi = A + B*(N - 1);
	cout << max(0LL, maxi - mini + 1) << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
long long H,W,c=0; cin>>H>>W;
long long counter=0;
long long a[H]={0};
long long aco=0;
long long bco=0;
cin>>a[0];
long long cco=a[0];
counter=a[0];
long long counter1=counter;
long long counter2;
long long answer=0;
long long ddo=0;
for(long long i=1;i<H;i++){
cin>>a[i];}
while(cco%2==0){
aco++;
cco/=2;}
for(long long i=1;i<H;i++){
cin>>a[i];
ddo=a[i];
while(ddo%2==0){
bco++;
ddo/=2;}
if(aco!=bco){
c=1;
goto asd;}
bco=0;}
for(long long j=0;j<H;j++){
counter=a[j];
counter2=__gcd(counter1,counter);
answer=counter*counter1/counter2;
counter1=answer;}
asd:
if(c==1) 
cout<<0<<endl;
else
cout<<(W+answer/2)/answer<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL L,R; cin >> L >> R;
    LL ans = LINF;

    for(LL i = L; i <= min(L+2019,R); i++){
        for(LL j = i+1; j <= min(R,i+1+2019); j++){
            LL tmp = i * j % 2019;
            ans = min(ans,tmp);
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
#define inf 0x3f3f3f3f
#define ll long long
int a[N],b[10];
int main() 
{
	int n;
	cin>>n;
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]<400)
		{
			b[1]++;
		}
		else if(a[i]<800)
		{
			b[2]++;
		}
		else if(a[i]<1200)
		{
			b[3]++;
		}
		else if(a[i]<1600)
		{
			b[4]++;
		}
		else if(a[i]<2000)
			b[5]++;
		else if(a[i]<2400)
			b[6]++;
		else if(a[i]<2800)
			b[7]++;
		else if(a[i]<3200)
			b[8]++;
		else if(a[i]>=3200)
			cnt++;
	}
	int t=0;
	for(int i=1;i<=8;i++)
		if(b[i])
			t++;
	if(t==0)
		cout<<1<<" "<<cnt<<endl;
	else 
		cout<<t<<" "<<t+cnt<<endl;
	
	return 0;
}

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

using namespace std;

int main(){
	long long n,t;
	cin >> n;
	long long nmax=-10000000,nmin=10000000,nsum=0;
	for(long long i=0;i<n;i++){
		cin >> t;
		if(nmax<t)nmax=t;
		if(nmin>t)nmin=t;
		nsum+=t;
	}
	cout << nmin << " " << nmax << " " << nsum << endl;
	return 0;
}

Measured memory_bytes: 3084
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int M1 = Integer.parseInt(sc.next());
			int D1 = Integer.parseInt(sc.next());
			int M2 = Integer.parseInt(sc.next());
			int D2 = Integer.parseInt(sc.next());
			if(M1 == M2) {
				System.out.println(0);
			}else {
				System.out.println(1);
			}
		}	
	}
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    ll n;
    cin >> n;
    if(n & 1) cout << 0;
    else
    {
        n /= 2;
        ll res = 0;
        while(n)
        {
            res += n / 5;
            n /= 5;
        }
        cout << res;
    }
    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

long P = 10^^9+7;

long pow(long x, long n) {
    long y = 1;
    while (n) {
        if (n%2 == 1) y = (y * x) % P;
        x = x^^2 % P;
        n /= 2;
    }
    return y;
}

long inv(long x)
{
    return pow(x, P-2);
}

void main()
{
    auto N = readln.chomp.to!long;
    int[][] T;
    T.length = N;
    foreach (_; 0..N-1) {
        auto ab = readln.split.to!(int[]);
        auto A = ab[0]-1;
        auto B = ab[1]-1;
        T[A] ~= B;
        T[B] ~= A;
    }

    long[][] TT;
    TT.length = N;
    long run(int i, int p) {
        int s;
        foreach (j; T[i]) if (p != j) {
            auto n = run(j, i);
            TT[i] ~= n;
            s += n;
        }
        if (N-(s+1) > 0) TT[i] ~= N-(s+1);
        return s+1;
    }
    run(0, -1);

    long r, all = pow(2L, N);
    long all_h = all * inv(2) % P, iall = inv(all);
    foreach (i; 0..N) {
        if (TT[i].length == 1) continue;

        long rr = 1;
        foreach (n; TT[i]) {
            rr = (rr + (pow(2, n) - 1 + P) % P) % P;
        }
        r = (r + (all_h - rr + P) % P * iall % P) % P;
    }
    writeln(r);
}

Measured memory_bytes: 44924
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll n,sum=0;
    cin>>n;
    //cout<<n<<'\n';
    for (ll i=1;i<=n;i++){
        if (i%5!=0&&i%3!=0){
            sum+=i;
        }
    }
    cout<<sum<<'\n';
}

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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

int main() {
	int n,t;

	cin >> n;
	V<pair<int, int> > p(n);

	REP(i,n) {
		cin >> t;
		p[i] = make_pair(t, i+1);
	}

	sort(ALL(p));

	REP(i,n) {
		cout << p[i].second << " ";
	}
	cout << endl;
}



Measured memory_bytes: 1664
// 2220
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
using namespace std;
const double PI = 2 * asin(1.0);


double cuberoot(double x){
	double s , prev;
	int positive;
	if(x == 0)  return 0;
	if(x>0)positive = 1; else {positive = 0 ; x = -x;}
	if(x>1) s = x ; else s = 1;
	do{
		prev = s ;  s = (x/(s*s)+2*s)/3;
	}while(s < prev);
	if(positive) return prev; else return -prev;
}
int M , P;

void check(double s){
	if(abs(s) < 1e-10) return ;
	if(s > 0) P++;
	else M++;
}
void cardano(double a, double b , double c , double d){
	double p , q , t , a3 , b3 , x1 , x2 , x3;
	b/=(3*a);
	c/=a;
	d/=a;
	p = b * b - c / 3;
	q = (b * (c-2*b*b)-d)/2;
	a = q * q - p * p * p;
	if(a == 0){
		q = cuberoot(q); x1 = 2 * q - b ; x2 = -q - b;
		//printf("x = %g, %g(ツ重ツ嘉ー)\n",x1,x2);
		check(x1);
		check(x2);
		check(x2);
	}else if( a > 0){
		if(q>0) a3 = cuberoot(q+sqrt(a));
		else a3 = cuberoot(q-sqrt(a));
		b3 = p / a3;
		x1 = a3 + b3 - b;
		x2 = - 0.5 * (a3 + b3) - b;
		x3 = fabs(a3-b3) * sqrt(3.0) / 2;
		//printf("x = %g; %g +- %g i\n",x1,x2,x3);
		check(x1);
	}else{
		a = sqrt(p) ; t = acos( q / (p * a) ); a *= 2;
		x1 = a * cos(t/3)-b;
		x2 = a * cos((t+2*PI)/3)-b;
		x3 = a * cos((t+4*PI)/3)-b;
		//printf("x = %g , %g , %g\n",x1,x2,x3);
		check(x1);
		check(x2);
		check(x3);
	}
}
int main(){ 
	cardano(2,8,10,4);
	int n;
	cin >> n;
	for(int i = 0 ; i < n ; i++){
		double a , b , c , d;
		cin >> a >> b >> c >> d;
		M = P = 0;
		cardano(a,b,c,d);
		cout << P << " " << M << endl;
	}
}

Measured memory_bytes: 0
using System;
using System.Linq;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] data = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
            Arrangement s = new Arrangement(data);
            s.Sort();
            s.Show();
        }
    }
    class Arrangement
    {
        int[] num;
        public Arrangement(int[] num) { this.num = num; }
        public void Sort() { Array.Sort(num); }
        public void Show()
        {
            int i = 1;
            foreach(int n in num)
            {
                Console.Write(n);
                if (i == num.Length) Console.WriteLine();
                else Console.Write(" ");
                i++;
            }
        }
    }
}

Measured memory_bytes: 9704
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  st s,t;
  	ci(s>>t);
  ll a=s.sz;
  ll b=t.sz;
  FOR(i,0,a+b){
	if(i%2==0){
		cout<<s[i/2];
    }
    else{
        cout<<t[i/2];
    }
  }
  cout<<" "<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        int N, ans = 0;
        int[] p;

        void solve(InputReader in, PrintWriter out) {
            N = in.nextInt();
            p = in.nextIntArray(N);
            for (int i = 1; i < N - 1; ++i) {
                int[] a = new int[] {p[i - 1], p[i], p[i + 1]};
                Arrays.sort(a);
                if (p[i] == a[1]) ans++;
            }
            out.println(ans);
        }
    }


    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}

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

int main(){
  int N;
  int64_t D;
  cin >> N >> D;

  vector<pair<int64_t, int64_t>> data(N);
  for(int i=0; i<N; i++){
    cin >> data.at(i).first >> data.at(i).second;
  }

  int ans= 0;
  for(auto [x,y]:data){
    if(x*x+ y*y <= D*D){
      ans++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 6348
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n, m, Q;
  cin >> n >> m >> Q;
  vector<int> l(m), r(m);
  vector<vector<int>> x(n + 1, vector<int>(n + 1, 0));
  vector<vector<int>> c = x;

  rep(i, 0, m) {
    cin >> l[i] >> r[i];
    x[l[i]][r[i]]++;
  }

  rep(i, 1, n + 1) { rep(j, 1, n + 1) c[i][j] = c[i][j - 1] + x[i][j]; }

  rep(i, 1, Q + 1) {
    int p, q;
    cin >> p >> q;
    int sumv = 0;
    rep(j, p, q + 1) sumv += c[j][q] - c[j][p - 1];
    cout << sumv << endl;
  }
}


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

int main() {
  int N;
  cin >> N;
  
  int M = 100001;
  
  int a[M] = {0};
  int num;
  
  for (int i = 0; i < N; i++) {
    cin >> num;
    
    a[num-1]++;
    a[num]++;
    a[num+1]++;
  }
  
  int ans = 0;
  
  for ( int i = 1; i < 100001; i++) {
    if (ans < a[i]) {
      ans = a[i];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
typedef pair<ll,ll> P;

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

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return 1;
    }
    return 0;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return 1;
    }
    return 0;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


int dx[5]={1,0,-1,0};
int dy[5]={0,1,0,-1};
// v.front() = -BOUND;
// v.back() = BOUND;
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }
    // 素数である
    return true;
}

int d[127];
int main() {
    int N;
    int ans=0;
    int p[100005];
    bool same=false;
    int seq=0;
    int samenum=0;
    cin >> N;
    for(int i=1; i<=N; i++){
        cin >> p[i];
        if(!same && p[i]==i){
            same=true;
            samenum++;
        }else if(same && p[i]==i){
            seq++;
            same=false;
            samenum++;
        }else if(same && p[i]!=i){
            same=false;
        }else if(!same && p[i]!=i){
            same=false;
        }
    }

    cout << samenum-seq << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>
#include <map>

using namespace std;
typedef long long ll;
ll N;
ll M;
string s;
vector<ll > input1;  
vector<vector <ll > > input2;

int main(){
    
    //cin >> N;
    int a,b,c,d,e,k;
    vector<ll > aa(5);
    for(int i = 0; i < 5; i++){
        cin >> aa[i];
    } 
    cin >> k;
    
    for(ll i = 0; i < 5; i++){
        for(ll j = i + 1; j < 5; j++){
            if(abs(aa[i] - aa[j]) > k){
                cout << ":(" << endl;
                return 0;
            }
        }
    }
     cout << "Yay!" << endl;


} 

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    char arr[10];
    scanf("%s",arr);
    arr[0] = '2';
    arr[1] = '0';
    arr[2] = '1';
    arr[3] = '8';
    for(int i=0; i<10;i++){    
    printf("%c",arr[i]);
    }
    return 0;
}

Measured memory_bytes: 1596