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

const int N = 100054;

int n, K, ans;
int p[N], fc[N], nc[N], f[N];

inline void up(int &x, const int y) {x < y ? x = y : 0;}
inline void link(int x, int px) {nc[x] = fc[px], fc[px] = x;}

void dfs(int x, int dep = 0) {
	for (int y = fc[x]; y; y = nc[y]) dfs(y, dep + 1), up(f[x], f[y] + 1);
	if (dep > 1 && f[x] >= K - 1) ++ans, f[x] = -1;
}

int main() {
	scanf("%d%d%d", &n, &K, &ans), ans = ans != 1;
	for (int i = 2; i <= n; ++i) scanf("%d", p + i), link(i, p[i]);
	dfs(1), printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 6528
import java.util.*

fun main(args: Array<String>) {
  val (n, m) = readLine()!!.split(' ').map(String::toInt)
  val sc = IntArray(n) { -1 }
  repeat(m) {
    val (s, c) = readLine()!!.split(' ').map(String::toInt)
    if (sc[s - 1] != -1 && sc[s - 1] != c) {
      println(-1)
      return
    }
    sc[s - 1] = c
  }
  if (n != 1 && sc[0] == 0) {
    println(-1)
    return
  }
  if (sc[0] == -1) {
    sc[0] = if (n == 1) 0 else 1
  }
  for (i in 1 until n) {
    if (sc[i] == -1) sc[i] = 0
  }
  println(sc.joinToString(""))
}


Measured memory_bytes: 38348
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll W, H, X, Y;

int main() {
	scanf("%lld %lld %lld %lld", &W, &H, &X, &Y);
	double ans1 = (W * H) / 2.0;
	ll ans2 = (X * 2 == W && Y * 2 == H) ? 1 : 0;
	printf("%0.12lf %lld\n", ans1, ans2); 
	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

# 正解者
A = [int(input()) for _ in range(Q)]

# ポイント
P = [0]*(N)

for a in A:
  P[a-1] +=1

for p in P:
  if K - Q + p > 0:
    print('Yes')
  else:
    print('No')
  



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

int main() {
  int n,x;
  cin >> n >> x;
  int a,b,c;
  int count = 0;
  
  while (n != 0 || x != 0){
    count = 0;
  for (int i = 1; i < n - 1; i++) {
    a = i;
    
    for (int j = i + 1; j < n; j++) {
      b = j;
    
      for (int k = j + 1; k < n + 1; k++) {
        c = k;
        if (a + b + c == x) {
          count ++;
        }
      }
    }
  }
  cout << count << endl;
  cin >> n >> x;
  }
}





Measured memory_bytes: 3092
#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;
}
void print() { cout << "\n"; }
template <class T> void print(const T &x) { cout << x << "\n"; }
template <class T, class... Args> void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
template <class T> void printVector(const vector<T> &v) {
    for(const T &x : v) {
        cout << x << " ";
    }
    cout << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr 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 n, m;
    cin >> n >> m;
    vector<int> h(n);
    for(int i = 0; i < n; i++) {
        cin >> h[i];
    }
    vector<bool> good(n, true);
    for(int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if(h[a] < h[b]) {
            good[a] = false;
        }
        if(h[b] < h[a]) {
            good[b] = false;
        }
        if(h[a] == h[b]) {
            good[a] = good[b] = false;
        }
    }
    print(count(ALL(good), true));
}

Measured memory_bytes: 3672
N = int(input())
x = []
y = []
h = []

for i in range(N):
    xt, yt, ht = map(int, input().split())
    x.append(xt)
    y.append(yt)
    h.append(ht)
    if ht != 0:
        cx = xt
        cy = yt
        htt = ht

for j in range(101):
    for k in range(101):
        H = htt + abs(cx - j) + abs(cy - k)
        for i in range(N):
            if h[i] != max(H - abs(x[i] - j) - abs(y[i] - k), 0):
                break
        if i == N - 1 and h[i]== max(H - abs(x[i] - j) - abs(y[i] - k), 0):
            print(j, k, H)


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

template<typename T>
istream& operator >> (istream& istr, vector<T>& vec){
    for(T& x: vec) istr >> x;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& vec){
    if(!vec.empty()){
        ostr << vec.front();
        for(auto itr = ++vec.begin(); itr != vec.end(); itr++)
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

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

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
// vll x(n); x[i]=a;
typedef vector<pair<ll,ll>> vpll;
// vpll x(n); x[i]={a,b}; x[i].first/second;
typedef vector<vector<ll>> vvll;
// vvll x(m,vi(n)); x[i][j]=a;

#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));


int main(){
    ll n, q, a, b;
    cin >> n >> q;
    vvll v(n);
    vll ans(n);
    REP(i,n) ans[i] = 0;

    REP(i,n-1){
        cin >> a >> b;
        v[a-1].push_back(b-1);
    }

    REP(i,q){
        cin >> a >> b;
        ans[a-1] += b;
    }
    REP(i,n){
        REP(j,v[i].size()) ans[v[i][j]] += ans[i];
    }

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


Measured memory_bytes: 14848
#include<stdio.h>
int main(){
  int n,ccnt,p,c,i,j,A[51],B[51],C[51];

  while(1){
    scanf("%d%d",&n,&ccnt);
    if(n==0 && ccnt==0)break;
    
    for(i=0;i<n;i++){
      A[i]=n-i;
    }
    
    for(i=0;i<ccnt;i++){
      scanf("%d%d",&p,&c);

      for(j=0;j<c;j++){
	B[j]=A[p-1+j];
      }
      for(j=0;j<p-1;j++){
	C[j]=A[j];
      }
      for(j=0;j<c;j++){
	A[j]=B[j];
      }
      for(j=0;j<p-1;j++){
	A[c+j]=C[j];
      }
    }
    printf("%d\n",A[0]);
  }
  return 0;
}

Measured memory_bytes: 600
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

struct edge {
  int t,c;
  edge(){}
  edge(int t,int c):t(t),c(c){}
};

struct state {
  int n,cap,c;
  state(){}
  state(int n,int cap,int c):n(n),cap(cap),c(c){}
  bool operator>(const state& e)const{
    return c>e.c;
  }
};

char s[22],t[22];
char c[3000][22], d[3000][22];
char st[333][22];
int w[3000];
vector<edge> g[6011];
//vector<vector<edge> > g;

vector<bool> sta;
//vector<vector<int> > cost;
unsigned short cost[6011][2001];
int from,to;

int main(void)
{
  int n,m,cap;
  for(;;) {
    scanf("%d%d%d",&n,&m,&cap); if(n+m+cap==0)break;
    {
      vector<string> node;
      scanf("%s%s",s,t);
      node.push_back(s);
      node.push_back(t);
      for( int i = 0; i < n; i++ ) {
        scanf("%s%s%d",c[i],d[i],w+i);
        node.push_back(c[i]);
        node.push_back(d[i]);
      }
      for( int i = 0; i < m; i++ ) {
        scanf("%s",st[i]);
        node.push_back(st[i]);
      }
      sort(node.begin(),node.end());
      node.erase(unique(node.begin(),node.end()),node.end());
      int sz = node.size();
      //g.clear();
      //cost.clear();
      sta.clear();
      //g.resize(sz,vector<edge>());
      //cost.resize(sz,vector<int>(cap*10+1));
      sta.resize(sz);
      for( int i = 0; i < sz; i++ ) {
        sta[i] = false;
        g[i].clear();
        for( int j = 0; j <= cap*10; j++ ) {
          //cost[i][j] = 1919810893;
          cost[i][j] = 65535;
        }
      }
      for( int i = 0; i < n; i++ ) {
        int a = lower_bound(node.begin(),node.end(),c[i])-node.begin();
        int b = lower_bound(node.begin(),node.end(),d[i])-node.begin();
        g[a].push_back(edge(b,w[i]));
        g[b].push_back(edge(a,w[i]));
      }
      for( int i = 0; i < m; i++ ) {
        sta[lower_bound(node.begin(),node.end(),st[i])-node.begin()] = true;
      }
      from = lower_bound(node.begin(),node.end(),s)-node.begin();
      to = lower_bound(node.begin(),node.end(),t)-node.begin();
    }
    priority_queue<state,vector<state>,greater<state> > q;
    q.push(state(from,cap*10,0));
    cost[from][cap*10] = 0;
    int res = -1;
    while( !q.empty() ) {
      state p = q.top(); q.pop();
      if( p.n == to ) {
        res = p.c;
        break;
      }
      if( cost[p.n][p.cap] < p.c ) continue;
      for( int i = 0; i < int(g[p.n].size()); i++ ) {
        edge& e = g[p.n][i];
        int c = p.c+e.c;
        int ncap = p.cap-e.c;
        if( ncap < 0 ) continue;
        if( sta[e.t] ) ncap = cap*10;
        if( cost[e.t][ncap] > c ) {
          cost[e.t][ncap] = c;
          q.push(state(e.t,ncap,c));
        }
      }
    }
    printf("%d\n",res);
  }
  return 0;
}

Measured memory_bytes: 51348
l=[100000 for i in range(100001)]
l[0]=0
dif=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]
for i in range(1,100001):
	for j in dif:
		if j>i:
			break
		l[i]=min(l[i],l[i-j]+1)
n=int(input())
print(l[n])

Measured memory_bytes: 3956
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    string s;
    read(s);

    print((s != string(3, s[0])) ? "Yes" : "No");

    return 0;
}


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

main(){
	int n,k,ipt,ans;
	cin>>n>>k;
	ans = 0;
	for(int i=1;i<=n;i++){
		cin>>ipt;
		if(ipt >= k)
			ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 

    int main(){
        lint n,d,a;
        cin>>n>>d>>a;
        d*=2;
        P p[n];
        rep(i,n){
            lint x,h;
            cin>>x>>h;
            p[i]={x,h};
        }
        vector<lint> x;
        vector<lint> h;
        sort(p,p+n);
        rep(i,n){
            x.push_back(p[i].first);
            h.push_back(p[i].second);
        }
        lint damage[n+1];
        fill(damage,damage+n+1,0);
        lint ans=0;
        rep(i,n){
        if(i!=0)damage[i]+=damage[i-1];
        lint add=max(0LL,(h[i]-damage[i]+a-1)/a);
        ans+=add;
        auto it=upper_bound(all(x),x[i]+d);
        lint g=it-x.begin();
        damage[i]+=add*a;
        damage[g]-=add*a; 
        }
        cout<<ans<<endl;

    }
      

Measured memory_bytes: 11284
#include<iostream>
#include<vector>
using namespace std;
typedef long long int llint;
int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	vector<int>b(n);
	int x = 0, y = n - 1;
	for (int i = 0;i < n;i++) {
		cin >> a[i];
	}
	for (int i = 0;i < n;i++) {
		if (i % 2 == 0) {
			b[x] = a[n - 1 - i];
			x++;
		}
		else {
			b[y] = a[n - 1 - i];
			y--;
		}
	}
	for (int i = 0;i < n;i++) {
		cout << b[i];
		if (i != n - 1) {
			cout << " ";
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3712
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define HASH_SIZE 8000
#define HASH_FNUM 7
#define HASH_CNUM 4
#define STRL 13

typedef struct node node;

struct node{
  node *next;
  char str[STRL];
};

typedef struct{
  node* first[HASH_SIZE];
}hash_table;

void hasht_init(hash_table *ht){
  
  node *nul = malloc(sizeof(node));
  int i;
  
  nul->next = nul;
  strcpy(nul->str, "");
  
  for(i = 0; i < HASH_SIZE; i++){
    ht->first[i] = nul;
  }
}

int hash(char *ch){
  int len = strlen(ch);
  int i, l, k;
  int sum = 0;
  
  k = 1;
  
  if(len < HASH_FNUM){
    l = len;
  }else l = HASH_FNUM;
  
  for(i = 0; i < l; i++){
    if(ch[i] == 'G'){
      sum = sum + k;
    }else if(ch[i] == 'C'){
      sum = sum + k * 2;
    }else if(ch[i] == 'T'){
      sum = sum + k * 3;
    }
    k = k * 4;
  }
  
  return sum % HASH_SIZE;
}

void insert(hash_table *ht, char *ch){

  int hashn = hash(ch);
  node *newn = malloc(sizeof(node));
  node *oldn = ht->first[hashn];
  
  strcpy(newn->str, ch);
  newn->next = oldn;
  ht->first[hashn] = newn;
  
}

void find(hash_table *ht, char *ch){

  int hashn = hash(ch);
  int flag = 1;

  node *n = ht->first[hashn];

  while(n->next != n){

    if(strcmp(ch, n->str) == 0){
      flag = 0;
      break;
    }else{
      n = n->next;
    }
  }

  if(flag){
    printf("no\n");
  }else{
    printf("yes\n");
  }
}

void debug(hash_table *ht){
  int i;
  node *n;
  for(i = 0; i < HASH_SIZE; i++){
    printf("%d:",i);
    n = ht->first[i];
    while(n != n->next){
      printf("%s ",n->str);
      n = n->next;
    }
    printf("\n");
  }
}

int main(){

  hash_table ht;
  int i,n;
  char str1[7];
  char str2[13];

  hasht_init(&ht);

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    scanf("%s %s",str1, str2);

    if(strcmp(str1, "insert") == 0){
      insert(&ht, str2);
    }else if(strcmp(str1, "find") == 0){
      find(&ht, str2);
    }
    //debug(&ht);
  }

  return 0;
}

Measured memory_bytes: 18500
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(void){
	int a[100],n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=n-1;i>=0;i--){
		if(i!=n-1) printf(" ");
		printf("%d",a[i]);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2060
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <tuple>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<n; ++i)

template <class T>
void print_answer(vector<T>& a) {
    for (auto& x : a)
        cout << x << endl;
}

int main() {
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    int n=0;
    while (a >= b) {
        b *= 2;
        ++n;
        if (n > k) {
            cout << "No";
            return 0;
        }
    }
    while (b >= c) {
        c *= 2;
        ++n;
        if (n > k) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


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

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(ki, k) {
        vector<int> b(n + 1);
        rep(i, n) {
            int l = max(0, i - a[i]);
            int r = min(i + a[i] + 1, n);
            b[l]++;
            b[r]--;
        }
        rep(i, n) b[i + 1] += b[i];
        b.pop_back();
        if(a == b) break;
        a = b;
    }
    rep(i, n) cout << a[i] << endl;
    return 0;
}


Measured memory_bytes: 4840
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll m;
    cin >> m;
    ll d[m], c[m];
    ll ans = -1;
    ll sum = 0;
    rep(i,m){
        cin >> d[i] >> c[i];
        ans += c[i];
        sum += d[i] * c[i];
    }
    sum--;
    ans += sum / 9;
    

    

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


Measured memory_bytes: 3328
h, w = map(int, raw_input().split())
A = [list(raw_input()) for i in xrange(h)]

x = y = 0
A[0][0] = '.'
while 1:
    if y+1 < h and A[y+1][x] == '#':
        A[y+1][x] = '.'
        y += 1
    elif x+1 < w and A[y][x+1] == '#':
        A[y][x+1] = '.'
        x += 1
    else: break
if y == h-1 and x == w-1 and all(all(f is '.' for f in e) for e in A):
    print "Possible"
else:
    print "Impossible"


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

int main(void)
{
	int n;

	cin >>n;
	vector<int> a(n);

	for (int i=0; i<n; ++i) cin >> a[i];
	reverse(a.begin(), a.end());
	for (int i=0; i<n; ++i) {
		cout<< a[i];
		i != n-1 ? cout << " ": cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1196
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
//*********************************************DO IT NOW****************************************************************
#include<bits/stdc++.h> 
#include<random>
#define int long long   
#define pp pair<int,int> 
#define ss second 
#define ff first 
#define pb push_back
#define mod 1000000007
#define pi 3.14159265359
#define mk(arr,n,type)  type *arr=new type[n];
#define sl s1.length();
#define yes cout<< "YES"<<endl
#define no  cout<< "NO"<<endl
#define all(v) (v).begin(),(v).end()
#define s(v)   sort(v,v+n)
#define  mt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define read(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define print(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" "
#define for1(i,a,n)  for(int i=0;i<n;i++)
using namespace std;
//**********************************************DO IT NOW***************************************************************
void fastio()
{  
  #ifndef ONLINE_JUDGE
  freopen("INPUT.txt","r",stdin);
  freopen("OUTPUT.txt","w",stdout); 
  #endif
  ios_base :: sync_with_stdio(false); 
  cin.tie(NULL) ; 
  cout.tie(NULL);
}
int dp[101][1001],ans1=1e9,dp1[1000001];
int num[10];
int a[1000000];
signed main()
{   
    fastio();
    int t=1;
   // cin>>t;
    while(t--)
    { 
        char c;
        cin>>c;
        c++;
        cout<<c;
    }
}
// 🍪 🍪 🍪


Measured memory_bytes: 3648
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
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; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll a,b,c,k;cin>>a>>b>>c>>k;
    ll sum = 0;
    if (k-a<=0) {
        sum = k;
        ct(sum);
        return  0;
    }
    if (k-a>0 && k-a-b<=0) {
        sum = a;
        ct(sum);
        return 0;
    }
    if (k-a-b>0) {
        sum = a;
        k=k-a-b;
        rep(i,k) {
            sum -= 1;
        }
        ct(sum);
    }    
}


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

const int N = 4005, M = 1e9+7;
int C[N][N];

int dp[N][N];
int st[N][N], en[N][N];

inline int sum(int a, int b) {
    return a+b>=M ? a+b-M:a+b;
}

void pre() {
    for (int i=0; i<N; i++) C[i][0] = C[0][i] = 1;
    for (int i=1; i<N; i++)
        for (int j=1; j<N; j++)
            C[i][j] = sum(C[i-1][j], C[i][j-1]);
}

int main() {
    pre();
    long long ans = 0;

    int n;
    cin>>n;

    for (int i=1; i<=n; i++) {
        int x, y;
        cin>>x>>y;
        ans -= C[x+x][y+y];

        st[N/2-x][N/2-y] ++;
        en[N/2+x][N/2+y] ++;
    }

    for (int i=1; i<N; i++) {
        for (int j=1; j<N; j++) {
            dp[i][j] = sum(dp[i][j-1], sum(dp[i-1][j], st[i][j]));
            ans = ans + 1LL * en[i][j] * dp[i][j];
        }
    }

    ans = (ans%M+M)%M;
    if (ans%2)  ans +=M;
    cout<<ans/2<<endl;
}






Measured memory_bytes: 175436
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {

            var N = cin.ReadInt;
          	var ans 
              = cin.ReadIntArray(N)
              .Min(x => {
                var c = 0;
              	while(x % 2 == 0 && x != 0){x /= 2;++c;}
                return c;
              });
            
            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define maxs(a,b) a=max(a,b)
#define mins(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){
   
    int n;cin>>n;
    vl a(n);
    ll l=0;
    rep(i,n){
        cin>>a[i];
        l+=a[i];
    }

    ll h=0;
    ll ans=0;
    rep(i,n){
        h+=a[i];
        if(h*2>=l){
            ans=2*h-l;
            h-=a[i];
            mins(ans,l-2*h);
            break;
        }
    }

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

vector<int> G[100001],Q[100001],group[100000];
vector<bool> seen;
int cnt(0);
int group_num[100001] = {0};
void dfs(int v) {
  group[cnt].push_back(v); 
  group_num[v] = cnt;
  seen[v] = true;
  for (auto next_v : G[v]) { 
      if (seen[next_v]) continue;
      dfs(next_v); // 再帰的に探索
  }
}

int main(){
  int N,M,K;
  cin>>N>>M>>K;
	seen.assign(N, false);
  for (int i(0);i<M;i++){
    int a,b;
    cin>>a>>b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for (int i(1);i<=N;i++){
    if (seen[i]) continue; // v が探索済みだったらスルー
    dfs(i); // v が未探索なら v を始点とした DFS を行う
    cnt++;
  }
  int block[100001] = {0};
  for (int i(0);i<K;i++){
    int a,b;
    cin>>a>>b;
    if (group_num[a] == group_num[b]){
      block[a]++;
      block[b]++;
    }
  }
  int renketu[100001] = {0};
  for (int i(0);i<cnt;i++){
    for (auto j:group[i]){
      renketu[j] = int(group[i].size());
    }
  }
  for (int i(1);i<=N;i++){
    cout << renketu[i] - int(G[i].size()) - 1 - block[i]<<" ";
  }
  cout << endl;
  return 0;
}



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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

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

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

    int N, K;
    cin >> N >> K;

    int j;

    vi val(N);
    for (int i = 0; i < N; i++) {
        cin >> val[i];
        if (val[i] == 1) j = i;
    }

    cout << (N - 1 + (K - 2)) / (K - 1) << endl;

    return 0;
}



Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String s = scanner.nextLine();
		String t = scanner.nextLine();

		String[] ss = s.split("");
		String[] tt = t.split("");

		int count = 0;
		for (int i = 0; i < s.length(); i++) {

			if (!ss[i].equals(tt[i]) ) {
				ss[i] = tt[i];
				count++;
//				System.out.print(i+ " "+ss[i]+ " "+tt[i]);
			}

		}
		System.out.println(count);

	}

}


Measured memory_bytes: 67188
//35
#include<iostream>

using namespace std;

int main(){
  for(double d;cin>>d,d>0;d++){
    int i=d*16;
    if(i>=1<<12||d*16-i){
      cout<<"NA"<<endl;
    }else{
      for(int j=0;j<12;j++){
	if(j==8){
	  cout<<'.';
	}
	cout<<!!(i&1<<(11-j));
      }
      cout<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main()
{
    int cell[128][128];
    int r, c, i, j, t;
    scanf("%d%d", &r, &c);
    for(i=0; i<r; i++) {
        for(j=0; j<c; j++) {
            scanf("%d", &cell[i][j]);
        }
    }
    for(i=0; i<r; i++) {
        for(j=0; j<c; j++) {
            t=cell[i][j];
            cell[r][j]+=t;
            cell[i][c]+=t;
            cell[r][c]+=t;
        }
    }
    for(i=0; i<=r; i++) {
        for(j=0; j<c; j++) {
            printf("%d ", cell[i][j]);
        }
        printf("%d\n", cell[i][c]);
    }
    return 0;
}

Measured memory_bytes: 656
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

// ref : https://drken1215.hatenablog.com/entry/2019/07/01/111500

int seen[100010];
ll dist[100010][3];
vector<int> g[100010];

int main(){
    int n, m;
    cin >> n >> m;
    rep(i, m){
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
    }
    rep(i, 100010) rep(j, 3) dist[i][j] = -1; 
    int s, t;
    cin >> s >> t;
    s--, t--;

    dist[s][0] = 0;
    queue<pair<int,int>> que;
    que.push({s, 0});

    while(!que.empty()){
        P now = que.front();
        que.pop();
        int v = now.first;
        int parity = now.second;
        for (auto nv : g[v]) {
            int np = (parity + 1) % 3;
            if (dist[nv][np] == -1) {
                dist[nv][np] = dist[v][parity] + 1;
                que.push({nv, np});
            }
        }
    }
    
    if(dist[t][0] != -1) cout << dist[t][0] / 3 << endl;
    else cout << -1 << endl;

    return 0;
}


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

int main(int argc, char const *argv[])
{
	int n;
	cin >> n ;
	int A[n],B[n],c[n];
	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		A[i] = a;
		B[i] = a; 
	}
	sort(B,B+n);
	reverse(B,B+n);
	for (int i = 0; i < n; ++i)
	{
		if (A[i] != B[0])
		{
			c[i] = B[0];
		}
		else
			c[i] = B[1];
	}
	for (int i = 0; i < n; ++i)
	{
		cout << c[i] <<"\n";
	}
	return 0;
}

Measured memory_bytes: 3968
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node {int p,l,r;};

Node T[MAX];
int n,D[MAX];

void print(int u){
	int i,c;
	cout<<"node "<<u<<": ";
	cout<<"parent = "<<T[u].p<<", ";
	cout<<"depth = "<<D[u]<<", ";
	
	if(T[u].p==NIL)cout<<"root, ";
	else if(T[u].l==NIL)cout<<"leaf, ";
	else cout<<"internal node, ";
	
	cout<<"[";
	
	for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
		if(i)cout<<", ";
		cout<<c;
	}
	cout<<"]"<<endl;
}

void rec(int u,int p){
	D[u]=p;
	if(T[u].r!=NIL)rec(T[u].r,p);
	if(T[u].l!=NIL)rec(T[u].l,p+1);
}

int main(){
	int i,j,d,v,c,l,r;
	cin>>n;
	for(i=0;i<n;i++)T[i].p=T[i].l=T[i].r=NIL;
	
	for(i=0;i<n;i++){
		cin>>v>>d;
		for(j=0;j<d;j++){
			cin>>c;
			if(j==0)T[v].l=c;
			else T[l].r=c;
			l=c;
			T[c].p=v;
		}
	}
	for(i=0;i<n;i++){
		if(T[i].p==NIL)r=i;
	}
	
	rec(r,0);
	
	for(i=0;i<n;i++)print(i);
	
	return 0;
}



Measured memory_bytes: 7684
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long int ll;

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

ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}

int main()
{
	while(true) {
	
		int n, m;
		int p[20];
		ll sum = 0, count = 0;
	
		scanf("%d%d", &n, &m);
		
		if(n == 0 && m == 0)
			break;
	
		for(int i = 0; i < m; ++i)
			scanf("%d", &p[i]);
			
		count = (ll)n;
		sum = (ll)(1 + n) * n / 2;
		
		for(int x = 1; x < (1 << m); ++x) {
		
			ll c = 0, d = 1, idx = 0;
		
			for(int y = 1; y < (1 << m); y <<= 1, ++idx) {
			
				if(x & y) {
					d = lcm(d, p[idx]);
					++c;
					//printf("%d ", p[idx]);
				}
			}
			
			ll dc = n / d;
			ll ds = (1 + dc) * dc / 2 * d;
			
			//printf(": %d %d\n", c & 1 ? -dc : dc, c & 1 ? -ds : ds);
			if(c & 1) count -= dc, sum -= ds;
			else count += dc, sum += ds;
		}
		
		//printf("%lld %lld %f\n", sum, count, count != 0 ? (double)sum / (double)count : 0.0);
		printf("%f\n", count != 0 ? (double)sum / (double)count : 0.0);
	}
	
	return 0;
}

Measured memory_bytes: 796
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,k;
  cin >> n >> k;
  int d[100];
  for (int i=0; i<n; i++) {
    cin >> d[i];
  }
  int a;
  for (int i=0; i<n; i++) {
    a += 2*min(d[i],k-d[i]);
  }
  cout << a << endl; 
}

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

using  namespace  std;

#define PI              acos(-1.0)
#define lcm(a,b)        (a * (b / __gcd(a,b)))
#define en '\n'

#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);
#define Infi                0x3f3f3f3f

const int dx[] = {+1,-1,+0,+0};                         // 4 X directions
const int dy[] = {+0,+0,+1,-1};                         // 4 Y directions
const int dx8[] = {+0,+0,+1,-1,-1,+1,-1,+1};            // King X Moves
const int dy8[] = {-1,+1,+0,+0,+1,+1,-1,-1};            // King Y Moves
const int kx[] = {-2, -2, -1, -1,  1,  1,  2,  2};      // Knight X Moves
const int ky[] = {-1,  1, -2,  2, -2,  2, -1,  1};      // Knight Y Moves



int  Set    (int N,int pos) {return N=N | (1<<pos);}    /// turn a bit on
int  reset  (int N,int pos) {return N= N & ~(1<<pos);}  /// turn a bit off
bool check  (int N,int pos) {return (bool)(N & (1<<pos));} /// check, if a bit is on or not

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif

typedef long long int           ll;
typedef unsigned long long int  llu;


int main(void){

   // READ_IN;
    string s;
    cin >> s;
    string sx=s;
    reverse(sx.begin(),sx.end());

    int f = (s.size()-1)/2;
    int se = (s.size()+3)/2;

    string ff;
    string ss;

    for(int i=0;i<f;i++){

        ff.push_back(s[i]);

    }
    for(int i=se-1;i<s.size();i++){
        ss.push_back(s[i]);
    }

    //trace(ff);
    //trace(ss);

    string FF;
    string SS;

    FF = ff;
    SS = ss;

    reverse(FF.begin(),FF.end());

    reverse(SS.begin(),SS.end());

    if(FF==ff && SS==ss && sx==s && s.size()%2!=0){
        cout << "Yes" << endl;

    }
    else{
        cout << "No" << endl;
    }


    return 0;
}




Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

  	Int N; cin >> N;
    Int res = N;
    if (N%2 != 0) res *= 2;
    cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int a,b;
    cin >> a >> b;
    if(b%a==0){cout << a+b <<endl;}
    else cout << b-a << endl;
    return 0;

}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
 
using namespace std;
 
#define pai 3.14159265359
#define mod 1000000007

int main()
{
    int n, m;
    cin >> n >> m;
    bool canredin[100001];
    int ballnum[100001];
    canredin[1] = true;
    ballnum[1] = 1;
    for(int i = 2; i <= n; i++){
        canredin[i] = false;
        ballnum[i] = 1;
    }
    for(int i = 0; i < m; i++){
        int x, y;
        cin >> x >> y;
        if(canredin[x]) canredin[y] = true;
        if(ballnum[x] == 1) canredin[x] = false;
        ballnum[x]--;
        ballnum[y]++;
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        if(canredin[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

vector<long long> ret;

void divisor(long long n) {
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return;
}

int main(){
  ll ans=0;
  ll n; cin>>n;
  divisor(n);
  for(auto x : ret){
    if(x>=(n/x-1)){
      continue;
    }else{
      ans+=n/x-1;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3588
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
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;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

int main(void){
    // char ;
    ll n,T,ans=0;
    scanf("%lld%lld",&n,&T);
    ll t[n],now=0;
    rep(i,0,n){
        scanf("%lld",&t[i]);
    }
    rep(i,1,n){
        ans+=min2(T,t[i]-now);
        now=t[i];
    }
    ans+=T;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1664
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;

char S[100010];
int pos[100010];
int ans[100010] = {};

signed main()
{
	cin >> S;

	int N = strlen(S);

	int cur = 0;
	for (int i = 0; i < N; i++)
	{
		if (S[i] == 'L')
		{
			for (int j = cur; j < i; j++)
			{
				if (S[j] == 'R')
				{
					pos[j] = i - j;
				}
			}
			cur = i;
		}
	}

	cur = N - 1;
	for (int i = N - 1; i >= 0; i--)
	{
		if (S[i] == 'R')
		{
			for (int j = cur; j > i; j--)
			{
				if (S[j] == 'L')
				{
					pos[j] = j - i;
				}
			}
			cur = i;
		}
	}

	for (int i = 0; i < N; i++)
	{
		if (S[i] == 'R')
		{
			if (pos[i] % 2 == 0)
			{
				ans[i + pos[i]]++;
			}
			else
			{
				ans[i + pos[i] - 1]++;
			}
		}
		else
		{
			if (pos[i] % 2 == 0)
			{
				ans[i - pos[i]]++;
			}
			else
			{
				ans[i - pos[i] + 1]++;
			}
		}
	}

	for (int i = 0; i < N; i++)
	{
		cout << (i ? " " : "") << ans[i];
	}
	cout << endl;
}











Measured memory_bytes: 2176
/*
 
Coded and Decoded by : Yash Kapoor
 
*/
#include <bits/stdc++.h>
using namespace std;
 
#define ll          long long
#define ld          long double
#define pb          push_back
#define pf          push_front
#define mp          make_pair
#define pll         pair<ll,ll>
#define vl          vector<ll>
#define sl          set<ll> 
#define vll         vector<pll>
#define ml          map<ll,ll>
#define mll         map<pll,ll>
#define all(a)      a.begin(),a.end()
#define x           first
#define y           second
#define sz(x)       (ll)x.size()
#define dl          '\n'
#define why         (ll)1000000007
//#define why         (ll)998244353
#define lp(i,a,b)   for(ll i=a;i<b;++i)
#define lpr(i,a,b)  for(ll i=a;i>=b;i--)
#define lpd(i,x)    for(auto i:x)
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll inf = 1e18;
ld pi = 3.141592653589;
ll mod = why;
ll fast_power(ll base,ll power,ll mod){
    ll result=1;
    while(power){
        if(power%2)
        result=(result*base)%mod;
        base=(base*base)%mod;
        power/=2;
    }
    return result;
}
 
ll inverse(ll base,ll mod){
    return fast_power(base,mod-2,mod);
}

ll solve(){
    ll x; cin>>x;
    for(ll i = 1;i*i<=x;i++){
        if(x%i == 0){
            ll j = 0;
            while(j <= 1000){
                if(pow(j,5) - pow(j-i,5) == x){
                    cout<<j<<" "<<j-i;
                    return 0;
                }
                j++;
            }
        }
    }
    return 0;
}

int main(){
    ios
    ll t=1; 
    //cin>>t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 4048
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fir first
#define sec second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e6 + 5;
const int MOD = 1e9 + 7;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

inline ll read() {
    ll res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}

int main() {
    int n, a, b;
    std::cin >> n >> a >> b;
    if ((b - a) & 1) puts("Borys");
    else puts("Alice");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int search(char *word, char *sentence);

int main() {
    char W[11], T[1001];
    int count = 0;

    scanf("%s", W);

    while(1) {
        scanf("%s", T);
        if (strcmp(T, "END_OF_TEXT") == 0) break;
        if (search(W, T) == 0) count++;
    }

    printf("%d\n", count);

    return 0;
}

int search(char* word, char* sentence) {
    int i = 0;

    if (strlen(word) != strlen(sentence)) return -1;

    while(word[i] != '\0') {
        sentence[i] = tolower(sentence[i]);
        if (word[i] - sentence[i] != 0) {
            return -1;
        }
        i++;
    }

    return 0;
}


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

using i64 = int64_t;

string remove_zero(string s){
    int cnt = 0;
    while(s[cnt] == '0')cnt++;
    s.erase(0, cnt);
    return s;
}

int main(){
    string s;
    cin >> s;
    i64 ans = 0;
    for(int i=0;i<=(int)s.size();++i){
        string a = (i == 0 ? "0" : s.substr(0,i));
        string b = (i == s.size() ? "0" : s.substr(i));
        i64 z = stoi(a), w = stoi(b);
        //cerr << a << " " << b << endl;
        if((w+z)%2 != 0 || w-z < 0 || (w-z)%2 != 0)continue;
        i64 x = (w + z) / 2, y = (w - z) / 2;
        string aa = remove_zero(to_string(x - y));
        string bb = remove_zero(to_string(x + y));
        if(bb == "")bb = "0";
        //cerr << "!!!" << s << " " << aa << " " << bb << endl;
        if(s != aa+bb)continue;
        ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3288
#include <iostream>
#include <climits>
#include <vector>
#include <numeric>
#include <cmath>

int main() {
  int n;
  std::cin >> n;
  std::vector<int64_t> a;
  for (int i = 0; i < n; i++) {
    int64_t v;
    std::cin >> v;
    a.push_back(v);
  }

  int64_t min = LONG_MAX;  
  int64_t total = 0;
  for (int v : a) {
    total += v;
  }
  int64_t x = 0;
  int64_t y = total;
  for (auto it = a.begin(); it < a.end() - 1; it++) {
    x += *it;
    y -= *it;
    int64_t diff = std::abs(x - y);
    if (diff < min)
      min = diff;
  }
  std::cout << min << std::endl;
  return 0;
}


Measured memory_bytes: 2420