akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

int main()
{
    int a, b;
    cin >> a >> b;
    if(a+b == 15) cout << "+" << endl;
    else if(a*b == 15) cout << "*" << endl;
    else cout << "x" << endl;
    return 0;
}

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

struct Node { int p, left, right; };
Node T[25];

void search_l(int search) {
	cout << " " << search;
	if (T[search].left != -1) {
		search_l(T[search].left);
	}
	if (T[search].right != -1) {
		search_l(T[search].right);
	}
}

void search_i(int search) {
	if (T[search].left != -1) {
		search_i(T[search].left);
	}
	cout << " " << search;
	if (T[search].right != -1) {
		search_i(T[search].right);
	}
}

void search_r(int search) {
	if (T[search].left != -1) {
		search_r(T[search].left);
	}
	if (T[search].right != -1) {
		search_r(T[search].right);
	}
	cout << " " << search;
}

int main() {
	int n, num, f_num = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		T[i].p = -1;
	}
	cin >> num;
	f_num = num;
	cin >> T[num].left >> T[num].right;
	T[T[num].left].p = num;
	T[T[num].right].p = num;
	for (int i = 0; i < n-1; i++) {
		cin >> num;
		cin >> T[num].left >> T[num].right;
		T[T[num].left].p = num;
		T[T[num].right].p = num;
	}
	for (int i = 0; i < n; i++) {
		if (T[i].p == -1) {
			f_num = i;
		}
	}
	cout << "Preorder" << endl;
	search_l(f_num);
	cout << endl;
	cout << "Inorder" << endl;
	search_i(f_num);
	cout << endl;
	cout << "Postorder" << endl;
	search_r(f_num);
	cout << endl;
}


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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	int n, m;
	vector<int> t;

	cin >> n;
	for(int i=0; i<n; i++){
		int tmp;
		cin >> tmp;
		t.pb(tmp);
	}

	cin >> m;
	vector< pair<int, int> > p;
	for(int i=0; i<m; i++){
		int p, x;
		cin >> p >> x;
		ll sum = 0;
		for(int j=0; j<n; j++){
			if(j == p-1){
				sum += x;
			}else{
				sum += t[j];
			}
		}
		cout << sum << endl;
	}

	
	return 0;
}


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

using namespace std;

int dp[2019], ans;

int main() {
	string s;
	cin >> s;
	dp[0]++;
	for (int i = s.size() - 1, q = 1, p = 0; ~i; i--) {
		ans += dp[(p += (s[i] - '0') * q) %= 2019]++;
		(q *= 10) %= 2019;
	}
	cout << ans;
}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    cin >>N;
    vector<ll>A(N);
    ll ans = 0;
    rep(i,N){
        ll a;
        cin>>a;
        while(1){
            if(a%2==1) break;
            ans++;
            a/=2;
        }
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 3716
#include <iostream>
#include <cassert>

enum class status_t
{
    neutral,
    increase,
    decrease,
};

enum class next_pos_state_t
{
    second,
    other,
};

int main(int argc, char const* argv[])
{
    uint64_t n;
    std::cin >> n;

    uint64_t prev, currnt;
    std::cin >> prev;

    status_t status = status_t::neutral;

    uint64_t result = 1;
    for(int i=1; i<n;++i)
    {
        std::cin >> currnt;

        switch(status)
        {
            case status_t::neutral:
            {
                if(prev == currnt)
                {
                    continue;
                }
                if(prev < currnt)
                {
                    status = status_t::increase;
                }
                if(prev > currnt)
                {
                    status = status_t::decrease;
                }
                break;
            }
            case status_t::increase:
            {
                if(prev > currnt)
                {
                    status = status_t::neutral;
                    result++;
                }
                break;
            }
            case status_t::decrease:
            {
                if(prev < currnt)
                {
                    status = status_t::neutral;
                    result++;
                }
                break;
            }
            default:
            {
                assert("wtf");
            }
        }

        prev = currnt;
    }

    std::cout << result << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;


signed main(){
	string s;cin>>s;
	rep(i,len(s))cout<<"x";
	cout<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cassert>
using namespace std;

typedef pair<int, char> PIC;
typedef pair<int, int> PII;

int main(void) {
  int N;
  while (cin >> N, N) {
    vector<PIC> lines(N);

    for (int i = 0; i < N; i++) {
      string line;
      cin >> line;

      lines[i].first = line.size() - 1;
      lines[i].second = line.back();
    }

    if (lines[0].second == '+') {
      lines.push_back(PIC(1, '0'));
    }
    
    if (lines[0].second == '*') {
      lines.push_back(PIC(1, '1'));
    }

    
    vector<char> operators;
    vector<PII> operands;
    
    int now_dep = 0;
    for (auto line : lines) {
      int dep = line.first;
      char sym = line.second;
    
      while (dep < now_dep) {
        char op = operators.back();
        operators.pop_back();
        int res = ((op == '+') ? 0 : 1);
     
        while (operands.back().first == now_dep) {
          int operand = operands.back().second;
          operands.pop_back();
          if (op == '+') res += operand;
          else res *= operand;
        }
       
        now_dep--;
        operands.push_back(PII(now_dep, res));
      }
    
      now_dep = dep;
     
      if (sym == '+' || sym == '*') operators.push_back(sym);
      else operands.push_back(PII(now_dep, sym - '0'));
    }

    if (operators.size() != 0) {
        char op = operators.back();
        operators.pop_back();
        int res = ((op == '+') ? 0 : 1);
    
        while (!operands.empty()) {
          int operand = operands.back().second;
          operands.pop_back();
          if (op == '+') res += operand;
          else res *= operand;
        }
    
        now_dep--;
        operands.push_back(PII(now_dep, res));
    }

    cout << operands[0].second << endl;
  }
  return 0;
}

Measured memory_bytes: 3164
N = int(input())
*H, = map(int, input().split())

max = 0
count = 0
for i in range(N-1):
    if H[i]>=H[i+1]:
        count+=1
        continue
    if count>max:
        max = count
    count = 0
if count>max:
    max = count

print(max)

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

#define ll long long 
 
using namespace std ;
 
int z , o , ans ;

string s ;

int main(){

	int a , b , c , d ;

	cin >> a >> b >> c >> d ;

	int k = c / b ;

	if( c % b != 0 ){

		k ++ ;

	}

	int u = a / d ;

	if( a % d != 0 ){

		u ++ ;

	}

	if( k <= u ){

		cout << "Yes" << endl ;

	}

	else{

		cout << "No" << endl ;

	}

}

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

int main(){
  int N;
  cin >> N;
  uint64_t a = 0,b = 0;
  for(int i = 0;i < N;i++){
    int d;
    cin >> d;
    a += d;
    b += d*d;
  }

  std::cout << ((a*a - b)/2) << std::endl;
}


Measured memory_bytes: 256
S = input()
N = len(S)
Sw = '01' * (N // 2)
if (N % 2):
  Sw += '0'
Sb = '10' * (N // 2)
if (N % 2):
  Sb += '1'
diffw = 0
for i in range(N):
  if (S[i] != Sw[i]):
    diffw += 1
diffb = 0
for i in range(N):
  if (S[i] != Sb[i]):
    diffb += 1
print(min(diffw, diffb))

Measured memory_bytes: 3316
#include <stdio.h>
int main(void){
    int  n, f[100][10], p[100][11], i, j, b, max, s, t, c, o[10]={0};
    
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        for(j = 0; j < 10; j++){
            scanf("%d", &f[i][j]);
        }
    }
    for(i = 0; i < n; i++){
        for(j = 0; j <= 10; j++){
            scanf("%d", &p[i][j]);
        }
    }
    
    max = -1000000000;
    for(t = 1; t < 1024; t++){
        b = t; i = 0;
        while(b > 0){
            o[i] = b % 2;
            b /= 2;
            i++;
        }
        s = 0;
        for(i = 0; i < n; i++){
            c = 0;
            for(j = 0; j < 10; j++){
                if(f[i][j] == 1 && o[j] == 1){
                    c++;
                }
            }
            s += p[i][c];
        }
        if(max < s){
            max = s;
        }
    }
    printf("%d\n", max);
    
    return 0;
}


Measured memory_bytes: 128
# https://atcoder.jp/contests/agc003/tasks/agc003_a

s = input()
d = dict(N=0, W=0, S=0, E=0)

for i in range(len(s)):
    d[s[i]] += 1

if (d['N'] == 0 and d['S'] != 0) or (d['N'] != 0 and d['S'] == 0) or (d['W'] == 0 and d['E'] != 0) or (d['E'] == 0 and d['W'] != 0):
    print('No')
else:
    print('Yes')

Measured memory_bytes: 38256
import bisect
s = int(input())

a = [s]
b = [s]
def f(n):
    if(n % 2 == 0):
        return n/2
    else:
        return 3 * n + 1
n = 1
while(True):
    tmp = f(a[n-1])
    insert_index = bisect.bisect_left(b, tmp)
    if len(b) > insert_index and b[insert_index] == tmp:
        ans = n + 1
        break
    else:
        if len(b) == insert_index:
            b.append(tmp)
        else:
            b.insert(insert_index, tmp)
        a.append(tmp)
    n += 1

print(ans)


Measured memory_bytes: 3064
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

#define ROOP(i,n) for(i=0;i<n;i++)

//prototype declaration
int getint();
long long getllint();
double getdint();
char getch();
void setstring(char *s);
void showint(int i);
void showllint(long long i);
void showdouble(double i);
void showchar(char c);
void showstring(char *s);

int myPower(int a, int n) { // aのn乗の計算
	int x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

int min(int a, int b) {
	return a < b ? a : b;
}

#define mod 1000000007
static int kaidan[100002];
static int64_t dp[100002];

int main(void) {
	int n, m, i;
	n = getint();
	m = getint();
	ROOP(i, m) {
		int a;
		a = getint();
		kaidan[a] = 1;
	}
	dp[0] = 1;
	if (kaidan[1] == 0) {
		dp[1] = 1;
	}
	for(i = 2;i <= n; i++) {
		if (kaidan[i] != 0) {
			dp[i] = 0;
			continue;
		}
		dp[i] = (dp[i - 1] + dp[i - 2]) % mod;
	}
	printf("%lld\n", dp[n]);
	return 0;
}

int getint() {
	int i;
	scanf("%d", &i);
	return i;
}

long long getllint() {
	long long i;
	scanf("%lld", &i);
	return i;
}

double getdint() {
	double i;
	scanf("%lf", &i);
	return i;
}

char getch() {
	char c;
	scanf("%c", &c);
	return c;
}

void setstring(char *s) {
	scanf("%s", s);
}

void showint(int i) {
	printf("%d\n", i);
}

void showllint(long long i) {
	printf("%lld\n", i);
}

void showdouble(double i) {
	printf("%lf\n", i);
}

void showchar(char c) {
	printf("%c\n", c);
}

void showstring(char *s) {
	printf("%s\n", s);
}


Measured memory_bytes: 1280
using System;

class Program
{
    static void Main()
    {
            int i = 0,j;
            int[] m = new int[256];
            int[] f = new int[256];
            int[] r = new int[256];
            while (true)
            {
                string inp = Console.ReadLine();
                string[] data = inp.Split(' ');
                m[i] = int.Parse(data[0]); 
                f[i] = int.Parse(data[1]);
                r[i] = int.Parse(data[2]);
                if (m[i] == -1 && f[i] == -1 && r[i] == -1)
                {
                    break;
                }
                i++;

            }
            for (j = 0; j < i; j++)
            {
                if (m[j] == -1 || f[j] == -1)
                {
                    Console.WriteLine("F");
                }
                else if (m[j] + f[j] >= 80)
                {
                    Console.WriteLine("A");
                }
                else if (m[j] + f[j] >= 65)
                {
                    Console.WriteLine("B");
                }
                else if (m[j] + f[j] >= 50)
                {
                    Console.WriteLine("C");
                }
                else if (r[j]>=50)
                {
                    Console.WriteLine("C");
                }
                else if (m[j] + f[j] >= 30)
                {
                    Console.WriteLine("D");
                }else
                {
                    Console.WriteLine("F");
                }
            }
    }
}


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

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

int main() {
    double n;
    cin >> n;
    double oddCnt = 0;
    for (int i = 1; i <= n; i++) {
        if (i & 1) oddCnt++;
    }
    // cout << oddCnt / n << endl;
    printf("%f\n", oddCnt / n);

    return 0;
}

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

const int N = 2e5;

vector<int> G[N + 1];
bool used[N + 1];

bool ans = false;
int n, m;

void dfs(int u, int d) {
  if (d == 3 || ans) return;
  if (d == 2 && u == n) {
    ans = true;
    return;
  }
  used[u] = 1;
  for (int i = 0; i < G[u].size() && !ans; i++) {
    if (!used[G[u][i]])
      dfs(G[u][i], d + 1);
  }
}

int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfs(1, 0);
  if (ans) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}


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

#define VARNAME(x) #x
#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = (ll)1e9 + 7LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    map<int, int> mp;
    for (int i = 0; i < N; i++) {
        int A;
        cin >> A;
        mp[A]++;
    }
    vector<int> num;
    for (const auto& e : mp) {
        num.push_back(e.second);
    }
    sort(num.begin(), num.end());
    ll sum = 0;
    for (int i = 0; i < (int)num.size() - K; i++) {
        sum += num[i];
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 10744
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<bitset>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();++itr)
#define pb push_back
#define mk make_pair
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
#define spln(i,n) (i==n?'\n':' ')
#define fac_init(n){fac[0]=fac[1]=inv[1]=fi[0]=fi[1]=1;fz(i,2,n){fac[i]=1ll*fac[i-1]*i%mod;inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;fi[i]=1ll*fi[i-1]*inv[i]%mod;}}
using namespace std;
inline void read(int &x)
{
	char c;int f=1;
	while(!isdigit(c=getchar()))if(c=='-')f=-1;
	x=(c&15);while(isdigit(c=getchar()))x=(x<<1)+(x<<3)+(c&15);
	x*=f;
}
const int mod=998244353;
int n,m,i,j,a[200005],s[200005],s2[200005],ans;
int fac[200005],inv[200005],fi[200005],pw[200005],ipw[200005];
vector<int> v[200005];
void add(int x,int y)
{
	while(x){
		inc(s[x],y)
		s2[x]++;
		x-=(x&-x);
	}
}
int query(int x)
{
	int ss=0;
	while(x<=n){
		inc(ss,s[x])
		x+=(x&-x);
	}
	return ss;
}
int query2(int x)
{
	int ss=0;
	while(x<=n){
		ss+=s2[x];
		x+=(x&-x);
	}
	return ss;
}
int main()
{
	fac_init(200002)
	read(n);read(m);
	pw[0]=ipw[0]=1;
	pw[1]=1ll*(m-1)*inv[m]%mod;
	ipw[1]=1ll*m*inv[m-1]%mod;
	fz(i,2,n){
		pw[i]=1ll*pw[i-1]*pw[1]%mod;
		ipw[i]=1ll*ipw[i-1]*ipw[1]%mod;
	}
	fz1(i,n){
		read(a[i]); 
		v[max(1,i-m+1)].push_back(a[i]);
	}
	int s=0,c=0;
	ans=1ll*n*(n-1)/2%mod;
	fz1(i,n-m+1){
		ff(v[i],it){
			ans=(ans+(mod-i+1))%mod;
			ans=(ans+2ll*query2(*it))%mod;
			ans=(ans+2ll*(mod-pw[i])*query(*it))%mod;
		}
		ff(v[i],it){
			c++;
			inc(s,ipw[i])
			add(*it,ipw[i]);
		}
	}
	cout<<1ll*ans*inv[2]%mod<<endl;
	return 0;
}

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

#define int long long
#define uint unsigned int
#define pii pair<int, int>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,n,0)
#define ALL(c) ((c).begin()), ((c).end())

#define PB(a) push_back(a)
#define EMPB(...) emplace_back(__VA_ARGS__)
#define EMP(...) emplace(__VA_ARGS__)
#define MP(a,b) make_pair(a,b)
#define MT(...) make_tuple(__VA_ARGS__)

#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))

#define PW(n) (1LL << (n))

using namespace std;

template <class T> inline bool CHMIN(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool CHMAX(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline void SORT(T &a) { sort(a.begin(), a.end()); }
template <class T> inline void REV(T &a) { reverse(a.begin(), a.end()); }
template <class T> inline void UNI(T &a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }

template <class S, class T> ostream& operator << (ostream& os, const pair<S, T> v) {
  os << "(" << v.first << ", " << v.second << ")"; return os;
}

const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

/* ---------------------------------------------------------------------------------------------------- */

int N;
int a[100010];

void NO() {
  cout << "NO" << endl;
  exit(0);
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  int sum = 0;
  REP(i, N) {
    cin >> a[i];
    sum += a[i];
  }
  int M = N*(N+1)/2;
  if (sum % M != 0) NO();
  int cnt = sum/M;
  int sum2 = 0;
  REP(i, N) {
    int pre = (i-1+N)%N;
    int diff = a[i]-a[pre]-cnt;
    if (diff > 0 || diff % N != 0) NO();
    sum2 += -diff / N;
  }
  if (sum2 != cnt) NO();
  cout << "YES" << endl;

  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;
 
ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
//cout<< fixed << setprecision(10)
multiset<int>f[200005];
int main(){
 
    fast;
    int T;
    T=1;
   // cin>>T;
    while(T--){
    ll a;
    cin>>a;
    ll b;
    b=(a+(a*a)+(a*a*a));
    cout<<b;
    cout<<"\n";
 
    }
	return 0;
}

Measured memory_bytes: 13020
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#define int long long
using namespace std;

typedef long long ll;

int s;
ll ans;
const ll MOD = 1e9 + 7;

int lg(int x)
{
    if (x < 10) return 1;
    if (1000 < x && x < 10000) return 4;
    return lg(x / 10) + 1;
}

ll inq(ll x, ll y)
{
    if (!y) return 1;
    ll l = inq(x, y / 2);
    if (y % 2) return l * l % MOD * x % MOD;
    return l * l % MOD;
}

signed main()
{
    #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // ONLINE_JUDGE
    cin >> s;
    int r = 1, si = 0;
    for (int l = 1; l < 10000000; l++)
    {
        while (si + lg(r) <= s) si += lg(r), r++;
        if (si == s) ans++;
        si -= lg(l);
    }
    for (int fl = 8; fl <= s; fl++)
    {
        if (s % fl == 0)
        {
            ans = (ans + 4 * MOD + inq(10, fl) - inq(10, fl - 1) - s / fl + 1) % MOD;
        }
        int r = s % fl;
        if (r == 0) r += fl;
        ll val = r * (fl + 1);
        ll c = 1ll * fl * (fl + 1);
        if (val < s) ans = (ans + (s - val) / c + ((s - val) % c > 0)) % MOD;
    }
    cout << ans % MOD;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

int main() {
    ll n; cin >> n;
    string ans = "";
    
    while(n>0){
        n--;
        int r;
        r = n % 26;
        ans += 'a' + r;
        n /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
import static java.lang.Integer.parseInt;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

/**
 * Rank Checker
 * 
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		int[][] rank = new int[101][3];

		for (int i = 0; i < rank.length; i++) {
			rank[i][0] = i;
		}

		// read.
		for (;;) {
			line = br.readLine();
			int p = parseInt(line.substring(0, line.indexOf(',')));// 整理番号
			int q = parseInt(line.substring(line.indexOf(',') + 1));// 正解数
			if ((p | q) == 0) {
				break;
			}
			rank[p][0] = p;
			rank[p][1] = q;
		}

		// ranking.
		Arrays.sort(rank, new Comparator<int[]>() {
			@Override
			public int compare(int[] o1, int[] o2) {
				return o2[1] - o1[1];
			}
		});

		rank[0][2] = 1;
		for (int j = 1; j < rank.length; j++) {
			if (rank[j - 1][1] != rank[j][1]) {
				rank[j][2] = rank[j - 1][2] + 1;
			} else {
				rank[j][2] = rank[j - 1][2];
			}
		}

		Arrays.sort(rank, new Comparator<int[]>() {
			@Override
			public int compare(int[] o1, int[] o2) {
				return o1[0] - o2[0];
			}
		});

		//
		while ((line = br.readLine()) != null && !line.isEmpty()) {
			System.out.println(rank[parseInt(line)][2]);
		}
	}
}

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const string YES = "YES", NO = "NO", Yes = "Yes", No = "No", yes = "yes", no = "no";

// clang-format off
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }

template <typename T> void sort(vector<T> &v) { sort(all(v)); }
template <typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int a = in(), b = in();
  cout << a - (a > b ? 1 : 0) << endl;
}


Measured memory_bytes: 256
#include <cstdio>

int main(){
    int a,b,sum = 0;
    char op;
    scanf("%d %c %d",&a,&op,&b);
    if(op == '+')
        sum = a + b;
    else
        sum = a - b;
    printf("%d\n",sum);

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int N;
int A[1<<17];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>A[i];
	int ans=1;
	int i=2;
	int now=A[0]<A[1]?1:A[0]>A[1]?-1:0;
	while(i<N)
	{
		if(now==1&&A[i-1]>A[i])
		{
			ans++;
			i++;
			if(i<N)
			{
				now=A[i-1]<A[i]?1:A[i-1]>A[i]?-1:0;
			}
		}
		else if(now==-1&&A[i-1]<A[i])
		{
			ans++;
			i++;
			if(i<N)
			{
				now=A[i-1]<A[i]?1:A[i-1]>A[i]?-1:0;
			}
		}
		else if(now==0&&A[i-1]!=A[i])
		{
			now=A[i-1]<A[i]?1:-1;
		}
		i++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<char,int> pci;
typedef vector<pair<int,int>> vpii;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
#define sci(a) scanf("%d",&a)
#define scii(a,b) scanf("%d %d",&a,&b)
#define sciii(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sciiii(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
#define scl(a) scanf("%lld",&a)
#define scll(a,b) scanf("%lld %lld",&a,&b)
#define sclll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c
#define scllll(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define print(a) printf("%d ",a)
#define println(a) printf("%d\n",a)
#define ln printf("\n")
#define pb(a) push_back(a)
#define m_p(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define rep(i,s,n) for(int i=s;i<=n;i++)
#define rrep(i,e,s) for(int i=e;i>=s;i--)
#define repv(i,m) for(auto i = m.begin();i != m.end();i++)
#define FileIO freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const long long INF = 4000000000000000000LL;
/************************************* Chocolate *************************************/
int main(){
    int n;
    sci(n);
    vi cnt(4);
    rep(i,1,n){
        int x;
        sci(x);
        ++cnt[x];
    }
    double ev[n+1][n+1][n+1];
    for(int c=0;c<=cnt[3];++c){
        for(int b=0;b<=cnt[2]+cnt[3];++b){
            for(int a=0;a<=cnt[1]+cnt[2]+cnt[3];a++){
                if(a+b+c == 0 || a+b+c > n) continue;
                double p_waste = 1.0*n/(a+b+c);
                double p_a = 1.0*a/(a+b+c);
                double p_b = 1.0*b/(a+b+c);
                double p_c = 1.0*c/(a+b+c);
                ev[a][b][c] = p_waste;
                if(a) ev[a][b][c] += p_a*ev[a-1][b][c];
                if(b) ev[a][b][c] += p_b*ev[a+1][b-1][c];
                if(c) ev[a][b][c] += p_c*ev[a][b+1][c-1];
            }
        }
    }
    cout.precision(10);
    cout << fixed << ev[cnt[1]][cnt[2]][cnt[3]] << endl;
}

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

N = int(input())
arr = list(map(int, input().split()))
div_arr = list(map(lambda x: x // 400, arr))
sol_arr = [x for x in div_arr if x < 8]
free_len = len(div_arr) - len(sol_arr)
if sol_arr != []:
    min_num = len(set(sol_arr))
    max_num = min_num + free_len
else:
    min_num = 1
    max_num = free_len
print(min_num, max_num)

Measured memory_bytes: 3064
import itertools as it
import numpy as np

N, M, X = map(int, input().split())
A = []

for i in range (0, N):
	A.append(list(map(int, input().split())))

A = np.array(A)

L = list(it.product([0,1], repeat = N))

saishoucost = 100000000
Check = 0

for i in range (0, len(L)):
	D = np.array([0]*(M+1))
	Check = 0
	for j in range (0, N):
		if L[i][j] == 1:
			for k in range (0, M+1):
				D[k]+=A[j][k]
	for j in range (1, M+1):
		if D[j] < X:
			Check = 1
	if Check == 0:
		saishoucost = min(saishoucost, D[0])

if saishoucost == 100000000:
	print(-1)
else:
	print(saishoucost)

Measured memory_bytes: 27308
import javax.management.monitor.CounterMonitor;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        //
        //Euclid e1=new Euclid();//ユークリッドの互除法
        //Compute c1=new Compute();//累積和，
        //変数
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        //int answer=0;
        StringBuilder answer=new StringBuilder();
        //List<Integer> list = new ArrayList<>();
        //int array[] = new int[];

        //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int  K= sc.nextInt();
        String S=sc.next();
        //String[] s=new String[N];

        String s[]=new String[N];
        K--;
        for(int i=0;i<s.length;i++)
        {
            s[i]=S.substring(i,i+1);
        }

        if(s[K].equals("A"))
        {
            s[K]="a";
        }else if(s[K].equals("B"))
        {
            s[K]="b";
        }else if(s[K].equals("C"))
        {
            s[K]="c";
        }

        for(int i=0;i<s.length;i++)
        {
            answer.append(s[i]);
        }
        //出力
        //System.err.println();//標準エラー出力
        System.out.println(answer.toString());
    }
}

class Euclid
{
    public static int gcd(int x,int y)//ユークリッドの互除法を使って2値の最大公約数を求める
    {
        int tmp;
        if(x<y)
        {
            tmp=x;
            x=y;
            y=tmp;
        }
        if(x==0)//(x or y)=0の時は0でない時の値を返す
        {
            return y;
        }else if(y==0)
        {
            return x;
        }else
        {
            while ((tmp = x % y) != 0)
            {
                x = y;
                y = tmp;
            }
            return y;
        }
    }
}

class Compute
{
    int cumulativeSum(int A[],int k)//kの大きさごとに配列Aを切り取ってその区間内の数を足した時の最大値をreturn
    {
        int ans=0;
        //累積和表を作成
        int B[]=new int[A.length+1];//累積和に使う配列
        B[0]=0;
        for(int i=1;i<B.length;i++)
        {
            B[i]=B[i-1]+A[i-1];
        }

        //最大値を求める
        int tmp=0;
        ans=B[k]-B[0];
        for(int i=1;i<A.length-k;i++)
        {
            tmp=B[i+k]-B[i];
            if(tmp>ans)
            {
                ans=tmp;
            }
        }
        System.out.println(Arrays.toString(B));
        return ans;
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_a() {
	string S;
	ll ans = 0;;

	cin >> S;

	rep(i, S.size()/2) {
		if (S[i] != S[S.size() - 1 - i]) {
			ans++;
		}
	}

	cout << ans << "\n";
}

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

	solve_abc_a();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin>>N;
  vector<int> vec(N);
  
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  
  int result=0;
  
  for(int i=0;i<N-1;i++){
    result+= vec.at(i);
  }
  if(result>vec.at(N-1)){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  
  }

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            // var line = consoleReader.SplitInt32();
            var N = consoleReader.Int32();
            var si = consoleReader.Repeat(N).ToArray();
            var lastA = new List<int>();
            var firstB = new List<int>();
            var count = 0;
            for (var h = 0; h < N; h++)
            {
                var s = si[h];
                if (s[0] == 'B')
                    firstB.Add(h);
                if (s[s.Length - 1] == 'A')
                    lastA.Add(h);

                for (int i = 0; i < s.Length - 1; i++)
                {
                    if (s[i] == 'A' && s[i + 1] == 'B')
                    {
                        count++;
                        i++;
                    }
                }
            }

            var renketsu = Math.Min(lastA.Count, firstB.Count);
            if (renketsu > 0 && lastA.SequenceEqual(firstB))
                renketsu--;
            return count + renketsu;
        }

        private readonly ConsoleReader consoleReader;
        public Program() : this(new ConsoleReader()) { }
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program().Calc());
        public static string MultiLine<T>(IEnumerable<T> source) => string.Join("\n", source);
    }

    public class ConsoleReader
    {
        public virtual string String() => Console.ReadLine(); public int Int32() => int.Parse(String()); public long Int64() => long.Parse(String()); public ulong UInt64() => ulong.Parse(String()); public double Double() => double.Parse(String()); public string[] Split() => String().Split().ToArray(); public int[] SplitInt32() => String().Split().Select(int.Parse).ToArray(); public long[] SplitInt64() => String().Split().Select(long.Parse).ToArray(); public ulong[] SplitUInt64() => String().Split().Select(ulong.Parse).ToArray(); public double[] SplitDouble() => String().Split().Select(double.Parse).ToArray(); public IEnumerable<string> Repeat(int count) { for (int i = 0; i < count; i++) yield return String(); }
        public IEnumerable<int> RepeatInt32(int count) { for (int i = 0; i < count; i++) yield return Int32(); }
        public IEnumerable<long> RepeatInt64(int count) { for (int i = 0; i < count; i++) yield return Int64(); }
        public IEnumerable<string[]> RepeatSplit(int count) { for (int i = 0; i < count; i++) yield return Split(); }
        public IEnumerable<int[]> RepeatSplitInt32(int count) { for (int i = 0; i < count; i++) yield return SplitInt32(); }
    }
}


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

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

	for(int i = 0; i < t.length(); i++){
		if(t[i] == '?') t[i]='D';
	}

	cout << t << endl;

	return 0;
}

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

using namespace std;

#define int long long
int const maxn = 1e5 + 5;
int a[maxn], b[maxn], c[maxn], pref[maxn], f[2 * maxn];

inline void add(int x) {
    while (x < 2 * maxn) {
        f[x]++;
        x = (x|(x + 1));
    }
}

inline int get(int x) {
    int ans = 0;
    while (x > 0) {
        ans += f[x];
        x = (x&(x + 1)) - 1;
    }
    return ans;
}

main() {
#ifdef HOME
    freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int i = 1; i <= n; ++i) b[i] = a[i];
    sort(b + 1, b + n + 1);
    int lef = 0, righ = n;
    int sum = 0;
    for (int i = 1; i <= n; ++i) sum += (n - i + 1);
    while (righ - lef > 1) {
        int mid = (righ + lef) / 2;
        for (int j = 1; j <= n; ++j) {
            if (a[j] <= b[mid]) c[j] = 1;
            else c[j] = -1;
            pref[j] = pref[j - 1] + c[j];
        }
        int cnt = 0;
        for (int i = 0; i < 2 * maxn; ++i) f[i] = 0;
        add(maxn + 1);
        for (int j = 1; j <= n; ++j) {
            cnt += get(pref[j] + maxn);
            add(pref[j] + 1 + maxn);
        }
        if (cnt >= (sum + 2) / 2) righ = mid;
        else lef = mid;
    }
    cout << b[righ] << '\n';
    return 0;
}



Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

vector <P> ans;
string str;

int main(){
  ll anssum=0,anssize=0;
  ll maxH,nowH,cnt,maxW;
  cin>>str;
  maxH=nowH=20000LL;
  cnt=0;

  for(int i=0;i<(int)str.size();i++){

    if(str[i]=='/'){
      nowH++;
      if(maxH==nowH){
	cnt++;
	ans.push_back(P(i,cnt/2));
	cnt=0;
      }else if(maxH<nowH){
	maxH=nowH;
      }else{
	cnt+=(maxH-nowH)*2+1;
      }
      
    }else if(str[i]=='_'){

      if(maxH>nowH){
	cnt+=(maxH-nowH)*2;

      }
    }else{

      nowH--;
      if(maxH>nowH){
	cnt+=(maxH-nowH)*2-1;
      }

    }
  }
  
  maxH=nowH=20000LL;
  maxW=(int)str.size()-1;

  cnt=0;

  for(int i=(int)str.size()-1;i>=0;i--){
    if(str[i]=='\\'){
      nowH++;
      if(maxH==nowH){
	cnt++;
	ans.push_back(P(maxW,cnt/2));
	cnt=0;
      }else if(maxH<nowH){
	maxH=nowH;
	maxW=i;
      }else{
	cnt+=(maxH-nowH)*2+1;
      }
    }else if(str[i]=='_'){
      if(maxH>nowH){
	cnt+=(maxH-nowH)*2;
	
      }else if(maxH==nowH){
	maxW=i;
      }
    }else{
      if(nowH==maxH)maxW=i;
      nowH--;
      if(maxH>nowH){
	cnt+=(maxH-nowH)*2-1;
      }
    }
  }

  sort(ans.begin(),ans.end());
  anssum=anssize=0;
  for(int i=0;i<(int)ans.size();i++){
    if(i>0&&ans[i-1]==ans[i])continue;
    anssum+=ans[i].second;
    anssize++;
  }
  
  cout<<anssum<<endl;
  cout<<anssize;
  for(int i=0;i<(int)ans.size();i++){
    if(i>0&&ans[i-1]==ans[i])continue;
    cout<<' '<<ans[i].second;
  }
  cout<<endl;
}



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

using namespace std;

void solve()
{
    int n;
    cin >> n;
    vector<long> as(n);
    for (int i = 0; i < n; i++)
    {
        cin >> as[i];
    }
    long ans = 0;
    bitset<100010> vst;
    for (int d = 1; d <= (n - 1) / 2; d++)
    {
        long res = 0;
        vst.reset();
        for (int k = 0; (k + 1) * d < n; k++)
        {
            int l = k * d, r = n - 1 - l;
            if (vst[l] || vst[r] || l == r)
                break;
            vst[l] = vst[r] = 1;
            res += as[l] + as[r];
            ans = max(ans, res);
        }
    }
    cout << ans << endl;
}

int main()
{
    solve();
    cerr << "\"努力不足ですね！\"" << endl;
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  if(s == "AAA" || s == "BBB") puts("No");
  else puts("Yes");
  return 0;
}


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

signed main(){

  using i64 = int_fast64_t;

  i64 n;
  cin>>n;
  vector<i64> a(n);
  for(auto& ai:a)cin>>ai;

  i64 x = 0,s = 0;
  int l = 0,r = 0;
  i64 ans = 0;
  for(;l<n;++l){
    while(r<n&&((x^a[r])==(s+a[r]))){
      x ^= a[r];
      s += a[r];
      r++;
    }
    //cout<<l<<" "<<r<<endl;
    ans += r-l;
    x ^= a[l];
    s -= a[l];
  }
  cout<<(ans)<<endl;

}

Measured memory_bytes: 1792
waitTime = []
_time = 0
for i in range(0,5):
    t, mod = divmod(int(input()), 10)
    _time += (t * 10)
    if mod != 0:
        waitTime.append(mod)
if len(waitTime) > 0:
    waitTime = sorted(waitTime, reverse= True)
    _time += (len(waitTime) - 1) * 10
    _time += min(waitTime)
print(_time)

Measured memory_bytes: 3060
#include <iostream>
#include<math.h>
#define P 1000000007
using namespace std;
int main() {
	long long int n,a,b,i,j,ans=0;
	cin>>n>>a>>b;
	long long int x[n],dis[n-1];
	for(i=0;i<n;i++){
		cin>>x[i];
	}
	for(i=0;i<n-1;i++){
		dis[i]=x[i+1]-x[i];
	}
	for(i=0;i<n-1;i++){
		ans+=fmin(dis[i]*a,b);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<cstdio>
using namespace std;
int main(){
  long x,a,b,c;
  scanf("%ld",&x);
  a=x/11;
  b=x%11;
  if(b==0)
    printf("%ld\n",2*a);
  else if(b<=6)
    printf("%ld\n",2*a+1);
  else
    printf("%ld\n",2*a+2);
}

Measured memory_bytes: 128
#include <stdio.h>
#define MAX 1000000
int main()
{
    int i, j, n, count, prime[MAX];
    
    prime[0] = prime[1] = 0;
    for (i = 2; i < MAX; i++) prime[i] = 1;    
    for (i = 2; i * i < MAX; i++) 
        for (j = 2 * i; j < MAX; j += i) prime[j] = 0;
    
    while(scanf("%d", &n) != EOF){
        count = 0;
        for (i = 2; i <= n; i++) count += prime[i];
        printf("%d\n", count);
    }
    
    return 0;
}

Measured memory_bytes: 4500
import operator
def poland(A):
    l = []
    ops = { "+": operator.add, "-": operator.sub, '*' : operator.mul }
    for i in range(len(A)):
        item = A.pop(0)
        if item in ops:
            l.append(ops[item](l.pop(-2),l.pop()))
        else:
            l.append(int(item))
    return l.pop()
    

if __name__ == '__main__':
    A = input().split()
    print (poland(A[:]))

Measured memory_bytes: 7760
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	string S;
	cin >> S;
	int start_0 = 0;
	int start_1 = 0;
	for (int i = 0; i < S.size(); i++)
	{
		if (S[i] == '0')
		{
			if (!(i & 1))
			{
				start_1++;
			}
			else
			{
				start_0++;
			}
		}
		else
		{
			if (!(i & 1))
			{
				start_0++;
			}
			else
			{
				start_1++;
			}
		}
	}
	cout << min(start_0, start_1) << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 512
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ords = []
    for i, a in enumerate(A):
        ords.append((i, a))
    ans = list(map(lambda x: x[0]+1, sorted(ords, key=lambda x: x[1])))
    print(*ans)
    
        
    


    
if '__main__' == __name__:
    resolve()

Measured memory_bytes: 97348
//
//  sublime text 3,
//  emre yazicioglu
//

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;
typedef vector <ll> vll;
typedef vector <pll> vpll;
#define pb push_back
#define fi first
#define se second
#define INF (ll) (1e18 + 7)
#define MOD (ll) (1e9 + 7)

const int N = 2e6 + 7;
ll mn = INF, mx = -INF;
ll n, m, k, s, q, t;
ll a, b, c, d, e;
ll ans, cur, sum, cnt;
ll ar[N], p[N], dp[N];
string str; bool h[N];
pll pp[N]; vll v;
priority_queue <ll> pq;

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

  // freopen("../in.txt","r",stdin);
  // freopen("../out.txt","w",stdout);

  cin >> n >> k;
  for(int i = 1; i <= n; i++) {
    cin >> ar[i];
    pq.push(ar[i]);
  }
  while(k--) {
    pq.push(pq.top() / 2);
    pq.pop();
  }
  while(pq.empty() == 0) {
    ans += pq.top();
    pq.pop();
  }
  cout << ans;
}

Measured memory_bytes: 5496
#include<stdio.h>
int main(){
  int h,w,i,j,k;
  scanf("%d %d",&h,&w);
  for(i=0;;i++){
    for(j=0;j<h;j++){
      for(k=0;k<w;k++){
          if((j+k+2)%2==0){
        printf("#");
          }else{
              printf(".");
          }
        if(j==h-1&&k==w-1){
          printf("\n");
        }
      } 
      printf("\n");
    }
    h=0;
    w=0;
    scanf("%d %d",&h,&w);
    if(h==0&&w==0){
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 2124
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    for(ll i=1; i<=3*n/4; i++){
        for(ll k=3*n/4; k<=3500; k++){
            ll t=4*i*k-n*(i+k);
            if(t>=1 && n*i*k%t==0){
                cout << i << " " << n*i*k/t << " "<< k << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    string s,t;
    cin >> s >> t;
    cout << t << s << endl;
    return 0;
}

Measured memory_bytes: 256