akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<30;
const ll LINF = 1LL<<58;
const ll mod = 1000000007;

int main(){
    int n, h, ma = 0, cnt = 0;
    cin >> n >> h;
    vector<int> B, X;
    for(int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        chmax(ma, a);
        B.pb(b);
    }
    for(int i = 0; i < n; i++){
        if(B[i] > ma){
            X.pb(B[i]);
        }
    }
    sort(rall(X));
    for(int i = 0; i < X.size(); i++){
        h -= X[i];
        cnt++;
        if(h <= 0) break;
    }
    if(h>0)cnt += (h-1)/ma + 1;
    cout << cnt << endl;
    return 0;
}

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

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

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

using namespace std;

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

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

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

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

int main(int argc, char* argv[]) {
  ll n, z, w;
  cin >> n >> z >> w;
  vec<ll> a(n);
  scan(a);

  if (n == 1) {
    put(abs(a[n - 1] - w));
    return 0;
  }

  put(max(abs(a[n - 1] - w), abs(a[n - 2] - a[n - 1])));
  return 0;
}

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

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

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

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

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

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

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

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

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

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

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


Measured memory_bytes: 256
/*            AUTHOR - SHIVAM GUPTA
                       Jalpaiguri Govt. Engg College             */
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector<ll> ve[100005];
ll vis[100005],z;
ll dp[105][100005];

void solve()
{
    vector<ll> v;        vector<pair <ll,ll>> vp;
    map<ll,ll> mp;       set<ll> st;        multiset<ll> mst;
    ll n=0,m=0,i=0,j=0,k=0,c=0,l=0,r=0,p=0,q=0,x=0,y=0,z=0,flag=0,sum=0;
    // ll a[300005]={0},b[300005]={0},ans[300005];
    string s,t;
    cin>>n>>k;
    vp.push_back({0,0});
    for(i=0;i<n;i++)
    {
        cin>>x>>y;
        vp.push_back({x,y});
    }
    for(i=1;i<=n;i++)
    {
        ll wt=vp[i].first;
        ll val=vp[i].second;
        for(j=1;j<=k;j++)
        {
            if(wt>j)
            dp[i][j]=dp[i-1][j];
            else
            dp[i][j]=max(dp[i-1][j-wt]+val,dp[i-1][j]);
        }
    }
    cout<<dp[n][k];
}
bool imp=false;int main()
{
    fio;
    int t=1;
    if(imp)
	cin>>t;
	ll j=t;
    while(t--){
    // cout<<"Case #"<<j-t<<": ";
    solve();}
    return 0;
}

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

using namespace std;



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

	long long a;
	cin >> a;

	int b;
	cin >> b;

	char c;
	cin >> c;

	int d;
	cin >> d;

	b = b * 100 + d;

	long long ans = a * b;
	ans /= 100;

	cout << ans << '\n';

	return 0;	
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define N  1000


typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

using namespace std;

int main() {
	fast;
	char a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	if(a==f && b==e && c==d) cout<<"YES";
	else cout<<"NO";
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a > b){
    printf("a > b\n");
  } else if(a < b){
    printf("a < b\n");
  } else {
    printf("a == b\n");
  }
  return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long 
#define pb push_back
//#define mp make_pair
#define fr first
#define sc second
#define MAX ((ll)(1e17+100))
#define MX ((ll)(4e9+100))
#define ARRS ((ll)(1e6+100))
#define ARS ((ll)(1e3+100))
#define HS ((ll)(233))
#define MOD ((ll)(998244353))
#define EP ((double)(1e-9))
#define PI ((double)3.141592653)
#define LG 21
using namespace std;

ll n,m;
ll a[ARRS];
ll b[ARRS];
ll f[ARRS];
ll fn[ARRS];
string s;
vector<ll> v[ARRS];

ll pw(ll a,ll b){
	ll p=1;
	while(b){
		if(b&1)p=(p*a)%MOD;
		a=(a*a)%MOD;
		b>>=1;
	}
	return p;
}

ll ce(ll k,ll n){
	if(k>n)return 0;
	return f[n]*fn[k]%MOD*fn[n-k]%MOD;
}

int main(){
	ll pas=0;
	ll n,a,b,k;
	cin>>n>>a>>b>>k;
	f[0]=1;
	fn[0]=1;
	for(int i=1; i<=n; i++)
		f[i]=(f[i-1]*i)%MOD,fn[i]=pw(f[i],MOD-2);
	k+=a;
	for(int i=0; i<=2*n; i++){
		k-=a;
		if(k<0)break;
		if(k%b)continue;
		ll j=k/b;
		pas=(pas+ce(i,n)*ce(j,n))%MOD;
	}
	cout<<pas<<endl;
}


Measured memory_bytes: 30976
n = gets.to_i
a = gets.split.map(&:to_i)
cnt = 0
for i in 0..n-1
    minj = i
    for j in i..n-1
        if a[j] < a[minj]
            minj = j
        end
    end
    next if i == minj 
    k = a[i]
    a[i] = a[minj]
    a[minj] = k
    cnt += 1
end
puts a.join(" ")
puts cnt


Measured memory_bytes: 6872
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
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;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

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

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

void YES(bool ok){
    cout << (ok ? "Yes" : "No") << endl;
}
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;cin >> s;
    ll n = s.size();
    ll ans = 0;
    rep(i,0,n){
        ans += s[i] - '0';
        ans %= 9;
    }
    YES(ans == 0);
}

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

char s[20];
int main(){
    scanf("%s", s);

    int w = 0, l = 15;
    for(int i = 0; s[i]; i++){
        if(s[i] == 'o')w++;
        l--;
    }

    if(l + w >= 8)printf("YES\n");
    else printf("NO\n");

    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()) {
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t) {
	stringstream ss;
	ss << f;
	ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x)
#define debug(x)
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain() {
	int n, a, b;
	cin >> n >> a >> b;
	int ans = n;
	rep(i, n) {
		int t;
		cin >> t;
		if(a <= t && t < b) ans--;
	}
	cout << ans << endl;
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	mainmain();
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,M,K=map(int,input().split())
    A=list(range(0,N*M+1,N))
    s=set()
    for i in range(M+1):
        for j in range(N+1):
            if A[i]+(M-i*2)*j==K:
                YesNo(1)
                exit()
    YesNo(0)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39856
#include<bits/stdc++.h>
using namespace std;
int main(void) {
    int n;
    cin >> n;
    int a;
    int ans = 0;
    while(n--) {
        cin >> a;
        ans++;
        for(int i = 2;i <= sqrt(a);i++) {
            if(!(a % i)) {
                ans--;
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3088
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

mat ans(550,vec(550,-1));

void solve(int l, int r, int lev){
  int mid = (l+r)/2;
  if(r-l <= 1) return;
  FOR(i,l,mid){
    FOR(j,mid,r) ans[i][j] = ans[j][i] = lev;
  }
  solve(l,mid,lev+1);
  solve(mid,r,lev+1);
  return;
}

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

  int n;
  cin >> n;

  solve(0,n,1);

  REP(i,n){
    FOR(j,i+1,n) cout << ans[i][j] << " ";
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 2944
#include <stdio.h>
int main(void){
    // Your code here!
    int S,h,m,s;
    scanf("%d",&S);
    h=S/3600;
    m=S%3600/60;
    s=S%3600%60;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    string S;
    cin >> S;
    if (S.substr(0, 4) == "YAKI") cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    N, A = map(int, input().split())
    X = list(map(int, input().split()))

    dp = [[0] * (A * N + 1) for _ in range(N + 1)]
    dp[0][0] = 1
    for i, x in enumerate(X):
        for j in reversed(range(1, i + 2)):
            for a in range(x, A * N + 1):
                dp[j][a] += dp[j - 1][a - x]
    return sum(dp[i][A * i] for i in range(1, N + 1))

print(main())


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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;
//const int MOD = 998244353;

// Lib
//
void add(ll &a, ll b){
    a += b;
    if (a >= MOD) a -= MOD;
}

int main(){
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int N, K; cin >> N >> K;
    string S; cin >> S;

    // 「1 の個数」「0 の個数」を交互に記録していく
    vector<int> nums;
    if (S[0] == '0') nums.push_back(0); // 先頭が 0 だったら
    for (int i = 0; i < S.size();) {
        int j = i;
        while (j < S.size() && S[j] == S[i]) ++j; // S[i] の数値がどこまで続くか
        nums.push_back(j - i);
        i = j;
    }
    if (S.back() == '0') nums.push_back(0); // 最後尾が 0 だったら

    // 累積和
    vector<int> sums(nums.size() + 1, 0);
    for (int i = 0; i < nums.size(); ++i) sums[i+1] = sums[i] + nums[i];

    // 偶数番目の添字から始まる、長さ 2K+1 (以下) の区間の総和のうち、最大値を求める
    int res = 0;
    for (int left = 0; left < sums.size(); left += 2) {
        int right = left + K*2+1;
        if (right >= sums.size()) right = (int)sums.size() - 1;
        res = max(res, sums[right] - sums[left]);
    }
    cout << res << endl;
}


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

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

using namespace std;

typedef pair<int,int> pii;
typedef long long int ll;

void gen_sosuu(int sosuu[]){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}

int n,m;

int main(){
  scanf("%d %d", &n,&m);
  printf("%d\n",(n-1)*(m-1));
}


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

list = [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]

print(list[N-1])

Measured memory_bytes: 3060
n, m = map(int, input().split())
nums = [i+1 for i in range(n)]
cnt = 0
ss = [set(map(int, input().split()[1:])) for i in range(m)]
ps = list(map(int, input().split()))
for i in range(2**n):
    flag = True
    s = bin(i)[2:].zfill(n)
    on_set = set(nums[i] for i in range(n) if int(s[i]))
    for j in range(m):
        if len(on_set & ss[j])%2 == ps[j]:
            continue
        else:
            flag = False
            break
    if flag:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
# coding: utf-8
import string

numbers = "0123456789"
alphabets = string.ascii_letters
characters = numbers + alphabets


def convert(value, n=2):
    try:
        tmp = int(value)
    except:
        raise ValueError('Invalid value:', value)

    if n < 2 or n > len(characters):
        raise ValueError('Invalid n:', value)

    result = ''
    tmp = int(value)
    while tmp >= n:
        idx = tmp % n
        result = characters[idx] + result
        tmp = int(tmp / n)
    idx = tmp % n
    result = characters[idx] + result
    return result


def main():
    n, k = map(int, input().split(' '))

    after = convert(n, k)
    print(len(after))

    return 0


if __name__ == '__main__':
    main()


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

 int main() {
 int N, X; cin >> N >> X;
 vector<int> D(N + 1),L(N);
   for(int i=0; i<N; i++){
     cin >> L.at(i);
   }
   D.at(0)=0;
   for(int i=0; i<N; i++){
     D.at(i+1)=D.at(i)+L.at(i);}
   
   int s;
   
   for(int i = 1 ; i<N+1; i++){
     if(X<D.at(i)){
       s=i; break;}}
     cout << s << endl;}
   
 

Measured memory_bytes: 256
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD 1000000007
#define MOD2 998244353
#define MOD3 1000000009
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("ride.in");ofstream coutt("ride.out");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), 


signed main(){
    FASTER;
    int n;cin>>n;
    cout<<ceil(n,1000)*1000-n;
}

Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <queue>
#include <math.h>
#include <unordered_map>

using namespace std;

class Solution {
private:
public:
};

int main() {
    int days, assignments;
    cin >> days >> assignments;
    for(int i = 0; i < assignments; ++i) {
        int temp = 0;
        cin >> temp;
        days -= temp;
    }
    cout << max(-1, days) << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
int main(){
    int n,k;
    cin>>n>>k;
    vector<bool> have(n);
    for(int i=0; i<k; i++){
        int d;
        cin>>d;
        for(int j =0; j<d; j++){
            int aa;
            cin>>aa;
            have.at(aa-1) =true;
        }
    }
    int count  =0;
    for(int i=0; i<n; i++){
        if(!have.at(i)) count++;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>

void solve() {
    int n, m;
    std::cin >> n >> m;

    std::vector<int> indeg(n, 0);
    std::vector<std::vector<int>> to(n);

    while (m--) {
        int u, v;
        std::cin >> u >> v;
        --u, --v;
        to[u].push_back(v);
        ++indeg[v];
    }

    std::vector<bool> used(n, false);
    bool unique = true;
    std::vector<int> ans;

    for (int q = 0; q < n; ++q) {
        std::vector<int> vs;
        for (int i = 0; i < n; ++i) {
            if (!used[i] && indeg[i] == 0) {
                vs.push_back(i);
            }
        }

        if ((int)vs.size() > 1) unique = false;

        int v = vs.front();
        ans.push_back(v);
        used[v] = true;

        for (auto u : to[v]) --indeg[u];
    }

    for (auto v : ans) std::cout << v + 1 << "\n";
    std::cout << !unique << "\n";
}

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

    solve();

    return 0;
}



Measured memory_bytes: 3832
#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;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
ll f[MAX];
ll modex(ll a, ll b)
{
    ll ans = 1;
    while(b)
    {
        if(b & 1)
            ans = (ans * a) % mod;
        b >>= 1;
        a = (a * a) % mod;
    }
    return ans;
}
ll nCr(ll n, ll r)
{
    if(n < r || r < 0)
        return 0;
    return ((f[n] * modex(f[r], mod - 2)) % mod * modex(f[n - r], mod - 2)) % mod;
}
ll cal(ll x, ll y)
{
    return nCr(x + y - 2, y - 1);
}
int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll h, w, a, b, i, ans = 0;
    cin >> h >> w >> a >> b;
    f[0] = 1;
    for(i = 1; i < MAX; i++)
        f[i] = (f[i - 1] * i) % mod;
    ll prev = 0;
    for(i = b + 1; i <= w; i++)
    {
        ll p = cal(h - a, i);
        ll m = (p - prev + mod) % mod;
        ans = (ans + (m * cal(a + 1, w - i + 1)) % mod) % mod;
        prev = p;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8192
S=str(input())
S=list(map(str,S))
count=0
real_count=0
for i in range(len(S)):
  if S[i]=='A' or S[i]=='C' or S[i]=='G' or S[i]=='T':
    for j in range(i,len(S)):
      if S[j]=='A' or S[j]=='C' or S[j]=='G' or S[j]=='T':
        count+=1
      else:
        break
    if count>real_count:
      real_count=count
    count=0
print(real_count)

Measured memory_bytes: 9140
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n),b(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  for(Int i=0;i<n;i++) cin>>b[i];

  using P = pair<Int, Int>;
  vector<P> v;
  for(Int i=0;i<n;i++) v.emplace_back(a[i],0);
  for(Int i=0;i<n;i++) v.emplace_back(b[i],1);

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

  Int ans=1;
  const Int MOD = 1e9+7;
  Int x=0,y=0;
  for(Int i=0;i<(Int)v.size();i++){
    if(v[i].second==0){
      if(y) ans*=y--;
      else x++;
    }else{
      if(x) ans*=x--;
      else y++;
    }
    ans%=MOD;
  }

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


Measured memory_bytes: 7536
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int[] A = new int[3];
        A[0] = sc.nextInt();
        A[1] = sc.nextInt();
        A[2] = sc.nextInt();
        int sum = 0;
        int max = 0;
        for(int i = 0; i < 3; i++){
            sum = sum + A[i];
            if(A[i]>A[max]){
                max = i;
            }
        }
        if(sum - A[max] == A[max]){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}


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

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

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

	int q;
	cin >> q;
	vector<int> t(q);
	for (int i=0;i<t.size();i++){ 
		cin >> t[i];
	}

	vector<int> ans;
	for (int i=0;i<t.size();i++){
		int left = 0;
		int right = n;
		while (left < right) {
			int mid = (left+right) /2;
			if (t[i] < s[mid]) { 
				right = mid;
			} else if (t[i] > s[mid]) {
				left = mid+1;
			} else { 
				ans.push_back(s[mid]);
				break;
			}
		}
	}

	cout << ans.size() << endl;
}




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

// Aにkeyがあるなら1，ないなら0を返す
int search(int A[],int n,int key){
  A[n] = key;
  /*
  for(int i=0;i<n;i++){
    if(A[i]==key){
      return 1;
    }
  }
  return 0;
  */
  int i=0;
  while(A[i]!=key){
    i++;
  }
  return i!=n;
}

int main(){
  int n,q;
  scanf("%d",&n);
  int S[n+1];
  for(int i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  int t;
  int sum=0;
  for(int i=0;i<q;i++){
    scanf("%d",&t);
    if(search(S,n,t)){
      sum++;
    }
  }
  printf("%d\n",sum);

}



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

int main(){
    int n;
    cin >> n;
    vector<int> t(n);
    int ma = 0;
    for(int i = 0; i < n; i++)  cin >> t[i], ma = max(ma, t[i]);
    vector<int> p;
    for(int i = 1; i <= ma; i++){
        if(ma%i == 0)    p.push_back(i);
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        ans += *(lower_bound(p.begin(), p.end(), t[i]))-t[i];
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3300
import java.util.Scanner;

public class Main {
    public static void main(String... args){
        Scanner scan = new Scanner(System.in);
        int p, c;
        while(true){
            int n = scan.nextInt();
            int r = scan.nextInt();
            if(n == 0 && r == 0)break;
            
            int list[] = new int[n];
            int nlist[] = new int[n];
            for(int i = 0;i < n;i++)list[i] = n-i;
            
            for(int i = 0;i < r;i++){
                p = scan.nextInt();
                c = scan.nextInt();
                int j, count = 0;
                for(j = 0;j < c;j++) nlist[j] = list[p-1+j];
                count = j;
                for(j = 0;j < n;j++){
                    if(p-1 <= j && j < p-1+c)continue;
                    nlist[count] = list[j];
                    count++;
                }
                for(j = 0;j < n;j++) list[j] = nlist[j];
            }
            System.out.println(nlist[0]);
            

        
        }
        
        scan.close();
    }

    

}


Measured memory_bytes: 37316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
set<int> to[405];
set<int> inv[405];
bool isDead[405];
vector<i_i> queries;

void query(int x, int y) {
    if(isDead[x]) return;
    if(isDead[y]) {
        isDead[x] = true;
        return;
    }
    for(auto itr = to[y].begin(); itr != to[y].end(); itr++) {
        if(*itr == x) {
            isDead[x] = true;
            return;
        }
        queries.push_back({x, *itr});
    }
    queries.push_back({x, y});
    for(auto itr = inv[y].begin(); itr != inv[y].end(); itr++) {
        queries.push_back({*itr, x});
    }
}

int main() {
    //cout.precision(10);
    int N, M;
    cin >> N >> M;
    while(M--) {
        int x, y;
        cin >> x >> y;
        query(x, y);
        query(y, x);
        while(!queries.empty()) {
            i_i now = queries.back();
            queries.pop_back();
            to[now.first].insert(now.second);
            inv[now.second].insert(now.first);
        }
    }
    /*
    for(int i = 1; i <= N; i++) {
        cout << i << " ";
        if(isDead[i]) {
            cout << "Died" << endl;
            continue;
        }
        for(auto itr = to[i].begin(); itr != to[i].end(); itr++) {
            cout << *itr << " " ;
        }
        cout << endl;
    }
    */
    int ans = 0;
    for(int i = 1; i <= N; i++) {
        if(isDead[i]) continue;
        for(int j = i + 1; j <= N; j++) {
            if(isDead[j]) continue;
            if(to[i].find(j) != to[i].end()) continue;
            if(to[j].find(i) != to[j].end()) continue;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5632
#include <stdio.h>
int N;
int main()
{
	scanf("%d",&N);
	if((N/1000==N%1000/100&&N%1000/100==N%100/10)||(N%1000/100==N%100/10&&N%100/10==N%10))
		printf("Yes");
	else 
		printf("No");
	return 0;
}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int n=0; n<N; n++) {
        cin >> vec[n];
    }
    
    int ans=0;
    for(int n=0; n<N; n++) {
        ans += vec[n];
        int tmp=vec[n];
        for(int i=n; i<N; i++) {
            if(tmp>vec[i]) {
                tmp = vec[i];
            }
            vec[i] -= tmp;
        }
    }
    
    cout << ans << endl;


    return 0;
    
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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


ll gcd(ll x,ll y){
    while(y > 0){
        ll tmp = y;
        y = x % y;
        x = tmp;
    }
    return x;
}

ll lcm(ll x, ll y){
    return x / gcd(x,y) * y;
}

vector<pair<ll,ll>> prime_fact(ll x){
    ll i = 2; 
    vector<pair<ll,ll>> ans;
    while(i*i <= x){
        ll tmp = 0;
        while(x%i == 0){
            tmp++;
            x/=i;
        }
        if(tmp != 0){
            ans.push_back(make_pair(i,tmp));
        }
        i++;
    }
    if(x != 1)ans.push_back(make_pair(x,1));

    return ans;
}

int main(){
    ll N;
    cin>>N;
    vector <pair<ll,ll>> facts = prime_fact(N);
    ll ans  =0 ;
    for(pair<ll,ll> elem: facts){
        rep(i,1,50){
            if(i <= elem.second){
                elem.second -= i;
                ans++;
            }
        }
    }
    
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

void solve(){
  string s;
  cin >> s;
  ll ans=0;
  for(auto &c:s) ans+=ll(c-'0');
  
  
  
 cout << (ans%9?"No":"Yes") << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

void vprint(vector<ll> A){
    ll L = A.size();
    FOR(i, 0, L){
        if(i) cout << ' ';
        cout << A[i];
    }
    cout << endl;
}

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

    // input
    ll N;
    cin >> N;

    vector<ll> A(N+1);
    FOR(i, 0, N+1){
        cin >> A.at(i);
    }

    vector<ll> B(N+1);
    FOR(i, 0, N+1){
        cin >> B.at(i);
    }

    ll sum = 0;
    for(ll a : A){
        sum += a;
    }

    FOR(i, 0, N){
        ll beat = min(A[i], B[i]);
        A[i] -= beat;

        ll rest_power = B[i] - beat;
        ll beat2 = min(rest_power, A[i+1]);
        A[i+1] -= beat2;
    }
    ll rest = 0;
    for(ll a : A){
        rest += a;
    }

    ll ans = sum - rest;
    p(ans);

    return 0;
}

Measured memory_bytes: 1792
def solve():
    s = input()
    a = int(s[:2])
    if a == 0 or a > 12:
        x = "YY"
    else:
        x = "MM"
    b = int(s[2:])
    if b == 0 or b > 12:
        y = "YY"
    else:
        y = "MM"
    if x + y == "YYYY":
        print("NA")
    elif x + y == "MMMM":
        print("AMBIGUOUS")
    else:
        print(x + y)


solve()


Measured memory_bytes: 9064
import java.util.*;
public class Main{
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      System.out.println(n*n*n);
    }
    public static int lcm(int x, int y){
      return x*y/gcd(x,y);
    }
    public static int gcd(int x, int y){
      if(x < y)return gcd(y,x);
      if(y==0)return x;
      return gcd(y,x%y);
    }
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in);) {
			long n = sc.nextLong();

			StringBuilder sb = new StringBuilder();
			

			while (n > 26) {
				long amari = (n % 26) ;
				if(amari == 0) amari = 26;
				sb.insert(0, (char)(amari + 96));
				n = (n-1) / 26l;
			}
			
			long amari1 = n % 26;
			if(amari1 == 0) amari1 = 26;
			sb.insert(0, (char)(amari1 + 96));
			n = (n-1) / 26;

			System.out.println(sb.toString());

		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}


Measured memory_bytes: 35816
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
constexpr ll mod = 1e9 + 7;
#define endl '\n'
 
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  ll K,X;
  cin >> K >> X;
  if (K*500 >= X) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  

}


Measured memory_bytes: 3628
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(non_upper_case_globals)]
#![macro_use]
use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::mem::*;
use std::num::*;
use std::ops::*;
use std::rc::*;
use std::str::*;
use std::string::*;
use std::*;

const MOD: usize = 1000000007;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let N: usize = sc.read();
    let K: usize = sc.read();
    let mut map = HashMap::new();
    map.insert("lisp", 1958);
    map.insert("c", 1972);
    map.insert("rust", 2006);
    let mut st = HashSet::new();
    for _ in 0..K {
        let d: usize = sc.read();
        let a: Vec<usize> = sc.vec(d);
        for x in &a {
            st.insert(*x);
        }
    }
    println!{"{}",N - st.len()}
}

fn next() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok().unwrap();
    s
}
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn gcd(mut a: u64, mut b: u64) -> u64 {
    if a < b {
        std::mem::swap(&mut a, &mut b)
    }
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}
fn yn(val: bool) {
    if val {
        println! {"Yes"}
    } else {
        println! {"No"}
    }
}
fn digits_sum(mut val: usize) -> usize {
    let mut ret = 0;
    while val > 0 {
        ret += val % 10;
        val /= 10;
    }
    ret
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);
impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        Self(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 2120
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

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


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
long long int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
int main()
{
     long long int n,a;
     cin>>n>>a;
     long long int p=n*a,q=p/(gcd(n,a));
     //cout<<p<<" "<<gcd(n,a)<<endl;
     cout<< q;

     
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
using namespace std;

#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)

string s;
string ans = "";

int main() {
  cin >> s;

  ans = "2018/01/" + s.substr(8, 2);

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


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int s;
    scanf("%d",&s);
    int m1=s/100;
    int m2=s%100;
    if(1<=m1 && m1<=12){
        if(1<=m2 && m2<=12) printf("AMBIGUOUS");
        else printf("MMYY");
    }
    else{
        if(1<=m2 && m2<=12) printf("YYMM");
        else printf("NA");
    }
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>

int main(void)
{
    int a, b, i,len;
    scanf("%d%d", &a, &b);
    if(a<=9&&a>=1&&b<=9&&b>=1){
        char A[a+1];
        char B[b+1]; 
        //printf("%d %d\n",(int)sizeof(A),(int)sizeof(B));
        //printf("%s\n",A);
        //printf("%s\n\n",B);
        for (i = 0; i < a; i++)
        {
            A[i] = b+'0';
            //printf("%s\n",A);
        }
        A[i]='\0';

        for (i = 0; i < b; i++)
        {
            B[i] = a+'0';
        }
        B[i]='\0';
        
        if(b<a){
           printf("%s\n",A);
        }
        
        else printf("%s",B);
    }
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <inttypes.h>

#define MB UINT32_C(1000000007) /* mod by */

uint32_t add(uint32_t a, uint32_t b) {
	uint32_t r = a + b;
	if (r >= MB) r -= MB;
	return r;
}

uint32_t mul(uint32_t a, uint32_t b) {
	uint64_t tmp = (uint64_t)a * b;
	return (uint32_t)(tmp % MB);
}

uint32_t pou(uint32_t a, uint32_t b) {
	uint32_t r = 1;
	while (b > 0) {
		if (b & 1) r = mul(r, a);
		a = mul(a, a);
		b = b >> 1;
	}
	return r;
}

uint32_t inv(uint32_t a) {
	return pou(a, MB - 2);
}

#define BCACHE_MAX 10000
uint32_t bcache[BCACHE_MAX + 1] = {1};
uint32_t bcached = 0;

uint32_t bikkuri(uint32_t a) {
	uint32_t i, r = 1;
	if (a <= bcached) return bcache[a];
	for (i = 1; i <= a; i++) {
		r = mul(r, i);
		if (i <= BCACHE_MAX) bcache[i] = r;
	}
	bcached = a;
	return r;
}

/* a個のXとb個のYの重複順列の数 */
uint32_t tyozyun(uint32_t a, uint32_t b) {
	uint32_t t1, t2, t3;
	t1 = bikkuri(a + b);
	t2 = bikkuri(a);
	t3 = bikkuri(b);
	return mul(t1, (mul(inv(t2), inv(t3))));
}

int main(void) {
	int N, K;
	int i;
	if (scanf("%d%d", &N, &K) != 2) return 1;
	for (i = 1; i <= K; i++) {
		if (N-K+1 >= i) { /* i個の区間に分割できるだけの赤いボールがある */
			uint32_t t1, t2;
			t1 = tyozyun(N-K-(i-1), i);
			t2 = tyozyun(K-i, i-1);
			printf("%" PRIu32 "\n", mul(t1, t2));
		} else {
			puts("0");
		}
	}
	return 0;
}

/*
ちょうどi回 → 赤で区切られた青の区間がちょうどi個ある

**まず、青が最低限の数しかない場合を考える**

R...R [BR] R...R [BR] R...R [B] R...R

それぞれのR...Rは0個以上任意個のRの列

N-K-(i-1)個のRとi個の区切り([BR]または[B])の重複順列
→ (N-K+1)! / ((N-K-i+1)! * i!)

**次に、それぞれの区切りへの青の割り当て方を考える**

まず1個ずつ割り当て、残りを適当に割り当てる

i個からK-i個を選ぶ重複組み合わせ

BBBBB|BB||BBB

K-i個のBとi-1個の|の重複順列
→(K-1)! / ((K-i)! * (i-1)!)


*/


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

int main(){
  ll n,m,ans=0; cin>>n>>m;
  if(2*n<=m) {
    m -= 2*n;
    ans += n;
    ans += m/4;
  }
  else {
    ans += m/2;
  }
  cout<<ans;
}

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

int main() {
	int N,M; cin >> N >> M;
	vector<int> love(M,0);
	for(int i = 0 ; i < N ; i++){
		int x; cin >> x;
		for(int l = 0 ; l < x ; l++){
			int k ; cin >> k;
			love[k-1]++;
		}
	}
	int ans = 0;
	for(int f : love){
		if(f == N) ans++;
	}
	cout << ans << endl;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 200005;

int main(){
  FASTER;
  int n;
  cin >> n;
  cout << n * n * n << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void){
    char S[105];
    long long K, x, a[2], l, s, i;
    scanf("%s%lld", S, &K);
    
    if (strlen(S)==1) {
        printf("%lld", (strlen(S)*K)/2);
        return 0;
    }
    
    x=0;
    for (i=0; i<=strlen(S)-2; i++) {
        if (S[i]==S[i+1]) x++;
        else break;
    }
    if (x==strlen(S)-1) {
        printf("%lld", (strlen(S)*K)/2);
        return 0;
    }
    
    if (S[0]==S[strlen(S)-1]) {
        a[0]=0; a[1]=strlen(S)-2;
        for (i=1; i<=strlen(S)-1; i++) {
            if (S[0]==S[i]) a[0]=i;
            else break;
        }
        for (i=strlen(S)-1; i>=1; i--) {
            if (S[0]==S[i]) a[1]=i;
            else break;
        }
        // printf("%lld %lld\n", a[0], a[1]);
        l=0;
        s=0;
        for (i=a[0]+1; i<=a[1]-2; i++) {
            if (S[i]==S[i+1]) l++;
            else {
                s+=(l+1)/2;
                l=0;
            }
            // printf("%lld\n", i);
        }
        s+=(l+1)/2;
        
        x=s*K+(a[0]+1)/2+(strlen(S)-a[1])/2+((a[0]-a[1]+strlen(S)+1)/2)*(K-1);
        // printf("%lld %lld %lld %lld\n", s*K, (a[0]+1)/2, (strlen(S)-a[1])/2, ((a[0]-a[1]+strlen(S)+1)/2)*(K-1));
        printf("%lld", x);
        return 0;
    }
    
    l=0;
    s=0;
    for (i=0; i<=strlen(S)-2; i++) {
        if (S[i]==S[i+1]) l++;
        else {
            s+=(l+1)/2;
            l=0;
        }
    }
    s+=(l+1)/2;
    
    printf("%lld", s*K);
    return 0;
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException{
		InputStreamReader in = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(in);
		String[] line = br.readLine().split(" ");
		int a = Integer.parseInt(line[0]);
		int b = Integer.parseInt(line[1]);
		
		br.close();

		float price;
		
		for(int i = 0;i<10000;i++) {
			if((int)(i*0.08) == a && (int)(i*0.10) == b) {
				System.out.println(i);
				return;
			}
		}
		System.out.println(-1);
	}
}


Measured memory_bytes: 23252
#include<iostream>
#include<cstdio>
#include<map>
typedef long long ll;
const int N=2e5+5;
int n;ll a[N];
std::map<ll,int> t;
int main() {
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%lld",a+i),a[i]+=a[i-1];
    ll ans=0;
    t[0]=1;
    for(int i=1;i<=n;i++) ans+=t[a[i]],t[a[i]]++;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 14336