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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    string s,ans="Yes";
    cin >> s;
    int n = s.size();

    rep(i,(n-1)/4+1)
      if(s[i] != s[(n-3)/2 - i] || s[i+(n+1)/2] != s[n-1-i] || s[i] != s[i+(n+1)/2])
        ans = "No";
    print(ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,e) for(ll i=0;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT32_MAX;

ll i,j,k;



int main(){
   ll N;
   cin>>N;
   vector<string> S(N);
   rep(i,N)cin>>S[i];

   map<string,ll> dic;
   rep(i,N){
      if(dic.count(S[i]))dic[S[i]]++;
      else dic[S[i]]=1;
   }

   ll m=0;
   for(auto itr=dic.begin();itr!=dic.end();itr++)m=max(m,itr->second);

   vector<string> ans;
   for(auto itr=dic.begin();itr!=dic.end();itr++)if(itr->second==m)ans.push_back(itr->first);

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

   rep(i,ans.size())cout<<ans[i]<<endl;
   



}

Measured memory_bytes: 28404
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int X,happiness=0;
    cin>>X;
    while (X>=5)
        if (X-500>=0) {
            happiness = happiness + 1000;
            X = X - 500;
        }
        else if (X-5>=0) {
            happiness = happiness + 5;
            X = X - 5;
        }
        cout<<happiness;
        return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int N = 1e5 + 5;

int stupid(int n, vector<int>& p, vector<int>& q) {
	vector<int> temp;
	for(int i = 1; i <= n; ++i) {
		temp.push_back(i);
	}
	int x = -1, y = -1, cur = 1;
	do {
		if(p == temp) {
			x = cur;
		}
		if(q == temp) {
			y = cur;
		}
		if(x != -1 && y != -1) {
			break;
		}
		cur++;
	} while(next_permutation(temp.begin(), temp.end()));
	return abs(x - y);
}

void getAC() {	
	ios_base :: sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	vector<int> p(n), q(n);
	for(int i = 0; i < n; ++i) cin >> p[i];
	for(int i = 0; i < n; ++i) cin >> q[i];

	cout << stupid(n, p, q) << '\n';
}
 
int main() {	
	getAC();
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<unordered_map>
#include<vector>
#include<string>
#include<unordered_set>
#include<set>
#include<algorithm>
using namespace std;


typedef long long ll;



int main()
{
	int n;
	cin >> n;
	if (n >= 30) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3616
N, K = map(int, input().split())

k = (N-1)*(N-2) // 2
if k < K:
    print(-1)
else:
    d = k - K
    M = N-1 + d
    print(M)

    for i in range(N-1):
        print(i+1, N)

    count = 0

    flag = True
    if d > 0:
        for i in range(N-2):
            for j in range(i+1, N-1):
                print(i+1, j+1)
                count += 1
                if count == d:
                    flag = False
                    break
            if flag:
                continue
            else:
                break


Measured memory_bytes: 3616
#include<stdio.h>
#include<stdlib.h>

#define ABS(a) ((a)>0?(a):-(a))

typedef long long int int64;

typedef struct inode{
  int x,y;
  int index;
} point;

int cmp(const void *a,const void *b){
  point *p=(point *)a;
  point *q=(point *)b;
  int c=p->x+p->y;
  int d=q->x+q->y;
  if(c!=d) return c<d?-1:1;
  return p->x-q->x;
}

int distance(point *a,point *b){
  return ABS(a->x-b->x)+ABS(a->y-b->y);
}

int root(int *u,int x){
  if(u[x]==x) return x;
  return u[x]=root(u,u[x]);
}

void unite(int *u,int x,int y){
  x=root(u,x);
  y=root(u,y);
  if(x==y) return;
  u[x]=y;
}

void calc(point *p,int n,int *u,int d){
  qsort(p,n,sizeof(point),cmp);
  int i,j;
  j=1;
  for(i=0;i<n;i++){
    if(distance(p+i,p+j-1)==d) unite(u,p[i].index,p[j-1].index);
    while(j<n && cmp(p+j,&((point){p[i].x+d,p[i].y,0}))<=0){
      if(distance(p+i,p+j)==d){
	unite(u,p[i].index,p[j].index);
      }
      j++;
    }
  }
}

int64 calc2(point *p,int n,int d){
  qsort(p,n,sizeof(point),cmp);
  int64 res=0;
  int l=0;
  int r=0;
  int i;
  for(i=0;i<n;i++){
    while(l<n && cmp(p+l,&((point){p[i].x,p[i].y+d,0}))<0) l++;
    while(r<n && cmp(p+r,&((point){p[i].x+d,p[i].y,0}))<0) r++;
    res+=r-l;
  }
  return res;
}

void run(void){
  int n,a,b;
  scanf("%d%d%d",&n,&a,&b);
  point *p=(point *)calloc(n,sizeof(point));
  int i;
  for(i=0;i<n;i++){
    int x,y;
    scanf("%d%d",&x,&y);
    p[i]=(point){x,y,i+1};
  }
  int d=distance(p+a-1,p+b-1);
  int *u=(int *)calloc(n+1,sizeof(int));
  for(i=0;i<=n;i++) u[i]=i;
  calc(p,n,u,d);
  for(i=0;i<n;i++) p[i]=(point){-p[i].y,p[i].x,p[i].index};
  calc(p,n,u,d);
  int len=0;
  for(i=0;i<n;i++){
    if(root(u,a)==root(u,p[i].index)){
      p[len++]=p[i];
    }
  }
  int64 ans=0;
  ans+=calc2(p,len,d);
  for(i=0;i<len;i++) p[i]=(point){-p[i].y,p[i].x,p[i].index};
  ans+=calc2(p,len,d);
  printf("%lld\n",ans);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

signed main(void){
    int M1,D1,M2,D2;
    cin >> M1 >> D1 >> M2 >> D2;
    cout << !!(D2==1) << 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 NIL -1


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

    int min_a = NIL, max_a = NIL;

    int tax;
    for(int x = 0;;x++){
        tax = 8 * x / 100; //8%税

        //税がaの間はmaxを更新,初めてaになったときminを更新
        if(tax == a){
            max_a = x;
            if(min_a == NIL){
                min_a = x;
            }
        }
        
        //max_aが更新済みでmax_aとxが一致しなくなったとき(更新されなくなったとき)break
        if(max_a != NIL && x != max_a) break;
    }

    int min_b = NIL, max_b = NIL;
    for(int x = 0;;x++){
        tax = 10 * x / 100; //10%税

        if(tax == b){
            max_b = x;
            if(min_b == NIL){
                min_b = x;
            }
        }
        
        if(max_b != NIL && x != max_b){
            break;
        }
    }

    //存在するかの処理
    if(max_a < min_b || max_b < min_a){
        cout << NIL << endl;
    }else{
        int left = min(min_a, min_b);
        int right = max(max_a, max_b);

        //iが初めて区間に入った時出力してbreak
        for(int i = left; i <= right; i++){
            if(min_a <= i && i <= max_a && min_b <= i && i <= max_b){
                cout << i << endl;
                break;
            }
        }
    }

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
#define all(x) (x).begin(),(x).end()

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);std::cout<<std::fixed<<std::setprecision(10);
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i,N){
        int tmp;
        cin >> tmp;
        A[tmp-1]=i+1;
    }
    REP(i,N)cout <<A[i]<< " ";
    cout << "\n";
}

Measured memory_bytes: 1280
#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cassert>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<limits>
#include<ctime>
#include<stack>
#include<bits/stdc++.h>
#include<string>
#include<stdlib.h>
#include<stdio.h>
typedef long long ll;

using namespace std;

int main(){
	ll n;
	cin>>n;
	ll a[n],b[n];
	for(int i=1;i<=n;i++){
		cin>>a[i];
		b[a[i]]=i;
	}
	for(int i=1;i<=n;i++){
		cout<<b[i]<<' ';
	}
}



Measured memory_bytes: 5088
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	string s;
	cin>>s;
	if(s[0]=='9' || s[1]=='9'){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d",&a);
    scanf("%d",&b);
    if(a==1&&b==2||a==2&&b==1)
    {
        c=3;
        printf("%d\n",c);
    }
    else if(a==2&&b==3||a==3&&b==2)
    {
        c=1;
        printf("%d\n",c);
    }
    else if(a==3&&b==1||a==1&&b==3)
    {
        c=2;
        printf("%d\n",c);
    }
    return 0;
}


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

long long cache[100005];

long long jump(int *a, int n, int i) {
    if (i >= n) {
        return 2e9;
    }

    if (i == n-1) {
        return 0;
    }

    if (cache[i] != -1) {
        return cache[i];
    }

    long long cost1 = jump(a, n, i+1);
    long long abs1 = abs(a[i] - a[i+1]);

    long long cost2 = jump(a, n, i+2);
    long long abs2 = abs(a[i] - a[i+2]);

    long long minCost = min(cost1 + abs1, cost2 + abs2);
    cache[i] = minCost;
    return minCost;
}

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

    for (int i = 0; i <= n; i++) cache[i] = -1;
    cout<<jump(a, n, 0)<<endl;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  long long N, M;
  long long A[100100];
  cin >> N >> M;
  REP(i, N) cin >> A[i];

  long long s[N + 1];
  REP(i, N+1) s[i] = 0;
  REP(i, N) s[i+1] = s[i] + A[i];
  REP(i, N+1) s[i] %= M;
  // REP(i, N+1) cout << s[i] << ' ';
  // cout << endl;

  long long ans = 0;

  map<long long, long long> dct;
  REP(i, N+1) dct[s[i]]++;
  for(auto itr = dct.begin(); itr != dct.end(); itr++) {
    ans += (itr->second - 1) * itr->second / 2;
  }
  cout << ans << endl;

  return 0;
}

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

typedef long long ll;
const int N = 200001;
int n;
int a[N];
ll dp[N];
ll S[N / 2 + 1];

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

    cin >> n;
    ll sum = 0;
    for (int i = 0, j = 0; i < n; ++i) {
        cin >> a[i];
        if (i % 2 == 0) {
            sum += a[i];
            S[j++] = sum;
        }
    }

    dp[0] = 0;
    for (int i = 1; i < n; ++i) {
        // select half of i + 1
        if ((i + 1) % 2) {
            // 2 of 5
            dp[i] = max(dp[i - 1], dp[i - 2] + a[i]);
        } else {
            // 2 of 4
            dp[i] = max(dp[i - 2] + a[i], S[i / 2]);
        }
    }
    cout << dp[n - 1] << endl;

    return 0;
}



Measured memory_bytes: 6776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

int main() {
	ll n,k;
	cin>>n>>k;
	ll now=n%k;
	cout << min(k-now,now);
	return 0;
}

Measured memory_bytes: 3624
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) &= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double PI = (double)acos(-1);
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

signed main() {
  int ai, ao, at, aj, al, as, az;
  cin >> ai >> ao >> at >> aj >> al >> as >> az;

  if (ai * aj * al == 0) {
    cout << ao + ai + aj + al - ai % 2 - aj % 2 - al % 2 << endl;
  } else {
    int a, b;
    a = ao + ai + aj + al - ai % 2 - aj % 2 - al % 2;
    ai--, al--, aj--;
    b = ao + ai + aj + al - ai % 2 - aj % 2 - al % 2 + 3;
    cout << max(a, b) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c[4];
  for (int i = 0; i < 4; i++ ){
    cin >> c[i] ;
  }
  if (c[0] == c[1]){
    if (c[2] == c[3] && c[0] != c[2]) printf("Yes\n");
    else printf("No\n");
  }
  else if (c[0] == c[2]){
    if (c[1] == c[3] && c[0] != c[1]) printf("Yes\n");
    else printf("No\n");
  }
  else if (c[0] == c[3]){
    if (c[1] == c[2] && c[0] != c[2]) printf("Yes\n");
    else printf("No\n");
  }
  else printf("No\n");
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;

int d[1010][1010];
bool done[1010][1010];

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h,w;
    cin>>h>>w;
    string s[1010];
    for(int i=0;i<h;i++)cin>>s[i];    
    queue<pair<int,int>> Q;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(s[i][j]=='#'){
                Q.push(make_pair(i,j));
                d[i][j]=0;
                done[i][j]=true;
            }
        }
    }
    while(!Q.empty()){
        auto now=Q.front();
        Q.pop();
        int y=now.first;
        int x=now.second;
        for(int i=0;i<4;i++){
            int ny=y+dy[i];
            int nx=x+dx[i];
            if(ny<0||nx<0||ny>=h||nx>=w)continue;
            if(done[ny][nx])continue;
            done[ny][nx]=true;
            d[ny][nx]=d[y][x]+1;
            Q.push(make_pair(ny,nx));
        }
    }
    int res=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            res=max(res,d[i][j]);
        }
    }  
    cout<<res<<endl;
}

Measured memory_bytes: 26548
#include<stdio.h>
int main(){
  int i,n;
  scanf("%d",&n);
  int f[44];
  f[0]=1;
  f[1]=1;
  for(i=2;i<=n;i++)f[i]=f[i-1]+f[i-2];
  printf("%d\n",f[n]);
  return 0;
}



Measured memory_bytes: 2052
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

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

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  ll n;cin>>n;
  cout<<(n+1)*n/2 - n<<endl;

 

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>

using namespace std;
using int64 = long long;
using P = pair<int,int>;

int main () {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i=0; i<n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    a.erase(unique(a.begin(), a.end()), a.end());

    int ans = a.size();
    if (ans%2 == 0) ans--;
    cout << ans << endl;
}


Measured memory_bytes: 888
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
s += sum(b)
for i in range(n-1):
    if a[i]+1==a[i+1]:
        s += c[a[i]-1]
print(s)

Measured memory_bytes: 9092
n=str(input())
n=n[-1]
if n=="2" or n=="4" or n=="5" or n=="7" or n=="9":
    print("hon")
    exit()
if n=="0" or n=="1" or n=="6" or n=="8":
    print("pon")
    exit()
if n=="3":
    print("bon")
    exit()


Measured memory_bytes: 9108
#include<stdio.h>

#define N 100000
int linearSearch(int *, int,int);

int main(){
  int i,j,a,b,n=0,m;
  int S[N],T[N];

  scanf("%d",&i);

  for(a=0;a<i;a++){
    scanf("%d",&S[a]);
  }

  scanf("%d",&j);

  for(b=0;b<j;b++){
    scanf("%d",&T[b]);
  }

  for(a=0;a<j;a++){
    m=linearSearch(S,T[a],i);
    if(m==-1) continue;
    else n++;
  }

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

int linearSearch(int *A,int key,int n){
  int i;
  
  for(i=0;i<n;i++){
    if(A[i]==key) return i;
  }

  return -1;
}



Measured memory_bytes: 2104
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    S = input()
    N = len(S)
    if S[0] == '0' or S[-1] == '1':
        print(-1)
        return
    cnt = 0
    flag = True
    for i in range(N - 1):
        if S[i] != S[N - i - 2]:
            flag = False
            break
        if S[i] == '1':
            cnt += 1
    if not flag:
        print(-1)
        return
    
    edge = []
    for i in range(cnt):
        edge.append((i + 1,i + 2))
    
    extend = 0
    now = cnt + 2
    vertex = 2
    for i in range(1,N - 1):
        if S[i] == '0':
            extend += 1
        else:
            for _ in range(extend):
                edge.append((vertex,now))
                now += 1
            extend = 0
            vertex += 1

    if now == N + 1:
        print('\n'.join(' '.join(map(str,a)) for a in edge))
    else:
        print(-1)
if __name__ == '__main__':
    main()

Measured memory_bytes: 30516
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define fi first
#define se second
#define pi pair<int, int>
#define rep(i, a, n) for(int i = a; i <= n; i++)
#define per(i, a, n) for(int i = a; i >= n; i--)
#define REP(i, a, n) for(int i = a; i < n; i++)
#define Y "YES"
#define N "NO"
using namespace std;

ll a, b, c, d;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	//freopen("in.txt", "r", stdin);

	cin >> a >> b >> c >> d;
	ll ans = max(a * c, b * d);
	ans = max(ans, a * d);
	cout << max(ans, b * c);
}

Measured memory_bytes: 3604
#include<stdio.h>
int main(void){

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

if( y < x ){
n = x;
x = y;
y = n;
}

if( z < y ){
n = y;
y = z;
z = n;
}
	
	if( y < x ){
		n = x;
		x = y;
		y = n;
	}

printf("%d %d %d\n" , x,y,z);

return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <algorithm>
using namespace std;
 
using ll = long long;
 
int main() {
  ll a, b, c;
  cin >> a >> b >> c;

  if (a & 1 && b & 1 && c & 1) {
    cout << min(a * b, min(b * c, c * a)) << endl;
    return 0;
  }
  cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_
void debug_out() {cerr << endl;}
template<typename Head,typename... Tail> void debug_out(Head H,Tail... T){cerr << ' ' << H; debug_out(T...);}
#define debug(...) cerr << 'L' << __LINE__ << " [" << #__VA_ARGS__ << "]:",debug_out(__VA_ARGS__)
#define dump(x) cerr << 'L' << __LINE__ << " " << #x << " = " << (x) << endl;
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

template<class Monoid> struct SegmentTree{
    int N;
    vector<Monoid> tree;

    //depending on the problem
    Monoid unit;
    using FX = function<Monoid(Monoid,Monoid)>; FX func;
    //

    SegmentTree(int _N,Monoid _unit,FX _func) :N(_N),unit(_unit),func(_func) {
        tree.assign(2*N,unit);
    }

    void build(vector<Monoid> &array){
        for (int i = N; i < 2*N; i++) tree[i] = array[i - N];
        for (int i = N - 1;i > 0; i--) tree[i] = func(tree[i << 1],tree[i << 1|1]);
    }

    void update(int k,Monoid x){
        k += N;
        tree[k] = func(tree[k],x);
        while (k > 1){
            k >>= 1;
            tree[k] = func(tree[k << 1],tree[k << 1|1]);
        }
    }

    Monoid query(int L,int R){
        L += N; R += N;
        Monoid vL = unit,vR = unit;
        while (L < R){
            if (L&1){ vL = func(vL,tree[L]); L ++; }
            if (R&1){ R --; vR = func(tree[R],vR); }
            L >>= 1; R >>= 1;
        }
        return func(vL,vR);
    }
};

const int MAX = 300010;

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

    int N,K; cin >> N >> K;
    vector<int> A(N);
    rep(i,N) cin >> A[i];

    SegmentTree<int> dp(MAX,0,[](int a,int b){return max(a,b);});

    rep(i,N) {
        int l = max(0,A[i] - K);
        int r = min(MAX,A[i] + K + 1);
        int a = dp.query(l,r);
        dp.update(A[i],a + 1);
    }
    int ans = dp.query(0,MAX);
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 6632
#include <stdio.h>
#include <stdlib.h>

int main() {
  int a = 0;
  int b;
  char buf[10];

  scanf("%s", buf);

  for(int i = 0; buf[i] != '\0'; i++) {
    a = a + (buf[i] - '0');
  }
  b = atoi(buf);

  if(b % a == 0) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
}


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

int main()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int *a = new int[n];
	int tmp = 0;
	deque<int> dq;
	while (n--)
		cin >> a[tmp++];
	for (int i = 0; i < tmp; i++)
	{
		if ((i + 1) % 2 == 1)
			dq.push_front(a[i]);
		if ((i + 1) % 2 == 0)
			dq.push_back(a[i]);
	}
	if (tmp % 2 != 0)
	{
		for (int i = 0; i < dq.size(); i++)
		{
			cout << dq[i] << " ";
		}
	}
	else
	{
		for (int i = dq.size()-1; i >=0; i--)
		{
			cout << dq[i] << " ";
		}
	}
	return 0;
}

Measured memory_bytes: 3840
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

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

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

  int ans = 1000000000;

  for (int i = 0; i < n; i++) {
    int next = (i + 1) % n;
    int prev = (i - 1 + n) % n;

    int nv = (a[next] - a[i] + k) % k;
    int pv = (a[prev] - a[i] + k) % k;
    ans = min(ans, k - nv);
    ans = min(ans, pv);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
# -*- coding: utf-8 -*-
n,l = map(int, input().split())

s = 0
for i in range(1,n+1):
    s += l+i-1

ans = 10**6
idx = -1
for i in range(1,n+1):
    s2 = s - (l+i-1)
    if abs(s-s2)<ans:
        ans = abs(s-s2)
        idx = i

print(s-(l+idx-1))


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

#define INF INT_MAX

using namespace std;

int alpha[26];

int main(void){
	string s;
	cin >> s;
	bool flag = true;
	for(int i = 0;i < s.length();i++){
		if(alpha[s[i]-'a']>0){
			flag = false;
			break;
		}
		alpha[s[i]-'a']++;
	}
	if(flag){
		cout << "yes" << endl;
	}else{
		cout << "no" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <tuple>
#include <numeric>
#include <cstdio>
#include <cmath>
using namespace std;
using ll = long long;
const int INF = 1e9;

int main() {
    int n, h; cin >> n >> h;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    sort(b.begin(), b.end());
    reverse(b.begin(), b.end());

    int rtn = 0;
    int a_max = a[0];
    for (int bi : b) {
        if (bi > a_max) {
            h -= bi;
            rtn++;
            if (h <= 0) {
                cout << rtn << endl;
                return 0;
            }
        } else {
            int remain = (h + (a_max - 1)) / a_max;
            cout << rtn + remain << endl;
            return 0;
        }
    }
    int remain = (h + (a_max - 1)) / a_max;
    cout << rtn + remain << endl;
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int aCount = 0;
		int zCount = 0;
		int answer = 0;
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		String[] splitStr = str.split("",0);
		
		for(int i = 0; i < splitStr.length; i++){
			if(splitStr[i].equals("A")){
					aCount = i;
					break;
			}
		}
		for(int i = 0; i < splitStr.length; i++){
			if(splitStr[i].equals("Z") && i > aCount){
				zCount = i;
			}
			
				answer = zCount - aCount + 1;
		}
		System.out.println(answer);
	}

}

Measured memory_bytes: 53300
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
    int N;
    cin >> N;
    vector <string> S(N);
    map <char, int> name;

    for (int i = 0; i < N; i++){
        cin >> S[i];
        name[S[i][0]] ++;
    }
    
    vector<long long> march(5);
    march[0] = name['M'];
    march[1] = name['A'];
    march[2] = name['R'];
    march[3] = name['C'];
    march[4] = name['H'];

    long long ans = 0;
    for (int i = 0; i < 3; i++){
        for (int j = i + 1; j < 4; j++){
            for (int k = j + 1; k < 5; k++){
                ans += march[i] * march[j] * march[k];
            }
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6144
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  string s;
  ll K;

  cin >> s;
  cin >> K;

  ll i = 0;
  ll k;
  while(i <= s.size()){
    if (s[i] != '1'){
      break;
    }
    i++;
  }
//  cout << i << endl;

  if (i >= K){
    cout << 1 << endl;
  }else{
    cout << s[i] << endl;
  }



  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader();    
        int n = r.i();
        int[] a = r.ii();
        int[] b = new int[n];
        int i = 0;
        int j;
        while((j = n-1-2*i) >= 0){
            b[i] = a[j];
            i++;
        }
        j = 2*i-n;
        while(i < n){
            b[i] = a[j];
            i++;
            j+=2;
        }           
        StringBuffer sb = new StringBuffer();
        for(int x : b)
            sb.append(String.format("%d ", x));
        println(String.valueOf(sb));
    }

    static void print(Object o){
        System.out.print(o.toString());
    }

    static void println(Object o){
        System.out.println(o.toString());
    }

    static int Int(String s){
        return Integer.parseInt(s);
    }

    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s() throws IOException{
            return readLine();
        }

        String[] ss() throws IOException{
            return s().split(" ");
        }

        int i() throws IOException{
            return Int(s());
        }

        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }

        long l() throws IOException{
            return Long(s());
        }

        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 130180
#include <stdio.h>
 
int main() {
  int a,b;
  
  scanf("%d %d", &a, &b);
  
  // 計算結果が 1 の場合 Even
  // 計算結果が 0 の場合 Odd
  printf("%s\n", (a * b) % 2? "Odd" : "Even");
  
 
  return 0;
}

Measured memory_bytes: 1612
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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 (a > b) {
    a = b;
    return true;
  }
  return false;
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int a,b; cin >> a >> b;
  if(a>b) rep(i, a) cout << b;
  else rep(i,b) cout << a;
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#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(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;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())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));


int main(){	
	double L;
	cin >> L;
	printf("%.16f\n", L/3*L/3*L/3);
	return 0;
}



Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N, M, K = map(int, input().split())
friend = [[] for _ in range(N)]
block = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    friend[a - 1].append(b - 1)
    friend[b - 1].append(a - 1)

for _ in range(K):
    a, b = map(int, input().split())
    block[a - 1].append(b - 1)
    block[b - 1].append(a - 1)

vst = [0] * N
SIZE = []
C = 0
for i in range(N):
    if not vst[i]:
        C += 1
        vst[i] = C
        q = [i]
        cnt = 0
        for u in q:
            cnt += 1
            for v in friend[u]:
                if not vst[v]:
                    vst[v] = C
                    q.append(v)
        SIZE.append(cnt)

for i in range(N):
    ret = SIZE[vst[i] - 1] - 1
    ret -= len(friend[i])
    for b in block[i]:
        if vst[i] == vst[b]:
            ret -= 1
    print(ret, end=' ')
print()


Measured memory_bytes: 83784
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define db double
#define ld long double
#define rep(i,n) for(ll i=0;i<n;i++)
#define rev(i,n) for(ll i=n;i>=0;i--)
#define rep_a(i,a,n) for(ll i=a;i<n;i++)
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define debug(x) do { std::cerr << #x << ": " << x << std::endl; } while (0);
#define debugg(x,y) do { std::cerr << #x << ": " << x << "  "<< #y << ": " << y << std::endl; } while (0);
#define debugggg(i,j,k,ans) std::cerr << #i << ": " << i << "  "<< #j << ": " << j <<#k << ": " << k <<#ans << ": " << ans << std::endl;
const long long mod = 998244353;
const long long MOD = 1000000007;
typedef vector<ll>              vll;
typedef vector<string>          vstr;
typedef vector<char>            vchar;
typedef vector<pair<ll,ll> >    vpll;
typedef set<ll>                 sll;
typedef set<string>             sstr;
typedef set<pair<ll,ll> >       spll;
typedef map<ll,ll>              mllll;
typedef map<string,ll>          mstrll;
typedef queue<ll>               qll;
map<ll,ll>mp; 
int solve()
{
  int n,k;cin>>n;cin>>k;vll h(n);
  rep(i,n)cin>>h[i];
  vll dp(n+1,INT_MAX);
  dp[0] = 0;
  dp[1] = 0;
  dp[2] = abs(h[0] - h[1]);
  rep_a(i,3,n+1)
  {
    int m = min(i,k+1LL);
    rep_a(j,1,m)
    dp[i] = min(dp[i-j] + abs(h[i-1-j] - h[i - 1]) , dp[i]);
  }
  cout<<dp[n]<<endl;
  return 0;
}
 
int main()
{
  fast;
	/* #ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#else
	#endif */
	solve();
	/* #ifndef ONLINE_JUDGE
	cout<<"\nTime Elapsed: "<<1.0*clock()/ CLOCKS_PER_SEC <<" Sec\n";
	#endif */
	return 0;
}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
int tenpow(int a){
    int ta = 1;
    for(int ti = a;ti > 0;ti--){
        ta = ta*10;
    }
    return ta;
}
long long tenpowll(int a){
    long long ta = 1;
    for(int ti = a;ti > 0;ti--){
        ta = ta*10;
    }
    return ta;
}
int main(){
    int n;
    long long ans = 0;
    long long conbi[9][9];
    for(int i = 1;i <= 9;i++){
        for(int j = 1;j <= 9;j++){
            if(i == j){
                conbi[i-1][j-1] = 1;
            }else{
                conbi[i-1][j-1] = 0;
            }
        }
    }
    cin >> n;
    if(n <= 9){
        cout << n << endl;
        return 0;
    }
    for(int i = 1;i <= 9;i++){
        for(int j = 1;j <= 9;j++){
            for(int k = 4;k >= 0;k--){

                if((tenpow(k+1)*(i+1)+j-10) <= n){
                    conbi[i-1][j-1] = conbi[i-1][j-1] + tenpowll(k);
                }else{
                    if((tenpow(k+1)*i+j) <= n){
                        conbi[i-1][j-1] = conbi[i-1][j-1] + (n - (tenpow(k+1)*i+j) + 10)/10;

                    }

                }
            }
        }
    }
    for(int i = 1;i <= 9;i++){
        for(int j = 1;j <= 9;j++){
            ans = ans + conbi[i-1][j-1]*conbi[j-1][i-1];
            
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <cstring>
#include <iomanip>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
int main() {
    ll n, ans = 0;
    vector<ll> p;

    cin >> n;

    for (int i = 0; i < n; i++) {
        int temp;
        cin >> temp;
        p.push_back (temp);
    }

    ll min = 300000;

    for (int i = 0; i < n; i++) {
        if (p[i] <= min) {
            ans++;
            min = p[i];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+7;
int a[N];
long long sum[N], psum[N];

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

    int n, k;
    cin>>n>>k;

    for (int i=1; i<=n; i++) {
        cin>>a[i];
        sum[i] = sum[i-1] + a[i];
        psum[i] = psum[i-1] + max(a[i], 0);
    }

    long long ans = 0;
    for (int l=1; l+k-1<=n; l++) {
        int r = l+k-1;
        long long cur = max(0LL, sum[r] - sum[l-1]);
        long long left = psum[l-1];
        long long right = psum[n] - psum[r];
//        cout<<l<<" "<<r<<" ----> "<<cur<<" "<<left<<" "<<right<<endl;
        ans = max(ans, cur+left+right);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5596
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    w, a, b = i_map()

    if a + w < b:
        print(b-a-w)
    elif b + w < a:
        print(a-b-w)
    else:
        print(0)

if __name__ == '__main__':
    main()


Measured memory_bytes: 77052
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int read()
{
    char ch='!';int z=1,num=0;
    while(ch!='-'&&(ch<'0'||ch>'9'))ch=getchar();
    if(ch=='-')z=-1,ch=getchar();
    while(ch<='9'&&ch>='0')num=(num<<3)+(num<<1)+ch-'0',ch=getchar();
    return z*num;
}
const int _=105;
int n,x,a[_];
int main()
{
    n=read(),x=read();
    for(int i=1;i<=n;++i)a[i]=read();
    sort(a+1,a+1+n);
    int i=1;
    while(x>=a[i]&&i<=n)x-=a[i++];i--;
    if(x&&i==n&&x!=a[i])i--;
    printf("%d\n",i);
    return 0;
}

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

#define all(a)  (a).begin(),(a).end()

#define mkp make_pair
#define pb push_back

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



int main(){
    bool flag=true;
    ll ans=0,sum=0;
    int n,m;
    cin >>n;
    int a[n];



    //cout <<fixed<<setprecision(16)<< << endl;
    cout << n*n*n << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int a[2000];
    int b[2000];
    int num;
    char op[2000];
    for(int i=0;i<=1999;i++){
        scanf("%d %c %d",&a[i],&op[i],&b[i]);
        num=i;
        if(op[i]=='?'){
            break;
        }
    }
    
    for(int k=0;k<=num-1;k++){
        if(op[k]== '+'){
            printf("%d\n",a[k]+b[k]);
        }
        else if(op[k]== '-'){
            printf("%d\n",a[k]-b[k]);
        }
        else if(op[k]== '*'){
            printf("%d\n",a[k]*b[k]);
        }
        else{
            printf("%d\n",a[k]/b[k]);
        }
        
    }
    return 0;
    
    
}


Measured memory_bytes: 2028
use std::io;

fn main() {
    let s: String = parse_line();
    let c = s.chars().next().unwrap();
    println!("{}", ((c as u8) + 1) as char);

}

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


Measured memory_bytes: 4352
S = list(input())

left = [0]*(len(S)+1)

right = [0]*(len(S)+1)

for i in range(len(S)):
    if S[i] == '<':
        left[i+1] += 1+left[i]

for i in range(len(S)-1,-1,-1):
    if S[i] == '>':
        right[i] = right[i+1]+1

ans = [0]*(len(S)+1)
for i in range(len(S)+1):
    ans[i] = max(left[i],right[i])
print(sum(ans))

Measured memory_bytes: 100808
class SegmentTree():
    """一点加算、区間取得クエリをそれぞれO(logN)で答えるデータ構造を構築する
    add: i番目にvalを加える
    get_sum: 区間[begin, end)の和を求める
    """
    def __init__(self, n):
        self.n = n
        self.size = 1
        while self.size < n:
            self.size *= 2
        self.node = [0] * (2*self.size - 1)

    def add(self, i, val):
        i += (self.size - 1)
        self.node[i] += val
        while i > 0:
            i = (i - 1) // 2
            self.node[i] = self.node[2*i + 1] + self.node[2*i + 2]

    def get_sum(self, begin, end):
        begin += (self.size - 1)
        end += (self.size - 1)
        s = 0
        while begin < end:
            if (end - 1) & 1:
                end -= 1
                s += self.node[end]
            if (begin - 1) & 1:
                s += self.node[begin]
                begin += 1
            begin = (begin - 1) // 2
            end = (end - 1) // 2
        return s

    def debug(self):
        """Segment Tree上の葉の配列を出力する"""
        return(self.node[self.size - 1: self.size - 1 + self.n])


n, q = map(int, input().split())
info = [list(map(int, input().split())) for i in range(q)]
st = SegmentTree(n)
 
for i in range(q):
    com, x, y = info[i]
    if com == 0:
        st.add(x - 1, y)
    else:
        print(st.get_sum(x - 1, y))


Measured memory_bytes: 28892
import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		sc.close();
		int[] yono = new int[n];
		Arrays.fill(yono , 0);
		for(int a = 1 ; a <= Math.sqrt(n) ; a++){
			for(int b = 1 ; b <= Math.sqrt(n) ; b++){
				for(int c = 1 ; c <= Math.sqrt(n) ; c++){
					if(a * a + b * b + c * c + a * b + b * c + c * a <= n){
						yono[a * a + b * b + c * c + a * b + b * c + c * a - 1]++;
					}
				}
			}
		}
		for(int i = 0 ; i < n ; i++) ou.println(yono[i]);
		ou.flush();
	}
}

Measured memory_bytes: 29644
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;

int main(){
  prep();
  string s;
  cin >> s;
  int change = 0;
  for (int i=0; i<s.size()/2; i++){
      char first = s[i];
      char scnd = s[s.size()-1-i];
      if (first != scnd){
          change++;
      }
  }
  cout << change;
  return 0; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int int64_t
#define rep(i, N) for(int i=0; i<N; i++)
#define repr(i, N) for(int i=N-1; i>=0; --i)
using namespace std;
//using pair = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;

//プロトタイプ宣言
//int myfunc(int, vvec);

//グローバル変数
//int N, M;
//vvec data(N, vec(M));

//関数：
int gcd(int mx, int mn) {
	if(mn == 0) return(mx);
	else gcd(mn, mx%mn);
}

bool has_divisor(int n, int i) {
	//base case 1:
	if (i == n) return false;
	//base case 2:
	if (n % i == 0) return true;
	return has_divisor(n, i+1);
}

bool is_prime(int n) {
	if (n == 1) return false;
	else if (n == 2) return true;
	else {
		return !has_divisor(n, 2);
	}
}

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

	int N, M; cin >> N >> M;
  int a = 0;
	int ans = max(N-2*M, a);
	cout << ans << endl;
	return 0;
}
//std::string str;
//str = std::to_string(int i);
//bitset<3> s(N);
//int ans = (char)grid - '0';

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

int main() {
 string S,T;
  cin>>S>>T;
  int sum;
  int n=S.size();
  for(int i=0;i<n;i++){
    if(S.at(i)!=T.at(i)){
      sum++;

    }
  }
  if(sum==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  
}

Measured memory_bytes: 3632