akhauriyash/Code-Regression huggingface dataset:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
d = [INT() for _ in range(n)]
print(len(list(set(d))))

Measured memory_bytes: 5772
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(), x.end()
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const ll inf = 1e18;
const int MAX_N = 500;

int main() {
    int n; cin >> n;
    if (n < 1000) cout << "ABC" << endl;
    else cout << "ABD" << endl;
}

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 Jaynil
 */
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);
        AChangingACharacter solver = new AChangingACharacter();
        solver.solve(1, in, out);
        out.close();
    }

    static class AChangingACharacter {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            StringBuilder ans = new StringBuilder(in.next());
            ans.setCharAt(k - 1, (char) (ans.charAt(k - 1) + 32));
            out.println(ans.toString());
        }

    }

    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: 21076
#include <bits/stdc++.h>
#include <cstdlib>
#include <vector>
using namespace std;

int main() {
    int n;
    float sum_rcp = 0;
    float rcp_rcp = 0; 
    cin >> n;
    vector<float> a(n);
    
    for(int i=0; i < n; i++) {
        cin >> a[i]; 
        sum_rcp += 1 / a[i];
    }

    rcp_rcp = 1 / sum_rcp;
    cout << defaultfloat;
    cout << rcp_rcp << endl;

    return 0;
}

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

int main() {
  vector<int> vec;
  int i;
  while (true) {
    cin >> i;
    if (i == 0) break;
    vec.push_back(i);
  }

  for (size_t i=1; i != vec.size()+1; i++) {
    cout << "Case " << i << ": " << vec[i-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 3164
#include<bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long unsigned int ll;
typedef vector<int >    vecint;
typedef vector<double >    vecd;
typedef vector<vector<int> >  vec2int;
typedef vector<vector<double> >  vec2d;
typedef vector<ll >     vecll;
typedef vector<string > vecstr;
typedef vector<bool > vecbool;
typedef vector<vector< bool > > vec2bool;
typedef vector<bool > vecbool;
////////////////////////////////////////////////
int main()
{
  string s; cin >> s;
  set<char> g;
  REP(i,s.size()){
    g.insert(s[i]);
  }
  if(s.size() != 26){
    for(char c = 'a'; c < 'z'; c ++ ){
      if(g.find(c) == g.end()){
	s = s + c;
	cout << s << endl;
	return 0;
      }
    }
  }else{
    int ind = 0;
    for(int i = 25; i >= 1; i--){
      if(s[i - 1] < s[i]){
	ind = i;
	break;
      }
    }
    ///// last one
    if(ind == 0){
      cout << -1 << endl;
      return 0;
    }
    ///// last one
    char key;
    key = s[ind - 1];
    // cout << key << " " << ind <<  endl;
    char key2 = 'z';
    for(int i = ind; i <= 25; i ++){
      // cout << s[i] << " " << (key > s[i]) << endl;
      if(key < s[i]){
	key2 = min(key2, s[i]);
      }
    }
    if(ind == 1){
      cout << key2 << endl;
    }else{
      cout << s.substr(0,ind-1) << key2<< endl;
    }
  }
} 


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




int main() {

		int A, B;
		cin >> A >> B;
		cout <<(A-1)*(B-1)<< endl;

	
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
 
#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define pd(x) printf("%lf\n", x)
#define ps(x) printf("%s\n", x)
 
#define INF 1000000000000000000
#define MOD 1000000007
 
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
 
int compare_long(const void *a, const void *b) {
	return *(long*)a - *(long*)b;
}
 
int main() {
	long N;
	long s[110];
	long ans = 0;
	long i, j;
	long m = INF;
	
	sl(N);
	
	for(i=0;i<N;i++) {
		sl(s[i]);
		ans += s[i];
		if(s[i] % 10 != 0) m = MIN(m, s[i]);
	}
	
	qsort(s, N, sizeof(long), compare_long);
	
	if(ans % 10 == 0) {
		if(m == INF) {
			ans = 0;
		} else {
			ans -= m;
		}
	}
	
	pl(ans);
	
	return 0;
}

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int r1, r2; cin >> r1 >> r2;
  cout << fixed << setprecision(9) << (r1*r2*1./(r1+r2)) << endl;

  return 0;
}


Measured memory_bytes: 256
import sys,heapq,math,resource
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def setrlim():
  sys.setrecursionlimit(250000)
  soft,hard = resource.getrlimit(RLIMIT_STACK)
  # setrlimit works on ubuntu (and atcoder), but not on WSL
  #resource.setrlimit(RLIMIT_STACK, (128*1024*1024,hard))

n = inn()
if n<10:
    x = n
elif n<100:
    x = 9
elif n<1000:
    x = n-90
elif n<10000:
    x = 909
elif n<100000:
    x = n-9090
else:
    x = 90909
print(x)


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

int main() {
    int N; string S;
    cin >> N >> S;
    long long r = 0, g = 0, b = 0;
    for (auto c : S) {
        if (c == 'R') ++r;
        else if (c == 'G') ++g;
        else ++b;
    }
    long long all = r * g * b;
    long long sub = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = i+1; j < N; ++j) {
            if (S[i] == S[j]) continue;
            int k = j*2-i;
            if (k >= N || S[k] == S[i] || S[k] == S[j]) continue;
            ++sub;
        }
    }
    cout << all - sub << endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
#include <set>

#define int long long

using namespace std;
int A[200000];
set<int> s;

int search(int ok, int ng, int n){
    if (abs(ok-ng) <= 1)
        return ok;
    int mid = (ok+ng) / 2;
    if (A[mid] < n || (A[mid] == n && s.count(mid)))
        return search(mid, ng, n);
    else
        return search(ok, mid, n);
}

signed main(){
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> A[i];
    sort(A, A+n);
    int m = 1 << 30;
    int ans = 0;

    for (int i = 0; i < 30; i++){
        for (int j = 0; j < n; j++){
            if (s.count(j) || A[j] >= m)
                continue;
            int a = search(-1, n, m - A[j]) + 1;
            if (a >= n)
                continue;
            if (A[a] == m - A[j]){
                if (a == j){
                    a++;
                    if (a >= n || A[a] != A[j])
                        continue;
                }
                s.insert(a);
                s.insert(j);
                ans++;
            }
        }
        m >>= 1;
    }

    m = 2;
    int ans2 = 0;

    for (int i = 0; i < 30; i++){
        for (int j = 0; j < n; j++){
            if (s.count(j) || A[j] >= m)
                continue;
            int a = search(-1, n, m - A[j]) + 1;
            if (a >= n)
                continue;
            if (A[a] == m - A[j]){
                if (a == j){
                    a++;
                    if (a >= n || A[a] != A[j])
                        continue;
                }
                s.insert(a);
                s.insert(j);
                ans2++;
            }
        }
        m <<= 1;
    }

    cout << max(ans, ans2);
}

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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#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
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());


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
}

int32_t main()
{
 // c_p_c();
  int n,k;
  cin >> n >> k;
  vector <int> v(k,1);
  map <int,vector<int>> mp;
  for(int i=1;i<=k;i++)
  {
    int num;
    cin >> num;
    while(num--)
    {
      int p;
      cin >> p;
      mp[p].push_back(i);
    }
  }
  cout<<n-mp.size()<<endl;
  return 0;
}



Measured memory_bytes: 3588
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){
	string s;
	cin>>s;
	if(s=="SUN") return cout<<"7\n",0;
	if(s=="SAT") return cout<<"1\n",0;
	if(s=="MON") return cout<<"6\n",0;
	if(s=="TUE") return cout<<"5\n",0;
	if(s=="WED") return cout<<"4\n",0;
	if(s=="THU") return cout<<"3\n",0;
	if(s=="FRI") return cout<<"2\n",0;
}


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

constexpr int MAX_N = 2*1e5;

int a[MAX_N+1];
int b[MAX_N+1];

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

  vector<int> ans;
  for (int i{N}; i >= 1; --i) {
    int x{a[i]};
    for (int j{i}; j <= N; j += i) {
      x ^= b[j];
    }
    b[i] = x;
    if (x)
      ans.push_back(i);
  }

  int M = ans.size();
  cout << M << endl;
  if (M) {
    cout << ans[M-1];
    for (int i{M-2}; i >= 0; --i) {
      cout << " " << ans[i];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 3064
t=input()

def right(text):
  li=["dream","dreamer","erase","eraser"]
  for te in li:
    if text[-len(te):] == te:
      return text[:len(text)-len(te)]
  return text

flag=True
while flag:
  temp=right(t)
  if not temp:
    print("YES")
    break
  elif temp==t:
    print("NO")
    break
  t=temp




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

int main()
{
    long long int n,m,i,j,k,b,t,uos;
    char a[9999];
    while(scanf("%lld %lld",&n,&m)==2)
    {

k=0;b=0;uos=0;
for(i=m;b<n;b++)
{
    k+=i;if(i==0){uos=1;}i++;
}

if(m<=0 && uos==1){printf("%lld\n",k);}
else if(m<=0 && uos!=1){printf("%lld\n",k-(n+m-1));}
else if(m>0){printf("%lld\n",k-m);}

    }

    return 0;

}


Measured memory_bytes: 128
package main

import (
  "fmt"
)
var str, t string
var quest []int

func check(idx int) bool {
  if len(str) - idx < len(t) {
    return false
  }
  for i := idx; i < idx + len(t); i++{
    if str[i] != t[i-idx] && str[i] != '?' {
      return false
    }
  }
  return true
}

func main() {
  fmt.Scanf("%s\n%s", &str, &t)
  if str == t {
    fmt.Println(str)
    return
  }

  quest = make([]int, len(str))
  cnt := 0
  for i := len(str) - 1; i >= 0; i-- {
    if str[i] != '?' {
      cnt = 0
    } else {
      cnt += 1
      quest[i] = cnt
    }
  }
  idx := -1
  for i := 0; i < len(str); i++ {
    if(check(i)) {
      idx = i
    }
  }
  if idx == -1 {
    fmt.Println("UNRESTORABLE")
  } else {
    for i := 0; i < len(str); i++ {
      if i == idx {
        fmt.Print(t)
        i += len(t) - 1
      } else if str[i] == '?' {
        fmt.Print("a")
      } else {
        fmt.Print(string(str[i]))
      }
    }
    fmt.Println()
  }

}


Measured memory_bytes: 512
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;
const int NN=301;
void print(bool p[NN][NN], int n, int m){
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cerr << (p[i][j]?1:0);
		}
		cerr << endl;
	}
}
int solve(bool p[NN][NN], int n, int m){
	int s=0;
	for(int i=0;i<m;i++){
		int d=-1;
		for(int j=s;j<n;j++){
			if(p[j][i]){
				d=j;
			}
		}
		if(d==-1){
			//cerr << "aaa" << endl;
			continue;
		}
		if(d!=s){
			for(int j=i;j<m;j++){
				swap(p[s][j],p[d][j]);
			}
		}
		for(int j=s+1;j<n;j++){
			if(!p[j][i])continue;
			for(int k=i;k<m;k++){
				p[j][k]^=p[s][k];
			}
		}
		//print(p,n,m);
		s++;
		//cerr << "aa " << s << endl;
	}
	return s;
}

bool a[301][301];
LL C[301][301];
LL ps[301];
const LL M=998244353;
int main() {
	int N,K;
	cin >> N >> K;
	for(int i=0;i<N;i++){
		for(int j=0;j<K;j++){
			int v;
			cin >>v;
			if(v){
			a[i][j]=true;
			}
		}
	}
	int s=solve(a,N,K);
	//cerr << s << endl;
	for(int i=0;i<301;i++){
		C[i][0]=1;
		for(int j=1;j<=i;j++){
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%M;
		}
	}
	ps[0]=1;
	for(int i=1;i<301;i++){
		ps[i]=ps[i-1]*2%M;
	}
	LL ret=0;
	for(int i=1;i<=s;i++){
		for(int j=1;j<=i;j+=2){
			ret+=C[s][i]%M*C[i][j]%M*ps[s-i]%M*ps[N-s]%M*ps[K-s]%M;
			ret%=M;
		}
	}
	cout << ret << endl;



	return 0;
}



Measured memory_bytes: 1024
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

pub fn bsearch<F>(ok: i64, ng: i64, pred: F) -> Option<i64>
where
    F: Fn(i64) -> bool,
{
    let orig_ok = ok;
    let mut ok = ok;
    let mut ng = ng;
    while (ok - ng).abs() > 1 {
        let mid = (ok + ng) / 2;
        if pred(mid) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    if ok == orig_ok {
        None
    } else {
        Some(ok)
    }
}

fn main() {
    input! {
        s: Chars,
        t: Chars
    };

    let s_len = s.len();
    let mut pos_table = HashMap::new();
    for (i, ch) in s.into_iter().enumerate() {
        pos_table.entry(ch).or_insert(Vec::new()).push(i as i64);
    }
    let mut res = 0;
    let mut cur_pos = -1;
    for ch in t {
        let posv = match pos_table.get(&ch) {
            Some(v) => v,
            _ => {
                println!("-1");
                return;
            }
        };
        let i = bsearch(posv.len() as i64, -1, |x| {
            let p = posv[x as usize];
            cur_pos < p
        });
        if let Some(i) = i {
            let p = posv[i as usize];
            res += p - cur_pos;
            cur_pos = p;
            continue;
        }
        res += s_len as i64 - 1 - cur_pos;
        cur_pos = -1;
        let i = bsearch(posv.len() as i64, -1, |x| {
            let p = posv[x as usize];
            cur_pos < p
        });
        if let Some(i) = i {
            let p = posv[i as usize];
            res += p - cur_pos;
            cur_pos = p;
        } else {
            unreachable!();
        }
    }
    println!("{}", res);
}


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


int main()
{
    // vecter<pair<int, int>> v;
    vector<pair<int, int>> v;
    int N;
    cin >> N;
     
    int temp; 

    rep(i, N){
        cin >> temp;
        pair<int, int> ptemp(temp, i+1);
        v.push_back(ptemp);
    }
    
    sort(v.begin(), v.end());
    rep(i, N) cout << v[i].second << ' ';
    cout << endl;
    return 0;
}

Measured memory_bytes: 1780
#[allow(unused_imports)]
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Chars, Usize1};
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused)]
const ALPHA_SMALL: [char; 26] = [
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
    't', 'u', 'v', 'w', 'x', 'y', 'z',
];
#[allow(unused)]
const ALPHA: [char; 26] = [
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
    'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
];
#[allow(unused)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(unused)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(unused)]
fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
    let v: Vec<T> = read_vec();
    assert_eq!(v.len(), 2);
    (v[0], v[1])
}
fn main() {
    input!(N: usize, M: usize);
    let mut g = vec![vec![]; N];
    for _ in 0..M {
        input!((x, y, z): (Usize1, Usize1, Usize1));
        g[x].push(y);
        g[y].push(x);
    }

    let mut visit = vec![false; N];
    let mut ans = 0;
    for i in 0..N {
        if visit[i] == false {
            bfs(N, &g, i, &mut visit);
            ans += 1;
        }
    }

    println!("{}", ans);
}

//単一視点から目的のノードまでの最短距離、ただし全ての辺の重みが等しいグラフに限る
fn bfs(n: usize, g: &Vec<Vec<usize>>, start: usize, visit: &mut Vec<bool>) {
    let mut q = std::collections::VecDeque::new();

    //init
    visit[start] = true;
    q.push_back(start);

    while let Some(now) = q.pop_front() {
        for &e in &g[now] {
            if !visit[e] {
                visit[e] = true;
                q.push_back(e);
            }
        }
    }
}


Measured memory_bytes: 10788
#include<bits/stdc++.h>
#define lg long long int
#define loop(i,s,e) for(lg i=s;i<=e;i++)
#define iloop(i,s,e) for(lg i=e;i>=s;i--)
#define pb push_back
#define mp make_pair
#define mod 1000000007


using namespace std;

lg min(lg a,lg b)
{return a<b?a:b;}
lg max(lg a,lg b)
{return a>b?a:b;}
lg lcm(lg a ,lg b)
{
    return (a*b)/__gcd(a,b);
}
lg n,m,k,ans;
int main()
{
    string h;
    cin>>h;
    n=h.length();
    if(h[n-1]=='s') h+="es";
    else h+="s";

    cout<<h<<endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mkp make_pair
#define rep(i,s,f) for(i=s;i<f;i++)
#define db cout<<'h'<<'i'<<endl 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define B begin()
#define E end()
#define vi vector<int>
#define vii vector<pair<int,int>>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define PI 3.14159265
#define mod 1000000007
#define mod2 998244353
#define space 100005
//<<fixed << setprecision(9)

int main()
{
    int n,i,j,t;
    boost;
    int k;
    cin>>n>>k;
    int arr[n];
    ll sum=0;
    rep(i,0,n)
    {
        cin>>arr[i];
        sum+=arr[i];
    }
    vi v;
    rep(i,1,sqrt(sum)+3)
    {
        if(sum%i==0)
        {
            v.pb(i);
            v.pb(sum/i);
        }
    }
    
    int mx=1;
    ll up[n],p;
    ll temp;
    for(auto z:v)
    {
        temp=0;
        sum=0;
        rep(i,0,n)
        {
            p=arr[i]/z;
            p*=z;
            if(arr[i]%z!=0)p+=z;
            up[i]=p-arr[i];
            sum+=up[i];
        }
        if(sum%z==0)
        {
            sort(up,up+n);
            p=sum/z;
            p=n-p;
            rep(i,0,p)temp+=up[i];
            if(temp<=k)
            {
                mx=max(mx,z);
            }
        }
    }
    cout<<mx;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;
   cin>>s;
   if(s=="Sunny"){
     cout<<"Cloudy"<<endl;
   }
   else if(s == "Cloudy"){
     cout<<"Rainy"<<endl;
   }
   else if(s == "Rainy"){
     cout<<"Sunny"<<endl;
   }
}


Measured memory_bytes: 3496
#include<stdio.h>
#include<string.h>
#include<math.h>
#define Limit 100
#define Size 16
int mdt[Size][Size], space, score, edge;
int swap_upper(int*, int*, int);
int swap_lower(int*, int*, int);
int swap_left(int*, int*, int);
int swap_right(int*, int*, int);
int Dfs(int*, int*, int, int, int);
int main(void)
{
  int i, j, init[Size], goal[Size];
  edge = sqrt(Size);
  for (i = 0; i < Size; i++) {
    for (j = 0; j < Size; j++) {
      mdt[i][j] = fabs(i / edge - j / edge) + fabs(i % edge - j % edge);
    }
  }
  for (i = 0; i < Size; i++) {
    scanf("%d", &init[i]);
    if (!init[i]) space = i;
    else score += mdt[i][init[i]-1];
    goal[i] = (i + 1) % Size;
  }
  for (i = score; i < Limit; i++) {
    if (Dfs(init, goal, 0, -1, i)) {
      printf("%d\n", i);
      break;
    }
  }
}
int swap_upper(int *board, int *next, int prev)
{
  int i;
  if (!(space / edge) || prev == 1) return 0;
  else {
    memcpy(next, board, sizeof(int) * Size);
    next[space] = board[space - edge];
    next[space - edge] = board[space];
    score += mdt[space][next[space] - 1] - mdt[space - edge][next[space] - 1];
    space -= edge;
  }
  return 1;
}
int swap_lower(int *board, int *next, int prev)
{
  int i;
  if ((space / edge) == edge - 1 || prev == 0) return 0;
  else {
    memcpy(next, board, sizeof(int) * Size);
    next[space] = board[space + edge];
    next[space + edge] = board[space];
    score +=  mdt[space][next[space] - 1] - mdt[space + edge][next[space] - 1];
    space += edge;
  }
  return 1;
}
int swap_left(int *board, int *next, int prev)
{
  int i;
  if (!(space % edge) || prev == 3) return 0;
  else {
    memcpy(next, board, sizeof(int) * Size);
    next[space] = board[space - 1];
    next[space - 1] = board[space];
    score +=  mdt[space][next[space] - 1] - mdt[space - 1][next[space] - 1];
    space--;
  }
  return 1;
}
int swap_right(int *board, int *next, int prev)
{
  int i;
  if ((space % edge) == edge - 1 || prev == 2) return 0;
  else {
    memcpy(next, board, sizeof(int) * Size);
    next[space] = board[space + 1];
    next[space + 1] = board[space];
    score +=  mdt[space][next[space] - 1] - mdt[space + 1][next[space] - 1];
    space++;
  }
  return 1;
}
int Dfs(int *board, int *goal, int depth, int prev, int limit)
{
  int next[Size], prespace = space, prescore = score;
  if (!score) return 1;
  else if (depth + score > limit) return 0;
  if (swap_upper(board, next, prev)) {
    if (Dfs(next, goal, depth + 1, 0, limit)) return 1;
  }
  space = prespace;
  score = prescore;
  if (swap_lower(board, next, prev)) {
    if (Dfs(next, goal, depth + 1, 1, limit)) return 1;
  }
  space = prespace;
  score = prescore;
  if (swap_left(board, next, prev)) {
    if (Dfs(next, goal, depth + 1, 2, limit)) return 1;
  }
  space = prespace;
  score = prescore;
  if (swap_right(board, next, prev)) {
    if (Dfs(next, goal, depth + 1, 3, limit)) return 1;
  }
  space = prespace;
  score = prescore;
  return 0;
}


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

typedef long long ll;

const int Maxn = 100005;

int n;
int a[Maxn], b[Maxn];
ll res;

int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n + 1; i++)
        scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &b[i]);
        int tk = min(a[i], b[i]);
        a[i] -= tk; b[i] -= tk; res += tk;
        tk = min(a[i + 1], b[i]);
        a[i + 1] -= tk; b[i] -= tk; res += tk;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int N, M;
vector<vector<int>> G;
int cnt = 0;
vector<bool> Map;
int x, y;

int dfs(int u){
    cnt++;
    for(auto v : G[u]){
        if(!Map[v] && !(u == x && v == y) && !(u == y && v == x)){
            Map[v] = true;
            dfs(v);
        }
    }
    return 0;
}

int main(){
    cin >> N >> M;
    G.resize(N);
    Map.resize(N);
    set<pair<int, int>> ST;
    for(int i = 0; i < M; i++){
        int a, b; cin >> a >> b; a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
        ST.insert(make_pair(a, b));
    }
    ll ans = 0;

    for(auto st : ST){
        x = st.first;
        y = st.second;
        for(int i = 0; i < N; i++) Map[i] = false;
        Map[0] = true;
        cnt = 0;
        dfs(0);
        if(cnt != N) ans++;

    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind
#define rt (a); return (a); 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
int gcd(int a, int b) {
	if (b > a)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
int ans = 0;
int s[10][10];
int k[10];
int p[10];
void bit(int m, int n,int d) {
	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			bool w = true;
			rep(i, 0,d ) {
				int x = 0;
				rep(j, 0, k[i])if (now[s[i][j] - 1] == '1')x++;
				if (x%2 != p[i])w = false;
			}
			if(w)ans += 1;
		}
		else {
			for (int i = m - 1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
}
;
int main() {
	int n, m;
	cin >> n >> m;
	rep(i, 0, m) {
		cin >> k[i];
		rep(j, 0, k[i])cin >> s[i][j];
	}
	rep(i, 0, m)cin >> p[i];
	bit(2, n,m);
	cout << ans << endl;
		return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {return (a%b) ? gcd(b, a%b) : b;}
ll modPow(ll x, ll n) {
    if(n==0) return 1;
    ll res = modPow(x*x%MOD, n/2);
    if(n&1) res=res*x%MOD;
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll x; cin >> x;
    ll ans = 0;
    ll tmp = 100;
    while(tmp<x) {
        tmp = tmp*1.01;
        ans++;
    }
    ct(ans);
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef pair<int, int> p;
typedef long long ll;
const int inf = 1000000007;
int main() {
  int a, p;
  cin >> a >> p;
  cout << (a * 3 + p) / 2 << endl;
  return 0;
}

Measured memory_bytes: 3596
INF = float('inf')
n, m = list(map(int, input().split()))
a, b, c = [], [], []
for _ in range(m):
    abc = list(map(int, input().split()))
    a.append(abc[0])
    b.append(abc[1])
    c.append(-abc[2]) # convert pos-neg

dist = [INF]*(n+1)
dist[1] = 0
for loop in range(n-1):
    for i in range(m):
        if dist[a[i]] == INF:
            continue
        if dist[b[i]] > dist[a[i]] + c[i]:
            dist[b[i]] = dist[a[i]] + c[i]
ans = dist[-1]

negative = [False]*(n+1) # negative closed path
for loop in range(n):
    for i in range(m):
        if dist[a[i]] == INF:
            continue
        if dist[b[i]] > dist[a[i]] + c[i]:
            dist[b[i]] = dist[a[i]] + c[i]
            negative[b[i]] = True
        if negative[a[i]] is True:
            negative[b[i]] = True

    if negative[-1] is True:
        break
# print(dist, negative)
if negative[-1] is True:
    print('inf')
else:
    print(-ans)

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

typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7;
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define pb push_back

ll N;
ll M;
ll dp[100005];
ll cp[100005];
ll det[100005];

int main(){

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

cin>>N>>M;

rep(i,M){
	ll a,b;
	cin>>a>>b;
	cp[b]=max(cp[b],a);
}

dp[1]=0;
det[1]=0;
for(ll i=2; i<=N; i++){
	if(cp[i]==0){
		dp[i]=dp[i-1];
		det[i]=det[i-1];
	}
	else if(cp[i]<det[i-1]){
		dp[i]=dp[i-1];
		det[i]=det[i-1];
	}
	else if(cp[i]>=det[i-1]){
		dp[i]=dp[i-1]+1;
		det[i]=i;
	}
}

cout<<dp[N]<<endl;

}
	


Measured memory_bytes: 2560
N = int(input())
SP_ = []
for i in range(N):
  s,p = input().split()
  SP_.append([s,int(p),i])
  
SP_s = sorted(SP_,key=lambda x:(x[0],-x[1]))
#print(SP_s)

for i in range(N):
  print(SP_s[i][2]+1)
  





Measured memory_bytes: 3060
S = list(input())
dic = {'a': 0, 'b': 0, 'c': 0}

for s in S:
    dic[s] += 1

while dic['a'] > 0 and dic['b'] > 0 and dic['c'] > 0:
    dic['a'] -= 1
    dic['b'] -= 1
    dic['c'] -= 1

if max(dic.values()) >= 2:
    print('NO')
else:
    print('YES')

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 1000000007LL
#define EPS 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair

#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (int i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 200005
int n;
vi e[MN];
int co[MN];
int res[MN];
int cnt[2];
int amt[3];
int cur[3];

void dfs(int cn, int p){
    cnt[co[cn]]++;
    for(auto nn : e[cn]) if(nn != p){
        co[nn] = 1-co[cn];
        dfs(nn, cn);
    }
}

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

    cin >> n;
    F0R(_, n-1){
        int u, v;
        cin >> u >> v;
        e[u].pb(v);
        e[v].pb(u);
    }

    FOR(i, 1, n) ++amt[i%3];

    cur[1] = 1; cur[2] = 2; cur[0] = 3;

    dfs(1, 0);
    if(cnt[0] < cnt[1]){
        if(cnt[0] <= amt[0]){
            FOR(i, 1, n){
                if(co[i] == 0){
                    res[i] = cur[0];
                    cur[0] += 3;
                }
            }
        } else{
            assert(cnt[0] >= amt[2]);
            FOR(i, 1, n){
                if(co[i] == 0){
                    if(cur[2] <= n){
                        res[i] = cur[2];
                        cur[2] += 3;
                    } else{
                        res[i] = cur[0];
                        cur[0] += 3;
                    }
                }
            }
        }
        FOR(i, 1, n){
            if(co[i] == 1){
                if(cur[0] <= n){
                    res[i] = cur[0];
                    cur[0] += 3;
                } else if(cur[1] <= n){
                    res[i] = cur[1];
                    cur[1] += 3;
                } else{
                    res[i] = cur[2];
                    cur[2] += 3;
                }
            }
        }
    } else{
        if(cnt[1] <= amt[0]){
            FOR(i, 1, n){
                if(co[i] == 1){
                    res[i] = cur[0];
                    cur[0] += 3;
                }
            }
        } else{
            assert(cnt[1] >= amt[2]);
            FOR(i, 1, n){
                if(co[i] == 1){
                    if(cur[2] <= n){
                        res[i] = cur[2];
                        cur[2] += 3;
                    } else{
                        res[i] = cur[0];
                        cur[0] += 3;
                    }
                }
            }
        }
        FOR(i, 1, n){
            if(co[i] == 0){
                if(cur[0] <= n){
                    res[i] = cur[0];
                    cur[0] += 3;
                } else if(cur[1] <= n){
                    res[i] = cur[1];
                    cur[1] += 3;
                } else{
                    res[i] = cur[2];
                    cur[2] += 3;
                }
            }
        }
    }

    FOR(i, 1, n){
        cout << res[i] << " ";
    }
    cout << "\n";

    return 0;
}


Measured memory_bytes: 21376
import java.util.Scanner;

public class Main {
    public boolean shouldTurnOn(int temperature) {
        return temperature >= 30;
    }

    public static void main(String[] args) throws Exception {
        Main solution = new Main();

        Scanner scanner = new Scanner(System.in);
        int temperature = scanner.nextInt();

        boolean shouldTurnOn = solution.shouldTurnOn(temperature);
        if (shouldTurnOn) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35640
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

int solve(int a)
{
  return a + a * a + a * a * a;
}

int main()
{
  int a;
  std::cin >> a;

  std::cout << std::setprecision(20);
  std::cout << solve(a) << std::endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main() {
 string A;
 cin >> A;
 
 int count = A.size()/2;
  
 if (A.size() % 2 == 0){ 
  for (int i=0;i<A.size()-1;i+=2){
   if (A.at(i) == 'h' && A.at(i+1)=='i'){
   count--; 
   }
   else
     break;
  }
  if (count == 0)
    cout << "Yes" << endl;
  else 
    cout << "No" << endl;
 }
 else
   cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<string>
#include <numeric>
#include<math.h>
#include <bits/stdc++.h>
using namespace std;

int main(void) {

    string a;
    int c=0;
    cin>>a;
    if(a[0]=='1')c++;
    if(a[1]=='1')c++;
    if(a[2]=='1')c++;

    cout<<c<<endl;
}


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

int main(){
    int N; cin >> N;
    list<int> b;
    for (int i = 0; i < N; i++){
        int x; cin >> x;
        b.push_back(x);
    }
    vector<int> ans;
    for (int i = 0; i < N; i++)
    {
        int k = N - i;
        auto lastpos = b.end();
        int pos = 1;
        for (auto iter = b.begin(); iter != b.end(); ++iter)
        {
            //cout << pos << " " << *iter << endl;
            if(*iter == pos) lastpos = iter;
            pos++;
        }

        if(lastpos==b.end()){
            cout << -1 << endl;
            return 0;
        }
        //cout << *lastpos << endl;
        ans.push_back(*lastpos);
        b.erase(lastpos);
    }
    reverse(ans.begin(), ans.end());
    for(int i: ans) cout << i << '\n';    
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"container/list"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func asub(x, y int) int {
	if x > y {
		return x - y
	}
	return y - x
}

func solve(a []int, N int) int {
	l := list.New()
	l.PushBack(a[0])
	a = a[1:]
	ans := 0
	fpos := 0
	bpos := len(a) - 1
	for i := 0; i < len(a); i++ {
		f := l.Front().Value.(int)
		b := l.Back().Value.(int)
		diff := [4]int{
			asub(f, a[fpos]),
			asub(f, a[bpos]),
			asub(b, a[fpos]),
			asub(b, a[bpos]),
		}
		//out(f, b, a[fpos], a[bpos], diff)
		sel := 0
		for j := 0; j < 4; j++ {
			if diff[sel] < diff[j] {
				sel = j
			}
		}
		switch sel {
		case 0:
			l.PushFront(a[fpos])
			fpos++
		case 1:
			l.PushFront(a[bpos])
			bpos--
		case 2:
			l.PushBack(a[fpos])
			fpos++
		case 3:
			l.PushBack(a[bpos])
			bpos--
		}
		ans += diff[sel]
	}

	return (ans)
}

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = getInt()
	}
	sort.Ints(a)

	ans := solve(a, N)
	out(ans)
}


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

int main(int argc, char *argv[]) {
  int N;
  cin >> N;
  int count = 0;
  int r = 0;
  for(int i = 1; i <= N; i++) {
    if(i % 2 == 0) continue;
    for(int j = 1; j <= i; j++) {
      if(i % j == 0) {
        count++;
      }
    }
    if(count == 8) {
      r ++;
    }
    count = 0;
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 256
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}



int main(){
  int n;cin>>n;
  vector<int> A(n);
  for(int i = 0; n > i; i++){
    cin>>A[i];
  }
  int nw = 0;
  int ans = 0;
  for(int i = 0; n > i; i++){
    if(nw <= A[i]){
      ans++;
      nw = A[i];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct data
{
	int w,id;
	friend bool operator < (data a,data b){return a.w<b.w;}
}d[200020];
int n,a[100010],b[100010],cnt1,cnt2;
long long ans,sum;
bool usea[100010],useb[100010];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		scanf("%d %d",&a[i],&b[i]);
		d[i*2-1]=data{a[i],i};
		d[i*2]=data{b[i],-i};
	}
	sort(d+1,d+1+2*n);
	int cnt1=0,cnt2=0;
	for(int i=1;i<=n;++i)
	{
		sum+=d[i].w;
		if(d[i].id>0)usea[d[i].id]=1,++cnt1;
		else useb[-d[i].id]=1,++cnt2;
	}
	bool f=0;
	for(int i=1;i<=n;++i)if(usea[i]&&useb[i])f=1;
	if(cnt1==n||cnt2==n||f)return printf("%lld",sum),0;
	int mx=0;
	for(int i=1;i<=n;++i)if(d[i].id!=-d[n+1].id)mx=max(mx,d[i].w);
	ans=sum+d[n+1].w-mx;
	mx=0;
	for(int i=1;i<=n;++i)if(d[i].id!=-d[n+2].id)mx=max(mx,d[i].w);
	ans=min(ans,sum+d[n+2].w-mx);
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> pippi;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
int iinf=1<<30;
double pi=3.141592653589793238462643383279L;
double eps=1e-8;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    if(k<0)return 0;
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}


int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll n;cin>>n;
    ll ans=0;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            ll cnt=0;
            while(n%i==0){
                cnt++;
                n/=i;
            }
            rep(j,1,100){
                if(j*(j+1)/2>cnt){
                    ans+=j-1;
                    break;
                }
            }
        }
    }
    if(n>1)ans++;
    cout<<ans<<endl;
}


Measured memory_bytes: 3576
#include<iostream>
using namespace std; // 575

int main() {
	int N, H, high = 0, ans = 0;
	cin >> N;
	for (int i = 0;i < N;++ i) {
		cin >> H;
		if (high <= H) ++ ans;
		high = max(high, H);
	}
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

*/

Measured memory_bytes: 256
/*3.2 hightierra*/
#include <stdio.h>
 
int main(void){
    //変数の定義
    int N,i;
    scanf("%d",&N);
    //iにNの１の位を代入
    i = N % 10;

    //iの値で場合わけ
    switch(i){
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
          printf("hon");
          break;
        case 0:
        case 1:
        case 6:
        case 8:
          printf("pon");
          break;
        case 3:
          printf("bon");
          break;
    }
    return 0;
}

Measured memory_bytes: 1688
#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    string n;
    cin >> n;
    string s;
    if(n[0]==n[1]&&n[1]==n[2]) s="Yes";
    else if(n[1]==n[2]&&n[2]==n[3]) s="Yes";
    else s="No";
    cout << s << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int Size = 10005;
int Arr[Size];
int main()
{
    int N, F = 0, maxx = 0; cin >> N;
    while (F <= N){
        maxx++;
        F = (maxx*maxx) + (2*maxx) + 3;
    }
    for (int i = 1; i < maxx; i++){
        for (int j = 1; j < maxx ; j++){
            for (int k = 1; k < maxx; k++){
                F = (i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(i*k);
                if (F <= N) Arr[F]++;
            }
        }
    }
    for (int i = 1; i <= N; i++)
        cout << Arr[i] << endl;
}


Measured memory_bytes: 3632