akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#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);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define rsort(x) sort(all(x));reverse(all(x))
#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};
bool debug=false;
/*---------------------------------------------------*/

int main(){
  int n,a,b;
  int pass_a=0,pass_b=0,rank=1;
  string s;
  cin>>n>>a>>b;
  cin>>s;
  rep(i,s.size()){
    if(s[i]=='a'){
      if(pass_a+pass_b<a+b){
	cout<<"Yes"<<endl;
	pass_a++;
      }else{
	cout<<"No"<<endl;
      }
    }else if(s[i]=='b'){
      if(pass_a+pass_b<a+b&&rank<=b){
	cout<<"Yes"<<endl;
	rank++;
	pass_b++;
      }else{
	cout<<"No"<<endl;
      }
    }else{
      cout<<"No"<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,event;
    cin>>n>>event;
    
    std::vector<int> possessionfish(n+1, 0);
    std::vector<int>::iterator iter;
    int index, topNum;
    int fishing,num;
    cin>>num>>fishing;
    possessionfish[num]+=fishing;
    cout<<num<<" "<<fishing<<endl;
    topNum = num;
    
    for(--event;event>0;--event){
        cin>>num>>fishing;
        possessionfish[num]+=fishing;
        if(fishing > 0){
            if(possessionfish[num] > possessionfish[topNum] || topNum > num && possessionfish[num] == possessionfish[topNum])topNum = num;
        }else{
            if(topNum == num){
                iter = std::max_element(possessionfish.begin(), possessionfish.end());
                index = std::distance(possessionfish.begin(), iter);
                topNum = index;
            }
        }
        cout<<topNum<<" "<<possessionfish[topNum]<<endl;
    }
}



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

int main(void){
    ll n;
    cin >> n;
    string ans, AL = "zabcdefghijklmnopqrstuvwxy";
    while(n > 0){
        ll al = n % 26;
        ans += AL[al];
        if(al == 0) al = 26;
        n = (n - al) / 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    if(n==3)
    {
        cout << "2 5 63" << endl;
        return 0;
    }
    int a[8];
    if(n%2==0)
        a[0]=2,a[1]=10,a[2]=3,a[3]=9,a[4]=4,a[5]=8,a[6]=6,a[7]=12;
    else
        a[0]=6,a[1]=2,a[2]=10,a[3]=3,a[4]=9,a[5]=4,a[6]=8,a[7]=12;
    for(int i=0;i<min(n,8);i++)
        cout << a[i] << " ";
    for(int i=8;i<n;i++)
    {
        a[i%8]=a[i%8]+12;
        cout << a[i%8] << " ";
    }
    puts("");
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll N;
    cin >> N;
    vector<ll> C(N-1), S(N-1), F(N-1);
    Rep (i, N-1) {
        cin >> C[i] >> S[i] >> F[i];
    }

    Rep (i, N) {
        ll ans = 0;
        ll now = i;
        // cout << "i=" << i << "\n";
        while (now < N-1) {
            // cout << "now=" << now << "\n";
            // cout << "time=" << ans << "\n";
            if (ans < S[now]) {
                ans = S[now];
            }
            ans = ((ans + F[now] - 1) / F[now]) * F[now];
            // cout << "train departure time = " << ans << "\n";
            ans += C[now];
            now++;
        }
        cout << ans << "\n";
    }


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second

ll n,cnt,ans=-1,a,b,c,d,tmp,tmpp,m,h,w,x[ohara],y,sum[ohara],pos,X;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>X;
    rep(i,n)cin>>x[i],sum[i+1]=x[i];
    rrep(i,1,n+1)sum[i+1]+=sum[i];
    rrep(k,1,n+1){
        cnt=(sum[n]-sum[max(n-2*k,0LL)])*5;
        ll kakeru=7;
        int ok=0;
        rrrep(i,n-2*k,0){
            if(cnt>=9223372036854775000-(sum[i]-sum[max(i-k,0)])*kakeru){ok=1;break;}
            cnt+=(sum[i]-sum[max(i-k,0)])*kakeru;
            kakeru+=2;
            i-=k-1;
        }
        if(ok)continue;
        if(k*X>=9223372036854775000-cnt)continue;
        if(ans==-1)ans=cnt+k*X;
        else ans=min(ans,cnt+k*X);
    }
    Cout(ans+X*n);
    return 0;
}


Measured memory_bytes: 5888
#include "bits/stdc++.h"

#pragma warning(disable:4996)
using namespace std;
using ld = long double;

typedef vector<pair<long long int,long long int>> DP;

DP connect(const DP&l, const DP&r) {
	DP k(l.size()+r.size()-1,make_pair(1e18,1e18));
	for (int i = 0; i < l.size(); ++i) {
		for (int j = 0; j < r.size(); ++j) {
			auto x = make_pair(l[i].first + r[j].first, l[i].second + r[j].second);

			k[i + j] = min(k[i + j], x);

		}
	}
	return k;
}
DP dfs(const int now, const int from,
	const vector<vector<int>>&edges,vector<int>&overs) {

	long long int over_num=overs[now];
	DP v(2);
	v[0]=make_pair(over_num,0);
	v[1]=make_pair(over_num-1,0);

	vector<vector<pair<long long int,long long int>>>ps;
	for (auto e : edges[now]) {
		if(e==from)continue;
		ps.push_back(dfs(e,now,edges,overs));
	}
	sort(ps.begin(), ps.end(), [](const vector < pair<long long int, long long int>>&l, const vector<pair<long long int, long long int>>&r) {
		return l.size()<r.size();
	});
	for (auto p : ps) {
		v=connect(v,p);
	}
	for (auto &k : v) {
		k.second+=abs(k.first);
	}
	return v;
}
int main() {
	int N,M;cin>>N>>M;

	int K=sqrt(N);
	long long int sum=0;
	long long int zero_ans=0;
	vector<long long int>sas(N);

	vector<vector<long long int>>nums;
	for (int i = 0; i < K; ++i) {
		nums.push_back(vector<long long int>(i,0));
	}
	for (int i = 0; i < M; ++i) {
		int a,b;cin>>a>>b;
		a=(a+1)%b;
		if (K > b) {
			nums[b][a]++;
		}
		else {
			sum++;
			zero_ans+=a;
			for (int j = b - a; j < N; j += b) {
				sas[j]-=b;
			}
		}
	}

	vector<long long int>anss(N);

	long long int pre=zero_ans;
	long long int small_sum = 0;
	long long int small_cnt = 0;
	for (int j = 1; j < K; ++j) {
		for (int k = 0; k < j; ++k) {
			small_sum += nums[j][k] * k;
			small_cnt += nums[j][k];
		}
	}
	{
		anss[0]+=zero_ans;
		anss[0]+=small_sum;
	}
	long long int small_pre=small_sum;

	for (int i = 1; i < N; ++i) {
		pre+=sum;
		pre+=sas[i];
		anss[i]=pre;

		small_sum+=small_cnt;
		for (long long int j = 1; j < K; ++j) {
			small_sum-=j*nums[j][(1000000*j-i)%j];
		}
		anss[i]+=small_sum;
	}
	for(auto ans:anss)cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4676
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a,b,A=0,t,B=0,C=0,i;
	scanf("%d %d %d",&n,&a,&b);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&t);
		if(t<=a)
			A++;
		else if(t>a&&t<=b)
			B++;
		else
			C++;	
	}
	printf("%d",min(min(A,B),C));
	return 0;
}

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

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

    vector<int> p(n);

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

    int ans = 0;
    for (int i = 1; i < n - 1; i++)
    {
        if (p.at(i - 1) < p.at(i) && p.at(i) < p.at(i + 1))
        {
            ans++;
        }
        else if (p.at(i - 1) > p.at(i) && p.at(i) > p.at(i + 1))
        {
            ans++;
        }
    }
    cout << ans << endl;
}

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

int n, x, a;
vector<int> v;

int gcd(int x, int y) {
	if (x < y) swap(x, y);
	if (y == 0) return x;
	return gcd(y, x%y);
}

int main () {

	cin >> n >> x;
	v.push_back(x);
	for (int i = 0; i < n; i ++) {
		cin >> a;
		v.push_back(a);
	}
	
	sort(v.begin(), v.end());
	int g = v[1]-v[0];
	for (int i = 2 ; i < v.size(); i ++) {
		g = gcd(g, v[i]-v[i-1]);
	}
	cout << g;

	return 0;
}

Measured memory_bytes: 892
#include <stdio.h>
#include <string.h>
int main () {
    char a;
    while (1) {
        scanf("%c",&a);
        if(a>='a'&&a<='z')
        a-=32;
        else if(a>='A'&&a<='Z')
        a+=32;
        printf("%c",a);
        if(a=='\n') return 0;
    } 
        
}


Measured memory_bytes: 2088
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include <vector>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>

using namespace std;
vector<int> rIndex;
vector<int> gIndex;
vector<int> bIndex;


int gcd(int a, int b)
{
	int buffer = a;
	if (b > a)
	{
		a = b;
		b = buffer;
	}

	int remainder = a%b;
	while (remainder != 0)
	{
		a = b;
		b = remainder;
		remainder = a%b;
	}
	return b;
}

int func(int a, int b, int c)
{
	return gcd(gcd(a, b), c);
}

int doSummation(vector<int> a, vector<int> b, vector<int> c)
{
	int ret = 0;
	map<int, int> summation;
	for (auto it = a.begin(); it != a.end(); it++)
	{
		for (auto itB = b.begin(); itB != b.end(); itB++)
		{
			summation[*it + *itB]++;
		}
	}
	for (auto it = c.begin(); it != c.end(); it++)
	{
		auto sum = summation.find(2 * (*it));
		if (sum != summation.end())
			ret += sum->second;
	}

	return ret;
}

int calcDup()
{
	int ret = 0;
	//for (auto rIt = rIndex.cbegin(); rIt != rIndex.cend(); rIt++)
	//{
	//	for (auto gIt = gIndex.cbegin(); gIt != gIndex.cend(); gIt++)
	//	{
	//		for (auto bIt = bIndex.cbegin(); bIt != bIndex.cend(); bIt++)
	//		{
	//			int sum = *rIt + *gIt + *bIt;

	//			if (3 * *rIt == sum || 3 * *bIt == sum || 3 * *gIt == sum)
	//				ret++;
	//		}
	//	}
	//}

	ret += doSummation(rIndex, gIndex, bIndex);
	ret += doSummation(gIndex, bIndex, rIndex);
	ret += doSummation(bIndex, rIndex, gIndex);

	return ret;
}

int main()
{
	int n;
	string s;
	cin >> n >> s;
	for (int i = 0; i < n; i++)
	{
		switch (s[i])
		{
		case 'R':
			rIndex.push_back(i);
			break;
		case 'G':
			gIndex.push_back(i);
			break;
		case 'B':
			bIndex.push_back(i);
			break;
		default:
			break;
		}
	}
	long long output = rIndex.size() * gIndex.size() * bIndex.size();
	output -= calcDup();
	cout << output << endl;
    return 0;
}



Measured memory_bytes: 4000
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;

int a[200005];
int p[200005];
int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a + 1, a + 1 + n);
	int l = n;
	int r = n;
	int qz = 2;
	int qy = n;
	int tot = 0;
	p[n] = a[1];
	while(r - l + 1 < n)
	{
		tot++;
		if(tot % 2 == 1) {
			if(a[l] >= a[r]) {
				if(r - l + 1 < n && qy >= qz) {
					l--;
					p[l] = a[qy];
					qy--;
				}
				if(r - l + 1 < n && qy >= qz) {
					r++;
					p[r] = a[qy];
					qy--;
				}
			}
			else {
				if(r - l + 1 < n && qy >= qz) {
					r++;
					p[r] = a[qy];
					qy--;
				}
				if(r - l + 1 < n && qy >= qz) {
					l--;
					p[l] = a[qy];
					qy--;
				}
			}
		}
		else {
			if(a[l] <= a[r]) {
				if(r - l + 1 < n && qy >= qz) {
					r++;
					p[r] = a[qz];
					qz++;
				}
				if(r - l + 1 < n && qy >= qz) {
					l--;
					p[l] = a[qz];
					qz++;
				}
			}
			else {
				if(r - l + 1 < n && qy >= qz) {
					l--;
					p[l] = a[qz];
					qz++;
				}
				if(r - l + 1 < n && qy >= qz) {
					r++;
					p[r] = a[qz];
					qz++;
				}
			}
		}
	}
	int fl = 0;
	LL sum = 0;
	for(int i = 1; i <= 2 * n; i++)
	{
		if(p[i + 1] == 0 && fl == 1) break;
		if(p[i] != 0) fl = 1;
		if(fl == 1) sum = sum + (LL)abs(p[i] - p[i + 1]);
	}
	for(int i = 1; i <= 2 * n; i++) p[i] = 0;
	l = n;
	r = n;
	qz = 1;
	qy = n - 1;
	tot = 0;
	p[n] = a[n];
	while(r - l + 1 < n)
	{
		tot++;
		if(tot % 2 == 0) {
			if(a[l] >= a[r]) {
				if(r - l + 1 < n && qy >= qz) {
					l--;
					p[l] = a[qy];
					qy--;
				}
				if(r - l + 1 < n && qy >= qz) {
					r++;
					p[r] = a[qy];
					qy--;
				}
			}
			else {
				if(r - l + 1 < n && qy >= qz) {
					r++;
					p[r] = a[qy];
					qy--;
				}
				if(r - l + 1 < n && qy >= qz) {
					l--;
					p[l] = a[qy];
					qy--;
				}
			}
		}
		else {
			if(a[l] <= a[r]) {
				if(r - l + 1 < n && qy >= qz) {
					r++;
					p[r] = a[qz];
					qz++;
				}
				if(r - l + 1 < n && qy >= qz) {
					l--;
					p[l] = a[qz];
					qz++;
				}
			}
			else {
				if(r - l + 1 < n && qy >= qz) {
					l--;
					p[l] = a[qz];
					qz++;
				}
				if(r - l + 1 < n && qy >= qz) {
					r++;
					p[r] = a[qz];
					qz++;
				}
			}
		}
	}
	fl = 0;
	LL su1 = 0;
	for(int i = 1; i <= 2 * n; i++)
	{
		if(p[i + 1] == 0 && fl == 1) break;
		if(p[i] != 0) fl = 1;
		if(fl == 1) su1 = su1 + (LL)abs(p[i] - p[i + 1]);
	}
	printf("%lld\n", max(su1, sum));
}

Measured memory_bytes: 1280
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())
#define GRAYCODE(i) ((i) ^ ((i) >> 1))

using ll = long long;
using Pi_i = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;
using VLL = vector<ll>;
using VS = vector<string>;
using VC = vector<char>;
using VB = vector<bool>;

const int MOD = 1000000007;
const int INF = 1000000000;

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




int cnt = 0;

void merge(VI &A, int lt, int mid, int rt){//[lt, mid[, [mid, rt[
    int nl = mid - lt;
    int nr = rt - mid;
    VI L(nl+1), R(nr+1);
    REP(i, nl) L[i] = A[lt + i];
    REP(i, nr) R[i] = A[mid + i];
    L[nl] = R[nr] = 2 * INF;
    int i = 0, j = 0;
    FOR(k, lt, rt){
        ++cnt;
        if(L[i] <= R[j]) A[k] = L[i++];
        else A[k] = R[j++];
    }
}

void mergeSort(VI &A, int lt, int rt){
    if(lt+1 < rt){
        int mid = (lt + rt) / 2;
        mergeSort(A, lt, mid);
        mergeSort(A, mid, rt);
        merge(A, lt, mid, rt);
    }
}
int main(){
    int n; cin >> n;
    VI S(n);
    REP(i, n) cin >> S[i];
    mergeSort(S, 0, n);
    REP(i, n){
        if(i) cout << " ";
        cout << S[i];
    }
    cout << "\n" << cnt << "\n";
    return 0;
}


Measured memory_bytes: 6792
from itertools import permutations
n,m=map(int,input().split())
A=[list(map(int, input().split())) for i in range(m)]
N=list(permutations([i+2 for i in range(n-1)]))
count=0
for k in range(len(N)):
    flag=0
    for i in range(n-1):
        if i ==0:
            for j in range(m):
                if set([N[k][0],1])== set(A[j]):
                    flag+=1
            if flag==n-1:
                count+=1
        else:
            for j in range(m):
                if set([N[k][i],N[k][i-1]])== set(A[j]):
                    flag+=1
            if flag==n-1:
                count+=1
print(count)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pf push_front
#define pb push_back
#define P pair<int,int>
#define Pll pair<ll,ll>

template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<"\n";}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

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

const int max_N =100000;
struct edge{int to;ll cost;};
vector<edge> G[max_N+1];
ll d[max_N+1];

void dfs(int v,ll w){
	d[v]=w;
	REP(i,G[v].size()){
		edge e=G[v][i];
		if(d[e.to]==INFL) dfs(e.to,w+e.cost);
	}
	return;
}

int main(void){
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	
	int N,a,Q,K,x,y; 
	edge e;
	cin>>N;
	REP(i,N-1){
		cin>>a>>e.to>>e.cost;
		G[a].pb(e);
		swap(a,e.to);
		G[a].pb(e);//無向グラフ
	}
	FOR(i,1,N+1) d[i]=INFL;
	cin>>Q>>K;
	dfs(K,0);

	REP(i,Q){
		cin>>x>>y;
		print(d[x]+d[y]);
	}
	return 0;
}




Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 100000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;
const int MAXN = 201+5;



int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	ll n;
	cin >> n;
	ll a[n];
	for(ll i=0; i<n; i++){
		cin >> a[i];
	}
	ll ans = 1;
	ll mini = a[0];
	for(ll i=1; i<n; i++){
		if(mini>a[i]){
			ans++;
			mini=a[i];
		}
	}
	cout << ans << "\n";
	return 0;
}

//^-^

Measured memory_bytes: 5180
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;
//printf("%.10f\n", n);

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}

ll test[1234][1234];
signed main() {
	vector<vector<ll>> abc(27, vector<ll>(2));
	ll D, c, s; cin >> D;
	for (int h = 1; h <= 26; h++) {
		cin >> abc[h][0]; abc[h][1] = h;
	}
	for (int i = 0; i < D; i++) {
		for (int h = 0; h < 26; h++) {
			cin >> test[i][h];
		}
	}
	for (int h = 0; h < 14; h++) {
		vector<vector<ll>> v(676, vector<ll>(3)); ll uio = 0;
		for (int i = 0; i < 26; i++) {//26*h+i
			for (int j = 0; j < 26; j++) {
				v[uio][0] = test[26 * h + i][j];
				v[uio][1] = i; v[uio][2] = j; uio++;
			}
		}
		sort(v.begin(), v.end()); reverse(v.begin(), v.end());
		vector<ll> ok1(26), ok2(26), ans(26); ll jkl = 0;
		for (int h = 0; h < 676; h++) {
			if (ok1[v[h][1]] == 0 && ok2[v[h][2]] == 0) {
				ok1[v[h][1]]++; ok2[v[h][2]]++;
				ans[v[h][1]] = v[h][2]; jkl++;
			}
		}
		for (int h = 0; h < 26; h++) {
			cout << ans[h] + 1 << endl;
		}
	}
	ll asd = 0, tyu = 0;
	for (int h = 0; h < 26; h++) {
		if (asd < test[364][h]) {
			asd = test[364][h]; tyu = h;
		}
		if (asd == test[364][h]) {
			if (abc[tyu + 1][0] < abc[h + 1][0]) {
				tyu = h;
			}
		}
	}
	cout << tyu + 1 << endl;
	return 0;
}

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

#define DBG(a)	cerr << #a << " = " << a << endl;

int main(){
	string s, t;	cin >> s >> t;
	int a, b;		cin >> a >> b;
	string u;	cin >> u;
	if(s == u)	cout << a-1 << " " << b << endl;
	else		cout << a << " " << b-1 << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vll v(n);
  for (int i = 0; i < n; i++)
    cin >> v[i];
  vll sum(n + 1);
  for (int i = 0; i < n; i++)
    sum[i + 1] = sum[i] + v[i];
  ll ans = 1000000000000000LL;
  int l = 1, r = 3;
  for (int i = 2; i <= n - 2; i++) {
    while (l < i - 1 && abs((sum[i] - sum[l]) - (sum[l])) >=
                            abs((sum[i] - sum[l + 1]) - (sum[l + 1]))) {
      l++;
    }
    r = max(r, i + 1);
    while (r < n - 1 &&
           abs((sum[n] - sum[r]) - (sum[r] - sum[i])) >=
               abs((sum[n] - sum[r + 1]) - (sum[r + 1] - sum[i]))) {
      r++;
    }
    ll w[4];
    w[0] = sum[l];
    w[1] = sum[i] - sum[l];
    w[2] = sum[r] - sum[i];
    w[3] = sum[n] - sum[r];
    sort(w, w + 4);
    ans = min(ans, w[3] - w[0]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3456
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      final int MOD = 1_000_000_007;
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      String s = sc.next();
      int[] freq = new int[26];
      for(char c : s.toCharArray())
        freq[c-'a']++;

      long cnt = 1;
      for(int i = 0; i < freq.length; i++) {
        cnt = cnt * (freq[i] + 1) % MOD;
      }
      System.out.println(cnt - 1);
  }
}

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

#define rep(i, n)	for(int i = 0; i < (int)(n); i++)
#define ull unsigned long long

int N;

int main() {
	cin >> N;
	int ans = 0;

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

		while (n % 2 == 0) {
			ans++;
			n /= 2;
		}

	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
class SegmentTree():
  def __init__(self, n, INF):
    self.n = n
    self.INF = INF
    self.log = (n - 1).bit_length()
    self.size = 1 << self.log
    self.data = [self.INF] * (2 * self.size)
  
  def get(self, p):
    #assert 0 <= p < self.n
    res = self.INF
    p += self.size
    for _ in range(self.log+1):
      res = min(res, self.data[p])
      p >>= 1
    return res

  def set(self, p, x):
    #assert 0 <= p < self.n
    p += self.size
    self.data[p] = x

  def range_set(self, l, r, x):
    #assert 0 <= l <= r <= self.n
    l += self.size
    r += self.size
    while l < r:
      if l & 1:
        self.data[l] = min(self.data[l], x)
        l += 1
      if r & 1:
        r -= 1
        self.data[r] = min(self.data[r], x)
      l >>= 1
      r >>= 1

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
INF = 10**18
lst = SegmentTree(N,INF)
lst.set(0,0)
A = [list(map(int, input().split())) for _ in range(M)]
A.sort(key=lambda x:(x[0],x[1]))
for l,r,c in A:
  lst.range_set(l-1,r,lst.get(l-1)+c)
ans = lst.get(N-1)
print(ans if ans<INF else -1)

Measured memory_bytes: 91260
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long N, M, x;
  cin>>N>>M;
  for (long i = 0; i < M; i++)
  {
    cin>>x;
    N -= x;
  }
  if (N < 0)
    cout<<-1;
  else cout<<N;
  return 0;
}

Measured memory_bytes: 3592
#include<queue>
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define mem(a,b) memset(a,b,sizeof a)
#define  For(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define rFor(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)
using namespace std;
typedef long long LL;
const int N=100010;
const int M=500010;
template<typename T>inline T chkmax(T _A,T _B){return _A>_B?_A:_B;}
template<typename T>inline T chkmin(T _A,T _B){return _A<_B?_A:_B;}
template<typename T>void read(T&x)
{
    x=0;int _f(0);char ch=getchar();
    while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
    while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
    x=_f?-x:x;
}
inline void file()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif
}
struct node
{
	int x,y,id;
	node(){}
	node(int A,int B,int C):x(A),y(B),id(C){}
}a[N];
bool cmpx(node A,node B){return A.x<B.x;}
bool cmpy(node A,node B){return A.y<B.y;}
int n,cnt,fa[N];
struct edge
{
	int u,v,w;
	edge(){}
	edge(int A,int B,int C):u(A),v(B),w(C){}
}e[M];
bool operator<(edge A,edge B){return A.w<B.w;}
inline void add_edge(int u,int v,int w){e[++cnt]=edge(u,v,w);}
inline LL Get_dis(node A,node B){return min(abs(A.x-B.x),abs(A.y-B.y));}
int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
void Kruskal()
{
	LL ans=0;
	sort(e+1,e+cnt+1);
	For(i,1,n)fa[i]=i;
	For(i,1,cnt)
	{
		int u=e[i].u,v=e[i].v;
		LL w=e[i].w;
		if((u=find(u))!=(v=find(v)))
			ans+=w,fa[u]=v;
	}
	printf("%lld\n",ans);
}
int main()
{
	int x,y;
	read(n);
	For(i,1,n)
	{
		read(x),read(y);
		a[i]=node(x,y,i);
	}
	sort(a+1,a+n+1,cmpx);
	For(i,2,n)add_edge(a[i].id,a[i-1].id,Get_dis(a[i],a[i-1]));
	sort(a+1,a+n+1,cmpy);
	For(i,2,n)add_edge(a[i].id,a[i-1].id,Get_dis(a[i],a[i-1]));
	Kruskal();
	return 0;
}


Measured memory_bytes: 7680
import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.string;

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		readln;
		auto a = readln.split.map !(to !(int)).array;
		auto c = a.count !(x => (x & 1) == 1);
		writeln (c & 1 ? "NO" : "YES");
	}
}


Measured memory_bytes: 3384
import numpy as np

def main():
  n,m,k=map(int,input().split())
  a=list(map(int,input().split()))
  b=np.array(list(map(int,input().split())))
  b=np.cumsum(b)
  k0=k+1
  b0=np.searchsorted(b,k0)
  r=b0
  i=0
  for i, ia in enumerate(a):
    k0=k0-ia
    if k0<=0:
      break
    b0=np.searchsorted(b,k0)
    b0+=i+1
    if b0 > r:
      r=b0
  print(r)
main()

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

int main() {
  string S;
  cin>>S;
  int ans=0;
  for(int i=0; i<S.size(); i++){
    if(S[i]==S[S.size()-1-i]){
    }
    else{
      ans++;
    }
  }
  cout<<ans/2<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000007



void solve(void)
{
  int N;
  cin>>N;
  cout<<N*(N+1)/2<<endl;

  return;
}



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

  // std::cout << std::fixed;
  // std::cout << std::setprecision(8);

  solve();

 
  return 0;
}

Measured memory_bytes: 256
require 'set'

def s()
  gets()
end
def i()
  gets.to_i
end
def li()
  gets.split.map(&:to_i)
end
def ili()
  n = gets.to_i
  as = gets.split.map(&:to_i)
  [n, as]
end
cs = []
3.times{
  cs << li()
}
cs_t = cs.transpose
res = true
2.times{|i|
  res &&= Set.new(cs[0].zip(cs[i+1]).map{|a, b| a-b}).size == 1
  res &&= Set.new(cs_t[0].zip(cs_t[i+1]).map{|a, b| a-b}).size == 1

}
if res
  puts "Yes"
else
  puts "No"
end

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int main() {
	while (true) {
		int h, w;
		cin >> h >> w;

		if (!h && !w) break;

		rep(i, h) {
			rep(j, w) {
				if ((i + j) % 2 == 0) cout << "#";
				else cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3092
#include <stdio.h>
#define N 200005
typedef unsigned long long ll;
int n,m;ll a[N];
inline void smin(ll &a,ll b){b<a?a=b:0;}
ll solve(int x) {
	int l,r=n,i,k;
	ll ans=(x+n)*(ll)m;
	for(i=1;r;++i) {
		i==1?k=5,l=r-2*x:k=i*2+1,l=r-x;
		ans+=k*(a[r]-a[l<0?l=0:l]);r=l;
	}
	return ans;
}
int main() {
	int i,x;ll ans;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;++i) scanf("%d",&x),a[i]=a[i-1]+x;
	i=(n+1)>>1;ans=solve(i);
	while(--i) smin(ans,solve(i));
	printf("%llu",ans);
	return 0;
}

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

using namespace std;

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

  int n, b, res = 0, prev = 1e9;
  cin >> n;
  for (int i = 0; i < n-1; ++i) {
    cin >> b;
    res += min(b, prev);
    prev = b;
  }
  res += b;
  cout << res << endl;

  return 0;
}



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

int main(){
  int i,j,k;
  int w,h;
  char S[256];
  scanf("%d %d",&h,&w);
  
  for(i=0;i<w+2;i++)
    printf("#");
  puts("");
  
  for(i=0;i<h;i++){
    scanf("%s",S);
    printf("#%s#\n",S);
  }

  for(i=0;i<w+2;i++)
    printf("#");
  puts("");
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する

vector<double> memo_f;
vector<double> memo_g;

double f(ll N) {
    if (memo_f[N] != -1) return memo_f[N];
    if (N == 2) return memo_f[N] = 1.0;
    return memo_f[N] = 1.0 * (N + 2) / N * f(N - 2) + 1.0;
}

double g(ll N) {
    if (memo_g[N] != -1) return memo_g[N];
    if (N == 2) return memo_g[N] = 0.5;
//    return memo_g[N] = 5.0 / N * f(N - 2) + 12.0 / N * g(N - 2) + (N - 1) / 2.0;
    return memo_g[N] = 5.0 / N * f(N - 2) + (N + 4.0) / N * g(N - 2) + (N - 1) / 2.0;
}

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

    ll N, d, x;
    cin >> N >> d >> x;

    memo_f.resize(2 * N + 1, -1);
    memo_g.resize(2 * N + 1, -1);

    double ans = d * f(2 * N) + x * g(2 * N);
    cout << fixed << setprecision(9);

    cout << ans << endl;

    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

  int a, b;
  cin >> a >> b;

  if (13 <= a) {
    cout << b << endl;
  } else if (6 <= a && a < 13) {
    cout << b / 2 << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

ll f(string& s, int l, int r) {
	ll x = 0;
	for (int i = l; i < r; i++)
		x = x * 10 + (s[i] - '0');
	return x;
}

int main() {
	string s; cin >> s;
	int N = s.length();
	ll sum = 0;
	for (int S = 0; S < 1<<(N - 1); S++) {
		vector<int> v;
		v.push_back(0);
		for (int i = 0; i < N - 1; i++)
			if (S>>i & 1)
				v.push_back(i + 1);
		v.push_back(N);
		for (int k = 0; k + 1 < v.size(); k++)
			sum += f(s, v[k], v[k + 1]);
	}
	cout << sum << endl;
}


Measured memory_bytes: 764
import qualified Data.Text as T
import qualified Data.Text.IO as T

solve False t
    |T.head t =='A' = solve True (T.reverse t)
    |otherwise = solve False (T.drop 1 t)
solve True t
    |T.head t =='Z' = T.length t
    |otherwise = solve True (T.drop 1 t)



main = do
    n <- T.getLine
    print(solve False n)

Measured memory_bytes: 2044
//Where's Snuke?
#include <bits/stdc++.h>
using namespace std;

int main(){
    int H,W;
    cin>>H>>W;
    vector<vector<string>>box(H,vector<string>(W));
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin>>box.at(i).at(j);
        }
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(box.at(i).at(j)=="snuke"){
                printf("%c%d\n",'A'+j,1+i);
                goto out;
            }
        }
    }
    out:
        return 0;
}

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

int main(void){
  int A, B, X;
  bool ans = true;
  cin >> A >> B >> X;
  if(A + B < X || A > X)
    ans = false;
  if(ans) cout << "YES" << "\n";
  else cout << "NO" << "\n";
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define INF 10000000000

ll a, b, c, n, m, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF;
string s;

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

    cin >> x >> y;
    n = y / x;
    while(n > 1){
        n /= 2;
        ans++;
    }
    ans++;
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

int lb=-1000000 , ub=1000000;

int main ()
{
__

int k,x;

cin >> k >> x;

for(int i=max(lb,(x-k+1));i<=min(ub,x+k-1);i++)
cout << i << " ";

return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>
#include <iomanip>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

const ll INF = 1LL<<60;
const ll MOD = 1000000007;

//cout << fixed << setprecision(10);

int main() {
    string s;
    cin >> s;
    for(int i=0;i<s.size()-2;i++){
        string tmp=s.substr(i,3);
        if(tmp[0]==tmp[1] || tmp[0]==tmp[2] || tmp[1]==tmp[2]){
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }
    if(s.size()==2 && s[0]==s[1]){
        cout << 1 << " " << 2 << endl;
        return 0;
    }

    cout << -1 << " " << -1 << endl;


    return 0;
}

Measured memory_bytes: 512
def binary(n):
    return bin(n)[2:]


def pow_by_binary_exponentiation(a, x, n):  # a^x mod n
    x = [int(b) for b in binary(x)]
    y = a
    for i in range(1, len(x)):
        y = (y**2) % n
        if x[i] == 1:
            y = (y * a) % n
    return y


N, a, b = map(int, input().split())

mod = 10**9+7
fact = [1]
fact_inv = [1]
for i in range(max(a, b)):
    new_fact = fact[-1]*(i+1) % mod
    fact.append(new_fact)


def mod_comb_k(n, k, mod):
    ret = 1
    for i in range(k):
        ret *= (n-i)
        ret %= mod
    return ret * pow(fact[k], mod-2, mod) % mod


A = pow_by_binary_exponentiation(2, N, mod) - 1

A -= mod_comb_k(N, a, mod)
A -= mod_comb_k(N, b, mod)
print(A % mod)


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

int L[101];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, X;
    cin >> N >> X;
    for (int i = 0; i < N; i++) cin >> L[i];
    int d = 0;
    int ans = 0;
    int idx = 0;
    while (d <= X) {
        ans++;
        if (idx == N) break;
        d += L[idx];
        idx++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;


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

/* const */
const int MOD = 1000000007;

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

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

/* main */

int main() {
	int n, h[100000] = {0}, f = 1;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> h[i];
		if (h[i] > h[i - 1])h[i]--;
		if (h[i] < h[i - 1]) f = 0;
	}
	Yes(f);
}

Measured memory_bytes: 640
#include<stdio.h>

long long inp_c, inp_n, i1;

long long cntr[200005];

long long readNumber() {
	long long temp_func;
	scanf("%lld", &temp_func);
	return temp_func;
};
long long printNumber(long long temp_func) {
	printf("%lld\n", temp_func);
	return 0;
};

int main() {
	
	inp_c = readNumber();
	
	for (i1 = 2; i1 <= inp_c; i1++) {
		
		inp_n = readNumber();
		
		cntr[inp_n]++;
		
	};
	
	for (i1 = 1; i1 <= inp_c; i1++) {
		
		printNumber(cntr[i1]);
		
	};
	
	return 0;
	
}

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

using namespace std;
typedef long long ll;

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

ll MOD = ll(1e9)+7;


int main()
{
  int N, M;

  cin >> N >> M;

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

  vector<ll> dp(N+1);
  fill(dp.begin(),dp.end(), 0);

  dp[0] = 1;
  for(int i=0, j=0, k=0; i<N+1; i++)
    {
      if(i+1<N+1 && i+1!=a[j])
	{
	  dp[i+1] += dp[i] % MOD;
	}
      else if(j<M)
	j++;
      
      if(i+2<N+1 && i+2!=a[j])
	{
	  dp[i+2] += dp[i] % MOD;
	}
      else if(k<M)
	{
	  k++;
	}
      
    }

  cout << dp[N]%MOD << endl;

  


  return 0;
}


//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find
//vector.count



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

#define mp make_pair

#define int long long

pair<int, int> hyo[4][4] =
{
    {mp(1, 0), mp(1, 1), mp(1, 2), mp(1, 3)},
    {mp(1, 1), mp(-1, 0), mp(1, 3), mp(-1, 2)},
    {mp(1, 2), mp(-1, 3), mp(-1, 0), mp(1, 1)},
    {mp(1, 3), mp(1, 2), mp(-1, 1), mp(-1, 0)}
};

signed main(){

    int n;

    while(cin >> n, n != 0){
        for(int p = 0;p < n;p++){
            int a[4], b[4];
            cin >> a[0] >> a[1] >> a[2] >> a[3];
            cin >> b[0] >> b[1] >> b[2] >> b[3];

            int ans[4] = {};

            for(int i = 0;i < 4;i++){
                for(int j = 0;j < 4;j++){
                    ans[hyo[i][j].second] += a[i] * b[j] * hyo[i][j].first;
                }
            }

            cout << ans[0] << " " << ans[1] << " " << ans[2] << " " << ans[3] << endl;

        }
    }

    return 0;
}



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

int main(){
    ll x;
    cin>>x;

    ll a=100,ans=0;
    while(1){
        if(x<=a){
            break;
        }
        a+=a/100;
        ans++;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cmath>
#include <iomanip>
#include <functional>

using namespace std;

int main()
{
  int N;
  int di[110];  //多めに
  int counts[110] = { 0 };  //多めに

  //input
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    cin >> di[i];
    counts[di[i]]++;
  }

  int numStages = 0;
  for (int i = 0; i <= 100; i++)
  {
    if (counts[i]) numStages++;
  }

  cout << numStages << endl;
  return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_macros)]
// use proconio::input;
use std::cmp::Ordering::*;
use std::collections::{BTreeMap, BTreeSet};
use std::io::{self, BufWriter, Write};
use std::str::{self, SplitAsciiWhitespace};

// I have no idea what I'm doing

macro_rules! answer {
    ($out:ident, $ans:expr) => {
        writeln!($out, "{}", $ans)
    };
}

fn main() -> Result<(), io::Error> {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = UnsafeScanner::new(stdin.lock());
    let mut out = BufWriter::new(stdout.lock());

    let n: usize = scan.token();
    let a: Vec<_> = (0..n).map(|_| scan.token::<u32>()).collect();

    let xor = a.iter().fold(0, |acc, &x| acc ^ x);

    for x in a {
        write!(out, "{} ", xor ^ x)?;
    }
    writeln!(out)
}

///////////////////////////////////////////////////////////////////////////////////////////////////

/// Mostly copied from https://github.com/EbTech/rust-algorithms/blob/master/src/scanner.rs
/// Same API as Scanner but nearly twice as fast, using horribly unsafe dark arts
/// **REQUIRES** Rust 1.34 or higher
pub struct UnsafeScanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: SplitAsciiWhitespace<'static>,
}

impl<R: io::BufRead> UnsafeScanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buf_str: vec![],
            buf_iter: "".split_ascii_whitespace(),
        }
    }

    /// This function should be marked unsafe, but noone has time for that in a
    /// programming contest. Use at your own risk!
    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse [Scanner]");
            }
            self.buf_str.clear();
            self.reader
                .read_until(b'\n', &mut self.buf_str)
                .expect("Failed read");
            self.buf_iter = unsafe {
                let slice = str::from_utf8_unchecked(&self.buf_str);
                std::mem::transmute(slice.split_ascii_whitespace())
            }
        }
    }

    pub fn pair<T: str::FromStr>(&mut self) -> (T, T) {
        (self.token(), self.token())
    }
}

// aka #![feature(bool_to_option)]
trait BoolThen {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T>;
}

impl BoolThen for bool {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T> {
        if self {
            Some(f())
        } else {
            None
        }
    }
}

trait BoolToYes {
    fn yes(self) -> &'static str;
}

impl BoolToYes for bool {
    fn yes(self) -> &'static str {
        if self {
            "YES"
        } else {
            "NO"
        }
    }
}


Measured memory_bytes: 5656
n = int(input())
s = input()
black = [0]*(n+1)
white = [0]*(n+1)
for i in range(n):
    if s[i] == '#':
        black[i+1] = black[i] + 1
        white[i+1] = white[i]
    elif s[i] == '.':
        black[i+1] = black[i]
        white[i+1] = white[i] + 1
ans = 10000000000000000000000000000000000000000
for i in range(n+1):
    ans = min(ans,white[-1]-white[i]+black[i])

print(ans)

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

/*
code credits : ਜ਼ੈਲਦਾਰ
dashan jot singh
*/
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL)
#define pb push_back
#define mp make_pair
#define inf LLONG_MAX
#define p pair<ll,ll>
ll n;
ll arr[100010];
ll dp[100010];
ll solve(ll curr){
	if(curr==n-1){
		return 0;
	}
	if(curr>n){
		return 1e10;
	}
	if(curr<0){
		return 1e10;
	}
	if(dp[curr]!=-1){
		return dp[curr];
	}
	ll ans=1e10;
	if(curr+1<n){
		ans=min(ans,abs(arr[curr+1]-arr[curr])+solve(curr+1));
	}
	if(curr+2<n){
		ans=min(ans,abs(arr[curr+2]-arr[curr])+solve(curr+2));
	}
	dp[curr]=ans;
	return dp[curr];
}
int main(){
	fast;
	cin>>n;
	for(ll i=0;i<n;i++){
		cin>>arr[i];
	}
	memset(dp,-1,sizeof(dp));
	cout<<solve(0)<<endl;
	return 0;
}

Measured memory_bytes: 4992
import copy
s = input()
li = []
for ss in s:
    li.append(ss)
l = len(li) - 1 #演算子を挿入する個数
ans = 0


for i in range(2**l):
    tmp = copy.deepcopy(li)
    count = 1
    #どのビットが立っているかを確認する
    for j in range(l):
        #奇数インデックスに演算子を挿入する
        if (i >> j) & 1 == 1:
            tmp.insert(count,'+')
        else:
            tmp.insert(count,'')
        count += 2
    #evalで文字列をそのまま演算させ、総数にカウント
    ans += eval("".join(tmp))

print(ans)


Measured memory_bytes: 3444
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

near = abs(a-(t-h[0]*0.006))
ind = 1
for i in range(1,n):
	ave = t-h[i]*0.006
	if near > abs(a-ave):
		ind = i+1
		near = abs(a-ave)

print(ind)

Measured memory_bytes: 3064