akhauriyash/Code-Regression huggingface dataset:
/*
 * A.cpp
 *
 *  Created on: 2017/06/18
 *      Author: jin
 */

#define MYDEBUG
#include <bits/stdc++.h>

#ifdef MYDEBUG
#define dbp(x) cout<<#x<<": "<<x<<endl
#define dbp2(x,y) cout<<#x<<","<<#y<<": "<<x<<","<<y<<endl
#define dbp3(x,y,z) cout<<#x<<","<<#y<<","<<#z<<": "<<x<<","<<y<<","<<z<<endl
#define dbp4(w,x,y,z) cout<<#w<<","<<#x<<","<<#y<<","<<#z<<": "<<w<<","<<x<<","<<y<<","<<z<<endl
#define ifcin(x) std::ifstream cin(x)
#else
#define dbp(x)
#define dbp2(x,y)
#define dbp3(x,y,z)
#define dbp4(w,x,y,z)
#define ifcin(x)
#endif
#define ll long long
#define ull unsigned long long
#define all(x) x.begin(), x.end()
#define rep(i, from, to) for(int i=from; i<to; ++i)
#define REP(i, from, to) for(int i=from; i<=to; ++i)
#define EPS = 1e-14;
using std::vector;
using std::cout;
using std::cin;
using std::endl;
using std::max;
using std::min;
using std::swap;
using std::string;
using std::fill;
using std::pair;
using std::sort;
using std::reverse;
using std::pair;
using std::greater;
using std::priority_queue;
using std::ostream;
typedef std::complex<int> P;

template<typename T>
ostream& operator<<(ostream& out, const vector<vector<T> >& v) {
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i] << endl;
  }
  return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last) {
      out << ",";
    }
  }
  out << "]";
  return out;
}
const int maxn = 100010;
int n;
int a[maxn];
string no = "No", yes = "Yes";
void solve() {
  cin >> n;
  int small = INT_MAX, big = INT_MIN;
  rep(i,0,n)
  {
    cin >> a[i];
    small = min(a[i], small);
    big = max(a[i], big);
  }
  sort(a, a + n);
  if (big - small > 1) {
    cout << no << endl;
    return;
  }
  int sn = 0, bn = 0;
  rep(i,0,n)
  {
    if (a[i] == small) {
      sn++;
    }
    if (a[i] == big) {
      bn++;
    }
  }
  if (small == big && big == n - 1) {
    cout << yes << endl;
    return;
  }
  int es = n - big;
  if (bn > es && bn <= (es * 2)) {
    cout << yes << endl;
  } else {
    cout << no << endl;
  }

}

int main() {
  solve();
}



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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

int main(int argc, char* argv[]) {
  ll n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  s = '1' + s + '1';

  vector<int> indexes, lengths;

  int count = 0;
  rep(i, 0, sz(s)) {
    if (s[i] == '1') {
      if (!count) indexes.pb(i);
      count++;
      continue;
    }
    if (count > 0) lengths.pb(count);
    count = 0;
  }
  lengths.pb(count);

  if (sz(indexes) - 1 <= k) {
    put(sz(s) - 2);
    return 0;
  }

  int ans = 0;
  rep(i, 0, sz(indexes) - k) {
    int first = indexes[i];
    int last = indexes[i + k] + lengths[i + k];
    if (!first) first++;
    if (last == sz(s)) last--;

    chmax(ans, last - first);
  }

  put(ans);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, m, q;
	cin >>n >>m >>q;
	
	vector<VI> ss(n+2, VI(n+2)), sk(n+3, VI(n+3));
	rep(i, m){
		int l, r; cin >>l >>r;
		ss[l-1][r-1]++;
	}
	rep(i, n+2) rep(j, n+2){
		sk[i+1][j+1] = sk[i+1][j] + sk[i][j+1] - sk[i][j] + ss[i][j];
	}

	rep(i, q){
		int a, b; cin >>a >>b; 
		cout << sk[b][b] - sk[a-1][b] - sk[b][a-1] + sk[a-1][a-1] <<"\n";
	}
	return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
    string s;
    cin >> s;
    if (s == "AAA" || s == "BBB")
        OP("No");
    else
        OP("Yes");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define f(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
ll a[25][25];
ll n;
const int q=23;
ll fastmodexp(ll a,ll b){
    ll res=1;
    while(b>0){
         if (b & 1)
        res=(res*a);
        a=(a*a);
        b=b>>1;
    }
    return res;
}
ll dp[22][int(pow(2,q))-1];
ll find(ll i,ll mask){
//    cout<<" comes "<<mask<<endl;
if(i==n){
   if(mask==(fastmodexp(2,n)-1)){
    return 1;
   }
   else{
    return 0;
   }
    
    
}
if(dp[i][mask]!=-1){
    return dp[i][mask];
}
ll co=0;

for(ll j=0;j<n;j++){
if((a[i][j]==1&&(((mask>>j)&1)==0))){
mask=(mask|(1<<j));
ll val=find(i+1,mask);
co+=val;
co=co%mod;
mask=(mask&(~(1<<j)));
}
}

return dp[i][mask]=co%mod;
}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
cin>>n;
f(i,0,n){
    f(j,0,n){
        cin>>a[i][j];
    }
}

f(i,0,n+1){
    f(j,0,fastmodexp(2,n+1)){
       dp[i][j]=-1;
    }
}
cout<<find(0,0)%mod<<endl;


}

Measured memory_bytes: 766208
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
int find(int x);
int same(int x,int y);
void unite(int x,int y);
typedef pair<int,int>P;
typedef pair<P,P>Q;
vector<P>p;
vector<P>q;
vector<Q>edge;
int pp[100009];

int main(){
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    int a,b;
    cin>>a>>b;
    p.push_back(P(a,i));
    q.push_back(P(b,i));
    pp[i]=i;
  }
  sort(p.begin(),p.end());
  sort(q.begin(),q.end());
  for(int i=0;i<n-1;i++){
    int cost=p[i+1].fi-p[i].fi;
    int ncost=q[i+1].fi-q[i].fi;
    edge.push_back(Q(P(cost,p[i].se),P(p[i+1].se,0)));
    edge.push_back(Q(P(ncost,q[i].se),P(q[i+1].se,0)));
  }
  sort(edge.begin(),edge.end());
  ll sum=0;
  for(int i=0;i<edge.size();i++){
    ll w=edge[i].fi.fi;
    int s=edge[i].fi.se;
    int t=edge[i].se.fi;
    if(same(s,t)==0){
      sum+=w;
      unite(s,t);
    }
  }
  cout<<sum<<endl;
  return(0);
}

int find(int x){
  if(x==pp[x])return x;
  return pp[x]=find(pp[x]);
}

int same(int x,int y){
  if(find(x)==find(y))return 1;
  else return 0;
}

void unite(int x,int y){
  x=find(x);
  y=find(y);
  pp[x]=y;
}


Measured memory_bytes: 8424
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int lli;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s,t;
    cin>>s>>t;
    
    if(s.length()!=t.length()-1)
    {
        cout<<"No";
        return 0;
    }
    
    if(s!=t.substr(0,s.length())) cout<<"No";
    else cout<<"Yes";
    return 0;
}

Measured memory_bytes: 3652
use proconio::input;

fn main() {
    input! {
        n: usize,
        xyh: [(i64, i64, i64); n],
    };
    for c_y in 0..=100 {
        for c_x in 0..=100 {
            let mut c_h = 0;
            for &(x_i, y_i, h_i) in xyh.iter() {
                if h_i == 0 {
                    continue;
                }
                // h_i + ((x_i - c_x).abs() + (y_i - c_y).abs()) == c_h
                c_h = h_i + (x_i - c_x).abs() + (y_i - c_y).abs();
                break;
            }

            let mut ok = true;
            for &(x_i, y_i, h_i) in xyh.iter() {
                if h_i != std::cmp::max(c_h - ((x_i - c_x).abs() + (y_i - c_y).abs()), 0) {
                    ok = false;
                    break;
                }
            }
            if ok {
                println!("{} {} {}", c_x, c_y, c_h);
                return;
            }
        }
    }
}


Measured memory_bytes: 2192
#include<stdio.h>
#include<string.h>
int main()
{
    int a,d,sum,i,flag;
    int b[100]={};
    int c;
  	a=0;
    c=0;
    sum=1;
    // スペース区切りの整数の入力
    scanf("%d",&a);
    for(d=0;d<a;d++){
      scanf("%d",&c);
      b[d]=c;
    }
    for(d=1;d<a;d++){
        flag=1;
    	for(i=0;i<d;i++){
        	if(b[i]>b[d]){
              flag=0;
        	  break;
        	}
        }
        sum += flag;
    }
    // 出力
    printf("%d",sum);
    return 0;
}

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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)

#define mt              make_tuple
#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


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




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////

int main()
{
    FASTIO;

    string st;

    cin >> st;


    for(int i=0; i<st.length(); i++)
        cout << "x";








    return 0;
}



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

int main(){
	vector<int> all;
	for(int i=0; i<10; i++){
		int n;
		cin>>n;
		all.push_back(n);
	}
	sort(all.begin(), all.end());
	reverse(all.begin(), all.end());
	for(int i=0; i<3; i++){
		cout<<all[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9+7;

int main(void){

    int N; cin>>N;
    vector<int> a(N+1);
    for (int i = 1; i <= N; ++i) {
        cin>>a[i];
    }

    bool ok = true;

    int index=1;
    int tmp,cnt=0;
    for (int i = 0; i < N; ++i) {
        if(a[index]==2){
            ok = true;
            cnt++;
            break;
        }else if(a[index]==0){
            ok = false;
            break;
        }
        tmp = index;
        index = a[index];
        a[tmp] = 0;
        cnt++;
    }

    if(ok) cout<<cnt<<endl;
    else cout<<-1<<endl;

    return 0;
}

Measured memory_bytes: 640
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] lengthes = new int[n + 1];
		for(int i = 0; i < n; i++){
			lengthes[i] = sc.nextInt();
		}
		lengthes[n] = Integer.MAX_VALUE;
		Arrays.sort(lengthes);
		int count = 0;
		for(int i = 0; i < n; i++){
			for(int k = i + 1; k < n; k++){
				int twoLength = lengthes[i] + lengthes[k];
				int begin = k;
				int end = n;
				while(end - begin > 1){
					int middle = (begin + end) / 2;
					if(lengthes[middle] < twoLength){
						begin = middle;
					}else{
						end = middle;
					}
				}
				count += begin - k;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 26484
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <deque>
#include <string>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <map>
#include <unordered_map>
#include <bitset>
#include <fstream>
#pragma warning(disable:4996)
#define hayai ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define INF 0x3F3F3F3F
#define MAX 100001
#define MAXLOGO 17
#define MOD 1000000007
#define ALPHABET 128
using namespace std;
typedef long long ll;

//freopen("perimetric_chapter_1_input.txt", "r", stdin);
//freopen("result.txt", "w", stdout);

ll f1(pair <ll, ll > a, pair<ll, ll> b)
{
    return a.first + a.second < b.first + b.second;
}

ll f2(pair<ll, ll> a, pair<ll, ll> b)
{
    return a.first - a.second < b.first - b.second;
}

ll dist (pair<ll, ll> a, pair <ll, ll> b)
{
    return abs(a.first - b.first) + abs (a.second - b.second);
}

int main(void)
{
    ll n;
    cin >> n;
    vector<pair<ll, ll>> v1(n), v2(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v1[i].first >> v1[i].second;
    }
    v2 = v1;
    sort (v1.begin(), v1.end(), f1);
    sort (v2.begin(), v2.end(), f2);
    ll mx1 = dist(v1[n - 1], v1[0]);
    ll mx2 = dist(v2[n - 1], v2[0]);
    cout << max(mx1, mx2) << endl;
}

Measured memory_bytes: 9580
#include<bits/stdc++.h>
//#include<iostream>
using namespace std;
//type
typedef long long ll;
#define pii pair<int, int>
#define vi vector<int>
//x * y * 1.0 can cause overflow
//constant
#define inf (int)(1e9+7)
#define mod (ll)(1e9+7)
#define eps 1e-10
//omission
#define eb emplace_back
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define all(v) v.begin(), v.end()
#define ios cin.tie(0); ios::sync_with_stdio(false)
#define FIX(a) cout << fixed << setprecision(a)
#define mp make_pair
//manip
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(unique(v.begin(), v.end(), v.end());
#define fill(x, y) memset(x, y, sizeof(x))
#define ceil(a, b) a / b + !!(a % b)
template<class T> T power_mod(T a, T b) {return b ? power(a * a % inf, b / 2) * (b % 2 ? a : 1) % inf : 1;}
template<class T> T power(T a, T b) {return b ? power(a * a, b / 2) * (b % 2 ? a : 1) : 1;}
#define LB(v, x) (int)(lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (int)(upper_bound(v.begin(), v.end(), x) - v.begin())
template<typename T> T gcd(T a, T b) {if (b == 0) return a; return gcd(b, a % b);}
template<typename T> T lcm(T a, T b) {return a / gcd(max(a, b), min(a, b)) * b;} //先に割る!!
#define outa(a, n) rep(i_, n) cout << a[i_] << " "; cout << endl
#define out(a) cout << a << endl
#define outv(v) rep(i, SZ(v)) cout << v[i] << " "; cout << endl
//loop
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep3(i, st, n) for (int i = st; i < n; ++i)
//algorithm
//double pointer, l start, how many adds, can be 0 -> init r = l, sum = 0
//bfs, not x, y, i, j
//not !(i % 2), i % 2 == 0
//minimal required terms
//cast caution
//look constraints always



int main() {
    
    
    
    
    
    int n; cin >> n;
    
    double p[n]; rep(i, n) cin >> p[i];
    
    double dp[3007] = {0};
    
    dp[1] = p[0];
    dp[0] = 1 - p[0];
    double dp2[3007] = {0};
    //outa(dp, n + 1);
    
    rep3(i, 1, n) {
        rep(j, n + 1) dp2[j] = 0;
        rep(j, n) {
            double tmp = dp[j];
            dp2[j + 1] += tmp * p[i];
            
            dp2[j] += tmp * (1 - p[i]);
            
        }
        //outa(dp2, n + 1);
        rep(j, n + 1) dp[j] = dp2[j];
    }
    
    double ans = 0;
    rep3(i, n / 2 + 1, n + 1) {
        ans += dp[i];
    }
    FIX(10);
    out(ans);
    
    
    
    
}



Measured memory_bytes: 256
import sys


def solution(nominals, currency):
    result = 0
    for value, c in zip(nominals, currency):
        if c =="JPY":
            result += value
        else:
            result += 380000.0 * value
    return result



nominals, currencies = [], []
for i,line in enumerate(sys.stdin):
    if i == 0:
        cases = int(line)
    else:
        n, c = line.split(' ')
        nominals.append(float(n))
        currencies.append(c.strip())

print(solution(nominals, currencies))

# print(solution([10000, 0.1], ['JPY', 'BTC']))
# print(solution([100000000 , 100.00000000, 0.00000001 ], ['JPY', 'BTC', 'BTC']))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0, i##_len=(n); i<i##_len; ++i)
#define FOR(i, a, b) for (int i=(a); i<(b); ++i)
using ll = long long;
using namespace std;

int nh[] = {1, -1, 0,  0};
int nw[] = {0,  0, 1, -1};

int main()
{
    int H, W;
    cin >> H >> W;
    string S[H];
    REP(i, H) cin >> S[i];

    int cost[H][W];
    REP(i, H) REP(j, W) cost[i][j] = -1;
    cost[0][0] = 0;
    int gh = H-1;
    int gw = W-1;

    queue<pair<int, int>> que;
    que.push(make_pair(0, 0));

    while (!que.empty())
    {
        pair<int, int> elem = que.front();
        que.pop();

        int h1 = elem.first;
        int w1 = elem.second;

        if (h1 == gh && w1 == gw) break;

        REP(i, 4)
        {
            int h2 = h1+nh[i];
            int w2 = w1+nw[i];
            if (h2 < 0 || h2 >= H) continue;
            if (w2 < 0 || w2 >= W) continue;
            if (cost[h2][w2] >= 0) continue;
            if (S[h2][w2] ==  '#') continue;

            cost[h2][w2] = cost[h1][w1]+1;
            que.push(make_pair(h2, w2));
        }
    }

    if (cost[gh][gw] < 0)
    {
        cout << -1 << endl;
        return 0;
    }

    int ret = 0;
    REP(i, H) REP(j, W) if (S[i][j] == '.') ++ret;
    ret -= cost[gh][gw]+1;

    cout << ret << endl;
    return 0;
}

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

int main(){
	string s;
	cin >> s;
	for(int i = 0; i < s.size();){
		cout << s[i];
		i += 2;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>

int main(void){

  int frag = 1;
  int MAX = 100;
  int R[MAX], n, j, i, count=0;
  int buffa;
  scanf("%d", &n);

  for(i=0;i<n;i++) scanf("%d", &R[i]);

  while(frag==1){
    frag = 0;
    for(j=n-1;j>=1;j--){
      if(R[j] < R[j-1]){
        buffa = R[j];
        R[j] = R[j-1];
        R[j-1] = buffa;
        count =	count + 1;
        frag = 1;
      }
    }
  }
  for(i=0;i<n-1;i++) printf("%d ", R[i]);
  printf("%d\n", R[n-1]);
  printf("%d\n", count);
  return 0;
}



Measured memory_bytes: 2008
#include <iostream>
#include <vector> 

using namespace std;

int main()
{
   int N,i,num,cnt,tmp;
   vector<int> v;
   cin >> N;
   for(i=0;i<N;i++)
   {
    cin >> num;
    v.push_back(num);
   }
    
   cnt=N-1;
    int swap=0;
    for(vector<int>::iterator iter = v.begin();iter != v.end(); iter++)
    {
        for(i=0;i<cnt;i++)
        {
            if(v[i]>v[i+1])
            {
                tmp=v[i];
                v[i]=v[i+1];
                v[i+1]=tmp;
                    swap++;
            }
        }
        cnt--;
   }
    for(vector<int>::iterator iter = v.begin();iter != v.end()-1; iter++)
    {
        cout<<*iter<<' ';
    }
    cout<<v[N-1]<<endl;
    cout<<swap<<endl;
}


Measured memory_bytes: 3148
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
long long n,m;
const int MAX_N = 100000;
long a[MAX_N], b[MAX_N];
pair<long long, long long> p[MAX_N];
long solve(){
    for(int i=0 ; i<n ; i++){
        p[i].first = a[i];
        p[i].second = b[i];
    }
    sort(p, p+n);
    long yen = 0;
    for(int i=0 ; i<n ; i++){
        long t = min(p[i].second, m);
        m -= t;
        yen += p[i].first * t;
        if(m == 0 ) break;
    }
    return yen;
}
int main(){
    cin >> n >> m;
    for(int i=0 ; i<n ; i++){
        cin >> a[i] >> b[i];
    }
    cout << solve() << endl;
    return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    char c;
    cin >> c;
    c++;

    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ret = 0
for a in range(A + 1) :
    for b in range(B + 1) :
        for c in range(C + 1) :
            if 500 * a + 100 * b + 50 * c == X :
                ret += 1
print(ret)

Measured memory_bytes: 39536
n, m = map(int, input().split())
a = []
b = []
for _ in range(n):
  a.append(str(input()))
for _ in range(m):
  b.append(str(input()))
ans = False
for i in range(n-m+1):
  for j in range(n-m+1):
    match = True
    for k in range(m):
      #print(i, j, k, a[i+k][j:j+m], b[k])
      if a[i+k][j:j+m] != b[k]:
        match = False
        break
    if match:
      ans = True
      break
  if ans: break
if ans: print('Yes')
else: print('No')

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;
template <class T> using vec = vector<T>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr ll MOD = 1000000007;

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

int main(int argc, char* argv[]) {
  ll n, m;
  cin >> n >> m;

  if (abs(n - m) >= 2) {
    put(0);
    return 0;
  }

  ll ans = abs(n - m) == 0 ? 2 : 1;
  rep(i, 0, n) { ans = mod(ans * (i + 1), MOD); }
  rep(i, 0, m) { ans = mod(ans * (i + 1), MOD); }
  put(ans);

  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) {
  T c = min(a, b), d = max(a, b);
  return c * (d / gcd(c, d));
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] arg){
        int x, y, i, j;
        Scanner xc = new Scanner(System.in);
        x = xc.nextInt();
        j = 3;
        y = 1;
        for(i = 0; i < j; i++){
            y = y * x;
        }
        System.out.println(y);
    }
}


Measured memory_bytes: 26352
#include <stdio.h>
int main (void)
{
    int i,j,n,ans;
    scanf("%d",&n);
    int h[n];
    for (i = 0; i < n; i++) {
        scanf("%d",&h[i]);
    }
    //入力完了//
    for (i = 0; i < n; i++) {
        for (j = 0; j < i; j ++)    {
            if(h[j] > h[i]) break;
        }
        if(j == i)  ans ++;
    }
    printf("%d",ans);
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)

#define SORT(c) sort((c).begin(),(c).end())
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

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

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

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int hparent(int i){return i/2;}
int hleft(int i){return i*2;}
int hright(int i){return i*2+1;}

int H;
VI A;

void maxHeapify(int i) {
  int L = hleft(i);
  int R = hright(i);
  int largest;
  if (L<=H && A[L] > A[i]) {
    largest = L;
  }else{
    largest = i;
  }
  if (R<=H && A[R] > A[largest]) {
    largest = R;
  }
  if (largest!=i) {
    swap(A[i],A[largest]);
    maxHeapify(largest);
  }
}

void buildMaxHeap() {
  RREP1(i,H/2) maxHeapify(i);
}

int main(int argc, char const *argv[]) {
  cin.tie(0); ios::sync_with_stdio(false);
  int tmp; std::cin >> H; A.reserve(H);
  REP1(i,H){ std::cin >> tmp; A[i] = tmp; }
  buildMaxHeap();
  REP1(i,H){std::cout<< " " << A[i];}
  std::cout << '\n';
  return 0;
}



Measured memory_bytes: 4580
import javax.swing.plaf.synth.SynthEditorPaneUI;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        long k = sc.nextLong();
        int[]a = new int[n];
        for (int i =0;i<n;i++){
            a[i]=sc.nextInt()-1;
        }
        int[]c= new int[n];
        Arrays.fill(c,-1);
        int s =0;
        int cur =0;
        while (k>0){
            if (c[s]==-1){
                c[s]=cur++;
                s=a[s];
                k--;
            }
            else {
                k%=(cur-c[s]);
                cur++;
                if (k>0){
                    s=a[s];
                    k--;
                }
            }
        }
        pw.println(s+1);
        pw.flush();
    }
    static long gcd(long a,long b){
        if (a==0)
            return b;
        return gcd(b%a,a);
    }
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public int[] nextIntarr(int n)throws Exception{
            int[]a = new int[n];
            for (int i =0;i<n;i++)
                a[i]=nextInt();
            return a;
        }
        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}

Measured memory_bytes: 54176
#include<iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <functional>
#include <vector>

using namespace std;
int main()
{
	int A, B, C = 0;
	int Ans = 0;

	cin >> A;
	cin >> B;

	if (A <= 8 && B <= 8) {
		cout << "Yay!";
	}
	else { cout << ":("; }

	return 0;
}

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

using namespace std;

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

    int a, b;
    cin >> a >> b;
    for (int i = (25 * a + 1) / 2; i <= (25 * (a + 1) / 2); i++) {
        for (int j = 10 * b; j < 10 * (b + 1); j++) {
            if (i == j && 2 * i / 25 == a && j / 10 == b) {
                cout << i << '\n';
                return 0;
            }
        }
    }
    cout << -1 << '\n';
    return 0;
}

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

using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ll = long long int;
using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using cdouble = complex<double>;

const double INFD = numeric_limits<double>::infinity();
const double PI = 3.14159265358979323846;
#define Loop(i, n) for(int i = 0; i < (int)(n); i++)
#define Loop1(i, n) for(int i = 1; i <= (int)(n); i++)
#define Loopr(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)(n); i >= 1; i--)
#define Foreach(buf, container) for(auto buf : container)
#define Loopdiag(i, j, h, w, sum) for(int i = ((sum) >= (h) ? (h) - 1 : (sum)), j = (sum) - i; i >= 0 && j < (w); i--, j++)
#define Loopdiagr(i, j, h, w, sum) for(int j = ((sum) >= (w) ? (w) - 1 : (sum)), i = (sum) - j; j >= 0 && i < (h); j--, i++)
#define Loopdiagsym(i, j, h, w, gap) for (int i = ((gap) >= 0 ? (gap) : 0), j = i - (gap); i < (h) && j < (w); i++, j++)
#define Loopdiagsymr(i, j, h, w, gap) for (int i = ((gap) > (h) - (w) - 1 ? (h) - 1 : (w) - 1 + (gap)), j = i - (gap); i >= 0 && j >= 0; i--, j--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(ex_i, vector.size()) { cout << vector[ex_i] << " "; } cout << endl;
#define printmx(matrix) Loop(ex_i, matrix.size()) { Loop(ex_j, matrix[ex_i].size()) { cout << matrix[ex_i][ex_j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
#define Comp(type_t) bool operator<(const type_t &another) const
#define fst first
#define snd second
bool nearlyeq(double x, double y) { return abs(x - y) < 1e-9; }
bool inrange(int x, int t) { return x >= 0 && x < t; }
bool inrange(vi xs, int t) { Foreach(x, xs) if (!(x >= 0 && x < t)) return false; return true; }
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (m * m <= x ? 0 : -1); }
ll ceilsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }
ll gcd(ll m, ll n) { if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

/*******************************************************/

int main() {
	int n; cin >> n;
	vector<pair<ll, int>> a(n);
	Loop(i, n) {
		cin >> a[i].fst;
		a[i].snd = i;
	}
	sort(a.begin(), a.end());
	int cnt = 0;
	Loop(i, n) {
		if (i % 2 == 0 && a[i].snd % 2 == 1) cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>

using namespace std;

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

  cin >> N >> M;

  vector<int> f(M);

  for (int i = 0; i < N; ++i) {
    int K;
    cin >> K;
    for (int j = 0; j < K; ++j) {
      int a;
      cin >> a;
      ++f[a - 1];
    }
  }

  int res = 0;
  for (int i = 0; i < M; ++i) {
    if (f[i] == N)
      ++res;
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 256
from collections import deque

h, w = map(int, input().split())
board = [list(input().strip()) for i in range(h)]

check = [[False] * w for i in range(h)]

ans = 0
q = deque()
q.append((0, 0, 0))
while len(q) > 0:
    x, y, step = q.popleft()
    if x == w-1 and y == h-1:
        ans = step
        break
    for n_x, n_y in [(x-1, y), (x+1, y), (x, y-1), (x, y+1)]:
        if 0 <= n_x and n_x < w and 0 <= n_y and n_y < h:
            if board[n_y][n_x] == "." and not check[n_y][n_x]:
                q.append((n_x, n_y, step+1))
                check[n_y][n_x] = True

if ans != 0:
    air = 0
    for y in range(h):
        for x in range(w):
            if board[y][x] == ".":
                air += 1
    print(air - ans - 1)
else:
    print(-1)


Measured memory_bytes: 3316
#include<iostream>
using namespace std;
int main(){
int i,n,k,j;
cin >> n;
for(i=0;i<n;i++){
for(j=0;j<n;j++){
  if(4*i+7*j==n){
  cout<<"Yes"<<endl;
    return 0;
  }
}
}
  cout <<"No"<<endl;
  return 0;
}

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

int main() {
  string c;
  cin >> c;
  
  if (c == "a" || c == "e" || c == "i" || c == "o" || c == "u") {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
  
  
}


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

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

  vector<int> p(N);
  rep(i,0,N-1) cin >> p[i];

  int ans = 0;
  rep(i,0,N-1) {
    if (i == p[i] - 1) {
      ans++;
      if (i + 1 == p[i + 1] - 1) {
        i++;
      }
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3796
#include"bits/stdc++.h"
using namespace std;

int main(){
    int h;
    cin >> h;
    bool flag;
    int left;
    int right;
    int ans;
    while (h!=0){
        vector<vector<int>> color(h, vector<int>(5));
        for (int i = 0; i<h; i++){
            for (int j = 0; j<5; j++) cin >> color[i][j];
        }
        ans = 0;
        while (1){
            flag = false;
            for (int i = 0; i<h; i++){
                left = 2;
                right = 2;
                for (int j = 1; j<3; j++){
                    if (color[i][2]!=0 && color[i][2]==color[i][2+j]) right++;
                    else break;
                }
                for (int j = 1; j<3; j++){
                    if (color[i][2]!=0 && color[i][2]==color[i][2-j]) left--;
                    else break;
                }
                if (right - left >= 2){
                    flag = true;
                    ans += color[i][2]*(right - left + 1);
                    for (int j = left; j <= right; j++) color[i][j] = 0;
                }
            }
            if (!flag) break;
            for (int i = 0; i<5; i++){
                for (int j = h-1; j>=0; j--){
                    if (j+1 < h && color[j+1][i]==0 && color[j][i]!=0){
                        color[j+1][i] = color[j][i];
                        color[j][i] = 0;
                        j+=2;
                    }
                }
            }
        }
        cout << ans << endl;
        cin >> h;
    }
}



Measured memory_bytes: 3152
#include<iostream>
#include<map>
using namespace std;
int n,ans;
string s;
map<string,int> data;
int main()
{
	cin>>n;
	for(int i=1; i<=n; i++)
	{
		cin>>s;
		if(!data[s])
		{
			data[s]=1;
			ans++;
		}
		else
		{
			data[s]=0;
			ans--;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 12544
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, A, B = MAP()

print(N*A if N*A < B else B)

Measured memory_bytes: 61676
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int m = 1000000007;
int dp[100005];
int32_t main()
{
    IOS;
    memset(dp,m,sizeof(dp));
    int n,w;
    cin>>n>>w;
    int arr[n][2];
    dp[0]=0;
    int ans=-1;
    for(int i=0;i<n;i++)
        cin>>arr[i][0]>>arr[i][1];
    for(int i=0;i<n;i++)
    {
        for(int j=1e5;j>=arr[i][1];j--)
        {
            dp[j]=min(dp[j-arr[i][1]]+arr[i][0],dp[j]);
        }
    }
    for(int i=0;i<=1e5;i++)
        {
            if(dp[i]<=w)
            ans=i;
        }
    cout<<ans<<endl;
}


Measured memory_bytes: 1152
#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);
  }
  int min=A.at(0),Max=A.at(0);
  for(int i=1; i<N;i++){
    if(min >A.at(i)){
      min =A.at(i);
    }
    
    if(Max <A.at(i)){
      Max=A.at(i);
    }
  }
  cout<< Max-min <<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  vector<int> abc(3); REP(i, 3) cin >> abc[i];
  sort(ALL(abc));
  cout << (abc[0] == 5 && abc[1] == 5 && abc[2] == 7 ? "YES\n" : "NO\n");
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int tot = 0;
		for(int i=0;i<N;i++) tot += (L + i);
		
		int ans = 0;
		int diff = (int) 1e9;
		for(int i=0;i<N;i++){
			int rest = tot - (L + i);
			if(diff > Math.Abs(rest - tot)){
				ans = rest;
				diff = Math.Abs(rest - tot);
			}
		}
		Console.WriteLine(ans);
		
		
	}
	int N,L;
	public Sol(){
		var d = ria();
		N = d[0]; L = d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define ELEM(array)  (sizeof (array) / sizeof *(array))
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;


int main(){
    string s;
    cin>>s;
    int a=0,b=0;
    rep(i,s.size()){
        s[i]=='1' ? a++:b++;
    }
    cout<<min(a,b)*2;
    return 0;
}

Measured memory_bytes: 512
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>

using namespace std;

template<typename T>
T absi(T x) {
    if (x < static_cast<T>(0)) {
        x *= static_cast<T>(-1);
    }
    return x;
}


struct Pos {
    int i;
    int j;
};

int distanse(const Pos& a, const Pos& b)
{
    return absi(a.i - b.i) + absi(a.j - b.j);
}

int main()
{
    int H, W, D;
    std::cin >> H >> W >> D;

    std::unordered_map<int, Pos> m;

    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            int a;
            std::cin >> a;
            m[a] = Pos{i, j};
        }
    }

    std::vector<int> dists(H*W+1);

    for (int i = D+1; i <= H*W; ++i) {
        dists[i] = dists[i-D] + distanse(m[i-D], m[i]);
    }

    int Q;
    std::cin >> Q;

    for (int k = 0; k < Q; ++k) {
        // 1 <= l, r <= 300
        int l, r;
        std::cin >> l >> r;

        auto d = dists[r] - dists[l];
        std::cout << d << std::endl;
    }

    return 0;
}


Measured memory_bytes: 5284
open System
let R T = stdin.ReadLine()|> T
let RS T = stdin.ReadLine().Split()|>Array.map T
let R2 T U = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U)
let R3 T U V = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U),(c.[2]|>V)
let R4 T U V W = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U),(c.[2]|>V),(c.[3]|>W)
let R5 T U V W X = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U),(c.[2]|>V),(c.[3]|>W),(c.[4]|>X)
let outl s = stdout.WriteLine(s|>string)
let outsep ls = stdout.WriteLine(String.concat " " (ls|>Array.map string))
let outsepl ls = stdout.WriteLine(String.concat "\n" (ls|>Array.map string))
let Mod = (1e9|>int64)+7L
[<EntryPoint>]
let main argv =
    let S,T=R2 string string
    let A,B=R2 int int
    let U=R string
    if S=U then [|A-1;B|] else [|A;B-1|]
    |>outsep
    0
    

Measured memory_bytes: 11348
#include <cstdio>

int main(){
    int A,B,C,X;
    int count=0;
    scanf("%d%d%d%d",&A,&B,&C,&X);
    for(int i=0;i<=A;i++){
        for(int j=0;j<=B;j++){
            for(int k=0;k<=C;k++){
                if(i*500+j*100+k*50==X)
                    count++;
                
            }
        }
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 128