akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int n,q;
  while(cin>>n>>q,n+q) {
    vector<int> v(101);
    REP(i,n) {
      int m;
      cin >> m;
      REP(j,m) {
        int x;
        cin >> x;
        v[x]++;
      }
    }
    int ma=0;
    int ans =0;
    REP(i,101) {
      if (v[i]>=q&&v[i]>ma) {
        ma = v[i];
        ans = i;
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 0
import sys
input = sys.stdin.buffer.readline

def main():

    n, m, s = map(int, input().split())
    g = [[] for i in range(n*2501)]
    for i in range(m):
        u, v, a, b = map(int, input().split())
        u, v = u-1, v-1
        for j in range(2501):
            k = j-a
            if 0 <= k <= 2500:
                g[u+n*j].append((b, v+n*k))
                g[v+n*j].append((b, u+n*k))

    for i in range(n):
        c, d = map(int, input().split())
        for j in range(2501):
            k = j+c
            if 0 <= k <= 2500:
                g[i+n*j].append((d, i+n*k))

    import heapq
    INF = 10**18
    def dijkstra_heap(s, edge, n):
        d = [INF] * n
        used = [True] * n #True: not used
        d[s] = 0
        used[s] = False
        edgelist = []
        for e in edge[s]:
            heapq.heappush(edgelist,e)
        while len(edgelist):
            minedge = heapq.heappop(edgelist)
            if not used[minedge[1]]:
                continue
            v = minedge[1]
            d[v] = minedge[0]
            used[v] = False
            for e in edge[v]:
                if used[e[1]]:
                    heapq.heappush(edgelist,(e[0]+d[v],e[1]))
        return d

    s_ = 0+min(s, 2500)*n
    d = dijkstra_heap(s_, g, n*2501)
    #print(d)
    for i in range(1, n):
        min_ = INF
        for j in range(2501):
            k = i+n*j
            min_ = min(min_, d[k])
        print(min_)

if __name__ == '__main__':
    main()


Measured memory_bytes: 105980
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using lli = long long;

int N;
lli K, A[200'010], F[200'010];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> N >> K;
	for (int i = 0; i < N; ++i)
		cin >> A[i];
	for (int i = 0; i < N; ++i)
		cin >> F[i];
	sort(A, A + N);
	sort(F, F + N);
	reverse(F, F + N);
	lli l = 0, r = A[N - 1] * F[0], ans;
	while (l <= r)
	{
		lli m = l + r >> 1;
		lli cnt = 0;
		for (int i = 0; i < N; ++i)
		{
			if (A[i] * F[i] > m)
			{
				cnt += A[i] - (m / F[i]);
			}
		}
		if (cnt > K) l = m + 1;
		else { ans = m; r = m - 1; }
	}
	cout << ans;
}

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

int main(){
	// sengen
	string s;
	// nyuryoku
	cin >> s;
	int q;
	cin >>q;
	// keisan
	string right,left;
	int rev = 0;
	for(int i=0;i<q;i++){
		int t,f;
		char c;
		cin >> t;
		if(t == 1){
			rev++;
		}else{
			cin >> f >> c;
			if(rev%2 == 0){
				if(f == 1){
					left = c + left;
				}else{
					right = right + c;
				}
			}else{
				if(f == 1){
					right = right + c;
				}else{
					left = c + left;
				}
			}
		}
	}
	s = left + s + right;
	if(rev%2 == 1){
		reverse(s.begin(),s.end());
	}
	// syutsuryoku
	cout << s;
}

Measured memory_bytes: 1512
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		final int N = scanner.nextInt();
		final int A = scanner.nextInt();
		final int B = scanner.nextInt();
		String s = scanner.next();
		int a = 0, b = 0;
		for(int i = 0; i < N; ++i){
			if(s.charAt(i) == 'a'){
				if(a+b < A+B){
					++a;
					System.out.println("Yes");
					continue;
				}
			}
			else if(s.charAt(i) == 'b'){
				if(a+b < A+B && (b<B || b == 0)){
					++b;
					System.out.println("Yes");
					continue;
				}
			}
			System.out.println("No");
		}
		scanner.close();
	}

}


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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}


int main() {
      int n;cin >> n;
      string s;cin >> s;
       int tem=0;
      rep(i,s.length()) {
         tem=0;
          if(s[i]+n>'Z')tem=26;
          cout << char(s[i]+n-tem);;
      }
      cout << endl;
    
      return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

using namespace std;

int main() {
  int a, b, mx;
  cin >> a;
  for (int i = 0; i < 4; i++) {
    cin >> b;
  }
  mx = b - a;
  cin >> a;
  string ret;
  if (a < mx) ret = ":(";
  else ret = "Yay!";
  cout << ret << endl;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

template<class V, int ME> class BIT {
public:
    V bit[1<<ME];
    V total(int e) {V s=0;e++;while(e) s+=bit[e-1],e-=e&-e; return s;}
    void add(int e, V val) {e++; while(e<=1<<ME) bit[e-1]+=val,e+=e&-e;}
};

ll N;
vector<ll> a(101010);
ll offset = 101010;

ll count(vector<ll> &S){
	ll M = S.size();
	BIT<ll, 18> bi;
	REP(i, 1<<18) bi.bit[i] = 0;
	bi.add(S[0]+offset, 1);
	ll res = 0;
	for(int j=1;j<M;j++){
		res += bi.total(S[j]+offset);
		bi.add(S[j]+offset, 1);
	}
	return res;
}

ll kosu(ll x){
	vector<ll> bin(N), binsum(N+1);
	REP(i, N) bin[i] = (a[i]>=x ? 1 : -1);
	binsum[0] = 0;
	REP(i, N) binsum[i+1] = binsum[i] + bin[i];
	return count(binsum);
}

ll naive(){
	vector<ll> meds;
	REP(i, N)REP(j, N){
		if(i<=j){
			vector<ll> tmp;
			for(int k=i;k<=j;k++) tmp.push_back(a[k]);
			sort(tmp.begin(), tmp.end());
			meds.push_back(tmp[tmp.size()/2]);
		}
	}
	sort(meds.begin(), meds.end());
	vprint(meds);
	return meds[meds.size()/2];
}

int main(){
	cin >> N;
	REP(i, N) cin >> a[i];

	ll ma = -1;
	REP(i, N) if(ma<a[i]) ma = a[i];

	ll l = -1;
	ll u = ma+1;

	ll comb = ((N+1)*N)/2;

	while(u-l>1){
		ll m = (l+u)/2;
		if(kosu(m)>=(comb+1)/2){
			l = m;
		}else{
			u = m;
		}
	}
	cout << u-1 << endl;
    return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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



void solve() {
	int N; cin >> N;
    vec a(N+1);
    rep(i, N){
        cin >> a[i+1];
    }
    vec res(N+1);
    for(int i=N; i>=1; i--){
        int p=0;
        for(int j = i*2; j<=N; j += i) p += res[j];
        int s = p%2;
        if(a[i] == s) res[i] = 0;
        else res[i] = 1;
    }

    vec ans;
    rep(i, N+1){
        if(res[i]) ans.push_back(i);
    }
    
    cout << ans.size() << endl;
    rep(i, ans.size()){
        cout << ans[i];
        if(i != ans.size()-1) cout << " ";
        else cout << endl;
    }
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7288
#include<cstdio>
#include<vector>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<map>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=1e5+5;
const int MOD=1e9+7;
const double EPS=1e-12;
template <class T>
bool sf(T &ret){ //Faster Input
    char c; int sgn; T bit=0.1;
    if(c=getchar(),c==EOF) return 0;
    while(c!='-'&&c!='.'&&(c<'0'||c>'9')) c=getchar();
    sgn=(c=='-')?-1:1;
    ret=(c=='-')?0:(c-'0');
    while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0');
    if(c==' '||c=='\n'){ ret*=sgn; return 1; }
    while(c=getchar(),c>='0'&&c<='9') ret+=(c-'0')*bit,bit/=10;
    ret*=sgn;
    return 1;
}
int sign(double x){
    return fabs(x) < EPS ? 0 : x>0 ? 1 : -1 ;
}
ll a[N]; /// ll=long long int
map<ll,ll> mp;
int main(void){
    ll n;
    sf(n);
    for(int i=1;i<=n;i++)   sf(a[i]);
    for(int i=1;i<=n;i++)   mp[a[i]]++;
    ll ans=0;
    for(auto t : mp){
        ll num=t.F;
        ll cnt=t.S;
        if(cnt==num)    continue;
        else if(cnt>num)    ans+=cnt-num;
        else    ans+=cnt;
    }
    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
 int main() {
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   int n;
   cin>>n;
   int h[n];
   for(auto i=0;i<n;i++) {
     cin>>h[i];
   }
   int a[n]={0},j=0;
   for(auto i=0;i<n-1;i++) {
     if(h[i]>=h[i+1])
       a[j]++;
     else
       j++;
   }
   cout<<*max_element(a,a+n);
   return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

void conv_str(char *str)
{
	int i;
	
	i = 0;
	while (str[i] != '\0'){
		if (str[i] == ' ' || str[i] == '.'){
			str[i] += 0;
		}
		else if (str[i] != 'z'){
			str[i] += 1;
		}
		else {
			str[i] = 'a';
		}
		i++;
	}
}

int main(void)
{
	char str[100];
	int next_flag;
	int i, j;
	
	while (scanf("%[a-z .]", str) != EOF){
		getchar();
		
		next_flag = 0;
		for (i = 0; i < 26; i++){
			for (j = 0; j < strlen(str) - 2; j++){
				if (strncmp(&str[j], "this", 4) == 0 || strncmp(&str[j], "that", 4) == 0 || strncmp(&str[j], "the", 3) == 0){
					printf("%s\n", str);
					next_flag = 1;
					break;
				}
			}
			if (next_flag == 1){
				break;
			}
			conv_str(str);
		}
		memset(str, '\0', sizeof(str));
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// #define int long long

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

typedef pair<int, int> pint;

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front

#define MOD (1000 * 1000 * 1000 + 7)

pair<ll, ll> min_max(vector<ll> &sum, int l, int r) {
    int left = l;
    int right = r-1;
    // cout << "l = " << l;
    // cout << ", r = " << r;
    // cout << endl;

    pair<ll, ll> ret;
    ll min_abs = 1000L * 1000L * 1000L * 1000L * 1000L;
    while (left <= right) {
        int mid = (left + right) >> 1;
        ll l_sum = sum[mid] - sum[l-1];
        ll r_sum = sum[r] - sum[mid];

        // cout << "left = " << left;
        // cout << ", right = " << right;
        // cout << ", mid = " << mid;
        // cout << ", l_sum = " << l_sum;
        // cout << ", r_sum = " << r_sum;
        // cout << endl;

        if (abs(r_sum - l_sum) < min_abs) {
            min_abs = abs(r_sum - l_sum);
            ret.first = min(r_sum, l_sum);
            ret.second = max(r_sum, l_sum);
        }

        if (l_sum < r_sum) {
            left = max(mid, left+1);
        } else {
            right = min(mid, right-1);
        }
    }

    return ret;
}

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

    vector<ll> sum(N+1, 0);
    REP(i, N) {
        ll a;
        cin >> a;
        sum[i+1] = sum[i] + a;
    }

    ll ans = 1000L * 1000L * 1000L * 1000L * 1000L;

    REPS(i, N-3) {
        // cout << "i = " << i << endl;
        pair<ll, ll> mm_left = min_max(sum, 1, i+1);
        // cout << mm_left.first << ", " << mm_left.second << endl;
        pair<ll, ll> mm_right = min_max(sum, i+2, N);
        // cout << mm_right.first << ", " << mm_right.second << endl;

        ll _min = min(mm_left.first, mm_right.first);
        ll _max = max(mm_left.second, mm_right.second);
        ans = min(ans, _max - _min);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>

static const int N = 100;

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
  
  int key;
  for(i=0;i<=n-1;i++){
    key=A[i];
    j=i-1;
    while(j>=0&&A[j]>key){
      A[j+1]=A[j];
      j--;
      A[j+1]=key;
    }
    
    int m;
    for ( m = 0; m <= n-1; m++ ){
      if ( m > 0 ) printf(" ");
      printf("%d", A[m]);
    }
    printf("\n");
  }
  
  return 0;
}

Measured memory_bytes: 604
#include <iostream>
using namespace std;
int main()
{
  int _a, b, _c, d;
  cin >> _a, cin >> b, cin >> _c, cin >> d;

  int a = min(_a, _c);
  int c = max(_a, _c);

  if (d >= abs(a - c)) {
    cout << "Yes" << endl;
    return 0;
  }

  if ((b >= c) && (b <= a)) {
    cout << "No" << endl;
    return 0;
  }

  if ( (d >= abs(a-b) && (d >= abs(b-c)) ) ) {
    cout << "Yes" << endl;
    return 0;
  }

  cout << "No" << endl;
  return 0;
  
}

Measured memory_bytes: 256
//***Little by little one travels far***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

 vector<pair<ll,ll>> v[20];
ll needed[20];
int main()
{
    ll n,m=0;
    cin>>n;
    
    for1(i,n){
        ll p;
        cin>>p;
        while(p--){
        ll a,b;
        cin>>a>>b;
        v[i].pb(mp(a,b));
        }
    }

    for(ll i=0;i<pow(2,n);i++){
        ll c=0,f=1;
        for(ll j=0;j<n;j++){
            if(((1<<j)&i)!=0) needed[j+1]=1;
            else   needed[j+1]=0;
        }
        for(ll j=0;j<n;j++){
            if(((1<<j)&i)!=0){
                for(auto x:v[j+1]){
                    if(x.se!=needed[x.fi]){
                        f=0;
                        break;
                    }
                }
            }
            if(f==0) break;
        }

        if(f==0) continue;
        for(ll k=1;k<=n;k++)
        if(needed[k]==1)
        c++;
    m=max(m,c);
    //cout<<m<<" ";
    }
    cout<<m;
}

Measured memory_bytes: 256
n = int(input())
S = str(input())

d = {}
for i in range(n):
    if S[i] not in d:
        d[S[i]] = 1
    else:
        d[S[i]] += 1

mod = 10**9+7
ans = 1
for v in d.values():
    ans *= (v+1)
    ans %= mod
ans -= 1
print(ans%mod)


Measured memory_bytes: 39408
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl
using namespace std;
int max_int = 2147483647;
int prime = 10e9+7;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<auto>& a,int n);
double PI = 3.14159265358979;
int n;




signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    if(a>k){
        print(k);
        return 0;
    }
    int tmp = k - a;
    if(b >= tmp){
        print(a);
        return 0;
    }
    tmp -= b;
    print(a-tmp);
    
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}

//key以上の初めてのitr
int nibul(auto a,auto b){return lower_bound(All(a),b) - a.begin();}
//key以下の最後のitr
int nibuu(auto a,auto b){return upper_bound(All(a),b) - a.begin()-1;}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


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

using namespace std;

int main(){
    int N;  cin >> N;
    vector<int> A(N);

    for(int i=0; i<N; i++){
        cin >> A.at(i);
    }

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

    int res = 0;
    int cnt = 1;
    for(int i=0; i<N-1; i++){
        if(A.at(i+1) == A.at(i)){
            cnt++;
        }else{
            if(cnt%2 == 1) res++;
            cnt = 1;
        }

        if(i == N-2 && cnt%2 == 1) res++;
    }

    cout << res << endl;
}

Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp make_pair
#define F first
#define S second
#define pf pop_front
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
typedef long long ll;
const ll mod=1e9+7;
const ll maxn=3005;
const ll inf=1e9+7;
double dp[maxn][maxn];
double p[maxn];
ll n;
int main()
{
    while(cin>>n)
    {
        rep1(i,n) cin>>p[i];
        dp[0][0]=1;
        rep1(i,n)
        {
            dp[i][0]=dp[i-1][0]*(1-p[i]);
            for(int j=1;j<=i;j++)
            {
                dp[i][j]=dp[i-1][j]*(1-p[i])+dp[i-1][j-1]*p[i];
            }
        }
        double ans=0;
        rep1(i,n)
        {
            if(i>n-i) ans+=dp[n][i];
        }
        cout<<fixed<<setprecision(9)<<ans<<"\n";
    }
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

int mod(int a, int b){return (a%b+b)%b;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void judge(bool b){b?Yes():No();}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef map<int, int> mint;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstr;

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    vint a(m), b(m);
    mint mp;
    int mx;
    rep(i, m)
        cin >> a[i] >> b[i];


    rep(i, m){
        mp[a[i]]++;
        mp[b[i]]++;
    }
    rep(i, n){
        ppp(mp[i+1]);
    }



    return 0;
}


Measured memory_bytes: 256
# ARC100D

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))


# import numpy as np
import bisect
n = int(input())
a = list(map(int, input().split()))
# a = np.array(list(map(int, input().split())))
ca = [None] * n #ca[i] = a0~aiの和
s = 0
for i,num in enumerate(a):
    s += a[i]
    ca[i] = s
# ca = a.cumsum()

def sub(l, start, end, init):
    if len(l)==0:
        return 0,0
    elif end-start==1:
        return 0,l[start]-init
    target = (init + l[end-1])/2
    i = bisect.bisect_right(l, target)
    p1 = (l[i]-init, l[end-1]-l[i])
    p2 = (l[i-1]-init, l[end-1]-l[i-1])
    if abs(p1[0] - p1[1]) < abs(p2[0] - p2[1]):
        return min(p1), max(p1)
    else:
        return min(p2), max(p2)
best = 10**15
for i in range(1,n):
    p1 = sub(ca, 0, i, 0)
    p2 = sub(ca, i, n, ca[i-1])
    nn = max(p1[1]-p2[0], p2[1]-p1[0], p1[1]-p1[0], p2[1]-p2[0])
#     print(p1,p2,nn)
    best = min(best, nn)
print(best)

Measured memory_bytes: 25676
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
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);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	int n;
	cin>>n;
	int a[n];
	forci(0,n)	cin>>a[i];
	int sum=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++)
		{
			sum+=a[i]*a[j];
		}
	}
	cout<<sum<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}






Measured memory_bytes: 3660
IDENTIFICATION DIVISION.
PROGRAM-ID. NOMURA-B.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
  SELECT STDIO ASSIGN TO KEYBOARD. 
*>
DATA DIVISION.
FILE SECTION.
FD STDIO.
01 T          PIC X(200000).
*>
WORKING-STORAGE SECTION.
01 OUT        PIC X(200000).
*>
PROCEDURE DIVISION.
  OPEN INPUT STDIO.
  READ STDIO.         
  CLOSE STDIO.
*>
  MOVE T TO OUT
  INSPECT OUT REPLACING ALL '?' BY 'D'.
*>
  DISPLAY FUNCTION TRIM(OUT)
  STOP RUN.


Measured memory_bytes: 5156
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;

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

Node *root, *NIL;

void insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;
  z =(Node *)malloc(sizeof(Node));
  z->key = k;
  z->l = NIL;
  z->r = NIL;
  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->l;
    }
    else{
      x=x->r;
    }
  }
    z->p=y;
  if(y==NIL){
    root=z;
  }
  else{
    if(z->key < y->key){
      y->l=z;
    }
    else{
      y->r=z;
    }
  }
}


void inorder(Node *u){
  if(u==NIL)
    return;
  inorder(u->l);
  printf(" %d",u->key);
  inorder(u->r);
}
void preorder(Node *u){
  if(u==NIL)
    return;
  printf(" %d",u->key);
  preorder(u->l);
  preorder(u->r);

}


int main(){
  int n, i, x;
  string com;
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    cin>>com;
    if ( com == "insert" ){
      scanf("%d", &x);
      insert(x);
    } else if ( com== "print" ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } 
  }
  return 0;
}



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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

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

const lli mod = 1e9 + 7;
const lli N = 1000 + 10;

map<int, int> f(int n, map<int, int>& cnt)
{
  for (int i = 2; i <= n; ++i) {
    while (n % i == 0) {
      n /= i;
      ++cnt[i];
    }
  }
  return cnt;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    map<int, int> m;
    for (int i = 2; i <= n; ++i) {
      f(i, m);
    }
    // each (i, m) cout << i << endl;
    lli x = 1;
    each (i, m) {
      x = (x * (i.second + 1)) % mod;
    }
    cout << x << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define RI(a) scanf("%d",&a)
#define RII(a,b) scanf("%d%d",&a,&b)
#define RIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define REP(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
//}}}
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;

int n,m;
string s;

int main()
{
	cin>>n>>m;
	cout<<(1<<m)*(100*(n-m)+1900*m);
	return 0;
}












Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]

A.sort(reverse=True)

if N % 2 == 1:
    if A[-1] == 0:
        A.pop()
    else:
        print(0)
        quit()

for i in range(0, N - 2, 2):
    if A[i] != N - i - 1 or A[i] != A[i + 1]:
        print(0)
        quit()

print(2 ** (N // 2) % (10 ** 9 + 7))


Measured memory_bytes: 13880
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
int low[maxn];
int vis[maxn],lv[maxn];
vector<int> E[maxn];
set<pair<int,int> > bridge;
map<pair<int,int>,int> V;
/* 
1.if there are parellel lines, can't use fa.

 */
void dfs(int now,int curlv,int fa){
    low[now]=curlv;
    lv[now]=curlv;
    vis[now]=1;
    int son_cnt=0;
    for(auto v:E[now]){
        //1.tree edge to fa, or back edge visited by now's descendant
        if(v==fa)continue;
        //2.back edge to now's ancestor
        if(vis[v]) low[now]=min(low[now],lv[v]);
        //3.tree edge to son.
        else{
            son_cnt++;
            dfs(v,curlv+1,now);
            low[now]=min(low[now],low[v]);
            if(low[v]>lv[now]){
                bridge.insert({min(now,v),max(now,v)});
            }
        }
    }
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    rep(i,1,m){
        int x,y;
        cin>>x>>y;
        E[x].push_back(y);
        E[y].push_back(x);
    }
    rep(i,0,n-1)if(!vis[i])dfs(i,0,-1);
   // rep(i,0,n-1)debug(i),debug(low[i]);
    for(auto e:bridge)cout<<e.first<<' '<<e.second<<endl;
}
/* 
4 4
0 1
0 2
1 2
2 3
 */


Measured memory_bytes: 28284
N = int(input())
H = [int(x) for x in input().split()]

cnt=0
reg=[]
for i in range(1, len(H)):
    if H[i-1] >= H[i]:
        cnt += 1
    else:
        reg.append(cnt)
        cnt = 0
if cnt != 0:
    reg.append(cnt)
if reg!=[]:
    print(max(reg))
else:
    print(0)

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

string substring(string text, long low, long digit){
    string output = "";
    for(long i = low; i < low + digit; i++){
        output.push_back(text[i]);
    }
    return output;
}

int main(){
    string S;
    cin >> S;
    S.pop_back();
    while(substring(S, 0, S.size() / 2) != substring(S, S.size() / 2, S.size() / 2) || S.size() % 2 == 1){
        S.pop_back();
    }
    cout << S.size() << endl;
}

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

using namespace std;

#define FOR(v, b, e)   for (int v = (b); v < (e); ++v)
#define REP(v, n)      FOR(v, 0, n)

int main () {
	string O, E;
	cin >> O >> E;
	REP (i, O.length() + E.length()) {
		if ((i % 2) == 0) {
			cout << O[(int)(i / 2)];
		} else {
			cout << E[(int)(i / 2)];
		}
	}
	cout << endl;
}

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

using namespace std;


#define ff				first
#define ss				second
#define int				long long
#define pb				push_back
#define mp				make_pair
#define pii				pair<int,int>
#define vi				vector<int>
#define mii 			map<int,int>
#define	pqb				priority_queue<int>
#define pqs				priority_queue<int,vi,greater<int> >
#define setbits(x)		__builtin_popcountll(x)
#define zrobits(x)		__builtin_ctzll(x)
#define mod				1000000007
#define inf 			1e18
#define ps(x,y)			fixed<<setprecision(y)<<x
#define mk(arr,n,type)	type *arr = new type[n]
#define w(x)			int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)


void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}


bool isPrime(int n)
{
	if (n <= 1)
		return false;
	if (n <= 3)
		return true;
	if (n % 2 == 0 || n % 3 == 0)
		return false;
	for (int i = 5; i * i <= n; i += 6)
	{
		if (n % i == 0 || n % (i + 2) == 0)
			return false;

	}
	return true;
}

vector<int> Sieve(int n)
{
	bool prime[n + 1];
	memset(prime, true, sizeof(prime));
	for (int i = 2; i * i <= n; i++)
	{
		if (prime[i])
		{
			for (int j = i * i; j <= n; j += i)
			{
				prime[j] = false;
			}
		}
	}
	vi primes;
	for (int i = 2; i <= n; i++)
	{
		if (prime[i])
			primes.pb(i);
	}
	return primes;
}



set<int> primeFactors(int  n)
{
	set<int> factors;
	while (n % 2 == 0)
	{
		n /= 2;
		factors.insert(2);

	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		while (n % i == 0)
		{
			factors.insert(i);
			n /= i;
		}
	}
	if (n > 2)
		factors.insert(n);
	return factors;
}


// int power(int x, unsigned int y, int p)
// {
// 	int res = 1;     // Initialize result

// 	x = x % p; // Update x if it is more than or
// 	// equal to p

// 	if (x == 0) return 0; // In case x is divisible by p;

// 	while (y > 0)
// 	{
// 		// If y is odd, multiply x with result
// 		if (y & 1)
// 			res = (res * x) % p;

// 		// y must be even now
// 		y = y >> 1; // y = y/2
// 		x = (x * x) % p;
// 	}
// 	return res;
// }
// Graph------------------------------------------------------------------------


int32_t main()
{
	FIO;
	// c_p_c();
// --------------------------------------------------

	int n;
	cin >> n;
	mk(arr, n, int);
	int total = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
		total += arr[i];
	}
	int m; cin >> m;
	int j, k;
	for (int i = 0; i < m; i++)
	{
		cin >> j >> k;
		cout << total + k - arr[j - 1] << endl;
	}
}





Measured memory_bytes: 256
n = int(input())
data = list(map(int, input().split()))
count = 0
for i in range(n):
    if data[i] < 0:
        count += 1
    data[i] = abs(data[i])
if count % 2 == 0:
    print(sum(data))
else:
    print(sum(data) - min(data) * 2)

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

int main(){
	int money = 100000;
	int n;

	cin >> n;

	for(int i = 0; i < n; i++){
		money = int(money * 1.05);
		if(money%1000 != 0){
			money += 1000 - money%1000;
		}
	}
	cout << money << endl;
	
	return(0);
}

Measured memory_bytes: 1160
n = int(input())
h = list(map(int, input().split()))
dp = [10 ** 18 for _ in range(n)]
dp[0] = 0
for i in range(1, n):
    dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print(dp[-1])


Measured memory_bytes: 13924
#include<bits/stdc++.h>
using namespace std;
int a[200005];
int main()
{
	int i,n,k;
	scanf("%d %d",&n,&k);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(i=1;i<=n-k;i++)
	{
		if(a[i]<a[i+k])
			printf("Yes\n");
		else 
			printf("No\n");
	}
}

Measured memory_bytes: 4432
program main
	character*100 sa,sb,sc
    integer::a=1,b=1,c=1
    integer::t=1,i=0
    read *,sa
    read *,sb
    read *,sc
    do
    	if (t==1) then
        	i=1
          	if(a==len_trim(sa)+1) then
              	print *, 'A'
                exit
            else if(sa(a:a)=='a') then
               	a=a+1
            else if(sa(a:a)=='b') then
              	a=a+1
                t=2
            else !then
            	a=a+1
                t=3
            end if
        else if(t==2) then
            if(b==len_trim(sb)+1) then
               	print *, 'B'
                stop
            else if(sb(b:b)=='a') then
               	b=b+1
                t=1
            else if(sb(b:b)=='b') then
              	b=b+1
            else! then
             	b=b+1
                t=3
            end if
		else if(t==3) then
            if(c==len_trim(sc)+1) then
               	print *,'C'
                stop
            else if(sc(c:c)=='a') then
              	c=c+1
                t=1
            else if(sc(c:c)=='b') then
              	c=c+1
                t=2
            else! then
              	c=c+1
            end if
        end if
   	end do
end program main

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

int main() {
  
  int n;
  cin >> n;
  
  vector<int> c(n);
  vector<int> v(n);
  int sum = 0;
  for(int i = 0; i < n; ++i) 
    cin >> c[i];
  for(int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    sum += max(0, c[i] - a);
  }
  
  cout << sum << endl;
  
  return 0;
}
  
  
    
    

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
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
 *
 * @author HossamDoma
 */
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);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {

            int n = in.nextInt();
            int odds = 0, evens = 0, fours = 0;

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

                int x = in.nextInt();

                if (x % 4 == 0)
                    fours++;
                else if (x % 2 == 0)
                    evens++;
                else
                    odds++;
            }

            if (fours >= odds || (fours + 1 == odds && n == odds + fours))
                out.println("Yes");
            else
                out.println("No");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 37732
#include<stdio.h>
 
int main(void)
{
 char a[11];
 int i,l,count1=0,count2=0;
 scanf("%s",a);
  for(l=0;l<11;l++){
   for(i=l;i<11;i++){
     if(a[i]=='A'||a[i]=='C'||a[i]=='G'||a[i]=='T')
      count1++;
     else
      break;
   }
   
      if(count1>count2)
       count2=count1;
    count1=0;
   }
     
  printf("%d",count2);
  
 return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main(void){
   int a[10000],min,max,n,i;
   long long sum = 0;
   scanf("%d",&n);
   for(i=0;i<n;i++){
       scanf("%d",&a[i]);
       sum += a[i];
   }
   max = min = a[0];
   for(i=1;i<n;i++){
       if(a[i]> max)max=a[i];
       if(a[i]<min)min=a[i];
   }
   printf("%d %d %lld\n",min,max,sum);
   
   return 0;
}


Measured memory_bytes: 2124
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;


// [0,n] までに存在する回文数の個数
int f(int n){
	
	int a[5];
	for(int i = 0; i < 5; i++){
		a[i] = n % 10;
		n /= 10;
	}

	int b[5];
	for(int i = 0; i < 5; i++){
		b[i] = a[i];
	}
	b[0] = b[4];
	b[1] = b[3];
	
	int ret = (a[4] * 10 + a[3]) * 10;
	int na = a[1] * 10 + a[0];
	int nb = b[1] * 10 + b[0];
	if(na >= nb) ret += a[2] + 1;
	else ret += a[2];
	
	return ret;
}

int main(){

	int a, b; cin >> a >> b;
	cout << f(b) - f(a - 1) << endl;
	return 0;
}

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

template<typename T>
class BIT {
    public:
    int n;
    vector<T> bit; // i: [1,n]
    BIT(int size) {
        n = size + 1;
        bit = vector<T>(n+1,0);
    }

    void add(int i, T x) {
        while (i <= n) {
            bit[i] += x;
            i += i & -i;
        }
    }

    T sum(int i) {
        T ret = 0;
        while (i > 0) {
            ret += bit[i];
            i -= i & -i;
        }
        return ret;
    }

    T range(int l, int r) {
        return sum(r) - sum(l-1);
    }
};

ll n;
vector<int> a;

bool check(int x) {
    vector<int> b(n);
    rep(i,n){
        b[i] = (a[i] >= x ? +1 : -1);
    }
    vector<ll> s(n+1);
    rep(i,n){
        s[i+1] = s[i] + b[i];
    }
    vector<pair<ll, int>> vp(n+1);
    rep(i,n+1) {
        vp[i] = {s[i],i};
    }
    sort(all(vp));

    // 小さい順に1..n+1の連番を振る
    vector<ll> c(n+1);
    rep(i,n+1){
        c[vp[i].second] = i+1;
    }

    ll result = 0;
    BIT<int> bit(n+1);
    rep(i,n+1){
        result += bit.sum(c[i]);
        bit.add(c[i], 1);
    }

    return (n*(n+1)/2 + 1)/2 <= result;
}

int main(void) {
    cin >> n;
    a.resize(n);
    vector<int> meds(n);

    rep(i,n){
        cin >> a[i];
        meds[i] = a[i];
    }
    sort(all(meds));
    int l = 0, r = n;
    while (l + 1 < r) {
        int mid = (l+r)/2;
        if (check(meds[mid])) {
            l = mid;
        } else {
            r = mid;
        }
    }
    cout << meds[l] << endl;
    return 0;
}


Measured memory_bytes: 4992
s = str(input())
t = str(input())
count = 0
if len(s) == len(t) == 3:
    s.upper()
    t.upper()
    slist = list(s)
    tlist = list(t)
    for i in range(len(s)):
        if slist[i] == tlist[i]:
            count += 1
        else:
            continue
    print(count)
else:
    print('hoge!')

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

int main()
{
    int n;
    string s,ans;

    cin >> n >> s;

    ans = "";
    rep(i,n-1) {
        if (s[i] != s[i + 1]) {
            ans += s[i];
        }
    }
    ans += s[n];

    std::cout << ans.size() << endl;

    return 0;
}


Measured memory_bytes: 3764
#include <iostream>

using namespace std;

int main()
{
    int n;
    int a, b, c;

    cin >> n;

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

      cin >> a >> b >> c;

      if((a*a) == (b*b + c*c) || (b*b) == (c*c + a*a) || (c*c) == (a*a + b*b))
          cout << "YES" << endl;
      else
          cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<int, vector<int>, greater<int> > gpq; //逆順priority_queue
typedef priority_queue<int> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    string S;
    cin>>S;
    cout<<S[0]<<S[1]<<S[2]<<endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

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

#define MAX_V 100000

#define MOD 1000000007L
#define INF 2147483647

signed main() {
	string w;
	cin >> w;
	int a[28] = {};
	for (int i = 0; i < w.size(); ++i) {
		a[w[i] - 'a']++;
	}
	bool ok = true;
	for (int i = 0; i < 28 && ok; ++i) {
		ok = a[i] % 2 == 0;
	}

	cout << (ok ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A=[]
for _ in range(N):
    A.append(list(map(int, input().split())))
#print(N,M,C,B,A)

count=0
for code in A:
    if sum([code[j]*B[j] for j in range(M)]) > -C:
        count+=1
print(count)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

int main()
{
  static ll INF = 1000000000000;
  int N, W;
  cin >> N >> W;
  vector <int> w(N);
  vector <int> v(N);  
  vector <vector<ll> > dp(N+1, vector<ll>(200009, INF));
  
  for( int i=0;i<N;i++ )
    cin >> w[i] >> v[i];

  dp[0][0] = 0;
  for( int i=0;i<N;i++ )
    {
      for( int j=0;j<100009;j++ )
	if(dp[i][j] >= 0)
	  {
	    dp[i+1][j+v[i]] = min(dp[i+1][j+v[i]], dp[i][j]+w[i]);
	    dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
	  }
    }

  ll mv = 0;
  for( int i=0;i<100009;i++ )
    {
      if( dp[N][i]<=W )
	mv = i;
    }
  cout << mv << endl;
}


Measured memory_bytes: 159744
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		double p2=0;
		double p3=0;
		double value = 0;
		double max=0;
		double Dp1=0;
		double Dp2=0;
		double Dp3=0;
		//sc.useDelimiter("\\s");
		for(int i=0; i<n; i++){
			x[i] = sc.nextInt();
		}	
		for(int i=0; i<n; i++){
			y[i] = sc.nextInt();
		}
		for(int i=0; i<n; i++){
			Dp1 += (double)Math.abs(x[i]-y[i]);
			p2 += Math.pow(x[i]-y[i],2.0);
			p3 += Math.pow(Math.abs(x[i]-y[i]),3.0);
		}
		Dp2 = Math.sqrt(p2);
		Dp3 = Math.cbrt(p3);		
		for(int i=0; i<n; i++){
			value = (double)Math.abs(x[i]-y[i]);
			if(value>max)
				max = value;
		}
		System.out.printf("%.6f\n",Dp1);
		System.out.printf("%.6f\n",Dp2);
		System.out.printf("%.6f\n",Dp3);
		System.out.printf("%.6f\n",max);

	}
}

Measured memory_bytes: 26716
#include <stdio.h>
#include <string.h>
int main(){
  int N;
  char S[10001];
  scanf("%d %s", &N, S)+1;
  int len = strlen(S);
  for(int i=0; i < len; i++){
    S[i] += N;
    if (S[i] > 'Z')S[i] -= 26;
  }
  printf("%s\n", S);

  return 0;
}


Measured memory_bytes: 128
//
//  header_useful.h
//  c++_acm
//
//  Created by 李弘辰 on 2019/7/23.
//  Copyright © 2019 李弘辰. All rights reserved.
//

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <utility> // pair
#include <map>
#include <iostream>
#include <sstream>
#include <algorithm> // sort
#include <string>
#include <stack>
#include <queue>
#include <fstream>
#include <bitset>

using namespace std;

#define ll long long
#define uchar unsigned char
#define ushort unsigned short
#define uint unsigned int
#define ulong unsigned long
#define ull unsigned long long

#define INT_INF 0x7fffffff

#define pi acos(-1)

#define mx(a,b) (a) > (b) ? (a) : (b)
#define mn(a,b) (a) < (b) ? (a) : (b)
#define mem(a,b) memset(a,b,sizeof(a))
#define fre(a) freopen(a,"r",stdin)

#define cio ios::sync_with_stdio(false); // Do not use it with "scanf" and other c input!

#define itn int
#define nit int
#define inr int
#define mian main
#define ednl endl
#define fro for
#define fir for
#define reutrn return
#define retunr return
#define reutnr return


/* header_useful_h */


int main()
{
    ll x;
    scanf("%lld",&x);
    ll k = 100;
    ll f = 0;
    while (k < x) {
        k *= 1.01;
        f ++;
    }
    printf("%lld\n",f);
    return 0;
}


Measured memory_bytes: 3228