akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>

#define PI 3.141592653589793

int main(void){
    int a,b,c;
    double s,l,h;
    
    scanf("%d%d%d",&a,&b,&c);
    
    s = sin(c * PI / 180.0)*a*b/2;
    l = a + b + sqrt(a*a + b*b - 2*a*b * cos(c * PI / 180.0));
    h = s/a*2;
    
    printf("%lf %lf %lf\n" ,s,l,h);
    
    return 0;
}


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

#define ED return 0;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) long(pow(x,y))
const long long int mod = 1000000007;
unsigned long long int gcd(unsigned long long int a, unsigned long long int b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<string> vec (N);
    for(int i = 0;i < N;i++){
        cin >> vec.at(i);
        if(i != 0 && vec.at(i).at(0) != vec.at(i-1).at(vec.at(i-1).size()-1)){
            cout << "No" << endl;
            ED
        }
        for(int j = 0;j < i;j++){
            if(vec.at(i) == vec.at(j)){
                cout << "No" << endl;
                ED
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef pair<int,int> pa;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
const int MO=1e9+7;
int n,k;
LL f[2010][2010],ans,fac[4000010],inv[4000010];
LL pw(LL x,LL y){
	LL t=1;
	for (;y;y>>=1){
		if (y&1) t=t*x%MO;
		x=x*x%MO;
	}
	return t;
}
LL C(int x,int y){
	return fac[x]*inv[y]%MO*inv[x-y]%MO;
}
int main(){
	cin>>n>>k;
	if (k==1) return puts("1"),0;
	fac[0]=1;
	FOR(i,1,4000000) fac[i]=fac[i-1]*i%MO;
	inv[4000000]=pw(fac[4000000],MO-2);
	FORD(i,3999999,0) inv[i]=inv[i+1]*(i+1)%MO;
	f[0][0]=1;
	FOR(i,0,n) //>0
		FOR(j,0,i) //=0
			if (f[i][j]){
				if (j<i) (f[i][j+1]+=f[i][j])%=MO;
				if (i<n) (f[i+1][j]+=f[i][j]*(n-i)%MO*C(i*k-i+j+1+k-2-1,k-2))%=MO;
			}
	ans=(f[n][n]%MO+MO)%MO;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 94208
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(ll i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int n;
bool s[200][200];
int status[200] = {}; // new-active-finished

/* bool acyclic(int i, int from) {
	status[i] = 1;
	rep(j, n) {
		if (s[i][j] && from != j) {
			if (status[j] == 1) return true;
			else {
				if (acyclic(j, i)) return true;
			}
		}
	}
	status[i] = 2;
	return false;
} */

const int MAX = 10000;
int main(void)
{
	string str[201];
	int d[200][200] = {};
	cin >> n;
	rep(i, n) cin >> str[i];

	rep(i, n) {
		rep(j, n) {
			if (str[i][j] == '1') {
				s[i][j] = true;
				d[i][j] = 1;
			} else {
				s[i][j] = false;
				if (i == j) d[i][j] = 0;
				else d[i][j] = MAX;
			}
		}
	}
	
/* 	// 閉路検出
	rep(i, n) {
		if (status[i] == 0) {
			if (acyclic(i, -1)) {
				cout << -1 << endl;
				return 0;
			}
		}
	} */
	for (int k = 0; k < n; k++){       // 経由する頂点
    for (int i = 0; i < n; i++) {    // 始点
      for (int j = 0; j < n; j++) {  // 終点
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }
/* 	rep(i, n) {
		rep(j, n) {
			cout << d[i][j] << " ";
		}
		cout << endl;
	} */

	// 奇数頂点による閉路の検出
	rep(i, n) {
		rep(j, n) {
			if (s[i][j]) {
				rep(k, n) {
					if (d[k][i] == d[k][j] && d[k][i] < MAX) {
						cout << -1 << endl;
						return 0;
					}
				}
			}
		}
	}

	// 各グラフについて最長二点間距離を求める
	int ans = 0;
	rep(i, n) {
		if(status[i] == 0) {
			int max = 0;
			vector<int> g;
			rep(j, n) {
				if(d[i][j] < MAX) g.push_back(j);
				status[j] = 1;
			}
			for(int j : g) {
				for(int k : g) {
					chmax(max, d[j][k]);
				}
			}
			ans += (max + 1);
			// cout << i << " : " << (max + 1) << endl;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
n, m, x = map(int,input().split())
a = list(map(int,input().split()))

#leftto0
cost_left = 0
for i in range(x-1,0,-1):
    if i in a:
        cost_left+= 1
    
#right_to_N
cost_right = 0
for i in range(x+1, n):
    if i in a:
        cost_right+= 1
    
print(min(cost_left, cost_right))

Measured memory_bytes: 3064
// Mon May 11 18:21:13 IST 2020          
#include <bits/stdc++.h>        
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(ii,a,b)        for(int ii = (int)a ; ii < (int)b  ; ii++ )
#define debug(x)           cerr << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define int64              long long    
#define MOD                998244353 
#define pb                 push_back
#define f_                 first 
#define s_                 second    
#define all(x)             (x).begin(),(x).end() 
#define precise(x)         cout << fixed << setprecision(12) << x << '\n'; 
#define tough_nut          numeric_limits<int64>::min()
const double pi = 3.141592653589793238;
using namespace std ;     
using namespace __gnu_pbds;
 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
// const int N = 2e5; 
const int INF = INT_MAX;  
int tests(){ 
    int n,m,x ;
    cin >> n >> m  >> x ; 
    vector <vector <int>> a;
    vector <int> c(n);
    for(int i = 0 ; i < n ; i++ ){
        cin >> c[i];
        vector <int> v(m);
        for(auto&x : v)
            cin >> x ; 
        a.push_back(v);
    }
    int ans = INT_MAX;
    for(int i = 0 ; i < (1 << n) ; i++ ){
        vector <int> total(m);
        int money  = 0 ;
        for(int j = 0 ; j < n ; j++ ){
            if(i&(1<<j)){ 
                money += c[j];
                for(int k = 0 ; k < m ; k++)
                    total[k] += a[j][k];

            }
        }
        bool ok = true ;
        for(int j = 0 ; j < m ; j++ )
            ok &= total[j] >= x ;
        if(ok)
            ans  = min(ans,money);
    }
    if(ans == INT_MAX)
        ans = -1 ;
    cout << ans << '\n';
    return 0; 
}
int32_t main(){
    I__O ;    
    int cases = 1 ;  
    // cin >> cases ; 
    while(cases--){    
        tests(); 
    }
    return 0 ; 
}
 
// -Wall -Wextra -O2
// -pedantic -std=c++11
// -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

Measured memory_bytes: 3592
import collections
N = int(input())
A = list(map(int, input().split()))

dic = collections.Counter(A)
for a in A:
    if (a-1 in dic) & (a+1 in dic): 
        dic[a-1] += 1
        dic[a+1] += 1

    elif (a+1 in dic):
        dic[a+1] += 1
        dic[a-1] = 1
    elif (a-1 in dic):
        dic[a-1] += 1
        dic[a+1] = 1
    else:
        dic[a+1] = 1
        dic[a-1] = 1

print(max(dic.values()))
        




Measured memory_bytes: 62060
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math

def solve(h):
    if h == 1:
        return 1
    return solve(math.floor(h/2))*2 + 1

def main():
    H = int(input())
    print(solve(H))

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k,c,cnt=0;
	cin>>n>>k>>c;
	string s;
	cin>>s;
	vector<int>g1,g2;
	for(int i=0;cnt<k;i++){
		if(s[i]=='o'){
			g1.push_back(i);
			i+=c;cnt++;
		}
	}cnt=0;
	for(int i=n-1;cnt<k;i--){
		if(s[i]=='o'){
			g2.push_back(i);
			i-=c;cnt++;
		}
	}
	reverse(g2.begin(),g2.end());
	for(int i=0;i<k;i++)if(g1[i]==g2[i])cout<<g1[i]+1<<endl;
}

Measured memory_bytes: 3448
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> mvec(size_t a){return vector<T>(a);}template<class T, class... Ts>auto mvec(size_t a, Ts... ts){return vector<decltype(mvec<T>(ts...))>(a, mvec<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}/* 重み付きUnionFind */struct WUnionFind {vector<int> par;vector<int> rank;WUnionFind(int n = 1) {init(n);}void init(int n = 1) {par.resize(n); rank.resize(n);for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;}int root(int x) {if (par[x] == x) {return x;}else {int r = root(par[x]);return par[x] = r;}}bool issame(int x, int y) {return root(x) == root(y);}bool merge(int x, int y) {x = root(x); y = root(y);if (x == y) return false;if (rank[x] < rank[y]) swap(x, y);if (rank[x] == rank[y]) ++rank[x];par[y] = x;return true;}};/* IO高速化 */void fastio(){ios::sync_with_stdio(false);cin.tie(NULL);}
/* ここからコード開始 */

int main(){
  fastio;
  ll N, M;
  cin >> N >> M;
  auto vec = mvec<pair<P,ll>>(M);
  ll num{};
  for(auto&& i : vec){
    cin >> i.first.first >> i.first.second;
    i.second = num;
    num++;
  }
  sort(all(vec));
  ll point{}, r{1};
  rep(i, 0, M){
    r++;
    if(point != vec[i].first.first){
      r = 1;
      point = vec[i].first.first;
    }
    vec[i].first.second = r;
  }
  auto ans = mvec<P>(M);
  rep(i, 0, M){
    ans[vec[i].second] = vec[i].first;
  }
  for(auto&& i : ans){
    rep(j, 0, 5-log10(i.first)) cout << 0;
    cout << i.first;
    rep(j, 0, 5-log10(i.second)) cout << 0;
    cout << i.second << rt;
  }
}

Measured memory_bytes: 5632
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(int, a, b);
    print(max(0, a - b));

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
typedef struct res{
	int p,cnt;
	string s;
}res;

bool cmp(res a,res b){
	if(a.s==b.s){
		return a.p>b.p;
	}
	return a.s<b.s;
}

int main(){
	int n,t;
	cin>>n;
	vector<res> f(n);
	for(int i=0;i<n;i++){
		cin>>f[i].s>>f[i].p;
		f[i].cnt=i+1;
	}
	sort(f.begin(),f.end(),cmp);
	for(int k=0;k<n;k++){
		printf("%d \n",f[k].cnt);
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++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 ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector <ll>a(n);
    REP(i,n)cin >> a[i];
    a.insert(a.begin(),0);
    a.push_back(0);
    ll all_dist = 0;
    REP(i,n+1){
        all_dist += llabs(a[i+1] - a[i]);
    }
    FOR(i,1,n+1){
        if((a[i-1] <= a[i] && a[i] <= a[i+1]) || (a[i-1] >= a[i] && a[i] >= a[i+1])){
            cout << all_dist << endl;
        }
        else {
            cout << all_dist - 2*min(llabs(a[i]-a[i-1]),llabs(a[i]-a[i+1])) << endl;
        }
    }
    return 0;
}

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

#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define OK puts("OK")
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 1005, M = 2e4;

int n;

struct st
{
    int w, v, s;
};

st a[N];

bool cmp (st a, st b)
{
    return a.w + a.s < b.w + b.s;
}

long long dp[N][M + 5], ans;

main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
        scanf("%d%d%d", &a[i].w, &a[i].s, &a[i].v);

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

    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j <= M; j++)
        {
            if (j >= a[i].w && j - a[i].w <= a[i].s)
                dp[i][j] = dp[i - 1][j - a[i].w] + a[i].v;

            dp[i][j] = max( dp[i][j], dp[i - 1][j] );

            ans = max(ans, dp[i][j]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 156544
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int n;cin>>n;
    lint a=1,b=1,x,y;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        lint at=(a+x-1)/x,bt=(b+y-1)/y;
        if(at>bt){
            a=at*x;
            b=at*y;
        }
        else{
            a=bt*x;
            b=bt*y;
        }
    }
    cout<<a+b<<endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
constexpr int MOD = 1000000007;

int mod(const ll &x){
    return x > 0 ? x % MOD : (x+MOD) % MOD;
}

int modm(const ll &x,const ll &m){
    return (x % MOD) * (m % MOD) % MOD;
}

int modpow(ll x, ll p) {
    int ret = 1;
    while(p > 0) {
        if (p & 1) ret = modm(ret,x);
        x = modm(x,x);
        p >>= 1;
    }
    return ret;
}

// x * modinv(d)
int modd(ll x,ll d) {
    return modm(x,modpow(d,MOD-2));
}

int main(void)
{
    IOS
    const string S = "AGCT";

    int n; cin >> n;

    vector<map<string,int>> dp(n+1);

    vector<string> agct({""});
    REP(i,3) {
        vector<string> tmp;
        swap(tmp,agct);
        for (auto s:tmp) {
            for (auto c: S) {
                agct.push_back(s+c);
            }
        } 
    }

    map<string,bool> memo;
    auto isok = [&](string s) {
        try {
            return memo.at(s);
        } catch (out_of_range) {
            bool ret = true;
            REP(i,s.size()) {
                if (i == 0) {
                    if (s.find("AGC") != string::npos) ret = false;
                } else {
                    string t = s;
                    swap(t[i],t[i-1]);
                    if (t.find("AGC") != string::npos) ret = false;
                }
            }
            memo[s] = ret;
            return ret;
        }
    };

    for (auto s:agct) {
        if (isok(s)) dp[3][s] = 1;
        else dp[3][s] = 0; 
    }

    FOR(i,4,n+1) {
        for(auto s:agct) {
            for(auto c:S) {
                string t = s+c;
                if (isok(t)) dp[i][t.substr(1,3)] = mod(dp[i][t.substr(1,3)] + dp[i-1][s]);
            }
        }
    }

    int ans = 0;
    for(auto v:dp[n]) ans = mod(ans + v.second);

    cout << ans << '\n';


    return 0;
}

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

using namespace std;

int main() {
    int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin>>k;
    cout<<a[k-1];
    return 0;
}

Measured memory_bytes: 256
from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 1000001
MOD = 10**9+7
spf = [i for i in range(MAXN)]
spf[0]=spf[1] = -1
def sieve():
    for i in range(2,MAXN,2):
        spf[i] = 2
    for i in range(3,int(MAXN**0.5)+1):
        if spf[i]==i:
            for j in range(i*i,MAXN,i):
                if spf[j]==j:
                    spf[j]=i
def fib(n,m):
    if n == 0:
        return [0, 1]
    else:
        a, b = fib(n // 2)
        c = ((a%m) * ((b%m) * 2 - (a%m)))%m
        d = ((a%m) * (a%m))%m + ((b)%m * (b)%m)%m
        if n % 2 == 0:
            return [c, d]
        else:
            return [d, c + d]

def charIN(x= ' '):
    return(sys.stdin.readline().strip().split(x))

def arrIN(x = ' '):
    return list(map(int,sys.stdin.readline().strip().split(x)))

def ncr(n,r):
    num=den=1
    for i in range(r):
        num = (num*(n-i))%MOD
        den = (den*(i+1))%MOD

    return (num*(pow(den,MOD-2,MOD)))%MOD

def flush():
    return sys.stdout.flush()

'''*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*'''
n,m = arrIN()

d = defaultdict(list)

for i in range(m):
    a,b = input().split()
    d[int(a)].append(b)
ca = pe = 0
for i in range(1,n+1):
    if "AC" in d[i]:
        ca+=1
        pe+=d[i].index("AC")
print(ca,pe)

Measured memory_bytes: 71016
#include <iostream>
#include <vector>
#include <cmath>
#include <climits>
#include <algorithm>


using namespace std;


class point {
    public:
        point();
        point(long x, long y);
        point(const point& other);
        long x, y, h;
        long height(long cx, long cy);
};


point::point(long x, long y)
    : x(x), y(y)
{
}


point::point(const point& other)
    : x(other.x), y(other.y)
{
}


point::point()
    : point(101, 101)
{
}


long point::height(long cx, long cy)
{
    return this->h + abs(this->x - cx) + abs(this->y - cy);
}



int main()
{
    vector<point> ps(100);
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> ps[i].x >> ps[i].y >> ps[i].h;
    }
    point *anchor;
    for (anchor = &ps[0]; anchor->h == 0; anchor++) ;

    point *ans = nullptr;
    for (long x = 0; x <= 100; x++) {
        for (long y = 0; y <= 100; y++) {
            bool sat = true;
            long height = anchor->height(x, y);
            for (int i = 0; i < N; i++) {
                long test = height - abs(ps[i].x - x) - abs(ps[i].y - y);
                if (ps[i].h != max(test, 0L)) {
                    sat = false;
                    break;
                }
            }
            if (sat)
                ans = new point(x, y);
        }
    }

    cout << ans->x << " " << ans->y << " " << anchor->height(ans->x, ans->y) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0; i<(n); ++i)
#define rep1(i,n) for(ll i=1; i<=(n); ++i)
#define repi(i,a,b) for(ll i=a; i<=(b); ++i)
#define rrep(i,n) for(ll i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define print(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
using Edge = pair<ll,ll>;
using Graph = vector<vector<Edge>>;
typedef pair<ll,ll> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll devc(ll x, ll y){return 1 + (x-1)/y;}

string BASE_CONVERSION(ll num, ll base, ll digit){
    string s = "";
    ll x = pow(base,digit-1);
    for(ll i = 0; i < digit; i++) s += to_s(num / x), num %= x, x /= base;
    return s;
}

ll solve(ll N,vector<ll> A){
    ll ans = 0;
    vector<ll> d(60),z(60);
    
    rep(i,N){
        ll x = pow(2,59);
        rep(j,60){
            if(A[i] / x != 0) d[j]++, A[i] -= x;
            else z[j]++;
            x /= 2;
        }
    }

    ll x = pow(2,59);
    rep(i,60){
        ll xx = (d[i]*z[i]) %MOD;
        ll xxx = x % MOD;
        ans += (xx*xxx)%MOD;
        x /= 2;
        ans %= MOD;
    }


    return ans;
}

int main(){
    ll N; cin >> N;
    vector<ll> A(N); rep(i,N) cin >> A[i];
    print(solve(N,A));
    return 0;
}

Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {

	private static final long x = (long) Math.pow(10, 18);

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();

		if ((b - a) / 2 + 1 <= k) {
			for (int i = a; i <= b; i++) System.out.println(i);
			return;
		}

		for (int i = a; i < a + k; i++) {
			System.out.println(i);
		}

		for (int i = b - k + 1; i <= b; i++) {
			System.out.println(i);
		}

		sc.close();
	}

}


Measured memory_bytes: 36264
var
    i,j,n:longint;
    ch:array[1..200000]of char;
begin
    while not eoln do 
        begin
            inc(n);
            read(ch[n]);
        end;
    for i:=1 to n do if ch[i]='A' then break;
    for j:=n downto 1 do if ch[j]='Z' then break;
    writeln(j-i+1);
end.

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

const int INF = 1000000000;
//INFにっているのは右端か左端

int n, a[100005];
vector< pair<int,int> > distv;

int main() {
	cin>>n;
	for(int i = 0; i< n; i++){
		cin>>a[i];
		a[i]--;
	}
	int ld=INF;
	bool flag = false;
	for(int i = 0; i< n; i++){
		if(flag)ld++;
		if(a[i] == i){
			if(distv.size() > 0) distv[distv.size()-1].second = ld;
			distv.push_back(make_pair(ld,-1));
			ld = 0;
			flag = true;
		}
	}
	if(distv.size() > 0) distv[distv.size()-1].second = INF;
	
	int ans = 0;
	
	for(int i = 0; i < distv.size(); i++){
		ans++;
		if(distv[i].second == 1){
			i++;
		}
	}
	
	cout<<ans<<endl;
	
	return 0;
}

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

using namespace std;

typedef long long ll;

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

		vector<int> table(N+1, 0);
		for (int i = 0; i < M; i++) {
				int l, r;
				cin >> l >> r;
				l--; r--;
				table[l]++;
				table[r+1]--; // r番目のIDカードまでは通過できるため
		}

		vector<ll> sim(N+1, 0);
		sim[0] = table[0];
		ll ans = 0;

		for (int i = 0; i < N+1; i++) {
				if (i > 0) sim[i] = sim[i-1] + table[i];
				if (sim[i] == M) ans++;
		}

		cout << ans << endl;

		return 0;
}


Measured memory_bytes: 1408
import java.util.Scanner;
class Prime{
	double x;
	Prime(int X){
		x=X;
	}
	boolean isPrime() {
		if(x==2) {
			return true;
		}
		else if(x<2||x%2==0) {
			return false;
		}
		else {
			int i=3;
			while(i<=Math.sqrt(x)) {
				if(x%i==0) {
					return false;
				}
				i=i+2;
			}
		}
		return true;
	}
}
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		Prime [] p=new Prime [n];
		int sum=0;
		for(int i=0;i<n;i++) {
			p[i]=new Prime(sc.nextInt());
			p[i].isPrime();
			if(p[i].isPrime()==true) {
				sum+=1;
			}
		}
		System.out.println(sum);
		sc.close();
	}
}



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

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

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

    bool flag = false;
    for(int i = 0 ; i < n ; ++i){
        for(int j = 0 ; j < n ; ++j){
            swap(p[i], p[j]);
            bool tmp = true;
            for(int k = 0 ; k < n - 1 ; ++k){
                if(p[k] > p[k + 1]){
                    tmp = false;
                    break;
                }
            }
            if(tmp){
                flag = true;
            }
            swap(p[i], p[j]);
        }
    }

    if(flag){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2019-12-22 19:45:45
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;
template<class T> ostream& operator<<(ostream& os, vector<T>& _) { os << '{'; for (T& x : _) { os << x; if (&x != &_.back()) os << ','; } os << '}'; return os; }
template<class T, class U> ostream& operator<<(ostream& os, pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#else
#define debug(_) 1728
#endif

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

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

  int cnt = 0;
  int next = 1;

  for (int i = 0; i < n; ++i) {
    if (a[i] == next) {
      ++cnt;
      ++next;
    }
  }

  int ans = n - cnt;
  if (ans == n) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>

int main()
{
	int *a, *b, n;
	scanf("%d", &n);

	a = (int *)malloc(n * sizeof(int));
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);

	b = (int *)malloc(n * sizeof(int));

	if (n % 2 == 0)//n为偶数
	{
		for (int i = 0; i < n / 2; i++)
			b[i] = a[n - 1 - 2 * i];
		for (int i = 0; i < n / 2; i++)
			b[n / 2 + i] = a[2 * i];
	}
	else//n为奇数
	{
		for (int i = 0; i < n / 2 + 1; i++)
			b[i] = a[n - 1 - 2 * i];
		for (int i = 0; i < n / 2; i++)
			b[n / 2 + 1 + i] = a[2 * i + 1];
	}

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

	return 0;
}

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

using namespace std;

int main()
{
  string s;
  cin>>s;
  
  int sum=700;
  int i;
  for(i=0;i<s.length();++i)
  {
    if(s[i]=='o')
        sum+=100;
  }
  
  cout<<sum;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int a, b, op;
    do {   
    scanf("%d %c %d", &a, &op, &b);
    switch (op) {
        case '+':
            printf("%d\n", a+b);
            break;
        case '-':
            printf("%d\n", a-b);
            break;
        case '*':
            printf("%d\n", a*b);
            break;
        case '/':
            printf("%d\n", a/b);
            break;
        default:
            exit(0);
            break;
        }
    } while (op != '?');
    
}


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

// masu[0]: J, masu[1]: O, masu[2]: I
int masu[1005][1005][3];

int main(void) {
  int m, n;
  int num;
  cin >> m >> n;
  cin >> num;

  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      char tmp;
      cin >> tmp;
      if (tmp == 'J') {
        masu[i][j][0]++;
      } else if (tmp == 'O') {
        masu[i][j][1]++;
      } else {
        masu[i][j][2]++;
      }
    }
  }

  for (int k = 0; k < 3; k++) {
    for (int i = 1; i <= m; i++) {
      for (int j = 1; j <= n; j++) {
        masu[i][j][k] += masu[i][j-1][k];
      }
    }
    for (int j = 1; j <= n; j++) {
      for (int i = 1; i <= m; i++) {
        masu[i][j][k] += masu[i-1][j][k];
      }
    }
  }

  while (num--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    for (int i = 0; i < 3; i++) {
      int ans = masu[c][d][i] - masu[a-1][d][i] - masu[c][b-1][i] + masu[a-1][b-1][i];
      cout << (i ? " " : "") << ans;
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 12824
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  Name:- OMHARI 
  Institution:- UNIVERSIT OF CALCUTTA(INFORMATION TECHNOLOGY)
  Email:- omharicu@gmail.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include<bits/stdc++.h>
using namespace std; 

#define ull unsigned long long
#define ll long long
#define ul unsigned long
#define db double
#define pb push_back
#define mp make_pair
#define el "\n"
#define vll vector <ll>
#define vi vector <int>
#define all(v) (v.begin(), v.end()) 
#define rall(v) (v.rbegin(), v.rend()) 
const ll mod = 1e9+7;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
     #endif
    /***************-Code starts from here-***************/
    ll n,k,sum=0;
    cin>>n>>k;
    vi v(n);
    for(int i=0; i<n; i++)
    cin>>v[i];
    sort all(v);
    for(int i=0; i<k; i++)
    sum+=v[i];
    cout<<sum;
    return 0; 
} 

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF 1000000000
#define mod 1000000007


int main() {
    int N; cin >> N;
    ll K; cin >> K;
    map<int, ll> M;
    for(int i=0; i<N; i++){
        int a, b; cin >> a >> b;
        M[a] += b;
    }
    
    ll c = 0;
    for(auto m:M){
        c += m.second;
        if(K<=c){
            cout << m.first << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <cmath>

using namespace std;
#define PI 3.14159265359



int main()
{
    string S;
    cin >> S;
    int ans = 0;
    string ACGT = "ACGT";

    for(int i = 0; i < S.size(); i++){
        for(int j = 1; i + j - 1 < S.size(); j++){
            string part = S.substr(i, j);
            bool can = true; // partがACGT文字列であるかどうか
            for(int k = 0; k < part.size(); k++){
                if(part[k] == ACGT[0] || part[k] == ACGT[1] 
                || part[k] == ACGT[2] || part[k] == ACGT[3]){ 
                }else{
                    can = false;
                }
            }

            if(can){
                if(ans < part.size()) ans = part.size();
            }

        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    H,W = MI()
    G = [list(ST().split()) for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if G[i][j] == "snuke":
                print(chr(ord("A")+j) + str(i+1) ) 
if __name__ == '__main__':
    main()

Measured memory_bytes: 6668
#ifdef _DEBUG
#define _CRT_SECURE_NO_WARNINGS
#include "MyLib.h"
#else
#define main_A main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define MGN 8
#define LINF (LONG_MAX/2)
using namespace std;
typedef long long ll; typedef unsigned long long ull;
typedef vector<int> vi; typedef vector<vi> vvi; 
typedef vector<ll> vl; typedef vector<vl> vvl;
typedef vector<double> vd; typedef vector<string> vs;
typedef pair<int, int> pii; typedef pair<ll, ll> pll;
typedef vector<bool> vb; typedef vector<vb> vvb;
template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
    return left.second > right.second;}
vs split(string str, char sep) {
    vs v; stringstream ss(str); string t;
    while (getline(ss, t, sep)) v.push_back(t);
    return v;}
vs re_search_g(string s, regex re) {
    vs ret; smatch mc; auto it = s.cbegin();
    while (regex_search(it, s.cend(), mc, re)) {
        ret.push_back(mc[0]);
        it += mc.position(0) + mc.length();}
    return ret;}
#endif

void init_global_A() {}


int main_A() {
    cin.tie(0);
    ios::sync_with_stdio(false);
     
    int N, M; cin >> N >> M;

    int ans = (N - 1)*(M - 1);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		double n =m;

		String ans = "Yes";
		sc.close();
		System.out.println((n/3)*(n/3)*(n/3));
	}
}


Measured memory_bytes: 21588
def main():
    n = int(input())
    p = list(map(int, input().split()))

    c = [0 for i in range(n)]
    for i in range(n):
        c[p[i]-1] = i + 1

    a, b = [None for i in range(n)], [None for i in range(n)]
    for i in range(n):
        a[i] = str(30000 * (i+1))
        b[i] = str(30000 * (n-i) + c[i])

    print(" ".join(a))
    print(" ".join(b))


if __name__ == '__main__':
    main()


Measured memory_bytes: 8436
/*input
60522 114575 7559
*/

#include <functional>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <utility> 
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>

using namespace std;

using ll = long long;
using ld = long double;

const int SINF = 1000000009;
const ll INF =  1000000000000000018;

#define sp          cout << " "
#define nl          cout << "\n"
#define all(c)      (c).begin(),(c).end()
#define prec(n)     cout << fixed << setprecision(n)
#define PI          3.14159265358979323846264338327951
#define ifalse      ios_base::sync_with_stdio(false), cin.tie(NULL)

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

template <typename T, typename U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.first >> p.second;
  return is;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for(auto x: v) {
    os << x << " ";
  }
  return os;
}

template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (auto &x : v) is >> x;
  return is;
}
/********************* MODULAR ARITHMETIC *******************************/

ll MOD = 998244353;

void mod(ll &a){ if(a > MOD) a %= MOD; }
ll add(ll a, ll b) { a += b; mod(a); return a; }
ll mul(ll a, ll b) { mod(a); mod(b); a *= b; mod(a); return a; }
ll sub(ll a, ll b) { mod(a); mod(b); a -= b; a += MOD; mod(a); return a; }

ll powr(ll a, ll b) {
  ll x = 1LL;
  while(b) {
    if(b & 1) x = mul(x, a);
    a = mul(a, a), b >>= 1;
  }
  return x;
}

ll inv(ll a) { return powr(a, (MOD - 2)); }

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


/******************************** START *********************************/
const int N = 400005;

ll fact[N];
ll pre_inv[N];

void init() {
  fact[0] = 1;
  for(int i = 1; i < N; i ++) {
    fact[i] = mul(fact[i - 1], i);
  }

  pre_inv[N - 1] = inv(fact[N - 1]);
  for(int i = N - 2; i >= 0; i --) {
    pre_inv[i] = mul(pre_inv[i + 1], i + 1);
  }
}

ll ncr(ll n, ll r)
{
  ll nem = fact[n];
  ll den = mul(pre_inv[r], pre_inv[n - r]);
  return mul(nem, den);
}

int main()
{
  ifalse;
  init();
  ll n, m, k;
  cin >> n >> m >> k;

  ll ans = 0;
  for(int i = 0; i <= k; i ++) {
    ll d = m;
    ll u = powr(m - 1, n - i - 1);
    ll g = mul(d, u);
    g = mul(g, ncr(n - 1, i));
    ans = add(ans, g);
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 9904
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n,a,b;
  cin>>n>>a>>b;
  ll ans=min(b,n*a);
  cout<<ans<<endl;
}


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

int main() {
  int R,G,B,n,ans = 0,b;
  cin >> R >> G >> B >> n;
  for(int r = 0;r <= n/R;r++){
    for(int g = 0;g <= n/G;g++){
      b = (n-R*r-G*g)/B;
      if(b >= 0 && (n-R*r-G*g)%B == 0){
        ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

const int maxn=233;
struct Hungary
{
	vector<int> g[maxn];
	int match[maxn],mark[maxn],cur;
	bool dfs(int x)
	{
		mark[x]=cur;
		for(int i=0;i<(int)g[x].size();i++)
			if(match[g[x][i]]==-1||(mark[match[g[x][i]]]!=cur&&dfs(match[g[x][i]])))
			{
				match[x]=g[x][i];
				match[g[x][i]]=x;
				return true;
			}
		return false;
	}
	int bipartite(int n)
	{
		memset(match,-1,sizeof(match));
		int ret=0;
		for(cur=1;cur<=n;cur++)if(match[cur]==-1)ret+=dfs(cur);
		return ret;
	}
}m1;

int n,a[111],t[222],k;
bool prime(int x)
{
	if(x<=2||x%2==0)return false;
	for(int i=3;i*i<=x;i+=2)if(x%i==0)return false;
	return true;
}
int main()
{
	get1(n);
	a[0]=-1;
	for(int i=1;i<=n;i++)
	{
		get1(a[i]);
		if(a[i]-1!=a[i-1])
		{
			if(i>1)t[++k]=a[i-1]+1;
			t[++k]=a[i];
		}
	}
	t[++k]=a[n]+1;
//	for(int i=1;i<=k;i++)printf("%d ",t[i]);puts("");
	for(int i=1;i<=k;i++)for(int j=1;j<=k;j++)if(prime(abs(t[i]-t[j])))m1.g[i].pb(j);
	int c0=0,c1=0,c2=m1.bipartite(k);
	for(int i=1;i<=k;i++)if(t[i]%2==0)c0++;else c1++;
	c0-=c2;c1-=c2;
	printendl(c2+c0/2*2+c1/2*2+(c0%2)*3);
	return 0;
}

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

def make753(s):
    if int(s) > n:
        return 0
    if all(s.count(i) > 0 for i in '753'):
        count = 1
    else:
        count = 0
    for i in '753':
        count += make753(s + i)
    return count
           
print(make753('0'))

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

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

template <class T> using max_heap = priority_queue<T>;
template <class T> using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U> void chmax(T &a, U b) {
    if (a < b)
        a = b;
}
template <class T, class U> void chmin(T &a, U b) {
    if (b < a)
        a = b;
}

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 50);

const string YES = "YES";
const string NO = "NO";
void solve(long long N, std::vector<long long> A) {
    map<int, int> m;
    for (auto a : A) {
        m[a]++;
        if (m[a] > 1) {
            cout << NO << endl;
            return;
        }
    }
    cout << YES << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 7;
#define debug(a) cout<<#a<<": "<<a<<'\n'
struct E{
	int to,nx,val;
}e[maxn];
int head[maxn],tot;
ll dfn[maxn],num[maxn],fa[maxn],cnt,size[maxn],vis[maxn],pre[maxn],ans[maxn],last[maxn];
void dfs(int x){
	//cout << x << endl;
	dfn[x] = ++cnt;
	pre[cnt] = x;
	vis[x]= 1;
	for(int i = head[x];i;i = e[i].nx){
		int y = e[i].to;
		if(vis[y])continue;
		dfs(y);
		size[x]+=size[y];
	}
	last[x] = cnt;
}

void add(int x,int y){
	e[++tot].to = y;
	e[tot].nx = head[x];
	head[x] = tot;
}
int main() {
	ios::sync_with_stdio(false);
	int l,r,n,q,x,y,s,t;
	scanf("%d%d",&n,&q);
	for(int i = 1;i <= n;++i)size[i] = 1;
	for(int i = 1;i < n;++i){
		scanf("%d%d",&x,&y);
		add(x,y);add(y,x);
	}
	dfs(1);
	for(int i = 1;i <= q;++i){
		scanf("%d%d",&s,&t);
		l = dfn[s];
		r = last[s] + 1;
		num[l]+=t;
		num[r]-=t;
	}
	for(int i = 2;i <= n;++i){
		num[i] += num[i-1];
	}
	for(int i = 1;i <=n;++i)ans[pre[i]] = num[i];
	for(int i = 1;i<=n;++i)printf("%lld ",ans[i]);
	return 0;
}


Measured memory_bytes: 45056
N = int(input())

ans = N
for i in range(N + 1):
    c = 0
    res = i
    while res > 0:
        c += res % 6
        res //= 6
    res = N - i
    while res > 0:
        c += res % 9
        res //= 9
    ans = min(ans, c)
print(ans)


Measured memory_bytes: 41068
#include<cstdio>
#include<vector>


using namespace std;
using pii=pair<int,int>;
using vpii=vector<pii>;


int main(void)
{
	int n, t;

	while(scanf("%d%d", &n, &t)==2)
	{
		const int TLE_COST=9999;

		vpii ct(n);
		pii ans=make_pair(TLE_COST, 0);

		for(int i=0;i<n;i++)
		{
			scanf("%d%d", &ct[i].first, &ct[i].second);
			if(ct[i].second<=t)
			{
				if(ans.first>ct[i].first)
				{
					ans=ct[i];
				}
			}
		}
		if(ans.first==TLE_COST)
		{
			printf("TLE\n");
		}
		else
		{
			printf("%d\n", ans.first);
		}
	}

	return 0;
}


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

typedef long long LL;
#define dbg(x) cout << #x"=" << x << endl;

int main(){
   // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0); cin.tie(0);
    int h,n,a;
    LL sum = 0;
    cin >> h >> n;
    bool ok = false;
    for(int i = 0; i < n; ++i){
        cin >> a;
        sum += a;
        if(!ok && sum >= h) {
            cout << "Yes" << endl;
            ok = true;
        }
    }
    if(!ok) cout << "No" << endl;
    return 0;
}

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

#define mod 1000000007
#define MAX_N 400005
ll pow2[MAX_N];
void pow2_init(){
    pow2[0] = 1;
    for (int i = 1; i < MAX_N; ++i) {
        pow2[i] = pow2[i-1] * 2 % mod;
    }
}

int main() {
    pow2_init();
    int N;
    cin >> N;
    vector<ll>C(N);
    for (int i = 0; i < N; ++i) {
        cin >> C[i];
    }
    sort(C.begin(), C.end());
    ll ans = 0;
    for (int i = 0; i < N; ++i) {
        ll temp = N - i + 1;
        temp *= pow2[N-1] * pow2[N-1] % mod;
        temp %= mod;
        temp = temp * C[i] % mod;
        ans += temp;
        ans %= mod;
    }
    cout << ans << "\n";
    return 0;
}

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

int main() {
	
	int N;
	cin >> N;
	int ac=0,wa=0,tle=0,re = 0;
	for(int i=0; i <N ;i++){
		string verdict;
		cin>>verdict;
		if(verdict == "AC") {
			ac++;
		} else if (verdict == "WA") {
			wa++;
		} else if (verdict == "TLE") {
			tle++;
		} else if (verdict == "RE") {
			re++;
		}
	}
	cout<<"AC x "<<ac<<endl;
	cout<<"WA x "<<wa<<endl;
	cout<<"TLE x "<<tle<<endl;
	cout<<"RE x "<<re<<endl;
	
	
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n;
  cin >> n;
  vector<string> w(n);
  set<string> cnt;
  for(ll i=0;i<n;i++) {
    cin >> w[i];
    cnt.insert(w[i]);
  }
  if(cnt.size()!=n) {
    cout << "No" << endl;
    return 0;
  }
  for(ll i=0;i<n-1;i++) {
    if(w[i][w[i].size()-1]!=w[i+1][0]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256