akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;
typedef vector<int> Vint;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

signed main(void){
  int i, j, k;
  for(int testcase = 0;testcase < 1234567;testcase++){
    for(;;){
      string s; cin >> s; if(s == "#") break;
      int t = 0, b = 1;
      for(i = s.size() - 1;i >= 0;){
        if(s[i] == 'h'){
          if(t != 0)t = t * 2 - 90;
          i -= 5;
        }else{
          if(t != 45 * b)t = t * 2 + 90;
          i -= 4;
        }
        b *= 2;
      }
      b /= 2;
      if(t == 0)pri(0);
      else{
        for(;!(t % 2) & !(b % 2);){t /= 2; b /= 2;}
        if(b == 1)pri(t);
        else printf("%d/%d\n", t, b);
      }
    }

/*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	#ifdef LOCAL
//		freopen("in1.txt", "r", stdin);
//		freopen("in1.txt", "w", stdout);
	#endif
	string s;
	cin >> s;
	int cnt = 0;
	for (char x : s) cnt += (x == 'R');
	if (cnt == 2 && s[1] == 'S') cnt--;
	cout << cnt << '\n';
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

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

/*---------------------------------------------------*/

int main(){
  ll a[5]={0},n;
  string s;
  cin>>n;
  rep(i,n){
    cin>>s;
    if(s[0]=='M')a[0]++;
    if(s[0]=='A')a[1]++;
    if(s[0]=='R')a[2]++;
    if(s[0]=='C')a[3]++;
    if(s[0]=='H')a[4]++;
  }
  //rep(i,5)cout<<"DEBUG"<< " "<<a[i]<<endl;
  ll ans=0;
  REP(i,0,5){
    REP(j,i,5){
      REP(k,j,5){
	if(i==j||j==k||k==i)continue;
	//cout<<i<<" "<<j<<" "<<k<<endl;
	ans+=a[i]*a[j]*a[k];
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
str = gets.chomp
gets.to_i.times do
 n = gets.chomp.split
 f = n[1].to_i
 l = n[2].to_i
 case n[0]
 when 'replace'
   str[f..l] = n[3]
 when 'reverse'
   str[f..l] = str[f..l].reverse
 when 'print'
   puts str[f..l]
 end
end

Measured memory_bytes: 8680
import math
n=int(input())

#temp_n=int(math.sqrt(2*n)//1)-1
temp_n=int((-1+math.sqrt(1+8*n))//2)
#print(n,temp_n)

while(temp_n*(temp_n+1) < 2*n):
    temp_n+=1

#print(n,temp_n)
ans=[]
while(n>0):
#    print(n,temp_n,ans)
    if(n>=temp_n):
        n-=temp_n
        ans.append(temp_n)
        temp_n-=1
    else:
        temp_n=n
        ans.append(temp_n)
        n-=temp_n
ans.sort()

for ai in ans:
    print(ai)


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

template<typename T>
class BIT
{
//bit[x]
//manage range of bit[x] is (x & -x)
//
public:
	static const int n = 2*110000;
	T bit[n] = {};
	void add(int a, T w)
	{
		for (int x = a; x <= n; x += x & -x)
		{
			bit[x] += w;
		}
	}
	T sum(int a)
	{
		T ret = 0;
		for (int x = a; x > 0; x -= x & -x)
		{
			ret += bit[x];
		}
		return ret;
	}

};

int main()
{
	string s;
	cin >> s;
	int hairetsu[2*110000];
	int n = s.size();
	for (int i = 1; i <= n; ++i)
	{
		hairetsu[i] = (s[i-1] == 'B'?1:0);
	}
	long long int ans = 0;
	BIT<long long int> BT;
	for (int i = 1; i <= n; ++i)
	{
		BT.add(i, hairetsu[i]);
		if (hairetsu[i] == 0)
		{
			ans += BT.sum(i);
		}
		// cout << i - BT.sum(hairetsu[i]) << " ";
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
	int N;
	static long long H[100000], ANS = 0, Cur = 0;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> H[i];
	for (int i = 0; i < N - 1; i++) {
		if (H[i] >= H[i + 1]) {
			Cur++;
		}
		else {
			Cur = 0;
		}
		ANS = max(ANS, Cur);
	}
	cout << ANS << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int a[n];
  int num=1;
  rep(i,n){
    cin>>a[i];
  }
  int mx=1000000000000000000;
  sort(a,a+n);
  if(a[0]==0){
    cout<<0<<endl;
    return 0;
  }
  rep(i,n){
    
    int x=mx/num;
    // cout<<x<<endl;
    if(a[i]>x){
      cout<<-1<<endl;
      return 0;
    }
    num*=a[i];
  }
  cout<<num<<endl;
    

  return 0;
}


Measured memory_bytes: 4388
#include <bits/stdc++.h>
using namespace std;
const int N = 16;
typedef long long ll;
ll sum[1 << N], dp[1 << N], a[N][N], n;
int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i)
        for  (int j = 0; j < n; ++j)
            cin >> a[i][j];
    for (int S = 1; S < (1 << n); ++S) {
        int i = __lg(S & -S);
        sum[S] = sum[S ^ (1 << i)];
        for (int j = i + 1; j < n; ++j)
            if (S >> j & 1)
                sum[S] += a[i][j];
        dp[S] = sum[S];
        for (int T = S; T > 0; T = (T - 1) & S)
            dp[S] = max(dp[S], dp[S ^ T] + dp[T]);
    }
    cout << dp[(1 << n) - 1] << endl;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ifstream f("D.in");
ofstream g("D.out");


int main()
{
    ll x,N,sum=0,mini=1e9+2;
    cin>>N;
    vector < ll > V;
    for(int i=1;i<=N;i++)
    {
        cin>>x;
        V.push_back(x);
    }
    sort(V.begin(),V.end());
    if(N==1) cout<<0;
    else
    if(N==2) cout<<V[N-1];
    else
    {
        sum=V[N-1];
        int idx=N-2,op=0;
        for(int i=N-3;i>=0;i--)
        {
            sum+=V[idx];
            op++;
            if(op==2)
            {
                idx--;
                op=0;
            }
        }
        cout<<sum;
    }

    return 0;
}


Measured memory_bytes: 5348
use strict;
use warnings;

my $str = <>;
chomp $str;

if ( $str eq 'SUN' ) {
    print 7;
} elsif ( $str eq 'SAT' ) {
    print 1;
} elsif ( $str eq 'FRI' ) {
    print 2;
} elsif ( $str eq 'THU' ) {
    print 3;
} elsif ( $str eq 'WED' ) {
    print 4;
} elsif ( $str eq 'TUE' ) {
    print 5;
} elsif ( $str eq 'MON' ) {
    print 6;
} else {
    print 'error'
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  ll n;
  cin>>n;
  map<ll,ll> soin;
  ll c=n;
  for(ll i=2;i*i<=n;i++){
    
    while(n%i==0) {
     soin[i]++;
      n/=i;
     
    }
    
  }
  ll ans=0;
  if(n!=1) ans++;
  //
  
  for(ll i=2;i*i<=c;i++){
    for(int j=1;j<100;j++){
     if(soin[i]>=j) {
       ans++;
       soin[i]-=j;
     }
      else break;
    }
  }
  if(c==1) cout<<0<<endl;
  else{
    
  cout<<ans<<endl;
  }
 //cout<<sqrt(c)<<endl;
}




Measured memory_bytes: 65996
#include<bits/stdc++.h>
using namespace std;
int main(){
  long K;cin>>K;
  long p=9;vector<vector<long>>D;
  D.push_back({1,2,3,4,5,6,7,8,9});
  while(p<K){
    vector<long>E;
    for(long x:D[D.size()-1]){
      if(x%10<9)E.push_back(x*10+(x%10)+1);
      E.push_back(x*10+(x%10));
      if(x%10>0)E.push_back(x*10+(x%10)-1);
    }
    sort(E.begin(),E.end());
    D.push_back(E);
    p+=E.size();
  }
  cout<<D[D.size()-1][D[D.size()-1].size()-p+K-1];
}

Measured memory_bytes: 6764
#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,ra,re) for((i)=ra;(i)<(re);(i)++)
#define _rep(i,ra,re) for((i)=ra;(i)>(re);(i)--)
#define rep_(i,ra,re) for((i)=ra;(i)<=(re);(i)++)
#define _rep_(i,ra,re) for((i)=ra;(i)>=(re);(i)--)
#define put(n) cout << n << " "; 
#define puts(n) cout << n << endl;
#define pu(n) cout << n;
#define mod 1000000007
int i,j,k,l;
static const int MAX_N=10e5;
long x[MAX_N];
int main(void){
	int N;
		cin >> N;
	int a,front;
	cin >> front;
	x[0]=front;
	rep(i,1,N){
		cin >> a;
		if(front<a)
			a--;
		front=a;
		x[i]=front;
	}
	bool c=true;
	rep(i,0,N-1){
		if(x[i]>x[i+1]){c=false;break;}
	}if(c){puts("Yes");}else{puts("No");}
	return 0;
}


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

int N, M, Res;

int main(){
	int i, a;
	scanf("%d %d", &N, &M);
	scanf("%d", &a); Res = abs(M - a);
	for(i = 1; i < N; i++) scanf("%d", &a), Res = __gcd(Res, abs(M - a));
	printf("%d", Res);
	return 0;
}

Measured memory_bytes: 384
import functools as f

def to_num(a, b):
    if a > b:
        return 1
    if b > a:
        return -1
    return 0

def cmp(a, b):
    if (a[0] == b[0]):
        return to_num(b[1], a[1])
    return to_num(a[0], b[0])

n = int(input())
A = []
for i in range(n):
    a, b = input().split()
    A.append([a, int(b), i + 1])
#print(A)
A.sort(key=f.cmp_to_key(cmp))
for i in range(n):
    print(A[i][2])
#for i in range(n):


Measured memory_bytes: 3572
/*

*/
#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
  char a;cin>>a;
  cout<<(a>='A'&&a<='Z'?'A':'a')<<endl;
}


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

typedef long long ll;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

int main(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int x=max(a,max(b,c));
    cout<<a+b+c+x*pow(2,k)-x<<endl;
}

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

int main(){

  int x;
  int N[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cin >> x;
  cout << N[x-1] << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    string c;
    string v("aiueo");
    cin >> c;
    if(v.find(c) != -1){
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }
    return 0;
}

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

const int mod = 1e9+7;
const long long inf = 1e18;

int main() 
{
	int n;
	scanf("%d", &n);
	vector<long long> v(n);
	long long dp[n+1][n+1];
	for(int i = 0; i < n; i++) {
		scanf("%lld", &v[i]);
	}
	long long pre_sum[405];
	pre_sum[0] = v[0];
	for(int i = 1; i < n; i++) {
		pre_sum[i] = pre_sum[i-1] + v[i];
	}
	for(int i = n-1; i >= 0; i--) {
		for(int j = i; j < n; j++) {
			if(i == j) {
				dp[i][j] = 0;
			} else {
				dp[i][j] = inf;
				for(int k = i; k <= j; k++) {
					dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + pre_sum[j] - (i>0?pre_sum[i-1]:0));
				}
			}
		}
	}
	printf("%lld\n", dp[0][n-1]);
}

Measured memory_bytes: 5004
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<pi> vpi;

#define debugone(x) cerr << #x << " " << x << endl;
#define debugtwo(x) cerr << #x << "-------------" << endl;for(auto &it: x) cerr << it << " ";cerr << endl;
#define debugthree(x, i, j) cerr << #x << "------------" << endl;cerr << "from " << i << " to " << j << endl;for(int k=i; k<=j; k++) cerr << x[k] << " ";cout << endl;


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

	 int n;
	 cin >> n;
	 pi a[n];

	 for(int i = 0; i < n; i++){
	 	cin >> a[i].second >> a[i].first;
	 }

	 sort(a, a + n);

	 bool yes = true;

	 int currTime = 0;
	 for(int i = 0; i < n; i++){
	 	currTime += a[i].second;
	 	if(currTime > a[i].first){
	 		yes = false;
	 		break;
	 	}
	 }

	 cout << (yes ? ("Yes") : ("No")) << endl;

}			

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

ll n,q;
vector<ll> v;

bool binarySearch(int x){
    ll vl=0,vr=n+1;
    while(vr-vl>1){
        ll idx = (vl+vr)/2;
        if(v[idx]==x) return true;
        else if(v[idx]>x) vr = idx;
        else vl = idx;
    }
    if(v[vl]==x || v[vr]==x) return true;
    return false;
}

int main(){
    cin >> n;
    v.resize(n);
    for(int i=0;i<n;i++){
        cin >> v[i];
    }
    ll res=0;
    cin >> q;
    for(int i=0;i<q;i++){
        int x; cin >> x;
        if(binarySearch(x)) res++;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (int i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (int i = x.size()-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define fst first
#define scd second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int n, r;

int main()
{
    cin>>n>>r;
    cout<<r + 100 * max(0, 10 - n)<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	int n,a,cnt=0;
	cin>>n;
	for (int i = 0; i < n; ++i){
		cin>>a;
		while(a%2==0){
			a/=2;
			cnt++;
		}
	}

	cout<<cnt<<endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  int A[N],B[N],C[N];
  REP(i,N)cin>>A[i];
  REP(i,N)cin>>B[i];
  REP(i,N)cin>>C[i];
  sort(A,A+N);
  sort(B,B+N);
  sort(C,C+N);
  lint ans=0;
  REP(i,N){
    lint temp=1;
    temp*=lower_bound(A,A+N,B[i])-A;
    temp*=C-upper_bound(C,C+N,B[i])+N;
    ans+=temp;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <string.h>
using namespace std;

string s;
int a[100000];

int main()
{
	cin >> s;

	memset(a, 0, sizeof(a));
	int n = s.size();

	for (int i = 0; i < n - 1; i++) {
		if (s[i] == 'R' && s[i + 1] == 'L') {
			int j = i;

			while (j >= 0 && s[j] == 'R') {
				if ((i - j) % 2 == 0)
					a[i]++;
				else
					a[i + 1]++;

				j--;
			}

			j = i + 1;

			while (j < n && s[j] == 'L') {
				if ((j - i) % 2 == 0)
					a[i]++;
				else
					a[i + 1]++;

				j++;
			}
		}
	}

	for (int i = 0; i < n - 1; i++)
		cout << a[i] << " ";
	cout << a[n - 1] << endl;

	return 0;
}

Measured memory_bytes: 1024
S = input()

answer = ''

for i in range(len(S)):
    s = S[i]
    if i+1 <= len(S)-1 and S[i+1] == s:
        answer = str(i+1) + ' ' + str(i+2)
        break
    elif i+2 <= len(S)-2 and S[i+2] == s:
        answer = str(i+1) + ' ' + str(i+3)
        break
    else:
        answer = '-1 -1'

print(answer)

Measured memory_bytes: 3188
ans=10**8
s=input()
t=input()

end=False
for i in range(len(s)):
    cnt=0
    for q in range(len(t)):
        if i+q==len(s):
            end=True
            break
        if s[i+q]!=t[q]:
            cnt+=1
            #print("!")
    if end:
        break
    #print(cnt)
    ans=min(ans,cnt)
print(ans)

Measured memory_bytes: 9116
var input = ""
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
 
process.stdin.on('end', function() {
  input = input.split("\n");
  var i = 0;
  while (true) {
    var x = input[i];
    if (x == "0") {
      break;
    }

    var sum = 0;
    for (j = 0; j < x.length; j++) {
      sum += parseInt(x[j], 10);
    }

    console.log(sum)
    i++;
  }
});

Measured memory_bytes: 8700
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    a,b,k = LI()
    s = set()
    for i in range(a,a+k):
        if i > b:
            break
        s.add(i)
    for i in range(b-k+1,b+1):
        if i < a:
            continue
        s.add(i)


    return '\n'.join(map(str, sorted(list(s))))


print(main())




Measured memory_bytes: 5584
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
4
0 1 2
1 2 1
1 3 3

output:
5
"""

import sys
from math import isinf
from collections import deque


def generate_adj_table(v_table, init_adj_table):
    for each in v_table:
        source, target, cost = map(int, each)
        init_adj_table[source][target] = cost
        init_adj_table[target][source] = cost

    return init_adj_table


def graph_bfs(current, v_num, adj_table):
    queue = deque()
    distance = [float('inf')] * v_num
    distance[current] = 0
    queue.appendleft(current)

    while queue:
        current = queue.popleft()
        for adj, cost in adj_table[current].items():
            if isinf(distance[adj]):
                distance[adj] = distance[current] + cost
                queue.append(adj)
    return distance


def calc_tree_diameter(v_num, adj_table):
    # init x -> bridge vertex
    init_v = 0
    distance_1 = graph_bfs(init_v, v_num, adj_table)
    diameter, bridge_v = 0, 0
    for v, dis_1 in enumerate(distance_1):
        if isinf(dis_1):
            continue
        elif diameter < dis_1:
            diameter = dis_1
            bridge_v = v

    # bridge vertex -> y
    distance_2 = graph_bfs(bridge_v, v_num, adj_table)
    diameter = 0
    for dis_2 in distance_2:
        if isinf(dis_2):
            continue
        diameter = max(diameter, dis_2)

    return diameter


def solve():
    _input = sys.stdin.readlines()
    v_num = int(_input[0])
    edges = map(lambda x: x.split(), _input[1:])

    init_adj_table = tuple(dict() for _ in range(v_num))
    adj_table = generate_adj_table(edges, init_adj_table)
    ans = calc_tree_diameter(v_num, adj_table)
    print(ans)
    return None


if __name__ == '__main__':
    solve()

Measured memory_bytes: 63124
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 無限 #####
# inf = float('inf')

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

inf = float('inf')

def main():
	N,K = inputMap()
	ans = 1

	while True:
		tmp = N // K
		if tmp == 0:
			break
		N = tmp
		ans += 1

	print(ans)


if __name__ == "__main__":
	main()


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

void func(int num, int& sento, int& matsubi) {
	string num_str = to_string(num);
	sento = num_str[0] - '0';
	matsubi = num % 10;
}

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

	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int sento, matsubi;
		func(i, sento, matsubi);
		if (matsubi == 0) {
			continue;
		}
		//1ケタ
		if (sento == matsubi) {
			ans++;
		}
		//2ケタ
		int num = matsubi * 10 + sento;
		if (num > n) {
			goto LBL_CONTINUE;
		}
		ans++;
		//3ケタ
		for (int j = 0; j <= 9; j++) {
			int num = matsubi * 100 + j * 10 + sento;
			if (num > n) {
				goto LBL_CONTINUE;
			}
			ans++;
		}
		//4ケタ
		for (int j = 0; j <= 99; j++) {
			int num = matsubi * 1000 + j * 10 + sento;
			if (num > n) {
				goto LBL_CONTINUE;
			}
			ans++;
		}
		//5ケタ
		for (int j = 0; j <= 999; j++) {
			int num = matsubi * 10000 + j * 10 + sento;
			if (num > n) {
				goto LBL_CONTINUE;
			}
			ans++;
		}
		//6ケタ
		for (int j = 0; j <= 9999; j++) {
			int num = matsubi * 100000 + j * 10 + sento;
			if (num > n) {
				goto LBL_CONTINUE;
			}
			ans++;
		}
	LBL_CONTINUE:continue;
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    double a, b, c, d, e, f;
    while (cin >> a >> b >> c >> d >> e >> f) {
        double x = (c * e - b * f) / (a * e - b * d);
        double y = (a * f - c * d) / (a * e - b * d);
        x *= 1000; x = x + (x > 0 ? 0.5 : -0.5); x = (int)x;
        y *= 1000; y = y + (y > 0 ? 0.5 : -0.5); y = (int)y;
        printf("%.3f %.3f\n", x / 1000, y / 1000);
    }
    return 0;
}

Measured memory_bytes: 3188
data = [int(x) for x in input().split()]
n = data[0]
a = data[1]
b = data[2]
maximum = b*(n-1) + a 
minmum = b + a*(n-1)
if a > b:
    print(0)
elif n == 1 and a != b:
    print(0)
else:
    print(maximum - minmum +1)
    

Measured memory_bytes: 38492
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n, r;
	cin >> n >> r;
	
	if( n < 10 ) {
		cout << r + 100 * (10 - n) << endl;
	} else {
		cout << r << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define pp pair<int,int>
#define ll long long
int inf=100000000;
ll INF=100000000000000000;
ll are=1000000007;

int main() {
    string s;
    cin >> s;
    ll c=0,an=0,bn=0;
    ll q=1,qq;
    int p=0;
    rep(i,s.size()) if (s.at(i)=='?') {qq=q;q=(q*3);q=q%are;p++;}
    if (p<=3){
    //cout << q << endl;
    for (int i=s.size()-1;i>-1;i--){
        if (s.at(i)=='A') an=(an+bn)%are;
        if (s.at(i)=='B') bn=(bn+c);
        if (s.at(i)=='C') c=(c+q);
        if (s.at(i)=='?') {
            an=(an+bn/3)%are;
            bn=(bn+c/3);
            c=(c+qq);
        }
    }
    }
    else {
        q=1;
        int uu=0;
        rep(i,s.size()){
            if (s.at(i)=='?' && uu>=3) {qq=q;q=(q*3);q=q%are;p++;}
            else if (s.at(i)=='?') uu++;
        }
        for (int i=s.size()-1;i>-1;i--){
        if (s.at(i)=='A') an=(an+bn*3)%are;
        if (s.at(i)=='B') bn=(bn+c*3)%are;
        if (s.at(i)=='C') c=(c+q*3)%are;
        if (s.at(i)=='?') {
            an=(an+bn)%are;
            bn=(bn+c)%are;
            c=(c+q)%are;
        }
    }
    }
    cout << an << endl;
}


Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <climits>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define in insert
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define f first
#define s second
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define int ll
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
using namespace std;

 
const ll INF = 1e12;
const ll N =(3e5+5); // TODO : change value as per problem
const ll MOD = 1e9+7;
void solve(){	
	string s;
	cin >> s;
	int n = (int)s.size();
	map<char,int> m;
	for(int i =0;i<n;i++){
		m[s[i]]++;
	}
	int cur = (n*(n-1))/2;
	for(char c = 'a';c<='z';c++){
		cur -= (m[c]*(m[c]-1))/2;
	}
	cout << cur + 1 << endl;
}
signed main(){
 
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
     // freopen(".in","r",stdin);freopen(".out","w",stdout);
    
     ll tt=1;   
     // cin >> tt;
    while(tt--){    
        solve();
    }    
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, m; cin >> n >> m;
    vector<deque<int>> v(n, deque<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> v[i][j];
        }
    }
    vector<bool> deleted(m+1, false);
    vector<int> count(m+1, 0);
    int q = m;
    int ans = 1e9;
    while (q--) {
        for (int i = 0; i < n; i++) {
            while (deleted[v[i].front()]) v[i].pop_front();
            count[v[i].front()]++;
        }
        int maxi = 0; int index = 0;
        for (int i = 1; i <= m; i++) {
            if (maxi < count[i]) {
                maxi = count[i]; index = i;
            }
            count[i] = 0;
        }
        ans = min(ans, maxi);
        deleted[index] = true;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 768
using System;

class Program {
    static void Main (string[] args) {
        string n = Console.ReadLine ();
        int sum = 0;
        for (int i = 0; i < n.Length; i++)
            sum += int.Parse (n[i].ToString ());
        //出力
        Console.WriteLine (sum % 9 == 0 ? "Yes" : "No");
    }
}

Measured memory_bytes: 32956
n, m = gets.chomp.split(' ').map(&:to_i)
high = gets.chomp.split(' ').map(&:to_i)

res = Array.new(n, true)
m.times do
  a, b = gets.chomp.split(' ').map(&:to_i)
  if high[a-1] > high[b-1]
    res[b-1] = false
  elsif high[a-1] < high[b-1]
    res[a-1] = false
  else
    res[b-1] = false
    res[a-1] = false
  end
end

puts res.count(true)


Measured memory_bytes: 23252
#include <iostream>

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define N 1000

using namespace std;

void trace(int A[], int n) {
  int i;
  rep(i,n) {
    if(i > 0) cout << " ";
    cout << A[i];
  }
  cout << endl;
}

int main () {
  int n, A[N+1];
  int i, j, key;

  // input
  cin >> n;
  rep(j,n) cin >> A[j];
  
  // trace
  trace(A,n);
  // sort
  REP(j,1,n) {
    key = A[j];
    i = j - 1;
    while (i >= 0 && A[i] > key) {
      A[i+1] = A[i];
      i = i - 1;
    }
    A[i+1] = key;
    // output
    trace(A,n);
  }
  return 0;
}

Measured memory_bytes: 1164
import java.io.*;
import java.util.*;
//import java.util.stream.*;
//import java.math.*;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        HashMap<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < 26; i++) {
            map.put((char) (97 + i), Integer.MAX_VALUE);
        }
        int n = Integer.parseInt(br.readLine());
        String array[] = new String[n];
        for (int i = 0; i < n; i++) {
            array[i] = br.readLine();
        }
        for (int i = 0; i < n; i++) {
            int arr[] = new int[26];
            for (int j = 0; j < array[i].length(); j++) {
                char c = array[i].charAt(j);
                arr[c - 97]++;
            }
            for (int k = 0; k < 26; k++) {
                if (arr[k] < map.get((char) (k + 97))) {
                    map.put((char) (97 + k), arr[k]);
                }
            }
        }
        String s = "";
        for (Map.Entry<Character, Integer> entry : map.entrySet()) {
            if (entry.getValue() > 0) {
                int x = entry.getValue();
                char c = entry.getKey();
                for (int i = 0; i < x; i++) {
                    s += c;
                }
            }
        }
        System.out.println(s);
        bw.flush();
    }
}


Measured memory_bytes: 23892
#include<stdio.h>
 
int main(void){
  int D,T,S;
  scanf("%d ",&D);
  scanf("%d ",&T);
  scanf("%d ",&S);
  if((double)D/S<=T)
    printf("Yes\n");
  else
    printf("No\n");
  
  return 0;
}


Measured memory_bytes: 2084
#include <stdio.h>

int main()
{
    double L[10];
    double V1, V2;
    double meet_pos;
    double railway_lenth;
    int cnt1, cnt2;
    int output[50];
    
    cnt2 = 0;
    while(1)
	{
    	if(scanf("%lf,", &L[0]) == EOF)
    	{
			break;
		}
    	for(cnt1 = 1; cnt1 < 10; cnt1++)
    	{
			scanf("%lf,", &L[cnt1]);
		}
		scanf("%lf,%lf", &V1, &V2);
    	
    	railway_lenth = 0;
    	for(cnt1 = 0; cnt1 < 10; cnt1++)
    	{
			railway_lenth += L[cnt1];
		}
    	meet_pos = railway_lenth * V1 / (V1 + V2);
    	
    	cnt1 = 0;
    	railway_lenth = 0;
    	while(railway_lenth < meet_pos)
    	{
			railway_lenth += L[cnt1];
			cnt1++;
    	}
    	output[cnt2] = cnt1;
    	cnt2++;
    }
    
    for(cnt1 = 0; cnt1 < cnt2; cnt1++)
    {
		printf("%d\n", output[cnt1]);
	}
    
    
	
    return 0;
} 

Measured memory_bytes: 624
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e14;
const int ZERO = 0;
const double PI = 3.14159265359;
typedef pair<int,int> P;

//頂点fromから頂点toへのコストcostの辺
struct edge{
	int from,to,cost;
};

edge es[100010]; //辺
int d[100010]; //最短距離
int N,M; //頂点数、辺数
bool negative[100010];

//ｓ番目の頂点から各頂点への最短距離を求める
int shortest_path(int s) {
	for(int i = 0;i < N;i++) {
		d[i] = INF;
	}
	d[s] = 0;
	for(int j = 0;j < N - 1;j++) {
		bool update = false;
		for(int i = 0;i < M;i++) {
			edge e = es[i];
			if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				update = true;
			}
		}
		if(update == false) {
			break;
		}
	}
    int ans = d[N - 1];
    for(int i = 0;i < N;i++) {
        negative[i] = false;
    }
    for(int i = 0;i < N;i++) {
        bool update = false;
		for(int i = 0;i < M;i++) {
			edge e = es[i];
			if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
                negative[e.to] = true;
				update = true;
			}
		}
		if(update == false) {
			break;
		}
    }
    if(negative[N - 1] == true) {
        return INF;
    }
    else {
        return -ans;
    }
}

signed main() {
    cin >> N >> M;
    for(int i = 0;i < M;i++) {
        int A,B,C;
        cin >> A >> B >> C;
        es[i] = edge{A - 1,B - 1,-C};
    }
    if(shortest_path(0) == INF) {
        cout << "inf" << endl;
    }
    else {
        cout << shortest_path(0) << endl;
    }
}

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

int main() {
    int n; cin >> n;
    string s; cin >> s;
    int ma = 0;
    for (int i = 0; i <= n; i++) {
        vector<bool> exists(128);
        for (int j = 0; j < i; j++) exists[s[j]] = true;
        int cnt = 0;
        for (int j = i; j < n; j++) if (exists[s[j]]) {
            exists[s[j]] = false;
            cnt++;
        }
        ma = max(ma, cnt);
    }
    cout << ma << endl;
    return 0;
}


Measured memory_bytes: 256
//In the name of Allah :)
#include <bits/stdc++.h>
using namespace std;
string to_string(char c) { return string(1,c); }
string to_string(bool b) { return b ? "true" : "false"; }
string to_string(const char* s) { return (string)s; }
string to_string(string s) { return s; }
template<class A> string to_string(complex<A> c) { 
	stringstream ss; ss << c; return ss.str(); }
string to_string(vector<bool> v) { 
	string res = "{"; for(int i = 0; i < (int)v.size(); i++) res += char('0'+v[i]);
	res += "}"; return res; }
template<size_t SZ> string to_string(bitset<SZ> b) {
	string res = ""; for(size_t i = 0; i < SZ; i++) res += char('0'+b[i]);
	return res; }
template<class A, class B> string to_string(pair<A,B> p);
template<class T> string to_string(T v) { // containers with begin(), end()
	bool fst = 1; string res = "{";
	for (const auto& x: v) {
		if (!fst) res += ", ";
		fst = 0; res += to_string(x);
	}
	res += "}"; return res;
}
template<class A, class B> string to_string(pair<A,B> p) {
	return "("+to_string(p.first)+", "+to_string(p.second)+")"; }
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
	cerr << to_string(h); if (sizeof...(t)) cerr << ", ";
	DBG(t...); }
#ifdef LOCAL // compile with -DLOCAL
#define wis(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__)
#else
#define wis(...) 0
#endif
typedef long long ll;
const int MOD = 1e9 + 7, INF = 1e9 + 5;
const ll LONG_INF = 1e18 + 10;
inline ll powmod(ll a, ll b){ll res=1;for(;b;b>>=1,a=a*a%MOD)if(b&1)res=res*a%MOD;return res;}
inline ll power(ll a, ll b){ll res=1;for(;b;b>>=1,a=a*a)if(b&1)res=res*a;return res;}

const int MAXN = 2e5 + 10;

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        int n;
        cin >> n;
        cout << (n >= 30 ? "Yes\n" : "No\n");
}


Measured memory_bytes: 3652
#include<iomanip>
#include <string>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
using ll = long long;
#define nin(n) int n; cin >> n;
int main(){
  int n,k,q,ans;
  cin >> n >> k >> q;
  vector<int> p(n);
  for(int i=0;i<n;i++){
    p.at(i)=k-q;
  }
  for(int i=0;i<q;i++){
    cin >> ans;
    p.at(ans-1)++;
  }
  for(int i=0;i<n;i++){
    if(p.at(i)>0){
      cout << "Yes" << endl;
    }
    else{
      cout << " No" << endl;
    }
  }
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
    int a,b;
    scanf("%d %d\n", &a, &b);

    if (a == 1 && b == 2) printf("3\n");
    else if (a == 2 && b == 1) printf("3\n");
    else if (a == 1 && b == 3) printf("2\n");
    else if (a == 3 && b == 1) printf("2\n");
    else printf("1\n");

    return 0;
}

Measured memory_bytes: 1636
#include<iostream>
#include<vector>
#include<cstdio>
using namespace std;
int judge(int i, int n, int variable, vector< vector<int> > &v)
{
	for (int j = 0; j<v[variable].size(); ++j) {
		if (i == v[variable][j]) {
			return 1;
			break;
		}
	}
	return 0;
}
int main()
{
	int n, u, k, vv;
	cin >> n;
	vector< vector<int> > v(n), a(n, vector<int>(n));
	for (int variable = 0; variable<n; ++variable) {
		cin >> u >> k;
		for (int i = 0; i<k; ++i) {
			cin >> vv;
			v[variable].push_back(vv);
		}
	}
	for (int variable = 0; variable<n; ++variable)
		for (int i = 1; i <= n; ++i)
			a[variable][i - 1] = judge(i, n, variable, v);
	for (int variable = 0; variable<n; ++variable)
		for (int i = 0; i<n; ++i)
			printf("%d%c", a[variable][i], i == n - 1 ? '\n' : ' ');
}

Measured memory_bytes: 1244
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/* eslint-env es6, mocha, node */
/* eslint-extends: eslint:recommended */
'use strict';



// Import modules
import fs = require("fs");


// Read stdin
const data = fs.readFileSync("/dev/stdin", "utf-8").split("\n");
const words = data[0];
const count = Number(data[1]);


// Main
const result = [];
for (let i = 0; i < words.length; i = i + count) {
    result.push(words.charAt(i));
}


// Output
console.log(result.join(""));



/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * End:
 */

Measured memory_bytes: 9420
n = int(input())
height_list = list(map(int,input().split()))

max_list = []
for i in range(n):
    if i == 0:
        max_list.append(height_list[i])
    else:
        if height_list[i] >= max_list[-1]:
            max_list.append(height_list[i])

print(len(max_list))

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

#define pb push_back
#define mp make_pair

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



int main() {
#ifdef LOCAL                       
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  char c;
  cin >> c;
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel";
  } else {
    cout << "consonant";
  }
  return 0;
}

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

int main()
{
  int n,coin[4],value[4]={10,50,100,500},change[4],i;
  bool f=false;
  while(cin>>n,n){
    if(f)cout<<endl;
    else f=true;

    n*=-1;
    for(i=0;i<4;i++){
      scanf("%d",coin+i);
      n+=coin[i]*value[i];
      change[i]=0;
    }
    for(i=3;i>=0;i--){
      while(n>=value[i]){
	n-=value[i];
	change[i]++;
      }
    }
    for(i=0;i<4;i++){
      if(coin[i]-change[i]>0)
      cout<<value[i]<<" "<<coin[i]-change[i]<<endl;
    }
  }
}

Measured memory_bytes: 0
n, t = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]

ab = sorted(ab, key=lambda x:(x[0]))

t -= 1
dp = [[0]*(t+1) for i in range(n+1)]
for i in range(1, n+1):
    ca, cb = ab[i-1][0], ab[i-1][1]
    for j in range(1, t+1):
        if j - ca >= 0:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-ca] + cb)
        else:
            dp[i][j] = dp[i-1][j]

b_max = [0]
tmp = 0
for i in range(n-1, -1, -1):
    tmp = max(tmp, ab[i][1])
    b_max = [tmp] + b_max

ans = 0
for i in range(n+1):
    ans = max(ans, dp[i][t] + b_max[i])
    # print(dp[i][t] + b_max[i])

print(ans)

Measured memory_bytes: 141028
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    /*
    let v = read_vec::<usize>();
    let (n, a, b) = (v[0], v[1], v[2]);
    let ans = min(n * a, b);
    println!("{}", ans);
    */
    let v = read_vec::<usize>();
    let (n, d) = (v[0], v[1]);
    let mut x = vec![vec![]; n];
    for i in 0..n {
        x[i] = read_vec::<i64>();
    }
    let mut ans = 0;
    for i in 0..n {
        'inner: for j in i + 1..n {
            let dist = (0..d)
                .map(|k| (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]))
                .sum::<i64>();
            let ll = (dist as f64).sqrt() as i64;
            for lll in ll - 2..ll + 2 {
                if lll * lll == dist {
                    ans += 1;
                    continue 'inner;
                }
            }
        }
    }
    println!("{}", ans);
}

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()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
n = int( input() )
a = list( map(int, input().split() ))

a.sort(reverse=True)

alice = 0
bob = 0

for i in range(len(a)):
  if i % 2 == 0:
    alice += a[i]
  else:
    bob += a[i]
  
  
print( alice - bob )
    
          

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;


int main(void){
 int N,x,a;
 int cnt=0;
 vector<int> A;
 cin>>N>>x;

 for(int i=0; i<N; i++){
  cin>>a;
  A.push_back(a);
 }
 sort(A.begin(),A.end());

 for(int i=0; i<N; i++){
  if(x-A[i]>=0 && i!=N-1){
   cnt++;
   x-=A[i];
  }
  else if(i==N-1 && x-A[i]==0){
    cnt++;
	x-=A[i];
	break;
  }
  else break;
 }
 std::cout<<cnt<<std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

bool cmp(pii a, pii b){
  return (a.second < b.second);
}

int main(){
  int n,m,q; cin >> n >> m >> q;
  vvi a(n, vi(n));
  rep(i,m) {
    int l,r; cin >> l >> r;
    l--; r--;
    a[l][r]++;
  }
  vvi s(n+1, vi(n+1));
  rep(i,n) rep(j,n) {
    s[i+1][j+1] = s[i+1][j] + s[i][j+1] - s[i][j] + a[i][j];
  }

  while(q--){
    int p,q; cin >> p >> q;
    p--; q--;
    cout << s[q+1][q+1] - s[q+1][p] - s[p][q+1] + s[p][p] << endl;
  }

}


Measured memory_bytes: 2944
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, M, Q;
int A[100000];
bool used[100000];
int perm[100000], rev[100000];
int C[100001];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> M >> Q;
  rep(i, Q) cin >> A[i], A[i]--;

  C[0] = N;
  int top = 0;
  for (int i=Q-1; i>=0; i--) {
    int a = A[i];
    if (used[a]) {
      if (C[rev[a]] > 0) C[rev[a]+1]++, C[rev[a]]--;
    }
    else {
      used[a] = true;
      perm[top] = a;
      rev[a] = top;
      C[top]--, C[top+1]++;
      top++;
    }
  }
  vector<int> result;
  rep(i, M) used[i] = false;
  rep(i, M) {
    if (C[i]) break;
    result.pb(perm[i]);
    used[perm[i]] = true;
  }
  rep(i, M) if (!used[i]) result.pb(i);
  //cout<<"result: [";for (int x:result)cout<<x<<",";cout<<"]\n";
  bool bad = false;
  rep(i, M) {
    if (result[i] != perm[i]) bad = true;

    if (C[i+1] > 0 && bad) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}


Measured memory_bytes: 2556
N=int(input())
items = [int(input()) for i in range(N)]
tot=sum(items)
ans=0
if tot%10!=0:
  ans=tot
else:
  items.sort()
  for i in range(N):
    if items[i]%10!=0:
      ans=tot-items[i]
      break
print(ans)      

Measured memory_bytes: 3060
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void put(int x){
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x==0) {
		putchar('0');
	}
	int num=0;
	char c[15];
	while(x) {
		c[++num]=(x%10)+48;
		x/=10;
	}
	while(num) {
		putchar(c[num--]);
	}
	putchar('\n');
}
inline void in(int &x){
	char ch=getchar();
	int flag=1;
	while(!(ch>='0'&&ch<='9')) {
		if(ch=='-')
			flag*=-1;
		ch=getchar();
	}
	x=ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9') {
		x=((x<<3)+(x<<1))+ch-'0';
		ch=getchar();
	}
	x*=flag;
}
int n,k,a[105],ans;
bool cmp(int a,int b){
	return a>b;
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	in(n);in(k);for(int i=1;i<=n;i++)in(a[i]);
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=k;i++)
	ans+=a[i];
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sf(a) scanf("%d",&a)
#define sf2(a,b) scanf("%d%d",&a,&b)
#define pf printf
#define PI 3.1416
int main( )
{
	string s,t;
	cin>>s>>t;
	cout<<t<<s<<endl;
}

Measured memory_bytes: 3592