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

using namespace std;

int main(){
  long long a, b, c;
  cin >> a >> b >> c;
  
  if ((c - a - b) <= 0){
    cout << "No";
    return 0;
  }
  
  long long left = a * b * 4;
  long long right = (c - a - b) * (c - a- b);
  string ret = (left < right) ? "Yes" : "No";
  cout << ret;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int score[5], sum = 0, ave;
	int i;
	
	for (i = 0; i < 5; i++){
		scanf("%d", &score[i]);
		if (score[i] < 40) score[i] = 40;
		
		sum += score[i];
	}
	
	ave = sum/5;
	
	printf("%d\n", ave);
	
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define ll                  long long
#define dl                 double
#define pb                push_back
#define eb                emplace_back
#define mp                make_pair
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   for(int i=s;i<n;i++){cout <<  V[i] << "  " ;} cout << endl;
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
using namespace std;

int main()
{
fast;
ll q=1;
//cin >> q;
while(q--)
{
    ll n,m,i,j,l,r,a,t,b,c,u,v,w,p,x,y;
    //n=m=i=j=l=r=a=t=b=c=u=v=w=p=x=y=0;
    cin >> n >> t;
    vector<vector<ll> > T(n+1);
    for(i=0;i<n-1;i++)
    {
        cin >> u >> v;
        T[u].pb(v);
        T[v].pb(u);
    }
    vector<ll> C(n+1);
    for(i=0;i<t;i++)
    {
        cin >> x >> y;
        C[x] += y;
    }
    vector<ll> ans(n+1);
    vector<ll> vis(n+1,0);
    queue<ll> Q;
    Q.push(1);
    ans[1] = C[1];
    while(!Q.empty())
    {
        ll x = Q.front();
        vis[x] = 1;
         Q.pop();
        for(auto it:T[x])
        {
            if(vis[it]==0)
            {
                ans [it]  = C[it] + ans[x];
                Q.push(it);
            }
        }
    }

    COUT(ans,1,n+1);


}
    return 0;
}


Measured memory_bytes: 21232
//#define local
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
#ifdef local
#include "library/debug.cpp"
#else
#define debug(...)
#endif
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin >> n;
    map<ll,ll> mp; ll ans = 0;
    rep(i,n){
        ll a; cin >> a;
        mp[a+i]++;
        ans += mp[-a+i];
    }
    cout << ans << endl;

}

Measured memory_bytes: 26244
from collections import deque
N = int(input())
E = [[] for _ in range(N)]
for _ in range(N-1):
    u,v,w = map(int, input().split())
    E[u-1].append((v-1, w))
    E[v-1].append((u-1, w))

ans = [-1]*N
ans[0] = 0
q = deque()
q.append((0, 0))
while q:
    temp = q.popleft()
    u = temp[0]
    w = temp[1]
    for e in E[u]:
        if ans[e[0]] >= 0:
            continue
        if w+e[1] & 1 == 0:
            ans[e[0]] = 0
        else:
            ans[e[0]] = 1
        q.append((e[0], w+e[1]))

for a in ans:
    print(a)

Measured memory_bytes: 39292
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

void debug_out() { std::cout << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n)-1); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n)-1); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> d(n);
    rep(i,0,n) cin >> d[i];
    vector<int> t(13,0);
    t[0]++;
    rep(i,0,n){
        t[d[i]]++;
        if(d[i]==0 || t[d[i]]>2){
            cout << "0\n";
            return 0;
        }
    }
    int ans = 0;
    vector<int> a;
    rep(bit,0,(1<<12)){
        a.assign(1,0);
        rep(i,0,12){
            if(t[i+1]==2){
                a.emplace_back(i+1);
                a.emplace_back(23-i);
            }
            if(bit & (1<<i) && t[i+1]==1){
                a.emplace_back(23-i);
            }
            else if(t[i+1]==1){
                a.emplace_back(i+1);
            }
        }
        int c = INF;
        rep(i,0,a.size()){
            rep(j,0,a.size()){
                if(i==j) continue;
                int dt = abs(a[i]-a[j]);
                dt = min(dt,24-dt);
                chmin(c,dt);
            }
        }
        chmax(ans,c);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    long a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    sort(a,a+n,greater<long>());
    long aa = 0;
    long bb = 0;
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1]){
            if(aa!=0){
                bb=a[i];
                break;
            }else{
                aa = a[i];
                i++;
            }
        }
    }
    cout << aa*bb<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define met(s) memset(s, 0, sizeof(s))
const int mod = 1e9 + 7;
const int maxn = 100005;
const int inf = 0x3f3f3f3f;
vector<int> g[maxn];
int n, k, dp[maxn];
ll ans = 1;
bool used[maxn];
void dfs(int x)
{
    for (int i = 0; i < g[x].size(); i++)
    {
        if (!used[g[x][i]])
        {
            used[g[x][i]] = true;
            ans = (ans * (k - dp[x])) % mod;
            dp[x]++;
            dp[g[x][i]] = 2;
            dfs(g[x][i]);
        }
    }
}
int main()
{
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n - 1; i++)
    {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back(v);
        g[v].push_back(u);
    }
    memset(used, false, sizeof(used));
    dp[1] = 1;
    used[1] = true;
    ans *= k;
    dfs(1);
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 9728
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // fixed, setprecision 
#include <math.h> // double sqrt
#define rep(i,n) for(int i=0;i<(n);++i)
#define ll long long
using namespace std;
int main(){
int n;
cin>>n;
vector<string>s(n);
rep(i,n)cin>>s[i];
int a=0,b=0,c=0,d=0;
rep(i,n){
    if(s[i]=="AC")a++;
    if(s[i]=="WA")b++;
    if(s[i]=="TLE")c++;
    if(s[i]=="RE")d++;}
    cout<<"AC x "<<a<<endl;
        cout<<"WA x "<<b<<endl;
            cout<<"TLE x "<<c<<endl;
                cout<<"RE x "<<d<<endl;
                return 0;

}

Measured memory_bytes: 5260
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl

#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define gap cout<<endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(int i=0;i<n;i++)
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())


const int N=100005;
int father[N];
int height[N];
int wrong[N];
int edges[N];
void init() {
    for (int i = 0; i < N; ++i) {
        father[i] = i;
        height[i] = 1;
        wrong[i]=0;
        edges[i]=0;
    }
}

int find(int node) {
    if (father[node] != node) {
        father[node] = find(father[node]);
    }
    return father[node];
}

void unite(int A, int B) {
    int rootA = find(A);
    int rootB = find(B);
    if(rootB==rootA) return;
    if (height[rootA] > height[rootB]) {
        father[rootB] = rootA;
        height[rootA] = (height[rootA]+ height[rootB]);
    } else {
        father[rootA] = rootB;
        height[rootB] = (height[rootB]+height[rootA]);
    }
}

int main(){
	int n,m,k;
	cin>>n>>m>>k;
	init();
	int a,b;
	fo(i,m){
       cin>>a>>b;
       edges[a]++;
       edges[b]++;
       unite(a,b);
	}
	fo(i,k){
		cin>>a>>b;
		if(find(a)==find(b)){
			wrong[a]++;
			wrong[b]++;
		}
	}
	int ans=0;
	FOR(i,1,n){
		ans=max(height[find(i)]-edges[i]-1-wrong[i],0);
        cout<<ans<<" ";
	}
	gap


}

Measured memory_bytes: 2432
#include<stdio.h>
#include<math.h>

double a1,b1,c1,a2,b2,c2,delta,x,y;

int main(){
while(scanf("%lf%lf%lf%lf%lf%lf",&a1,&b1,&c1,&a2,&b2,&c2) != EOF){
  delta = a1*b2 - b1*a2;
  x = (c1*b2 - b1*c2)/delta;
  y = (a1*c2 - a2*c1)/delta;
  x = floor(10000*x+0.5)/10000;
  y = floor(10000*y+0.5)/10000;
 printf("%.3lf %.3lf\n",x,y);
 }
  return 0;
}

Measured memory_bytes: 648
#include<bits/stdc++.h>
using namespace std;
char c;
void imput() {
  cin >> c;
}
void judge(char c) {
  if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u') cout<<"vowel\n";
  else cout<<"consonant\n";
  return;
}
int main(){
  imput();
  judge(c);
  return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <math.h>

double radius;
double area;
double length;


int main() {
  scanf("%lf", &radius);
  area = radius * radius * M_PI;
  length = radius * 2 * M_PI;
  printf("%lf %lf\n", area, length);
  return 0;
}



Measured memory_bytes: 2128
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

class union_find
{
public:
	vector<int> parent;
	vector<int> count;
	vector<int> rank;

public:
	union_find(int vertex_count)
		: parent(), count(), rank()
	{
		parent.assign(vertex_count, 0);
		count.assign(vertex_count, 1);
		rank.assign(vertex_count, 1);

		for (int i = 0; i < vertex_count; i++)
		{
			parent[i] = i;
		}
	}

public:
	int find(int u)
	{
		if (parent[u] == u) return u;
		return parent[u] = find(parent[u]);
	}

	void merge(int u, int v)
	{
		u = find(u);
		v = find(v);

		if (u == v) return;
		if (rank[u] < rank[v]) swap(u, v);

		parent[v] = u;
		count[u] += count[v];
		if (rank[u] == rank[v]) rank[u]++;
	}

	int size(int u)
	{
		return count[find(u)];
	}
};

//union_find uf(N);
//uf.merge(u, v);
//int u_parent = uf.find(u);
//int u_size = uf.size(u);

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

	int N, M;
	cin >> N >> M;

	union_find uf(N);

	for (int i = 0; i < M; i++)
	{
		int a, b;
		cin >> a >> b;

		uf.merge(a - 1, b - 1);
	}

	int result = 0;
	for (int i = 0; i < N; i++)
	{
		result = max(result, uf.size(i));
	}

	cout << result;

	return 0;
}


Measured memory_bytes: 5568
arr=[]
s = input()

for i in  s:
  if i == '0':
    arr.append('0')
  elif i == '1':
    arr.append('1')
  elif i == 'B':
    if len(arr) > 0:
      arr.pop(-1)
  else:
    pass
  
print(''.join(arr))
    

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

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

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

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()



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

    cout << 180*(N-2) << endl;

}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
#define P pair<int, int>
const int INF = INT_MAX / 2;
const int N = 50;

int main(){
    map<char, char> alpha;
    int a = 'A';
    for(char i = 'A'; i <= 'Z'; i++){
        alpha[i + 3] = i;
    }
    alpha['A'] = 'X';
    alpha['B'] = 'Y';
    alpha['C'] = 'Z';

    string str;
    cin >>str;
    REP(i, str.size()) cout <<alpha[str[i]];
    cout <<endl;
    return 0;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 1000000007;


     signed main(){
         cout << std::fixed << std::setprecision(15);
int a,v,b,w,t;
cin>>a>>v>>b>>w>>t;
if(t*(v-w)>=abs(a-b))cout<<"YES"<<endl;
else cout<<"NO"<<endl;

     }

 


 






    





      

        


Measured memory_bytes: 3636
#include <stdio.h>

int main(){

    int A, B,  val1, val2, val3;

    scanf("%d %d", &A, &B);

    val1 = A+B;
    val2 = A-B;
    val3 = A*B;

    if(val1 > val2 && val1 > val3){
        printf("%d\n", val1);
    }else if(val1 < val2 && val2 > val3){
        printf("%d\n", val2);
    }else if(val3 > val2 && val3 > val1){
        printf("%d\n", val3);
    }else if(val1 == val2 || val2 == val3 || val1 == val3){
        printf("%d\n", val1);
    }


    return 0;
}
        


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

int main() {
	string str1,str2,str3;
	int i,n1,n2;
	getline(cin, str1);
	getline(cin, str2);
	n1 = str1.length();
	n2 = str2.length();
	for (i = 0; i < n2; i++) {
		str1 += str1[i];
	}
	if (str1.find(str2) != std::string::npos) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  vector<int> v(n), c(n);
  int ans = 0;
  for(int & i : v) cin >> i;
  for(int & i : c) cin >> i;
  for(int i = 0; i < n; i++) ans += max(0, v[i] - c[i]);
  cout << ans << endl;
  return 0;
}

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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

vector<int> v;

void runrun(int i, int level)
{
  if (level == 0)
    return;
  int d = i % 10;
  if (d - 1 >= 0)
  {
    v.push_back(i * 10 + d - 1);
    runrun(i * 10 + d - 1, level - 1);
  }
  if (d + 1 <= 9)
  {
    v.push_back(i * 10 + d + 1);
    runrun(i * 10 + d + 1, level - 1);
  }
  v.push_back(i * 10 + d);
  runrun(i * 10 + d, level - 1);
}

signed main()
{
  int k;
  cin >> k;
  for (int i = 1; i <= 9; i++)
  {
    v.push_back(i);
    runrun((i), 10LL);
  }
  sort(all(v));
  cout << v[k - 1] << endl;
  // cout << v.size() << endl;
}


Measured memory_bytes: 10476
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define INF 10000000000000009
#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

signed main(){
    int A[3]={};
    string S;
    cin >> S;
    REP(i,S.size()){
        A[(int)(S[i]-'a')]++;
    }
    if(S.size()==1){
        cout << "YES" << endl;
        return 0;
    }
    if(S.size()==2){
        YES(S[0]!=S[1]);
        return 0;
    }
    if(S.size()==3){
        YES(S[0]!=S[1]&&S[0]!=S[2]&&S[2]!=S[1]);
        return 0;
    }
    sort(A,A+3);
    YES(A[2]-A[0]<=1);
    
    return 0;
}   


Measured memory_bytes: 512
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a,b,d,r;
    double f;
    scanf("%d %d",&a,&b);
    d = a/b;
    r = a%b;
    f = (double)a/b;
    printf("%d %d %lf\n",d,r,f);

    return 0;
}



Measured memory_bytes: 2100
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9 + 7;
int main() {
	int N;
	cin >> N;
	string S;
	cin >> S;
	int ans = 0;
	for (int i = 0; i <= 999; i++) {
		string T = to_string(i);
		T = string(3 - T.size(), '0') + T;
		int k = 0;
		for (int j = 0; j < N; j++) {
			if (S[j] == T[k]) {
				k++;
			}
		}
		if (k == 3) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
'use strict';

function main(input) {
  const numbers = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'.split(', ');
  console.log(numbers[input - 1]);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

using namespace std;

int main(){
    int N,n_AC,n_WA,n_TLE,n_RE;
    string s;

    cin >> N;
    n_AC = n_WA = n_TLE = n_RE = 0;

    for(int i = 0;i < N;i++){
        cin >> s;
        if(s.compare("AC") == 0){
            n_AC++;
        }else if(s.compare("WA") == 0){
            n_WA++;
        }else if(s.compare("TLE") == 0){
            n_TLE++;
        }else{
            n_RE++;
        }
    }

    printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d",n_AC,n_WA,n_TLE,n_RE);
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    for(int i = 0; i < n; i++) cin >> c[i];
    sort(a.begin(), a.end());
    sort(c.begin(), c.end());
    long long sum = 0;
    for(int i = 0; i < n; i++){
        auto ita = lower_bound(a.begin(), a.end(), b[i]);
        auto itc = upper_bound(c.begin(), c.end(), b[i]);
        sum += (ita - a.begin()) * (c.end() - itc);
    }
    cout << sum << endl;
    return 0;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> a(h+2, vector<char>(w+2, '#'));
  for(int i = 1; i < h+1; i++){
    for(int j = 1; j < w+1; j++) cin >> a.at(i).at(j);
  }
  
  for(int i = 0; i < h+2; i++){
    for(int j = 0; j < w+2; j++) cout << a[i][j];
    cout << endl;
  }
}

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

int main(){
  int x;
  std::cin >> x;
  for(ll i = -1000; i <= 1000; i++){
    for(ll j = 1000; j >= -1000; j--){
      ll a = pow(i,5), b = pow(j,5);
      if(a - b == (ll)x){
        std::cout << i << ' ' << j << '\n';
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 4100
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) a.erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}
int main(){
    ll w,h;cin>>w>>h;
    char c;cin>>c;
    vector<vector<char>> v(h,vector<char>(w,'.'));
    rep(i,w){
        v[0][i]='-';v[h-1][i]='-';
    }
    rep(i,h){
        v[i][0]='|';v[i][w-1]='|';
    }
    v[0][0]='+';
    v[h-1][0]='+';
    v[0][w-1]='+';
    v[h-1][w-1]='+';
    v[h/2][w/2]=c;
    rep(i,h){
        rep(j,w)cout<<v[i][j];
        cout<<endl;
    }
}


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


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

  for(int i=1; i<=n; i++) {
    ll ans = 0;
    for(int x = 1; x*x + 2 * x <= i; x++)
      for(int y = 1; x*x + y *y + x * y + x + y <= i; y++) {
        for(int z = 1; x*x + y *y + z*z + x*y + y*z + z*x <= i; z++) {
          int f = x*x + y *y + z*z + x*y + y*z + z*x;
          if( f == i ) ans++;
        }
      }
    cout << ans << endl;
  }
}


Measured memory_bytes: 3596
N, P = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(N):
    a[i] = a[i] % 2

g = a.count(1)
if g == 0:
    if P == 0:
        ans = 2 ** N
else:
    ans = 2 ** (N - 1)

print(ans)

Measured memory_bytes: 3064
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const ll MOD =998244353;
const ll hell=MOD;
const int INF = 1e16;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

const int N=200005;
int st[4*N];
void update(int i,int l,int r,int in,int x)
{
    if(l>r)
        return;
    if(in>r||in<l)
        return;
    if(l==r)
    {
        st[i]=x;
        return;
    }
    int m=(l+r)/2;
    update(2*i+1,l,m,in,x);
    update(2*i+2,m+1,r,in,x);
    st[i]=max(st[2*i+1],st[2*i+2]);
}
int query(int i,int l,int r,int qs,int qe)

{
    if(qs>r||qe<l)
        return -INF;
    else if(qs<=l&&qe>=r)
        return st[i];
    int mid=(l+r)/2;
    return max(query(2*i+1,l,mid,qs,qe),query(2*i+2,mid+1,r,qs,qe));
}

void solve()
{
    int n;
    cin>>n;
    pair<int,int> p[n];
    for(int i=0;i<n;i++)
    {
        cin>>p[i].first>>p[i].second;
        
    }
    sort(p,p+n);
    vi d(n);
    for(int i=0;i<n;i++)
        d[i]=p[i].first;
    int dp[n+1];
    dp[n]=1;
    int ind[n+1];
    for(int i=0;i<n;i++)
        update(0,0,n-1,i,i);
    for(int i=n-1;i>=0;i--)
    {
        int dx=p[i].first+p[i].second;
        int in=lower_bound(d.begin(),d.end(),dx)-d.begin();
        in--;
        dp[i]=dp[i+1];
        ind[i]=query(0,0,n-1,i,in);
        dp[i]=(dp[i]+dp[ind[i]+1])%hell;
        update(0,0,n-1,i,ind[i]);
    }
    cout<<dp[0]<<endl;
}

int32_t main()
{
    
    IOS;
    //FILE *fin = freopen("in","r",stdin);
    //FILE *fout = freopen("out","w",stdout);
    
    int t;
    t=1;
     //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 14208
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    int d,n;
    cin >> d >> n;
    if(n==100)n++;
    cout << n;
    rep(i,d)cout <<"00";
    cout << endl;
}

Measured memory_bytes: 888
import sys

def solve():
    n,d = map(int, input().split())
    l = [list(map(int, X.split())) for X in sys.stdin.readlines()]
    count = 0
    for i in range(n):
        Y = l[i]
        for Z in l[i+1:]:
            total = 0
            for y,z in zip(Y,Z):
                total += (y-z)**2
            d = total**0.5
            if d == int(d):
                count += 1
    return count

if __name__ == '__main__':
    print(solve())

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int A,B,C,ans;
int main()
{
	scanf("%d%d%d",&A,&B,&C);
	ans+=min(A,C);
	C-=ans; 
	A-=ans;
	if (C==0) ans+=B;
	else {
		if (B>=C) ans+=C+B; else ans+=B*2+1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#define r return
i,j,n,max[6];
dx[8]={1,1,0,-1,-1,-1,0,1};
dy[8]={0,1,1,1,0,-1,-1,-1};
char table[10][10],mark[2]={'o','x'};
 
int l(int dx,int dy,int x,int y,char m,int count){
  if(table[x][y]=='.'||table[x][y]=='0')return 0;
  if(table[x][y]==m)r count;
  r l(dx,dy,x+dx,y+dy,m,count+1);
}
int search(int x,int y,char m){
  int k,count;
  count = 0;
  if(table[x][y]!='.')return 0;
  for(k=0;k<8;k++){
    count += l(dx[k],dy[k],x+dx[k],y+dy[k],m,0);
  }
  return count;
}
int okikae2(int dx,int dy,int x,int y,char m){
  if(table[x][y]=='0'||table[x][y]=='.')return 0;
  else if(table[x][y]==m)return 1;
  else if(okikae2(dx,dy,x+dx,y+dy,m)){
    table[x][y]=m;
    return 1;
  }
  else return 0;
}
int okikae(int x,int y,char m){
  int k;
  table[x][y]=m;
  for(k=0;k<8;k++){
    okikae2(dx[k],dy[k],x+dx[k],y+dy[k],m);
  }
  return 0;
}
 
int main(){
  for(i=0;i<10;i++)table[0][i]=table[9][i]='0';
  for(i=1;i<9;i++){
    scanf("%s",&table[i][1]);
    table[i][0]='0';
    table[i][9]='0';
  }
  max[1]=-1;
  for(n=0;;n=(n+1)%2){
    max[n]=-1;
    for(i=n?8:1;n?i>-1:i<9;n?i--:i++){
      for(j=n?8:1;n?j>-1:j<9;n?j--:j++){
        if(max[n]<search(i,j,mark[n])){
          max[2+n]=i;
          max[4+n]=j;
          max[n]=search(i,j,mark[n]);
        }
      }
    }
    if(max[n]!=0)okikae(max[2+n],max[4+n],mark[n]);
    if(max[0]==0&&max[1]==0)break;
  }
  for(i=1;i<9;i++){
    for(j=1;j<9;j++){
      printf("%c",table[i][j]);
    }
    puts("");
  }
  return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;i++)
const ll INF=1e18;
const int inf=2e9;
const ll MOD=1000000007;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};

int main(){
    int N;cin>>N;
    pair<string,int> info[N];
    rep(i,N)cin>>info[i].first>>info[i].second;
    string S;cin>>S;
    ll ans=0,check=0;
    rep(i,N){
        if(check)ans+=info[i].second;
        if(info[i].first==S)check=1;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  while(true){
    c -= b;
    if(c <= 0){
      cout << "Yes" << endl;
      return 0;
    }
    a -= d;
    if(a <= 0){
      cout << "No" << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3596
#include <stdio.h>

int main(){
  char s[200001];
  scanf("%s",s);
  int len=strlen(s);
  int sum=0;
  for(int i=0;i<len;i++)sum+=s[i]-'0';
  if(sum%9==0){
    puts("Yes");
  }else{
      puts("No");
  }
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

ll h, w;

ll ans = INF;

int main(void) {
  // Here your code !
  scanf("%lld %lld\n", &h, &w);

  for (ll i = 1; i < h; ++i) {
    ll mid = (i + h) / 2;

    ll cur_base = w * i;

    for (ll j = max(mid - 2, i); j <= min(mid + 2, h); ++j) {
      ll cur_1 = (j - i) * w;
      ll cur_2 = (h - j) * w;

      ll cur_diff = max(cur_base, max(cur_1, cur_2)) - min(cur_base, min(cur_1, cur_2));

      ans = min(ans, cur_diff);
    }
  }

  for (ll i = 1; i < h; ++i) {
    ll mid = w / 2;

    ll cur_base = w * i;

    for (ll j = max(mid - 2, 0LL); j <= min(mid + 2, w); ++j) {
      ll cur_1 = (h - i) * j;
      ll cur_2 = (h - i) * (w - j);

      ll cur_diff = max(cur_base, max(cur_1, cur_2)) - min(cur_base, min(cur_1, cur_2));

      ans = min(ans, cur_diff);
    }
  }

  for (ll i = 1; i < w; ++i) {
    ll mid = (i + w) / 2;

    ll cur_base = h * i;

    for (ll j = max(mid - 2, i); j <= min(mid + 2, w); ++j) {
      ll cur_1 = h * (j - i);
      ll cur_2 = h * (w - j);

      ll cur_diff = max(cur_base, max(cur_1, cur_2)) - min(cur_base, min(cur_1, cur_2));

      ans = min(ans, cur_diff);
    }
  }

  for (ll i = 1; i < w; ++i) {
    ll mid = h / 2;

    ll cur_base = h * i;

    for (ll j = max(mid - 2, 0LL); j <= min(mid + 2, h); ++j) {
      ll cur_1 = j * (w - i);
      ll cur_2 = (h - j) * (w - i);

      ll cur_diff = max(cur_base, max(cur_1, cur_2)) - min(cur_base, min(cur_1, cur_2));

      ans = min(ans, cur_diff);
    }
  }

  printf("%lld\n", ans);

  return 0;
}


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

struct UnionFind {
	vector<int> par, siz;
	UnionFind(int n): par(n), siz(n,1) {
		rep(i,n) par[i] = i;
	}
	int find(int x) {
		return (par[x] == x) ? x: par[x] = find(par[x]);
	}
	bool unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return false;
		if (siz[x] < siz[y]) swap(x,y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int size(int x) {
		return siz[find(x)];
	}
};

int main() {
	int n, m, k;
	cin >> n >> m >> k;
	UnionFind uf(n);
	vector<set<int>> v(n, set<int>());
	rep(i,m) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		uf.unite(a, b);
		v[a].insert(b);
		v[b].insert(a);
	}
	rep(i,k) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		if (!uf.same(a, b)) continue;
		v[a].insert(b);
		v[b].insert(a);
	}
	rep(i,n) {
		if (i != 0) cout << " ";
		cout << max(0, uf.size(i) - (int) v[i].size() - 1);
	}
	cout << endl;
}

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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define itrdebug(x) cerr << #x << " "; for (auto & el : (x)) {cerr << (el) << " ";} cerr << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define debug(x)
#define itrdebug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long N, std::vector<long long> a){
    ll sum = 0;
    rep(i,0,N) sum ^= a[i];
    rep(i,0,N) cout << (sum ^ a[i]) << (i==N-1 ? "\n" : " ");
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, std::move(a));
    return 0;
}


Measured memory_bytes: 4924
def fetch_int_input():
    return [int(s) for s in input().strip().split()]

pre_input = fetch_int_input()
nxt_input = fetch_int_input()

echo_str = ""
if pre_input[0] != nxt_input[0]:
  echo_str = 1
 
else:
  echo_str = 0
 
print(echo_str)


Measured memory_bytes: 38736
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{

	public static void main(String[] arg) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = br.readLine().split(" ");

		double a = Double.parseDouble(str[0]);
		double b = Double.parseDouble(str[1]);
		double degree = Double.parseDouble(str[2]);

		double revrad = Math.PI * ( (180-degree)/180);//3.141592d Math.PI

		double cx = b * Math.cos(revrad) + a;
		double cy = b * Math.sin(revrad);

		System.out.printf("%.5f\n",(a*cy) / 2);
		System.out.printf("%.5f\n",Math.sqrt( (Math.pow(cx, 2) + Math.pow(cy, 2) )  ) + a + b);
		System.out.printf("%.5f\n",cy);
	}
}

Measured memory_bytes: 24628
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a; }

int main() {
    int n;
    cin >> n;
    vll a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    ll g = gcd(a[0], a[1]);
    srep(i, n, 2) {
        g = gcd(g, a[i]);
    }
    ll ans = g;

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

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

using namespace std;

int main() {
	stack<int> S1;
	stack< pair<int, int> > S2;
	int *ans;
	char ch;
	int A = 0;

	int i = 0, j;
	while (cin >> ch) {
		if (ch == '_' || (ch == '/' && S1.empty() == true)) {
			++i;
			continue;
		}
		else if (ch == '\\') {
			S1.push(i);
			++i;
			continue;
		}
		else if (ch == '/') {
			j = S1.top();
			S1.pop();
			A += (i - j);
			if (S2.empty() == true) {
				S2.push(make_pair(j, i - j));
				++i;
				continue;
			}
			else {
				int k = S2.top().first;

				if (k < j) {
					S2.push(make_pair(j, i - j));
					++i;
					continue;
				}
				else if (j < k) {
					int tempArea = 0;
					while (j < k && S2.empty() != true) {
						tempArea += S2.top().second;
						S2.pop();
						if (S2.empty() != true) {
							k = S2.top().first;
						}
					}
					S2.push(make_pair(j, tempArea + (i - j)));
					++i;
					continue;
				}
			}
		}
		else {
			++i;
			continue;
		}
	}

	int size = S2.size();
	ans = new int[size];
	for (int i = 0; i < size; ++i) {
		ans[size - 1 - i] = S2.top().second;
		S2.pop();
	}


	cout << A << endl;
	cout << size;
	for (int i = 0; i < size; ++i) {
		cout << " " << ans[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1284
from sys import stdin


def judge_palindrome(S):
    for i in range(len(S)//2):
        if S[i] != S[-i-1]:
            return False
    return True


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    S =     _in[0]   # type:str
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    N = len(S)
    flag = True
    if flag:
        flag = judge_palindrome(S)
    if flag:
        flag = judge_palindrome(S[0:(N-1)//2])
    if flag:
        flag = judge_palindrome(S[(N+3)//2-1:N])
    TF = 'Yes' if flag else 'No'
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
 
int main(void)
{
    int n,m,x,count=0;
    cin >> n >> m >> x;
    vector<int> lc(m);
    for(int i=0;i<m;i++) {
        cin >> lc.at(i);
        if(lc.at(i)<x) count++;
    }
    if(count>m-count) cout << (m-count);
    else cout << count;
}

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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxN = 60;
const int maxM = 20;

int n, m;
vi adj[maxN];
int cnt = 0, mat[maxN][maxN], flag[maxN];
ll prep[1 << maxM], res = 0;

void DFS(int u)
{
    flag[u] = 1;
    for (auto &v: adj[u])
    {
        if (!flag[v])
        {
            mat[u][v] = mat[v][u] = cnt++;
            DFS(v);
        }
    }
}

ll path(int u, int v)
{
    queue <int> pq;
    pq.emplace(u);
    vi flag(n + 1), tr(n + 1);
    flag[u] = 1;
    tr[u] = u;
    ll r = 0;
    while (!pq.empty())
    {
        int u = pq.front();
        pq.pop();
        for (auto &v: adj[u])
        {
            if (!flag[v])
            {
                flag[v] = 1;
                tr[v] = u;
                pq.emplace(v);
            }
        }
    }
    while (v != u)
    {
        r |= 1LL << mat[v][tr[v]];
        v = tr[v];
    }
    return r;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for1(i, n - 1)
    {
        int u, v;
        cin >> u >> v;
        adj[u].eb(v);
        adj[v].eb(u);
    }
    DFS(1);
    cin >> m;
    for0(i, m)
    {
        int u, v;
        cin >> u >> v;
        prep[1 << i] = path(u, v);
    }
    res = 1LL << (n - 1);
    for1(mask, (1 << m) - 1)
    {
        prep[mask] = prep[mask & -mask] | prep[mask - (mask & -mask)];
        ll r = 1LL << (n - 1 - __builtin_popcountll(prep[mask]));
        res += r * ((__builtin_popcount(mask) & 1) ? -1 : 1);
    }
    assert(res >= 0);
    cout << res;
    return 0;
}


Measured memory_bytes: 8448
#include <iostream>
#include <string>
#include <string_view>
#include <vector>
#include <algorithm>

using namespace std;

bool isPalindrome(const string& s)
{
	if (s.empty())
		return false;

	for (int i = 0; i < s.size() / 2; i++)
		if (s[i] != s[s.size() - 1 - i])
			return false;
	return true;
}

vector<string> strings;
vector<string> reversedStrings;
vector<int> costs;

struct stringData
{
	string s;
	bool isLeft;
	bool operator==(const stringData& other)
	{
		return (s == other.s) && (isLeft == other.isLeft);
	}
};

long long completePalindrome(const string& s, bool isLeft,
	vector<stringData> visitedStrings)
{
	if (isPalindrome(s))
		return 0;

	visitedStrings.push_back({ s, isLeft });

	const vector<string>& complStrings = (isLeft) ? reversedStrings : strings;
	long long minCost;
	bool first = true;
	for (int i = 0; i < complStrings.size(); i++)
	{
		const string& complString = complStrings[i];
		int j;
		bool b = false;
		for (j = 0; j < min(s.size(), complString.size()); j++)
		{
			if (s[j] != complString[j])
			{
				b = true;
				break;
			}
		}
		if (b)
			continue;
		if (s.size() == complString.size())
		{
			if (first)
			{
				first = false;
				minCost = costs[i];
			}
			else
			{
				if (costs[i] < minCost)
					minCost = costs[i];
			}
		}
		else
		{
			long long val;
			string rest;
			bool newIsLeft;
			if (s.size() < complString.size())
			{
				rest = complString.substr(s.size(), complString.size() - s.size());
				newIsLeft = !isLeft;
			}
			else // s.size() > complString.size()
			{
				rest = s.substr(complString.size(), s.size() - complString.size());
				newIsLeft = isLeft;
			}
			if (find(visitedStrings.begin(), visitedStrings.end(), stringData({ rest, newIsLeft })) != visitedStrings.end())
				continue;
			val = completePalindrome(rest, newIsLeft, visitedStrings);
			if (val == -1)
				continue;
			if (first)
			{
				first = false;
				minCost = costs[i] + val;
			}
			else
			{
				if (costs[i] + val < minCost)
					minCost = costs[i] + val;
			}
		}
	}
	if (!first)
		return minCost;
	else
		return -1;
}

int main()
{
	int n;
	cin >> n;
	strings.resize(n);
	reversedStrings.resize(n);
	costs.resize(n);
	
	for (int i = 0; i < n; i++)
	{
		cin >> strings[i] >> costs[i];
		reversedStrings[i] = strings[i];
		reverse(reversedStrings[i].begin(), reversedStrings[i].end());
	}

	cout << completePalindrome("", false, {}) << endl;
	return 0;
}

Measured memory_bytes: 3888
#include<bits/stdc++.h>
using namespace std;
// URDL
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
long long mod = 1e9+7;
//

int main(){
  int n, x; cin >> n >> x;
  int p = 0;
  int l;
  int cnt = 1;
  for(int i=0; i<n; i++) {
    cin >> l;
    p += l;
    if(p <= x) cnt++;
  }
  cout << cnt << endl;

  return 0;
}


// EOF


Measured memory_bytes: 256
h1, m1, h2, m2, k = map(int, input().split())

if h2<h1:
    h2=24+h2

hours=h2-h1

if m2<m1:
    m2+=60
    hours-=1
min=m2-m1

time= min+ 60*hours

print(time-k)

Measured memory_bytes: 9180
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <ccomplex>
#include <unordered_map>
#include <cstring>
#include <iostream>
#include <numeric>


using namespace std;
#define MAX 100000

int main(){
    int N, K;
    cin >> N >> K;
    int a, b, c;

    // Kの倍数がめんば
    long long int cnt = N / K;
    long long int ans = cnt * cnt * cnt;

    // Kの半分の大きさのあまりを持つのがめんば(Kが偶数なら)
    if (0 != K % 2){
        // nop
    }
    else{
        int tmp = K / 2;
        if (tmp <= (N - (int)(cnt * K))){
            cnt++;
        }
        ans += cnt * cnt * cnt;
    }
    cout << ans;
    return 0;
}

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

int main(void) {
  long long a,b,k,x;
  cin >> a >> b >> k;
  x = min(a,k);
  a -= x;
  k -= x;
  x = min(b,k);
  b -= x;
  k -= x;
  cout << a << " " << b;
}

Measured memory_bytes: 256
use std::io::stdin;
use std::str::FromStr;

fn main(){
    let (x, a): (i64, i64) = get_pair();
    let ans = if x < a { 0 } else { 10 };
    println!("{}", ans);
}

#[allow(dead_code)]
fn get_line() -> String {
    let mut s = String::new();
    match stdin().read_line(&mut s){
        Ok(_) => {s.trim().to_string()}
        Err(_) => String::new()
    }
}

#[allow(dead_code)]
fn get_vec<T: std::str::FromStr>() -> Vec<T> {
    let line = get_line();
    line.split_whitespace().filter_map(|x| x.parse().ok()).collect()
}

#[allow(dead_code)]
fn get_one<T: FromStr + Copy>() -> T {
    let v = get_vec();
    v[0]
}

#[allow(dead_code)]
fn get_pair<T: FromStr + Copy>() -> (T, T) {
    let v = get_vec();
    (v[0], v[1])
}

#[allow(dead_code)]
fn get_triple<T: FromStr + Copy>() -> (T, T, T) {
    let v = get_vec();
    (v[0], v[1], v[2])
}

#[allow(dead_code)]
fn get_chars() -> Vec<char> {
    get_line().chars().collect()
}

#[allow(dead_code)]
fn vec_min(xs: &Vec<i64>) -> i64 {
    xs.iter().map(|&x|x).fold(std::i64::MAX, std::cmp::min)
}

#[allow(dead_code)]
fn vec_max(xs: &Vec<i64>) -> i64 {
    xs.iter().map(|&x|x).fold(std::i64::MIN, std::cmp::max)
}

#[allow(dead_code)]
fn vec_sum(xs: &Vec<i64>) -> i64 {
    xs.iter().fold(0, |acc, &x| acc+x)
}


Measured memory_bytes: 4352