akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
 int a,b,c;
  cin>>a>>b>>c;
  
  int count=1;
  
  if(a!=b){
    count++;
  }
  if(a!=c&&b!=c){
    count++;
  }
  
  cout<<count<<endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(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 = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;

/* --------------------------------------------------- */

int main() {
    int n;
    cin >> n;
    vector<int> L(n);
    rep(i, n) cin >> L[i];
    int ans = 0;
    rep(i, n) {
        forr(j, i + 1, n) {
            forr(k, j + 1, n) {
                if(L[i] != L[j] && L[i] != L[k] && L[j] != L[k]) {
                    if(L[i] + L[j] > L[k] && L[i] + L[k] > L[j] && L[j] + L[k] > L[i]) ans++;
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3600
#include <cstdio>
using namespace std;

int main(){
    char c[4][4];
    for(int i = 0; i < 3; i++){
        scanf("%s", &c[i]);
    }
    printf("%c%c%c\n",c[0][0],c[1][1],c[2][2]);
    return 0;
}


Measured memory_bytes: 128
s = input()
n = len(s)

ans = ""
i = 0
for _ in range(n):
    if i > n or ans == s: break
    if s[i:i+5] == "erase":
        i += 5
        ans += "erase"
        if s[i:i+1] == "r":
            i += 1
            ans += "r"
    elif s[i:i+5] == "dream":
        i += 5
        ans += "dream"
        if s[i:i+3] == "era": continue
        elif s[i:i+2] == "er":
            i += 2
            ans += "er"
print("YES" if ans == s else "NO")

Measured memory_bytes: 9340
from operator import mul
from functools import reduce

def cmb(n, r):
    r = min(n - r, r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under % (10 ** 9 + 7)

N, K = map(int, input().split())
for i in range(K):
    if N-K+1 >= i + 1 and K-1 >= i:
        # a = factorial(N-K+1) / factorial(i+1) / factorial(N-K+1 - (i+1))
        a = cmb(N-K+1, i + 1)
        # b = factorial(K-1) / factorial(i) / factorial(K-1 - i)
        b = cmb(K-1, i)
        print((a*b) % (10**9+7))
    else:
        print(0)

Measured memory_bytes: 44508
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int main(){
  int n,k,i,j,r;
  long long a[18];
  long long b[18];
  long long sum;
  long long max = -9999;
  long long maxnow;
  int cnt;
  int use[18];
  int f;
  long long min = 99999999999;

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

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

  for(i = 0;i < (1 << n);i++){
    sum = 0;
    for(j = 0;j < n;j++){
      use[j] = 0;
      b[j] = a[j];
    }
    cnt = 0;

    for(j = 0;j < n;j++){
      if((i >> j) & 1){
        cnt++;
        use[j] = 1;
      }
    }

    if(cnt != k) continue;

    maxnow = -9999;
    for(j = 0;j < n;j++){
      if(use[j] == 1){
        for(r = j;r >= 0;r--){
          if(b[r] > maxnow) maxnow = b[r];
        }

        sum += maxnow - b[j];
        b[j] = maxnow;
        maxnow++;
      }
    }

    if(min > sum) min = sum;
  }

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

  return 0;
}

Measured memory_bytes: 128
n, *a = map(int, open(0).read().split())

status = 0
cnt = 1
for i in range(n - 1):
    #print(a[i], status)
    # neutral&break:0 <:1 >:2 
    if a[i] == a[i + 1]:
        #print('==')
        continue
    elif a[i] < a[i + 1]:
        if status == 0 or status == 1:
            #print('con<')
            status = 1
            continue
        else:
            #print('break&<')
            status = 0
            cnt += 1
    else:
        if status == 0 or status == 2:
            #print('con>')
            status = 2
            continue
        else:
            #print('break&>')
            status = 0
            cnt += 1

print(cnt)

Measured memory_bytes: 14052
from bisect import bisect_left

n, k = map(int, input().split())
x = list(map(int, input().split()))
if 0 in x:
    x.remove(0)
    k -= 1
    n -= 1

if n == 0:
    print(0)
else:
    si = bisect_left(x, 0)

    ans = (x[-1] - x[0]) * 2
    if si + k - 1 < len(x):
        ans = min(ans, x[si + k - 1])
    if si - k >= 0:
        ans = min(ans, abs(x[si - k]))

    for i in range(n):
        tmp_ans = 0
        if i < si and i + k -1 < len(x):
            tmp_ans = abs(x[i]) * 2 + x[i + k - 1]
            ans = min(ans, tmp_ans)
        elif i >= si and i - k + 1 >= 0:
            tmp_ans = x[i] * 2 + abs(x[i - k + 1])
            ans = min(ans, tmp_ans)

    print(ans)


Measured memory_bytes: 14548
N = int(input())
import math
if N == 1:
    print(1)
else:
    for a in reversed(range(1, (int(math.sqrt(N)))+1)):
        if N % a == 0:
            b = N/a
            ans=max(len(str(int(a))), len(str(int(b))))
            break
    print(ans)



Measured memory_bytes: 9092
#!/usr/bin/env python


def main():
    s = input().strip()
    k = int(input().strip())

    # 1桁目が、1以外のときは、1桁目を表示
    if s[0] != '1':
        print(s[0])
        return

    count_one = 0
    for c in s:
        if c == '1':
            count_one += 1
        else:
            break

    if k <= count_one:
        print(1)
    else:
        print(s[count_one])


main()


Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <math.h>

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

typedef int long long ill;
typedef int long il;

using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin>>a>>b>>c;
    if((a==7&&b==5&&c==5)||(a==5&&b==7&&c==5)||(a==5&&b==5&&c==7)){
        cout<<"YES\n";
    }else{
        cout<<"NO\n";
    }
    return 0;
}

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

class Progaram
{
    static void Main(string[] args)
    {
        var w = Console.ReadLine().ToCharArray();
        var al = new int[26];

        //a (97) ~ z (122)
        foreach (var i in w) al[(int)i - 97]++;
        foreach (var i in al.Select(x => x % 2).ToList()) if (i != 0)
            {
                Console.WriteLine("No");
                return;
            }
        Console.WriteLine("Yes");
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    string s;
    cin >> s;
    map<char,bool> M;
    REP(i,s.size()){
        M[s[i]] = 1;
    }
    if ((M['E']^M['W']) == 0 && (M['S']^M['N']) == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 764
N = int(input())
T, A = map(int,input().split())
H = list(map(int,input().split()))

minimum = 10000000
ans = 100000000
for n in range (N):
    A_now = T-H[n]*0.006
    if minimum >= abs(A_now - A):
        minimum = abs(A_now - A)
        ans = n +1
print(ans)

Measured memory_bytes: 3064
import java.util.*;
public class Main{
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     long  x = sc.nextLong();
     int i=0;
     long money=100;
     while(money<x){
       i++;
       money += money/100;
     }
     System.out.println(i);
   }
}


Measured memory_bytes: 35868
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
#define int long long
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }

using ll = long long;
const ll mod = LLONG_MAX;


vector<int> G[100010];
int d[100010];
int color[100010];
bool dfs(int s,int c){
  int esize=G[s].size();
  d[s]=c;
  rep(i,esize){
    if(d[G[s][i]]==-1){
      int ret=dfs(G[s][i],1-c);
      if(ret==0)return 0;
    }
    else if(d[G[s][i]]==c)return 0;
  }
  return 1;
}


signed main(){
  int N,M;
  int a,b;
  cin>>N>>M;
  rep(i,M){
    cin>>a>>b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  memset(d,-1,sizeof(d));
  if(dfs(0,0)){
    dump(1);
    int rin=0,ren=0;
    rep(i,N)
    {
      if(d[i]==1)rin++;
      else ren++;
    }

    cout<<rin*ren-M<<endl;
  }else{
    dump(0);
    cout<<N*(N-1)/2-M<<endl;
  }



}


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

int main(){
    int N;
    cin >> N;
    vector<int> B(N-1);
    for(int i=0;i<N-1;i++) cin >> B[i];
    int ans = B[0]+B[N-2];
    for(int i=N-3;i>=0;i--){
        ans += min(B[i],B[i+1]);
    }
    cout << ans << endl;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
typedef long long LL;

void test_case(){
    
}

int main() {
    fastio
    LL a, b, k;
    cin >> a >> b >> k;
    if(k<= a){
        cout<<a-k<<' '<<b;
    }
    else
        cout<<0<<' '<<max((LL)0, b-(k-a))<<endl;
	return 0;
}






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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

    ll a, b;cin >> a >> b;
    for(ll i = b + 1;i < a + b;i++){
        ll x = 1 + (i % b);
        ll y = (i / a) + (i % a);
        if(x > y){
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;

	return 0;
}



Measured memory_bytes: 3200
N,W = map(int,input().split())
dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1,N+1):
    w,v = map(int,input().split())
    for j in range(W+1):
        if j < w:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j],dp[i-1][j-w]+v)
print(dp[N][W])


Measured memory_bytes: 173448
import math

a,b,x = list(map(int,input().split()))

theta = math.degrees(math.atan(a*b*b/2/x))

if(b/math.tan(math.radians(theta)) > a):
    theta = math.degrees(math.atan((2*a*a*b-2*x)/a/a/a))


print('{:.7f}'.format(theta))



Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>

using namespace std;

typedef long long ll;

int A[50], n;
ll dp[50][50][100];

ll give(int i, int j, int k) {
    if(k < 0) return 0;
    if(i > j) return 0;
    vector <int> vi;
    
    for(int l = 0; l < i; ++l)
        vi.push_back(A[l]);
    for(int r = j + 1; r < n; ++r)
        vi.push_back(A[r]);
    ll mx = 0;
    sort(vi.begin(), vi.end());
    for(int l = 0; l < vi.size() && l <= k && vi[l] < 0; ++l)
        mx -= vi[l];
    
    return mx;
}

ll take(int i, int j, int k) {
    if(k < 0) return 0;
    if(i > j) return 0;
    if(dp[i][j][k] != -1) return dp[i][j][k];
    ll mx = 0;
    mx = max({ mx,
        A[i] + take(i + 1, j, k - 1),
        A[j] + take(i, j - 1, k - 1),
        give(i, j, k)
    });

    return dp[i][j][k] = mx;
}

int main() {
    int k; cin >> n >> k;
    for(int i = 0; i < n; ++i)
        cin >> A[i];
    memset(dp, -1, sizeof dp);
    
    cout << take(0, n - 1, k - 1);
    
    return 0;
}

Measured memory_bytes: 2176
n, k = map(int, input().split())
s = input()

part1 = s[:k - 1]
part2 = s[k - 1].lower()
part3 = s[k:]

# print(f'{part1}{part2}{part3}')
print('{part1}{part2}{part3}'.format(part1=part1, part2=part2, part3=part3))


Measured memory_bytes: 2940
N = int(input())
F = []
for _ in range(N):
    lst = input().split()
    F.append(''.join(lst))
P = []
for _ in range(N):
    P.append(tuple(map(int, input().split())))
ans = -10**12
for bit in range(1, 1 << 10):
    temp = 0
    for i, f in enumerate(F):
        f_dec = int(f, 2)
        both_open = f_dec & bit
        c = format(both_open, 'b').count('1')
        temp += P[i][c]
    ans = max(ans, temp)
print(ans)

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

int main(){
    long long b,c,n,m,k1,l,o=0,max=0;
    cin>>n;
    long long a[n];
    for (int i=0; i<n; i++) {
        cin>>a[i];
    }
    sort(a, a+n);
    for (int i=0; i<n-1; i++) {
        if (a[i]!=0) {
            b=a[i];
            c=a[i+1];
            a[i]=c%b;
            a[i+1]=b;
            i--;
        }
    }
    cout<<a[n-1]<<endl;
}


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

#define MAX 100001

int main(){
    int N; cin >> N;
    int a;
    int col[10];
    for(int i = 0; i < 10; i++) col[i] = 0;
    for(int i = 0; i < N; i++){
        cin >> a;
        int num = a/400;
        if(num >= 8) num = 8;
        col[num]++;
    }

    int s = 0;
    for(int i = 0; i < 8; i++){
        if(col[i] > 0) s++;
    }

    if(s == 0) cout << s+1;
    else cout << s ;
    cout << " " << s+col[8] << endl;;

}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define ic_a int a;cin>>a;
#define ic_b int b;cin>>b;
#define ic_s string s;cin>>s;
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000

using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
typedef long double ld;
const ld eps = 1.0e-10; // 許容される誤差
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int keta(int n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10; n /= 10;
	}
	return sum;//Nanashi,tRue,wai
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */
ld mysqrtl(ld x)
{
	ld a = sqrtl((double)x); // 近似値
	do {
		a = (a + x / a) / 2.0L;
	} while (fabsl(x - a * a) > eps);
	return a;
}
//平方根を求める。sqrtより精度が高い。
//epsを変えて誤差を調整する。
int main(void) {
	Rapid_pleaseAC_fast;
	llint ans=0, n=0,m,count,sum=0,ch=0;
	llint na=0, nb=0;
	bool check = false;
	vector<llint> a;
	cin >> n>>m;
	ans = n % m;
	count = (ans - m) * -1;
	cout << min(ans, count) << endl;
	please AC;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
//#undef LOCAL
#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#ifdef LOCAL
struct PrettyOS {
    ostream& os;
    bool first;
    template <class T> auto operator<<(T&& x) {
        if (!first) os << ", ";
        first = false;
        os << x;
        return *this;
    }
};
template <class... T> void dbg0(T&&... t) {
    (PrettyOS{cerr, true} << ... << t);
}
#define dbg(...)                                            \
    do {                                                    \
        cerr << __LINE__ << " : " << #__VA_ARGS__ << " = "; \
        dbg0(__VA_ARGS__);                                  \
        cerr << endl;                                       \
    } while (false);
#else
#define dbg(...)
#endif

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << "P(" << p.first << ", " << p.second << ")";
}

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    for (auto d : v) os << d << ", ";
    return os << "]";
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n;
    cin >> n;

    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            int di = i ^ j;
            int lv = 0;
            while (!(di & (1 << lv))) lv++;
            cout << lv + 1 << " ";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll h,w,m;
    cin>>h>>w>>m;
   
    ll r[h]={0};
    ll c[w]={0};
    ll e=0;
    ll f=0;
    vector<pair<ll,ll>>v;
    for(ll i=0;i<m;i++)
    {
        ll x,y;
        cin>>x>>y;
        x--;
        y--;
        
        r[x]++;
        c[y]++;
        e=max(e,r[x]);
        f=max(f,c[y]);
        v.push_back(make_pair(x,y));
    }
   
    ll c1=0,r1=0;
    for(ll i=0;i<h;i++)
    {
        if(r[i]==e)
        {
            r1++;
        }
    }
     for(ll i=0;i<w;i++)
    {
        if(c[i]==f)
        {
            c1++;
        }
    }
    ll ans=r1*c1;
    
    for(unsigned long long int i=0;i<v.size();i++)
    {
        ll p=v[i].first;
        ll q=v[i].second;
        if(r[p]==e && c[q]==f)
        {
            ans--;
        }
    }
    
    if(ans>0)
    {
        cout<<(e+f)<<endl;
    }
    else
    {
        cout<<e+f-1<<endl;
    }
    
	return 0;
}


Measured memory_bytes: 16284
N = int(input())
A = list(map(int,input().split()))
money = 1000
stock = 0
for i in range(N-1):
    if A[i] > A[i+1]:
        money += A[i]*stock
        stock = 0
    elif A[i] < A[i+1]:
        stock += money//A[i]
        money = money%A[i]
money += stock*A[-1]
print(money)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a,b;
  cin>>a>>b;
  if(a%b==0)cout<<0;
  else cout<<1;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    
    int n;
    cin >> n;
    int a,b;
    int i=1;
    for (a=0;a<26;a++){
        for(b=0;b<15;b++){
            if(a*4+b*7==n)
            {
                cout <<"Yes"<<endl;
                i=0;
                break;
            }
            
        }
        if(i==0) break;
    }
    if(i) cout <<"No"<<endl;
}

Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	int a, b, c, n;
	string s, s1, s2, s3;
	cin >> s;
	cout << s[0] << s.length() - 2 << s[s.length() - 1] << endl;


	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int n, a, ans[200010] = {0};
    scanf("%d", &n);
    for (int i = 1; i < n; i++)
    {
        scanf("%d", &a);
        ans[a - 1]++;
    }

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

    return 0;
}

Measured memory_bytes: 2456
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

int main(){
    string s;
    cin >> s;
    if(s[0]==s[1] and s[1]==s[2]){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll int
#define sort(v) sort(v.begin(),v.end())
#define pb push_back

/*ll ar[1000000+9]={0};
void seiv()
{
ll n=1000000,i,j;
ar[1]=1;
for(i=4;i<=n;i+=2)ar[i]=1;
for(i=3;i<=n;i+=2)
{
if(ar[i]==0)
{
for(j=i*i;j<=n;j+=i*2)ar[j]=1;
}
}
}
*/
int main()
{
  ll a,b,c,i,j,k=0;map<string,ll>m,n;
 string s;
    cin>>a>>s;
    for(i=0;i+1<s.size();i++)
   {
if(s[i]!=s[i+1])k++;
   }cout<<k+1<<endl;
 }

Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a=0,b=0,c=0,d=0,area1=0,area2=0;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    area1=a*b;
    area2=c*d;
    if(area1>area2)
      printf("%d",area1);
    else
	printf("%d",area2);  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

ll dp[105][2][5];

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

    int n;
    ll k;
    cin >> n >> k;
    vector<ll> Negative, Positive;
    int ZeroCnt = 0;
    for(int i = 0; i < n; ++i){
        int a;
        cin >> a;
        if(a == 0)  ++ZeroCnt;
        else if(a < 0)  Negative.emplace_back(-a);
        else    Positive.emplace_back(a);
    }
    sort(Negative.begin(), Negative.end());
    sort(Positive.begin(), Positive.end());

    int PositiveCnt = Positive.size();
    int NegativeCnt = Negative.size();
    ll bound = (ll)PositiveCnt * NegativeCnt;
    ll zero = (ll)ZeroCnt * (ZeroCnt - 1) / 2;
    zero += (ll)ZeroCnt * (PositiveCnt + NegativeCnt);
    if(bound < k && k <= bound + zero){
        cout << 0 << endl;
        return 0;
    }
    
    ll ans;
    if(k <= bound){
        auto check = [&](ll x) -> bool {
            ll res = 0;
            for(ll val : Positive){
                ll val2 = x / val;
                if(x % val != 0)    ++val2;
                res += Negative.end() - lower_bound(Negative.begin(), Negative.end(), val2);
            }
            return res >= k;
        };
        ll lb = 1, ub = 1e+18;
        while(ub - lb > 1){
            ll mid = (lb + ub) >> 1;
            if(check(mid))  lb = mid;
            else    ub = mid;
        }
        ans = -lb;
    }
    else{
        k -= bound + zero;
        auto check = [&](ll x) -> bool {
            ll res = 0;
            for(int i = 0; i < PositiveCnt - 1; ++i){
                ll val = Positive[i];
                res += upper_bound(Positive.begin() + i + 1, Positive.end(), x / val) - (Positive.begin() + i + 1);
            }
            for(int i = 0; i < NegativeCnt - 1; ++i){
                ll val = Negative[i];
                res += upper_bound(Negative.begin() + i + 1, Negative.end(), x / val) - (Negative.begin() + i + 1);
            }
            return res >= k;
        };
        ll lb = 0, ub = 1e+18;
        while(ub - lb > 1){
            ll mid = (lb + ub) >> 1;
            if(check(mid))  ub = mid;
            else    lb = mid;
        }
        ans = ub;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2420
/*
Problem Number: ABC177B
Problem Name: Substring
Notes: 
*/

#include <bits/stdc++.h>
#define endl "\n"

using namespace std;

int main(){
    cin.tie(0) -> sync_with_stdio(0);
    
    string S, T;
    cin >> S >> T;
    
    int mn = T.size();
    for(int i = 0; i < S.size() - T.size() + 1; i++){
        int cost = 0;
        for(int j = 0; j < T.size(); j++)
            cost += S[i+j] != T[j];
        mn = min(mn, cost);
    }
    cout << mn << endl;

    return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Tue Sep  1 20:36:57 JST 2020
 **/

signed main() {
    Int H, W;
    std::cin >> H >> W;
    std::map<Int, Int> mp;
    std::multiset<Int> s;
    REP(j, W) mp[j] = j, s.insert(0);
    REP(i, H) {
        Int l, r;
        std::cin >> l >> r, l--;
        Int x = -1;
        auto it = mp.lower_bound(l);
        while (it != mp.end() && it->first <= r) {
            x = it->second;
            s.erase(s.find(it->first - it->second));
            mp.erase(it++);
        }
        if (r != W && x != -1) mp[r] = x, s.insert(r - x);
        std::cout << (s.size() ? i + 1 + *s.begin() : -1) << "\n";
    }
}


Measured memory_bytes: 25484
n=int(input())
a=[int(input()) for _ in range(n)]
#print(a)
s=sorted(a,reverse=True)
max_1=s[0]
max_2=s[1]
#print(s)
for i in range(n):
    if a[i]==max_1:
        print(max_2)
    else:
        print(max_1)

Measured memory_bytes: 14112
#include <bits/stdc++.h>
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class T> using ordered_multiset = tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

typedef long long  ll;
typedef unsigned long long  ull;
typedef long double ld;
#define lp(i,n)      for(int i=0;i<n;i++)
#define lpi(i,j,n)   for(int i=j;i<n;i++)
#define lpd(i,j,n)   for(int i=j;i>=n;i--)
#define MP           make_pair
#define clr(v, d)    (memset(v, d, sizeof(v)))
#define all(v)     (v.begin()),(v.end())
#define N 100005
const double pi = acos(-1);

ll n,t,m,k;

ll ans;
ll mod = 1e9 +7;

bool f[105][15];
ll p[105][15];


int main() {
 
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
// freopen("e.txt","r",stdin); 
// freopen("e_out.txt","w",stdout); 
cout.precision(10);

cin>>n;
lp(i,n){
  lp(j,10)cin>>f[i][j];
}
lp(i,n){
  lp(j,11)cin>>p[i][j];
}
ans=-1e18;
for(int i=1;i<(1<<10);i++){
  ll temp=0;
  
  for(int j=0;j<n;j++){
    int cnt=0;
    lp(z,10){
      cnt += (f[j][z] && (i&(1<<z) ));
    }
    temp += p[j][cnt];
  }
  ans = max(ans,temp);
}
cout<<ans;






  
}
  
 



// bool isPrime(ll h){
//      for(ll i=0;primes[i]*primes[i]<= h;i++)
//      if (h%primes[i]==0)
//      	return 0;
//      return h!=1;
//  }
 bool isPrime(ll g){
   if((g%2==0 && g>2) || g==1)return 0;
   for(ll i=3;i*i<=g;i+=2)if(g%i==0)return 0;
   return 1;   
 
 }

Measured memory_bytes: 3616
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <deque>
#include <string>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    scanVecInt(A, N);
    unordered_map<int, int> count;
    loop(i, N){
        ++count[A[i] - 1];
        ++count[A[i]];
        ++count[A[i] + 1];
    }
    int result = 0;
    for (auto& elem : count){
        result = max(result, elem.second);
    }
    printf("%d\n", result);
}


Measured memory_bytes: 4644
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

vector<int> ch[301];
map<string,int> mp;
vector<int> G[301];
int siz=0;
int type[301];
int dp[301][301];
set<int> se[301];
int cnt[301],all[301];
bool flag[301][301];


typedef string::const_iterator State;
int expression(State &begin);

string tostring(int v){
	if(v==0)return "0";
	string s;
	while(v>0){
		s+=((v%10)+'0');
		v/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}

int expression(State &begin){
	int cur=siz;
	if(*begin=='('){
		begin++;
		siz++;
		int ret=expression(begin);
		begin++;
		siz++;
		int ret2=expression(begin);
		G[cur].push_back(ret);
		G[cur].push_back(ret2);
		begin++;
		return cur;
	}else if(*begin=='x'){
		begin++;
		return siz;
	}else{
		assert(false);
	}
}

int check(int v1,int v2){
	if(v1==v2)return 0;
	if(v1==0)return -1;
	if(v2==0)return 1;
	if(cnt[v1]*all[v2]!=cnt[v2]*all[v1]){
		if(cnt[v1]*all[v2]<cnt[v2]*all[v1])return -1;
		return 1;
	}
	
	//printf("ch %d %d %d %d\n",v1,v2,ch[v1][0],ch[v2][0]);
	if(flag[v1][v2])return dp[v1][v2];
	flag[v1][v2]=true;
	int res=check(ch[v1][0],ch[v2][0]);
	//printf("ch %d %d %d %d %d\n",v1,v2,ch[v1][0],ch[v2][0],res);
	if(res==-1){
		dp[v1][v2]=-1;
		return res;
	}else if(res==1){
		dp[v1][v2]=1;
		return res;
	}
	res=check(ch[v1][1],ch[v2][1]);
	//printf("ch %d %d %d %d %d\n",v1,v2,ch[v1][1],ch[v2][1],res);
	dp[v1][v2]=res;
	return res;
}

int dfs(int v){
	if(G[v].size()==0){
		type[v]=mp["0"];
	}else{
		int v1=dfs(G[v][0]);
		int v2=dfs(G[v][1]);
		if(v1>v2)swap(v1,v2);
		string vs="("+tostring(v1)+","+tostring(v2)+")";
		if(mp.find(vs)==mp.end()){
			int id=mp.size();
			mp[vs]=id;
			ch[id].push_back(v1);
			ch[id].push_back(v2);
			if(check(ch[id][0],ch[id][1])==1){
				swap(ch[id][0],ch[id][1]);
			}
			se[id].insert(id);
			for(set<int>::iterator it=se[v1].begin();it!=se[v1].end();it++){
				se[id].insert(*it);
			}
			for(set<int>::iterator it=se[v2].begin();it!=se[v2].end();it++){
				se[id].insert(*it);
			}
			all[id]=se[id].size()-1;
			set<int> tmp;
			for(set<int>::iterator it=se[v1].begin();it!=se[v1].end();it++){
				tmp.insert(*it);
			}
			cnt[id]=0;
			for(set<int>::iterator it=se[v2].begin();it!=se[v2].end();it++){
				if(tmp.find(*it)!=tmp.end()){
					cnt[id]++;
				}
			}
		}
		type[v]=mp[vs];
	}
	return type[v];
}

void construct(int v){
	if(G[v].size()==2){
		construct(G[v][0]);
		construct(G[v][1]);
		int rec=check(type[G[v][0]],type[G[v][1]]);
		if(rec==1){
			swap(G[v][0],G[v][1]);
		}
	}
}

string get(int v,int f){
	if(G[v].size()==0){
		return "x";
	}
	if(f==-1){
		return "(" + get(G[v][0],-1) + " " +get(G[v][1],1) +")";
	}else{
		return "(" + get(G[v][1],-1) + " " +get(G[v][0],1) +")";
	}
}


int main(void){
	while(1){
		string str;
		getline(cin,str);
		if(str=="0")break;
		for(int i=0;i<300;i++){
			ch[i].clear();
			G[i].clear();
			se[i].clear();
		}
		memset(dp,0,sizeof(dp));
		memset(flag,false,sizeof(flag));
		siz=0;
		mp.clear();
		mp["0"]=0;
		all[0]=1;
		se[0].insert(0);
		State st=str.begin();
		expression(st);
		dfs(0);
		construct(0);
		cout << get(0,-1) << endl;
	}
	return 0;
} 


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

int main () {
  int N, result = 0;
  cin >> N;
  int A[N];

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

  for(int i = 0; i < N-1; i++) {
    for(int j = i+1; j < N; j++) {
      if(abs(A[i] - A[j]) > result) result = abs(A[i] - A[j]);
    }
  }

  cout << result << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int x,a,b;
	cin >> x >> a >> b;
	a=abs(a-x);
	b=abs(b-x);
	if(a<b)cout << "A" << endl;
	else cout << "B" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int GCD(int a, int b) {
	int A, B, buff;
	if (a > b) { A = a; B = b; }
	else { A = b; B = a; }
	while (A%B != 0) {
		buff = B;
		B = A % B;
		A = buff;
	}
	return B;
}

int main() {
	int a, b, gcd;
	scanf("%d %d", &a, &b);
	gcd = GCD(a, b);
	printf("%d\n", gcd);
	return 0;
}


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

int main(){
  int N;
  cin >> N;
  int cpN = N;
  int sum = 0;
  
  while(cpN > 0){ 
    sum += cpN % 10;
    cpN /= 10;
  }
  
  if(N % sum == 0)cout << "Yes" << endl;
  else cout << "No" << endl;
 
}

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

int main(){
	int N,M; cin>>N>>M;
	vector<int> H(N), ok(N, 1); // ok=1, ng=0
	rep(i, N) cin>>H[i];
	rep(i, M){
		int a,b; cin>>a>>b; --a,--b;
		if(H[a] <= H[b]) ok[a] = 0;
		if(H[a] >= H[b]) ok[b] = 0;
	}
	int good = 0;
	rep(i, N) if(ok[i]) good++;
	cout<< good <<endl;
}

Measured memory_bytes: 4016
#include<bits/stdc++.h>
using namespace std;
int d[1001], t, a[1001], n, k, s=0;
int main(){
	scanf("%d %d", &n, &k);
	for(int i=1; i<=k; i++){
		scanf("%d", &d[i]);
		for(int j=1; j<=d[i]; j++){
			scanf("%d", &t);
			if(a[t]==0){
				a[t]=1;
				s++;
			}
		}
	}
	printf("%d", n-s);
}

Measured memory_bytes: 3816
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;

#ifndef LOCAL
#pragma GCC optimize ("O2")
#define endl '\n'
#endif

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

ll pwr(ll a,ll b, ll mod){
    a %= mod;
    int ans = 1;
    while(b){
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

const int N = 1e5 + 5;
int a[N];
void solve(){
	int n;
	cin >> n;
	int maxi = 0;
	fr(i, 1, n){
		cin >> a[i];
		maxi = max(maxi, a[i]);
	}
	f80 lol = (maxi / 2);
	f80 dd = 1e18;
	int ans = 0;
	fr(i, 1, n){
		if(dd > abs(lol - a[i]) && a[i] < maxi){
			dd = abs(lol - a[i]);
			ans = a[i];
		}
	}
	cout << maxi << " " << ans;
}
signed main(){
    IO;
    #ifdef LOCAL
        freopen("inp.txt","r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    cout << setprecision(10) << fixed;
    int t = 1;
    // cin >> t;
    fr(tt, 1, t){
        solve();
    }
    return 0;
}

Measured memory_bytes: 1024
//This is getting accepted!
#include<bits/stdc++.h>
#define ll long long
#define oo 1000000009
#define isset(x, i) (((x)>>(i))&1)
#define setbit(x, i) ((x)^(1ll<<(i)))
#define clearbit(x, i) ((x)&(~(1ll<<(i))))
#define twoexp(i) (1ll<<(i))

using namespace std;

const int MOD = 1000000007;
const double EPS = 1e-8;
const double PI = 2 * acos(0);
const int MAXN = 1e6 + 6;

int n, a, b;

bool input() {
	
	cin >> n >> a >> b;
	
	return !cin.fail();
}

void clear_input() {
	
}

void preprocess() {
	
	
	
}

void process(int itest) {
	
	cout << min(n*a, b) << endl;
	
}

void oneTest() {
	
	while(input()) {
		preprocess();
		process(0);
		clear_input();
	}
	
}

void multiTest() {
	
	int t;
	cin >> t;
	
	for (int it = 1; it <= t; ++it) {
		input();
		preprocess();
		process(it);
	}
}

int main(){
    #ifndef ONLINE_JUDGE
//    freopen("../out.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	oneTest();
//	multiTest();

    return 0;

}


Measured memory_bytes: 256
# ABC155C ref. ABC008B

d = {}
max_value = 1
n = int(input())
for i in range(n):
    t = input()
    if t in d.keys():
        d[t] += 1
        if d[t] > max_value:
            max_value = d[t]
    else:
        d.setdefault(t, 1)
#print(f"d = {d}")
#print(f"max_value = {max_value}")
#print(f"d.keys() = {d.keys()}")
#print(f"d.values() = {d.values()}")
d = sorted(d.items())
#print(d)
for k, v in d:
    if v == max_value:
        print(k)


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

using namespace std;


long long a[100005]; 
int main()
{
    long long n,k;
    cin>>n>>k;
    for(long long i=0;i<n;i++)
    cin>>a[i];
    cout<<(n-1)/(k-1)+((n-1)%(k-1)!=0)<<endl;
    //system("pause");
    return 0;
}   
  

Measured memory_bytes: 1024
s = str(input())
now = [0] * 2019
mod = 2019
ans,cnt = 0,1
lis = [int(s[-(1+i)]) for i in range(len(s))]
for num in lis:
    now[0] += 1
    num *= cnt
    num %= mod
    next = [0] * mod
    for i in range(2019-num):
        next[num+i] += now[i]
    for i in range(num):
        next[i] += now[2019-num+i]
    ans += next[0]
    cnt *= 10
    cnt %= mod
    now = next
print(ans)

Measured memory_bytes: 79512
#include<cstdio>
using namespace std;
int lst=-1,nw;
int main()
{
	for(int i=1;i<=4;i++)
	{
		scanf("%1d",&nw);
		if(lst==nw)
		{
			puts("Bad");
			return 0;
		}
		lst=nw;
	}
	puts("Good");
}

Measured memory_bytes: 128
import sys
# input = sys.stdin.readline
input = sys.stdin.buffer.readline
import math
EPS = 10**-7


class P2():
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.norm2 = (self.x**2 + self.y**2)**0.5

    def __add__(self, other):
        return P2(self.x + other.x, self.y + other.y)

    def __sub__(self, other):
        return P2(self.x - other.x, self.y - other.y)

    def smul(self, a):
        return P2(self.x * a, self.y * a)

    def dot(self, other):
        return self.x * other.x + self.y * other.y

    def det(self, other):
        return self.x * other.y - self.y * other.x


n, k = map(int, input().split())
p = []
c = []
for _ in range(n):
    x, y, cc = map(float, input().split())
    p.append(P2(x, y))
    c.append(cc)

dist = [[(p[i] - p[j]).norm2 for j in range(n)] for i in range(n)]


def check(r):
    r_c = tuple(r / c[i] for i in range(n))
    # 半径rの円２つの交点の列挙
    cand = [pi for pi in p]
    for i in range(n - 1):
        for j in range(i + 1, n):
            d_ij = p[i] - p[j]

            if dist[i][j] < r_c[i] + r_c[j] - EPS:
                # 点iと点jを中心とする円が交点を持つ時
                x = ((r_c[j])**2 -
                     (r_c[i])**2 + d_ij.norm2**2) / (2 * d_ij.norm2)
                h = math.sqrt(max((r_c[j])**2 - x**2, 0.0))
                v = P2(-d_ij.y, d_ij.x).smul(h / d_ij.norm2)
                dx = p[j] + d_ij.smul(x / d_ij.norm2)
                cand.append(dx + v)
                cand.append(dx - v)

    for cand_p in cand:
        cnt = 0
        for i in range(n):
            if (p[i] - cand_p).norm2 < r_c[i] + EPS:
                cnt += 1
                if cnt >= k:
                    return True

    return False


lb = 0.0  # False
ub = 3000 * 100  # True
while ub - lb > EPS:
    mid = (ub + lb) / 2
    if check(mid):
        ub = mid
    else:
        lb = mid

print(ub)


Measured memory_bytes: 82268
#Break Number
n=int(input())

if n >=64:
    print(64)
elif 64>n >=32:
    print(32)
elif 32>n >=16:
    print(16)
elif 16>n >=8:
    print(8)
elif 8>n >=4:
    print(4)
elif 4>n >=2:
    print(2)
else :
    print(1)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(){
    int n;
    int i = 1;

     while (1) { cin >> n;
     
         if (n == 0)break;
         cout << "Case" << " " << i << ":" << " " << n << endl;
         i ++;
     }
     return 0;
     
}

    


Measured memory_bytes: 3064
//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define endl "\n"
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int fast_pow(int x, int y, int p);
char diff(char a,char b){
    for(char x='a';x<='z';x++){
        if(x!=a && x!=b)return x;
    }
}
void solve() {
    int n,m;cin>>n>>m;
    if(n==m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
int32_t main() {
    IOS;
    int test = 1;
    //cin >> test;
    while (test--) {
        solve();
    }
    return 0;
}
int fast_pow(int x, int y, int p) {
    int res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut vs = vec![0i16; n];
    for i in 0..(n - 1) {
        vs[i] = read(&mut stdin_lock, &mut buf, b' ');
    }
    vs[n - 1] = read(&mut stdin_lock, &mut buf, b'\n');
    let mut cs = vec![0i16; n];
    for i in 0..(n - 1) {
        cs[i] = read(&mut stdin_lock, &mut buf, b' ');
    }
    cs[n - 1] = read(&mut stdin_lock, &mut buf, b'\n');
    let mut ans = 0;
    for i in 0..n {
        if vs[i] - cs[i] > 0 {
            ans += vs[i] - cs[i];
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define MOD 1000000007
typedef long long ll;
using namespace std;

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

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[200200];
    int flag[200200];
    Fill(flag,0);
    for(int i=1;i<=N;i++) cin >> A[i];
    vector<int> ans;
    for(int i=N;i>=1;i--){
        int num = 0;
        for(int j=i;j<=N;j+=i){
            num += flag[j];
        }
        if((num+A[i]) % 2 == 1){
            flag[i]++;
            ans.push_back(i);
        }
    }
    int cnt = ans.size();
    cout << cnt << endl;
    for(auto itr = ans.begin();itr != ans.end();itr++){
        if(itr != ans.begin()) cout << " ";
        cout << *itr;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3192
#include <iostream>
#include <string>

using namespace std;

int main() {
  int N,sum = 0;
  cin >> N;

  // ここにプログラムを追記
  for(int i; i < N ; i++){
    int A,B;
    cin >> A >> B;
    sum += B - A + 1;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
long long n,k,ans;
int main()
{
	cin>>n>>k;
	if(k%2)
	{
		cout<<(n/k)*(n/k)*(n/k);
	}
	else
	{
		rep(i,1,n)
		{
			if(i%k==0)ans+=(n/k)*(n/k);
			else if(i%k==k/2)
			{
				if(n%k>=k/2)ans+=(n/k+1)*(n/k+1);
				else ans+=(n/k)*(n/k);
			}
		}
		cout<<ans;
	}
	return 0;
}


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

int main() {
  string S; cin>>S;
  int n=S.size();

  stack<int> P;
  for (int i=0; i<n; i++) {
    if (S[i]=='S') P.push(1);
    else {
      if (P.empty()) {
        P.push(0);
        continue;
      }
      if (P.top()==0) P.push(0);
      else P.pop();
    }
  }
  cout<<P.size()<<endl;
}

Measured memory_bytes: 1284