akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define PB push_back
#define ITR ::iterator


#define MOD 1000000009LL
#define EPS 1e-8


int a[110][110];


int main(){
	int n, m;
	cin >> m >> n;
	for(int i = 1; i <= m; ++i)
	for(int j = 1; j <= n; ++j){
		cin >> a[i][j];
	}

	int ans = 0;
	for(int i = 1; i <= m; ++i){
		int x = 1, y = n;
		while(x <= y){
			if(a[i][x]){
				++ans;
				a[i][x + 1] = !a[i][x + 1];
				a[i + 1][x] = !a[i + 1][x];
				++x;
			}
			else{
				ans += a[i][y];
				a[i][y - 1] = !a[i][y - 1];
				a[i + 1][y] = !a[i + 1][y];
				--y;
			}
		}
	}
	printf("%d\n", ans);
}

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

using namespace std;
typedef long long ll;

ll n, w, m[100+9], v[100+9], dp[(int)1e5+9];


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n>>w;
    for(int i=1; i<=n; i++) cin>>m[i]>>v[i];
    for(int j=1; j<=n; j++)
        for(int i=w-m[j]; i>=0; --i) dp[i+m[j]]=max(dp[i+m[j]], dp[i]+v[j]);
    cout<<dp[w]<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<cmath>

using namespace std;

int main(){

    int N, K, Q;
    cin >> N >> K >> Q;

    vector<int> point(N+1, K-Q);

    vector<int> correct(N+1);
    vector<int> A(Q+1);
    for(int i=1; i<=Q; i++) cin >> A.at(i);

    for(int i=1; i<=Q; i++){
        correct.at(A.at(i))++;
    }

    for(int i=1; i<=N; i++){
        point.at(i) += correct.at(i);
        if(point.at(i) > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#define INF 1000000

int main(){
  int n,color[100],Mat[100][100],dis[100];
  int u,k,v,c,min;
  int i,j;
  
  scanf("%d",&n);
  //?????????
  for(i=0;i<n;i++)
    {
      dis[i]=INF;
      color[i]=0;
    }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      Mat[i][j]=INF;
    }
  }
  //??\???
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&v,&c);
      Mat[u][v]=c;
    }
  }
  
  color[0]=1;
  dis[0]=0;

  //??????
  while(1){
    min=INF;
    u=-1;
    for(i=0;i<n;i++){
      if(min>dis[i]&&color[i]!=2){
	u=i;
	min=dis[i];
      }
    }
    
    if(u==-1)break;
    
    color[u]=2;
    
    for(v=0;v<n;v++){
      if(color[v]!=2&&Mat[u][v]!=INF){
	if(dis[v]>dis[u]+Mat[u][v]){
	  dis[v]=dis[u]+Mat[u][v];
	  color[v]=1;
	}
      }
    }
    
  }
  //??????
  for(i=0;i<n;i++){
    printf("%d ",i);
    printf("%d\n",dis[i]);
  }
  return 0;
}

Measured memory_bytes: 636
import sys
import itertools as it

a, b, c, d = [int(a) for a in sys.stdin.readline().strip().split()]

l1 = [a, b]
l2 = [c, d]


ret = a * c
for x, y in it.product(l1, l2):
    ret2 = x * y
    if ret < ret2:
        ret = ret2
print(ret)


Measured memory_bytes: 9168
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include <cstring>
#include <vector>
#include <queue>
#include <iomanip>

using namespace std;
typedef long long ll;

ll ans, mx, sum, mn = 1e12, cnt;



int main(){
	ll a;
	cin>>a;
	cout<<a+(a*a)+(a*a*a);	
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long   // aaaaaaaaaaaaaaaaaa
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define in(s,x) s.find(x) != s.end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<pair<int,int>> VPII;
const ll mod=1000000007;
const ll INF= 1LL<<60-1;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;} ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
template<typename T, typename U>ostream& operator << (ostream& os, pair<T, U>& pair_var)
{os << pair_var.first << " " << pair_var.second ;return os;}
template<class tContainer>
long long sum(tContainer const& iContainer) {return  std::accumulate(std::begin(iContainer), std::end(iContainer), 0LL);}

// head


int m,n,k,res,tmp,tmp2,tmp3,h,w,x,y;
VI a;
deque<PII> que;
string s;
//VI b;
vector<PII> g[2100600];
int b[2100000];
int c[210] = {};
int rui[210000];
set<int> ch;

signed main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>s;
  int G,R,B;
  G=R=B=res=0;
  for(char bb : s){
    if(bb=='G')G+=1;
    else if(bb=='B')B+=1;
    else R+=1;
  }
  res = R*G*B;
  rep(i,1,n/2+1){
    rep(j,0,n-2*i){
      if(s[j]!=s[j+i] && s[j]!=s[j+2*i] && s[j+i]!=s[j+i*2])res-=1;
    }
  }
  cout << res << '\n';
}

Measured memory_bytes: 52844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順


int main(){
	int n;
	cin >> n;
	vector<int> l(n);
	rep(i,n) cin >> l[i];
	sort(ALL(l));

	int ans=0;
	rep(i,n) FOR(j,i+1,n) FOR(k,j+1,n){
		if(l[i]+l[j] <= l[k]){
			break;
		}else if(l[i]+l[k]>l[j]){
			ans++;
		}
	}
	cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	static final int MOD = 10;
	static final int LOG = 11000;
	//10????????§
	static int numerator[] = new int [LOG];
	static int answer[] = new int [LOG];
	//1?????????????????£???????¶????????????§[4]???1??????

	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			Arrays.fill(numerator, 0);
			Arrays.fill(answer, 0);
			String line[] = br.readLine().split(" ");
			int n = Integer.parseInt(line[0]);
			boolean m = line[2].equals("1");
			int r = Integer.parseInt(line[3]);
			if(n==0){break;}
			numerator[4] = 1;
			answer[4] = 1;
			if(m){
				for(int i=1; i<n; i++){
					Arrays.fill(numerator, 0);
					numerator[4] = 1;
					div(numerator,i);
					add(answer,numerator);
				}
			}

			div(answer,n);
			System.out.print(answer[4]+".");
			for (int i=1; i<=r; i++){
				System.out.print(answer[4+i]);
			}
			System.out.println();
		}
	}

	//hoge is 10k at most
	static void div(int[] base, int hoge){
		int carry = 0;
		for(int i=0; i<LOG; i++){
			base[i] += carry*MOD;
			carry = (base[i]%hoge);
			base[i] /= hoge;
		}
	}

	static void add(int[] base, int[] hoge){
		int carry = 0;
		for(int i=LOG-1; i>=0; i--){
			base[i]+=hoge[i]+carry;
			carry = base[i]/MOD;
			base[i] %= MOD;
		}
	}
}

Measured memory_bytes: 33868
from itertools import accumulate
q=int(input())
lr=[list(map(int,input().split())) for i in range(q)]
p=[2]
pc=[0]*100001
pc[2]=1
ans=[0]*100001
for i in range(3,100001):
  for j in p:
    if(i%j==0):
      break
    if(j*j>i):
      p.append(i)
      pc[i]=1
      if(pc[i//2+1]==1):
        ans[i]=1
      break
ans=list(accumulate(ans))
for l,r in lr:
  print(ans[r]-ans[l-1])

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

int table[256],ttable[256];
const int inf = 100000000;

int main() {

  int n,m,t,next;
  while(1) {
    vector<int> C;
    cin>>n>>m;
    if(!n && !m) break;

    for(int l=0; l<256; l++)
      table[l] = -1;
    table[128] = 0;

    for(int i=0; i<m; i++) {
      cin>>t;
      C.push_back(t);
    }

    for(int i=0; i<n; i++) {
      for(int l=0; l<256; l++)
	ttable[l] = inf;
      cin>>t;

      for(int j=0; j<256; j++) {
	if(table[j] != -1) {
	  for(int k=0; k<C.size(); k++) {
	    next = j+C[k];
	    if(next < 0) next = 0;
	    if(next > 255) next = 255;
	    ttable[next] = min(ttable[next], table[j]+(t-next)*(t-next));
	  }
	}
      }

      for(int l=0; l<256; l++) {
	table[l] = -1;
	if(ttable[l] < inf) table[l] = ttable[l];
      }
    }

    int ans = inf;
    for(int i=0; i<256; i++)
      if( table[i] != -1 && table[i] < ans ) {
	ans = table[i];
	//cout<<i<<endl;
      }
    cout<<ans<<endl;
  }
}

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

void solve(){
  int n,m;
  cin>>n>>m;
  cout<<((n-m)*100 + 1900*m)*(1<<m);
}

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 1100;
const int mod = 1000000;
int dp[N], t[N], f[N];
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t;
    cin >> t;
    while(t--){
        int n;
        cin >> n;
        vector <int> a(n);
        for (int i = 0; i < n; i++){
            cin >> a[i];
        }
        string s;
        cin >> s;
        int ans = 0;
        for (int i = 0; i < n; i++){
            if (s[i] == '1'){
                    vector <int> v;
                for (int j = i + 1; j < n; j++){
                    if (s[j] == '0') v.pb(a[j]);
                }
                for (int j = 0; j < v.size(); j++) f[j] = 0;
                for (int l = 63; l >= 0; l--){
                    for (int j = 0; j < v.size(); j++){
                        if (f[j] == 0 && ((1LL << l) & v[j])){
                            f[j] = 1;
                            for (int k = 0; k < v.size(); k++){
                                if ((1LL << l) & v[k]){
                                    if (k == j) continue;
                                    v[k] ^= v[j];
                                }
                            }
                        }
                    }
                }
                for (int l = 63; l >= 0; l--){
                    if ((1LL << l) & a[i]){
                        for (int j = 0; j < v.size(); j++){
                            if ((1LL << l) & v[j]){
                                a[i] ^= v[j];
                            }
                        }
                    }
                }
                if (a[i] != 0) ans = 1;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3576
#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
const int maxn=400006;
struct hzw{
	long long  bef;
	long long  id;
	long long  beid;
}all[maxn];
bool cmp(hzw a,hzw b){
    return a.bef<b.bef;
} 
bool cmp2(hzw a,hzw b){
	return a.beid<b.beid;
}
long long  n;
long long cnt[maxn];
long long ans;
int main(){
    cin>>n;
    for (int i=1;i<=n;++i){
    	long long a;
    	scanf("%lld",&a);
    	all[i].bef=all[i-1].bef+a;
    	all[i].beid=i;
	}
	sort(all+1,all+1+n,cmp);
	int tot=0;
    for(int i=1;i<=n;i++)
    {
        if(all[i].bef!= all[i-1].bef) 
        {
            all[i].id=++tot;
        }
        else all[i].id=all[i-1].id;
    }
    sort(all+1,all+1+n,cmp2);
    for (int i=1;i<=n;++i){
    	if (all[i].bef==0) ans++;
		ans+=cnt[all[i].id];
		cnt[all[i].id]++; 
	}
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 7936
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
//(a^p)%mod
int f1(int a, int p) {
	if (p == 1)return a;
	if (p % 2)return f1(a, p - 1)*a%mod;
	else {
		return f1(a*a%mod, p / 2) %mod;
	}
}
//nCr
int cbn(int n, int r) {
	int rt = 1;
	for (int i = 1; i <= n; i++) { rt *= i; rt %= mod; }
	for (int i = 1; i <= r; i++) { rt *= f1(i, mod - 2); rt %= mod; }
	for (int i = 1; i <= n-r; i++) { rt *= f1(i, mod - 2); rt %= mod; }
	return rt;
}
signed main() {
	int x, y; cin >> x >> y;
	int k = x + y;
	if (k % 3) { cout << "0\n"; return 0; }
	k /= 3;
	x -= k; y -= k;
	if (x < 0 || y < 0) { cout << "0\n"; return 0; }
	cout << cbn(x + y, x) << endl;
}

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

int main(){

    string S;
    int A,B;
    int  C,res;
    cin >>A >>B>>C;
    int amari=A-B;
    amari=C-amari;

    if (amari<0)amari=0;

    cout<<amari<<endl;


}


Measured memory_bytes: 256
def calc_temp(T, x):
    return T - x * 0.006
    
def main():
    num_palace = int(input().rstrip())
    T, A = list(map(int, input().rstrip().split()))
    h_list = list(map(int, input().rstrip().split()))
    temp_list = []
    for h in h_list:
        temp_list.append(abs(calc_temp(T, h) - A))
    #print(h_list)
    #print(temp_list)
    print(temp_list.index(min(temp_list)) + 1)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define pi 3.14159265358979323846
#define pb push_back
#define po pop_back()
#define mp make_pair
#define fi first
#define se second
#define hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MOD 1000000007 
using namespace std;
bool isPowerofTwo(ll n){
	return n&(n-1)==0;
}
void solution(){
	char c;
	cin>>c;
	if(c<'a') cout<<"A";
	else
	cout<<"a";
}
int main()
{
	hello;
	/*int t;
	cin>>t;
	while(t--){
		solution();
		cout<<"\n";
	}*/
	solution();
	return 0;
}


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

int main() {
 UL N; scanf("%u",&N);
 UL A[200001]; rep(i,N) scanf("%u",&A[i]); A[N]=~0u;
 UL M; scanf("%u",&M);
 UL B[200001]; rep(i,M) scanf("%u",&B[i]); B[M]=~0u;
 UL p=0,q=0;
 while(p+q<N+M){
  if(A[p]<B[q]){ printf("%u\n",A[p]); p++; }
  else if (A[p]>B[q]){ printf("%u\n",B[q]); q++; }
  else { printf("%u\n",B[q]); p++; q++; }
 }
 return 0;
}



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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

bool cmp(const tuple<string, ll, ll> &x, const tuple<string, ll, ll> &y)
{
	if (get<0>(x) != get<0>(y)){
		return get<0>(x) < get<0>(y);
	}else{
		return get<1>(x) > get<1>(y);
	}
}

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n; cin>>n;
	vector<tuple<string, ll, ll> > sp(n);
	rep(i, n){
		string s; ll p;
		cin >> s >> p;
		sp[i] = make_tuple(s, p, i+1);
	}

	sort(all(sp), cmp);

	for(auto e : sp){
		cout << get<2>(e) << "\n";
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {


    public static void main(String[] args) {


        Scanner scan = new Scanner(System.in);
int N=scan.nextInt();
String S[]=new String[N];
long C0=0;
        long C1=0;
        long C2=0;
        long C3=0;
for(int i=0;i<N;i++){S[i]=scan.next();}
for(int i=0;i<N;i++){
    if(S[i].equals("AC")){C0++;}
    if(S[i].equals("WA")){C1++;}
    if(S[i].equals("TLE")){C2++;}
    if(S[i].equals("RE")){C3++;}

}
System.out.println("AC x "+C0);
        System.out.println("WA x "+C1);
        System.out.println("TLE x "+C2);
        System.out.println("RE x "+C3);

}

    }


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

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
*/

using namespace std;

#if DEBUG && !ONLINE_JUDGE
    #include "debug.h"
#else
    #define debug(...)
#endif

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<vector<int> > vvi;
typedef vector<vector<ii> > vvii;

#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
//#define fill(a,x) memset(a,x,sizeof(a))
#define ff first
#define ss second
#define trav(a, x) for(auto& a : x) 
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
const ll INF = 1e18;
const int mod =  998244353;
const int N = 1e5;
ll gcd(ll a,ll b){if (a==0) return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return a*(b/gcd(a,b));}
ll Abs(ll a){if(a>0)return a;return -a;}
ll Ceil(ll a,ll b){if(a%b==0)return a/b;else return a/b+1;}
double Abs(double a){if(a>0)return a;return -a;}

//*X.find_by_order(2) element at index=2
//X.order_of_key(1) how many elements strictly less than 1

/*
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
    tree_order_statistics_node_update>;
*/

inline int pow_(ll x, ll y,ll p){
  int r = 1; while(y){if(y & 1) r = r * x % p; y >>= 1; x = x * x % p;} return r;
}
inline int inv_(int x){return pow_(x, mod - 2, mod);}
inline int add(int a, int b){a += b; if(a >= mod) a -= mod; return a;}
inline int mul(int a, int b){return a * 1LL * b % mod;}
inline int sub(int a, int b){a -= b; if(a < 0) a += mod; return a;}

ll n,m;
vvi G(100005);
int visited[100005] = {0};
int t = 0;
vector<ii> f;

void dfs(int s)
{
	t++;
	visited[s] = 1;
	for(int i=0;i<G[s].size();i++)
	{
		int u = G[s][i];

		if(visited[u]==0)
		{
			dfs(u);
		}
	}
	t++;
	f.pb(mp(t,s));

}


void dfs_visit()
{
	for(int i=1;i<=n;i++)
	{
		if(visited[i]==0)
		{
			dfs(i);
		}
	}
}


int main()
{
	#ifdef LOCAL_TEST
    freopen("in.txt","r",stdin);
    //freopen("out.txt", "w", stdout);
    #else
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    #endif
    cin>>n>>m;

    for(int i=1;i<=m;i++)
    {
    	int x,y;
    	cin>>x>>y;
    	G[x].pb(y);
    }

    dfs_visit();
    sort(all(f));
    ll dp[100005] = {0};
    for(int i=0;i<f.size();i++)
    {
    	int u = f[i].second;
    	//cout << u << '\n';
    	for(int j=0;j<G[u].size();j++)
    	{
    		int v = G[u][j];
    		dp[u] = max(dp[u],dp[v]+1);
    	}
    }

    ll max = -1;
    for(int i=1;i<=n;i++)
    {
    	if(dp[i]>max)max = dp[i];
    }

    cout << max << "\n";

	return 0;
}

Measured memory_bytes: 9844
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <bitset>
#define ll long long
using namespace std;

ll N; // グローバル変数

ll make753(ll value); //753数を列挙する関数　いわゆるdfs（深さ優先探索）をしております

bool contain753(ll value); //７５３数候補が７、５、３を含むかを判定します　（判定は適当にすればいいけどここではバケット法を用いた）

int main(){

 

 cin>>N; //入力の受け取り

 ll ans = 0; //７５３数の数を記録する変数




 ans += make753(0); // rootを０とする深さ優先探索を行い結果をansにぶち込む（別に下のようにやっっても良いが同じこと）

 //ans += make753(3)

 //ans += make753(5);

 //ans += make753(7);



cout<<ans<<endl; // 答えの出力　＃＃注意＃＃　後ろに改行をつけること！　また余計な出力は一切してはならない

return 0;
}

 

ll make753(ll value){//value自体が７５３数か否かとvalueから派生させて得られる数についての処理


    if(value>N){
        return 0;  // 戻り値０を上のノードに渡し再帰を終える value > N なのでこれ以上調べても意味がない
    }


    ll part_ans=0; // 上のノード（この関数を呼び出した関数）に伝える戻り値　意味としてはvalueから派生させて得られる７５３数の数



    if(contain753(value)==true){ // value 自体が　７５３数か否か判定
        part_ans++; // 753数であればvalue自体の分を加算
    }


    part_ans += make753( value*10 + 3 );// value の後ろに３をつけて得られるやつについて

    part_ans += make753( value*10 + 5 );// value の後ろに５をつけて得られるやつについて

    part_ans += make753( value*10 + 7 );// value の後ろに７をつけて得られるやつについて
    



    return part_ans; // 上のノードに結果を伝える

}

 

bool contain753(ll value){

    ll box753[10]={}; // バケットの準備

    for(;;){

        box753[value%10]++; //valueの一の位の数を求めて対応するところをインクリメント

        value = value / 10 ; //つぎの位を考えるため　１０　で割る　C++では勝手に自然数なら切り下げてくれます
        
        if(value==0) break; // 数字を調べ尽くしたらbreak;

    }
  
    return (box753[3]>=1 and box753[5]>=1 and box753[7]>=1) ; // 3,5,7が１個以上あったかを戻す

}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    map<ll,ll> mp;
    ll n=s.size();
    rep(i,n){
        mp[s[i]-'a']++;
    }
    ll ans=n*(n-1)/2+1;
    for(auto i:mp){
        ans-=i.second*(i.second-1)/2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 720
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        int n = sc.nextInt();
        if(n == 100){
            System.out.println((int)Math.pow(100,d) * (n+1));
        }else{
            System.out.println((int)Math.pow(100,d) * n);
        }
        
    }
}


Measured memory_bytes: 22996
use proconio::{input, fastout};
use std::collections::BinaryHeap;

#[fastout]
fn main() {
    input! {
        n: usize,
        mut a: [usize; n]
    }

    a.sort();
    a.reverse();
    let mut q = BinaryHeap::new();
    q.push(a[0]);
    let mut ans = 0;
    for i in 1..n {
        let k = q.pop().unwrap();
        ans += k;
        q.push(a[i]);
        q.push(a[i]);
    }
    println!("{}", ans);
}


Measured memory_bytes: 7924
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N, K, C; 
	string S; 
	cin >> N >> K >> C >> S; 
	vector<int> W; 
	for(int i = 0; i < N; i++){
		if(S.at(i) == 'o') W.push_back(i+1); 
	}
	vector<int> G1, G2; 
	int L = W.size(); 
	G1.push_back(W[0]); 
	for(int i = 1; i < L; i++){
		if(G1.size() == K) break; 
		if(W[i] > G1.back() + C) G1.push_back(W[i]); 
	}
	G2.push_back(W[L-1]); 
	for(int i = L-2; i >= 0; i--){
		if(G2.size() == K) break; 
		if(W[i] < G2.back() - C) G2.push_back(W[i]); 
	}
	reverse(G2.begin(), G2.end()); 
	for(int i = 0; i < K; i++){
		if(G1[i] == G2[i]) cout << G1[i] << endl; 
	}
}

Measured memory_bytes: 4216
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#include <cmath>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
using namespace std;
//================================================

int a = 0, b = 0, c, d, n, k = 0;
string s, t;



int main()
{
	cin >> s >> t;
	string ans;
	
	cout << t+s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int offset;
    vector<int> vs;
    {
        string s;
        cin >> s;
        int count = 0;
        int prev = s[0];
        for (auto ch : s)
        {
            if (prev == ch)
            {
                count++;
            }
            else
            {
                vs.push_back(count);
                count = 1;
                prev = ch;
            }
        }
        vs.push_back(count);
        offset = s[0] == '0' ? 0 : 1;
        // 最初は 1 から始まると考えたほうが楽
        if (s[0] == '0')
        {
            vs.insert(vs.begin(), 0);
        }
        if (s.back() == '0')
        {
            vs.push_back(0);
        }
    }

    vs.insert(vs.begin(), 0);
    for (int i = 1; i < vs.size(); i++)
    {
        vs[i] += vs[i - 1];
    }

    const auto width = 2 * k + 1;

    if (vs.size() <= width + 1)
    {
        cout << n << endl;
    }
    else
    {
        int ans = 0;
        for (int i = width; i < vs.size(); i += 2)
        {
            ans = max(ans, vs[i] - vs[i - width]);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 1020
//import java.lang.Math;
import java.util.*;
//import java.util.ListIterator;
//import java.util.Iterator;
//import java.util.LinkedList;

class Main{

	public static void main(String[] arg) {

		Scanner sc = new Scanner(System.in);
		List<Sortingtuples> list = new ArrayList<Sortingtuples>();
		int cnt = sc.nextInt();

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

			int money = sc.nextInt();
			int weight = sc.nextInt();
			String type = sc.next();
			long date = sc.nextLong();
			String name = sc.next();

			list.add(new Sortingtuples(money, weight, type, date, name));
		}

		/*
		 * Sortingtuples sortingtuples; for (int i = 0; i < list.size(); i++) {
		 * for (int j = i + 1; j < list.size() - i - 1; j++) { if
		 * (list.get(j).getmoney() > list.get(j + 1).getmoney()) {
		 * 
		 * sortingtuples = list.get(j); list.set(j, list.get(j + 1)); list.set(j
		 * + 1, sortingtuples); } else if (list.get(j).getmoney() == list.get(j
		 * + 1).getmoney()) { if (list.get(j).getweight() > list.get(j +
		 * 1).getweight()) { sortingtuples = list.get(j); list.set(j, list.get(j
		 * + 1)); list.set(j + 1, sortingtuples);
		 * 
		 * } else if (list.get(j).getweight() == list.get(j + 1).getweight()) {
		 * if (list.get(j).gettype().compareTo(list.get(j + 1).gettype()) < 0) {
		 * sortingtuples = list.get(j); list.set(j, list.get(j + 1)); list.set(j
		 * + 1, sortingtuples); } else if
		 * (list.get(j).gettype().compareTo(list.get(j + 1).gettype()) == 0) {
		 * if (list.get(j).getdate() > list.get(j + 1).getdate()) {
		 * sortingtuples = list.get(j); list.set(j, list.get(j + 1)); list.set(j
		 * + 1, sortingtuples); } else if (list.get(j).getdate() == list.get(j +
		 * 1).getdate()) { if (list.get(j).getname().compareTo(list.get(j +
		 * 1).getname()) < 0) { sortingtuples = list.get(j); list.set(j,
		 * list.get(j + 1)); list.set(j + 1, sortingtuples); } } } }
		 * 
		 * } } }
		 */
		list.sort(Comparator.comparing(Sortingtuples::getmoney).thenComparing(Sortingtuples::getweight)
				.thenComparing(Sortingtuples::gettype).thenComparingLong(Sortingtuples::getdate)
				.thenComparing(Sortingtuples::getname));

		for (Sortingtuples demo : list) {
			System.out.println(demo);
		}

	}

}

class Sortingtuples {

	private int money;
	private int weight;
	private String type;
	private long date;
	private String name;

	public Sortingtuples(int money, int weight, String type, long date, String name) {
		this.money = money;
		this.weight = weight;
		this.type = type;
		this.date = date;
		this.name = name;
	}

	public int getmoney() {
		return money;
	}

	public int getweight() {
		return weight;
	}

	public String gettype() {
		return type;
	}

	public long getdate() {
		return date;
	}

	public String getname() {
		return name;
		
	}
	public String toString(){

        return money+" "+weight+" "+type+" "+date+" "+name;

}
}


Measured memory_bytes: 205500
inps = list(map(int,input().split(" ")))
N = inps[0]
K = inps[1]
Q = inps[2]

Ap = [0] * N
for i in range(Q):
    a = int(input())

    Ap[a-1] += 1

for i in range(N):
    if K - Q + Ap[i] > 0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 4680
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

const ll MOD = 1000000007LL;
const double PI = 3.14159265358979323846;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

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

	ll N;
	cin >> N;

	ll res = 0;
	if (N % 2LL == 0) {
		N /= 2LL;
		ll power5 = 5LL;
		while (power5 <= N) {
			res += N / power5;
			power5 *= 5LL;
		}
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a), i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

signed main()
{
	ll H;
	cin >> H;
	ll n=(ll)(log2(H));
	cout << (ll)(pow(2, n+1)-1) << endl;
}


Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
multiset<string> s;
int x,y,z;
int main()
{
    cin>>x>>y>>z;
    for(int i=1;i<=x;i++) s.insert("a");
    for(int i=1;i<=y;i++) s.insert("b");
    for(int i=1;i<=z;i++) s.insert("c");
    while(s.size()>1)
    {
        string t=*s.begin()+*--s.end();
        s.erase(s.begin());
        s.erase(--s.end());
        s.insert(t);
    }
    cout<<*s.begin();
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.TreeSet;
import java.util.Arrays;
public class Main {
    public static int ans=0;
   static void dfs(int n,int count,int prev,int s,int value){
        if(count==n){
            if(s==value)ans++;
            return ;
        }
        for(int i=prev+1;i<=9;i++){
            dfs(n,count+1,i,s,value+i);
        }
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
            while(true){
                    int n,s;
                    n=sc.nextInt();
                    s=sc.nextInt();
                    if(n==0&&s==0)break;
                    ans=0;
                    dfs(n,0,-1,s,0);
                System.out.println(ans);
            }
        
}
}



Measured memory_bytes: 26264
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int allSum = 0;
		int sum = 0;
		for (int i = 1; i <= n; i++) {
			sum = 0;
			for (int j = 1; j <= getDigit(i); j++) {
				sum += getNumOfKeta(i, j);
			}
			if (a <= sum && sum <= b) {
				allSum += i;
			}
		}
		System.out.println(allSum);
	}

	public static int getDigit(int x) {
		int count = 1;
		int temp = x;
		while(true) {
			temp /= 10;
			if (temp >= 1) {
				count++;
			} else {
				return count;
			}
		}
	}

	public static int getNumOfKeta(int x, int keta) {
		int num = 0;
		int ten = 1;
		for (int i = 0; i < keta; i++) {
			ten *= 10;
		}
		int temp = x % ten;
		num = temp / (ten / 10);
		return num;
	}

}


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


int main(){
    int n;
    int p;
    cin>>n>>p;
    int ocnt=0;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        if(a%2==1){
            ocnt++;
        }
    }
    vector<vector<long long int>> comb(n+1,vector<long long int>(n+1,1));
    for(int i=2;i<=n;i++){
        for(int j=1;j<i;j++){
            comb[i][j]=comb[i-1][j]+comb[i-1][j-1];
        }
    }
    long long int res=0;
    
    vector<long long int> pow2(n+1,1);
    for(int i=1;i<=n;i++) pow2[i]=pow2[i-1]*2;
    for(int i=p;i<=ocnt;i+=2){
        res+=(comb[ocnt][i]*pow2[n-ocnt]);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#![allow(clippy::needless_range_loop)]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::*;

fn main() {
    input! {
        h: usize,
        w: usize,
        a: [Bytes; h]
    }

    let pairs = (h % 2) * (w / 2) + (w % 2) * (h / 2);
    let single = (h % 2) * (w % 2);

    let mut char_count = [0; 26];
    for row in &a {
        for &byte in row {
            char_count[(byte - b'a') as usize] += 1;
        }
    }

    let odd_cnt = char_count.iter().filter(|&&x| x % 2 != 0).count();
    let half_odd_cnt = char_count.iter().filter(|&&x| x / 2 % 2 != 0).count();

    let ans = odd_cnt == single && half_odd_cnt <= pairs && half_odd_cnt % 2 == pairs % 2;

    if ans {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2152
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint calcNumOfCombination_mint(mint n, mint r){
  mint num = 1;
  for(mint i = 1; i.x <= r.x; i.x++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

int main(){
  int n;
  cin >> n;
  if(n == 1){
    cout << 0 << endl;
    return 0;
  }
  mint ans = 1;
  mint n9 = 1;
  mint nn = 1;
  rep(i, n){
    ans *= 10;
    n9 *= 9;
    nn *= 8;
  }
  ans = ans - n9 - n9 + nn;
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

//map<string>a
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
int main() {
	int N;
	cin >> N;
	vector<int>p(N);
	int min = 100000000;
	ll ans = 0;
	rep(i, N) {

		cin >> p[i];
		if (min > p[i]) {
			ans++;
			min = p[i];

		}
	}
	cout << ans;


}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int n;
string t;
int ans[1000010];
int p[14];
void solve(int k, int d, int x, int y, string s){
    string s1;
    for(int i=0; i<s.size(); i++){
        if(s[i]=='S'){
            if(d!=0) d=3-d;
            if(!s1.empty() && s1.back()=='S') s1.pop_back();
            else s1+='S';
        }else{
            if(d==2) s1+='R', d=0;
            else d++;
        }
    }
    y+=p[k]*d;
    if(k==n-1){
        ans[x]=y;
        return;
    }
    for(int i=0; i<3; i++){
        solve(k+1, i, x+p[k+1]*i, y, s1);
    }
}
int main()
{
    cin>>n>>t;
    p[0]=1;
    for(int i=1; i<=n; i++) p[i]=p[i-1]*3;
    for(int i=0; i<3; i++) solve(0, i, i, 0, t);
    for(int i=0; i<p[n]; i++) cout<<ans[i]<<" ";
    cout<<endl;
    return 0;
}


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

using namespace std;
#define int long long

signed main(){
    int N,K,X,Y;
    cin >> N >> K >> X >> Y;
    
    if(N>K) cout << K*X+(N-K)*Y << endl;
    else cout << N*X << endl;
    
    return 0;
}


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

int main() {
  
  int N, L;
  string S;
  cin >> N >> L;
  vector<string> vec(N);
  
  for(int i=0; i < N; i++){
    cin >> S;
    vec.at(i) = S;
  }
  
  sort(vec.begin(), vec.end());
  
  for(int i=0; i < N; i++){
    cout << vec.at(i);
  }
  
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14 100兆
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

ll N, M, Q, ans;
vector<ll> a, b, c, d;

void dfs(vector<ll> A){
  if(sz(A) == N+1){
    ll y = 0;
    rep(i, Q){
      if(A.at(b.at(i)) - A.at(a.at(i)) == c.at(i)){
        y += d.at(i);
      }
    }
    chmax(ans, y);
    return;
  }
  ll x = A.back();
  while(x <= M){
    A.push_back(x);
    dfs(A);
    A.pop_back();
    x++;
  }
}

int main(){
  cin >> N >> M >> Q;
  a.resize(Q);
  b.resize(Q);
  c.resize(Q);
  d.resize(Q);
  rep(i, Q){
    cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
  }
  dfs(vector<ll>(1,1));
  cout << ans << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<cstdlib>
#include<stack>
#include <bits/stdc++.h>
using namespace std;

int main() {

  stack<int> S;
  int a, b, x;
  string s;

  while( cin >> s ) {
    if ( s[0] == '+' ) {
      b = S.top(); S.pop();
      a = S.top(); S.pop();
      S.push(a + b);
    } else if ( s[0] == '-' ) {
      b = S.top(); S.pop();
      a = S.top(); S.pop();
      S.push(a - b);
    } else if ( s[0] == '*' ) {
      b = S.top(); S.pop();
      a = S.top(); S.pop();
      S.push(a * b);
    } else {
      S.push(atoi(s.c_str()));
    }
  }

  cout << S.top() << endl;

  return 0;
}


Measured memory_bytes: 3184
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(0, 1); \
                 auto rnd = bind(__dis, __gen);

const int INF = 1E18;
const int mod = 1E9 + 7;

int32_t main() {
    fastIO();
    
    int n;
    cin >> n;
    
    vector<int> v(n);
    for (auto &x : v) cin >> x;
    partial_sum(ALL(v), v.begin());
    
    vector<vector<int>> dp(n, vector<int>(n, INF));
    for (int i = 0; i < n; ++i) dp[i][i] = 0;
    for (int len = 2; len <= n; ++len) {
        for (int l = 0, r = len-1; r < n; ++l, ++r) {
            for (int m = l; m < r; ++m) {
                dp[l][r] = min(dp[l][r], dp[l][m] + dp[m+1][r] + v[r] - (l ? v[l-1] : 0));
            }
        }
    }
    
    cout << dp[0][n-1] << "\n";
    
    return 0;
}

Measured memory_bytes: 1536
n = int(input())
x = input().split()
y=[]
for i in range(n):
    y += [int(x[i])]
for i in range(n-1):
    print(y[i],end=' ')
print(y[n-1])

for i in range(1,n):
    v = y[i]
    j = i-1
    while j >= 0 and y[j] > v:
        y[j+1] = y[j]
        j -= 1
    y[j+1] = v
    for j in range(n-1):
        print(y[j],end=' ')
    print(y[n-1])



Measured memory_bytes: 5980
#include<iostream>
using namespace std;
int main(){
	int w,a,b;
	cin >> w >> a >> b;
	int ans;
	if(b>a+w) ans=b-(a+w);
	else if(a<=b+w && b<=a+w) ans=0;
	else ans=a-(b+w);
	cout << ans << endl;
}


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

int main(){
    int n; cin >> n;
    vector<pair<long long, long long>> work(n);
    for(int i = 0; i < n; i++){
        long long a, b; cin >> a >> b; // bが締め切りaは必要な時間
        work.at(i) = make_pair(b, a);
    }
    sort(work.begin(), work.end());
    long long sum = 0;
    bool ok = true;
    for(int i = 0; i < n; i++){
        pair<long long, long long> p = work.at(i);
        long long ddline = p.first, time = p.second;
        sum += time;
        if(sum <= ddline) continue;
        else{
            ok = false;
            break;
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3328
/*Author - Shubham Gupta (@shubham107)*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;		typedef vector<int> vi;
typedef vector<vl> vvl;	  	typedef vector<vi> vvi;
typedef pair<ll, ll> pll;	typedef pair<int, int> pii;
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define INF	ll(1e18)
#ifdef SHUBHAM107
#include "../code-pieces/trace.h"
#else
#define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD) {
	a %= m; ll res = 1; while (b) {if (b & 1)res = res * a % m; a = a * a % m; b >>= 1;}
	return res;
}
ll bpow(ll a, ll b) {ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a) {return modpow(a, MOD - 2, MOD);}
void graph(vvi &adj, int m) {int x, y; forn(i, m) {cin >> x >> y; adj[x - 1].pb(y - 1); adj[y - 1].pb(x - 1);}}

const int mxN = 2e5 + 5;
void solve() {
	string a, b;
	cin >> a >> b;
	if(b.substr(0, sz(a)) == a) cout << "Yes";
	else cout << "No";
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef SHUBHAM107
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("err.txt", "w", stderr);
#endif
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 3644