akhauriyash/Code-Regression huggingface dataset:
//------------------------------------------------------
//------------------------------------------------------
//------------------------------------------------------
//----------Y-------------------------------------------
//----------Y-------------------------------------------
//----------Y-------------------------------------------
//----------YYYYYY--------------------------------------
//----------Y-------------------------------------------
//----------Y-------------------------------------------
//----------Y-------------------------------------------
//----------Y-------------------------------------------
//------------------------------------------------------
//------------------------------------------------------
//------------------------------------------------------
//------------------------------------------------------


#include <bits/stdc++.h>

using namespace std;

const int N = 505;
int a[N * N], X[N], n;
int c[N], cnt[N];
int pos[N][N], num[N];

bool cmp(const int &x, const int &y) { return X[x] < X[y]; }

bool check() {
  for (int i = 1; i <= n * n; i++) pos[a[i]][++num[a[i]]] = i;
  for (int i = 1; i <= n; i++)
    if (pos[i][i] != X[i]) return 0;
  return 1;
}

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &X[i]);
  for (int i = 1; i <= n; i++) c[i] = i, a[X[i]] = i;
  sort(c + 1, c + 1 + n, cmp);
  for (int i = 1; i <= n; i++) cnt[i] = i - 1;
  for (int i = 1; i <= n * n; i++) {
    if (a[i]) continue;
    for (int j = 1; j <= n; j++)
      if (cnt[c[j]]) {
        a[i] = c[j];
        cnt[c[j]]--;
        break;
      }
  }
  for (int i = 1; i <= n; i++) cnt[i] = n - i;
  for (int i = n * n; i >= 1; i--) {
    if (a[i]) continue;
    for (int j = n; j >= 1; j--)
      if (cnt[c[j]]) {
        a[i] = c[j];
        cnt[c[j]]--;
        break;
      }
  }
  if (check()) {
    puts("Yes");
    for (int i = 1; i <= n * n; i++) printf("%d%c", a[i], " \n"[i == n * n]);
  } else
    puts("No");
  return 0;
}


Measured memory_bytes: 3200
#include <stdio.h>
int main(void){
    
    int n,m,k,ans;
    ans=0;
    int num[31]={0};
    scanf("%d %d",&n,&m);
    
    int a[n][31];
    
    
    for(int i=0; i<n; i++){
        scanf("%d",&k);
        
        for(int j=0; j<k; j++){
            scanf("%d",&a[i][j]);
            
            for(int l=1; l<=30; l++){
                if(a[i][j]==l){
                    num[l]++;
                }
            }
        }
    }
    for(int l=1; l<=30; l++){
        if(num[l]==n)
            ans++;
    }
    
    printf("%d",ans);
}


Measured memory_bytes: 256
from math import sqrt, ceil

def main():

    ab = input().split(' ')
    a = int(ab[0])
    b = int(ab[1])

    tmp = b
    if a<b:
        tmp = a
        a = b
        b = tmp

    while b != 0:
        tmp = b
        b = a%b
        a = tmp

    count = 1

    if a == 1:
        return count

    if a%2 == 0:
        count += 1
        while a%2 == 0:
            a //= 2
        if a == 1:
            return count
    
    i = 3
    while i*i <= a:
        if a%i == 0:
            count += 1
            while a%i == 0:
                a //= i
            if a == 1:
                return count
        i += 2
        
    return count+1

if __name__ == "__main__":
    print(main())

Measured memory_bytes: 3064
# DP(貰うDP)
def main():
    from builtins import abs, max, min, range
    N, K = map(int, input().split())
    h = list(map(int, input().split()))

    dp = [0] * N
    for i in range(1, N):
        dp[i] = min(dp[j] + abs(h[i] - h[j]) for j in range(max(0, i - K), i))
    print(dp[N - 1])


main()


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

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i=1; i<=n; i++) {
        int x;
        cin >> x;
        if (x % 2 == 1 && i % 2 == 1) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3528
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	i64 n; scanf("%lld", &n);
	std::vector<i64> a(5);
	for(int i = 0; i < 5; i++) scanf("%lld", &a[i]);
	sort(begin(a), end(a));
	
	printf("%lld\n", (n + a.front() - 1) / a.front() + 4);
	return 0;
}


Measured memory_bytes: 256
n=int(input())
a=[int(i) for i in input().split()]


def ss(array, length):
  cnt=0
  for i in range(length):
    minj = i
    v = array[i]
    for j in range(i, n):
      if array[minj]>array[j]:
        minj = j
    if array[i] != array[minj]:
      cnt+=1
    array[i] = array[minj]
    array[minj] = v
  return array, cnt

b, c = ss(a, n)

for i in range(n):
  if i==n-1:
    print(b[i], end='')
  else:
    print(b[i], end=' ')

print()
print(c)


Measured memory_bytes: 5612
///usr/bin/g++ -O2 $0 -o ${0%.cpp} && echo "----------" && ./${0%.cpp}; exit;
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<double, int> ii; 

const int N = 1010;
int x[N], y[N], n, r[N]; 
double dist[N]; 

int main(int argc, char const *argv[]) {
    scanf("%d %d %d %d", &x[0], &y[0], &x[1], &y[1]); 
    scanf("%d", &n); n += 2; 
    for(int i = 2; i < n; ++i) {
        scanf("%d %d %d", &x[i], &y[i], &r[i]); 
    }

    priority_queue<ii, vector<ii>, greater<ii> > Q; 
    for(int i = 0; i < n; ++i) dist[i] = 1e18;
    dist[0] = 0;
    Q.emplace(0, 0);    

    auto get = [](int i, int j) {
        return max((long double) 0, hypotl(x[i] - x[j], y[i] - y[j]) - (r[i] + r[j])); 
    };

    while(!Q.empty()) {
        auto it = Q.top(); Q.pop(); 
        int u = it.second; double d = it.first;
        if(d > dist[u]) continue; 
        for(int i = 0; i < n; ++i) if(i != u) {
            double L = get(i, u); 
            if(dist[i] > d + L) {
                dist[i] = d + L; 
                Q.emplace(dist[i], i); 
            }
        }
    }

    printf("%.10f\n", dist[1]); 
}

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

int main(){
  int N,countA=0,A=0,countB=0,B=0,ans=0;
  cin>>N;
  bool can=true;
  for(int i=0; i<N; ++i){
    string S;
    cin>>S;
    if(S.at(0)=='B'){
      countB++;
      B+=i*i;
    }
    if(S.at(S.size()-1)=='A'){
      countA++;
      A+=i*i;
    }
    if((S.at(0)=='B' && S.at(S.size()-1)!='A') || (S.at(0)!='B' && S.at(S.size()-1)=='A')) can=false;
    for(int j=0; j<S.size()-1; ++j){
      if(S.at(j)=='A' && S.at(j+1)=='B') ans++;
    }
  }
  ans+=min(countA,countB);
  if(can){
    if(countA>=1 || countB>=1) ans--;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  sf  scanf
#define  pf  printf
int main()
{
    int i,n,k,s=0,a;
    sf("%d %d",&n,&k);
    for(i=0;i<n;i++)
    {
        sf("%d",&a);
    }
    for(i=0; ;i+=(k-1))
    {
        if(i>=(n-1))
        {
            break;
        }
        s++;
    }
    pf("%d\n",s);
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;
long S[100000];
long T[50000];

int main(){
	int n; scanf("%d",&n);
	for (int i = 0; i < n; ++i) scanf("%d", &S[i]);
	int q; scanf("%d",&q);
	for (int i = 0; i < q; ++i) scanf("%d",&T[i]);
	sort(S, S + n);
	sort(T, T + q);
	int cnt = 0;
	int k = 0;
	for (int i = 0; i < n; ++i){
		for (int j=k; j < q; ++j){
			if (S[i] == T[j]) { ++cnt, k=j+1; break; }
		}
	}
	cout << cnt << '\n';
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int A,B,C;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B>>C;
	int ret=0;
	ret=max(ret,A*10+B+C);
	ret=max(ret,B*10+A+C);
	ret=max(ret,C*10+B+A);
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))

ans = [0 for _ in range(100005)]

for aa in a:
    ans[aa] += 1
    ans[aa+1] += 1
    ans[aa+2] += 1

# prt = 0
# for i,v in enumerate(ans):
#     if v > prt:

print(max(ans))


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

typedef long long ll;

int main(){
  ll n,k;
  cin >> n >> k;
  ll ans=0;
  for(ll i=k+1;i<=n;i++){
    ll count=0;
    count+=n/i*(i-k);
    count+=max((ll)0,n%i-k+1);
    ans+=count;
  }
  if(k==0){
    cout << n*n << endl;
  }
  else{
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ri register int
const int N=1e3+5,K=25,mod=1e9+7;
int a[N],f[K][N],c[N][N]; 
inline int _add(ri x,ri y){
	return (x+=y)>=mod?x-mod:x;
}
int main(){
	ri n,k,i,j,x;
	scanf("%d%d",&n,&k);
	for(i=1;i<=k;++i) scanf("%d",&a[i]);
	for(i=0;i<=n;++i){
		c[i][0]=1;
		for(j=1;j<=i;++j)
			c[i][j]=_add(c[i-1][j],c[i-1][j-1]);
	//	for(j=0;j<=i;++j)
	//		printf("%d ",c[i][j]);
	//	puts("");
	}
	f[0][0]=1;
	for(i=1;i<=k;++i)
		for(j=0;j<=n;++j)
			for(x=0;x<=j&&x<=a[i];++x)
				f[i][j]=(f[i][j]+(long long)f[i-1][j-x]*c[n-(j-x)][x]%mod*c[n-x][a[i]-x])%mod;
	printf("%d\n",f[k][n]);
	return 0;
}

Measured memory_bytes: 4224
#include <stdio.h>

#define forN(i, N) for (i = 0; i < N; i++)

char operation(int a, int b, int n);

int main(int argc, char *argv[]) {
  int num[2];
  int i;

  forN(i, 2) scanf("%d", &num[i]);

  char op = operation(num[0], num[1], 15);
  putchar(op);
  return 0;
}

char operation(int a, int b, int n) {
  if (a + b == n) return '+';
  if (a * b == n) return '*';
  return 'x';
}


Measured memory_bytes: 128
n, q = map(int, raw_input().split(" "))
process = {}
schedule = []
sec = 0

for i in range(n):
    p, time = raw_input().split(" ")
    process[p] = int(time)
    schedule.append(p)

while len(schedule) != 0:
    p = schedule.pop(0)
    if process[p] - q > 0:
        process[p] -= q
        schedule.append(p)
        sec += q
    else:
        sec += process[p]
        print(p + " " + str(sec))

Measured memory_bytes: 13320
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a = inpl()
b = inpl()
if a[0] == b[0]:
    print(0)
else:
    print(1)

Measured memory_bytes: 63980
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define int64 long long
#define sz(a) ((int) (a).size())

const int N = (int) 1e5 + 10;
int a[N], b[N], n;
vector<int> all_have;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < n; ++i) {
		scanf("%d", &b[i]);
	}
	int cnt = 0;
	int64 delta = 0, have = 0;
	for (int i = 0; i < n; ++i) {
		if (a[i] < b[i]) {
			cnt++;
			delta += b[i] - a[i];
		} else {
			have += a[i] - b[i];
			all_have.push_back(a[i] - b[i]);
		}
	}
	if (delta > have) {
		printf("-1\n");
		return 0;
	}
	sort(all_have.rbegin(), all_have.rend());
	for (int i = 0; (i < sz(all_have)) && (delta > 0); ++i) {
		delta -= all_have[i];
		cnt++;
	}
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 1660
n, x = map(int,input().split())
l = list(map(int,input().split()))
l.insert(0,0)
dem=0
for i in range(1,len(l)):
    l[i] += l[i-1]
for i in l:
    if i <= x:
        dem+=1
    else:
        break
print(dem)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdint>
using namespace std;
using i64 = int64_t;

void solve() {
  i64 k, n;
  cin >> k >> n;
  vector<i64> a(n);
  for (auto &an : a) {
    cin >> an;
  }
  sort(a.begin(), a.end());
  vector<i64> d(n);
  for (i64 i = 0; i < n - 1; ++i) {
    d[i] = a[i + 1] - a[i];
  }
  d[n - 1] = (k - a[n - 1]) + a[0];
  sort(d.begin(), d.end());
  cout << abs(k - d[n - 1]) << endl;
}

int main() {
  solve();
  return 0;
}


Measured memory_bytes: 3456
#At coder 2020/2/9 D
#import numpy as np

# 入力
N,K= map(int, input().split())
p = list(map(int, input().split())) 
#p2 = sorted(p, reverse=True)
#print(p2)
kk=[0] * (N-K+1)
#p=np.array(p)
kk[0]=sum(p[0:K])
for ii in range(1,N-K+1):
    kk[ii]=kk[ii-1]-p[ii-1]+p[K+ii-1]
kk=max(kk)
K=float(K)
kk=float(kk)
ans=0.5*(kk+K)

print(ans)

Measured memory_bytes: 25060
A = list(map(str, input().split()))
A += list(map(str, input().split()))
A += list(map(str, input().split()))
a = []
N = int(input())
for i in range(N):
    a.append(input())
flag = 0
for i  in a:
    if i in A:
        A[A.index(i)] = "0"
B = []
C = []
D = []
E = []
F = []
for i in range(3):
    B.append(A[4*i])
    C.append(A[2*(i+1)])
    D.append(A[3*i])
    E.append(A[3*i+1])
    F.append(A[3*i+2])
    if "0" in A[i*3:i*3+3]:
        if A[i*3:i*3+3].count("0") == 3:
            flag = 1
if "0" in B:
    if B.count("0") == 3:
        flag = 1
if"0"in C:
    if C.count("0") == 3:
        flag = 1
if"0"in D:
    if D.count("0") == 3:
        flag = 1
if"0"in E:
    if E.count("0") == 3:
        flag = 1
if"0"in F:
    if F.count("0") == 3:
        flag = 1
if flag == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var s = cin.Read;

            var c = 0;
            for (int i = 0; i < s.Length/2; i++)
            {
                if (s[i] != s[s.Length - i - 1])
                {
                    c++;
                }
            }
            WriteLine(c);
        }
    }

    public static class Extensions
    {
        
    }


    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 11220
#include <iostream>
#include<math.h>
#include<list>
#include <algorithm>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
using ll = long long;
using vll = vector<long long>;

#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)


int main() {
	ll n,ans=0;
	in(n);

	vll a(n + 1);
	vll b(n);

	repeq(i, 0, n) {
		in(a[i]);
	}
	rep(i, 0, n) {
		in(b[i]);
	}

	rep(i, 0, n) {
		if (a[i] >= b[i]) {
			ans += b[i];
		}
		else{
			ans += a[i];
			b[i] -= a[i];
			if (a[i + 1] <= b[i]) {
				ans += a[i + 1];
				a[i + 1] = 0;
			}
			else {
				ans += b[i];
				a[i + 1] -= b[i];
			}
		}
	}

	outn(ans);
	return 0;
}



Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


#define ll int
#define FOR(i,a) for(ll i=0;i<(ll)a.size();i++)
#define pb push_back
#define ld long double
#define mp make_pair
#define F first
#define S second
#define pii pair<ll,ll> 

using namespace :: std;

const ll maxn=1e5+500;

inline char nott(char r){
	if(r=='A')return 'B';
	return 'A';
}
int main(){
	ll n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	ll tah=0;
	bool nnot=0;

	bool flag=0;
	for(ll i=0;i<k;i++){
		if(tah==n){
			flag=((k-i)%2);
			break;
		}
		char c=s[tah];
		if(nnot)c=nott(c);
		if(c=='A'){
			s[tah]=nott(s[tah]);
		}else{
			tah++;
			nnot=!nnot;
		}
	}
	if(tah==n && n%2==1 && flag){
		flag=1;
	}else{
		flag=0;
	}

	string ans;
	for(ll i=tah;i<n;i++){
		if(nnot){
			ans+=nott(s[i]);
		}
		else{
		   ans+=s[i] ;
		}
	}
	while(ans.size()<n){
		ans+='C';
	}
	char f='A';
	for(ll i=n-1;i>=0 && ans[i]=='C';i--){
		ans[i]=f;
		f=nott(f);
	}
	if(flag)ans[0]=nott(ans[0]);

	cout<<ans;
}











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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;

constexpr int MOD = 1000000007;

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

    int n;
    cin >> n;

    vll cnt(60, 0);
    rep(i, 0, n) {
        ll x;
        cin >> x;
        rrep(j, 0, 60) {
            if (x % 2 == 1) { ++cnt[j]; }
            x /= 2;
            if (x == 0) { break; }
        }
    }

    ll ans = 0, pow = 1;
    rrep(i, 0, 60) {
        ll tmp = (cnt[i] * (n - cnt[i])) % MOD;
        ans = (ans + (pow * tmp) % MOD) % MOD;
        pow = (2 * pow) % MOD;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define MEM(x,a) memset((x),a,sizeof((x)))
#define F first
#define S second
#define imx INT_MAX
const long long MOD = (long long)(1e9+7);
const long long MMX = (long long)(1e18);
typedef long long LL;
typedef pair<int,int> pii;
int n,ls[30],mx1,mx2,x;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        mx1=-1;
        for(int j=1;j<=26;j++)
        {
            scanf("%d",&x);
            if(x>mx1)mx1=x,mx2=j;
            else if(x==mx1)if(ls[j]<ls[mx2])mx2=j;
        }
        ls[mx2]=i;
        printf("%d\n",mx2);
    }
}


Measured memory_bytes: 3824
import java.util.Scanner;

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

        sc.close();

        int ans = Math.min(n * a, b);

        System.out.println(ans);
    }
}


Measured memory_bytes: 21588
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <map>
#include <utility>

using ll = long long ;
#define MAXN 200009
#define MAXL 29 
std::map<std::pair<int,int>, int> bucket;

class Rat
{
    private:
        int cofp2,cofp5;
    public:
        Rat(){}
        Rat(ll nn,ll dd)
        {
           ll tn = nn;
           ll td = dd;
           cofp2 = 0;
           while( tn%2==0){
               cofp2++;
               tn/=2;
           } 
           while(td%2==0){
               cofp2--;
               td/=2;
           }
           cofp5=0;
           while(tn%5==0){
               cofp5++;
               tn/=5;
           }
           while(td%5==0){
               cofp5--;
               td/=5;
           }
        }
        void output() 
        { 
            printf("2^{%d}*5^{%d}\n",cofp2,cofp5); 
        } 
        int getcofp2()
        {
            return cofp2;
        }
        int getcofp5()
        {
            return cofp5;
        }
}; 
        

int main(void) 
{ 
    char theNumber[MAXL]; 
    int N,i,j;
    scanf("%d",&N);
    Rat *a ;

    for (i=0;i<N;i++){
        scanf("%s",theNumber);
        char* ret = strchr(theNumber,'.');
        if (ret==NULL){
            a = new Rat(atoi(theNumber),1); 
        } else {
            int lenOfDen = strlen(&theNumber[ret-&theNumber[0]+1]);
            ll den = pow(10,lenOfDen); 
            ll num = atoi(theNumber)*den
            +atoi(&theNumber[ret-&theNumber[0]+1]);
            a = new Rat(num,den);
        }
        bucket[std::make_pair(a->getcofp2(),a->getcofp5())] ++;
    }

    ll s=0;
    for (auto it:bucket) {
        int x1 = it.first.first;
        int y1 = it.first.second;
        int r1 = it.second;
        for (auto it2:bucket) {
            int x2 = it2.first.first;
            int y2 = it2.first.second;
            int r2 = it2.second;

            if(x1+x2>=0 && y1+y2>=0)
            {
                if(it<it2){
                    s+=((ll)r1)*r2;
                } else if (it==it2) {
                    s+=((ll)r1*(r1-1))/2;
                }
            }
        }
    }

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

    return 0;
}


Measured memory_bytes: 9888
N,M,Q = map(int, input().split())
LR = [tuple(map(int, input().split())) for _ in range(M)]
PQ = [tuple(map(int, input().split())) for _ in range(Q)]


"""
pを含むpの右で出発して、qを含むqの左で停止する列車の本数を求める

愚直解だと、各クエリに対し各列車が当てはまるか見ていけばよい。が、計算量がO(M*Q)とかになるはずなので、到底間に合わない。
N,Mが10**5オーダーなので、各クエリに対し、O(1)とか、１でなくてももうちょっと少ないオーダーでで解答できると間に合う感じ。

各クエリに対し、毎回「列車１はここからここまでを走ってて～」を重複計算するのが無駄。
重複計算は前処理で解消するのが典型的な方法のはず。
区間に対して数え上げをする場合は累積和がよく使われる気がする。今回は二次元累積和。

"""

trains = [[0 for _ in range(N)] for _ in range(N)]
for l,r in LR:
    trains[l-1][r-1] += 1

# 累積和にする
for l in range(N):
    for r in range(l+1,N):
        trains[l][r] = trains[l][r-1] + trains[l][r]


for p,q in PQ:
    ans = 0
    for l in range(p-1, q):
        ans += trains[l][q-1]
    print(ans)

Measured memory_bytes: 108504
#include <bits/stdc++.h>
#include <vector>
#include <string.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
//#define INF 2e9
#define ALL(v) v.begin(), v.end()
 
using namespace std;
typedef long long ll;

int main(){
  string s;
  int slength;
  cin >> s ;
  if(s.back() == 's'){
    s += "es";
  }
  else{
    s += 's';
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3584
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#define maxn 1005
#include<cmath>
using namespace std;

double sqr(double a){ return a*a; }
int n;
struct Point
{
	double x,y;
	Point(double a=0,double b=0):x(a),y(b){}
	double operator *(const Point &B)const{ return sqrt(sqr(x - B.x) + sqr(y - B.y));}
}P[maxn],S,T;
double r[maxn],dis[maxn][maxn],dist[maxn];
bool vis[maxn];

int main()
{
	scanf("%lf%lf%lf%lf",&S.x,&S.y,&T.x,&T.y);
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lf%lf%lf",&P[i].x,&P[i].y,&r[i]);
	P[n+1]=S,P[n+2]=T;
	n+=2;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			dis[i][j] = max(0.0 , P[i] * P[j] -r[i] - r[j]);

	for(int i=1;i<=n;i++)dist[i] = 2e18;
	dist[n-1]=0;
	for(int i=1;i<=n;i++)
	{
		int Minloc = -1;
        for(int j=1;j<=n;j++)
			if(!vis[j] && (Minloc == -1 || dist[j] < dist[Minloc]))
				Minloc = j;
		vis[Minloc] = 1;
		for(int j=1;j<=n;j++)
			if(!vis[j] && dist[j] > dist[Minloc] + dis[Minloc][j])
				dist[j] = dist[Minloc] + dis[Minloc][j];
	}

	printf("%.10lf\n",dist[n]);
}


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

int main(){
  char X,Y;
  cin >> X >> Y;
  if(X>Y){
  cout << ">" << endl;
  }
  else if(X<Y){
  cout << "<" << endl;
  }
  else{
  cout << "=" << endl;
  }
}


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

int main(){
	long long n,k,x,ans=0;
	cin>>n>>k;
	x=n/k;
	ans+=(x*x*x);
	if(k%2==0){
		x=(n+k/2)/k;
		ans+=(x*x*x);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define ld long double
#define vl vector<ll> 
#define ll long long int 
using namespace std;
void solve()
{
    ll a, b, c, k;
    cin>>a>>b>>c>>k;
    if(a>=k)
    {
        cout<<k<<endl;
        return;
    }
    if(a+b>=k)
    {
        cout<<a<<endl;
        return;
    }
    cout<<(a)-(k-a-b)<<endl;
}
int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
        solve();
}

Measured memory_bytes: 3632
var  n,i,j:longint;
     x,z:longint;
     f,c,s:array[0..1000000]of longint;
function max(a,b:longint):longint;
begin
  if a>b then exit(a) else exit(b);
end;
begin
  read(n);
  for i:=1 to n-1 do
  read(c[i],s[i],f[i]);
  for i:=1 to n do
  begin
    x:=s[i];
    for j:=i to n-1 do
    begin
      z:=(x-s[j]);
       if z mod f[j]<>0 then
      begin
        z:=(f[j]-(z mod f[j]));
      end else Z:=0;
      if x<=s[j] then
      begin
        x:=s[j]+c[j];
      end else
      begin
        x:=x+z+c[j];
      end;
      //writeln('i=',i,' ',x);
    end;
    writeln(x);
  end;
end.




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

using namespace std;

using ll = int_fast64_t;
constexpr ll llmax = INT_FAST64_MAX; // std::numeric_limits<int_fast64_t>::max()
constexpr ll llmin = INT_FAST64_MIN; // std::numeric_limits<int_fast64_t>::min()
using ull = uint_fast64_t;
constexpr ull ullmax = UINT_FAST64_MAX; // std::numeric_limits<uint_fast64_t>::max()

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    vector<unordered_set<int>> VU{static_cast<size_t>(N)};
    REP(n1, N){
        string S;
        cin >> S;
        REP(n2, N){
            if (S[n2] == '1'){
                VU[n1].emplace(n2);
            }
        }
    }

    auto func = [&](int start) -> int {
        unordered_set<int> used;
        vector<unordered_set<int>> V{1};
        V[0].emplace(start);
        used.emplace(start);
        while(true){
            const int vn = V.size();
            V.emplace_back();
            for (auto&& e : V[vn - 1]){
                V[vn].insert(VU[e].begin(), VU[e].end());
            }
            for (auto&& e : V[vn]){
                if (used.count(e)){
                    if (vn < 2 || ! V[vn - 2].count(e)) return -1;
                }else{
                    used.emplace(e);
                }
            }
            if (used.size() == N) break;
        }
        for (auto&& e1 : V.back()){
            for (auto&& e2 : VU[e1]){
                if (V.back().count(e2)) return -1;
            }
        }
        return V.size();
    };

    int result = -1;
    REP(n1, N){
        result = max(result, func(n1));
    }
    cout << result << endl;
}


Measured memory_bytes: 2176
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}


int main(){
  ll n; cin >> n; vector<pair<ll,ll>> deadtime(n);
  
  rep(i,n){
    ll a,b; cin >> a >> b;
    deadtime[i] = make_pair(b,a);
  }
  
  sort(all(deadtime));
  
  bool flag = true; ll timesum = 0;
  
  for(auto p : deadtime){
    ll deadline = p.first; ll time = p.second;
    timesum += time;
    if(deadline < timesum){
      flag = false;
      break;
    }
  }
  
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  

}

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

// 3... 2/1, 2/3
// 6... 2/1, 2/3, 2/5, 4/1, 4/3, 4/5, 6/1, 6/3, 6/5
int main(void)
{
    int K;
    cin >> K;

    int odd = 0, even = 0;
    for (int i = 1; i <= K; i++)
    {
        if (i % 2 == 0)
            even++;
        else
            odd++;
    }
    cout << even * odd << endl;
    return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    ll n, d;
    cin >> n >> d;
    ll cnt = 0;
    rep(i, n){
        ll x, y;
        cin >> x >> y;
        if (x*x + y*y <= d*d) cnt++;
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3632
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <string.h>
#include <math.h>
#include <map>
#include <time.h>
using namespace std;

int main(){ 
	long long N, H, W, ans = 0;
	long long A[1000], B[1000];

	cin >> N >> H >> W;

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

	for (int i = 0; i < N; ++i){
		if (A[i] >= H && B[i] >= W)
			++ans;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main{ // 

	public static void main(String args[]) {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	static long now() {
		return System.currentTimeMillis();
	}

	static void trace(Object... objects) {
		assert null != System.out.format("trace:%s\n", Arrays.deepToString(objects));
	}

	private static void solve(ConsoleScanner cin, PrintWriter cout) {
		// assert solve(1) == 1;

		int x = cin.nextInt();
		int a = cin.nextInt();
		int b = cin.nextInt();

		long start = now();

		String ans = solve(x, a, b);
		cout.println(ans);

		trace("elapsed", now() - start);
	}

	private static String solve(int x, int a, int b) {
		return Math.abs(x - a) < Math.abs(x - b) ? "A" : "B";
	}

	static class ConsoleScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		}

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

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

}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;

    vector<long int> x(N),y(N);
    vector<long int> h(N);

    for(int i=0;i<N;i++){
        cin >> x.at(i) >> y.at(i) >> h.at(i);
    }

    long int H;
    int ansx=0,ansy=0;

    for(long int cx=0;cx<=100;cx++){
        bool fin = true;
        for(long int cy=0;cy<=100;cy++){
            fin = true;    
            for(int i=0;i<N;i++){
                if(h.at(i)>0){
                H=h.at(i)+abs(x.at(i)-cx)+abs(y.at(i)-cy);
                break;
                }
            }

            for(int i=0;i<N;i++){
                if(h.at(i) == max((H-abs(x.at(i)-cx)-abs(y.at(i)-cy)),(long int)0)){
                }
                else{
                    fin = false;
                }
            }

            if(fin == true){
                ansx=cx;
                ansy=cy;
                break;
            }
        }
        if(fin == true)break;
    }

    cout << ansx << " " << ansy << " " << H << endl; 
}

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

int main()
{
    char a[100010];
    int i,n,f;
    scanf("%s",a);
    n=strlen(a);
    f=n%2;
    if(f==1)
    {
        if(a[0]==a[n-1])f=1;
        else f=0;
    }
    else
    {
        if(a[0]==a[n-1])f=0;
        else f=1;
    }
    if(f==0)printf("First\n");
    else printf("Second\n");
    return 0;
}

Measured memory_bytes: 384
import java.util.*;
public class Main {
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	// 整数の入力
	long n = sc.nextLong();
	long p = sc.nextLong();

	long ans = 1;
	long cnt;

	if(n == 1){
	    ans = p;
	}else{

	    cnt = 0;
	    for(;;){
		if(p % 2 == 0){
		    cnt++;
		    p /= 2;
		}else{
		    for (int j = 1; j <= cnt / n; j++){
			ans *= 2;
		    }
		    break;
		}
	    }


	for(int i = 3; Math.pow(i, n) <= p;i+=2){

	    cnt = 0;
	    for(;;){
		if(p % i == 0){
		    cnt++;
		    p /= i;
		}else{
		    for (int j = 1; j <= cnt / n; j++){
			ans *= i;
		    }
		    break;
		}
	    }
	}
	}
 
	System.out.println(ans);
    }
}
 

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


typedef unsigned long long ll;
typedef long double ld;
using namespace std;
using namespace __gnu_pbds;


#define endl "\n"
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
const int N=20005, mxN=(1<<20)+5;
int mod=998244353 ;

ll mul(ll a, ll b)
{
    a%=mod;
    b%=mod;
    return (a*b)%mod;
}
ll add(ll a, ll b)
{
    a%=mod;
    b%=mod;
    return (a+b+mod)%mod;
}
ll fastpow(ll b, ll p)
{
    if(p==0)
        return 1;
    ll ans=fastpow(b,p/2);
    ans=mul(ans,ans);
    if(p%2)
        ans=mul(ans,b);
    return ans;
}
ll fac(ll n)
{
    ll ans=1;
    while(n)
    {
        ans=mul(ans,n--);
    }
    return  ans;
}
ll ncr(ll n, ll r)
{
    ll ans=fac(n);
    ll m=mul(fac(r),fac(n-r));
    ans=mul(ans,fastpow(m,mod-2));
    return ans;
}
bool intersect(int i, int j, int sz)
{
    if(i>j)
        swap(i,j);
    return !(i+sz>j);
}
int n,arr[N];
int get_ind(int x)
{
    int ind=n-1;
    int low=0,high=n-1;
    while(low<=high)
    {
        int mid=(low+high)/2;
        if(arr[mid]>=x)
        {
            high=mid-1;

        }
        else
        {
            ind=mid;
            low=mid+1;

        }
    }
    return ind;
}

int main()
{
    FIO
    cin>>n;
    for(int i=0; i<n; cin>>arr[i++]);
ll ans=0;
sort(arr,arr+n);
for(int i=0;i<n;i++)
{
    for(int j=i+1;j<n;j++)
    {
        int ind=get_ind(arr[i]+arr[j]);
        ans+=ind-j;

    }


}




cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long 
using ldb = long double;
using pa = pair < int, int >;
#define pb push_back
#define F  first
#define S  second
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)

const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;
int dp[105][105][2];
int a[105][105];
string s[105];
int n, m;
int dfs(int i, int j, int state){
    int &ans = dp[i][j][state];
    if(ans != -1){
        return ans;
    }
    if(i == n and j == m+1){
        return ans = 0;
    }
    if(i > n or j > m){
        return ans = MOD;
    }
    if(state == 0){
        if(a[i][j] == 0){
            ans = 1 + min(dfs(i,j+1,1),dfs(i+1,j,1));
        }
        else{
            ans = min(dfs(i,j+1,0),dfs(i+1,j,0));
        }
    }
    else{
        if(a[i][j] == 0){
            ans = min(dfs(i,j+1,1),dfs(i+1,j,1));
        }
        else{
            ans = min(dfs(i,j+1,0),dfs(i+1,j,0));
        }
    }
    return ans;
}
int32_t main() {
    fast();
    f(i,0,105)
        f(j,0,105)
            f(k,0,2)
                dp[i][j][k] = -1;
    cin >> n >> m;
    f(i,0,n)
        cin >> s[i];
    f(i,1,n+1)
        f(j,1,m+1){
            if(s[i-1][j-1] == '.')
                a[i][j] = 1;
        }

    cout << dfs(1,1,0) << endl;
    return 0;
}


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

int main(){

    int N;
    cin>>N;
    vector<int>W(N);

    for(int i=0;i<N;i++)
        cin>>W[i];

    int ans=10000000;

    int right=0;
    int left=0;
    for(int i=0;i<N;i++){
        right+=W[i];
    }

    for(int i=0;i<N;i++){
        left+=W[i];
        right-=W[i];
        ans=min(ans,abs(left-right));
    }

    cout<<ans<<endl;

    return 0;
}

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

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

    long long a[n];
    for (long long i = 0; i < n; i++) cin >> a[i];

    sort(a, a + n);

    long long sum = a[n - 1];
    for (long long i = 0; i < n - 2; i++)
        sum += a[n - (i / 2) - 2];


    cout << sum;
}

Measured memory_bytes: 5156
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>
#include <functional>

using namespace std;
typedef unsigned long long ll;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

int main() {
	ll A, B, C;
	cin >> A >> B >> C;
	ll mx;
	//どれかが偶数なら0
	//全部奇数なら最大値を半分にわける感じ
	if (A % 2ll == 0ll || B % 2ll == 0ll || C % 2ll == 0ll) {
		cout << 0 << endl;
	}
	else {
		if (A >= B && A >= C) {
			cout << B * C << endl;
		}
		else if (B >= A && B >= C) {
			cout << A * C << endl;
		}
		else {
			cout << A * B << endl;
		}
	}
	return 0;
}

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

int main() {
  int i,l=10,ln=5,t=0;
  vector<int> d(5);
  for(i=0; i<5; i++) {
    cin >> d.at(i);
    if(d.at(i)%10<l && d.at(i)%10!=0) {
      l=d.at(i)%10;
      ln=i;
    }
  }
  
  for(i=0; i<5; i++)
    if(i==ln)
      t+=d.at(i);
    else
      if(d.at(i)%10!=0)
        t+=10*(d.at(i)/10+1);
      else
        t+=d.at(i);
  
  cout << t << endl;
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

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

    int n;
    cin >> n;

    int ans = 0;
    vi a(n), b(n), c(n - 1);
    rep(i, 0, n) {
        cin >> a[i];
        --a[i];
    }
    rep(i, 0, n) {
        int b;
        cin >> b;
        ans += b;
    }
    rep(i, 0, n - 1) { cin >> c[i]; }

    rep(i, 0, n - 1) {
        if (a[i] + 1 == a[i + 1]) { ans += c[a[i]]; }
    }
    cout << ans << endl;

    return 0;
}

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

int main(){
    int n; cin >> n;
    vector<ll> h(n);
    rep(i,n) cin >> h[i];
    int res=h[n-1];
    rep(i,n){
        if(h[n-1-i]-res>=2){
            cout << "No" << endl;
            return 0;
        }
        if(res>h[n-1-i]){
            res=h[n-1-i];
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char a[][] = new char[n + 1][];
		int sum = 0, d = 0, cnt = 0;
		for(int i = 0;i <= n;i++){
			a[i] = sc.next().toCharArray();
		}
		for(int i = 1;i <= n;i++){
out1:		for(int j = 0;j < a[i].length;j++){
				if(a[0][0] == a[i][j]){
					for(int k = j + 1;k < a[i].length;k++){
						if(a[0][1] == a[i][k]){
							d = k - j;
							cnt = 2;
out2:						for(int l = k + d;l < a[i].length;l += d){
								if(a[0][cnt] == a[i][l]) cnt++;
								else break out2;
								if(cnt == a[0].length){
									sum++;
									break out1;
								}
							}
						}
					}
				}
			}
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 27468
n,W = map(int , input().split())

v,w,m = [],[],[]

for i in range(n):
    vv,ww,mm = map(int , input().split())
    v.append(vv)
    w.append(ww)
    m.append(mm)

dp = [-float('inf') for i in range(W+1)]
dp[0] = 0
deq = [0 for i in range(W+1)]
for i in range(n):
    temp = [-float('inf') for i in range(W+1)]
    for k in range(w[i]):
        s,t = 0,0
        a = []
        
        for cnt,l in enumerate(range(k,W+1,w[i])): a.append(dp[l]-cnt*v[i])
        for cnt,l in enumerate(range(k,W+1,w[i])):
            while(s<t) and (a[deq[t-1]] <= a[cnt]): t -= 1
            deq[t] = cnt
            t += 1
            temp[l] = a[deq[s]]
            if(cnt - m[i] >= 0): 
                if(cnt-m[i] == deq[s]) : s += 1
            temp[l] += cnt*v[i]
            
    dp = temp

ans = 0
for i in range(1,W+1):ans = max(ans , dp[i])

print(ans)


Measured memory_bytes: 7260
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
const ll INF = (ll)1e18 + 1;
const int inf = 1012345678;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    vector<int> a(5); rep(i,5) cin >> a[i];
    vector<int> p = { 0,1,2,3,4 };
    int ans = inf;
    
    do{
        int tmp = 0;
        rep(i,p.size()){
            while(tmp % 10 != 0) tmp += 1;
            tmp += a[p[i]];
        }
        chmin(ans, tmp);
    } while(next_permutation(all(p)));
    
    cout << ans << ln;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define N 1000000
#define INF 1000000006
using namespace std;

struct card{
  char f;
  int s;
};

card a[N],L[N],R[N],b[N];
int n,cnt;

void merge(int l,int m,int r){
  int n1=m-l,n2=r-m;
  for(int i=0;i<n1;i++) L[i]=b[l+i];
  for(int i=0;i<n2;i++)R[i]=b[m+i];
  L[n1].s=INF,R[n2].s=INF;
  int i=0,j=0;
  for(int k=l;k<r;k++){
    if(L[i].s<=R[j].s){
      b[k]=L[i],i++;
    }else {
      b[k]=R[j],j++;
    }
    cnt++;
  }
}

void msort(int l,int r){
  int m;
  if(l+1<r){
 m=(l+r)/2;
  msort(l,m);
  msort(m,r);
  merge(l,m,r);
  }
}

int partition(int p,int r){
  card t,x;
  int i;
  x=a[r],i=p-1;
  for(int j=p;j<r;j++)if(a[j].s<=x.s)i++,t=a[i],a[i]=a[j],a[j]=t;
  a[r]=a[i+1],a[i+1]=x;
  return i+1;
}

void quicksort(int p,int r){
  int q;
  if(p<r){
    q=partition(p,r);
    quicksort(p,q-1);
    quicksort(q+1,r);
  }
}

int main(){
    int f=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i].f>>a[i].s;
    b[i]=a[i];
  }
  
  quicksort(0,n-1);
  msort(0,n);
  
  for(int i=0;i<n;i++)if(a[i].f!=b[i].f || a[i].s!=b[i].s)f=1;
  
  if(f)cout<<"Not stable"<<endl;
  else cout<<"Stable"<<endl;

  for(int i=0;i<n;i++) cout<<a[i].f<<" "<<a[i].s<<endl;
  
  return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

int main() {
  int n, m;
  cin >> n >> m;
  int height[n];
  rep(i, n) cin >> height[i];

  map<int, vector<int>> deck;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    if (deck.count(a) > 0) {
      deck[a].push_back(b);
    } else {
      vector<int> v;
      v.push_back(b);
      deck[a] = v;
    }
    if (deck.count(b) > 0) {
      deck[b].push_back(a);
    } else {
      vector<int> v;
      v.push_back(a);
      deck[b] = v;
    }
  }

  int ans = 0;
  rep(i, n) {
    vector<int> v = deck[i];
    int selfH = height[i];
    bool isGood = true;
    for (int h : v) {
      if (selfH <= height[h]) isGood = false;
    }
    if (isGood) {
      ++ans;
      //cout << "good:" << i << " " << selfH << endl;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 14624