akhauriyash/Code-Regression huggingface dataset:
N = int(input())
def answer(N: int) -> str:
    x = 0
    for i in range(1, 10):
        for j in range(1, 10):
            if N == i * j:
                x = 1
                return 'Yes'
    if x == 0:
        return 'No'
print(answer(N))

Measured memory_bytes: 9156
#include <bits/stdc++.h>
const int maxn=3001000;
const int mod=1e9+7;
typedef long long ll;
using namespace std;

ll qpow(ll x,ll y)
{
    ll sum=1;
    while(y)
    {
        if(y&1)
            sum=(sum*x)%mod;
        x=x*x%mod;
        y/=2;
    }
    return sum;
}

int main()
{
    int a,b;
    cin>>a>>b;
    if(a<=9&&a>=1&&b<=9&&b>=1){
        cout<<a*b<<endl;
    }else{
        cout<<"-1"<<endl;
    }
}


Measured memory_bytes: 256
N = int(input())
xyh = [list(map(int,input().split())) for n in range(N)]
xyh.sort(key=lambda x:x[2],reverse=True)#高度１でない情報から高さ定めるため
for X in range(0,101):
    for Y in range(0,101):
        H = xyh[0][2] + abs(xyh[0][0]-X) + abs(xyh[0][1]-Y)
        for i in range(1,N):
            x,y,h = xyh[i]
            if h != max(H - abs(x-X) -abs(y-Y),0):
                break
        else:
            print(X,Y,H)
            break

Measured memory_bytes: 9004
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define Mod 998244353
#define endl '\n'
#define IO; ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;

int main()
{
    int n,m,x;
    cin>>n>>m>>x;

    vector<vector<int> > B(n,vi(m));
    vector<int> C(n);

    for(int i=0;i<n;i++)
    {
        cin>>C[i];
        for(int j=0;j<m;j++) cin>>B[i][j];
    }

    ll mn=1e18;

    for(int i=0;i<(1<<n);i++)
    {
        int cost=0;
        vi a(m,0);
        bool flg=true;
        for(int j=0;j<n;j++)
        {
            if(i&(1<<j))
            {
                cost+=C[j];
                for(int k=0;k<m;k++) a[k]+=B[j][k];
            }
        }
        for(int k=0;k<m;k++){
            if(a[k]<x){
                flg=false;break;
            }
        }
        if(flg){
            mn=min(mn,(ll)cost);
        }
    }

    if(mn==1e18) cout<<-1<<endl;
    else cout<<mn<<endl;
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <queue>
 
using namespace std;
static const int INF = 1e9;
static const int SIZE = 101;
typedef pair<int, int> P;
 
int d[SIZE];
vector<int> G[SIZE];
 
void solve()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; ++j)
        {
            int v;
            cin >> v;
            G[u].push_back(v);
        }
    }
    for (int i = 0; i < SIZE; ++i)
    {
        d[i] = INF;
    }
    d[1] = 0;
    queue<P> que;
    que.push(P(0, 1));
    while (!que.empty())
    {
        P p = que.front();
        que.pop();
        int v = p.second;
        for (int i = 0; i < G[v].size(); ++i)
        {
            int to = G[v][i];
            if (d[to] > p.first + 1)
            {
                d[to] = p.first + 1;
                que.push(P(d[to], to));
            }
        }
    }
    for (int i = 1; i <= n; ++i)
    {
        if (d[i] == INF)
        {
            cout << i << " " << -1 << endl;
        }
        else
        {
            cout << i << " " << d[i] << endl;
        }
    }
}
 
int main()
{
    solve();
    return(0);
}


Measured memory_bytes: 3172
import java.util.Scanner;


public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		for(; scanner.hasNext();)
		{
			String[] input = scanner.next().split(",");
			
			float weight = Float.parseFloat(input[1]);
			float height = Float.parseFloat(input[2]);
			
			float bmi = weight/(height*height);
			if(bmi >= 25)
			{
				System.out.println(Integer.parseInt(input[0]));
			}
		}
	}
}

Measured memory_bytes: 25992
n,m=map(int,input().split())
mod=10**9+7
if abs(n-m)>1:
    print(0)
    exit()
a,b=[1,1]
for i in range(1,min(n,m)+1):
    a=(a*i)%mod
if n!=m:
    b*=max(n,m)*a
    print((a*b)%mod)
else:
    b=a
    print((2*a*b)%mod)

Measured memory_bytes: 3064
import string
import sys

def CaesarCipher():
    
    low=string.ascii_lowercase
    
    for cry in sys.stdin: 
        for i in range(1,27):
            
            dec=cry.translate(str.maketrans(low,low[i:]+low[:i]))
    
            if 'this' in dec or 'that' in dec or 'the' in dec:
                print(dec[:-1])
            
                
    
CaesarCipher()

Measured memory_bytes: 8064
n,m = map(int,input().split())
can = []
for i in range(n):
  a,b = map(int,input().split())
  can.append([a,-b])
can.sort()
#print(can)
here = 0
import heapq
pool = []
ans = 0
for i in range(1,m+1):
  while here < n:
    if can[here][0] == i:
      heapq.heappush(pool,can[here][1])
      here += 1
    else:
      break
  if pool != []:
    ans -= heapq.heappop(pool)
print(ans)

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

ll INF = 1ll << 60;

void chmin(int &a, int b){
  if(a > b)
    a = b;
}
void chmax(int &a, int b){
  if(a < b)
    a = b;
}

void llchmin(ll &a, ll b){
  if(a > b)
    a = b;
}
void llchmax(ll &a, ll b){
  if(a < b)
    a = b;
}

int main(){
  int n;
  cin >> n;
  vi a(n);
  vl num(100010, 0);
  ll sum = 0;
  rep(i, 0, n){
    cin >> a[i];
    num[a[i]]++;
    sum += a[i];
  }
  int q;
  cin >> q;
  
  rep(i, 0, q){
    int b, c;
    cin >> b >> c;
    
    sum = sum - b*num[b] + c*num[b];
    cout << sum << endl;
    num[c] += num[b];
    num[b] = 0;
    
  }
  
  return 0;
  
}

Measured memory_bytes: 4500
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  vi C(4);
  string ans="YES";
  rep(i,0,3){
    int A,B; cin>>A>>B;
    C[A-1]++;
    C[B-1]++;
  }
  rep(i,0,4){
    if(C[i]<1||C[i]>2){
      ans="NO";
      break;
    }
  }
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
import java.util.*;

public class Main 
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int m = scan.nextInt();
		
		int a = 0;
		
		ArrayList<Integer> alist = new ArrayList<Integer>();
		
		for(int i = 0; i < n; i++)
		{
			int x = scan.nextInt();
			alist.add(x);
			a += x;
		}
		scan.close();
		
		int v = (a + 4*m-1) / (4 * m);
		
		int count = 0;
		
		for(int i : alist)
		{
			if(i >= v)
			{
				count++;
			}
		}	
				
		if(count >= m)
		{
			System.out.println("Yes");	
		}
		else
		{
			System.out.println("No");
		}
			
	}
}


Measured memory_bytes: 35864
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define dame {cout<< "Impossible" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N; cin>>N;
    map<ll,ll> mp;
    rep(i,N){
        ll x; cin>>x;
        ++mp[x];
    }
    ll mi=(*mp.begin()).first;
    ll ma=(*prev(mp.end())).first;
    if(ma%2==1){
        if(mp[mi]!=2) dame;
    }
    else{
        if(mp[mi]!=1) dame;
    }
    for(ll i=ma; i!=mi; --i){
        if(mp[i]<2) dame;
    }
    cout<< "Possible"<<"\n";
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    //cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define ll long long
#define PI 3.141592653589
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EPS 1e-7
#define f first
#define s second
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
const ll MOD = 1e9+7;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int random_int(int l,int r){return uniform_int_distribution<int>(l,r)(rng);}
ll fast_power(ll x, ll p){
    ll res = 1;
    while(p > 0){
        if(p & 1){
            res = (res * x);
        }
        p = p >> 1;
        x = (x*x);
    }
    return res;
}
int n,k;
int a[100005];
ll dp[100005];

ll solve(int index) {
    if (index == n - 1)
        return 0;
    if (dp[index] != -1) {
        return dp[index];
    }
    ll ans = LLONG_MAX;
    for (int i = 1; i <= k; i++) {
        if (index + i >= n) break;
        ans = min(ans, solve(index + i) + abs(a[index] - a[index + i]));
    }
    return dp[index] = ans;
}

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


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M), b(M);
  rep(i, M) {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
  }

  vector<int> cnt(N);
  rep(i, M) {
    cnt[a[i]]++;
    cnt[b[i]]++;
  }

  int ok = true;
  rep(i, N) {
    if (cnt[i] % 2)
      ok = false;
  }

  if (ok)
    cout << "YES\n";
  else
    cout << "NO\n";
}

Measured memory_bytes: 2560
results = [0 for i in range(10**5)]
for i in range(1, 10**2):
    for j in range(1, 10**2):
        for k in range(1, 10**2):
            n = i*i + j*j + k*k + i*j + j*k + k*i
            results[n] += 1

N = int(input())
for i in range(1, N+1):
    print(results[i])


Measured memory_bytes: 73468
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define ff first
#define ss second
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define in insert
#define pb push_back
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl "\n"
inline ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

const ll mod = 1e9 + 7;
const int N = int(3e5) + 999;
#define int long long int
#define inf 1e18

string s;
int d;

void add(int &a, int b)
{
    a = (a + b) % mod;
}

int32_t main()
{
    IOS;

    cin >> s;
    cin >> d;
    vector<vector<int>> dp(d, vector<int>(2, 0));
    dp[0][0] = 1;
    for (int i = 0; i < s.size(); ++i)
    {
        vector<vector<int>> ndp(d, vector<int>(2, 0));
        for (int sum = 0; sum < d; sum++)
        {
            for (int flag : {0, 1})
            {
                for (int dig = 0; dig <= 9; ++dig)
                {
                    if (dig > s[i] - '0' and !flag)
                        break;
                    add(ndp[(sum + dig) % d][flag || (dig < (s[i] - '0'))], dp[sum][flag]);
                }
            }
        }
        dp = ndp;
    }

    int ans = dp[0][0] + dp[0][1];
    ans %= mod;
    --ans;
    if (ans < 0)
        ans += mod;
    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define rep0(i,n) for (int i=0; i<=(int)(n); ++i)
#define rep1(i,n) for (int i=1; i<=(int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
template<typename T> using Graph = vector<vector<T>>;
template<typename T> using Spacial = vector<vector<vector<T>>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

template<typename T> struct is_pair : false_type{};
template<typename T1, typename T2> struct is_pair<pair<T1, T2>> : true_type{};
template<typename T> struct is_vector : false_type{};
template<typename T> struct is_vector<vector<T>> : true_type{};

template<typename T1, typename T2>
istream &operator >> (istream &istr, pair<T1, T2> &p) {
  istr >> p.first >> p.second;
  return istr;
} 
template<typename T1, typename T2>
ostream &operator << (ostream &ostr, const pair<T1, T2> &p) {
  ostr << p.first << " " << p.second;
  return ostr;
}
template<typename T>
ostream &operator << (ostream &ostr, const vector<T> &vec) {
  if (vec.empty()) return ostr;
  bool vp = is_vector<T>() || is_pair<T>();
  ostr << vec.front();
  for (auto itr = ++vec.begin(); itr != vec.end(); ++itr) {
    ostr << (vp ? "\n" : " ") << *itr;
  }
  return ostr;
}

template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

int modpow(int a, long long n, int mod = MOD) {
  int ret = 1;
  do {
    if (n & 1) ret = 1LL * ret * a % mod;
    a = 1LL * a * a % mod;
  } while (n >>= 1);
  return ret;
}

template<typename T>
T GCD(T a, T b) { return b ? GCD(b, a%b) : a; }
template<typename T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

template<typename T1, typename T2>
bool CompareBySecond(pair<T1, T2> a, pair<T1, T2> b) {
  return a.second != b.second ? a.second < b.second : a.first < b.first;
}
template<typename T>
bool CompareBySlope(pair<T, T> a, pair<T, T> b) {
// counterclockwise from 12 o'clock direction
  if (a.first * b.first < 0) return a.first < b.first;
  if (a.first == 0) return a.second >= 0 || b.first > 0;
  if (b.first == 0) return b.second < 0 && a.first < 0;
  return a.second * b.first < a.first * b.second;
}


/* -------- <templates end> -------- */


void solve() {
  string s; cin >> s;
  if (s.size() % 2 == 0) {
    string t;
    rep(i,s.size()/2) t += "hi";
    if (s == t) {
      cout << "Yes\n";
      return;
    }
  }
  cout << "No\n";
}


/* -------- <programs end> -------- */


signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
N = int(input())
x = input().split()
X = [(int(x[i]), i) for i in range(N)]
X.sort()
ans = [0]*N
for i in range(N // 2):
    ans[X[i][1]] = X[N // 2][0]
for i in range(N // 2, N):
    ans[X[i][1]] = X[N // 2 - 1][0]
for i in range(N):
    print(ans[i])

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


int main()
{
	int N;
	cin>>N;
	vector<int> A(N);
	vector<int> B(N);
	rep(i,N) cin>>A[i];
	rep(i,N) cin>>B[i];
	ll r=0;
	rep(i,N)
	{
		if(A[i]<=B[i])
		{
			r+=(B[i]-A[i])/2;
		}
	}
	rep(i,N)
	{
		if(A[i]>B[i])
		{
			if(A[i]-B[i]<=r)
			{
				r-=A[i]-B[i];
			}
			else
			{
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 3696
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue = BinaryHeap!(Array!long, "a<b");
// dfmt on

void main()
{
    long A, B, C;
    scan(A, B, C);
    foreach (x; 1 .. 1000)
        if (A * x % B == C)
        {
            writeln("YES");
            return;
        }
    writeln("NO");
}


Measured memory_bytes: 380
/*
    Author:DurJoy
*/
#include<bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int length = s.length();
    int temp = 0 , ans = 0;
    for(int i = 0; i < length; i++){
        if(s[i] =='A' || s[i] =='C' || s[i]=='T' || s[i] =='G'){
           temp++;
        }
        else{
            temp = 0;
        }
        ans = max(ans , temp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int l, r, d;
	int cnt = 0;
	scanf("%d %d %d", &l, &r, &d);
	for(int i = l; i <= r; i++){
		if(i % d == 0){
			cnt++;
		}
	}
	printf("%d", cnt);
}


Measured memory_bytes: 1716
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
String ans="";
    for (int i = 0; i <3; i++) {
        String s=sc.next();
        s=s.toUpperCase();
        ans=ans+Character.toString(s.charAt(0));
    }
    out.println(ans);
}
}

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

int main()
{
	int n;
	cin>>n;
	int x;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if(x%2!=0)
		  continue;
		if(x%3!=0&&x%5!=0)
		{
			cout<<"DENIED";
			return 0;
		}  
	}
	  cout<<"APPROVED";
	
	return 0;
}

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

int main(){
    int n,a,b;
    cin>>n>>a>>b;
    vector<int> ans(n,-1);
    bool stop=true;
    if(a<b){
        if(n/b+(n%b!=0)>a){
            cout<<-1<<endl;
            return 0;
        }
        if(a+b>n+1){
            cout<<-1<<endl;
            return 0;
        }
        int num=b;
        int inde=0;
        while(stop){
            a--;
            for(int i=0;i<b && stop;i++){
                ans[inde]=num;
                inde++;
                num--;
                if(a==n-inde){
                    int drop=b-i-1;
                    for(int j=inde-1;j>=inde-i-1;j--){
                        ans[j]-=drop;
                        num=ans[j];
                    }
                    num++;
                    while(inde<n){
                        ans[inde]=num;
                        num++;
                        inde++;
                    }
                    stop=false;
                }
            }
            num+=2*b;
        }
        for(int i=0;i<n;i++){
            cout<<ans[i]<<(i==n-1 ? "\n" : " ");
        }
    }
    else{
        if(n/a+(n%a!=0)>b){
            cout<<-1<<endl;
            return 0;
        }
        if(a+b>n+1){
            cout<<-1<<endl;
            return 0;
        }
        int num=n-a+1;
        int inde=0;
        while(stop){
            b--;
            for(int i=0;i<a && stop;i++){
                
                ans[inde]=num;
                inde++;
                num++;
                if(b==n-inde){
                
                    int upper=a-i-1;
                    for(int j=inde-1;j>=inde-i-1;j--){
                        ans[j]+=upper;
                        num=ans[j];
                    }
                    num--;
                    while(inde<n){
                        ans[inde]=num;
                        num--;
                        inde++;
                    }
                    stop=false;
                }
            }

            num-=2*a;
            
        }
        for(int i=0;i<n;i++){
            cout<<ans[i]<<(i==n-1 ? "\n" : " ");
        }

    }
    
    return 0;
}

Measured memory_bytes: 3328
#include<iostream>
using namespace std;
int main()
{
  int n,dif=0;
  cin>>n;
  int v[n],c[n];
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  for(int i=0;i<n;i++){
    cin>>c[i];
  }
  for(int i=0;i<n;i++){
    if(v[i]-c[i]>0)
    	dif+=v[i]-c[i];
  }
  cout<<dif;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(void) {
	int N, M, i, p;
	int a[1000];
	float s,t;
	p = 0;
	s = 0;
	scanf("%d %d", &N, &M);
	for (i = 0; i < N; i++) {
		scanf("%d", &a[i]);
		s += a[i];
	}
	t = s / (4 * M);
	for (i = 0; i < N; i++) {
		if (a[i] >= t)
			p++;
	}
	if (p >= M)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 128
fun main() {
    val n = readLine()!!.toInt()
    val resultMap = IntArray(n + 1) { 0 }

    for (a in 1..n) {
        if (a * a > n) continue
        for (b in 1..n) {
            if (a * a + b * b + a * b > n) continue
            for (c in 1..n) {
                val count = a * a + b * b + c * c + a * b + b * c + c * a
                if (count <= n) {
                    resultMap[count] += 1
                }
            }
        }
    }

    resultMap.takeLast(n).forEach { println(it) }
}


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

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

    int a, b, x;
    cin >> a >> b >> x;

    if(a<=x && x-a <= b) puts("YES");
    else puts("NO");
}

Measured memory_bytes: 256
#include<iostream>

#include<math.h>

using namespace std;

int main (){
int n,k;
cin >> n >> k;
int tab[100001];
int mi = 1000000000;
for(int i = 1 ; i <= n; i++){
    cin >> tab[i];
    if( i >= k ){
        mi = min(mi , tab[i] - tab[i-k+1] + min(abs(tab[i]),abs(tab[i-k+1])));
    }
}
cout << mi;
return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
    using namespace std;
    int main(){
		int r=0,l=0;
		string s;
		int a[100005]={};
		cin>>s;
		for(int i=0;i<s.size();i++){
			if(s[i]!='L' || s[i-1]!='L')
			r++;
			if(r!=0 && s[i]=='L'){
				a[i-1]=r/2;
				a[i]=r/2+r%2;
				r=0;
			}
		}
		for(int i=s.size()-1;i>=0;i--){
			if(s[i-1]!='R' && s[i]!='R')
			l++;
			if(l!=0 && s[i]=='R'){
				a[i+1]+=l/2;
				a[i]+=l/2+l%2;
				l=0;
			}
		}
		for(int i=0;i<s.size();i++){
			cout<<a[i]<<" ";
		}
		cout<<endl;
      return(0);
	}

Measured memory_bytes: 1024
import scala.collection.mutable._
import io.StdIn.readInt
import io.StdIn.readLine

object Main extends App {
  val out = new java.io.PrintWriter(System.out)

  def calculate(q:Array[Int],d:Array[Array[Int]]):Int = {
    val ts = q(0)
    val te = q(1)
    val st = q(2)

    val a = d.filter(_(2) == st)
    val map = new HashMap[Int,Array[Int]]
    val log = ListBuffer.empty[Tuple2[Int,Int]]
    a.foreach(l => {
      if(l(3) == 1) map.put(l(1),l)
      else {
        val e = map.remove(l(1)).get
        log += {( e(0), l(0) )}
        }
    })
    // println(log.mkString)

    val time = Array.ofDim[Boolean](721)
    log.foreach(t => {
      val s = math.max(ts, t._1) -540
      val e = math.min(te, t._2) -540
      (s until e).foreach(time(_) = true)
    })
    time.count(_ == true)
  }

  def solve(s:String):Unit = {
    val Array(n, m) = s.split(" ").map(_.toInt)
    val r = readInt
    val d = Iterator.continually(readLine)
      .take(r)
      .map(_.split(" ").map(_.toInt))
      .toArray
    val q = readInt
    Iterator.continually(readLine)
      .take(q)
      .map(_.split(" ").map(_.toInt))
      .foreach(qd => out.println(calculate(qd,d)))
  }

  Iterator.continually(readLine)
    .takeWhile(_ != "0 0")
    .foreach(solve(_))
  
  out.flush
}


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

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, x;
  cin >> a >> b >> x;
  if (a + b >= x && a <= x) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a;
  long long int b=0,c;
  scanf("%d",&a);
  for(int i=0; i<a; i++){
    scanf("%lld",&c);
    while(c%2==0){
      b++;c=c/2;
    }
  }
  printf("%lld",b);
  return 0;}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline
import heapq as hq
def print_ans(N, M, input_line):
    """Test Case
    >>> print_ans(3, 3, "2 13 8")
    9
    >>> print_ans(4, 4, "1 9 3 5")
    6
    >>> print_ans(1, 100000, "1000000000")
    0
    >>> print_ans(10 ,1, "1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000")
    9500000000
    """
    ar = [-int(i) for i in input_line.split()]
    hq.heapify(ar)
    for _ in range(M):
        hq.heappush(ar, -(-hq.heappop(ar) // 2))
    
    print(-sum(ar))

if __name__ == '__main__':
    N, M = map(int, input().rstrip().split())
    input_line = input().rstrip()
    print_ans(N, M, input_line)


Measured memory_bytes: 15228
#include<bits/stdc++.h>
using namespace std;
int n,a,b,ans=0;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++){
    	cin>>a>>b;
    	ans+=b-a+1;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
"use strict"
function main(arg) {
    var data = arg.split("\n")[0].split(" ").map(Number)
    var k = data[2]
    var a = data[0]
    var b = data[1]
    if (a >= k) {
        a = a - k
        console.log(a + " " + b)
        return
    } else {
        k = k - a
        a = 0
        if (b >= k) {
            b = b - k
            console.log(a + " " + b)
            return 
        } else {
            console.log(0 + " " + 0)
            return
        }
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main()
{    
    ll n;
    cin >> n;
    ll a[n],b[n],c[n];
    for(ll i=0;i<n;++i)
        cin >> a[i] >> b[i] >> c[i];
    vector<ll> a1(n),b1(n),c1(n);
    a1[0]=a[0];
    b1[0]=b[0];
    c1[0]=c[0];
    for(ll i=1;i<n;++i)
    {
        a1[i]=max(b1[i-1],c1[i-1])+a[i];
        b1[i]=max(c1[i-1],a1[i-1])+b[i];
        c1[i]=max(a1[i-1],b1[i-1])+c[i];
    }
    cout << max(c1[n-1],max(b1[n-1],a1[n-1]));
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include<algorithm>
int main()
{
	using namespace std;

	int a,b;
	cin >> a >> b;
	if ((a + b)%2 > 0) {
		cout << (a + b) / 2 + 1 << endl;
	}
	else {
		cout << (a + b) / 2 << endl;
	}
}


Measured memory_bytes: 256
import math

N = int(input())

field = [[-1 for i in range(101)] for j in range(101)]

tmp = []
for i in range(N):
	x,y,h = map(int,input().split())
	if h == 0:
		tmp.append([x,y,h])
		continue
	for j in range(101):
		for k in range(101):
			if h == 0:
				if field[j][k] - abs(x-j) - abs(y-k) > 0:
					field[j][k] = -2
			else:
				if field[j][k] == -1:
					field[j][k] = h + abs(x-j) + abs(y-k)
				elif field[j][k] != h + abs(x-j) + abs(y-k):
					field[j][k] = -2

for x,y,h in tmp:
	for j in range(101):
		for k in range(101):
			if h == 0:
				if field[j][k] - abs(x-j) - abs(y-k) > 0:
					field[j][k] = -2
			else:
				if field[j][k] == -1:
					field[j][k] = h + abs(x-j) + abs(y-k)
				elif field[j][k] != h + abs(x-j) + abs(y-k):
					field[j][k] = -2

for i in range(101):
	for j in range(101):
		if field[i][j] > 0:
			print(i,j,field[i][j])

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

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

Measured memory_bytes: 256
import java.util.Scanner;
import java.math.BigInteger;

public class Main {
	private Scanner sc;
	private BigInteger getLoopSteps( int a, int m ) {
		int counter = 1;
		for( int x = a % m; x != 1; x = a * x % m, counter++ );
		return new BigInteger( counter + "" );
	}
	private void run() {
		sc = new Scanner( System.in );
		while( sc.hasNext() ) {
			int a1, m1, a2, m2, a3, m3;
			a1 = sc.nextInt();
			m1 = sc.nextInt();
			a2 = sc.nextInt();
			m2 = sc.nextInt();
			a3 = sc.nextInt();
			m3 = sc.nextInt();
			if( a1 == 0 && m1 == 0 && a2 == 0 && m2 == 0 && a3 == 0 && m3 == 0 ) {
				break;
			}
			BigInteger xc = getLoopSteps( a1, m1 );
			BigInteger yc = getLoopSteps( a2, m2 );
			BigInteger zc = getLoopSteps( a3, m3 );
			BigInteger gcdxy  = xc.gcd( yc );
			BigInteger lcmxy = xc.multiply( yc ).divide( gcdxy );
			BigInteger lcmxyz = lcmxy.multiply( zc ).divide( lcmxy.gcd( zc ) );
			System.out.println( lcmxyz );
		}
		sc.close();
	}
	public static void main( String[] args ) {
		new Main().run();
	}
}

Measured memory_bytes: 20568
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair

using namespace std;

typedef pair<int, int> pii;
const int N = int(1e5) + 7;
const int inf = int(1e9);

int n, a[N], t[N];
ll b[N], m;

void Update(int x) {for(; x < N; x += (x & -x)) ++t[x];}
int Get(int x) {int res = 0; for(; x > 0; x -= (x & -x)) res += t[x]; return res;}

bool Check(int k) {
    memset(&t, 0, sizeof t);
    ll cnt = m; vector<int> v;
    for(int i = 1; i <= n; ++i) {
        b[i] = (a[i] >= k) + b[i - 1];
        v.pb(b[i] * 2 - i);
    }
    v.pb(0); sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    Update(lower_bound(v.begin(), v.end(), 0) - v.begin() + 1);
    for(int i = 1; i <= n; ++i) {
        b[i] = lower_bound(v.begin(), v.end(), b[i] * 2 - i) - v.begin() + 1;
        cnt -= Get(b[i]); Update(b[i]);
    }
    return cnt <= 0;
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i];
    if(n == 1) return cout << a[1], 0;
    m = 1ll * n * (n - 1) / 2 + n;
    m = m / 2;
    int low = 1, mid, high = int(1e9);
    while(low <= high) {
       mid = (low + high) >> 1;
       if(Check(mid)) low = mid + 1;
       else high = mid - 1;
    }
    cout << high;
}


Measured memory_bytes: 2792
s=int(input())
if s+1<=10**9:
  b=str(s+1)
  a=['0','0',b,'1','1','1']
else:
  a=int(s**(1/2))
  if a**2>=s:
    a_=a
  else:
    if a*(a+1)>=s:
      a_=a+1
    else:
      if a*(a+2)>=s and a+2<=10**9:
        a_=a+2
      else:
        a_=a+1
        a+=1
  x2=str(a)
  y3=str(a_)
  
  y2=str(1)
  x3=str(int(x2)*int(y3)-s)
  x1=str(0)
  y1=str(0)
  a=[x1,y1,x2,y2,x3,y3]
print((' ').join(a))


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

#define rep(i, b) for(int i = 0; i < b; i++)
#define repi(i, a, b) for(int i = a; i < b; i++)
#define all(c) c.begin(),c.end()
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define MAX_V 1001
#define MAX_E 401
#define INF INT_MAX
#define MOD 1000000007
#define EPS 1e-7
typedef long long ll;
inline int toInt(std::string s) { int v; std::istringstream sin(s); sin >> v; return v; }
template<class T> inline std::string toString(T x) { std::ostringstream sout; sout << x; return sout.str(); }
using namespace std;

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
#define X real()
#define Y imag()
typedef pair<int, int> pii;

struct Ren{
	ll h;
	ll kaku;
};
int main()
{
	ll N;
	cin >> N;
	vector<ll> T(N), A(N);
	rep(i, N)
	{
		cin >> T[i];
	}
	rep(i, N)
	{
		cin >> A[i];
	}

	vector<Ren> MT(N), MA(N);

	rep(i, N)
	{
		if (i == 0)
		{
			MT[i].h = T[i];
			MT[i].kaku = 1;
		}
		else if (T[i - 1] < T[i])
		{
			MT[i].h = T[i];
			MT[i].kaku = 1;
		}
		else{
			MT[i].h = T[i];
			MT[i].kaku = 0;
		}
	}

	for (ll i = N - 1; i > -1;i--)
	{
		if (i == N - 1)
		{
			MA[i].h = A[i];
			MA[i].kaku = 1;
		}
		else if (A[i + 1] < A[i])
		{
			MA[i].h = A[i];
			MA[i].kaku = 1;
		}
		else{
			MA[i].h = A[i];
			MA[i].kaku = 0;
		}
	}

	rep(i, N)
	{
		if (MT[i].kaku == 1)
		{
			if (MT[i].h > MA[i].h)
			{
				cout << 0 << endl;
				return 0;
			}
		}
		else if (MA[i].kaku == 1)
		{
			if (MA[i].h > MT[i].h)
			{
				cout << 0 << endl;
				return 0;
			}
		}
	}
	ll ans = 1;
	rep(i, N)
	{
		if (MT[i].kaku == 1)
		{
			ans = ans * (1 % MOD) % MOD;
		}
		else if (MA[i].kaku == 1)
		{
			ans = ans * (1 % MOD) % MOD;
		}
		else
		{
			ans = ans * (min(MA[i].h,MT[i].h) % MOD) % MOD;
		}
	}

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

Measured memory_bytes: 4992
def main():
    import itertools
    n = int(input())
    test = []
    for i in range(n):
        a = int(input())
        t = []
        for j in range(a):
            x,y = map(int,input().split())
            t.append([x,y])
        test.append(t)
    stats = ((0,1) for i in range(n))
    ans = 0
    for k in itertools.product(*stats):
        tf = [-1 for i in range(n)]
        flg = 0
        for i in range(len(k)):
            if k[i]==1:
                for t in test[i]:
                    if tf[t[0]-1]==-1:
                        tf[t[0]-1] = t[1]
                    else:
                        if tf[t[0]-1] != t[1]:
                            flg = 1
                            break
        for i in range(len(k)):
            if tf[i] != -1:
                if tf[i] != k[i]:
                    flg = 1
                    break
        if flg == 0:
            if ans < sum(k):
                ans = sum(k)
    print(ans)

if __name__ == "__main__":
    main()


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

//入力
ll X,Y,Z,K;
vector<ll> A(X);
vector<ll> B(Y);
vector<ll> C(Z);
vector<ll> ans;

int main(){
    cin >> X >> Y >> Z >> K;
    A.assign(X,0);
    B.assign(Y,0);
    C.assign(Z,0);
    for(int i=0; i<X; i++) cin >> A[i];
    for(int i=0; i<Y; i++) cin >> B[i];
    for(int i=0; i<Z; i++) cin >> C[i];

    vector<ll> A_B(X*Y);
    for(int i=0; i<X; i++){
        for(int j=0; j<Y; j++){
            A_B.push_back(A[i]+B[j]);
        }
    }

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

    vector<ll> A_B_C(K*Z);
    for(int i=1; i<=K; i++){
        for(int j=0; j<Z; j++){
            A_B_C.push_back(A_B[A_B.size()-i] + C[j]);
        }
    }

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

    for(int i=1; i<=K; i++){
        cout << A_B_C[A_B_C.size() - i] << endl;
    }
}

Measured memory_bytes: 64888
// I make this just for fun because i'm done
// Aimi Haraguni >> Konomi Suzuki >> Yui >>  Ikimono Gakari >> Garnidelia >> Kalafina >> Eir Aoi.   .. dude? 
// problems that involves any kind of persistent data structures are the best of the best, are not them?
 
// #pragma GCC optimize ("Ofast,unroll-loops")
// #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
 
#define pb push_back
#define ff  first
#define ss second
#define tm1 first
#define tm2 second.first
#define tm3 second.second
#define sz(x) ll(x.size())
#define all(v) (v).begin(), (v).end()
// #define fill(x, v) memset(x, v, sizeof(x))
#define FER(i,a,b) for(int i=int(a); i< int(b); ++i)
#define IFR(i,a,b) for(int i=int(a); i>=int(b); --i )
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
/*
// #define N 21000000
// #define M 19
// #define mod3 9
#define mod  998244353
#define mod1 1000000007
#define mod2 1000000009
*/
#define mody 998244353
#define bas 987625403
#define sqr(x) (x)*(x)  
#define INF 3000000000000000000
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii > tri;
typedef vector<ll> vi;
typedef vector<vi> vv;
typedef vector<ii> vii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> S_t;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

#define trace(...) fff(#__VA_ARGS__, __VA_ARGS__)
template<typename t> void fff(const char* x, t&& val1) { cout<<x<< " : "<<val1<<"\n";}
template<typename t1, typename... t2> void fff(const char* x, t1&& val1, t2&&... val2){
    const char* xd=strchr(x+1, ',');
    cout.write(x, xd-x)<<" : "<<val1<<" | ";
    fff(xd+1, val2...);
}
/*
inline ll add(ll a, ll b) { return a+b < mod? a+b : a+b-mod;}
inline ll rem(ll a, ll b) { return a >= b? a - b: a- b + mod;}
inline ll mul(ll a, ll b) { return (long long) a*b%mod;}
inline void Mul(ll &a, ll b) { a = (long long) a*b%mod;}
inline ll bp(ll a, ll p){
    ll ret;
    for(ret = 1; p; p>>=1, Mul(a, a)) (p & 1) && (Mul(ret, a), 1);
    return ret;
}
*/

inline void read(ll &x){cin>>x;}

int main(){
	fastio;
	long double a, b, x; cin>>a>>b>>x;
	cout<<fixed<<setprecision(11);
	x/=a;
	long double ret;
	if(a*b < 2*x){
		ret = atan2(2*(a*b - x), sqr(a));
	}
	else{
		ret = acos(-1)-2*atan2(2*x, sqr(b));
		ret/=2;
	}
	ret *=180;
	ret/=acos(-1);
	cout<<ret<<"\n";
	return 0;
}

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

int main(){
  ll h, w;
  string s;
  cin >> h >> w;
  vector<vector<ll>> Ans(h, vector<ll>(w,1000));
  vector<vector<char>> S(h, vector<char>(w));

  RAP(i, h){
    cin >> s;
    RAP(j, s.length()){
      S[i][j] = s[j];
    }
  }
  if(S[0][0]=='#'){
    Ans[0][0] = 1;
  }else{
    Ans[0][0] = 0;
  }
  RAP(i, h){
    RAP(j, w){
      if(j != w-1){
        if(S[i][j] == '.' && S[i][j+1]=='#'){
          Ans[i][j+1] = min(Ans[i][j+1], Ans[i][j] + 1);
        }else{
          Ans[i][j+1] = min(Ans[i][j+1], Ans[i][j]);
        }
      }
      if(i != h-1){
        if(S[i][j] == '.' && S[i+1][j]=='#'){
          Ans[i+1][j] = min(Ans[i+1][j], Ans[i][j] + 1);
        }else{
          Ans[i+1][j] = min(Ans[i+1][j], Ans[i][j]);
        }
      }
    }
  }
  /*
  RAP(i, h){
    RAP(j, w){
      cout << Ans[i][j] << " ";
    }
    cout << endl;
  }
  */
  cout << Ans[h-1][w-1] << endl;
  return 0;
}


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

using namespace std;

#define endl "\n"
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()

typedef long long ll;


int main(){
	ios_base::sync_with_stdio(0);
//	cin.tie(0);
	int n,a,b;
	cin>>n>>a>>b;
	cout<<min(n*a,b)<<endl;
	return 0;
}


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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define dbg(var) {std::cout << #var << "  = " << var << nl;}
#define vi vector<int>
typedef long long ll;

using namespace std;


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(0); 
	
	int n , m;
	cin >> n >> m;
	
	vi a(n);
	for(auto& el : a) cin >> el;
	SORT(a);
	
	vector<pii> q(m);
	for(auto& el : q) cin >> el.se >> el.fi;
	SORT(q);
	reverse(all(q));
	
	int i = 0;
	for(auto& el : q)
	{
		while(i < n && a[i] < el.fi && el.se > 0)
		{
			--el.se;
			a[i] = el.fi;
			++i;
		}
	}
	
	cout << accumulate(all(a) , 0LL) << endl;
	
	return 0;
}

Measured memory_bytes: 1408
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cctype>
#include<queue>
using namespace std;
const int inf=0x3f3f3f3f;
int n,a,b;

int main()
{
	scanf("%d%d%d",&n,&a,&b);
	if(n==1){if(a==b)printf("1");else printf("0");return 0;}
	if(a>b){printf("0");return 0;}
	printf("%lld",1ll*(b-a)*(n-2)+1);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
// #define int cpp_int
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}

inline void solve(void){
  int P,Q,R;
  in(P,Q,R);
  out(P+Q+R-max({P,Q,R}));
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include <cstdio>

int main(){
  int n;
  scanf("%d",&n);
  while(n--){
    int a=0,b=0,m;
    for(int i=0; i<10; i++){
      scanf("%d",&m);
      if(a<m)
	a=m;
      else if(b<m)
	b=m;
      else{
	printf("NO\n");
	while(getchar()!='\n');
	goto hoge;
      }

      if(a<b){
	int c; 
	c=a;a=b;b=c;
      }
    }
    printf("YES\n");
  hoge: ;
  }
}

Measured memory_bytes: 1012
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int N;
int main() {
	cin>>N;

	int A,B,C,D;
	A=N/1000;
	B=(N%1000)/100;
	C=(N%1000)%100/10;
	D=N%10;

	if(A==B&&B==C)cout<<"Yes"<<endl;
	else if(B==C&&C==D)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//Binary_Indexed_Tree (Range_Sum_Query)
//(1-indexed)
const long long max_n = 1 << 20;
long long n;
long long bit[max_n+1]={0};
//i番目(1-indexed)までの和
long long sum(long long i){
    long long s = 0;
    if(i==0) return 0;
    while(i > 0){
        s += bit[i];
        i -= i & -i;
    }
    return s;
}
//i番目(1-indexed)にxを加える
void add(long long i,long long x){
    while(i <= n){
        bit[i] += x;
        i += i & -i;
    }
}
int main() {
    // your code goes here
    ll i,j,d,a,x[200005],h[200005],r[200005],l[200005],pb=1,ko[200005],ans=0;
    vector<pair<ll,ll>> v;
    vector<ll> vx;
    cin >> n >> d >> a;
    d*=2;
    for(i=0;i<n;i++){
        cin >> x[i] >> h[i];
        if(h[i]%a==0) h[i]/=a;
        else h[i]=(h[i]-h[i]%a)/a+1;
        v.push_back({x[i],h[i]});
        vx.push_back(x[i]);
    }
    v.push_back({-1,0});
    vx.push_back(-1);
    sort(v.begin(),v.end());
    sort(vx.begin(),vx.end());
    for(i=1;i<=n;i++){
        x[i]=v[i].first;
        h[i]=v[i].second;
    }
    for(i=1;i<=n;i++){
        auto it=upper_bound(vx.begin(),vx.end(),x[i]+d);
        it--;
        r[i]=(it-vx.begin());
    }
    for(i=1;i<=n;i++){
        while(pb<=r[i]){
            l[pb]=i;
            pb++;
        }
    }
    for(i=1;i<=n;i++){
        ko[i]=sum(i)-sum(l[i]-1);
        ko[i]=min(ko[i],h[i]);
        ko[i]=h[i]-ko[i];
        add(i,ko[i]);
        ans+=ko[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 16364
import numpy as np
L= np.array([list(map(int, input().split())) for i in range(3)])

a1 = 0
b1 = L[0][0]
b2 = L[0][1]
b3 = L[0][2]
a2 = L[1][0] - b1
a3 = L[2][0] - b1
if (a2 + b2 != L[1][1] or a2 + b3 != L[1][2] or 
    a3 + b2 != L[2][1] or a3 + b3 != L[2][2]):
  print ("No")
else:
  print ("Yes")


Measured memory_bytes: 12500
let () =
  let n = Scanf.scanf "%d\n" (fun x -> x) in
  let f x = x mod 3 = 0 || String.contains (string_of_int x) '3' in
  let rec range x y = if x > y then [] else x :: range (x+1) y in
  Printf.printf " ";
  List.filter f (range 1 n) |> List.map string_of_int |> String.concat " " |> print_endline
    

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

int n, a, b;

int main()
{
//	freopen( "exp.in", "r", stdin );
//	freopen( "mycode.out", "w", stdout );
    scanf( "%d%d%d", &n, &a, &b );

    if( a + b > n + 1 || ll(a) * b < n ) {
        printf( "-1\n" ); return 0;
    }

    for( int i = n-a+1; i <= n; i ++ )
        printf( "%d ", i );
    b --; n -= a; 

    while( n )
    {
        if( n == b )
        {
            for( ; n >= 1; n -- )
                printf( "%d ", n ); 
            continue;
        }

        int tmp = 0; b --;
        for( ; n >= 1 && tmp < a; n --, tmp ++ )
            if( n == b ) break; 
        for( int i = 1; i <= tmp; i ++ )
            printf( "%d ", n + i );
    }
    printf( "\n" );

    return 0;
}

Measured memory_bytes: 2304