akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a,b;
  cin>>a>>b;
  vector<int> c(a),d(b),e(b),f(a,1);
  rep(i,a)
    cin>>c[i];
    rep(i,b)
    cin>>d[i]>>e[i];
  rep(i,b){
  if(c[d[i]-1]<=c[e[i]-1])
    f[d[i]-1]=0;
  if(c[e[i]-1]<=c[d[i]-1])
    f[e[i]-1]=0;

  }
  int h=0;
  rep(i,a){
  if(f[i])
    h++;
  }
  out(h);
}


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

using namespace std;

typedef long long ll;

int N;
int A[100000 + 100];
int main(int argc, char** argv, char** envp) {
  cin >> N;
  for(int i=0;i<N;++i) {
    scanf("%d", &A[i]);
  }
  sort(A, A+N);
  int ans1 = A[N-1];
  sort(A, A+N, [=](int a,int b){return abs(a*2-ans1) < abs(b*2-ans1);});
  int it=0;
  while(A[it] == ans1) it++;
  int ans2 = A[it];
  cout << ans1 << " " << ans2 << endl;
  
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define PER(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((LL)1e9+7) 
#define INF ((LL)1e9+7)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define BIT(x) (1LL << (x))
using namespace std;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

LL modpow(LL x, LL b){
	LL res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

LL modinv(LL x){
	return modpow(x, MOD-2);
}

int main(){
	int N;
	cin >> N;
	vector<LL> A(N), B(N);
	foreach(i, A)cin>>i;
	foreach(i, B)cin>>i;
	vector<LL> dif(N);
	LL sum = 0;
	REP(i, N){
		dif[i] = A[i] - B[i];
		sum += dif[i];
	}
	int count = 0;
	if(sum<0){
		cout << -1 << endl;
		return 0;
	}
	sort(ALL(dif), greater<LL>());
	sum = 0;
	foreach(i, dif){
		if(i<0){
			sum -= i;
			++count;
		}
	}
	REP(i, N){
		if(sum<=0){
			cout << i + count << endl;
			return 0;
		}
		sum -= dif[i];
	}
	cout << N << endl;

	return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
#include<string.h>
int main(void)
{
	char S[4];
	
	scanf("%s", S);
	if (strcmp(S, "ABC") == 0)
	{
		printf("ARC");
	}
	else
	{
		printf("ABC");
	}

	return 0;
}

Measured memory_bytes: 1636
#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
ans = 0
p = 1
for i in range(n):
    if a[i] == p:
        ans += 1
        p += 1
if ans == 0:
    print(-1)
else:
    print(n - ans)


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

using namespace std;

int main()
{
    string S, T;
    int cnt = 0;

    cin >> S;
    cin >> T;

    for(int i=0; i<3; ++i){
        if(S[i] == T[i]) ++cnt;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
// Devarshi

#include<bits/stdc++.h>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int maxn=1000001;


int main(){

int n;
cin>>n;
string s[n];

map<string,int> mpp;

forn(i,n){cin>>s[i]; mpp[s[i]]++;}


forn(i,n-1){
//if(i==n-1) continue;

if(s[i].back()!=s[i+1].front()){
    cout<<"No";
    return 0;
}
}
for(auto it:mpp){
    if(it.se>1){
        cout<<"No";
        return 0;
    }
}
cout<<"Yes";

return 0;
}


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

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,n) FOR(i,0,n)
#define REPD(i,n) FOR(i,n-1,0)
#define PB push_back
#define mod 1000000007


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m;
    cin>>n>>m;
    int a=0,b=0;
    if(n>1)
    a=n*(n-1)/2;
    if(m>1)
    b=m*(m-1)/2;
    cout<<a+b;
    return 0;   
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep1(i,n) for(i=1;i<=n;i++)
int main(){
  int x,n;
  int i;
  int p[101];
  int sa;
  bool exist = false;

  
  cin >> x >> n;
  
  int ans = x;
  
  rep1(i,n){
    cin >> p[i];
  }
  
  for(sa=0;sa<100/**/;sa++){
    rep1(i,n){
      if(p[i]==x+sa){
        break;
      }
      if(i==n){
        exist = true;
        ans = x+sa;
      }
    }
    
    /*if(exist==true)
      break;*/
    
    rep1(i,n){
      if(p[i]==x-sa){
        break;
      }
      if(i==n){
        exist = true;
        ans = x-sa;
      }
    }
    
    if(exist==true)
      break;
   
    
  }
  
    
  cout << ans;
  
  
}

Measured memory_bytes: 3596
#include <iostream>

using namespace std;

int main() {
    int n, matrix[100][100];

    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> matrix[i][j];
        }
    }

    bool visit[100] = {
        true
    };
    int sum = 0;

    while (1) {
        int min = 2001, mini = -1;
        for (int i = 0; i < n; i++) {
            if (visit[i] == true) {
                for (int j = 0; j < n; j++) {
                    if (matrix[i][j] > -1 && matrix[i][j] < min && visit[j] == false) {
                        min = matrix[i][j];
                        mini = j;
                    }
                }
            }
        }
        if (mini == -1) {
            break;
        }
        else {
            sum += min;
            visit[mini] = true;
        }
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3104
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

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

    if(n&1  || n<10){
        cout << 0 << endl;
        return 0;
    }

    ll ans = 0;
    ll base = 10; 
    ll cnt = 0;
   while(base <= 1e18*2){
       ans += n/base;
       base *= 10;
   }
    
    base = 50;
    while(base <= 1e+18*2){
        ll kakeru = 1;
        while(base*kakeru <= 1e18*2){
            ans += n/(base*kakeru) - n/(2*base*kakeru);
            kakeru *= 10;
        }
        base *= 5;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;

int main(){
    int t, x;
    cin >> t >> x;
    double ans = double(t) / x;
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int x,a,b,c,d;
	while(scanf("%d",&x)!=EOF)
	{
		a=x/1000;
		b=x/100%10;
		c=x/10%10;
		d=x%10;
	if(a+b+c+d==7) printf("%d+%d+%d+%d=7",a,b,c,d);
	else if(a-b+c+d==7) printf("%d-%d+%d+%d=7",a,b,c,d);
	else if(a+b-c+d==7) printf("%d+%d-%d+%d=7",a,b,c,d);
	else if(a-b-c+d==7) printf("%d-%d-%d+%d=7",a,b,c,d);
	else if(a+b+c-d==7) printf("%d+%d+%d-%d=7",a,b,c,d);
	else if(a-b+c-d==7) printf("%d-%d+%d-%d=7",a,b,c,d);
	else if(a-b-c-d==7) printf("%d-%d-%d-%d=7",a,b,c,d);
	else if(a+b-c-d==7) printf("%d+%d-%d-%d=7",a,b,c,d);
	}
}

Measured memory_bytes: 128
//Even better better solutions q{^.^}p

#define ONLINE_JUDGE //in case i forget to uncomment this, sometimes the grader defines the macro ^.^
#ifdef ONLINE_JUDGE
#include <bits/stdc++.h>
#else
#include "stdc++.h"
#endif

#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))

using namespace std;

signed main() {
#ifndef ONLINE_JUDGE
    freopen("/Users/kdkdk/Desktop/input.txt", "r", stdin);
    //freopen("/Users/kdkdk/Desktop/output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, t;
    cin >> n >> t;
    
    int mindist = -1;
    for(int i = 0; i < n; ++i) {
        int a,b;
        cin >> a >> b;
        if(mindist==-1 && b <= t) {
            mindist = a;
        }
        if(b <= t) {
            mindist = MIN(a,mindist);
        }
        
    }
    
    if(mindist == -1) cout << "TLE" << endl;
    else cout << mindist << endl;
        return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <sstream>
#include <iostream>
#include <cstdlib>
 
using namespace std;
 
#define BUF_SIZE 1024
#define ARRAY_SIZE 100
 
 
void selectionSort(int array[],int n,int& change_count)
{
    int min;
    for(int i = 0; i < n-1; i++){
        min = i;    //?????????
        for(int j = i+1; j < n; j++){
            if(array[j] < array[min]){
                min = j;
            }
        }
        if(i != min){
            swap(array[i],array[min]);
            change_count++;
        }
    }
 
}
 
int main(){
 
    char buf[BUF_SIZE];
    int n = atoi(fgets(buf,BUF_SIZE,stdin));
    int array[ARRAY_SIZE];
    int change_count = 0;
 
    for(int i = 0; i < n; i++){
        cin >> array[i];

    }
 
    selectionSort(array,n,change_count);
 
    for(int i = 0; i < n; i++){
        if(i != n-1){
            printf("%d ",array[i]);
        }else{
            printf("%d\n",array[i]);
        }
    }
    printf("%d\n",change_count);
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
template <typename node> void chkmax(node &x, node y) {x = max(x, y);}
template <typename node> void chkmin(node &x, node y) {x = min(x, y);}
template <typename node> void read(node &x) {
	x = 0; int f = 1; char c = getchar();
	while (!isdigit(c)) {if (c == '-') f = -1; c = getchar();}
	while (isdigit(c)) x = x * 10 + c - '0', c = getchar(); x *= f;
}
int main() {
	int x1, y1, x2, y2;
	read(x1), read(y1), read(x2), read(y2);
	int x3, y3, x4, y4;
	x3 = x2 - y2 + y1, y3 = y2 - x1 + x2;
	x4 = x1 - y2 + y1, y4 = y1 - x1 + x2;
	cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << "\n";
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String s =sc.nextLine();
        String answer="";
        for(int i=0;i<s.length();i++){
            char a=s.charAt(i);
            if(Character.isLowerCase(a)==true){
                a=Character.toUpperCase(a);
                answer+=a;
            }
            else{
                a=Character.toLowerCase(a);
                answer+=a;
            }
        }
        System.out.println(answer);
    }
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
using ll = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;

int main() {
  int n; cin >> n;
  vector<int> a(n+100);
  rep(i, n) {
    cin >> a[i];
  }
  a[n+1] = a[n];

  ull m = 1000;
  ull c = 0;

  rep(i, n) {
    // cout << i << "日目: " << a[i] << endl;
    int cur = a[i];
    int pos = 0;
    for(int j = i+1; j <= n; j++) {
      if (cur < a[j]) {
        pos = 1;
        break;
      }
      if (cur > a[j]) {
        pos = -1;
        break;
      }
    }
    ull curm = cur;
    if (pos == 1 && m >= curm) {
      c = m / cur;
      m = m - c * cur;
    } else if (pos == -1) {
      m = m + c * cur;
      c = 0;
    }
    // cout << m << " " << c << endl;
  }
  cout << m;
}


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

using namespace std;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int k;
    string s;
    cin >> s >> k;

    for(int i = 0; i < k && i < s.size(); ++i){
        if(s[i] != '1'){
             cout << s[i] << "\n";
             return 0;
        }
    }
    cout << s[k - 1] << "\n";
     
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
//#include<vector>

int main(){
	int a, b, c, d, ta, ao;
	std::cin>>a>>b>>c>>d;

	if (c%b != 0) {
		ta = c / b + 1;
	}
	else {
		ta = c / b;
	}

	if (a%d != 0) {
		ao = a / d + 1;
	}
	else {
		ao = a / d;
	}

	if (ta <= ao) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}


	
	return 0;
}

Measured memory_bytes: 3620
n = int(input())
nums = [int(i) for i in input().split()]
dp = [[0 for j in range(21)] for i in range(n - 1)]

dp[0][nums[0]] = 1
for i in range(0, n - 2):
    for j in range(0, 21):
        if j + nums[i + 1] <= 20:
            dp[i + 1][j + nums[i + 1]] += dp[i][j]
        if j - nums[i + 1] >= 0:
            dp[i + 1][j - nums[i + 1]] += dp[i][j]

print(dp[n - 2][nums[n - 1]])



Measured memory_bytes: 5600
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    int n,k,c=0,ans=0;
    cin >> n >> k;
    vector<int>a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    if(k==n){
        cout << 1;
        return 0;
    }
    while(1){
        c+=k;
        ans++;
        if(c>=n){
            break;
        }
        c-=1;
    }
    cout << ans;
}

Measured memory_bytes: 640
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
np = [i for i in range(1, n+1)]

import itertools

all_list = list(itertools.permutations(np))

cnt=0
a, b = 0, 0
for seq in all_list:
  cnt += 1
  if list(seq) == p:
    a = cnt
  if list(seq) == q:
    b = cnt

print(abs(a-b))


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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    if (S[0] == S[1] && S[1] == S[2]) {
        cout << NO << endl;
    } else {
        cout << YES << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
//BISMILLAH
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char str[3];
    int flag=0;
    scanf("%s",str);
    for(int i=0;i<strlen(str);i++)
    {
        if(str[i]=='7')
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
        cout<< "Yes"<<endl;
    else
        cout<< "No"<<endl;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N,X,D; cin>>N>>X>>D;
    if(D==0){
        if(X==0) cout<< 1 <<"\n";
        else cout<< N+1 <<"\n";
        return;
    }
    if(D<0){
        D=-D;
        X=-X;
    }
    map<ll,vector<P>> mp;
    rep(k,N+1){
        ll kxmodd=( (k*X)%D>=0 ? (k*X)%D : (-(k*X)%D)+D );
        ll kxmodsho=( X<0 ? (k*X)/D -1 : (k*X)/D );
        ll left=kxmodsho+(k*(k-1))/2;
        ll right=kxmodsho+((2*N-k-1)*k)/2;
        mp[kxmodd].emplace_back(left,right);
    }
    ll ans=0;
    for(auto x: mp){
        auto pev=x.second;
        SORT(pev);
        ll right=-INF2;
        for(auto pe: pev){
            ll le=pe.first;
            ll ri=pe.second;
            if(ri<=right) continue;
            if(le>right){
                ans+=ri-le+1;
            }
            else{
                ans+=ri-right;
            }
            right=ri;
        }
    }
    cout<< ans <<"\n";
}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 22144
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
 
    int n = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();

    int[] problems = new int[n];
    for(int i = 0; i < n; i++){
      problems[i] = sc.nextInt();
    }


    int count1 = 0;
    int count2 = 0;
    int count3 = 0;

    for(int i = 0; i < n; i++){
      if(problems[i] <= a){
        count1++;
      }else if(problems[i] > b){
        count3++;
      }else{
        count2++;
      }
    }
 
    System.out.println(Math.min(count1, Math.min(count2, count3)));

  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

Measured memory_bytes: 22612
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 10000000007; //10^9+7

int h,w;
int a[202][202];
int n=10;

int cost[210][210];//cost[i][j],(i,j)へのコスト
ll d[210];//d[i][j],(i,j)までにかかる最小コスト
bool used[210];//used[i],iを使ったかどうか

void warshall_floyd(){
  REP(k,n){
    REP(i,n){
      REP(j,n){
        cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
      }
    }
  }
}

int main(){
  cin>>h>>w;
  REP(i,10)REP(j,10){
    cin>>cost[i][j];
  }
  
  //REP(i,10){REP(j,10)cout<<cost[i][j];cout<<endl;}///
  //REP(i,h){REP(j,w)cout<<a[i][j];cout<<endl;}///
  //U();///
  warshall_floyd();
  //REP(i,10){REP(j,10)cout<<cost[i][j];cout<<endl;}///
  ll ans=0;
  REP(i,h)REP(j,w){
    cin>>a[i][j];
    if(a[i][j]==-1||a[i][j]==1)continue;
    ans+=cost[a[i][j]][1];
    //print(cost[1][a[i][j]+1]<<" "<<ans);///
  }
  print(ans);
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int M = scan.nextInt();
        Condition[] condition_list = new Condition[M];
        for (int i = 0; i < M; i++) {
            int k = scan.nextInt();
            Condition condition = new Condition();
            for (int j = 0; j < k; j++) {
                condition.add(scan.nextInt());
            }
            condition_list[i] = condition;
        }
        for (int i = 0; i < M; i++) {
            condition_list[i].setP(scan.nextInt());
        }
        int max = (int) Math.pow(2, N);
        int answer = 0;
        for (int i = 0; i < max; i++) {
            HashSet<Integer> on_switches = this.on_switches(i);
            boolean all_ok = true;
            for (int j = 0; j < M; j++) {
                if (!condition_list[j].is_on(on_switches)) {
                    all_ok = false;
                    break;
                }
            }
            if (all_ok) {
                answer += 1;
            }
        }
        System.out.println(answer);
    }
    private HashSet<Integer> on_switches(int current) {
        int index = 1;
        HashSet<Integer> on_switches = new HashSet<>();
        while(0 < current) {
            if (current % 2 == 1) {
                on_switches.add(index);
            }
            current /= 2;
            index += 1;
        }
        return on_switches;
    }
    class Condition {
        int p;
        HashSet<Integer> target_switches = new HashSet<>();
        void add(int target) {
            target_switches.add(target);
        }
        void setP(int p) {
            this.p = p;
        }
        boolean is_on(HashSet<Integer> on_switches) {
            int count = 0;
            for(int i : on_switches) {
                if (target_switches.contains(i)) {
                    count += 1;
                }
            }
            return this.p == count % 2;
        }
    }
}


Measured memory_bytes: 23892
#include <stdio.h>
#define N 101
#define WHITE 1
#define GRAY 2
#define BLACK 3

int n,d[N],f[N],time,S[N],G[N][N];

void DFS(void);
void DFSvisit(int);

int main(){
  int i,j,u,v,k;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      G[i][j]=0;
    }
  }
  
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      G[u-1][v-1]=1;
    }
  }

  DFS();

  for(i=0;i<n;i++){
    printf("%d %d %d\n",i+1,d[i],f[i]);
  }

  return 0;
}

void DFS(void){
  int i;
  
  for(i=0;i<n;i++){
    S[i]=WHITE;
  }
  time=0;
  for(i=0;i<n;i++){
    if(S[i]==WHITE){
      DFSvisit(i);
    }
  }
}

void DFSvisit(int u){
  int i;

  S[u]=GRAY;
  d[u]=++time;

  for(i=0;i<n;i++){
    if(G[u][i]==1 && S[i]==WHITE){
      DFSvisit(i);
    }
  }

  S[u]=BLACK;
  f[u]=++time;
}

Measured memory_bytes: 636
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

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


int main(){
    string s;cin>>s;
    int n = s.size();
    ll cnt = 0;
    rep(i,n-1){
        if(s[i]!=s[i+1])cnt++;
    }
    cout<<cnt;
}



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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using vpint = vector<pint>;
using vpll = vector<pll>;
using sint = set<int32_t>;
using sstr = set<string>;
using qint = queue<int32_t>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n;
    cin >> n;
    int cn = n;
    int sum = 0;
    while (n != 0)
    {
        sum += n % 10;
        n /= 10;
    }
    if (cn % sum == 0)
        Yes;
    else
        No;
}

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


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

bool ball(int left, int right, int i, vector<int> &stack) {
    if (i == 10)
        return true;

    if (stack[i] > left)
        return ball(stack[i], right, i + 1, stack);

    if (stack[i] > right)
        return ball(left, stack[i], i + 1, stack);

    return false;
}

int main()
{
    int n;
    cin >> n;
    vector<int> stack(10);

    while (n--) {
        for (int i = 0; i < 10; i++)
            cin >> stack[i];
        cout << (ball(0, 0, 0, stack) ? "YES" : "NO") << endl;
    }

    return 0;
}

Measured memory_bytes: 1184
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

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

  vector<ll> a(n);

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

  if (a[0] != 0) {
    cout << -1 << endl;
    return 0;
  }

  ll ans = 0;

  for (int i = 1; i < n; i++) {
    if (a[i] > a[i-1]+1) {
      cout << -1 << endl;
      return 0;
    } else {
      if (a[i] == a[i-1]+1) {
        ans++;
      } else {
        ans += a[i];
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
//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 <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())


//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

	vector<LL> a(n);
	vector<LL> b(n);

	LL suma = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		suma += a[i];
	}

	LL sumb = 0;
	for (int i = 0; i < n; i++) {
		cin >> b[i];
		sumb += b[i];
	}

	if (sumb > suma) {
		cout << "-1" << endl;
		return 0;
	}

	vector<LL> plus;

	LL minus = 0;
	LL cnt = 0;

	for (int i = 0; i < n; i++) {
		LL diff = b[i] - a[i];

		if (diff > 0) {
			minus += diff;
			cnt++;
		}
		else if(diff<0){
			plus.push_back(abs(diff));
		}
	}

	sort(plus.begin(), plus.end(), greater<LL>());

	for (auto i : plus) {
		if (minus > 0) {
			minus -= i;
			cnt++;
		}
		else {
			cout << cnt << endl;
			return 0;
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 2428
#include<bits/stdc++.h>
using namespace std;
char maze[25][25];
int row,col;
int run(pair<int,int> root)
{
	queue<pair<int,int> > que;
	map<pair<int,int>,int> dis;
	map<pair<int,int>,bool> vis;
	que.push(root);
	dis[root]=0;
	vis[root]=true;
	int ans=-1;
	while(!que.empty())
	{
		int x=que.front().first,y=que.front().second;
		int u=dis[que.front()];
		que.pop();
		if(x>=2&&maze[x-1][y]=='.'&&!vis[make_pair(x-1,y)])
		{
			pair<int,int> tmp=make_pair(x-1,y);
			vis[tmp]=true;
			dis[tmp]=u+1;
			que.push(tmp);
			ans=max(ans,dis[tmp]);
		}
		if(x<row&&maze[x+1][y]=='.'&&!vis[make_pair(x+1,y)])
		{
			pair<int,int> tmp=make_pair(x+1,y);
			vis[tmp]=true;
			dis[tmp]=u+1;
			que.push(tmp);
			ans=max(ans,dis[tmp]);
		}
		if(y>=2&&maze[x][y-1]=='.'&&!vis[make_pair(x,y-1)])
		{
			pair<int,int> tmp=make_pair(x,y-1);
			vis[tmp]=true;
			dis[tmp]=u+1;
			que.push(tmp);
			ans=max(ans,dis[tmp]);
		}
		if(y<col&&maze[x][y+1]=='.'&&!vis[make_pair(x,y+1)])
		{
			pair<int,int> tmp=make_pair(x,y+1);
			vis[tmp]=true;
			dis[tmp]=u+1;
			que.push(tmp);
			ans=max(ans,dis[tmp]);
		}
	}
	return ans;
}
void fl()
{
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
int main()
{
//    fl();
	scanf("%d%d",&row,&col);
	for(int i=1;i<=row;i++)
		for(int j=0;j<=col;j++)
			scanf("%c",&maze[i][j]);
	int ans=-1;
	for(int i=1;i<=row;i++)
		for(int j=1;j<=col;j++)
			if(maze[i][j]=='.')
				ans=max(ans,run(make_pair(i,j)));
	printf("%d\n",ans);
	return 0;
}


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

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

using namespace std;

using ll = long long;
using P = pair<int , int>;
  
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n; cin >> n;
  n %=10;

  if(n == 3) {
    cout << "bon";
  } else if(n == 0 || n == 1 || n == 6 || n == 8) {
    cout << "pon";
  } else {
    cout << "hon";
  }
}


Measured memory_bytes: 3656
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const ll LL_INF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

struct Edge{
  int to, cost;
};
int dist[10][10];
  

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int H, W;
  cin >> H >> W;
  REP(i,10){
    REP(j,10){
      int c;
      cin >> c;
      if(c == 0) dist[i][j] = INF;
      else dist[i][j] = c;
    }
  }
  int ans = 0;
  REP(k,10){
    REP(i,10){
      REP(j,10){
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }
  REP(i,H){
    REP(j,W){
      int a;
      cin >> a;
      if(a == -1 or a == 1) continue;
      ans += dist[a][1];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
    using namespace std;
    int main(){
    	map<string,int> mp;
      	string a,b;
      cin>>a>>b;
      int c,d;
      cin>>c>>d;
      mp[a]=c;
      mp[b]=d;
      string u;
      cin>>u;
      mp[u]--;
      cout<<mp[a]<<" "<<mp[b]<<endl;
      return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;
const int MAXN = 200000 + 10;
const int MOD = 1e9 + 7;

int n;

int C[MAXN], pre[MAXN];
long long f[MAXN];

inline int read(){
	int x = 0;
	char ch = getchar();
	
	while(ch < '0' || ch > '9')
		ch = getchar();
	
	while('0' <= ch && ch <= '9'){
		x = x*10 + ch - '0';
		ch = getchar();
	}
	
	return x;
}

int main(){
	n = read();
	
	for(register int i=1; i<=n; i++)
		C[i] = read();
	
	f[0] = 1;
	
	for(register int i=1; i<=2e5; i++){
		pre[i] = 2e5 + 1;
	}
	
	for(register int i=1; i<=n; i++){
		if(C[i] ==C[i-1])
			f[i] = f[i-1];
		else
			f[i] = (f[i-1] + f[pre[C[i]]]) % MOD;
		pre[C[i]] = i;
	}
	
	printf("%lld", f[n]);

	return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int a,s,d[200002],f,g,h,j,k,l,i,n,m;
multiset<int> s1,s2;
vector<int> v;
main(){
    cin>>n;
    v.push_back(-1);
    for(i=0;i<n;i++){
        scanf("%d",&a);
        v.push_back(a);
        d[i]=a;//cout<<d[i]<<"^";
    }

    sort(v.begin(),v.end());
    l=v[n/2];k=v[n/2+1];
    for(i=0;i<n;i++){
        if(d[i]<=l) printf("%d\n",k); else printf("%d\n",l);
    }
}


Measured memory_bytes: 3828
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		// Nの入力
		double N = sc.nextDouble();
		
		// 奇数の数
		double odd = Math.ceil(N/2);
		double probability = odd / N;
		
		// 結果の出力
		System.out.println(probability);
		
		sc.close();
	}

}


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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    string s;
    cin >> s;
    cout << count(s.begin(), s.end(), '2') << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define per(i,n) for (int i = n - 1; i >= 0; --i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline T intceil(T a, T b) { return (a + (b - 1)) / b; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const long long MOD = 1e9+7;
#define precout() cout << std::fixed << std::setprecision(20);
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const int dy[4] = { 0, 1, 0, -1 };
const int dx[4] = { 1, 0, -1, 0 };
static const long double pi = acos(-1.0);
typedef complex<ld> cd;

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

  int n; cin >> n;
  vector<int> cnt(13);
  rep(i, n) {
    int a; cin >> a;
    ++cnt[a];
  }
  ++cnt[0];

  if(cnt[0] >= 2) {
    cout << 0 << endl;
    return 0;
  }

  rep1(i, 12) {
    if(cnt[i] >= 3) {
      cout << 0 << endl;
      return 0;
    }
  }

  int ans = 0;
	for(int mask = 0; mask < (1 << 13); ++mask) {
    vector<int> times;
    times.push_back(0);
    times.push_back(24);
    rep1(i, 12) {
      if(cnt[i] == 0) continue;
      else if(cnt[i] == 2) {
        times.push_back(i);
        times.push_back(24 - i);
      } else {
        if(mask & (1 << i)) {
          times.push_back(i);
        } else {
          times.push_back(24 - i);
        }
      }
    }

    sort(times.begin(), times.end());
    int minv = 1e9;
    rep1(j, times.size() - 1) {
      chmin(minv, times[j] - times[j - 1]);
    }
    chmax(ans, minv);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
if N == 1 or N == 2:
    print(1)
    exit()
else:
    ans = 1
    if A[1] - A[0] > 0:
        inc = 1
    elif A[1] - A[0] == 0:
        inc = 0
    else:
        inc = -1
    for i in range(2, N):
        if inc == 1:
            if A[i] - A[i - 1] >= 0:
                pass
            else:
                ans += 1
                inc = 0
        elif inc == 0:
            if A[i] - A[i - 1] > 0:
                inc = 1
            elif A[i] - A[i - 1] == 0:
                inc = 0
            else:
                inc = -1
        else:
            if A[i] - A[i - 1] <= 0:
                pass
            else:
                ans += 1
                inc = 0
print(ans)


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N, A, B;
	cin >> N >> A >> B;
	int ans = 0;
	rep(i, 1, N + 1)
	{
		int res = 0;
		int ti = i;
		rep(j, 0, 5)
		{
			res += ti % 10;
			ti /= 10;
		}
		if (A <= res && res <= B)
		{
			ans += i;
		}
	}
	
	cout << ans << endl;

	return 0;
}

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

vector<string> v;
bool ngchars[256];

bool check(int y, int x, int Y, int X, char C) {
	bool out;
	bool in;
	Y++; X++;
	for(int i = y; i < Y; i++) {
		for(int j = x; j < X; j++) {
			if(ngchars[v[i][j]]) {
				return false;
			}
		}
	}
	return true;
}

int main() {
	int n;
	cin >> n;
	for(int iter = 0; iter < n; iter++) {
		int w, h;
		vector<char> cs;
		cin >> h >> w;
		v.clear();
		v.resize(h);
		for(int i = 0; i < h; i++)
			cin >> v[i];
		for(int i = 0; i < 256; i++)
			ngchars[i] = false;
		for(int i = 0; i < v.size(); i++) {
			for(int j = 0; j < v[i].size(); j++) {
				if(v[i][j] != '.') {
					cs.push_back(v[i][j]);
				}
			}
		}
		int x[30], y[30], X[30], Y[30];
		for(int i = 0; i < 30; i++) {
			x[i] = y[i] = 100;
			X[i] = Y[i] = -1;
		}
		for(int i = 0; i < v.size(); i++) {
			for(int j = 0; j < v[i].size(); j++) {
				if(v[i][j] == '.') continue;
				int c;
				c = v[i][j] - 'A';
				x[c] = min(x[c], j);
				X[c] = max(X[c], j);
				y[c] = min(y[c], i);
				Y[c] = max(Y[c], i);
			}
		}

		bool res = false;
		sort(cs.begin(), cs.end());
		cs.erase(unique(cs.begin(), cs.end()), cs.end());
		do {
			for(int i = 0; i < cs.size(); i++)
				ngchars[cs[i]] = true;
			ngchars['.'] = true;
			bool f = true;
			for(int i = 0; i < cs.size(); i++) {
				ngchars[cs[i]] = false;
				int c = cs[i] - 'A';
				if(!check(y[c],x[c],Y[c],X[c],'A'+c)) {
					f = false;
				}
			}
			if(f)
				res = true;
		} while(next_permutation(cs.begin(), cs.end()));
		if(res)
			cout << "SAFE" << endl;
		else
			cout << "SUSPICIOUS" << endl;
	}
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007

using namespace std;

vector<ll> adjlist[100002];
ll dp[100001][2];

//0- white , 1 - black

ll recurse(ll curr_node , ll p_node,int curr_color)
{
    if(adjlist[curr_node].size() == 1)
    {
        return dp[curr_node][curr_color]  = 1;
    }
    else
    {
        if(dp[curr_node][curr_color] != -1) return dp[curr_node][curr_color];
        else
        {
            ll ans = 1;
            for (ll i = 0; i < adjlist[curr_node].size(); i++)
            {
                if(adjlist[curr_node][i] != p_node)
                {
                    if(curr_color == 0) ans = (ans * (recurse(adjlist[curr_node][i],curr_node,0)%mod + recurse(adjlist[curr_node][i],curr_node,1) %mod) % mod)%mod;
                    else ans = ans * (recurse(adjlist[curr_node][i],curr_node,0)%mod)%mod;
                }
            }
            return dp[curr_node][curr_color] = ans %mod;
        }
        
    }
         
}

int main(int argc, char const *argv[])
{
    ll n , v1 , v2;
    cin >> n;
    for (ll i = 0; i < n-1; i++)
    {
        scanf("%lld %lld",&v1,&v2);
        adjlist[v1].push_back(v2);
        adjlist[v2].push_back(v1);
    }

    for (ll i = 0 ; i <= 100000 ; i++) for (int j = 0 ; j <2 ;j++) dp[i][j] = -1;

    //dp[i][j] denotes the number of ways i can color subtree rooted at i with color j;

    ll ans = 1;
    for(ll i =0 ; i < adjlist[1].size() ; i++) ans = ans*(recurse(adjlist[1][i],1,0)%mod)%mod;
    dp[1][1] = ans%mod;
    ans = 1;
    for(ll i =0 ; i < adjlist[1].size() ; i++) ans = (ans*(recurse(adjlist[1][i],1,0)%mod + recurse(adjlist[1][i],1,1) %mod) % mod)%mod;
    dp[1][0] = ans %mod; 

    // for (ll i = 0; i <=n; i++)    {
    //     for (int j = 0; j < 2; j++)
    //     {
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    cout << (dp[1][1]%mod + dp[1][0]%mod) %mod;
    return 0;
}



Measured memory_bytes: 19104
#include <iostream>

using namespace std;

int main() {

	long long int X;
	cin >> X;

	long long int i = 0;
	long long int x = 100;

	while (true)
	{
		if (X <= x) {
			break;
		}
			x *= 1.01;
		i++;
	}

	cout << i << endl;

	return 0;
}

Measured memory_bytes: 3636