stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<algorithm>

#include<iostream>

#include<cstdlib>

#include<cstdio>

#include<time.h>

using namespace std;

typedef long long ll;

int n,m,v,p,a[100005],b[100005],ans,pth_min;

bool judge(int pth){

	ll res=0;

	int i;

	for(i=1;i<=n;i++)

		b[i]=min(m,pth-a[i]);

	sort(b+1,b+n+1);

	if(b[p]<0)

		return 0;

	for(i=1;i<=n;i++)

		res+=i<=p-1?m:b[i];

	return res>=(ll)m*v;

}

int solve(){

	int l=0,r=2e9,mid,res=-1;

	while(l<=r){

		mid=((ll)l+r)>>1;

		if(judge(mid))

			r=mid-1,res=mid;

		else

			l=mid+1;

	}

	return res;

}

int main(){

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

	int i;

	for(i=1;i<=n;i++)

		scanf("%d",&a[i]);

	pth_min=solve();

	for(i=1;i<=n;i++)

		ans+=a[i]+m>=pth_min;

	printf("%d\n",ans);

	return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>



const int maxn=1e5+5;

#define int long long

int n,m,v,p,last,a[maxn];



inline bool cmp(int a,int b){

	return a>b;

}



inline int max(int a,int b){

	return a>b?a:b;

}



inline bool check(int x){

	if(x<=p) return true;

	if(a[x]+m<a[p]) return false;

	int now=m*(p-1+n-x+1);

	for(int i=p+1;i<x;i++){

		now+=a[x]+m-a[i];

	}now+=a[x]+m-a[p];

	return now>=m*v;

}



signed main(){

	scanf("%lld%lld%lld%lld",&n,&m,&v,&p);

	for(int i=1;i<=n;i++){scanf("%lld",&a[i]);}

	std::sort(a+1,a+n+1,cmp);

	int l=1,r=n,mid,pos=p;

	while(l<=r){

		mid=(l+r)>>1;

		if(check(mid)){

			l=mid+1;

			pos=mid;

		}else r=mid-1;

	}

	printf("%lld\n",pos);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

const int N=200005;

#define int long long

int n,m,v,p,pos,tmp;

int a[N],sum[N],t[N];



bool cmp(int x,int y)

{

	return x>y;

}



bool check(int x)

{

	//cout<<a[x]<<" "<<k<<" "<<tt<<endl;

	if(x<=p) return 1;

	int rest=v-(p-1)-(n-x+1);

	if(rest<0) rest=0;

	int choose=n-(p-1)-(n-x+1);

	int Sum=0;

	for(int i=1;i<=choose;i++) t[i]=a[i+p-1]-a[x],Sum+=t[i];

	//cout<<rest<<endl; for(int i=1;i<=choose;i++) cout<<t[i]<<" "; cout<<endl; cout<<endl;

	if(a[x]+m<a[p]) return 0;

	return Sum<=m*(choose-rest);

}



signed main() 

{

	scanf("%lld%lld%lld%lld",&n,&m,&v,&p);

	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);

	sort(a+1,a+n+1,cmp);

	int now=1;

	for(int i=1;i<=n;i++)

	{

		sum[i]=sum[i-1]+a[i];

	}

	int l=p,r=n,mid,best;

	while(l<=r)

	{

		mid=(l+r)>>1;

		if(check(mid)) l=mid+1,best=mid;

		else r=mid-1;

	}

	cout<<best<<endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>



const int maxn=1e5+5;

#define int long long

int n,m,v,p,last,a[maxn];



inline bool cmp(int a,int b){

	return a>b;

}



inline int max(int a,int b){

	return a>b?a:b;

}



inline bool check(int x){

	if(x<=p) return true;

	if(a[x]+m<a[p]) return false;

	int now=m*(p-1+n-x+1);

	for(int i=p+1;i<x;i++){

		now+=a[x]+m-a[i];

	}now+=a[x]+m-a[p];

	return now>=m*v;

}



signed main(){

	scanf("%lld%lld%lld%lld",&n,&m,&v,&p);

	for(int i=1;i<=n;i++){scanf("%lld",&a[i]);}

	std::sort(a+1,a+n+1,cmp);

	int l=1,r=n,mid,pos=p;

	while(l<=r){

		mid=(l+r)>>1;

		if(check(mid)){

			l=mid+1;

			pos=mid;

		}else r=mid-1;

	}

	printf("%lld\n",pos);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#define int long long



using namespace std;

const int N = 1e5 + 5;



int n, m, v, p;

int a[N], t[N];



bool judge(int x) {

	if (x <= p) return 1;

	if (a[x] + m < a[p]) return 0;

	if (v <= p - 1 && a[x] + m >= a[p]) return 1;

	for (register int i = 1; i <= n; i++)

		t[i] = a[i];

	for (register int i = 1; i < p; i++)

		t[i] += m;

	

	int cost = m * (p - 1);

	for (register int i = n, c = v - p; i > x && c; c--)

		cost += m, t[--i] += m;

	cost += m;

	

	int left = m * v - cost;

	for (register int i = p; i < x; i++) {

		int inc = min(m, max(a[x] + m - a[i], 0ll));

		inc = min(inc, left);

		left -= inc, t[i] += inc;

	}

	

	return a[x] + m >= t[p] && left <= 0;

}



signed main() {

	cin >> n >> m >> v >> p;

	for (register int i = 1; i <= n; i++)

		cin >> a[i];

	

	sort(a + 1, a + 1 + n, greater<int>());

	

	int l = 1, r = n, ret = 0;

	while (l <= r) {

		int mid = (l + r) >> 1;

		if (judge(mid)) ret = mid, l = mid + 1;

		else r = mid - 1;

	}

	

	cout << ret << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>



const int maxn=1e5+5;

#define int long long

int n,m,v,p,last,a[maxn];



inline bool cmp(int a,int b){

	return a>b;

}



inline int max(int a,int b){

	return a>b?a:b;

}



inline bool check(int x){

	if(x<=p) return true;

	if(a[x]+m<a[p]) return false;

	int now=m*(p-1+n-x+1);

	for(int i=p+1;i<x;i++){

		now+=a[x]+m-a[i];

	}now+=a[x]+m-a[p];

	return now>=m*v;

}



signed main(){

	scanf("%lld%lld%lld%lld",&n,&m,&v,&p);

	for(int i=1;i<=n;i++){scanf("%lld",&a[i]);}

	std::sort(a+1,a+n+1,cmp);

	int l=1,r=n,mid,pos=p;

	while(l<=r){

		mid=(l+r)>>1;

		if(check(mid)){

			l=mid+1;

			pos=mid;

		}else r=mid-1;

	}

	printf("%lld\n",pos);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

#define int long long

const int maxn=1e5+10;

int a[maxn];

int cmp(const int a,const int b){

    return a>b;

}

int n,m,v,p;

int b[maxn];

bool judge(int mid){

    //printf("hello %lld\n",mid);

    if(mid<=p)return true;

    if(a[mid]+m<a[p])return false;

    if(v<=p-1&&a[mid]+m>=a[p])return true;

    for(int i=1;i<=n;i++)b[i]=a[i];

    int temp=0;

    int inx=n,cnt=v-p+1;

    for (int i=n,j=v-p;i>mid&&j;i--,j--){

        temp+=m;

        b[i]+=m;

    }

    temp+=m*p;

    int now=a[mid]+m;

    int res=m*v-temp;

    int ww=a[p];

    for(int i=p;i<mid;i++){

        int add=min(m,max(now-a[i],0ll));

        if(add>res)add=res;

        res-=add;

        b[i]+=add;

        if(i==p){

            ww+=add;

        }

    }

    return now>=ww&&res<=0;

}

signed main(){

    cin>>n>>m>>v>>p;

    for(int i=1;i<=n;i++){

        cin>>a[i];

    }

    sort(a+1,a+n+1,cmp);

    int low=1,high=n;

    int ans=0;

    while(low<=high){

        int mid=(low+high)>>1;

        if(judge(mid)){

            low=mid+1;

            ans=mid;

        }

        else{

            high=mid-1;

        }

    }

    cout<<ans<<endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <cstring>

#include <algorithm>

#include <cstdio>

#define int long long

#define ri register int

#define N 100005

using namespace std;

int n,m,v,p,t=0,ans,a[N]= {0};

template <typename T> inline void read(T &x) {

    T c=getchar(),f=0;

    for (; c<48||57<c; c=getchar()) if (c=='-') f=1;

    for (x=0; 48<=c&&c<=57; c=getchar()) x=(x<<3)+(x<<1)+(c^48);

    if (f) x=-x;

}

template <typename T> inline void print(T x) {

    if (x<0) x=-x,putchar('-');

    if (x>9) print(x/10);

    putchar(x%10+48);

}

signed main() {

	read(n),read(m),read(v),read(p),ans=p;

	for (ri i=1; i<=n; i++) read(a[i]);

	sort(a+1,a+1+n),reverse(a+1,a+1+n);

	for (ri i=p+1; i<=n; i++) {

		if (a[i]+m<a[p]) break;

		if (v<=(p-1)+(n-i+1)) ans++;

		else if ((v-p-n+i)*m<=t) ans++;

		else if (((v-p-n+i)*m-t-1)/(i-p)+1+a[p]<=a[i]+m) ans++;

		t+=a[p]-a[i];

	}

	print(ans),putchar('\n');

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, int> pli;

typedef pair<ll, ll> pll;

typedef long double ld;

#define mp make_pair

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 

const int N = 100100;

int n;

ll m, v, p;

ll a[N];

ll pref[N];

 

int main()

{

//	freopen("input.txt", "r", stdin);

//	freopen("output.txt", "w", stdout);

 

	scanf("%d%lld%lld%lld", &n, &m, &v, &p);

	int ans = 0;

	for (int i = 0; i < n; i++)

		scanf("%lld", &a[i]);

	sort(a, a + n);

	reverse(a, a + n); // 将初始分数排序

	for (int i = 0; i < n; i++)

		pref[i + 1] = pref[i] + a[i]; // 前缀和计算区间分数和

	ans = p;

	for (int i = p; i < n; i++) {

		if (a[i] + m < a[p - 1]) break;

		ll cur = v - (n - (i - p + 1)); // 每个评委必须投的票数

		if (cur <= 0) { // 无票可投，第i票有机会被投

			ans++;

			continue;

		}

		if (cur * m <= (i - p + 1) * (a[i] + m) - (pref[i] - pref[p - 1]))

			// cur*m=必须投出的票数

			// (i-p+1)*(a[i]+m)=这(i-p+1)道题目最终的最高分数和

			// pref[i]-pref[p-1]=在[p-1,i)区间内的初始分数和

			// 二者相减=[p-1,i)这些题目所能投的最多票数（？？？？？？？？）

			ans++;

	}

	printf("%d\n", ans);

 

	return 0;

}






















// Optimized solution to the same problem (faster):
#include <cstring>

#include <algorithm>

#include <cstdio>

#define int long long

#define ri register int

#define N 100005

using namespace std;

int n,m,v,p,t=0,ans,a[N]= {0};

template <typename T> inline void read(T &x) {

    T c=getchar(),f=0;

    for (; c<48||57<c; c=getchar()) if (c=='-') f=1;

    for (x=0; 48<=c&&c<=57; c=getchar()) x=(x<<3)+(x<<1)+(c^48);

    if (f) x=-x;

}

template <typename T> inline void print(T x) {

    if (x<0) x=-x,putchar('-');

    if (x>9) print(x/10);

    putchar(x%10+48);

}

signed main() {

	read(n),read(m),read(v),read(p),ans=p;

	for (ri i=1; i<=n; i++) read(a[i]);

	sort(a+1,a+1+n),reverse(a+1,a+1+n);

	for (ri i=p+1; i<=n; i++) {

		if (a[i]+m<a[p]) break;

		if (v<=(p-1)+(n-i+1)) ans++;

		else if ((v-p-n+i)*m<=t) ans++;

		else if (((v-p-n+i)*m-t-1)/(i-p)+1+a[p]<=a[i]+m) ans++;

		t+=a[p]-a[i];

	}

	print(ans),putchar('\n');

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#ifndef ONLINE_JUDGE

#define debug(x) cout << #x << ": " << x << endl

#else

#define debug(x)

#endif

using namespace std;

typedef long long ll;

const int maxn=2e5+7;

const int inf=0x3f3f3f3f;

const int mod=1e9+7;



int a[maxn];

ll sum[maxn];



int main()

{

    ios::sync_with_stdio(false);

    cin.tie(0);

    ll n,m,v,p;

    cin>>n>>m>>v>>p;

    for(int i=1;i<=n;++i) cin>>a[i];

    sort(a+1,a+1+n);

    for(int i=1;i<=n;++i)

        sum[i]=sum[i-1]+a[i];

    int ans=p;

    for(int i=n-p;i>=1;--i)

    {

        if(a[i]+m<a[n-p+1]) break;

        else

        {

            if( m*v<=i*m+(p-1)*m+(a[i]+m)*(n-p+1-i)-(sum[n-p+1]-sum[i]) )

                ans++;

            else break;

        }

    }

    cout<<ans<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <cstring>

#include <algorithm>

#include <cstdio>

#define int long long

#define ri register int

#define N 100005

using namespace std;

int n,m,v,p,t=0,ans,a[N]= {0};

template <typename T> inline void read(T &x) {

    T c=getchar(),f=0;

    for (; c<48||57<c; c=getchar()) if (c=='-') f=1;

    for (x=0; 48<=c&&c<=57; c=getchar()) x=(x<<3)+(x<<1)+(c^48);

    if (f) x=-x;

}

template <typename T> inline void print(T x) {

    if (x<0) x=-x,putchar('-');

    if (x>9) print(x/10);

    putchar(x%10+48);

}

signed main() {

	read(n),read(m),read(v),read(p),ans=p;

	for (ri i=1; i<=n; i++) read(a[i]);

	sort(a+1,a+1+n),reverse(a+1,a+1+n);

	for (ri i=p+1; i<=n; i++) {

		if (a[i]+m<a[p]) break;

		if (v<=(p-1)+(n-i+1)) ans++;

		else if ((v-p-n+i)*m<=t) ans++;

		else if (((v-p-n+i)*m-t-1)/(i-p)+1+a[p]<=a[i]+m) ans++;

		t+=a[p]-a[i];

	}

	print(ans),putchar('\n');

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <cassert>



using ll = long long;

const int maxn = 1e5+7;



ll n, m, v, p, a[maxn], pre[maxn];



bool gao(ll x) {

	ll posl = std::lower_bound(a+1, a+1+n, x)-(a);

	ll posr = std::upper_bound(a+1, a+1+n, x+m)-(a);

//	std::cout << x << ' ' << x+m << ' ' << posl << ' ' << a[posl] << ' ' << posr << ' ' << a[posr] << '\n';

	assert(posl > 0);

	assert(posr <= n+1);

	posr = std::min(posr, n-p+2);

	posl = std::min(posl, n-p+2);

	if (x+m < a[n-p+1]) {

		return false;

	}

	ll ans = (posl-1)*m+(p-1)*m;

	ans += (x+m)*(posr-posl)-(pre[posr-1]-pre[posl-1]);

//	std::cout << (posl-1+1)*m << ' ' << (p-1)*m << ' ' << (x+m)*(posr-posl) << ' ' << (pre[posr-1]-pre[posl-1]) << ' ';

//	std::cout << ans << ' ' << v*m << '\n';

//	std::cout << "----------\n";

	return ans >= (v*m);

}



int main(int argc, char *argv[]) {  

	std::ios::sync_with_stdio(false);

	std::cin.tie(0); 

	std::cin >> n >> m >> v >> p;

	for (int i = 1; i <= n; i++) {

		std::cin >> a[i];

	}

	std::sort(a+1, a+n+1);

	pre[0] = 0;

	for (int i = 1; i <= n; i++) {

		pre[i] = a[i] + pre[i-1];

	}

//	for (int i = 1; i <= n; i++) {

//		std::cerr << a[i] << " \n"[i==n];

//	}

//	std::cout << "----------\n";

	int res = 0;

	for (int i = 1; i <= n; i++) {

		if (gao(a[i])) {

			res++;

		}

	}

	std::cout << res << '\n';

}

// Optimized solution to the same problem (faster):
#include <cstring>

#include <algorithm>

#include <cstdio>

#define int long long

#define ri register int

#define N 100005

using namespace std;

int n,m,v,p,t=0,ans,a[N]= {0};

template <typename T> inline void read(T &x) {

    T c=getchar(),f=0;

    for (; c<48||57<c; c=getchar()) if (c=='-') f=1;

    for (x=0; 48<=c&&c<=57; c=getchar()) x=(x<<3)+(x<<1)+(c^48);

    if (f) x=-x;

}

template <typename T> inline void print(T x) {

    if (x<0) x=-x,putchar('-');

    if (x>9) print(x/10);

    putchar(x%10+48);

}

signed main() {

	read(n),read(m),read(v),read(p),ans=p;

	for (ri i=1; i<=n; i++) read(a[i]);

	sort(a+1,a+1+n),reverse(a+1,a+1+n);

	for (ri i=p+1; i<=n; i++) {

		if (a[i]+m<a[p]) break;

		if (v<=(p-1)+(n-i+1)) ans++;

		else if ((v-p-n+i)*m<=t) ans++;

		else if (((v-p-n+i)*m-t-1)/(i-p)+1+a[p]<=a[i]+m) ans++;

		t+=a[p]-a[i];

	}

	print(ans),putchar('\n');

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long int

using namespace std;



const int MAX = 1e5+5;



const int MOD = 1e9 + 7;







int main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    

    int a , b , c;

    cin>>a>>b>>c;

    cout<<min(a*b , c)<<endl;

    return 0;

   

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	int n,a,b;

	scanf("%d%d%d",&n,&a,&b);

	int s = n*a;

	int y = b<s?b:s;

	printf("%d\n",y);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>

#include <iomanip>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <algorithm>



using namespace std;



#define drobucs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);



int main() {

	drobucs;



	int n, a, b;

	cin >> n >> a >> b;



	if (a * n > b) {

		cout << b;

	}

	else {

		cout << a * n;

	}



	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	int n,a,b;

	scanf("%d%d%d",&n,&a,&b);

	int s = n*a;

	int y = b<s?b:s;

	printf("%d\n",y);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int main() {

	long long a, b, c;

	cin >> a >> b >> c;

	cout << ((a*b < c) ? (a*b) : c);

	cout << endl;

	system("PAUSE");

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	int n,a,b;

	scanf("%d%d%d",&n,&a,&b);

	int s = n*a;

	int y = b<s?b:s;

	printf("%d\n",y);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
/**

*   @Author : MeGA

*   @InitTime :02/08/20 16:03:05

*   @Idea : 

*

*

*

*

*

*

*

**/

#include <bits/stdc++.h>

using namespace std;

int main(){

#ifndef ONLINE_JUDGE

  // freopen("in","r",stdin);

  // freopen("out","w",stdout);

#endif



     ios::sync_with_stdio(false);

     cin.tie(0);

     int n,a,b;

     cin>>n>>a>>b;

     cout<<min(b,n*a)<<endl;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>





int main()

{		

	int n, a, b;

	

	scanf("%d%d%d", &n, &a, &b);

	a *= n;

	printf("%d\n", a < b ? a : b);

				

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



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

#define all(x) (x).begin(),(x).end()

#define pb push_back

#define MP make_pair

#define SZ(v) ((int)((v).size()))

typedef long long ll;



const ll MOD = 1e9 + 7;

const int OO = (int)1e6;

const int N = (int)1e7;



void init(){

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

}



int main() {

	#   ifdef LOCAL_PROJECT

        freopen("in.txt", "r", stdin);

    #   endif

    int n,a,b;

    cin>>n>>a>>b;

    cout<<min(a*n,b);

    

    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>





int main()

{		

	int n, a, b;

	

	scanf("%d%d%d", &n, &a, &b);

	a *= n;

	printf("%d\n", a < b ? a : b);

				

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main(){

    int n,m,x,l;

    cin >> n >> m >> x;

    if(n*m>x)

        l = x;

    else

        l = n * m;

    cout << l << endl;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>





int main()

{		

	int n, a, b;

	

	scanf("%d%d%d", &n, &a, &b);

	a *= n;

	printf("%d\n", a < b ? a : b);

				

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

    long long int a,b,c;

    cin >> a >> b >> c;

    if(a*b<=c)

        cout << a*b << endl;

    else

        cout << c << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,a,b;

	scanf("%d%d%d", &n, &a, &b);

	printf("%d", min(n*a, b));

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

using namespace std;

int main() {

    int N=0,A=0,B=0;

    cin>> N>>A>>B;

    int tmp = N*A;

    if(B<tmp){

        cout<<B<<endl;

    }else{

        cout<<tmp<<endl;

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main(){

	

	int a,b,c;

	

	scanf("%d %d %d",&a,&b,&c);

	

	int trip =a*b;

	

	if(trip<=c){

		

		printf("%d\n",trip);

		

	}

	

	else{

		

		printf("%d\n",c);

	}

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#pragma GCC optimize("Ofast", "unroll-loops")

#define ll long long 

#define pii pair<int, int>

#define ull unsigned ll

#define f first

#define s second

#define FOR(i,a,b) for (int i=(a); i<(b); i++)

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

#define RREP(i,n) for (int i=(n-1); i>=0; i--)

#define ALL(x) x.begin(),x.end()

#define SZ(x) x.size()

#define SQ(x) (x)*(x)

#define MNTO(a,b) a = min(a,(__typeof__(a))(b))

#define MXTO(a,b) a = max(a,(__typeof__(a))(b))

#define pb push_back

#define debug(x) cerr<<#x<<" is "<<x<<endl

using namespace std;



// #define int ll



const int maxn = 1e5+5;

const int iinf = 1<<29;

const ll inf = 1ll<<60;

const ll mod = 1e9+7;





void GG(){cout<<"No\n"; exit(0);}



ll pow(ll a, ll n){ // a^n % mod

    ll re=1;

    while (n>0){

        if (n&1) re = re*a %mod;

        a = a*a %mod;

        n>>=1;

    }

    return re;

}



ll inv (ll b){

    if (b==1) return b;

    return (mod-mod/b) * inv(mod%b) % mod;

}



main(){

    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    int a, b, c; cin>>a>>b>>c; cout<<min(a*b,c)<<endl;



    

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



class FIO

{

public:

    template<typename T>FIO& operator >>(T& x){ _R(x);return *this; }

    template<typename T>FIO& operator <<(T x){ _W(x);return *this; }

private:

    char f,c,a[25],i;

    template<typename T>inline void _R(T& x)

    {

        for(f=0;(c=getchar())<48;c==45&&(f=1));

        for(x=c^48;(c=getchar())>47;x=(x<<3)+(x<<1)+(c^48));

        if(f)x=-x;

    }

    template<typename T>inline void _W(T x)

    {

        if(sizeof(x)==1){ putchar(x);return; }

        if(x<0)putchar(45),x=-x;

        if(x>99) {

            for(i=0;x;x/=10)a[i++]=x%10;

            while(i--)putchar(a[i]+48);

        } else if(x>9) putchar(x/10+48),putchar(x%10+48);

        else putchar(x+48);

    }

}io;



int main()

{

    int n,a,b;

    io>>n>>a>>b;

    if(n*a<b)io<<n*a;

    else io<<b;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



int main()

{

       int N, A, B,x,y;

       cin>> N >> A >> B;

       x=N*A;

       if(x<=B)

       {

              cout<< x<< endl;



       }

       else

       {

              cout<< B <<endl;

       }



}


// Optimized solution to the same problem (faster):
#include<stdio.h>



class FIO

{

public:

    template<typename T>FIO& operator >>(T& x){ _R(x);return *this; }

    template<typename T>FIO& operator <<(T x){ _W(x);return *this; }

private:

    char f,c,a[25],i;

    template<typename T>inline void _R(T& x)

    {

        for(f=0;(c=getchar())<48;c==45&&(f=1));

        for(x=c^48;(c=getchar())>47;x=(x<<3)+(x<<1)+(c^48));

        if(f)x=-x;

    }

    template<typename T>inline void _W(T x)

    {

        if(sizeof(x)==1){ putchar(x);return; }

        if(x<0)putchar(45),x=-x;

        if(x>99) {

            for(i=0;x;x/=10)a[i++]=x%10;

            while(i--)putchar(a[i]+48);

        } else if(x>9) putchar(x/10+48),putchar(x%10+48);

        else putchar(x+48);

    }

}io;



int main()

{

    int n,a,b;

    io>>n>>a>>b;

    if(n*a<b)io<<n*a;

    else io<<b;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

typedef long long ll;

#define vstroku() to_string()

#define vchislo() to_ulong()

#define gcd(x,y) __builtin_gcd(x,y)

#define numberof1(x) __builtin_popcount(x)

#define povsemelementam(i,mnozh) for(auto i: mnozh)

#define podotrezok(i,j) substr(i-1,j) // like prefix sum, (i,j)=s[j]-s[i-1]

#define pb push_back

#define pf push_front

#define popf pop_front

#define popb pop_back 

#define pii pair <int, int>

#define F first

#define S second

#define mipletsplay ios_base::sync_with_stdio(0); cin.tie(0); 





using namespace std;

const ll INFLL = 1e18;

const int MAXN = 3e5;

const ll INF = 1e9;

const ll kek=998244353;



int main() {

mipletsplay;



int n,a,b;

cin>>n>>a>>b;

int k=min(a*n,b);

cout<<k;}

// Optimized solution to the same problem (faster):
#include<stdio.h>



class FIO

{

public:

    template<typename T>FIO& operator >>(T& x){ _R(x);return *this; }

    template<typename T>FIO& operator <<(T x){ _W(x);return *this; }

private:

    char f,c,a[25],i;

    template<typename T>inline void _R(T& x)

    {

        for(f=0;(c=getchar())<48;c==45&&(f=1));

        for(x=c^48;(c=getchar())>47;x=(x<<3)+(x<<1)+(c^48));

        if(f)x=-x;

    }

    template<typename T>inline void _W(T x)

    {

        if(sizeof(x)==1){ putchar(x);return; }

        if(x<0)putchar(45),x=-x;

        if(x>99) {

            for(i=0;x;x/=10)a[i++]=x%10;

            while(i--)putchar(a[i]+48);

        } else if(x>9) putchar(x/10+48),putchar(x%10+48);

        else putchar(x+48);

    }

}io;



int main()

{

    int n,a,b;

    io>>n>>a>>b;

    if(n*a<b)io<<n*a;

    else io<<b;

    return 0;

}

// Fastest known solution for this problem: