akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
using namespace std;
int main()
{
    long long a ,b ,k ,i ;
    scanf("%lld %lld %lld",&a,&b,&k) ;
    if (a + k <= b - k + 1){
        for (i = a ; i < a + k ; ++ i)
            printf("%lld\n",i);
        for (i = b - k + 1 ; i <= b ; ++ i)
            printf("%lld\n",i) ;
        return 0 ;
    }
    for (i = a ; i <= b ; ++ i)
        printf("%lld\n",i) ;
    return 0;
}


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

int main() {
  
  int n;
  cin >> n;
  vector<int> vec(n);
  int total = 0;
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    vec.at(i) = x;
  }
  
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      total += vec.at(i) * vec.at(j);
    }
  }
  
  cout << total << endl;
  
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int mod = 1000000007;

vector<vector<P>> g(100005);
vector<int> ans;
 
void dfs(int a, int d = -1, int p = -1) {
	int tmp = 1;
	for (auto& c : g[a]) {
		int land = c.first, bridge = c.second;
		if (land == p) continue;
		if (tmp == d) tmp++;
		ans[bridge] = tmp;
		tmp++;
		dfs(land, ans[bridge], a);
	}
}

int main() {
	int n;
	cin >> n;
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		g[a].emplace_back(P(b, i));
		g[b].emplace_back(P(a, i));
	}
	ans.resize(n - 1, -1);
	int j_ans = 0;
	rep(i, n) j_ans = max(j_ans, int(g[i].size()));
	dfs(0);
	cout << j_ans << endl;
	rep(i, n - 1) cout << ans[i] << endl;
	return 0;
}


Measured memory_bytes: 9344
#include <iostream>
#include <string>
#include<algorithm>
using namespace std;
int main(){
 int a;
 cin>>a;
 if(a<105)cout<<0<<endl;
 else if(a<135)cout<<1<<endl;
 else if(a<165)cout<<2<<endl;
 else if(a<189)cout<<3<<endl;
 else if(a<195)cout<<4<<endl;
 else cout<<5<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        
        int a = scanner.nextInt();
        String str = scanner.next();
        int valLen = str.length(); 
        if(valLen == a){
            System.out.println(str);
        }else if(valLen < a){
            System.out.println(str);
        }else{
            String i = str.substring(0,a);
            System.out.println(i + "...");
        }
    }
}

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

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)



int n,m;
int a[100001] = {0};
map<int,ll>  mp;

ll ans = 0;

int main(){
  cin >> n >> m;
  mp[0] = 1;
  FOR(i,1,n+1){
    cin >> a[i];
    a[i] += a[i-1];
    a[i] %= m;
    if(mp.find(a[i]) == mp.end()) mp[a[i]] = 1;
    else mp[a[i]]++;
  }
  for(auto i = mp.begin();i!=mp.end();++i){
    ans += (i->second-1)*(i->second)/2;
  }
  cout << ans <<endl;
}


Measured memory_bytes: 4608
#include <stdio.h>
int main(void)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if(a < b && b < c)
	{
		printf("Yes\n");
	}
	else  
	{
		printf("No\n");
	}
	return 0;
}



Measured memory_bytes: 2092
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll a[3*n];
    multiset<ll> ms;
    multiset<ll> ::iterator itr;
    ll sum1[n+1],sum2[n+1];
    memset(sum1,0,sizeof(sum1));
    memset(sum2,0,sizeof(sum2));
    for(int i=0;i<3*n;i++){
        cin>>a[i];
        if(i<n){
            ms.insert(a[i]);
            sum1[0]+=a[i];
        }
    }
    ll ans=-1e18;
    for(int i=n;i<2*n;i++){
        ms.insert(a[i]);
        sum1[i-n+1]+=sum1[i-n];
        sum1[i-n+1]+=a[i];
        itr=ms.begin();
        sum1[i-n+1]-=*itr;
        ms.erase(itr);
    }
    ms.clear();
    for(int i=2*n;i<3*n;i++){
    	ms.insert(a[i]);
    	sum2[n]+=a[i];
    }
    for(int i=2*n-1;i>=n;i--){
    	ms.insert(a[i]);
    	sum2[i-n]+=sum2[i-n+1];
    	sum2[i-n]+=a[i];
    	itr=ms.end();
    	itr--;
    	sum2[i-n]-=*itr;
    	ms.erase(itr);
    }
    for(int i=0;i<=n;i++){
    	ans=max(ans,sum1[i]-sum2[i]);
    }
    cout << ans<<endl;
    return 0;
}


Measured memory_bytes: 8832
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 510000;
const int MOD = 1000000007;
//


        signed main() {
            int n,a,b;
            cin>>n>>a>>b;
            cout<<a*(n/(a+b))+min(a,n%(a+b));

        
        
        


      }


        


Measured memory_bytes: 256
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  int n;
  std::cin >> n;

  ll a[100];
  a[0]=2; a[1]=1;

  for(int i=2; i<=86; i++){
    a[i]=a[i-1]+a[i-2];
  }

  std::cout << a[n] << '\n';
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
x1, x2, x3, x4, x5 = map(int, input().split())

if x1 == 0:
    print(1)
elif x2 == 0:
    print(2)
elif x3 == 0:
    print(3)
elif x4 == 0:
    print(4)
elif x5 == 0:
    print(5)
    

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

int main(){
	char b;
	cin >> b;
	if(b == 'A'){
		cout << 'T' << endl;
	}else if(b == 'C'){
		cout << 'G' << endl;
	}else if(b == 'G'){
		cout << 'C' << endl;
	}else{
		cout << 'A' << endl;
	}
	return 0;
}


Measured memory_bytes: 3008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI = acos(-1);
const ll MOD = 1000000007;

int main() {
  int N, M; cin >> N >> M;
  vector<int> a(M),b(M);
  for (int i = 0; i < M; i++) cin >> a[i] >> b[i];
  set<int> s;
  
  for (int i = 0; i < M; i++) {
    if (a[i] == 1) s.insert(b[i]);
  }
  
  bool can = false;
  for (int i = 0; i < M; i++) {
    if (b[i] == N) {
      if (s.count(a[i])) {
        can = true;
        break;
      }
    }
  }
  
  if (can) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;     
}

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

int main(){

	int n = 0;
	string s;
	cin>>s;
	int length = 4;

	for(int i=0; i<length; i++){
		if(s[i]=='+'){
			n++;
		}
		else{
			n--;
		}
	}

	cout<<n<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    vector<int> a(n+1);
    string ans="";
    REP(i,n)cin>>a[i+1];
    if(n%2==0){
        for(int i=n;i>1;i-=2) cout<<a[i]<<" ";
        for(int i=1;i<n;i+=2) cout<<a[i]<<" ";
    }
    else{
        for(int i=n;i>0;i-=2) cout<<a[i]<<" ";
        for(int i=2;i<n;i+=2) cout<<a[i]<<" ";
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2944
s=int(input())
number=[s]
for i in range(1,1000001):
    if number[i-1]%2==0:
        next=number[i-1]//2
    else:
        next=number[i-1]*3+1
    if next in number:
        print(i+1)
        break
    else:
        number.append(next)



Measured memory_bytes: 38384
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }

int main() {
   string S;
   cin >> S;
   int cnt = 0;
   for (int i = 0; i < (int)S.size(); i++) {
      if (S[i] == 'o') cnt++;
   }
   if (cnt + 15 - (int)S.size() >= 8) cout << "YES" << endl;
   else cout << "NO" << endl;

   return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 2000000

int A[N], B[N], C[10001];

void counting_sort(int k, int n){
  int i;
  for(i=0;i<=k;i++) C[i] = 0;
  for(i=0;i<n;i++) C[A[i]]++;
  for(i=1;i<=k;i++) C[i] += C[i-1];
  for(i=n-1;i>=0;i--){
    B[C[A[i]]-1] = A[i];
    C[A[i]]--;
  }
}

main(){
  int n, k = 0, i;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%d", &A[i]);
    if(k < A[i]) k = A[i];
  }
  counting_sort(k, n);
  printf("%d", B[0]);
  for(i=1;i<n;i++) printf(" %d", B[i]);
  printf("\n");
  return 0;
}



Measured memory_bytes: 17372
#include<bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
#define pll pair<lld,lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define mod 1000000007
#define answer(x) cout<<endl<<"answer : "<<x<<endl<<endl;
#define op(x) cout<<x<<endl;
#define maxn 100005
#define messi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {messi lld t=1;//cin>>t;
    while(t--)
    {
        lld n=0,m=0,k=0,i=0,j=0,p=0,q=0,x=0,y=0,z=0,ans=0,cnt=0,l=0,r=0,mid=0,lo=0,hi=0;string s;bool flag=false;
        cin>>n; lld a[n]; for(i=0;i<n;i++) cin>>a[i];
        for(i=0;i<n;i++)
        {
            for(j=i+1;j<n;j++)
            {
                for(k=j+1;k<n;k++)
                {
                    if(((a[i]+a[j])>a[k]) && ((a[i]+a[k])>a[j]) && ((a[j]+a[k])>a[i]) && a[i]!=a[j] && a[j]!=a[k] && a[k]!=a[i])
                        cnt++;
                }
            }
        }
        cout<<cnt<<endl;

    }
	return 0;
}
/*  CODED BY:-
 ________________________________________
|            __        __                |
|  /\   /\  |__)  /\  |  \ |__| \ /  /\  |
| /~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\ |
|________________________________________|

*/


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

using namespace std;

#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()

const long long MOD = (int) 1e9 + 7;

long long binPow(long long a, long long b) {
    if (b == 0)
        return 1;

    long long ans = binPow(a, b / 2);
    ans = ans * ans % MOD;

    if (b % 2)
        ans = ans * a % MOD;

    return ans;
}

vector<vector<pair<int, int> > > a;
vector<int> ans;

void go(int v, int pr = -1, int c = -1) {
    int t = 0;
    for (auto i : a[v]) {
        if (i.first == pr)
            continue;

        if (t == c)
            ++t;

        ans[i.second] = t;
        go(i.first, v, t);
        ++t;
    }
}

int main() {
//    freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;

    a.resize(n);
    for (int i = 1; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        --x;
        --y;

        a[x].push_back({y, i - 1});
        a[y].push_back({x, i - 1});
    }

    ans.resize(n - 1);
    go(0);

    int mx = 0;
    for (auto i : ans)
        mx = max(mx, i + 1);

    cout << mx << "\n";
    for (int i : ans)
        cout << i + 1 << "\n";
}


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

const int MAX = 110000;
const int MOD = 1000000007;

long long 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() {
    // 前処理
    COMinit();

  ll N,K;
  cin >> N >> K;
  vector<ll> A(N);
  REP(i,N) cin >> A[i];
  sort(A.begin(), A.end());
  // MIN/MAX合計
  ll minsum = 0;
  ll maxsum = 0;
  REP(i,N-K+1) {
    ll combi = COM( N-1-i, K-1 ) % MOD;
    minsum += A[i] * combi % MOD;
    maxsum += A[N-1-i] * combi % MOD;
  }
  cout << ((maxsum + MOD) - minsum) %MOD << endl;
}


Measured memory_bytes: 3584
#!/usr/bin/env python3
# CGL_7_H: Circles - Intersection of a Circle and a Polygon

from math import acos, hypot, isclose, sqrt


def intersection(circle, polygon):
    x, y, r = circle
    area = 0.0

    for p1, p2 in zip(polygon, polygon[1:]+[polygon[0]]):
        ps = seg_intersection(circle, (p1, p2))
        for pp1, pp2 in zip([p1] + ps, ps + [p2]):
            c = cross(pp1, pp2)
            if c == 0:
                continue
            d1 = hypot(*pp1)
            d2 = hypot(*pp2)
            if le(d1, r) and le(d2, r):
                area += c / 2
            else:
                t = acos(dot(pp1, pp2) / (d1 * d2))
                sign = c // abs(c)
                area += sign * r * r * t / 2

    return area


def cross(v1, v2):
    x1, y1 = v1
    x2, y2 = v2
    return x1*y2 - x2*y1


def dot(v1, v2):
    x1, y1 = v1
    x2, y2 = v2
    return x1*x2 + y1*y2


def seg_intersection(circle, seg):
    x0, y0, r = circle
    p1, p2 = seg
    x1, y1 = p1
    x2, y2 = p2

    p1p2 = (x2-x1)**2 + (y2-y1)**2
    op1 = (x1-x0)**2 + (y1-y0)**2
    rr = r*r
    dp = dot((x1-x0, y1-y0), (x2-x1, y2-y1))

    d = dp*dp - p1p2*(op1 - rr)
    ps = []

    if isclose(d, 0.0, abs_tol=1e-9):
        t = -dp / p1p2
        if ge(t, 0.0) and le(t, 1.0):
            ps.append((x1 + t*(x2-x1), y1 + t*(y2-y1)))
    elif d > 0.0:
        t1 = (-dp-sqrt(d)) / p1p2
        if ge(t1, 0.0) and le(t1, 1.0):
            ps.append((x1 + t1*(x2-x1), y1 + t1*(y2-y1)))
        t2 = (-dp+sqrt(d)) / p1p2
        if ge(t2, 0.0) and le(t2, 1.0):
            ps.append((x1 + t2*(x2-x1), y1 + t2*(y2-y1)))

    # assert all(isclose(r, hypot(x, y)) for x, y in ps)
    return ps


def le(f1, f2):
    return f1 < f2 or isclose(f1, f2, abs_tol=1e-9)


def ge(f1, f2):
    return f1 > f2 or isclose(f1, f2, abs_tol=1e-9)


def eliminate_minus_zero(f):
    if isclose(f, 0.0, abs_tol=1e-9):
        return 0.0
    else:
        return f


def run():
    n, r = [int(i) for i in input().split()]
    ps = []

    for _ in range(n):
        x, y = [int(i) for i in input().split()]
        ps.append((x, y))

    print("{:.10f}".format(eliminate_minus_zero(intersection((0, 0, r), ps))))


if __name__ == '__main__':
    run()



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

int	main()
{
	int	K, N;
	int	A, prev_A, A_0, max_diff = -1, diff;
	cin >> K >> N;
	cin >> A;
	prev_A = A_0 = A;
	for (int i = 1; i < N; ++i) {
		cin >> A;
		diff = A - prev_A;
		if (max_diff < diff)
			max_diff = diff;
		prev_A = A;
	}
	diff = K + A_0 - prev_A;
	if (max_diff < diff)
		max_diff = diff;
	cout << K - max_diff << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main( void )
{
	int i, j, k, n, x, cnt;
	
	while( 1 ){
		scanf("%d %d", &n, &x);
		if( !n && !x ) break;
		
		cnt = 0;
		
		for(i = 1; i <= n; i++){
			for(j = i+1; j <= n; j++){
				for(k = j+1; k <= n; k++){
					if(i+j+k == x) cnt++;
				}
			}
		}
		
		printf("%d\n", cnt);
	}

	return 0;
}

Measured memory_bytes: 600
#include<iostream>
using namespace std;
long long n,a[200100],b[200100],ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=n;i>=1;i--)	
	{
		int h=0;
		for(int o=i+i;o<=n;o+=i)
			if(b[o]==1)
				h++;		
		if(h%2!=a[i])
		{
			b[i]=1;
			ans++;
		}		
	}
	cout<<ans<<endl;
	for(int i=1;i<=n;i++)
		if(b[i]==1)
			cout<<i<<" ";
	cout<<endl;		
} 

Measured memory_bytes: 3968
/* [Template].cpp 
Example code to use when starting new code. This particular problem was problem 
977A_Wrong_Subtraction from CodeForces

Compile: g++  -o A.exe A.cpp 
Execute: ./A
*/ 

#include <cstdio>
#include <iostream>
#include <cmath> 
#include <limits> 
#include <iomanip>
#include <cstring> 
#include <bits/stdc++.h>
#include <string>  
using namespace std;

int main() { 	
	int x; 
	cin >> x; 
	
	cout << 1 - x << endl; 
	
	return 0; 
} 


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (int)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll a, b, c;
    cin >> a >> b >> c;
    if(4*a*b < (c-a-b)*(c-a-b) && c-a-b >= 0) print("Yes");
    else print("No");

    return 0;
}

Measured memory_bytes: 256
if __name__ == "__main__":

    n = int(raw_input())
    v = map( int, raw_input().split())

    min = 1000000
    max = -1000000
    s = 0
    i = 0
    while i < n:
       if min > v[i]:
           min = v[i]
       if max < v[i]:
           max = v[i]
       s += v[i]
       i += 1

    print "{0} {1} {2}".format( min, max, s)

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

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

    if (a + b > c + d)
    {
        cout << "Left" << endl;
    }
    else if (a + b == c + d)
    {
        cout << "Balanced" << endl;
    }
    else
    {
        cout << "Right" << endl;
    }
}

Measured memory_bytes: 256
n = int(input())
s = list(input())

a = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

for i in range(len(s)):
    for j in range(len(a)):
        if s[i] == a[j]:
            s[i] = a[(j + n) % 26]
            break
print(''.join(s))


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll A, B, C; cin >> A >> B >> C;
    ll ans = ((A - B) >= C) ? 0 : C - (A - B);
    cout << ans << endl;
}

int main() {

    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <limits.h>
#include <cstring>
#include <tuple>
#include <cassert>
#include <numeric>
#include <iomanip>
using namespace std;
// type alias
typedef long long LL;
typedef pair< int , int > II;
typedef tuple< int, int, int > III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))

// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');

// debug cerr
#define TRACE true
#define dump(x) if(TRACE) { cerr << #x << " = " << (x) << endl; }
#define dump2(x,y) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << endl; }
#define dump3(x,y,z) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl; }
#define dump4(x,y,z,a) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #a << " = " << (a) << endl; }
#define dumpf(args...) if(TRACE) { fprintf(stderr, ##args); putchar('\n'); }
#define dumpAR(ar) if(TRACE) { FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
template<class Iter> void dumpc(Iter begin, Iter end) { if (TRACE) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; } }

// $ cp-batch Contests | diff Contests.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Contests.cpp && ./a.out

/*
 
 1/17/2019
 
 16:23-
 
 */

const int MAX_N=1e6+1;
int P[MAX_N];
int N,A,B;

void solve() {
  VI cnt(3,0);
  REP(i,N) {
    int p=P[i];
    if(p<=A) cnt[0]++;
    else if(p<=B) cnt[1]++;
    else cnt[2]++;
  }
//  dumpAR(cnt);
  cout<<*min_element(ALL(cnt))<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>A>>B;
  REP(i,N) cin>>P[i];
  solve();
  
  return 0;
}


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

int main() {
	int num1, num2, num3;

	cin >> num1 >> num2 >> num3;

	if (num1 < num2) {
		if (num2 < num3) {
			cout << "Yes\n";
		}
		else {
			cout << "No\n";
		}
	}
	else {
		cout << "No\n";
	}




	return 0;
}

Measured memory_bytes: 3084
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

char buf[210];
int main(void) {
  cin >> buf;
  int len = strlen(buf);
  int res = 0;
  for(int i = 1; i < len/2; ++i) {
    if(strncmp(buf, buf + i, i) == 0) {
      res = i;
    }
  }
  cout << res*2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST_INPUT ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long

using namespace std;

void solve() {
	ll a;
	cin >> a;
	ll res = a + a*a + a*a*a;
	cout << res << endl;
}

int main() {
    FAST_INPUT;

    solve();

    return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>

int main()
{
  int N, num;

  scanf("%d", &N);

  num = N % 10;

  if(num == 3){
    printf("bon\n");
  }
  else if(num == 0 || num == 1 || num == 6 || num == 8){
    printf("pon\n");
  }
  else{
    printf("hon\n");
  }

    return 0;
  }


Measured memory_bytes: 1656
/*
	written by Pankaj Kumar.
	country:-INDIA
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<pair<ll,ll>> vpl;
typedef vector<string> vs;
typedef map<ll,ll> ml;
typedef set<char>sc;
typedef set<ll> sl;
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
// define values.
// #define mod 1000000007
#define phi 1.618
/* Bit-Stuff */
#define get_set_bits(a) (__builtin_popcount(a))
#define get_set_bitsll(a) ( __builtin_popcountll(a))
#define get_trail_zero(a) (__builtin_ctz(a))
#define get_lead_zero(a) (__builtin_clz(a))
#define get_parity(a) (__builtin_parity(a))
/*  Abbrevations  */
#define ff first
#define ss second
#define mp make_pair
#define line cout<<endl;
#define pb push_back
#define Endl "\n"
// loops
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
// Some print
#define no cout<<"NO"<<endl;
#define yes cout<<"YES"<<endl;
#define cc ll test;cin>>test;while(test--)
// sort
#define all(V) (V).begin(),(V).end()
#define srt(V) sort(all(V))
#define srtGreat(V) sort(all(V),greater<ll>())
// function

ll power(ll x,ll y,ll mod)
{
	ll res=1;
	x=x%mod;
	while(y>0)
	{
		if(y%2==1)
		{
			res*=x;
			res=res%mod;
		}
		y/=2; x*=x; x=x%mod;
	}
	return res;
}
/* ascii value 
A=65,Z=90,a=97,z=122
*/
/*  -----------------------------------------------------------------------------------*/

ll solve()
{
	ll n;
	cin>>n;
	if(n<3)
		cout<<0<<endl;
	else if(n==3)
		cout<<1<<endl;
	else
	{
		vector<ll> v(10003,0);
		v[3]=v[4]=v[5]=1;
		v[6]=2;
		for(ll i=7;i<=n;i++)
		{
			v[i]=1;
			for(ll j=3;j+3<=i;j++)
			{
				v[i]+=v[j];
				v[i]%=1000000007LL;
			}
		}
		cout<<v[n]<<endl;
	}
	return 0;
}

int main()
{
	//freopen("input.txt"a, "r", stdin);
	pan;
	solve();
}

Measured memory_bytes: 3752
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

const long long INF = 1e6+7;
const long long MOD = 1e9+7;

using namespace std;

int main(){
	
	long long x,k,d;
	cin >> x >> k >> d;
	long long ans;
	
	if(x<0)x*=-1;
	if(k<0)k*=-1;
	if(d<0)d*=-1;
		
	long long a=x/d;
	
	if(a==k){
		ans=x%d;
	}else if(a<k){
		if((k-a)%2==0){
			ans=min({abs(x%d+2*d),abs(x%d-2*d),abs(x%d)});
		}else{
			ans=min(abs(x%d+d),abs(x%d-d));
		}
	}else if(a>k){
		ans=(a-k)*d+x%d;
	}
	
	if(ans<0)ans*=-1;
	cout << ans << endl;	
	return 0;
}


Measured memory_bytes: 3584
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include <iomanip>
#include <numeric>
#include <math.h>
using namespace std;

int main(void){
    long N;
    cin >> N;
    map<long,long> hen;
    for(long i = 0;i < N; i++){
        long tmp;
        cin >> tmp;
        hen[tmp]++;
    }

    long tate=0, yoko = 0;
    for(auto it = hen.rbegin(); it != hen.rend(); ++it){
        
        if(tate == 0 && it->second >= 4){
            tate = it->first;
            yoko = it->first;
            break;
        }else if(tate == 0 && it->second >= 2){
            tate = it->first;
        }else if(tate != 0 && it->second >= 2){
            yoko = it->first;
            break;
        }
    }

    cout << tate * yoko << endl;

    return 0;
}

Measured memory_bytes: 9740
#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()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    string s;
    ll A[200],k;
    cin>>s>>k;
    int a,b;
    rep(i,s.size()){
        if(s[i]!='1') {a=i,b=s[i]-'0';break;}
    }
    int z=1;
    if(k>100) z=0;
    if(k<=100){
        rep(i,k) if(s[i]!='1') z=0;
    }
    if(z) cout<<1;
    else cout<<b;
}

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

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    int n,W;
    cin>>n>>W;
    
    vector<long long> w(n+1), v(n+1);
    long long maxval = 0;
    
    for(int i = 1; i <= n; i++){
        cin>>w[i]>>v[i];
        maxval += v[i];
    }
    long long INF = 1e18;
    vector<long long> dp(maxval+1,INF);
    dp[0] = 0;
    //dp[i] = minimum weight possible to get exactly i value
    for(int i = 1; i <= n; i++){
        for(int j = maxval-v[i]; j >= 0; j--){
            dp[j+v[i]] = min(dp[j+v[i]], dp[j]+w[i]);
        }
    }
    
    long long ans = 0;
    
    for(int i = 0; i <= maxval; i++){
        if(dp[i] <= W) ans = i;
    }
    
    cout<<ans<<"\n";
    
    return 0;
}


Measured memory_bytes: 3936
#include <iostream>
#include <cstdlib>

using namespace std;
int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(abs(a-c) <= d || (abs(a-b)<=d && abs(b-c) <=d)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
 
int main()
{
  string s;
  cin >> s;
  int l = s.length();
  
  string p[4] = {"dream", "dreamer", "erase", "eraser",};
  bool q[l+10];
  REP(i, l+10) q[i] = false;
  q[0] = true;
  REP(i, l)
  {
    if(q[i])
    {
      REP(j, 4)
      {
        if(s.substr(i, p[j].length()) == p[j])
        {
          q[i + p[j].length()] = true;
        }
      }
    }
  }
  cout << (q[l] ? "YES" : "NO") << endl;
  return 0;
}

Measured memory_bytes: 3836
n, m = map(int, input().split())
inf = 10**8
dp = [-inf] * (m + 1)
dp[0] = 0

for i in range(n):
    w, v = map(int, input().split())
    for j in range(m - w, -1, -1):
        if dp[j] != -inf:
            dp[j + w] = max(dp[j + w], dp[j] + v)
print(max(dp))


Measured memory_bytes: 41708
#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    for(int i=0;i<t;++i){
        int n;
        cin>>n;
        int nh=0,h=0,l=0;
        cin>>nh;
        for(int j=1;j<n;++j){
            int s;
            cin>>s;
            if(s-nh>h)h=s-nh;
            if(nh-s>l)l=nh-s;
            nh=s;
        }
        cout<<h<<" "<<l<<endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
typedef long long ll;
typedef double ld;
#define pll pair<ll,ll>
#define pii pair<int, int>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()

const ll Mod = 1e9 + 7;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int m1 , d1 , m2 , d2;
	cin >> m1 >> d1 >> m2 >> d2;
	if(d2 == 1)
		cout << 1 << endl;
	else
		cout << 0 << endl;


	return 0;
}

















Measured memory_bytes: 256
#include<bits/stdc++.h>
	using namespace std;
	typedef long long ll;
	#define f(i,n) for(ll i=0;i<n;i++)
	#define pb push_back
int mod=1e9+7;
bool vis[100005]={false};
  vector<vector<long long >>dp(100005,vector<long long>(2,1));
  void dfs(vector<int>adj[],int i){
    vis[i]=true;
    for(auto edge:adj[i]){
      if(vis[edge])continue;
      dfs(adj,edge);
      dp[i][0]=(dp[i][0]%mod*(dp[edge][0]%mod+dp[edge][1]%mod+mod)%mod)%mod;
      dp[i][1]=(dp[i][1]%mod*((dp[edge][0]%mod+mod)%mod)%mod);
    }

  }
	int main(){
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
    int n;
    cin>>n;
    // memset(dp,0,sizeof dp);

    vector<int>adj[n];
    for(int i=0;i<n-1;i++){
      int a,b;
      cin>>a>>b;
      a--,b--;
      adj[a].push_back(b);
      adj[b].push_back(a);
    }
    dfs(adj,0);
    cout<<(dp[0][0]%mod+dp[0][1]%mod)%mod;

		return 0;
	}



Measured memory_bytes: 19672
using System;

namespace A
{
    class Node
    {
        public int key=0;
        public int parent;
        public int left=0;
        public int right=0;
    }

    class Max{
        public void maxHeapify(ref Node[] node, int i)
        {
            int left = i*2, right = i*2+1, large=i;
            Node change = new Node();
            if (left < node.Length && node[left].key > node[i].key)
            {
                large = left;
            }
            if (right < node.Length && node[right].key > node[large].key)
            {
                large = right;
            }
            if (large != i)
            {
                change = node[large];
                node[large] = node[i];
                node[i] = change;
                maxHeapify(ref node, large);
            }
        }
    }

    class B
    {
        static void Main(string[] args)
        {
            string input1 = Console.ReadLine();
            int n = int.Parse(input1), i;
            Node[] node = new Node[n + 1];
            string[] input2 = new string[n + 1];
            for (i = 0; i <= n; i++)
            {
                node[i] = new Node();
            }
            input2 = Console.ReadLine().Split(' ');
            for (i = 0; i < n; i++)
            {
                node[i + 1].key = int.Parse(input2[i]);
            }

            for (i = 1; i <= n; i++)
            {
                if (i / 2 > 0)
                {
                    node[i].parent = node[i / 2].key;
                }
                if (i * 2 <= n)
                {
                    node[i].left = i * 2;
                }
                if (i * 2 + 1 <= n)
                {
                    node[i].right = 2 * i + 1;
                }
            }

            Max max = new Max();
            for (i = n / 2; i > 0; i--)
            {
                max.maxHeapify(ref node, i);
            }

            for (i = 1; i <= n; i++)
            {
                Console.Write(" " + node[i].key);
            }
            Console.WriteLine();

        }
    }
}



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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



int main() {
    string s;
    cin >> s;
    map<char, li> cnt;
    for (auto c : s) {
        cnt[c]++;
    }
    for (auto kv : cnt) {
        if (kv.S % 2 > 0) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;
int n, m;
bool vis[nax];

int main () {

    scanf("%d %d", &n, &m);

    if (n % 2 == 0) {

        /// lol
        /// the construction is really stupid....
        /// but I'm more stupid
        /// I laugh as if I was crazy when I figured out stupid pattern...

        int l = 1, r = n;

        bool turn = true;

        for (int i = m ; i >= 1 ; -- i, turn ^= 1) {

            if (turn) {
                printf("%d %d\n", l, l + i);
                ++ l;
            } else {
                printf("%d %d\n", r, r - i);
                -- r;
            }
        }

        return 0;
    }

    int r = n, l = 1;

    for (int i = 1 ; i <= m ; ++ i) {
        printf("%d %d\n", l ++, r --);
    }


}
/*
    Good Luck
        -Lucina
*/
/*
    I hate Progmeth
*/


Measured memory_bytes: 3836
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

int main() {
	int n; std::cin >> n;
	int count4{ 0 }, count2{ 0 }, count1{ 0 };
	for (auto i = 0; i < n; ++i) {
		int a; std::cin >> a;
		if (a % 4 == 0) ++count4;
		else if (a % 2 == 0) ++count2;
		else ++count1;
	}
	if (count2 != 0) ++count1;
	if (count4 + 1 >= count1) std::cout << "Yes\n";
	else std::cout << "No\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	int N;
	vector<int> L, R;
	string S;

	cin >> N >> S;

	L.push_back(0);
	for (int i = 1; i < N; i++)
	{
		L.push_back(L[i-1]);
		if (S[i - 1] == 'W') {
			L[i]++;
		}
	}

	reverse(S.begin(), S.end());

	R.push_back(0);
	for (int i = 1; i < N; i++)
	{
		R.push_back(R[i-1]);
		if (S[i - 1] == 'E') {
			R[i]++;
		}
	}
	
	reverse(R.begin(), R.end());
	
	int min = 2000000000;
	for (int i = 0; i < N; i++)
	{
		int tmp = L[i] + R[i];
		if (tmp < min) {
			min = tmp;
		}
	}

	cout << min << endl;

	return 0;
}

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

int main()
{
    string S;
    cin >> S;
    int N = S.size();
    vector<long> a(N + 1);
    rep(i, 0, N + 1)
    {
        a[i] = 0;
    }
    rep(i, 0, N)
    {
        if (S[i] == '<')
        {
            a[i + 1] = a[i] + 1;
        }
    }
    for (int i = N - 1; i >= 0; i--)
    {
        if (S[i] == '>')
        {
            a[i] = max(a[i], a[i + 1] + 1);
        }
    }
    long sum = 0;
    rep(i, 0, N + 1)
    {
        sum += a[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 4740
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n;
int32_t main(){_

   cin>>n;
   vector<int> a(5);

   for (int i = 0; i < 5; ++i)
   {
      cin>>a[i];
   }
   
   int mi = *min_element(a.begin(), a.end());

   int ans = 5 + ((n - 1) / mi);

   cout<<ans;

   return 0;
}

// Common sense: do smth instead of nothing
// Even a single second counts...
// If other's can do it, even I can do it. It wouldn't be that tough. Let me give it a try.
// Mistakes made in past
// -Ques. ask for max-min => think binary_search, DP, greedy
// -not reading question properly / skipping to read & understand all samples properly & wasting time in wrong direction.
// -Using wrong indexing in nested loops something like a[i], when it is supposed to be a[j](WA)
// -value of const int N is not correct (WA/RTE).
// -Did you memset dp to -1 ?
// -check for small edges cases and work on small test cases manually if WA
// -not deallocating memory to pointers can lead to MLE. Use delete :))
// -not reading problem statements of harder problems E,..., thinking it couldn't be solved, but it isn't the case.
// -Avoid using #define int long long as much as possible when it's dp problem and requires high memory say, O(N^2, N=5000) (MLE)
// -Check Bitwise Operator Precedence 
// -Use pragmas to optimize (by constant factor) when necessary..
// -Think before coding & starting to debug. Have patience to look inside code and actually see how it works

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl ("\n")
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ms memset
#define MOD 1000000007
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#define fr(i,n) for(i=0;i<n;i++)
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>	vi;
typedef vector<ll>	vl;
typedef vector<pii>	vpii;
typedef vector<pl>	vpl;
typedef vector<vi>	vvi;
typedef vector<vl>	vvl;
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);

ll expo (ll x, ll y) {ll res = 1; while (y) {if (y & 1)res = res * x; res %= MOD; y = y >> 1; x = x * x; x %= MOD;} return res;}

void solve()
{   
   ll i,j;
   ll n,k;
   cin>>n>>k;
   ll A[n+1];
   ll dp[n+1];
  fr(i,n)
  cin>>A[i+1];
    fr(i,n+1)
    dp[i]=INT_MAX;
    dp[0]=0;
    dp[1]=0;
    dp[2]=abs(A[2]-A[1]);

    
    for(i=3;i<=n;i++)
    {
        for(j=1;j<=k;j++)
        {
            if(i-j>=1)
            dp[i]=min(dp[i-j]+abs(A[i-j]-A[i]),dp[i]);
        }
    }
    cout<<dp[n]<<endl;
   
}

int main() 
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout);
#endif
    fast;
    // Fuck Ratings, I'm in Love with Experience. 
    int t = 1;
    //cin >> t;
    while(t--) {
      solve();
    }
    return 0;
}



Measured memory_bytes: 5196
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-d>k or e-c>k or e-b>k or e-a>k or d-c>k or d-b>k or d-a>k or c-b>k or c-a>k or b-a>k:
	print(":(")
else:
	print("Yay!")

Measured memory_bytes: 3060
#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.at(i);
  }
  sort(a.begin(),a.end());
  int count=0;
  int i=0;
  while(i<N){
    int j=i;
    while(j<N && a.at(j)==a.at(i)){
      ++j;
    }
    int k=j;
    while(k<N && a.at(k)-a.at(i)<=2){
      ++k;
    }
    count=max(count,k-i);
    i=j;
  }

  cout<<count<<endl;

}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {

    int N;
    cin >> N;

    vector<vector<int>> dp(2, vector<int>(N, 0)), a(2, vector<int>(N, 0));
    REP(i, 2) REP(j, N) cin >> a[i][j];

    dp[0][0] = a[0][0];
    dp[1][0] = a[0][0] + a[1][0];
    REP(i, 2) rep(j, 1, N){
        if (i == 0) dp[i][j] = dp[i][j - 1] + a[i][j];
        else dp[i][j] = max(dp[i-1][j], dp[i][j - 1]) + a[i][j];  
    }

    cout << dp[1][N - 1] << endl;

    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#define N 100
#define white 0
#define gray 1
#define black 2

void dfs_visit(int);
void dfs(void);

int a,G[N][N];
int color[N],b[N],c[N],t;

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

  scanf("%d",&a);
  for(i=0;i<a;i++){
    for(j=0;j<a;j++){
      G[i][j] = 0;
    }
  }
  for(i=0;i<a;i++){
    scanf("%d %d",&x,&k);
    x--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      G[x][v]=1;
    }
  }
  dfs();
  return 0;
}
void dfs_visit(int y){
  int v;
  color[y] = gray;
  b[y] = ++t;
  for(v=0;v<a;v++){
    if(G[y][v] == 0){
      continue;
    }
    if(color[v] == white){
      dfs_visit(v);
    }
  }
  color[y] = black;
  c[y]=++t;
}
void dfs(){
  int z;
  for(z=0;z<a;z++){
    color[z]=white;
  }
  t=0;
  for(z=0;z<a;z++){
    if( color[z] == white){
      dfs_visit(z);
    }
  }
  for(z=0;z<a;z++){
    printf("%d %d %d\n",z + 1,b[z],c[z]);
  }
}




Measured memory_bytes: 2052
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stack>
#include<cstdlib> 
#include<fstream> 
using namespace std;
int main(){
	string s;
	cin>>s;
	if(s.size()<4){
		cout<<"No"<<endl;
		return 0;
	} 
	if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I'){
		cout<<"Yes"<<endl;
		return 0;
	}
	cout<<"No"<<endl;
	return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    string s, t; cin >> s >> t;
    int ans = 99999;
    for (int i = 0; i + t.size() <= s.size(); i++) {
        int tr = 0;
        for (int j = 0; j < t.size(); j++) {
            if (s[i+j] != t[j]) tr++;
        }
        ans = min(ans,tr);
    }
    cout << ans << '\n';
}



Measured memory_bytes: 3636
N, M, C = map(int, input().split())
Bs = list(map(int, input().split()))

cnt = 0
for i in range(N):
    As = list(map(int, input().split()))
    total = 0
    for j in range(M):
        total += Bs[j] * As[j]
    total += C
    if total > 0:
        cnt += 1
print(cnt)


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

#define fast() {ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
using ll = long long;
const int mod = 1e9 + 7;

int main()
{
	fast();
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	vector<int> green(a), red(b), color(c + x + y);	
	for(int i = 0; i < a; ++i){
		cin >> green[i];
	}
	for(int i = 0; i < b; ++i){
		cin >> red[i];
	}
	for(int i = 0; i < c; ++i){
		cin >> color[i];
	}
	sort(green.begin(), green.end());
	sort(red.begin(), red.end());
	int j = c;
	int left = green.size() - 1, right = green.size() - x;

	for(int i  = (int)green.size() - 1; i >= (int)green.size() - x; --i){
		color[j++] = green[i];
	}
	int l = red.size() - 1, r = red.size() - y;
	//cout << l << r;
	for(int i  = l; i >= r; --i){
		color[j++] = red[i];
	}
	//cout <<"llll";
	sort(color.begin(), color.end());
	ll ans = 0;
	for(int i = color.size() - 1; i >= color.size() - x - y; --i){
		ans += (ll)color[i];
	}
	cout << ans <<"\n";
}			

Measured memory_bytes: 2176
#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];
        a[i] -= i + 1;
    }

    sort(a.begin(), a.end());

    long long ans = 0, t = 0;
    for (int i = 0; i < n; i++) {
        ans += abs(a[i] - a[n / 2]);
        if (n % 2 == 0) { 
            t += abs(a[i] - a[n / 2 - 1]);
        }
    }
    if (n % 2 == 0) ans = min(ans, t);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024