akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cassert>

using namespace std;
using ll = long long;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> G[n];
    vector<int> deg(n, 0);
    for(int i = 0; i < n-1+m; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        deg[b]++;
    }
    queue<int> que;
    for(int i = 0; i < n; i++){
        if(deg[i] == 0){
            que.push(i);
        }
    }
    vector<int> order;
    vector<int> ans(n, 0);
    while(!que.empty()){
        int now = que.front(); que.pop();
        order.push_back(now);

        for(auto v: G[now]){
            deg[v]--;
            if(deg[v] == 0) {
                que.push(v);
                ans[v] = now+1;
            }
        }
    }

    // for(int i = 0; i < n; i++){
    //     cout << order[i] << endl;
    // }

    // cout << "---" << endl;

    

    // for(int i = 0; i < n-1; i++){
    //     int now = order[i];
    //     int mi = -1;
    //     for(auto v : G[now]){
    //         mi = max(v, mi);
    //     }
    //     ans[now] = mi + 1;
    // }
    // ans[order[n-1]] = 0;
    for(int i = 0; i < n; i++){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 10084
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var N = int.Parse(Console.ReadLine());

            var ans = "YES";
            var AList = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var dict = new Dictionary<int, int>();
            foreach(var A in AList)
            {
                if (dict.ContainsKey(A))
                {
                    ans = "NO";
                    break;
                }
                else
                {
                    dict[A] = A;
                }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 41424
#include <stdio.h>

int main(void)
{
	int a,b,c,d;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	for(;;){
		c-=b;
		if(c<1){
			printf("Yes");
			break;
		}
		a-=d;
		if(a<1){
			printf("No");
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1728
#include<iostream>
#include<algorithm>
#include<vector>
using lint=int64_t;
using namespace std;

int main()
{
	int H,W;
	int a[510][510];
	
	cin >> H >> W;
	for(int i=0;i<H;i++)
	{
		for(int j=0;j<W;j++)
		{
			cin >> a[i][j];
		}
	}
	
	vector<pair<int,int>> pv;
	vector<pair<int,int>> nt;
	for(int i=0;i<H;i++)
	{
		if(i%2==0)
		{
			for(int j=0;j<W;j++)
			{
				if(i==H-1 && j==W-1)
					break;
				if(a[i][j]%2==0)
					continue;
				
				pv.push_back(make_pair(i,j));
				a[i][j]--;
				if(j!=W-1)
				{
					nt.push_back(make_pair(i,j+1));
					a[i][j+1]++;
				}
				else
				{
					nt.push_back(make_pair(i+1,j));
					a[i+1][j]++;
				}
			}
		}
		else
		{
			for(int j=W-1;j>=0;j--)
			{
				if(i==H-1 && j==0)
					break;
				if(a[i][j]%2==0)
					continue;
				pv.push_back(make_pair(i,j));
				a[i][j]--;
				if(j!=0)
				{
					nt.push_back(make_pair(i,j-1));
					a[i][j-1]++;
				}
				else
				{
					nt.push_back(make_pair(i+1,j));
					a[i+1][j]++;
				}
			}
		}
	}
	
	cout << pv.size() << endl;
	auto pit=pv.begin();
	auto nit=nt.begin();
	for(;pit!=pv.end()&&nit!=nt.end();++pit,++nit)
		cout << pit->first+1 << " " << pit->second+1 << " " << nit->first+1 << " " << nit->second+1 << endl;
	
	return 0;
}

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

#define endl '\n'
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef pair<int, int> P;
typedef unsigned int uint;
typedef unsigned long long ull;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};

const int inf = 1000000009;
const double eps = 1e-8;
template<typename T>
class SegmentTree {
private:
    int n;
    T dat[(1<<18)-1];
public:
    SegmentTree(int n_) {
	n = 1;
	while (n < n_) n *= 2;
	for (int i = 0; i < 2*n-1; i++) dat[i] = 0;
    }

    // add a to node k
    void add(int k, T a) {
	k += n - 1;
	dat[k] += a;
	while (k > 0) {
	    k = (k - 1) / 2;
	    dat[k] = dat[k*2+1] + dat[k*2+2];
	}
    }
    
    // call query(a, b)
    // return sum of values for [a, b)
    T query(int a, int b) { return query(a, b, 0, 0, n); }
    T query(int a, int b, int k, int l, int r) {
	if (r <= a || b <= l) return 0;

	if (a <= l && r <= b) return dat[k];
	else {
	    T vl = query(a, b, k*2+1, l, (l+r)/2);
	    T vr = query(a, b, k*2+2, (l+r)/2, r);
	    return vl + vr;
	}
    }
};

void solve(int n, int q) {
    SegmentTree<ll> st(n);
    for (int i = 0; i < q; i++) {
	int com, x, y;
	scanf("%d%d%d", &com, &x, &y);
	x--;
	if (com == 0) {
	    st.add(x, y);
	} else {
	    y--;
	    printf("%lld\n", st.query(x, y+1));
	}
    }
}

int main() {
    /*
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    */

    int n, q;
    scanf("%d%d", &n ,&q);
    solve(n, q);
}

Measured memory_bytes: 3224
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;

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

  if (n == 2) {
    if (V[0] == V[1] && V[0] == 1) printf("Possible\n");
    else printf("Impossible\n");
    return 0;
  }

  int ok = 0;
  for (int root=0; root<n; root++) {
    // deepest = V[root]
    int mmax = 0;
    int cur_ok = 1;
    for (int i=0; i<n; i++)
      if (root != i) {
        mmax = max(mmax, V[i]);
        if (V[i] < V[root]) cur_ok = 0;
      }
    if (mmax != 2*V[root] && mmax != 2*V[root]-1) continue;
    if (!cur_ok) continue;

    int occ[101] = {0};
    for (int i=0; i<n; i++)
      occ[V[i]] ++;
    for (int i=V[root] + (mmax == 2*V[root]); i <= mmax; i++)
      if (occ[i] < 2) cur_ok = 0;
    if (occ[1] > 1) cur_ok = 0;
    if (mmax == 2*V[root]-1 && occ[V[root]] != 2) continue;
    if (mmax == 2*V[root] && occ[V[root]] > 1) continue;

    if (cur_ok)
      ok = 1;
  }

  if (ok) printf("Possible\n"); else printf("Impossible\n");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
struct edge {
    int to;
    ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
}

namespace uf {
    vector<int> par, rank;
    vector<int> memo;

    void init(int n) {
        par.resize(n);
        rank.resize(n);
        memo.resize(n);
        for (int i = 0; i < n; i++) {
            par[i] = i;
            rank[i] = 0;
            memo[i] = 1;
        }
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        } else {
            return par[x] = root(par[x]);
        }
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y)return;
        if (rank[x] < rank[y]) {
            par[x] = y;
            memo[y] += memo[x];
        } else {
            par[y] = x;
            memo[x] += memo[y];
            if (rank[x] == rank[y])rank[x]++;
        }
    }

    int size(int x) {
        return memo[root(x)];
    }
}

int main() {
    COME_LET_THE_GAMES_BEGIN();
    int N;
    cin >> N;
    vector<pair<int, P>> v;
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        v.push_back(make_pair(i, P(x, y)));
    }
    sort(v.begin(), v.end(), [](auto x, auto y) {
        return x.second.first > y.second.first;
    });
    priority_queue<pair<int, P>> q;
    for (int i = 1; i < N; i++) {
        q.push(make_pair(v[i].second.first - v[i - 1].second.first, P(v[i].first, v[i - 1].first)));
    }
    sort(v.begin(), v.end(), [](auto x, auto y) {
        return x.second.second > y.second.second;
    });
    for (int i = 1; i < N; i++) {
        q.push(make_pair(v[i].second.second - v[i - 1].second.second, P(v[i].first, v[i - 1].first)));
    }
    uf::init(N);
    ll ans = 0;
    while (q.size()) {
        auto x = q.top();
        q.pop();
        if (uf::same(x.second.first, x.second.second)) {
            continue;
        }
        ans -= x.first;
        uf::unite(x.second.first, x.second.second);
        if (uf::size(x.second.first) == N) {
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 10864
N = int(input())
A = input().split()
print(' '.join(A))
A = [int(s) for s in A]
while A != sorted(A):
    for i in range(1, N):
        tmp = A[i]
        if A[i-1] > tmp:
            j = i
            while j >0 and A[j-1] > tmp:
                A[j] = A[j-1]
                j -= 1
            A[j] = tmp
        result = map(str, A)
        print(' '.join(result))



Measured memory_bytes: 5604
n = int(input())
aaa = list(map(int, input().split()))
odd = 0
even = 0
even4 = 0
for a in aaa:
    if a % 4 == 0:
        even4 += 1
    elif a % 2 == 0:
        even += 1
    else:
        odd += 1
if odd == 0:
    print('Yes')
else:
    if even4 == 0:
        print('No')
    else:
        if even == 0:
            print('Yes' if even4 >= odd - 1 else 'No')
        else:
            print('Yes' if even4 >= odd else 'No')

Measured memory_bytes: 14252
N, M = map(int, input().split(" "))
price_amount_list = []
for _ in range(N):
    A, B = map(int, input().split(" "))
    price_amount_list.append((A, B))

# 価格順にソート
price_amount_list.sort(key=lambda x: x[0])

buy = 0
sum_money = 0
for i in range(N):
    price = price_amount_list[i][0]
    amount = price_amount_list[i][1]
    if buy + amount < M:
        sum_money += price * amount
        buy += amount
    else:
        sum_money += price * (M-buy)
        buy += (M-buy)
        break

print(sum_money)


Measured memory_bytes: 18168
N,M,X=map(int,input().split())
C=[]
A=[]
for i in range(N):
    li=list(map(int,input().split()))
    C.append(li[0])
    A.append(li[1:])
ans=10**20
for i in range(2**N):
    li=[0]*M
    cost=0
    for j in range(N):
        if(i>>j&1):
            cost+=C[j]
            for k in range(M):
                li[k]+=A[j][k]
    ok=True
    for j in range(M):
        if(li[j]<X):
            ok=False
            break
    if ok:
        ans=min(ans,cost)
print(ans if ans!=10**20 else -1)

Measured memory_bytes: 9112
#include<bits/stdc++.h>
using namespace std;
#define mx 200007


int main()
{
  int k,n,arr[mx];
  
  cin>>k>>n;
  
  
  for(int i=1;i<=n;++i)cin>>arr[i];
  
  int maxi=0;
  for(int i=1;i<n;++i)
   maxi=max(maxi,arr[i+1]-arr[i]);
  
  maxi=max(maxi,k-arr[n]+arr[1]);
  
  cout<<k-maxi;
  
  
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
int main(){
    ll n,k,ans=0,counta=0,countb=0,countc=0;
    cin >> n >> k;

    if(k%2==1){
        for(ll i=k;i < n+1;i+=k)
        {
            counta++;
        }
        ans=pow(counta,3);
    }else{
        for(ll j=k/2;j < n+1;j+=k/2)
        {
            if(j%k==0)
                countb++;
            else{
                countc++;
            }
        }
        ans= pow(countb,3)+pow(countc,3);
    }

    cout << ans << endl;
    
}


Measured memory_bytes: 384
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static final int MOD = (int) (1e9 + 7);

    public void solve(InputReader in, PrintWriter out) {
        int h = in.nextInt(), n = in.nextInt();
        int[] magics = new int[10001];
        for (int i = 1; i <= 10000; ++i) {
            magics[i] = Integer.MAX_VALUE;
        }
        for (int i = 0; i < n; ++i) {
            int a = in.nextInt(), b = in.nextInt();
            magics[a] = Math.min(magics[a], b);
        }

        long[] dp = new long[h + 1];
        for (int i = 1; i <= h; ++i) {
            dp[i] = Long.MAX_VALUE;
        }
        dp[0] = 0;
        for (int i = 1; i <= 10000; ++i) {
            if (magics[i] == Integer.MAX_VALUE) continue;
            for (int j = h; j >= 1; --j) {
                dp[j] = Math.min(dp[j], magics[i] * ((j + i - 1) / i));
                for (int k = 1; j - k * i > 0; ++k) {
                    if (dp[j - k * i] < Long.MAX_VALUE) {
                        dp[j] = Math.min(dp[j], dp[j - k * i] + magics[i] * k);
                    }
                }
            }
        }

        out.println(dp[h]);
    }

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        new Main().solve(in, out);
        out.flush();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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


Measured memory_bytes: 22740
/**
*    created: 16.07.2020 01:56:29
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
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;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    int l; cin >> l;
    vector<string> v(n);
    rep(i,n) cin >> v[i];
    sort(all(v));
    rep(i,n) cout << v[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 3624
//by (111110101)2
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
struct st
{
	long long w,s,v;
};
st a[1010];
long long n,ans,dp[10101010];
bool cmp(st a,st b)
{
	return (a.w+a.s)<(b.w+b.s);
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i].w>>a[i].s>>a[i].v;
	}
	sort(a,a+n,cmp);
	for(int i=0;i<n;i++)
	{
		for(int j=a[i].s;j>=0;j--)
		{
			dp[j+a[i].w]=max(dp[j+a[i].w],dp[j]+a[i].v);
		}
	}
	for(int i=0;i<10101000;i++)
	{
		ans=max(ans,dp[i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;

class Program
{
    static void Main(string[] args)
    {   
        var NA = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var N = NA[0];
        var A = NA[1];
        var X = Console.ReadLine().Split().Select(int.Parse).ToArray();
        
        var dp = new long[N+1,N+1,A*N+1];
        
        for(int i = 0;i < N+1; i++){
          dp[i,0,0] = 1;
        }
   
        for(int i = 0;i < N; i++){
          for(int j = 1;j-1 <= i; j++){
            for(int k = 0;k < A*N+1; k++){
              dp[i+1,j,k] += dp[i,j,k];
              if(k >= X[i]){
                dp[i+1,j,k] += dp[i,j-1,k-X[i]];
              }
            }
          }
        }
      //Console.WriteLine(dp[3,1,8]);
        long ans = 0;
        for(int i = 1;i <= N;i++){
          ans += dp[N,i,A*i];
        }
        
        Console.WriteLine(ans);
      
    }

}


Measured memory_bytes: 60384
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;

const double PI=3.14159265358979323846;

int main() {
  double a, b, x;
  cin >> a >> b >> x;

  x /= a;

  double ans;
  if (a*b/2 >= x){
    double tate = 2 * x / b;
    ans = 180 * atan2(b, tate) / PI;
  }else{
    double yoko = 2*b - 2*x/a;
    ans = 180 * atan2(yoko, a) / PI;
  }

  printf("%.10lf\n", ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
ll n;
cin>>n;
ll a[n];
for(int i=0;i<n;i++){
    cin>>a[i];
}
sort(a,a+n,greater<ll>());
ll sum=0;
for(int i=1;i<n;i++){
    sum+=a[i];
}
if(a[0]<sum){
    cout<<"Yes"<<endl;
}else{
    cout<<"No"<<endl;
}
}












Measured memory_bytes: 256
import java.util.*;
public class Main{
	int page;
	int max;
	boolean flg = true;
	void doIt(){
		Scanner sc = new Scanner(System.in);
        int l,ans = 0;
        l = sc.nextInt();
        Main ko = new Main();
        Main su = new Main();
        ko.page =sc.nextInt();
        su.page =sc.nextInt();
        ko.max =sc.nextInt();
        su.max =sc.nextInt();
        while(ko.flg || su.flg){
            ko.study();
            su.study();
            ans ++;
        }
        System.out.println(l - (ans));
	}
	public void study(){
	        this.page -= this.max;
	        if(this.page <=0){
	            this.page = 0;
	            this.flg = false;
	        }
	    }
	public static void main(String[] args){
		new Main().doIt();
	}
}

Measured memory_bytes: 25828
package main

import "fmt"

func main() {
	var a, b string
	fmt.Scan(&a, &b)

	if a == b {
		fmt.Println("EQUAL")
	} else if len(a) >= len(b) && a > b {
		fmt.Println("GREATER")
	} else {
		fmt.Println("LESS")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0; return gcd(a, b, x, y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
int n, a[100000];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n) cin >> a[i];
  sort(a, a + n);
  int j = -1, ans = -1;
  FOR(i, 0, n-1){
    if(min(a[i], a[n-1] - a[i]) > j){
      ans = a[i];
      j = min(a[i], a[n-1] - a[i]);
    }
  }
  cout << a[n-1] << " " << ans << endl;
  return 0;
}

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

int main() {
  int N,tmp;
  cin>>N;
  tmp=0;
  vector<int> vec(N);
  rep(i,N){cin >> vec.at(i);
          tmp=tmp^vec.at(i);}
  int Ans;
  rep(i,N-1){Ans=tmp^vec.at(i);cout<<Ans<<" ";}
  Ans=tmp^vec.at(N-1);
  cout<<Ans<<endl;
}

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


signed main() {
    int n;
    cin >> n;
    vi a(3*n);
    rep(i, 3*n) cin >> a[i];
    sort(a.begin(), a.end(), greater<int>());
    int ans = 0;

    rep(i, n){
        ans += a[2*i +1];
    }

    cout << ans << endl;
}

Measured memory_bytes: 5540
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}
	Scanner cin;
	const int MOD = 1000000007;
	const int INF = int.MaxValue;
	const double EPS = 1e-7;
	const double PI = 3.1415926536;

	void prog()
	{
		cin = new Scanner();
		int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } };
		int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };

		int N = cin.nextInt();
		int A = cin.nextInt();
		int B = cin.nextInt();
		string str = cin.next();
		int a = 0;
		int b = 0;
		bool[] yes = new bool[str.Length];
		for (int i = 0; i < str.Length; i++)
		{
			yes[i] = false;
		}
		for (int i = 0; i < str.Length; i++)
		{
			if(str[i] == 'a')
			{
				a++;
				if(a <= A + B)
				{
					yes[i] = true;
				}
			}
			else if(str[i] == 'b')
			{
				b++;
				if (a < A + B && b <= B)
				{
					yes[i] = true;
					a++;
				}
			}
		}
		for (int i = 0; i < str.Length; i++)
		{
			Console.WriteLine(yes[i] ? "Yes" : "No");
		}
	}

}

class Scanner
{
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner()
	{
		s = new string[0];
		i = 0;
	}

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return next();
	}

	public int nextInt()
	{
		return int.Parse(next());
	}

	public long nextLong()
	{
		return long.Parse(next());
	}

	public double nextDouble()
	{
		return double.Parse(next());
	}
}

Measured memory_bytes: 7896
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<map>
#include<queue>
using namespace std;
long long saikou(long long a, long long b) {
	long long aa, bb;
	aa = a;
	bb = b;
	while (a != 0 && b != 0) {
		if (a>b) {
			a %= b;
		}
		else b %= a;
	}
	long long gcd = max(a, b);
	return aa / gcd * bb;
}
int main() {
	long long ans, n;
	cin >> n;
	cin >> ans;
	for (long long i = 1; i<n; i++) {
		long long t;
		cin >> t;
		ans = saikou(ans, t);
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

#define DB( x ) cout << #x << " = " << x << endl;
#define LEFT(n) (2 * (n))
#define RIGHT(n) (2 * (n) + 1)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> node;
//typedef vector <vector <ll>> matrix;

const ll INF = 1e16;
const double EPS = 1e-9;
const ll MOD = (ll)(1e9 + 7);
const ll MAXV = (ll)(2e5 + 10);
const ll MAXE = (ll)(1e6 + 10);


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


	ll x, a;

	cin >> x >> a;

	if(x < a)
		cout << "0\n";
	else
		cout << "10\n";

	return 0;
}


Measured memory_bytes: 256
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};



int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    lint a, b, c;
    cin >> a >> b >> c;
    if(a == b && b == c && c == a){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)
typedef long long int lint;

map< char, int > lev;

lint calc(char op, lint a, lint b) {
	if (op == '+') return a + b;
	if (op == '-') return a - b;
	return a * b;
}

lint parse(int l, int r, const string& S) {
	int open_cnt = 0, close_cnt = 0, nxt_l = -1;
	lint num = 0;
	
	stack< lint > stk_val;
	stack< char > stk_op;
	
	for_(i,l,r) {
		if (open_cnt == close_cnt) {
			if (isdigit(S[i])) {
				num = 10 * num + lint(S[i] - '0');
			} else if (S[i] == '(') {
				++open_cnt;
				nxt_l = i+1;
			} else if (S[i] == '$') {
				stk_val.push(num);
				num = 0;
			} else {
				char op = S[i];
				while (!stk_op.empty() && lev[stk_op.top()] >= lev[op]) {
					char pre = stk_op.top(); stk_op.pop();
					lint b = stk_val.top(); stk_val.pop();
					lint a = stk_val.top(); stk_val.pop();
					stk_val.push(calc(pre, a, b));
				}
				stk_op.push(op);
			}
		} else {
			if (S[i] == '(') ++open_cnt;
			if (S[i] == ')') {
				++close_cnt;
				if (open_cnt == close_cnt) stk_val.push(parse(nxt_l, i, S));
			}
		}
	}
	
	while (!stk_op.empty()) {
		char op = stk_op.top(); stk_op.pop();
		lint b = stk_val.top(); stk_val.pop();
		lint a = stk_val.top(); stk_val.pop();
		stk_val.push(calc(op, a, b));
	}
	
	return stk_val.top();
}

int main() {
	string S;
	cin >> S;
	S += '#';
	
	int m = S.size();
	for_(i,0,m-1) {
		if (isdigit(S[i]) && !isdigit(S[i+1])) {
			S = S.substr(0,i+1) + "$" + S.substr(i+1);
			m = S.size();
		}
	}
	S = S.substr(0, m-1);
	
	lint ans = 1LL << 63;
	for_(i,0,3) for_(j,0,3) for_(k,0,3) {
		lev['+'] = i;
		lev['-'] = j;
		lev['*'] = k;
		ans = max(ans, parse(0, (int)S.size(), S));
	}
	cout << ans << endl;
}

Measured memory_bytes: 3248
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define po pop_front
#define m(o) memset(o,-1,sizeof(o))
#define fo(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define pi pair < int , int > 
const int b=22,dx[]={1,0,-1,0},dy[]={0,1,0,-1};
string in[b];
int far[b][b];
int n,m,ans=-1;
pi a;
int bfs()
{
	deque < pi > p;m(far);
	p.pb(a);
	far[a.first][a.second]=0;
	while(!p.empty())
	{
		pi now=p[0];
		p.po();
		int x=now.first,y=now.second;
		fo(i,4)
		{
			int xx=x+dx[i],yy=y+dy[i];
			if(xx<0||yy<0||yy>=m||xx>=n||in[xx][yy]=='#')	continue;
			if(far[xx][yy]==-1)
			{
				p.pb(mp(xx,yy));
				far[xx][yy]=far[x][y]+1;
			}
		}
	}
	int ans2=0;
	fo(i,n)
		fo(c,m)
			ans2=max(ans2,far[i][c]);
	return ans2;
}
signed main()
{
	cin>>n>>m;
	fo(i,n)
		cin>>in[i];
	fo(i,n)
	{
		fo(c,m)
		{
			if(in[i][c]!='#')
			{
				a=mp(i,c);
				int now=bfs();
				ans=max(ans,now);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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



public class Main{
	public static void main(String[] args){

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		int num;
		String str;
		String[] dice;
		char[] command;
		int[] int_dice=new int[6];
		int[] dice_for_change =new int[6];

		try{

			str=reader.readLine();
			dice=str.split(" ");//{1,2,3,4,5,6}={dice[0], dice[1], ... ,dice[5]}={???, S, E, W, N, ???}
			str=reader.readLine();
			command=str.toCharArray();
			for(int i=0;i<6;i++){
				int_dice[i]=Integer.parseInt(dice[i]);
			}



			for(int i=0;i<command.length;i++){

				switch(command[i]){

				case 'S':
			    {
			    	dice_for_change[0]=int_dice[4];
			    	dice_for_change[1]=int_dice[0];
			    	dice_for_change[2]=int_dice[2];
			    	dice_for_change[3]=int_dice[3];
			    	dice_for_change[4]=int_dice[5];
			    	dice_for_change[5]=int_dice[1];

			    	}
				break;

				case 'E':
			    {
			    	dice_for_change[0]=int_dice[3];
			    	dice_for_change[1]=int_dice[1];
			    	dice_for_change[2]=int_dice[0];
			    	dice_for_change[3]=int_dice[5];
			    	dice_for_change[4]=int_dice[4];
			    	dice_for_change[5]=int_dice[2];

			    	}
				break;

				case 'N':
			    {//??????
			    	dice_for_change[0]=int_dice[1];
			    	dice_for_change[1]=int_dice[5];
			    	dice_for_change[2]=int_dice[2];
			    	dice_for_change[3]=int_dice[3];
			    	dice_for_change[4]=int_dice[0];
			    	dice_for_change[5]=int_dice[4];
                	}
				break;

				case 'W':
			    {
			    	dice_for_change[0]=int_dice[2];
			    	dice_for_change[1]=int_dice[1];
			    	dice_for_change[2]=int_dice[5];
			    	dice_for_change[3]=int_dice[0];
			    	dice_for_change[4]=int_dice[4];
			    	dice_for_change[5]=int_dice[3];
                	}
				break;


				}//switch

				for(int k=0;k<6;k++){
			    	int_dice[k]=dice_for_change[k];

				}

			}//for
			System.out.println(int_dice[0]);


		}catch(IOException e){
			System.out.print(e);
		}
	}

}

Measured memory_bytes: 24252
import java.util.*;
import static java.lang.System.*;

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int N = sc.nextInt();
    Integer A[][] = new Integer[2][N];
    Integer Aone[] = new Integer[N+1];
    Integer Atwo[] = new Integer[N+1];
    Aone[0] = 0;
    Atwo[0] = 0;
    for(int i=0; i<N; i++){
      A[0][i] = sc.nextInt();
      Aone[i+1] = Aone[i] + A[0][i];
    }
    for(int i=0; i<N; i++){
      A[1][i] = sc.nextInt();
      Atwo[i+1] = Atwo[i] + A[1][i];
    }
    int ans = 0;
    int tmp;
    for(int i=1; i<N+1; i++){
      tmp = Aone[i] + Atwo[N] - Atwo[i-1];
      ans = Math.max(ans, tmp);
    }
    out.println(ans);
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}

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

using namespace std;

int main(){
  int ret=0;
  int n,k;
  vector<int> l;
  
  cin>>n;
  cin>>k;
  for(int i=0;i<n;i++){
    int tmp;
    cin>>tmp;
    l.push_back(tmp);
  }
  sort(l.begin(), l.end(), greater<int>());
  for(int i=0;i<k;i++){
    ret+=l[i];
  }
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
#![macro_use]

use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::mem::*;
use std::num::*;
use std::slice::*;

fn main() {
    let (r, w, e) = (stdin(), stdout(), stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    // =============================================== //
    let (n, a, b) = {
        let k = io.readn::<usize>(3);
        (k[0], k[1], k[2])
    };
    let s = io.chars();
    let mut asm = 0;
    let mut bsm = 0;
    let mut ycnt = 0;
    for i in 0..n {
        let mut ret = true;
        if s[i] == 'a' {
            asm += 1;
            if ycnt < a + b {
                ret = true;
                ycnt += 1;
            } else {
                ret = false;
            }
        } else if s[i] == 'b' {
            bsm += 1;
            if ycnt < a + b && bsm <= b {
                ret = true;
                ycnt += 1;
            } else {
                ret = false;
            }
        } else {
            ret = false;
        }
        println!("{}", if ret { "Yes" } else { "No" });
    }
}

// IO
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug ) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug>(&mut self, val1: S, val2: S) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
}


Measured memory_bytes: 4732
n,m = map(int, input().split())
a_list = [int(a) for a in input().split()]
a_list.sort()
bc_list = [0 for _ in range(m)]
for i in range(m):
    b,c = map(int, input().split())
    bc_list[i] = [b,c]
bc_list.sort(key= lambda x:x[1],reverse=True)
cur = 0
for i in range(m):
    b,c = bc_list[i][0],bc_list[i][1]
    for j in range(b):
        if cur >= n:
            break
        if a_list[cur]>=c:
            break
        else:
            a_list[cur] = c
            cur += 1
    else:
        continue
    break
print(sum(a_list))

Measured memory_bytes: 25160
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
int main()
{
  int n;ll l;
  cin >> n >> l;
  vector<ll> a(n);
  rep(i,n){
    cin >> a[i];
  }

  vector<ll> sum(n+1);
  sum[0] = 0;
  rep(i,n){
    sum[i+1] = sum[i] + a[i];
  }
  
  rep(i,n-1){
    if(sum[i+2]-sum[i]>=l){
      cout << "Possible" << "\n";
      for(int j=1;j<=i;++j){
	cout << j << "\n";
      }
      for(int j=n-1;j>=i+2;--j){
	cout << j << "\n";
      }
      cout << i+1 << "\n";
      return 0;
    }
  }
  cout << "Impossible" << "\n";
  
  return 0;
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
#define mst(a) memset(a,0,sizeof a)
ll a,b,c,d,n;
unordered_map<ll,ll>mp; 
ll dfs(ll n){
	if(!n) return 0;
	if(n==1) return d;
	if(mp[n]) return mp[n];
	ll res=1e18;
	if(n<res/d) res=n*d;
	res=min(res,a+n%2*d+dfs(n/2));
	res=min(res,a+(2-n%2)*d+dfs((n+1)/2));
	res=min(res,b+n%3*d+dfs(n/3));
	res=min(res,b+(3-n%3)*d+dfs((n+2)/3));
	res=min(res,c+n%5*d+dfs(n/5));
	res=min(res,c+(5-n%5)*d+dfs((n+4)/5));
	mp[n]=res;
	return res;
}
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		mp.clear();
	scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
	  printf("%lld\n",dfs(n));
	 }
	return 0;
} 

Measured memory_bytes: 4264
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
int main(void){
    int N,A,B;
    cin>>N>>A>>B;
    int ans;
    if(N*A>B){
        ans=B;
    }
    else{
        ans=N*A;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3568
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();

		int N = S.length();
		boolean ret = isPalindrome(S);
		ret &= isPalindrome(S.substring(0, (N - 1) / 2));
		ret &= isPalindrome(S.substring((N + 1) / 2));

		System.out.println(ret ? "Yes" : "No");
	}

	static boolean isPalindrome(String s) {
		int N = s.length();
		for ( int i = 0 ; i < N / 2 ; i++ ) {
			if ( s.charAt(i) != s.charAt(N - i - 1) ) {
				return false;
			}
		}
		return true;
	}
}


Measured memory_bytes: 23764
import numpy as np
from numpy.fft import rfft, irfft

N, M = map(int, input().split())
A = np.array(list(map(int, input().split())), np.int64)

fft_len = 1<<20
PA = np.bincount(A)
P = (irfft(rfft(PA, fft_len) * rfft(PA, fft_len)) + .5).astype(int)

ans = 0
for i in range(len(P)-1, -1, -1):
    if P[i] > 0:
        if M <= P[i]:
            ans += i * M
            print(ans)
            exit()
        else:
            M -= P[i]
            ans += i * P[i]


Measured memory_bytes: 65184
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
 

     String[] nyu=sc.nextLine().split(" ");

//     String nyu=sc.nextLine();
int A=Integer.parseInt(nyu[0]);
int B=Integer.parseInt(nyu[1]);
int C=Integer.parseInt(nyu[2]);
//int D=Integer.parseInt(nyu[3]);



//StringBuffer sb = new StringBuffer(nyu);
//		String dst = sb.reverse().toString();

//     String nyu2=sc.nextLine();
//int E=Integer.parseInt(nyu2);



//double A=Double.parseDouble(nyu[0]);
//double B=Double.parseDouble(nyu[1]);
/*
switch(nyu){
case "H H":
System.out.println("H") ;
break;

case "D D":
System.out.println("H") ;
break;

case "H D":
System.out.println("D") ;
break;

case "D H":
System.out.println("D") ;
break;


default:
System.out.println("NO") ;

break;
}
*/

//int res=Math.min((A*B),C);

//for(String tem:bo){
//if(tem.equals(nyu))res="vowel";
//}
//int res=0;
//for(int i=0;i<300;i++){
//if(num[i]==1)res=i;
//}

//char[] c = nyu.toCharArray();


//System.out.println(nyu+"-"+line_r_2+"-"+nyu2+"-"+line_r_1);



if(A+B==C || B+C==A || C+A==B){
//double res=Math.ceil((AB)/2);

System.out.println("Yes");
//}else if(B<A){
//System.out.println("Alice");

}else{
System.out.println("No");
}




	}
}

Measured memory_bytes: 21588
#include<iostream>
using namespace std;
#include<vector>
int main () {
  int N;
  cin >> N;
  vector<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];

  int res = 0;
  for (int i = 0; i < N; i++) {
    if (C[i] < V[i]) {
      res += V[i] - C[i];
    }
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N;
    cin>>N;
    vi B(N-1);
    rep(i,B.size()) cin>>B.at(i);
    int counter=0;
    counter+=B.at(0);
    counter+=B.at(N-2);
    for(int i=0; i<=N-3;i++) {
        counter+=min(B.at(i),B.at(i+1));
    }
    cout<<counter<<endl;
}

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

#define ll long long
#define sd(x) scanf("%d", &(x))
#define pii pair<int, int>
#define F first
#define S second
#define all(c) ((c).begin()), ((c).end())
#define sz(x) ((int)(x).size())
#define ld long double

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

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	for(int i = 0;i < (int)v.size(); i++){
		if(i)os<<", ";
		os<<v[i];
	}
	os<<"}";
	return os;
}

#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int SQM = 729;
const int M = SQM * SQM;
int nxt[2][M], nxt2[2][SQM], nxt3[2][SQM];
int p[M];
int q[M];
char s[M];
int type[M], cnt[M];
int U = 1, V = 1, W = 1, n, MID;

int lft[M], rgt[M];

int firstBAD[SQM + 10][SQM], val[SQM + 10][SQM];
void get(int l, int r){
	for(int i = 0; i < U; i++){
		firstBAD[r - l + 1][i] = r - l + 1;
		val[r - l + 1][i] = i;
	}
	for(int j = r; j >= l; j--){
		int t = type[j];
		for(int i = 0; i < U; i++){
			int new_node = nxt2[t][i];
			if(i != U - 1 || t != 1){
				val[j - l][i] = val[j - l + 1][new_node];
				firstBAD[j - l][i] = firstBAD[j - l + 1][new_node];
			} else{
				val[j - l][i] = i;
				firstBAD[j - l][i] = j - l;
			}
		};
	}
	
	for(int i = 0; i < V; i++){
		int L = lft[i], R = rgt[i], ind = 0;
		while(ind <= r - l){
			int nxt = firstBAD[ind][R];
			R = val[ind][R];
			L = (cnt[nxt - 1 + l] - cnt[ind - 1 + l]) & 1 ? nxt3[0][L] : L;
			if(nxt <= r - l){
				R = 0;
				L++;
				if(L == W) L = 0;
			}
			ind = nxt + 1;
		}
		q[i] = L * U + R;
	}
}

int transform(int v, int k){
	int pwr = 1, ret = 0;
	int V = v;
	for(int i = 0; i < k; i++, pwr *= 3, v /= 3){
		int t = (2 * v) % 3;
		ret += t * pwr;
	}
	return ret;
}
int h[M];
int main(){
	// n = 10;
	sd(n);
	scanf("%s", s);
	// int m = 100000;
	int m = strlen(s);
	for(int i = 1; i <= m; i++){
		type[i] = rand() % 2;
		type[i] = s[i - 1] == 'R';
		cnt[i] = cnt[i - 1] + 1 - type[i];
	}
	MID = (n + 1) / 2;
	for(int i = 0; i < n; i++) V *= 3;
	for(int i = 0; i < MID; i++) U *= 3;
	for(int i = 0; i < n - MID; i++) W *= 3;

	for(int i = 0; i < V; i++){
		nxt[0][i] = transform(i, n);
		nxt[1][i] = (i + 1) % V;
	}

	for(int i = 0; i < U; i++){
		nxt2[0][i] = transform(i, MID);
		nxt2[1][i] = (i + 1) % U;
	}

	for(int i = 0; i < W; i++){
		nxt3[0][i] = transform(i, n - MID);
		nxt3[1][i] = (i + 1) % W;
	}

	for(int i = 0; i < V; i++){
		lft[i] = i / U;
		rgt[i] = i % U;
		p[i] = i;
	}
	
	for(int i = 1; i <= m; i += SQM){
		get(i, min(m + 1, i + SQM) - 1);
		for(int j = 0; j < V; j++) h[j] = q[p[j]];
		memcpy(p, h, sizeof p);
	}
	for(int i = 0; i < V; i++) printf("%d ", p[i]);
}

Measured memory_bytes: 24572
#include <stdio.h>
int main() {
    int N, A, i, cnt = 0;
    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf("%d", &A);
        if (A % 2) cnt++;
    }
    printf("%s\n", cnt % 2 ? "NO" : "YES");
}

Measured memory_bytes: 128