akhauriyash/Code-Regression huggingface dataset:
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<double>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Tree = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<vector<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll n, m;
	cin >> n >> m;
	VecB ac(n, false);
	Vec wa(n);
	rep(i, m){
		ll p;
		string s;
		cin >> p >> s;
		p--;
		if(s == "AC") ac[p] = true;
		else if(!ac[p]) wa[p]++;
	}
	ll cntA = 0, cntW = 0;
	rep(i, n) if(ac[i]){
		cntA++;
		cntW += wa[i];
	}
	coVec({cntA, cntW});

	return 0;
}


Measured memory_bytes: 1152
def main():
    N = int(input())
    if N < 1000:
        print(1000 - N)
        return
    N = str(N)
    N = N[-3] + N[-2] + N[-1]
    N = int(N)
    if N == 0:
        print(0)
        return
    
    print(1000 - N)
    
main()

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

namespace ABC162D
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string input = Console.ReadLine();
            string[] S = new string[N];
            for (int i = 0; i < N; i++)
            {
                S[i] = input.Substring(i, 1);
            }
            long count = 0;
            for(int i = 1; 2 * i < N; i++)
            {
                for(int j = 0; j + i + i < N; j++)
                {
                    if (S[j] != S[j + i] & S[j] != S[j + i + i])
                    {
                        if (S[j + i] != S[j + i + i])
                        {
                            count += 1;
                        }
                    }
                }
            }
            Array.Sort(S);
            Queue<long> Q = new Queue<long>();
            for(int i = 0; i < N - 1; i++)
            {
                if (S[i] != S[i + 1])
                {
                    Q.Enqueue(i + 1);
                }
            }
            if (Q.Count == 2)
            {
                long b = Q.Dequeue();
                long g = Q.Dequeue() - b;
                long r = N - g - b;
                //Console.WriteLine(r);
                //Console.WriteLine(g);
                //Console.WriteLine(b);
                long ans = r * g * b - count;
                Console.WriteLine(ans);
            }
            else
            {
                Console.WriteLine(0);
            }
        }
    }
}


Measured memory_bytes: 28060
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
VI G[100011];

VI ord;
int D[100011];
int par[100011];
int bfs(int s) {
    ord.clear();
    ord.push_back(s);
    memset(D, -1, sizeof D);
    D[s] = 0;
    par[s] = s;
    REP (i_, N) {
	int v = ord[i_];
	EACH (e, G[v]) if (D[*e] == -1) {
	    D[*e] = D[v] + 1;
	    par[*e] = v;
	    ord.push_back(*e);
	}
    }

    return max_element(D, D+N) - D;
}

bool online[100011];

void MAIN() {
    scanf("%d", &N);
    REP (i, N-1) {
	int x, y;
	scanf("%d%d", &x, &y);
	x--; y--;
	G[x].push_back(y);
	G[y].push_back(x);
    }

    const int x = bfs(0);
    const int y = bfs(x);

    int cur = y;
    VI vs;
    while (1) {
	online[cur] = true;
	vs.push_back(cur);
	if (cur == x) break;
	cur = par[cur];
    }

    REP (i, N) if (!online[i] && (int)G[i].size() != 1) {
	puts("-1");
	return;
    }

    int cnt = 1;
    VI ans1, ans2;
    EACH (e, vs) {
	int tmp = cnt++;
	REP (t, (int)G[*e].size() - 2) {
	    ans1.push_back(cnt++);
	}
	ans1.push_back(tmp);
    }
    cnt = 1;
    reverse(vs.begin(), vs.end());
    EACH (e, vs) {
	int tmp = cnt++;
	REP (t, (int)G[*e].size() - 2) {
	    ans2.push_back(cnt++);
	}
	ans2.push_back(tmp);
    }

    VI ans = min(ans1, ans2);
    rprintf("%d", ans.begin(), ans.end());
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 9596
'''
参考
https://www.charter-blog.com/entry/2020/05/18/163000#D--Double-Dots
https://atcoder.jp/contests/abc168/submissions/13442966
BFS（幅優先探索について）
https://qiita.com/drken/items/996d80bcae64649a6580
'''
import collections

N, M = map(int, input().split())
'''
グラフ入力を受け取るためのリストを準備（部屋数分のリスト要素）
（2次元配列の初期化方法に注意）
https://note.nkmk.me/python-list-initialize/
'''
graph = [[] for _ in range(N+1)]    # グラフを用意（本来なら必要なのは部屋数分だがindex+1して出力するのが煩雑なので+1しておく）

for _ in range(M):                  # グラフ入力を受け取る（各通路がどの部屋間をつないでいるか）
    A, B = map(int, input().split())
    graph[A].append(B)              # Aで指定した部屋から通じる部屋Bの番号をAからの通路リストに追加
    graph[B].append(A)              # Bも同様

q = collections.deque([1])          # グラフから取り出した、通路がつながった先の部屋番号を格納するキュー
dest = [-1] * (N+1)                 # 全部屋を「未訪問」で初期化
dest[0] = 1                         # リストの先頭（出力対象外）は「1」にしておく
dest[1] = 1                         # 部屋1も訪問済ということにする（目的地なので）

while q:
    room = q.popleft()              # キューの先頭要素である部屋番号を取り出す（ここをリストにしてしまっていると計算量が増大する）
    for n_room in graph[room]:      # 部屋からの全ての通路で行ける次の部屋について
        if dest[n_room] == -1:
            dest[n_room] = room     # 今いる部屋の番号を格納
            q.append(n_room)        # キューの末尾に次の部屋を追加

if -1 in dest:
    print('No')
else:
    print('Yes')
    print('\n'.join(map(str, dest[2:])))    # 出力は2番目の部屋以降


Measured memory_bytes: 41708
#include<bits/stdc++.h>
using namespace std;
int n, m, q, a[210000], b[210000], c, dist[110000], T[110000], cnt, U[110000];
vector<pair<int, int> >x[110000], y[110000]; bool used[210000];
int main() {
	scanf("%d%d%d", &n, &m, &q);
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &a[i], &b[i]);
		x[a[i]].push_back(make_pair(b[i], i));
		x[b[i]].push_back(make_pair(a[i], i));
	}
	fill(dist, dist + n + 1, 999999); dist[1] = 0;
	queue<int> Q; Q.push(1);
	while (!Q.empty()) {
		int a1 = Q.front(); Q.pop();
		for (pair<int, int> i : x[a1]) {
			if (dist[i.first] > dist[a1] + 1) {
				dist[i.first] = dist[a1] + 1;
				Q.push(i.first);
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		for (pair<int, int> j : x[i]) {
			if (dist[i] < dist[j.first]) {
				y[i].push_back(j);
				T[j.first]++;
			}
		}
	}
	for (int i = 0; i < q; i++) {
		scanf("%d", &c); c--;
		queue<pair<int, int> > Q1;
		int ss = -1;
		if (dist[a[c]] < dist[b[c]])ss = b[c];
		if (dist[a[c]] > dist[b[c]])ss = a[c];
		if (ss >= 1 && U[ss] == 0 && used[c] == false) {
			Q1.push(make_pair(ss, c));
			while (!Q1.empty()) {
				int a1 = Q1.front().first, a2 = Q1.front().second; Q1.pop();
				if (U[a1] == 1 || used[a2] == true) continue; T[a1]--; used[a2] = true;
				if (T[a1] != 0) continue; cnt++; U[a1] = 1;
				for (pair<int, int> j : y[a1]) {
					if (U[j.first] == 0) Q1.push(j);
				}
			}
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 20064
#include<iostream>
using namespace std;
int n,i,nu,j;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    cout<<(n*(n-1))/2-n/2<<"\n";
    for(i=1; i<=n; i++)
    {
        if(n%2==0)
            nu=n-i+1;
        else
            nu=n-i;
        for(j=i+1; j<=n; j++)
            if(j!=nu)
                cout<<i<<" "<<j<<"\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
const ll MOD = 1000000007;

int main() {
    int n;
    double a, ans = 0;
    cin >> n;
    REP(i, n) {
        cin >> a;
        ans += 1/a;
    }
    cout << setprecision(14) << 1/ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

/* define */
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = a; i < b ; i++)
#define REP(i, n) for ( int i = 0; i < n ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = (int)1e9 + 7;

/* alias */
typedef long long ll;
typedef unsigned  u;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
ll Lgcd(ll a, ll b) {
	if (b != 0) return Lgcd(b, a % b); 
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
ll Llcm(ll a, ll b) {
	return a / Lgcd(a, b) * b;
}

/* main */
int n, m, ans = 0;
int a[60], b[60], visited[60], graph[60][60] = { };

void dfs(int v) {
	visited[v] = 1;
	REP(i, n) if (graph[v][i] == 1 && visited[i] == 0)dfs(i);
}

int main() {
	scanf("%d%d", &n, &m);
	REP(i, m) {
		scanf("%d%d", &a[i], &b[i]);
		a[i]--;
		b[i]--;
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = 1;
	}
	REP(i, m) {
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = 0;
		REP(j, n)visited[j] = 0;
		dfs(0);
		REP(j, n)if (visited[j] == 0) {
			ans++;
			break;
		}
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = 1;
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <stdio.h>
#include <cmath>
#include <tgmath.h>

using namespace std;

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;


int main() {

    ll d,n;
    cin>>d>>n;

    if(n==100)n++;

    ll ans=1;
    ans*=n*pow(100,d);

    cout<<ans<<endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c,t,sum;
    cin>>a>>b>>c;
    t=max(max(a,b),c);
    sum=a+b+c;
    if(sum-t==t) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
	return 0;
}


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

int count(int n){
	if(n == 0){
		return 0;
	}
	else{
		return count(n >> 1) + (n & 1);
	}
}

int main(){
	int N, i, j, s;
	scanf("%d", &N);
	vector<int> A(N);
	vector<vector<int>> x(N, vector<int>(N - 1)), y(N, vector<int>(N - 1));
	for(i = 0; i < N; i++){
		scanf("%d", &A[i]);
		for(j = 0; j < A[i]; j++){
			scanf("%d%d", &x[i][j], &y[i][j]);
			x[i][j]--;
		}
	}
	int ans = 0;
	for(s = 0; s < (1 << N); s++){
		int f = 1;
		for(i = 0; i < N; i++){
			if((s | (1 << i)) == s){
				for(j = 0; j < A[i]; j++){
					if(((s >> x[i][j]) & 1) != y[i][j]){
						f = 0;
					}
				}
			}
		}
		if(f == 1){
			ans = max(ans, count(s));
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=1e6+4;
const ll MOD=1e9+7;
inline int read() {
	int x=0,f=1;char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}
ll fac[N<<1]={1,1};
ll inv[N]={1,1};
int n,m;
char s[N];
inline ll fpow(ll a,int b) {
	ll ret=1;
	while (b) {
		if (b&1) ret=ret*a%MOD;
		b>>=1,a=a*a%MOD;
	}
	return ret;
}
inline ll C(int x,int y) {
	ll ans=fac[x];
	ans=ans*inv[y]%MOD;
	ans=ans*inv[x-y]%MOD;
	return ans;
}
int main() {
//	freopen("in.txt","r",stdin);
	for (register int i=1;i<(N<<1);++i) fac[i]=fac[i-1]*i%MOD;
	inv[N-1]=fpow(fac[N-1],MOD-2);
	for(int i=N-2;~i;--i)
	   inv[i]=inv[i+1]*(i+1)%MOD;
	n=read();
	scanf("%s",s);
	m=strlen(s);
	ll ans=0;
	for (register int i=0;i<=n;++i) {
		ll c=fpow(26,i)*fpow(25,n-i)%MOD;
		(ans+=c*C(n+m-i-1,m-1)%MOD)%=MOD;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 28196
#include <iostream>
#include <sstream>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  int minr,maxa=-2000000000;
  int n,r;
  cin>>n;
  cin>>r;
  minr=r;
  for (int i=0;i<n-1;i++){
    cin>>r;
    if(maxa<r-minr)maxa=r-minr;
    if(minr>r)minr=r;
  }
  cout<<maxa<<endl;
  return 0;
}



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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n,k;cin>>n>>k;
  vector<ll>a(n);
  rep(i,0,n)cin>>a[i];
  vector<ll>b;
  rep(i,0,n){
    ll ret=0;
    rep(j,i,n){
      ret+=a[j];
      b.PB(ret);
    }
  }
  ll ret=0;
  //debug(b,b.size());
  rrep(i,0,60){
    ll now=(ret|(1LL<<i));
    ll cnt=0;
    for(auto val:b){
      if((val&now)==now)cnt++;
    }
    //cout<<ret spa now<<endl;
    if(cnt>=k)ret=now;
  }
  cout<<ret<<endl;
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  string ans = "No";
  if (N <= 9) {
    ans = "Yes";
  }
  
  for (int i = 2; i <= 9; i++) {
    if (N % i == 0 && N / i <= 9) {
      ans = "Yes";
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 3624
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

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;}

const ll mod=1e9+7;


ll dp[105][4][2];

int main()
{
    string s;
    cin >> s;
    ll n=s.length();
    ll k;
    cin >> k;
    for(ll i=0;i<=n;i++){
        if(i==0){
            dp[0][0][0]=1;
            continue;
        }
        if((s[i-1]-'0')==0){
            for(ll j=0;j<=k;j++){
                if(j-1>=0){
                    dp[i][j][1]+=9*dp[i-1][j-1][1];
                }
                dp[i][j][0]+=dp[i-1][j][0];
                dp[i][j][1]+=dp[i-1][j][1];
            }
        }
        else{
            for(ll j=0;j<=k;j++){
                if(j-1>=0){
                    dp[i][j][0]+=dp[i-1][j-1][0];
                    dp[i][j][1]+=9*dp[i-1][j-1][1];
                    dp[i][j][1]+=((s[i-1]-'0')-1)*dp[i-1][j-1][0];
                }
                dp[i][j][1]+=dp[i-1][j][0]+dp[i-1][j][1];
            }
        }
    }
    cout << dp[n][k][0]+dp[n][k][1] << endl;
    return 0;
} 

Measured memory_bytes: 384
# -*- coding: utf-8 -*-
n = int(input())
s = str(input())
b = 10 ** 9 + 7 
# print(n);
# print(s);

sum=0
alphabet=['a', 'b', 'c', 'd' ]
alphabet=[chr(i) for i in range(97, 97 + 26)]
for i in alphabet:
    count=s.count(i)
    sum = (sum * (count + 1) + count ) % b     
    # print (s,i,count,sum)
print(sum)


Measured memory_bytes: 3188
#include <iostream>
#include <map>
using namespace std;
int main()
{
  int n;
  cin>>n;
  string a[200001];
  map<string,int> ma;
  for(int i=0;i<n;i++){
    cin>>a[i];
    ma[a[i]]++;
  }
  int mama=0;
  for(auto i:ma){
    mama=max(mama,i.second);
  }
  for(auto i:ma){
    if(i.second==mama)cout<<i.first<<endl;
  }
  
  
  return 0;
}
    
    

Measured memory_bytes: 26752
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
#include <utility>
 
using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;

int main(void) {
    string s;
    cin >> s;
    for (Int i = 0; i < (Int)s.length(); ++i) {
        if (s[i] == '1') {
            s[i] = '9';
        } else {
            s[i] = '1';
        }
    }
    cout << s << endl;
    return 0;
}



Measured memory_bytes: 3572
#include<bits/stdc++.h> 
#include<vector> 
#include<iterator> 
#include<deque> 
#include<algorithm>
using namespace std;
#define rep(i,n) for(int i = 0; i <(n) ; i++)
#define rep2(i,s,n) for(int i = (s); i<(n) ; i++)
#define ll long long


int main(){
  int N;
  cin >> N;
  vector<int> v(N,0);
  vector<int> c(N);
  rep(i,N) cin >> c[i];

  rep2(i,1,N){
    int s1 = i-1;
    int s2 = i-2;

    int c1 = abs(c[i]-c[s1]);
    int c2 = abs(c[i]-c[s2]);
    
    if(i==1){
      s2 = i-2;
      c2 = c1;
    }
    v[i] = min(v[s1]+c1,v[s2]+c2);
  }
  cout << v[N-1] <<endl;
  return 0;
}

Measured memory_bytes: 1024
from heapq import *
def find(A,x):
    p = A[x]
    if p == x:
        return x
    a = find(A,p)
    A[x] = a
    return a

def union(A, x, y):
    if find(A,x) > find(A,y):
        bx, by = find(A,y), find(A,x)
    else:
        bx, by = find(A,x), find(A,y)
    A[y] = bx
    A[by] = bx

N = int( input())
X = [(0,0)]*N
Y = [(0,0)]*N
E = [(0,0)]*N
for i in range(N):
    x, y = map( int, input().split())
    X[i] = (x,i)
    Y[i] = (y,i)
    E[i] = (x,y)
X.sort()
Y.sort()
H = []
heapify(H)
for i in range(N-1):
    x1, j1 = X[i]
    x2, j2 = X[i+1]
    y1, k1 = Y[i]
    y2, k2 = Y[i+1]
    heappush(H,(x2-x1, j1, j2))
    heappush(H, (y2-y1, k1, k2))
ans = 0
V = [ i for i in range(N)]
while H:
    w,s,t = heappop(H)
    if find(V,s) != find(V,t):
        union(V,s,t)
        ans += w
print(ans)

Measured memory_bytes: 61088
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	int a,b;
	cin>>a>>b;
	if(a>8 || b>8) cout<<":("<<endl;else cout<<"Yay!"<<endl;
	}

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

ll calc(ll N) {
    if(N==1) return 1;
    if(m.count(N) != 0) {
        return m[N];
    }
    else {
        m[N] = 1 + calc(N/2) + calc(N/2);
        return m[N];
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll H;
    cin >> H;
    cout << calc(H) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#include <cstdint>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

std::string s;

int main(){
    std::cin >> s;
    std::string rev = s;
    std::reverse(s.begin(), s.end());
    if(s != rev){
        printf("No\n");
        return 0;
    }
    std::string s1 = s.substr(0, s.length()/2);
    std::string s1rev = s1;
    std::reverse(s1.begin(), s1.end());
    if(s1 != s1rev){
        printf("No\n");
        return 0;
    }
    std::string s2 = s.substr(s.length()/2+1, s.length() - s.length()/2 - 1);
    std::string s2rev = s2;
    std::reverse(s2.begin(), s2.end());
    if(s2 != s2rev){
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
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; }
#define print(x) cout << (x) << endl;
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};



const int mod = 1e9 + 7;



int main(void){
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    rep(i,n-2){
      if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') ans++;
    }
    print(ans);

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
int h,w;
bool field[2000][2000];
vector<int> yoko[2000], tate[2000];
int s[2000][2000], t[2000][2000];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>h>>w;
    rep(i,0,h){
        yoko[i].pb(-1);
    }
    rep(j,0,w){
        tate[j].pb(-1);
    }
    rep(i,0,h){
        string s;
        cin>>s;
        rep(j,0,w){
            if(s[j]=='.') field[i][j]=1;
            else{
                field[i][j]=0;
                yoko[i].pb(j);
                tate[j].pb(i);
            }
        }
    }
    rep(i,0,h){
        yoko[i].pb(w);
    }
    rep(j,0,w){
        tate[j].pb(h);
    }
    rep(i,0,h){
        rep(j,0,w){
            if(field[i][j]){
                s[i][j]=*lb(yoko[i], j)-*(lb(yoko[i],j)-1)-1;
                t[i][j]=*lb(tate[j], i)-*(lb(tate[j],i)-1)-1;
            }
        }
    }
    int ans=0;
    rep(i,0,h){
        rep(j,0,w){
            ans=max(ans, s[i][j]+t[i][j]-1);
        }
    }
    cout << ans<<"\n";
}

Measured memory_bytes: 69504
def four(r , g , b):

    ans = (r*100) + (g*10) + b

    return "YES" if ans % 4 == 0 else "NO"

def main():
    r , g ,b = map(int , input().split())
    print(four(r , g , b))

if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include<iostream>
#include<vector>
#include<algorithm>
#define M 1000000

using namespace std;

int Dijkstra(const vector< vector<int> >& data, int& s, int& g){
  vector<bool> is_reached(data.size(), false);
  vector<int> ans(data.size(), M);
  ans[s] = 0;
  int i, j;
  i = s;
  while(i != g){
    is_reached[i] = true;
    for(j=0; j<data[i].size(); ++j){
      ans[j] = min(ans[j], ans[i] + data[i][j]);
    }
    for(i=-1, j=0; j<is_reached.size(); ++j){
      if(!is_reached[j] && (i < 0 || ans[i] > ans[j])) i = j;
    }
  }
  return ans[g];
}

int GetMinCost(const vector< vector<int> >& data, int& s, int g1, int g2){
  int cost = Dijkstra(data, s, g1) + Dijkstra(data, s, g2);
  for(int i=0; i<data.size(); ++i){
    cost = min(cost, Dijkstra(data, s, i)
	       + Dijkstra(data, i, g1) + Dijkstra(data, i, g2));
  }
  return cost;
}

int main(){
  int n, m, s, g1, g2;
  int a, b, c;

  while(1){
    cin >> n >> m >> s >> g1 >> g2;
    if(n == 0 && m == 0 && s == 0 && g1 == 0 && g2 == 0) break;

    --s;
    --g1;
    --g2;
    vector< vector<int> > data(n, vector<int>(n, M));

    for(int i=0; i<m; ++i){
      cin >> a >> b >> c;
      data[a-1][b-1] = c;
    }
    cout << GetMinCost(data, s, g1, g2) << endl;
  }
  return 0;
}

Measured memory_bytes: 1260
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <cstdint>
#include <iomanip>
using ll = long long;

int main(){
    ll N,x; std::cin>>N>>x;
    std::vector<ll> a;
    for(int i=0; i<N; ++i){
        ll b; std::cin>>b; a.push_back(b);
    }

    std::sort(a.begin(),a.end());

    ll cnt=0;
    for(int i=0; i<N; ++i){
        x -= a[i];
        if(x<0){
            std::cout << cnt;
            return 0;
        }
        ++cnt;
    }
    if(x>0){
        std::cout << cnt - 1;
    }else{
        std::cout << cnt;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
using ll = long long;
using graph = std::vector<std::vector<ll>>;

using namespace std;

vector<ll> Factorial(ll M, ll MOD){
    vector<ll> result = vector<ll>(M + 1);
    for(int i = 0; i <= M; i++){
        if(i == 0){
            result[i] = 1;
        }else{
            result[i] = result[i-1] * i % MOD;
        }
    }
    return result;
}

vector<ll> InvFact(ll M, ll MOD){
    vector<ll> result = vector<ll>(M + 1);
    vector<ll> inv = vector<ll> (M + 1);
    result[0] = 1;
    result[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < M; i++){
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        result[i] = result[i - 1] * inv[i] % MOD;
    }
    return result;
}

ll Combination(ll n,ll k,vector<ll>& fact, vector<ll>& invFact,ll MOD){
    //nCkを計算する
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fact[n] * (invFact[k] * invFact[n - k] % MOD) % MOD;
}

int main() {
    ll N,K;
    cin >> N >> K;
    vector<ll> A(N);
    ll MOD = 1000000007;
    vector<ll> fact = Factorial(N,MOD);
    vector<ll> invFact = InvFact(N,MOD);
    for(ll i = 0; i < N; i++){
        cin >> A[i];
    }
    sort(A.begin(),A.end());
    ll sum = 0;
    for(int i = 0; i < N; i++){
        sum = (sum - A[i] * (Combination(N - (i+1),K - 1,fact,invFact,MOD) - Combination(i,K - 1,fact,invFact,MOD))) % MOD;
    }
    cout << sum << endl;

}


Measured memory_bytes: 3328
// Math = ♥️

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
#define pq priority_queue
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define sz(c) ((ll)c.size())
// #define ordered_set                            \
//     tree<ll, null_type, less<ll>, rb_tree_tag, \
//          tree_order_statistics_node_update>

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

    ll n, m, k;
    cin >> n >> m >> k;

    vi a(n), b(m);
    for (auto &it : a) {
        cin >> it;
    }

    for (auto &it : b) {
        cin >> it;
    }

    ll many = 0;
    vi pre(m + 1);
    pre[0] = 0;
    for (int i = 0; i < m; i++) {
        pre[i + 1] = pre[i] + b[i];
    }

    ll how = 0;
    ll ans = 0;

    ll l = -1, r = m + 1;
    while (r - l > 1) {
        ll mid = (r + l) / 2;
        if (pre[mid] <= k) {
            l = mid;
        } else {
            r = mid;
        }
    }

    ans = max(ans, l);
    for (int i = 0; i < n; i++) {
        if (k >= a[i]) {
            how++;
            k -= a[i];
        } else {
            break;
        }

        l = -1, r = m + 1;
        while (r - l > 1) {
            ll mid = (r + l) / 2;
            if (pre[mid] <= k) {
                l = mid;
            } else {
                r = mid;
            }
        }
        ans = max(ans, l + how);
    }

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


Measured memory_bytes: 7944
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int N;
string S;
cin >> N >> S;
for (int i = 0;i < S.size();i++) {
    S.at(i) += N;
    if (S.at(i) > 90) S.at(i) -= 26;
}

cout << S << endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    deque<int> d;
    
    rep(i, n) {
        int p = lower_bound(all(d), a[i]) - d.begin();
        
        if (p == 0) {
            d.push_front(a[i]);
        }
        else {
            d[p - 1] = a[i];
        }
    }
    
    cout << sz(d) << endl;
    return 0;
}

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

using namespace std;

int main() {

	long long l,r;
	cin >> l >> r;

	long long ll;
	ll = l % 2019;
	long long rr;
	rr = r % 2019;

	if (r - l >= 2019) {
		cout << "0" << endl;
		return 0;
	}
	else {
		long long minn = 100000000;
		for (long long i = l; i < r; i++) {
			for (long long j = i+1; j <= r; j++) {
				if ((i*j) % 2019 < minn) {
					minn = (i * j) % 2019;
				}
			}
		}

		cout << minn << endl;
	}

}

Measured memory_bytes: 256
n, m  = gets.strip.split.map(&:to_i)
as = gets.strip.split.map(&:to_i)

matched_numbers = [2, 5, 5, 4, 5, 6, 3, 7, 6].map.with_index {|e, i| [e, i+1] }.select {|e, i| as.include?(i) }.sort.to_h

#p matched_numbers

dp = Array.new(n+1, 0)
(1..n).each do |i|
  tmp = matched_numbers[i].to_i.to_s
  matched_numbers.each do |cost, number|
    next if dp[i-cost].nil? || dp[i-cost].to_i.zero?

    a = dp[i-cost].to_s
    b = number.to_s
    str = a<b ? (b+a) : (a+b)
    tmp = str if tmp.length < str.length || (tmp.length==str.length && tmp < str)
  end
  dp[i] = tmp
end

#p dp
p dp[n].to_i

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

#ifdef _PRINTDEBUG
  #include "lib/printdebug.hpp"
#else
  #define printdebug(...) 1
#endif
#define MOD_1_000_000_007 (1000000007)
#define IINF (1<<28)
#define LINF (1LL<<60)
#define rep(i, n)      REP(i, 0, (n))
#define repc(i, n)     REPC(i, 0, (n))
#define REP(i, n, m)   for (int i = (int)(n); i <  (int)(m); i++)
#define REPC(i, n, m)  for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
#define yesno(cond)       YESNO((cond), "Yes", "No")
#define YESNO(cond, a, b) cout << ((cond) ? (a) : (b)) << "\n"

namespace solver {
  using namespace std;
  typedef long long ll;

  int A, B;

  void init() {
    cin >> A >> B;
  }

  void solve() {
    string res = "";
    if(A == 1) A = 14;
    if(B == 1) B = 14;
    if(A == B) res = "Draw";
    else if(A > B) res = "Alice";
    else res = "Bob";
    cout << res << "\n";
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  solver::init();
  solver::solve();
  return 0;
}

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

int main()
{
	int A, B;
	cin >> A >> B;

	int ans = -1;
	for( int n = 0; n < 100 * 1000; n++ ) {
		if( n * 8 / 100 == A && n * 10 / 100 == B ) {
			ans = n;
			break;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    private int count(char[] m1, char[] m2) {
        int cnt = 0;
        for (int i = 0; i < m1.length; i++) {
            if (m1[i] > 0 && m2[i] > 0) {
                cnt++;
            }
        }
        return cnt;
    }

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        char[] S = sc.next().toCharArray();

        char[] map1 = new char[26];
        char[] map2 = new char[26];
        for (int i = 0; i < N; i++) {
            map1[S[i] - 'a']++;
        }

        int max = 0;
        for (int i = 0; i < N; i++) {
            map1[S[i] - 'a']--;
            map2[S[i] - 'a']++;
            max = Math.max(count(map1, map2), max);
        }

        System.out.println(max);
        return;
    }

}

Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;

int main() {
	string S;
	cin>> S;
	int a;
	int z;
	for (int i = 0;i<S.size();++i) {
		if ('A' == S[i]) {
			a = i;
			break;
		}
	}
	for (int i = S.size()-1; i >=0; --i) {
		if ('Z' == S[i]) {
			z = i;
			break;
		}
	}
	cout << z-a+1<<endl;
	return 0;
}

Measured memory_bytes: 3764
from itertools import product

N, *ABC = map(int, input().split())

L = []
for _ in range(N):
  L.append(int(input()))

ans = 10**9
for X in product((0, 1, 2, 3), repeat=N):
  cnt, K, temp = [0]*4, [0]*4, 0
  for i in range(N):
    cnt[X[i]] += 1
    K[X[i]] += L[i]
  if min(cnt[1:]) == 0:
    continue
  for i in range(3):
    temp += abs(ABC[i] - K[i+1])
    temp += 10 * max(cnt[i+1]-1, 0)
  ans = min(ans, temp)

print(ans)

Measured memory_bytes: 9004
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int n;
  cin>>n;
  int a[n];
  rep(i,n) cin>>a[i];
  int ans = 0;
  int i = 0;
  while(i < n - 1)
  {
    if(a[i] == a[i + 1]) {
      ans++;
      i += 2;
    } else {
      i++;
    }
  }
  cout << ans << endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

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

    int ans = 1;
    int maxv = a[0];
    for(int i=1; i<N; i++){
        if(a[i] >= maxv) ans++;
        maxv = max(maxv, a[i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
//Never stop trying
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<str> vs;
typedef vector<ld> vd;
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

const int MOD = 1e9 + 7; //998244353
const ll INF = 1e18;
const int MX = 2e5 + 10;
const int nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0}; //right left down up

template<class T> using V = vector<T>;
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); } // divide a by b rounded up
constexpr int log2(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))

#define dbg(x) cerr << " - " << #x << " : " << x << endl;
#define dbgs(x,y) cerr << " - " << #x << " : " << x << " / " << #y << " : " << y << endl;
#define dbgv(v) cerr << " - " << #v << " : " << endl << "[ "; for(auto it : v) cerr << it << ' '; cerr << ']' << endl;

void IO() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}


int32_t main() {
	boost; IO();

	str s,t; cin>>s>>t;
	int ans=INF;
	for(int i=0; i<sz(s)-sz(t)+1; i++){
		int x=0;
		int ii=i;
		for(int j=0; j<sz(t); j++){
			if(s[ii]!=t[j]) x++;
			ii++;
		}
		ans=min(ans,x);
	}
	cout << ans << endl;




	return 0;
}

/* Careful!!!
	.Array bounds
	.Infinite loops
	.Uninitialized variables / empty containers
	.Order of input

   Some insights:
	.Binary search
	.Graph representation
	.Write brute force code
	.Change your approach
*/


Measured memory_bytes: 3652
#include <stdio.h>

int main(void) {
	int A[3];

	scanf("%d %d %d", &A[0], &A[1], &A[2]);

	int A_flag[3] = {0, 0, 0};
	int j;
	for (j = 0; j < 3; j++) {
		for (int i = 0; i < 3; i++) {
			if (A[j] != A[i])
				A_flag[j]++;
		}
	}

	for (int i = 0; i < 3; i++) {
		if (A_flag[i] >= 2) {
			printf("%d\n", A[i]);
			break;
		}
	}
}

Measured memory_bytes: 128
#include <stdio.h>

double f(int x){
	return x*x;
}

int main(void)
{	
	int d, i;
	
	while(scanf("%d",&d) != EOF){
		
		double s = 0;
		
		for(i = 1;i < 600 / d;i++){
			s += f(i * d) * d;
		}
		
		printf("%d\n",(int)s);
	}
	
	return 0;
}
			
			

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int f(int n) {
	if (n <= 9) return 1;
	else return 1 + f(n / 10);
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> s(m), c(m);
	rep(i,m) cin >> s[i] >> c[i];
	for (int i = 0; i < 1000; i++) {
		int keta = f(i);
		if (keta != n) continue;
		string t = to_string(i);
		bool b = true;
		rep(j,m) {
			if ((int)(t[s[j] - 1] - '0') != c[j]) b = false;
		}
		if (b) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}

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

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef set<int> si;
typedef set<ll> sll;
typedef map<int, int> mii;
typedef map<ll, ll> mll;

const double pi = acos(-1.0);
const long long INF = 2e18;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define in insert
#define endl "\n"

#define sqr(a) ((a) * (a))
#define jor(a) !(a&1)// jor means EVEN number
#define bjor(a) (a&1)// bjor means ODD number

#define all(a)  a.begin(), a.end()
#define mem(arr, b) memset(arr, b, sizeof(arr)) //memset only for -1 and 0
//fill(a, a+n, 5) //fill for any value

#define for0(i,b) for(int i=0;i<(b);i++)
#define for1(i,b) for(int i=1;i<=(b);i++)
#define forab(i,a,b) for(int i=(a);i<=(b);i++)
#define forba(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fileRead freopen("input.txt", "r", stdin);
#define fileWrite freopen("output.txt", "w", stdout);

void print(int a[], int n){ // for testing or debugging
    for(int i=0;i<n;i++)cout<<a[i]<<" "; cout<<endl;
}

//-------------------------------------------------------------------\\

int main()
{
    int n; cin>>n;
    int a[n];
    for0(i,n) cin>>a[i];
    ll ans=0;
    for0(i,n-1) if(a[i]>a[i+1]) ans+=a[i]-a[i+1], a[i+1]=a[i];
    cout<<ans;
}


Measured memory_bytes: 4408
#include <stdio.h>

int main(void){
  int a,b,c;
  int delta;

  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);

  delta = b - a;
  if(delta == (c - b)){
    printf("YES\n");
  }else{
    printf("NO\n");
  }
  return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val (x, t) = readIntegerList()
    val ans = max(0, x - t)
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


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

int main() {
  string str;
  int n;
  scanf("%d\n",&n);
  for(int i=0;i<n;i++) {
    getline(cin,str);
    for(unsigned int j=0;j<str.size();j++) {
      if(str.substr(j,7) == "Hoshino") {
        str.replace(j,7,"Hoshina");
      }
    }
    cout << str << endl;
  }
}

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

int main() {
    int64_t n;
    cin >> n;
    vector<int64_t> a(n);
    for(auto& e : a) cin >> e;
    if(find(begin(a), end(a), 0) != end(a)){
        cout << 0 << endl;
        return 0;
    }

    int64_t ans = 1;

    for(auto& e : a){
        if(ans > (int64_t)1e18 / e){
            cout << -1 << endl;
            return 0;
        }
        ans *= e;
    }
    cout << ans << endl;
    return 0;
}

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


int main(){
	int N, D;
	cin >> N >> D;

	vector<vector<int>> X(N, vector<int>(D));
	rep(i,N){
		rep(j,D){
			cin >> X[i][j];
		}
	
	}
	int ans = 0;

	for(int i = 0;i<N-1;i++){
		for(int j = i + 1;j < N; j++){
			int tmp = 0;
			bool ok = false;
			rep(k, D){
				tmp += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
			}
			for(int k = 1;k <= 126;k++){
				if(tmp == k * k){
					ok = true;
					break;
				}
			}
			if(ok){
			   	ans++;
		//		cout << i  <<  " " << j << " " << sqrt(tmp) << endl;
			}
		}

	}
	cout << ans << endl;
}














Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n, k; scanf("%d%d", &n, &k);
	int ans = 0;
	REP(i, n) {
		int h; scanf("%d", &h);
		if(h >= k) ans++;
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 256