akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define all(x) (x).begin() , (x).end()
#define f first
#define s second
#define pr(x) cout<<x<<endl;
#define pr2(x,y) cout<<x<<" "<<y<<endl;
#define pr3(x,y,z) cout<<x<<" "<<y<<endl;
#define prv(v) for(auto x:v) cout<<x<<" ";
#define ffs fflush(stdout);
#define int ll
using namespace std;
 
const ll MOD = 1e9+7;
const ll INF = 1e12;
const ll LOG = 29;
#define PI 3.141592653589793238 


long long binpow(long long a, long long b) {
    a%=MOD;    
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%MOD;
        a = (a * a)%MOD;
 
        
        b >>= 1;
    }
    res%=MOD;
    return res;
}
const ll N =(3e5+5);

void solve(){
	string s;
	cin>>s;
	string t;
	cin>>t;
	string x;
	ll n = t.size();
	for(int i = 0;i<(n-1);i++)x+=t[i];
	if(x==s){
		cout<<"Yes\n";
	}
	else
		cout<<"No\n";
}
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
     
    ll t=1;
 //   cin>>t;
    while(t--){
        solve();
    }    
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  cin >> a;
  vector<int> z(a+1);
  int ans = 0;
  int m = 0;
  for(int i = 1;i<a+1;i++){
    cin >> z.at(i);
    if(z.at(i)<=z.at(i-1))m++;
    else{m=0;}
    ans = max(ans,m);
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
static const ll MAX_L = 1e9 + 7;

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

int main() {
	ll n, m; cin >> n >> m;
	string s, r; cin >> s >> r;

	ll l = lcm(m, n);

	map<ll, char> mp;
	ll sIndex = 0;
	rep(i, 0, n) {
		ll t = i * l / n + 1;
		t--;
		//cout << t << " ";
		if (mp.find(t) == mp.end()) {
			mp[t] = s[sIndex++];
		}
		else if (mp[t] != s[sIndex]) {
			cout << -1 << endl;
			return 0;
		}
		else if (mp[t] == s[sIndex]) {
			sIndex++;
		}
	}

	//cout << endl;

	ll rIndex = 0;
	rep(i, 0, m) {
		ll t = i * l / m + 1;
		t--;
		//cout << t << " ";
		if (mp.find(t) == mp.end()) {
			mp[t] = r[rIndex++];
		}
		else if (mp[t] != r[rIndex]) {
			cout << -1 << endl;
			return 0;
		}
		else if (mp[t] == r[rIndex]) {
			rIndex++;
		}
	}

	//cout << endl;
	cout << l << endl;
	return 0;
}

Measured memory_bytes: 10880
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	long total = 0;
    	List<Integer> Ai = new ArrayList<>();
    	for (int i = 0; i < N; i++) {
    		int num = sc.nextInt();
    		Ai.add(num);
    		total += num;
    	}
    	long harf = total/2;
    	long harfSum = 0;
    	int harfIndex = 0;
    	for (int i = 0; i < Ai.size(); i++) {
    		harfSum += Ai.get(i);
    		if (harf <= harfSum) {
    			harfIndex = i;
    			break;
    		}
    	}
    	long harfSum2 = 0;
    	for (int i = harfIndex+1; i < Ai.size(); i++) {
    		harfSum2 += Ai.get(i);
    	}
    	long harfSum3 = harfSum - Ai.get(harfIndex);
    	long harfSum4 = harfSum2 + Ai.get(harfIndex);
    	long ans = Math.min(Math.abs(harfSum2 - harfSum),Math.abs(harfSum3 - harfSum4));
    	System.out.println(ans);
    }
}

Measured memory_bytes: 88608
#include<bits/stdc++.h>
using namespace std;
#define  ll  long long
const int N=1e5+2;
ll wt[101],val[101],dp[101][N];
void KS(ll n,ll m,ll v)
{
    for(ll i=0;i<=n;i++)
    {
        for(ll j=0;j<=v;j++)
        {
            dp[i][j]=1e14;
        }
    }
    dp[0][0]=0;
    for(ll i=1; i<=n; i++)
    {
        for(ll j=0; j<=v; j++)
        {
            if((j-val[i-1])>=0)
            {
                dp[i][j]=min(dp[i-1][j],dp[i-1][j-val[i-1]]+wt[i-1]);
            }
            else
            {
                dp[i][j]=dp[i-1][j];
            }
        }
    }
    ll mx=-1e14;
    for(ll i=0;i<=v;i++)
    {
        if(dp[n][i]<=m)
        {
            mx=max(mx,i);
        }
    }
    cout<<mx<<"\n";
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll t,i,j,n,m,l,r,k,v=0;
    cin>>n>>k;
    for(i=0; i<n; i++)
    {
        cin>>wt[i]>>val[i];
        v+=val[i];
    }
    KS(n,k,v);
    return 0;
}

Measured memory_bytes: 79232
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        long long a, b;
        if(!(cin >> a >> b))
            return 0;
        a += b;
        int ret = 1;
        while((a /= 10) > 0)
            ++ ret;
        cout << ret << endl;
    }
}

Measured memory_bytes: 0
N, M = map(int, input().split())

ab = [list(map(int, input().split())) for i in range(N)]
cd = [list(map(int, input().split())) for i in range(M)]

for student in ab:
    min_distance = 10**9
    min_idx = 0
    for idx in range(M)[::]:
        check = cd[idx]
        distance = abs(student[0] - check[0]) + abs(student[1] - check[1])
        if distance < min_distance:
            min_distance = distance
            min_idx = idx
    print(min_idx+1)

Measured memory_bytes: 3064
using System;
using static System.Console;
using static System.Math;

public class Hello{
    public static void Main(){
/*        string[] input = ReadLine().Split(' ');
        long a = long.Parse(input[0]);
        long b = long.Parse(input[1]);
        long x = long.Parse(input[2]);
        
        long ans = 0;
        ans += b/x;
        if(a>x){
        if(a%x == 0){
            ans -= (a/x)-1;
        }else{
            ans -= a/x;
        }
        }
        if(a==0){
            ans++;
        }
        WriteLine(ans);*/
        string a = ReadLine();
        if(a=="a"||a=="i"||a=="u"||a=="e"||a=="o"){
            WriteLine("vowel");
        }else{
            WriteLine("consonant");
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;


const int MAX = 510000;
///////combination///////
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
////////////////////////

int main(void) {
    int n,k;
    cin >> n >> k;
    COMinit();
    ll res;
    rep(i,k+1){
        if(i==0)continue;
        res = COM(n-k+1,i);
        DEBUG{cout << res << endl;}
        if(k!=i)res *= COM(k-1,k-i);
        res %= MOD;
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 12160
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d long double
#define pii pair<int,int>
#define pb push_back
#define pf push_front
#define cases int t;cin>>t;while(t--)
#define N 100003
#define M 103
#define inf LLONG_MAX
//int mod=1e9+7;
//int mod=998244353;

signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int a,b;
    cin>>a>>b;
    if(a<b)
        swap(a,b);
    int ans=a;
    --a;
    ans+=max(a,b);
    cout<<ans;



    return 0;
}


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

int main () {
  string x;
  int sum;
  while (1) {
    cin >> x;
    if (x == "0") break;
    sum = 0;
    for (int i = 0; i< x.size(); i++) {
      sum += x[i] - '0';
    }
    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n,m;
  cin >> n >> m;
  string res;
  for(int i = 0;i < n;i++)res += 'a';
  bool ok = true;
  for(int i = 0;i < m;i++){
    ll s;
    char c;
    cin >> s >> c;
    if((res[s - 1] != 'a' && res[s - 1] != c) || (s == 1 && n != 1 && c == '0'))ok = false;
    res[s - 1] = c;
  }
  for(int i = 0;i < n;i++){
    if(res[i] == 'a'){
      if(n == 1)res[i] = '0';
      else if(i == 0)res[i] = '1';
      else res[i] =  '0';
    }
  }
  if(ok)cout << res << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define ld long double
#define input for(int i = 0; i < n; ++i) cin >> a[i]
#define output for(int i = 0; i < n; ++i) cout << a[i] << " "
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pll pair<long long ,long long >
#define ppll pair < pll , pll >
int main(){
    SPEED;
    int n;
    cin >> n;
    int a[n];
    input;
    int dp[n];
    dp[0] = 0;
    dp[1] = abs(a[0] - a[1]);
    for(int i = 2; i < n; ++i){
        dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
    } 
    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <utility>
#include <stdint.h>
#include <vector>
#include <set>
#include <numeric>

using namespace std;

int64_t gcd(int64_t a, int64_t b)
{
  while(true) {
    if (a == 0) return b;
    b %= a;
    if (b == 0) return a;
    a %= b;
  }
}

int64_t lcm(int64_t a, int64_t b)
{
  int64_t temp = gcd(a, b);
  return temp ? (a / temp * b) : 0;
}

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

  set<int> A;
  int64_t biggest = 0;

  int64_t l = 1;
  for (int n=0; n<N; ++n) {
    int64_t a;
    cin >> a;
    A.insert(a);
    if (a%2) {
      cout << 0 << endl;
      return 0;
    }
    biggest = max(a, biggest);
    l = lcm(a,l);
  }

  vector<int> AA(A.begin(), A.end());

  int64_t first = 0;
  for (int64_t ii=0; ; ++ii) {
    bool flag = true;
    int64_t m = ii*biggest;
    if (m > M + biggest/2)
      break;

    for (int a : AA) {
      if ((m+(biggest-a)/2)%a) {
	flag = false;
	break;
      }
    }

    if (flag) {
      first = biggest*ii + biggest/2;
      break;
    }
  }

  if (first == 0 || first > M) {
    cout << 0 << endl;
  } else {
    cout << (M-first)/l + 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    string S,T; cin>>S>>T;

    int match=0;
    rep(i,0,N){
        bool matching=true;
        rep(j,0,N-i) if(S.at(i+j)!=T.at(j)){
            matching=false;
            break;
        }
        if(matching){
            match=N-i;
            break;
        }
    }

    cout<<2*N-match<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
using P = pair<int, int>;
const int inf =1e9;
const int minus_inf = -1e9;

struct edge{
    int to;
    int cost;
};
using graph = vector<vector<edge>>;

int main(){
    int n; cin >> n;
    vector<int> dp_A(n+1, inf);
    vector<int> dp_B(n+1, inf);
    vector<int> dp_C(n+1, inf);
    dp_A[0] = 0;
    dp_B[0] = 0;
    dp_C[0] = 0;
    int a, b, c;
    for(int i=0; i<n; i++){
        cin >> a >> b >> c;
        dp_A[i+1] = max(dp_B[i]+b, dp_C[i]+c);
        dp_B[i+1] = max(dp_A[i]+a, dp_C[i]+c);
        dp_C[i+1] = max(dp_A[i]+a, dp_B[i]+b);
    }
    cout << max(dp_A[n], max(dp_B[n], dp_C[n])) << endl; 
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int cnt=0;
  int pos=0;
  for(int i=0;i<n;i++){
    bool flag=false;
    for(int j=pos;j<n;j++){
      if(i+1==a[j]){
        pos=j+1;
        cnt++;
        flag=true;
        break;
      }
    }
    if(!flag) break;
  }
  if(cnt==0){
    cout << -1 << endl;
    return 0;
  }
  cout << n-cnt << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,k;
  cin >> a >> b >> k;
  for(int i=1;i<=k;i++){
    if(i%2==1){
      b+=a/2;
      a/=2;
    }
    else{
      a+=b/2;
      b/=2;
    }
  }
  cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;

const int MAXN = 100000 + 100;

int len, n;
vector<int> odd, ans;

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> len >> n;
	for(int i = 1; i <= n; i++)
	{
		int x;
		cin >> x;
		(x & 1 ? odd : ans).push_back(x);
	}
	if(odd.size() > 2)
	{
		cout << "Impossible" << endl;
		return 0;
	}
	if(odd.size() >= 1)
		ans.insert(ans.begin(), odd[0]);
	if(odd.size() >= 2)
		ans.insert(ans.end(), odd[1]);
	
	for(int i = 0; i < ans.size(); i++)
		cout << ans[i] << ' ';
	cout << endl;

	if(ans.size() == 1)
		ans.insert(ans.begin(), 0);

	ans.front()++;
	ans.back()--;
	if(!ans.back()) ans.pop_back();
	cout << ans.size() << endl;
	for(int i = 0; i < ans.size(); i++)
		cout << ans[i] << ' ';
	cout << endl;


	return 0;
}


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

typedef long long LL;

#define MAXN 2005


int n, k;
LL f[MAXN][MAXN], fac[MAXN * MAXN], inf[MAXN * MAXN];
const int mod = 1e9 + 7, N = 4000000;

LL power(LL a, int b) {
    LL res = 1;
    while (b) {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

void init() {
    inf[0] = fac[0] = 1;
    for (int i = 1; i <= N; ++i)
        fac[i] = fac[i - 1] * i % mod;
    inf[N] = power(fac[N], mod - 2);
    for (int i = N - 1; i >= 1; --i)
        inf[i] = inf[i + 1] * (i + 1) % mod;
}

LL C(int n, int m) {
    return fac[n] * inf[n - m] % mod * inf[m] % mod;
}

int main() {
    init();
    scanf("%d%d", &n, &k);
    if (k == 1) {
        puts("1");
        return 0;
    }
    f[0][0] = 1;
    for (int i = 1; i <= n; ++i)
        for (int j = 0; j <= i; ++j)
            if (!j)
                f[i][j] = f[i - 1][j]; //白球
            else
                f[i][j] = (f[i - 1][j] + f[i][j - 1] * C(n * k - (j - 1) * (k - 1) - i - 1, k - 2) % mod * (n - j + 1) % mod) % mod;
    printf("%lld\n", f[n][n]);
}

Measured memory_bytes: 94464
#include<iostream>
#include<queue>
#include<memory>
#include<map>
#include<set>
#include<unordered_map>
#include<array>
#include<vector>
#include<algorithm>
#include<list>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<string>

using namespace std;
using ll = long long;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<ll>;

const ll MOD = 1000000007;

mat edge;
vec usedAOKI;
vec usedTAKAHASHI;

void src(int v,vec & used,int d)
{
	used[v] = d;

	for (int u : edge[v])
	{
		if (used[u] != 0)continue;

		src(u, used, d + 1);
	}
}

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

	int u, v; cin >> u >> v; --u; --v;

	edge = mat(N);
	usedAOKI = vec(N,0);
	usedTAKAHASHI = vec(N,0);

	for (int i = 0; i < N - 1; ++i)
	{
		int A, B; cin >> A >> B; --A; --B;

		edge[A].emplace_back(B);
		edge[B].emplace_back(A);
	}

	src(u, usedTAKAHASHI, 1);
	src(v, usedAOKI, 1);

	int ans = 0;

	for (int i = 0; i < N; ++i)
	{
		
		if (usedTAKAHASHI[i] < usedAOKI[i])
		{
			ans = max(ans, usedAOKI[i] - 2);
		}
	}
	cout << ans << endl;
	
}

Measured memory_bytes: 10368
/*
    NEVER GIVE UP!
    THE EXPERT IN ANYTHING WAS ONCE A BEGINNER
*/

#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define f(i,a,b) for(ll i=a; i<=b; i++)
#define fi(i,a,b) for(ll i=a; i>=b; i--)
#define fa(x,b) for(auto x:b)
#define TC ll test_case; cin>>test_case; for(ll number=1 ; number <= test_case ; number ++ )
#define vll vector<ll>
#define pb push_back
#define pll pair<ll,ll>
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (ll)(a).size()
#define sp(x) cout << fixed << setprecision(x);
#define ReadFile freopen("input.txt","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
#define endl "\n"

const ld pi = acos(-1);
const ll M=1e9+7,N=1e7+5,INF=1e18;

ll n,m,x,t,mx=INF;
vector<pair<ll,vll>> c;
vector<string> pv;
vll a;

void comb(string p, ll s)
{
    if(s>n)
        return;
    string a="",b="";
    a=p+'1';
    if(sz(a)==n)
        pv.pb(a);
    comb(a,s+1);

    b=p+'0';
    if(sz(b)==n)
        pv.pb(b);
    comb(b,s+1);
}


void solve()
{    
    cin >> n >> m >> x;
    a.resize(m);

    f(i,1,n)
    {
        cin >> t;
        f(i,0,m-1)
            cin >> a[i];        
        c.pb(mp(t,a));
    }

    sort(c.begin(),c.end());
    // f(i,0,n-1)
    // {
    //     cout << c[i].ff << " ";
    //     fa(it,c[i].ss)
    //         cout << it << " ";        
    //     cout << endl;
    // }
    comb("",0);

    fa(it,pv)
    {
        f(i,0,m-1)
            a[i]=0;
        bool is=true;
        t=0;

        f(i,0,n-1)
        {
            if(it[i]=='1')
            {
                f(j,0,m-1)
                    a[j]+=c[i].ss[j];
                t+=c[i].ff;
            }
        }

        f(i,0,m-1)
        {
            if(a[i]<x)
                is=false;
        }

        if(is)
            mx=min(mx,t);

    }

    if(mx!=INF)
        cout << mx << endl;
    else 
        cout << "-1" << endl;
}

int32_t main()
{
    FIO
    solve();
    return 0;
}

Measured memory_bytes: 3800
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX = 1e5;

int main() {
	int N;
	cin >> N;
	int A[MAX + 2];
	rep1(i, N)cin >> A[i];
	A[0] = A[N + 1] = 0;


	//まずは取りやめないときの総和を出す
	int sum = 0;
	rep(i, N + 1)sum += abs(A[i] - A[i + 1]);

	//i番目を取りやめたときの金額を順に出す
	//差額は、前後の位置関係で確定するが、条件分岐はいらない気がした
	rep1(i, N) {
		int diff = abs(A[i] - A[i - 1]) + abs(A[i] - A[i + 1]) - abs(A[i - 1] - A[i + 1]);
			cout << sum - diff<<endl;
	}
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int ignore=1;
    //cin>>ignore;
    while(ignore--)
    {
      ll n,d;
      cin>>n>>d;
      ll count = 0;
      for(int i=0;i<n;i++)
      {
          ll x,y;
          cin>>x>>y;
          
          count += ((x*x)+(y*y))<=(d*d);
      }
       cout<<count<<endl; 
    }
    
}

Measured memory_bytes: 3620
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
use std::cmp::*;
fn main(){
    let n=read::<i32>();
    let a=(0..n).map(|_|read::<String>()).collect::<Vec<String>>();
    let m=read::<i32>();
    let b=(0..m).map(|_|read::<String>()).collect::<Vec<String>>();
    let mut s=0;
    for i in &a{
        let mut t=0;
        for j in &a{if i==j{t+=1}}
        for j in &b{if i==j{t-=1}}
        s=max(s,t);
    }
    println!("{}",s);
}


Measured memory_bytes: 4352
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
struct Integer{
public:
    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;}

    bool isPrime(ll x){
        if(x < 2) return false;
        if(x == 2) return true;
        if(x % 2 == 0) return false;
        for(ll i = 3;i <= sqrt(x) + 1;i += 2) if(x % i == 0) return false;
        return true;
    }

    vector<ll> divisor(ll M){
        vector<ll> dd;
        for(ll i = 1; i * i <= M; i++){
            if(M % i == 0){
                dd.push_back(i);
                if(i * i != M) dd.push_back(M / i);
            }
        }
        sort(dd.begin(), dd.end());
        return dd;
    }

    vector<ll> factor(ll M){ //素因数分解
        vector<ll> dd;
        if(M == 1){
            dd.push_back(1);
            return dd;
        }
        for(ll i = 2; i*i <= M; i++){
            while(M % i == 0){
                dd.push_back(i);
                M /= i;
            }
        }
        if(M != 1) dd.push_back(M);
        sort(dd.begin(), dd.end());
        return dd;
    }
};

ll power(ll x, ll n){
    if(n == 0) return 1LL;
    ll res = power(x * x % MOD, n/2);
    if(n % 2 == 1) res = res * x % MOD;
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll A[10010];
    rep(i,0,N) cin >> A[i];
    Integer it;
    map<ll,ll> mp;
    rep(i,0,N){
        auto dd = it.factor(A[i]);
        map<ll,ll> cnt;
        for(auto &e: dd){
            cnt[e]++;
        }
        for(auto &e: cnt){
            mp[e.first] = max(mp[e.first], e.second);
        }
    }
    ll add = 1;
    for(auto &e: mp){
        add *= power(e.first, e.second);
        add %= MOD;
    }
    ll ans = 0;
    rep(i,0,N){
        auto dd = it.factor(A[i]);
        map<ll,ll> cnt;
        for(auto &e: dd){
            cnt[e]++;
        }
        ll tt = add;
        for(auto &e: cnt){
            ll val = power(e.first, MOD-2);
            tt *= power(val, e.second);
            tt %= MOD;
        }
        ans += tt;
        ans %= MOD;
    }
    print(ans);
    

}

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

int main(){
	int n,q,S[10000],T[500];
	int count = 0;
	
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> S[i];
		}
	
	cin >> q;
	for(int i = 0;i < q;i++){
		cin >> T[i];
		}
	
	for(int i = 0;i < q;i++){
		for(int j = 0;j < n;j++){
			if(T[i] == S[j]){
				 count++;
				 break;
				}
		}
	}
	cout << count << endl;
}

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

#define ll long long int
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define repm(i, a, n) for (ll i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define mod (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vd vector<double>
#define vb vector<bool>
#define vs vector<string>
#define vii vector<vector<int>>
#define vllll vector<vector<ll>>
#define ALL(a) (a).begin(), (a).end()

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

void print(bool f)
{
    cout << (f ? "Yes" : "No") << endl;
}

void Print(bool f)
{
    cout << (f ? "YES" : "NO") << endl;
}

int main(void)
{
    ll n;
    cin >> n;
    vll x(n), y(n);
    rep(i, 0, n) cin >> x[i] >> y[i];

    map<pll, ll> mp;
    rep(i, 0, n)
    {
        rep(j, 0, n)
        {
            if (i != j)
                mp[make_pair(x[i] - x[j], y[i] - y[j])]++;
        }
    }
    ll m = 0;
    for (auto x : mp)
        m = max(m, x.second);
    cout << n - m << endl;
}

Measured memory_bytes: 384
S=int(input())
pr=10**9+7
MAX_NUM = 3001 + 1
fac  = [0]*MAX_NUM
finv = [0]*MAX_NUM
inv  = [0]*MAX_NUM
fac[0]  = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2,MAX_NUM):
    fac[i] = fac[i-1] * i % pr
    inv[i] = pr - inv[pr%i] * (pr // i) % pr
    finv[i] = finv[i-1] * inv[i] % pr
def c(n,k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % pr) % pr
a=0
for i in range(1,S//3+1):
    a=(a+c(S-2*i-1,i-1))%pr
print(a)

Measured memory_bytes: 9400
program main
    integer::n,a=0,t=0,i
    integer,allocatable::h(:)
    read *,n
    allocate(h(n))
    read *,h(:)
    do i=2,n
    	if(h(i-1)>=h(i))then
        	t=t+1
        else
        	a=max(a,t)
            t=0
        end if
    end do
    a=max(a,t)
    print '(i0)',a
end program main

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

#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,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	cout << (3 * a + b) / 2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<string>
//#include<queue>
//#include<cmath>
//#include<algorithm>
//#define debug1 cout<<"?"<<endl;
//#define debug2 cout<<"?"<<i<<endl;
#define PII pair<int,int>
typedef long long ll;
const int maxn=3e5+9;
const double pi=acos(-1);
const int mod=998244353;
const int INF=0x3f3f3f3f;
const double ep=1e-7;
using namespace std;
int main()
{
	int k,n,i;
	double p[maxn]={0},sum[maxn]={0};
	scanf("%d%d",&n,&k);
	for(i=1;i<=n;i++)scanf("%lf",&p[i]),p[i]=(1+p[i])/2,sum[i]=sum[i-1]+p[i];
	double ans=0;
	for(i=k;i<=n;i++)ans=max(ans,sum[i]-sum[i-k]);
	printf("%.12f\n",ans);
}

Measured memory_bytes: 4992
import java.util.Scanner;
 
public class Main {
	
	public static void main(String[] args) throws Exception{	
		Scanner sc = new Scanner(System.in);
		
		int ans;

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		if(a == b){
			if(a == c){
				ans = 1;
			}
			else{
				ans = 2;
			}
			
		} else {
			if(a == c){
				ans = 2;
			}
			else if(b == c){
				ans = 2;
			}
			else {
				ans = 3;
			}
		}
		
		System.out.println(ans);
		
		
		
		sc.close();
	}
}

Measured memory_bytes: 9680
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<ll> t(n),a(n);
    rep(i,0,n) cin>>t[i];
    rep(i,0,n) cin>>a[i];
    
    vector<ll> kakutei_t(n),kakutei_a(n);
    int now=-1;
    rep(i,0,n){
        if(t[i]!=now){
            now=t[i];
            kakutei_t[i]=now;
        }
        else kakutei_t[i]=0;
    }
    
    now=-1;
    rrep(i,n,0){
        if(a[i]!=now){
            now=a[i];
            kakutei_a[i]=now;
        }
        else kakutei_a[i]=0;
    }
    
    rep(i,0,n){
        if(kakutei_t[i]!=0 && kakutei_a[i]!=0 && kakutei_t[i]!=kakutei_a[i]){
            cout<<0<<endl;
            return 0;
        }
        if(kakutei_t[i]!=0 && kakutei_a[i]==0 && a[i]<t[i]){
            cout<<0<<endl;
            return 0;
        }
        if(kakutei_a[i]!=0 && kakutei_t[i]==0 && t[i]<a[i]){
            cout<<0<<endl;
            return 0;
        }
    }
    
    rep(i,0,n){
        if(kakutei_t[i]!=0) t[i]=1;
        if(kakutei_a[i]!=0) a[i]=1;
    }
    
    
    ll ans=1;
    rep(i,0,n){
        ans*=min(a[i],t[i]);
        ans%=MOD;
    }
    
    cout<<ans<<endl;
    
}



Measured memory_bytes: 3456
/// wa ^3^

#pragma GCC optimize("O3")

#include<bits/stdc++.h>

#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
 
using namespace std;

using ll = long long;
using pii = pair<int, int>;                                   

const int MOD = 1e9 + 7;
const int INF32 = 1e9 + 1e2;

void stndrtn() {
#ifdef hitorie
    freopen(".in", "r", stdin);
#endif        
}

const int flag = 0;

void maincode() {
    double r;
    cin >> r;
    cout << setprecision(10) << fixed << 2.0 * acos(-1) * r; 
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr), stndrtn();
    int ts = 1;
    if (flag) 
        cin >> ts;
    while (ts--)
        maincode(); 
    return 0;
}


Measured memory_bytes: 3792
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))

int c(const void*a,const void*b){
	return strcmp(a,b);
}

char s[99][99];
int main(){
	ll n;
	while(scanf("%lld",&n),n){
		char temp[99];
		rep(i,0,n){
			scanf("%s",temp);
			int n=strlen(temp);
			int cnt=0;
			s[i][cnt++]=temp[0];
			rep(j,1,n)if(temp[j-1]=='a'||temp[j-1]=='i'||temp[j-1]=='u'||temp[j-1]=='e'||temp[j-1]=='o'){
				s[i][cnt++]=temp[j];
			}
			s[i][cnt]=0;
		}
		qsort(s,n,99,c);
//		rep(i,0,n)puts(s[i]);
		int ans=0;
		rep(i,0,n-1){
			if(!strcmp(s[i],s[i+1])){
				ans=-1;
				break;
			}
			int j=0;
			while(s[i][j]==s[i+1][j])j++;
			ans=max(ans,j+1);
		}
		printf("%d\n",ans);
	}
}


Measured memory_bytes: 2104
import sys
input=sys.stdin.readline
from collections import defaultdict
from heapq import heappush,heappop
N,m,s,t=map(int,input().split())
en=defaultdict(set)
sneek=defaultdict(set)
for i in range(m):
    u,v,a,b=map(int,input().split())
    en[u]|={(a,v)}
    en[v]|={(a,u)}
    sneek[u]|={(b,v)}
    sneek[v]|={(b,u)}
inf=float('inf')
def makedist(first,branch):
    dist=[inf]*(N+1)
    dist[first]=0
    check=[(0,first)]
    while len(check)>0:
        d,now=heappop(check)
        if dist[now]<d:
            continue
        for lenth,nex in branch[now]:
            if d+lenth<dist[nex]:
                dist[nex]=d+lenth
                heappush(check,(d+lenth,nex))
    return dist
disten=makedist(s,en)
distsneek=makedist(t,sneek)
ans=[0]*(N+1)
ans[N]=disten[N]+distsneek[N]
for i in range(N-1,0,-1):
    ans[i]=min(ans[i+1],disten[i]+distsneek[i])
big=10**15
for i in range(1,N+1):
    print(big-ans[i])

Measured memory_bytes: 114028
using System;

namespace ALDS1_6_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());
            //int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            string[] str = Console.ReadLine().Split(' ');
            int[] input = new int[num];
            int last = 0;
            int q = 0;

            for (int i=0; i<num; i++)
            {
                input[i] = int.Parse(str[i]);
            }
            last = num - 1;

            q = partition(input, 0, last);
            output(input, q-1);

        }
        
        static int partition(int[] A, int p, int r)
        {
            int x = A[r];
            int i = p - 1;
            int tmp = 0;
            int index = 0;

            for (int j=p; j<r; j++)
            {
                if(A[j] <= x)
                {
                    i++;
                    tmp = A[i];
                    A[i] = A[j];
                    A[j] = tmp;
                }
            }

            tmp = A[r];
            A[r] = A[i + 1];
            A[i + 1] = tmp;
            i++;

            index = i + 1;
            return index;
        }

        static void output(int[] B, int r)
        {
            for (int i=0; i<B.Length; i++)
            {
                if (i == r)
                {
                    Console.Write("[" + B[i] + "] ");
                }
                else if (i != B.Length-1 )
                {
                    Console.Write("{0} ", B[i]);
                }
                else
                {
                    Console.Write("{0}", B[i]);
                    Console.WriteLine();
                }
            }
        }
    }
}

Measured memory_bytes: 19932
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;

struct Node {
	int key;
	Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;
	
	z = (Node *)malloc(sizeof(Node));
	z->key   = k;
	z->left  = NIL;
	z->right = NIL;
	
	while(x != NIL) {
		y = x;
		if(z->key < x->key) {
			x = x->left;
		} else {
			x = x->right;
		}
	}
	
	z->parent = y;
	if(y == NIL) {
		root = z;
	} else {
		if( z->key < y->key) {
			y->left = z;
		} else {
			y->right = z;
		}
	}
}

void inorder(Node *u) {
	if(u == NIL) return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}
void preorder(Node *u) {
	if(u == NIL) return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}
	
int main(void) {
	int n, i, x;
	string com;
	scanf("%d",&n);
	
	for(i=0;i<n;i++) {
		cin >> com;
		if(com == "insert") {
			scanf("%d",&x);
			insert(x);
		} else if(com == "print") {
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}

	return 0;
}

/*
10
insert 30
insert 88
insert 12
insert 1
insert 20
find 12
insert 17
insert 25
find 16
print
*/


Measured memory_bytes: 26640
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n, k;
    cin >> n >> k;
    vll p(n);
    rep(i, n) cin >> p[i];
    vll max_seq(n);
    ll seq = 0, last = -1;
    for(ll i = 0; i < n; i++) {
        if(last < p[i]) ++seq;
        else seq = 1;
        max_seq[i] = seq;
        last = p[i];
    }
    vb ordered(n);
    for(ll i = 0; i < n; i++) {
        if(max_seq[i] >= k) ordered[i] = true;
    }
    set<ll> s;
    vb min_max(n);
    for(ll i = 0; i < k; i++) s.insert(p[i]);
    for(ll i = k; i < n; i++) {
        if(*s.begin() == p[i - k] && *s.rbegin() < p[i]) min_max[i] = true;
        s.erase(p[i - k]);
        s.insert(p[i]);
    }
    ll cnt_ordered = 0, cnt_minmax = 0;
    for(ll i = 0; i < n; i++) {
        if(ordered[i]) cnt_ordered++;
    }
    if(cnt_ordered > 0) cnt_ordered--;
    for(ll i = 0; i < n; i++) {
        if(!ordered[i] && min_max[i]) cnt_minmax++;
    }
    cout << n - k + 1 - cnt_ordered - cnt_minmax << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 15856
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<max(a*b, c*d)<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    static final int MOD = 2019;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long L = sc.nextInt();
        long R = sc.nextInt();

        R = Math.min(R, L + 2019); //Rを狭めても結果は一緒　2019を2週すれば同じmodが2個以上取れるのでi<jの場合も対応可能
        long ans = 2018;

        for (long i = L; i <= R; i++) {
            for (long j = i + 1; j <= R; j++) {
                long x = i * j % 2019;
                ans = Math.min(ans, x);
            }
        }

        System.out.println(ans);

    }

}


Measured memory_bytes: 23636
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e3 + 10;
int a[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int ans = 0;
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		int cnt = 1;
		for (int j = 1; j < i; j++)
		{
			if (a[i] >= a[j]) cnt++;
		}
		if (cnt == i)
			ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

	int ans = -1;
	for (int i = 0; i < N; ++i) {
		int c, t;
		cin >> c >> t;
		if (t <= T) {
			if (ans < 0 || c < ans) {
				ans = c;
			}
		}
	}
	if (ans < 0) {
		cout << "TLE" << endl;
	}
	else {
		cout << ans << endl;
	}
}


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

#define INF (1 << 29)

int maps[6][2] = {
  {1, 2},
    {INF, 4},
      {1, INF},
	{5, 2},
	  {3, 5},
	    {2, 1},
};

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

  char temp[105];

  while(1){
    cin >> temp;
    if(strcmp(temp, "#") == 0) break;

    int now = 0;
    bool flag = true;
    for(int i = 0;i < strlen(temp) && flag;++i){
      if(maps[now][temp[i] - '0'] != INF){
	now = maps[now][temp[i] - '0'];
      }else{
	flag = false;
      }
    }
    
    if(now == 5 && flag){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }

  }

  return 0;
}




Measured memory_bytes: 3240
from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))
C = Counter(A)
C = sorted(C.items(), key=lambda x: x[1])
k = len(C)
c = 0
for i in range(k - K):
    k, v = C[i]
    c += v

print(c)

Measured memory_bytes: 43164
N, K = map(int, input().split())
MOD = 10**9 + 7

D = [[0]*(K+1) for i in range(N+1)]
for n in range(0, N+1):
    D[n][1] = 1
for k in range(1, K+1):
    D[0][k] = 1
for n in range(1, N+1):
    for k in range(1, K+1):
        if n >= k:
            D[n][k] = (D[n-k][k] + D[n][k-1]) % MOD
        else:
            D[n][k] = D[n][n]
print(D[N][K])



Measured memory_bytes: 29348
import math
import itertools

N = int(input())
x = [list(map(int, input().split())) for i in range(N)]


# print(x)
# print(y)

def root(xi, yi, xj, yj):
    return math.sqrt((xi - xj) ** 2 + (yi - yj) **2)

# print(root(1, 0, 0, 0))
# print(root(0, 0, 0, 1))


# a = root(4, 3, 6, 2)
# print(a)



# x1 = (-406, 10)
# x2 = ( 512, 859)
# x3 = ( 494, 362)
# x4 = (-955, -475)
# x5 = ( 128, 553)
# x6 = (-986, -885)
# x7 = ( 763, 77)
# x8 = ( 449, 310)
#

l = x
# print(l)
# l = [x1, x2, x3, x4, x5, x6, x7, x8]

m = 0
for i in itertools.permutations(l, len(l)):
    k = 0
    for j in range(len(i) -1):
        k += root(*(i[j] + i[j+1]))
    m += k
print(m/math.factorial(len(l)))


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

int main()
{
    int a, b;
    cin >> a >> b;

    if ((a <= 9) && (b <= 9))
    {
        cout << a * b << endl;
    }
    else
    {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#include <chrono>
#include <random>
#include <math.h>
#include <time.h>
#include <assert.h>
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end() 
#define PII pair <ll,ll>
#define N 100005
#define MOD 1000000007
#define INF 1000000000000000000
using namespace std;

ll dp[101][100001];
int main()
{
	int n, k, A[N];
	cin >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		cin >> A[i];
	}
	memset(dp, 0, sizeof(dp));
	dp[0][0] = 1;
	for (int child = 1; child <= n; ++child)
	{
		for (int i = 1; i <= k; ++i)
		{
			dp[child - 1][i] = (dp[child - 1][i] + dp[child - 1][i - 1]) % MOD;
		}
		for (int candie = 0; candie <= k; ++candie)
		{
			dp[child][candie] = dp[child - 1][candie];
			if(candie - (A[child] + 1) >= 0)
			{
				dp[child][candie] -= dp[child - 1][candie - (A[child] + 1)];
				dp[child][candie] = (dp[child][candie] + MOD) % MOD;
			}	
		}
	}
	cout << dp[n][k] << "\n";	
}


Measured memory_bytes: 79104
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define in (void)scanf
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
//#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Repp(i,l,r,k)for(int i=(int)(l);i<(int)(r);i+=(int)(k))
//#define Repp(i,l,r,k)for(LL i=(LL)(l);i<(LL)(r);i+=(LL)(k))
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define MOD 1000000007//998244353,1000000007,1000000009,4999999999999997
int upi(const void* a, const void* b) { return*(int*)a<*(int*)b ? -1 : *(int*)a> * (int*)b ? 1 : 0; }
int downi(const void* a, const void* b) { return*(int*)a<*(int*)b ? 1 : *(int*)a> * (int*)b ? -1 : 0; }
void sortupi(int* a, int n) { qsort(a, n, sizeof(int), upi); } //1,2,3,4,...
void sortdowni(int* a, int n) { qsort(a, n, sizeof(int), downi); }
int upLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? -1 : *(LL*)a> * (LL*)b ? 1 : 0; }
int downLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? 1 : *(LL*)a> * (LL*)b ? -1 : 0; }
void sortupLL(LL* a, int n) { qsort(a, n, sizeof(LL), upLL); }
void sortdownLL(LL* a, int n) { qsort(a, n, sizeof(LL), downLL); }
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab
LL gcd(LL p, LL q) { while (q) { LL t = p % q; p = q; q = t; }return p; }
LL modpow(LL a,LL n,int m){LL x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define invmodpow(b,p)modpow(b,p-2,p)// a/b≡a*b^{-1}(mod p)...return b^{-1}(mod p)
//typedef struct fac { LL n, exp; }F;
//LL fact(LL n,F*a){LL x=n,i,j,c=0;for(i=2;i*i<=x;i++){for(j=1;x%i==0;j++)x/=i;if(j>1){a[c].n=i;a[c++].exp=j-1;}}if(x-1){a[c].n=x;a[c++].exp=1;}return c;}
LL nibtan(LL* a,LL n,LL x){LL p=0,q=n/2,r=n-1;while(r-p>1){if(x>=a[q])p=q;if(x<=a[q])r=q;q=(p+r)/2;}return a[p]==x?p:r;}
//snippet

#define N 200009

void run(void) {
	char s[N], t[N];
	in("%s%s", s, t);
	int a[N] = { 0 }, b[N] = { 0 }, n = strlen(s), flag = 1;
	rep(i, n) {
		a[s[i] - 'a']++;
		b[t[i] - 'a']++;
	}
	rep(i, 26) {
		rep(j, 26)if (b[j] == a[i]) { b[j] = 0; flag--; break; }
		if (flag) { printf("No\n"); return; }
		flag = 1;
	}
	printf("Yes\n");
}

int main(void) {
	int test = 1;
//	in("%d", &test);
	while (test--) {
		run();
		fflush(stdout);
	}
	return 0;
}

Measured memory_bytes: 3608
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    map<int, int> dict;
    for (size_t i = 0; i < n; ++i) {
        int a;
        cin >> a;
        if (dict.count(a)) {
            ++dict[a];
        }
        else {
            dict[a] = 1;
        }
    }

    if (dict.size() <= k) cout << 0 << endl;
    else {
        vector<int> counts;
        for (const auto& item : dict) counts.push_back(item.second);
        sort(counts.begin(), counts.end());
        int num = 0;
        for (size_t i = 0; i < dict.size() - k; ++i) {
            num += counts[i];
        }
        cout << num << endl;
    }
    
    return EXIT_SUCCESS;
}

Measured memory_bytes: 10748
#include <iostream>
#include <map>
#include <string>

using namespace std;
using ull = unsigned long long;

void solve() {
    int n;
    int b[3] = {0, 0, 0};
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i]%4 == 0){
            b[0]++;
        }else if(a[i]%2 == 0){
            b[1]++;
        }else{
            b[2]++;
        }
    }
    if(b[2]+b[1] <= b[0]+1){
        cout << "Yes" << endl;
    }else{
        b[1] = b[1]%2;
        if(b[2]+b[1] <= b[0]+1){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 640