akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll mod = 1000000007;

const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}



// check
// 問題文を復唱する


int main() {
  // ll r,d,x;
  ll n;
  cin >> n;
  // string s;
  // cin >> s;
  vector<string> s(n);
  vector<ll> p(n, 0);

  // vector<pair<string, ll>> sp(n);

  vector<tuple<string, ll, ll>> spt(n);

  for (int i = 0; i < n; i++) {
    cin >> s[i] >> p[i];
    spt[i] = make_tuple(s[i], p[i], i + 1);
  }



  // sort(spt.begin(), spt.end(), []( tuple<string, ll, ll> &left, tuple<string, ll, ll> &right ) {
  //   return get<1>(left) > get<1>(right);
  // });

  sort(spt.begin(), spt.end(), []( tuple<string, ll, ll> &left, tuple<string, ll, ll> &right ) {
    if (get<0>(left) < get<0>(right))return true;

    if (get<0>(left) == get<0>(right))return get<1>(left) > get<1>(right);

    return false;
    // return get<0>(left) < get<0>(right);
  });


  for (int i = 0; i < n; i++) {
    cout << get<2>(spt[i]) << endl;
  }


}




















Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,f=0,c=1;
  cin>>n;
  if(n<3){
    cout<<1;
    return 0;
  }
  int a[n];
  cin>>a[0];
  for(int i=1;i<n;i++){
    cin>>a[i];
    if(a[i]>a[i-1]){
      if(f==0) f=1;
      else if(f==-1){
        f=0;
        c++;
      }
    }else if(a[i]<a[i-1]){
      if(f==0) f=-1;
      else if(f==1){
        f=0;
        c++;
      }
    }
  }
  cout<<c;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>

using namespace std;

void solve(int D, int N) {
  int d = 1;
  for (int i = 0; i < D; i++) {
    d *= 100;
  }
  if (N == 100) {
    printf("%d\n", 101 * d);
  } else {
    printf("%d\n", N * d);
  }
}

int main() {
  int D, N;
  cin >> D >> N;
  solve(D, N);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pf(n) printf("%lld\n",n)
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1001001001;
const double PI = acos(-1);

int main() {
	int l, r, d;
	cin >> l >> r >> d;

	int cnt = 0;
	for (int i = l; i <= r; i++) {
		if (i%d == 0) cnt++;
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> >
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

map<ll,vector<pair<ll,ll> > >info;
ll N;
ll ans[100005];
ll Q,K;

void DFS(ll from){
    rep(i,info[from].size()){
        ll to = info[from][i].first;
        ll cost = info[from][i].second;
        //if(to == K) continue;
        if(ans[to] == 0){
            if(to==K) continue;
            ans[to] = ans[from] + cost;
            DFS(to);
        }
    }
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
        
    cin >> N;
    rep(i,N-1){
        ll a,b,c; cin >> a>> b >> c;
        info[a].pb(mp(b,c));
        info[b].pb(mp(a,c));
    }
    
    cin >> Q >> K;
    vector<pair<ll,ll> > quer;
    rep(i,Q){
        ll x,y; cin >> x >> y;
        quer.pb(mp(x,y));
    }
    
    DFS(K);
    cerr << "----------" << endl;
    rep(i,N){
        cerr << ans[i+1] << endl;
    }
    cerr << "---------" << endl;
    rep(i,Q){
        cerr << ans[quer[i].first] <<" +"  << ans[quer[i].second]  << " =";
        cout << ans[quer[i].first] + ans[quer[i].second] << endl;
    }
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


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

int main()
{
  int n, y;
  scanf("%d%d", &n, &y);
  y /= 1000;
  for (int i = 0; i <= 2000; i++)
  {
	if (i * 10 > y) break;
    int rest_n = n - i, rest_y = y - i * 10;
    if ((rest_y - rest_n) % 4 == 0 && rest_y >= rest_n && 5 * rest_n >= rest_y)
    {
      printf("%d %d %d\n", i, (rest_y - rest_n) / 4, rest_n - (rest_y - rest_n) / 4);
      return 0;
    }
  }
  printf("-1 -1 -1\n");

  return 0;
}

Measured memory_bytes: 256
deck = [[False for i in range(13)] for j in range(4)]
suits = ['S', 'H', 'C', 'D']

card = int(input())
for i in range(card):
    pattern, number = input().split()
    number = int(number)
    deck[suits.index(pattern)][number-1] = True

[print(suits[i], j+1) for i in range(4) for j in range(13) if not deck[i][j]]
        
    


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

from collections import Counter

snuke_s = set([i for i in range(1,N+1)])

s=set()

for i in range(K):
    d_i = int(input())
    snuke = set(list(map(int,input().split())))

    s=s|snuke

s_diff = snuke_s - s

print(len(s_diff))

Measured memory_bytes: 9468
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;

signed main(){
    int N;cin>>N;
    vector<int>A(N);
    REP(i,N)cin>>A[i];
    vector<pair<int,int>>L(N);
    vector<pair<int,int>>R(N);
    REP(i,N){
        if(i==0)L[0]=mp(0,0);
        else L[i]=mp(L[i-1].first+abs(L[i-1].second-A[i-1]),A[i-1]);
    }
    reverse(A.begin(),A.end());
    REP(i,N){
        if(i==0)R[0]=mp(0,0);
        else R[i]=mp(R[i-1].first+abs(R[i-1].second-A[i-1]),A[i-1]);
    }
    reverse(R.begin(),R.end());
    REP(i,N)cout<<L[i].first+R[i].first+abs(R[i].second-L[i].second)<<endl;
}

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

using namespace std;

int x[200000];
int t[200000];

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

	int n;
	cin >> n;
	for( int i = 0; i < n; i++ )cin >> x[i];
	memcpy(t, x, sizeof(int) * n);
	sort(x, x + n);
	int s = x[( n + 1 ) / 2];
	int c[2] = { x[( n + 1 ) / 2],x[( n + 1 ) / 2 - 1] };
	for( int i = 0; i < n; i++ )
	{
		if( s > t[i] )cout << c[0] << endl;
		else cout << c[1] << endl;
	}

	return 0;
}


Measured memory_bytes: 3712
import sys

read = sys.stdin.buffer.read


def main():
    N, T, *AB = map(int, read().split())
    D = [(a, b) for a, b in zip(*[iter(AB)] * 2)]

    D.sort()

    dp = [[0] * T for _ in range(N + 1)]
    for i, (a, b) in enumerate(D):
        for t in range(T):
            if 0 <= t - a:
                dp[i + 1][t] = dp[i][t - a] + b
            if dp[i + 1][t] < dp[i][t]:
                dp[i + 1][t] = dp[i][t]

    ans = 0
    for i in range(N - 1):
        if ans < dp[i + 1][T - 1] + D[i + 1][1]:
            ans = dp[i + 1][T - 1] + D[i + 1][1]

    print(ans)
    return


if __name__ == '__main__':
    main()


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


void solve(long long X){
    long long a = X/500;
    long long re = X%500;
    long long b = re/5;
    cout << a * 1000 + b*5 << endl;


}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[][] a = new int[2][n];
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < n; j++) {
                a[i][j] = in.nextInt();
            }
        }

        for (int i = 1; i < n; i++) {
            a[0][i] += a[0][i - 1];
        }

        for (int i = n - 2; i >= 0; i--) {
            a[1][i] += a[1][i + 1];
        }

        int ans = 0;
        for (int i = 0; i < n; i++) {
            int total = a[0][i] + a[1][i];
            ans = Math.max(ans, total);
        }

        System.out.println(ans);

    }
}

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

const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 5;

ll modpow(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b&1)
      res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}

ll f[MAXN];
ll invf[MAXN];

ll ncr(ll n, ll r) {
  if (r == 0 || n == r) return 1;
  return (((f[n] * invf[n-r]) % MOD) * invf[r]) % MOD;
}

int main() {
  int h, w, a, b;
  cin >> h >> w >> a >> b;
  f[0] = 1;
  for (int i = 1; i < MAXN; i++) {
    f[i] = (f[i-1] * i) % MOD;
    invf[i] = modpow(f[i], MOD-2);
  }
  ll res = 0;
  for (int i = b; i < w; i++) {
    int y1 = h - a - 1, x1 = i;
    int y2 = a - 1, x2 = w - i - 1;
    ll p = (ncr(x1 + y1, x1) * ncr(x2 + y2, x2)) % MOD;
    res = (res + p) % MOD;
  }
  cout << res << '\n';
}

Measured memory_bytes: 19224
X = int(input())
#X = (24**5)-(15**5)

a = [int( i/2)*((-1)**i) for i in range(1, 1000)]
b = [int( i/2)*((-1)**i) for i in range(1, 1000)]

#a = [24]
#b = [15]
"""
* Aが正ならBは負または、Aより小さい正
* Aが負ならBは負
* X/(a+b)は、1以上の整数
"""

find = False
if X == 0:
  print(0)
else:  
  for a_ in a:
    for b_ in b:

      if a_ + b_ == 0:
        continue
      if a_ >= 0:
        if b_ >= 0 and b_ > a_:
          continue
      if a_ < 0:
        if b_ >= 0:
          continue
      """
      if X%(a_+b_) != 0:
        print("hoge")
        continue
      """
      if (a_**5) - (b_**5) == X:
        print(f"{a_} {b_}")
        find = True
        break
    if find:
      break


Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int m;
    cin >> m;
    vector<ll> d(m), c(m);
    for (int i = 0; i < m; i++)
    {
        cin >> d[i] >> c[i];
    }
    ll ans = 0;
    ll cnt = 0;
    for(int i=0;i<m;i++){
        cnt+=c[i];
        ans+=d[i]*c[i];
    }
    ll res = cnt-1+(ans-1)/9;
    cout<<res<<endl;
}

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

int main() {
    ll N;cin >> N;
    ll P[N] = {};
    for (int i = 0;i < N;i++) cin >> P[i];
    ll ans = 1;ll mini = P[0];
    for (int i = 1;i < N;i++){
        if (P[i] < mini) {
            ans++;mini = P[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

int main() {
    ll N;
    cin >> N;
    vector<ll> Pis;
    for (ll i = 0; i < N; i++) {
        ll Pi;
        cin >> Pi;
        Pis.push_back(Pi);
    }
    struct ValInfo {
        ll idx;
        ll value;
    };
    auto comp_val_info_0 = [](ValInfo lhs, ValInfo rhs){ return lhs.value < rhs.value; };
    priority_queue<ValInfo, vector<ValInfo>, decltype(comp_val_info_0)> queue0(comp_val_info_0);
    vector<ll> right_map0(N, N);
    for (ll i = 0; i < N; i++) {
        ll Pi = Pis[i];
        while (!queue0.empty() && queue0.top().value > Pi) {
            ValInfo info = queue0.top();
            queue0.pop();
            right_map0[info.idx] = i;
        }
        queue0.push(ValInfo{i, Pis[i]});
    }
    while (!queue0.empty()) {
        queue0.pop();
    }
    vector<ll> left_map0(N, -1);
    for (ll i = N-1; i >= 0; i--) {
        ll Pi = Pis[i];
        while (!queue0.empty() && queue0.top().value > Pi) {
            ValInfo info = queue0.top();
            queue0.pop();
            left_map0[info.idx] = i;
        }
        queue0.push(ValInfo{i, Pis[i]});
    }
    ll ans = 0;
    for (ll i = 0; i < N; i++) {
        ll cnt = 0;
        cnt += (i - left_map0[i]) * (right_map0[i] - i);
        ans += cnt * Pis[i];
    }
    cout << ans << endl;
}



Measured memory_bytes: 9328
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int main() {
    int h,w;
    cin >> h >> w;
    vector<vector<char> > area(h, vector<char>(w));
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> area[i][j];
        }
    }
    vector<vector<int> > ans(h, vector<int>(w,0));
    for(int i = 0; i < h; i++){
        int count = 0;
        for(int j = 0; j < w; j++){
            if(area[i][j] == '.'){
                count++;
                ans[i][j] = count;
            }else{
                ans[i][j] = -1;
                count = 0;
            }
        }
        int now = 0;
        for(int j = w-1; j >= 0; j--){
            if(ans[i][j] == -1){
                now = 0;
            }else{
                now = max(now, ans[i][j]);
                ans[i][j] = now;
            }
        }
    }

    vector<vector<int> > ans2(h, vector<int>(w,0));
    for(int j = 0; j < w; j++){
        int count = 0;
        for(int i = 0; i < h; i++){
            if(area[i][j] == '.'){
                count++;
                ans2[i][j] = count;
            }else{
                ans2[i][j] = -1;
                count = 0;
            }
        }
        int now = 0;
        for(int i = h-1; i >= 0; i--){
            if(ans2[i][j] == -1){
                now = 0;
            }else{
                now = max(now, ans2[i][j]);
                ans2[i][j] = now;
            }
        }
    }

    int ret = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            ret = max(ret, ans[i][j] + ans2[i][j] - 1);
        }
    }
    cout << ret << endl;
}

Measured memory_bytes: 37632
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n;
ll M=(1e5)+1;

//bit全探索
vi bt;
void setbit(ll i){
  bt.clear();
  for(ll tmp=0;i>0;i/=2){
    if (i%2==1) bt.push_back(tmp);
    tmp++;
  }
}




int main(){
  ll ans=0,q;
  cin >>n;
  n++;
  ll nlg=ceil(log2(n));
  vi V(n),W(n);
  REP(i,n-1) cin>>V[i+1]>>W[i+1];

  cin >>q;
  vi u(q),L(q);
  REP(i,q) cin>>u[i]>>L[i];

  //上半分
  ll nhi=nlg-(nlg/2);
  vvi data(1LL<<nhi, vi(M));  // N * M の2次元配列

  for(ll i=1;i<(1LL<<nhi);i++){
    for(ll j=0;j<M;j++){
      if ((j-W[i])>=0)
      {
        data[i][j]=max(data[i/2][j-W[i]]+V[i],data[i/2][j]);
      }
      else
      {
        data[i][j]=data[i/2][j];
      }
    }
  }


int uiv[10];
int wuiv=0;


//下半分
for(ll loop=0;loop<q;loop++){
  ll uidx=u[loop];
  if (uidx<(1LL<<nhi)){
    cout<<data[uidx][L[loop]]<<endl;
  }else{//上＋下
    ll maxval=0;
    //vi uiv;
    int nn=0;
    wuiv=0;
    for(;;uidx/=2){
      if (uidx<(1LL<<nhi))break;
      uiv[wuiv]=uidx;
      wuiv++;
      nn++;
    }

    int bn=1<<nn;
    for(int i=0;i<bn;i++){
      //setbit(i);
      ll tmpw=0;
      ll tmpv=0;
      for(int j=0;j<nn;j++){
        if ((i&(1<<j))!=0){
          tmpv+=V[uiv[j]];
          tmpw+=W[uiv[j]];
        }
      }
      //for (auto j : bt) {
        //tmpv+=V[uiv[j]];
        //tmpw+=W[uiv[j]];
      //}
      if (tmpw<=L[loop]){
        maxval=max(data[uidx][L[loop]-tmpw]+tmpv,maxval);
      }
    }

    cout<<maxval<<endl;
  }












}


  return 0;
}

Measured memory_bytes: 207304
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#ifdef DEBUG
std::ostream& dout = cout;
#else
stringstream dout;
#endif
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
signed main(signed argc, char* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    const int MOD = 1000000007;
    int n,k;
    cin>>n>>k;
    n=n%k;
    n=min(n,k-n);
    cout<<n<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#define MAXN 10000001

typedef long long ll;
ll n, d[MAXN], num[MAXN];
ll ans, cnt, prime[MAXN];
bool vis[MAXN];

void getd(int N) {
    d[1] = 1, num[1] = 1;
    for (int i = 2; i <= N; ++i) {
        if (!vis[i]) {
            prime[++cnt] = i;
            d[i] = 2, num[i] = 1;
        }
        for (int j = 1; j <= cnt; ++j) {
            if (i * prime[j] > n) break;
            vis[i * prime[j]] = 1;
            if (i % prime[j] == 0) {
            	d[i * prime[j]] = d[i] / (num[i] + 1) * (num[i] + 2);
            	num[i * prime[j]] = num[i] + 1;
            	break;
            }
            else {
            	d[i * prime[j]] = d[i] * 2;
            	num[i * prime[j]] = 1;
            }
        }
    }
}

int main() {
	scanf("%lld", &n);
	getd(n);
	for (int i = 1; i <= n; ++i) {
		ans += 1ll * i * d[i];
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 174968
from sys import stdin
input = stdin.readline


def main():
  N, M = list(map(int, input().split()))
  PS = []
  for i in range(M):
    p, s = input().split()
    PS.append((int(p)-1, s))

  penas = [0]*(N)
  is_ac = [0]*(N)
  for i in range(M):
    p, s = PS[i]
    if s == 'AC':
      is_ac[p] = True
    elif not is_ac[p]:
      penas[p] += 1

  num_ac = sum(is_ac)
  num_pe = 0

  for i in range(N):
    if is_ac[i]:
      num_pe += penas[i]

  print(num_ac, num_pe)


if(__name__ == '__main__'):
  main()


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

string getstring(){
  string s;
  cin>> s;
  int t;
  t = s.length();
  while (!((t <= 100) && (t >= 1))) {
    exit(0);
  }

  for (int i =0;i<t;i++){
    while(!(((int)s[i]>=97)&&((int)s[i]<=122))){
      exit(0);
    }
  }
  return s;
}

int main(){

string s;
s = getstring();
int t,k,sum=0;
t = s.length();
k = t/2 ;
for (int i =0;i<k;i++){
  if(((int)s[i])!=((int)s[t-i-1])){
    sum++;
  }
}
 cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 256
<?php
// ???????????´??° aa???bb???cc ??????????????????aa ?????? bb ?????§?????´??°????????????
// cc ????´???°?????????????????????????±???????????????°????????????????????????????????????
fscanf(STDIN, "%d %d %d", $aa, $bb, $cc);
$count = 0;
//--------------------
//$cc????´???°????±???????
//--------------------
for($i = 1; $i <= $cc; $i++){
    if($cc % $i == "0") {
        $yakusuu[] = $i;
    } 
}
//--------------------
//$cc????´???°???????????????????????????
//--------------------
for($i = $aa; $i <= $bb; $i++){
    foreach($yakusuu as $value){
        if($i == $value){
            $count++;
        }
    }
}
echo $count;
?>

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

int main() {
  int a, b;
  cin >> a >> b;
  
  if (a * b % 2 == 0) {
    cout << "Even" << endl;
  }
  
  else if (a * b % 2 == 1) {
    cout << "Odd" << endl;
  }
}

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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int K = in.nextInt();
            Integer[] H = new Integer[N];
            for (int i = 0; i < N; i++) {
                H[i] = in.nextInt();
            }
            Arrays.sort(H);
            long ans = 0;
            for (int i = 0; i < N - K; i++) {
                ans += H[i];
            }
            out.println(ans);
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

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

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

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

    }
}



Measured memory_bytes: 57300
#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <numeric>
#include <iterator>

using namespace std;

namespace {

}

int main()
{
	// int N = 0;

	long long A, B, K;

	cin >> A >> B >> K;


	for (long long i = A; i <= B; ++i){
		if ((i <= A + K - 1) 
			|| (i >= B - K + 1)){
			cout << i << endl;
		}
	}
	


	return 0;
}

Measured memory_bytes: 256
N= int(input())
ans = 0

#Ｎまでの範囲で奇数のみ回す
for i in range(1,N+1,2):
	# print(i)
	count=0	 
	#奇数のみを考えるので、1-200の間の奇数だけで考える
	for j in range(1,200,2):
		if j <= i and i % j ==0:
			# print('j:',j)
			count += 1
		else:
			continue
	if count == 8:
		ans += 1


print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
 
using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
 
template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }
 
template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}
 
template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}
 
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif
 
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  int x,y;
  cin >> x >> y;
  if(x % y == 0){
    cout << "-1\n";
  }else{
    cout << x;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const int maxm = 1e6 + 5;
const double eps = 1e-8;
const double pi = acos(-1.0);
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll n,a,b;
int main(){
//	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> a >> b;
	ll sum = (a + b);
	ll x = n / sum;
	ll y = n % sum;
	ll ans = x * a + min(a,y);
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N , K = map(int,input().split())
S = input()
L = []
flag = int(S[0])
for x in S:
    L.append(x)
cnt = 1
C = []
for i in range(len(L)):
    try:
        if L[i] == L[i+1]:
            cnt += 1
        else:
            C.append(cnt)
            cnt = 1
    except:
        pass
C.append(cnt)
ans = 0
from itertools import accumulate
accumulated =  [0]+list(accumulate(C))
ans = 0
A = 0
if flag == 0:
    if len(C) % 2 == 0:
        k = min(K,len(C)//2)
    else:
        k = min(K,len(C)//2+1)
else:
    k = min(K,len(C)//2)
for i in range(len(C)):
    try:
        if (flag + i) % 2 == 0:
            A =max(A, accumulated[i+2*k-1] - accumulated[i])
            ans = accumulated[i+2*k] - accumulated[i]
        else:
            A =max(A, accumulated[i+2*k-1] - accumulated[i])
            A =max(A, accumulated[i+2*k] - accumulated[i])
            ans = accumulated[i+2*k+1] - accumulated[i]
        A = max(ans,A)
    except:
        pass
print(A)



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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

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


const int N = 12;
vi adj[N];
int cur[N], p[N];
int n, m, ans;

void solve(int idx) {
    if (idx == n) {
        bool flag = true;
        loop(i, m)flag &= (cur[i] == p[i]);
        ans += flag;
        return;
    }

    solve(idx + 1);
    for (int nxt : adj[idx])cur[nxt] ^= 1;
    solve(idx + 1);
    for (int nxt : adj[idx])cur[nxt] ^= 1;
}

int main() {

#ifndef ONLINE_JUDGE
//    freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int sz, x;
    cin >> n >> m;
    loop(i, m) {
        cin >> sz;
        loop(j, sz) {
            cin >> x;
            adj[x - 1].push_back(i);
        }
    }

    loop(i, m)cin >> p[i];

    solve(0);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int elementaryMatrix(vector<bitset<2501> >& mat)
{
    const int n = mat.size();
    const int m = mat[0].size();
    int y = 0;
    int x = 0;
    while(y < n && x < m){
        int tmp = -1;
        for(int i=y; i<n; ++i){
            if(mat[i][x] == 1){
                tmp = i;
                break;
            }
        }
        if(tmp != -1){
            swap(mat[y], mat[tmp]);
            for(int i=y+1; i<n; ++i){
                if(mat[i][x])
                    mat[i] ^= mat[y];
            }
            ++ y;
        }
        ++ x;
    }
    mat.resize(y);
    return y;
}

const int MOD = 1000000009;

long long power(int a, int b)
{
    long long ret = 1;
    long long tmp = a;
    while(b > 0){
        if(b & 1){
            ret *= tmp;
            ret %= MOD;
        }
        tmp *= tmp;
        tmp %= MOD;
        b >>= 1;
    }
    return ret;
}

int main()
{
    int r, c;
    cin >> r >> c;
    vector<bitset<2501> > mat(r*c);
    for(int i=0; i<r; ++i){
        for(int j=0; j<c; ++j){
            int tmp;
            cin >> tmp;
            mat[i*c+j][r*c] = (tmp == 1);
        }
    }
    
    for(int i=0; i<r*c; ++i){
        for(int j=0; j<9; ++j){
            if(j == 4)
                continue;
            int y = i / c;
            int x = i % c;
            while(0 <= y && y < r && 0 <= x && x < c){
                mat[i][y*c+x] = true;
                y += j / 3 - 1;
                x += j % 3 - 1;
            }
        }
    }

    int rank = elementaryMatrix(mat);
    long long ret = 0;
    if(!mat[rank-1][r*c] || mat[rank-1].count() != 1)
        ret = power(2, r*c - rank);
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 1796
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
 
int main() {
	int N, K;
	cin >> N >> K;
	string S;
	cin >> S;
 
	vector<int> Nums;
	int now = 1;
	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		if (S[i] == (char)('0' + now)) cnt++;
		else {
			Nums.push_back(cnt);
			now = 1 - now;
			cnt = 1;
		}
	}
	if (cnt != 0) Nums.push_back(cnt);

	if (Nums.size() % 2 == 0) Nums.push_back(0);
 
	vector<int> sum(Nums.size() + 1);
	for (int i = 0; i < Nums.size(); i++)
	{
		sum[i + 1] = sum[i] + Nums[i];
	}

	int Add = 2 * K + 1;
	int ans = 0;
 
	for (int i = 0; i < Nums.size(); i += 2)
	{
		int tmp = 0;
 
		int left = i;
		int right = min(i + Add, (int)Nums.size());

        /*
		for (int j = left; j < right; j++)
		{
			tmp += Nums[j];
		}
*/        

		tmp = sum[right] - sum[left];

		ans = max(tmp, ans);
	}
 
	cout << ans << endl;
}

Measured memory_bytes: 1272
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    assert_eq!(!0usize, std::usize::MAX); //🙊

    let (n, x) = (io.read::<usize>(), io.read::<i64>());
    let mut a = io.readn::<i64>(n);

    let mut ans = 0;
    for i in 0..n - 1 {
        if a[i] + a[i + 1] > x {
            let dif = a[i] + a[i + 1] - x;
            ans += dif;
            a[i + 1] -= min(a[i + 1], dif);
        }
    }
    io.writeln(ans);
}

static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <string.h>
#include <string>

using namespace std;

void solve()
{
	int n;
	cin >> n;
	while(n--)
	{
		int point = 0;
		int outcount = 0;
		bool runner[3];
		memset(runner, 0, sizeof(bool) * 3);
		while(true)
		{
			string str;
			cin >> str;
			if(str == "HIT")
			{
				if(runner[2])
				{
					point++;
				}
				for(int i = 1; i >= 0; --i)
				{
					if(runner[i])
					{
						runner[i + 1] = true;
					}
				}
				runner[0] = true;
			}
			else if(str == "OUT")
			{
				outcount++;
				if(outcount == 3)
				{
					cout << point << endl;
					break;
				}
			}
			else if(str == "HOMERUN")
			{
				point++;
				for(int i = 0; i < 3; ++i)
				{
					if(runner[i])
					{
						point++;
						runner[i] = false;
					}
				}
			}
		}
	}
}

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

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

const int S = 0;
const int W = 1;

int sim(vector<int> &p, int n, string &s) {
  for(int i = 1; i < n; i++) {
    int ni = (i + 1) % n;
    if((p[i] == S && s[i] == 'o') || (p[i] == W && s[i] == 'x')) {
      if(p[ni] != -1 && p[ni] != p[i-1]) return 0;
      p[ni] = p[i-1];
    } else {
      if(p[ni] != -1 && p[ni] != !p[i-1]) return 0;
      p[ni] = !p[i-1];
    }
  }
  return 1;
}

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

  vector<vector<int>> p(4, vector<int>(n, -1));
  rep(i,4) {
    p[i][0] = i&1;
    p[i][1] = (i&2)>>1;
    p[i][n-1] = ((p[i][0] == S && s[0] == 'o') || (p[i][0] == W && s[0] == 'x')) ? p[i][1] : !p[i][1];
    if(sim(p[i], n, s)) {
      rep(j,n) cout << (p[i][j] ? 'W' : 'S');
      cout << endl;
      return 0;
    }
  }
  cout << "-1" << endl;

  return 0;
}


Measured memory_bytes: 2432
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC150A
{
    class Program
    {
        static void Main(string[] args)
        {
            var word = Console.ReadLine().Split();
            int a = int.Parse(word[0]);
            int b = int.Parse(word[1]);
            if (a * 500 >= b)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

            Console.ReadKey();
        }
    }
}


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

int vector_max(vector<int> A){//計算量(A.size())
    int max = A.at(0);
    for(int i=0; i<A.size(); i++){
        if (A.at(i) > max){
            max = A.at(i);
        }
    }
    return max;
}

int vector_secondmax(vector<int> A){//second_maxがmaxより真に小さい場合（存在する場合）
    sort(A.begin(), A.end());
    int second_max = A[A.size() - 2];
    return second_max;
}

int main(){
    int n;
    cin >> n;
    vector<int> veven(n/2);
    vector<int> vodd(n/2);
    for(int i=0; i<n/2; i++){
        cin >> vodd[i] >> veven[i];
    }
    vector<int> count_odd(100010, 0);
    vector<int> count_even(100010,0);

    for(int i=0; i<n/2; i++){
        count_odd[vodd[i]-1] ++;
        count_even[veven[i]-1] ++;
    }

    int largeodd = count_odd[0], largeeven = count_even[0], figureodd = 1, figureeven = 1;//largeは多いやつの個数、figureは多いやつの数字
    for(int i=0; i<count_odd.size(); i++){
        if(count_odd[i] > largeodd){
            largeodd = count_odd[i];
            figureodd = i+1;
        }
        if(count_even[i] > largeeven){
            largeeven = count_even[i];
            figureeven = i+1;
        }
    }

    if(figureeven != figureodd){
        cout << n - largeodd - largeeven << endl;
    }

    else{
        int secondodd = vector_secondmax(count_odd), secondeven = vector_secondmax(count_even);

        cout << n -  max(largeeven + secondodd, largeodd + secondeven) << endl;
    }
}

Measured memory_bytes: 1792
s = gets.to_i
ymf = 0
myf = 0
ato = (s % 100).to_i
mae = (s / 100).to_i
 
if 1 <= mae and mae <= 12
  if 1 <= ato and ato <= 12
    puts "AMBIGUOUS"
  else
    puts "MMYY"
  end
else
  if 1 <= ato and ato <= 12
    puts "YYMM"
  else
    puts"NA"
  end
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include <assert.h>
#include <memory>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

const vector<unsigned int> primepool={4294967291, 4294967279, 4294967231, 4294967197};

class RobinKarpMersenne {
public:
	static const uint64_t mod = (1ull<<61) - 1;
	uint64_t modmul(uint64_t a, uint64_t b){
		uint64_t l1 = (uint32_t)a, h1 = a>>32, l2 = (uint32_t)b, h2 = b>>32;
		uint64_t l = l1*l2, m = l1*h2 + l2*h1, h = h1*h2;
		uint64_t ret = (l&mod) + (l>>61) + (h << 3) + (m >> 29) + (m << 35 >> 3) + 1;
		ret = (ret & mod) + (ret>>61);
		ret = (ret & mod) + (ret>>61);
		return ret-1;
	}
	uint64_t modpow(uint64_t a, uint64_t n) {
		uint64_t ret = 1; uint64_t p = a; while (n) { if (n & 1) ret = modmul(ret, p); p = modmul(p, p); n >>= 1; } return ret;
	}
	uint64_t b,binv;
	vector<uint64_t> bpow;
	//vector<uint64_t> invbpow;
	void init(int n, uint64_t base) {
		b=base;
		bpow.reserve(n);
		uint64_t x=1;
		bpow.PB(x);
		for (int i=1;i<n;i++) {
			x=modmul(x,b);
			bpow.PB(x);
		}
		/*
		binv=modpow(b,mod-2);
		x=1;
		invbpow.PB(x);
		for (int i=1;i<n;i++) {
			x=modmul(x,invb);
			invbpow.PB(x);
		}*/
	}
	uint64_t addc(uint64_t hash, uint64_t c, int pos) {
		hash+=modmul(c,bpow[pos]); if (hash>=mod) hash -= mod;
		return hash;
	}
};
RobinKarpMersenne rk;
map<pair<uint64_t,uint64_t>, int> h;
int main(){	
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n; string inp; cin>>n>>inp;
	string s[2]; s[0]=inp.substr(0,n); s[1]=inp.substr(n,n); reverse(s[1].begin(),s[1].end());
  seed_seq seq{
      (uint64_t) chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count(),
      (uint64_t) __builtin_ia32_rdtsc()
  };
  mt19937 rng(seq);
  uint64_t base = uniform_int_distribution<uint64_t>(31, rk.mod-31)(rng);
  rk.init(n,base);
  for (int z=0;z<(1<<n);z++) {
  	pair<uint64_t,uint64_t> hash=MP(0,0);
  	int zeros=0,ones=0;
  	for (int x=0;x<n;x++) {
  		if (0==(z&(1<<x))) hash.fst=rk.addc(hash.fst, s[0][x], zeros++);
  		else hash.snd=rk.addc(hash.snd,s[0][x],ones++);
  	}
  	hash.fst^= ((uint64_t)zeros)<<61;
  	++h[hash];
  }
  ll final=0;
  for (int z=0;z<(1<<n);z++) {
  	pair<uint64_t,uint64_t> hash=MP(0,0);
  	int zeros=0,ones=0;
  	for (int x=0;x<n;x++) {
  		if (0==(z&(1<<x))) hash.fst=rk.addc(hash.fst, s[1][x], zeros++);
  		else hash.snd=rk.addc(hash.snd,s[1][x],ones++);
  	}
  	hash.fst^= ((uint64_t)zeros)<<61;
  	auto it=h.find(hash);
  	if (it!=h.end()) final+=(it->snd);
  }
  printf("%lld\n",final);
}



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

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

int main()
{
    int n, m;
    scanf("%d %d", &n, &m);

    printf("%d\n", max({2 * n - 1, 2 * m - 1, m + n}));

    return 0;
}


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

int main(int argc, const char * argv[]) {
    int n;
    int a;
    
    bool c[8];
    int top_cnt, bottom_cnt;
    
    int min, max;
    
    //初期化
    for (int i = 0; i < 8; i++) {
        c[i] = false;
    }
    top_cnt = bottom_cnt = 0;
    
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a;
        
        if (a >= 1 && a < 400) {
            if (c[0] == false) {
                bottom_cnt++;
                c[0] = true;
            }
        }else if(a >= 400 && a < 800){
            if (c[1] == false) {
                bottom_cnt++;
                c[1] = true;
            }
        }else if(a >= 800 && a < 1200){
            
            if (c[2] == false) {
                bottom_cnt++;
            }
            c[2] = true;
        }else if(a >= 1200 && a < 1600){
            
            if (c[3] == false) {
                bottom_cnt++;
            }
            c[3] = true;
        }else if(a >= 1600 && a < 2000){
            if (c[4] == false) {
                bottom_cnt++;
                c[4] = true;
            }
        }else if(a >= 2000 && a < 2400){
            if (c[5] == false) {
                bottom_cnt++;
                c[5] = true;
            }
        }else if(a >= 2400 && a < 2800){
            if (c[6] == false) {
                bottom_cnt++;
                c[6] = true;
            }
        }else if(a >= 2800 && a < 3200){
            if (c[7] == false) {
                bottom_cnt++;
                c[7] = true;
            }
        }else{
            top_cnt++;
        }
    }
    

    min = bottom_cnt;
    max = bottom_cnt + top_cnt;
    if (bottom_cnt == 0 && top_cnt > 0) {
        min = 1;
    }
    cout << min << ' ' << max << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define reps(i,f,n) for(int i = f; i < n; ++i)
#define rep(i,n) reps(i,0,n)
 
using namespace std;
 
int main(void){
    int ans = 0;
    vector<int> a;
    a.resize(5);
    int m = 10;
 
    rep(i, a.size()){
        cin >> a[i];
        if(a[i] % 10 < m && a[i] % 10 != 0){
            m = a[i] % 10;
        }
    }
    rep(i, a.size()){
        if(a[i] %10 != m){
          if(a[i]%10 != 0){
            ans += a[i] + (10 - a[i] % 10);
          }else{ans += a[i];}
        }else{
            ans += a[i];
            m = 10;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

def solve(N: int, A: "List[int]"):
    ans, t, s = 0, 0, 0
    for h in range(N):
        while t < N and s ^ A[t] == s + A[t]:
            s += A[t]
            t += 1
        ans += t - h
        s -= A[h]
    return ans

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 24992
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-04-12 11:39:06
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rev(x) greater<x>()
#define MOD 1000000007
#define INF 1000000000

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

LL modpower(LL n, LL m, LL mod)
{
    if (m == 0) {
        return 1;
    } else if (m % 2 == 0) {
        LL p = modpower(n, m/2, mod);
        return p*p % mod;
    } else {
        return n*modpower(n, m-1, mod) % mod;
    }
}

LL modinv(LL n, LL mod)
{
    return modpower(n, mod-2, mod);
}

LL modcombination(LL n, LL r, LL mod)
{
    LL ret = 1;

    for (int i = 0; i < r; i++) {
        ret *= (n-i);
        ret %= mod;
        ret *= modinv(i+1, mod);
        ret % mod;
    }

    return ret % mod;
}

int gcd(int k, int l)
{
    if (l > 0) return gcd(l, k%l);
    else return k;
}

struct UnionFind
{
    vector<int> par;

    UnionFind(int n) : par(n) {
        for (int i = 0; i < n; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

map<int, int> sum;

int count(int n)
{
    if (n < 10) return n;
    else return n%10 + count(n/10);
}

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

    for (int i = 1; i <= n; i++)
        sum[i] = count(i);
    
    int ans = 0;
    for (const auto &x : sum) {
        int p = x.first;
        int q = x.second;

        if (q >= a && q <= b) ans += p;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 768
//Moh_K_Imar .......
//24/08/2020  ... 5,42 .
//Ya Rab....
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
int main(){
    char a;
    cin>>a;
    if(a=='z')cout<<'a'<<endl;
    else
    cout<<char(a+1)<<endl;
    
    return 0;
}



Measured memory_bytes: 3548