akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
using namespace std;

int main(){
  vector<string> v(3);
  for(int i = 0; i < 3; i++){
    cin >> v[i];
  }
  
  cout << v[0][0] << v[1][0] << v[2][0] << endl;
}


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

#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define w(x) int t; cin >> t; while(t--)
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define repd(i, b, a) for(int i = b; i >= a; i--)
#define mk(arr,n,type) type* arr = new type[n];
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define um unordered_map
#define us unordered_set
#define pqm priority_queue<int>
#define pqmi priority_queue<int, vi, greater<int>>
#define lb(v, val) lower_bound(v.begin(), v.end(), val) - v.begin();
#define ub(v, val) upper_bound(v.begin(), v.end(), val) - v.begin();
#define setbits(x) __builtin_popcountll(x)
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define out(flag) flag ? cout << "NO" << endl : cout << "YES" << endl;
#define MAX 100001
#define mod 998244353
#define inf 1e18
#define PI 3.1415926535

void IO() {
	fast;
}

int main() {

	IO();

	int n;
	cin >> n;
	vector<vector<int>> dp(n, vector<int>(3));
	for (int i = 0; i < n; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		if (i == 0) {
			dp[i][0] = a;
			dp[i][1] = b;
			dp[i][2] = c;
		} else {
			dp[i][0] = a + max(dp[i - 1][1], dp[i - 1][2]);
			dp[i][1] = b + max(dp[i - 1][0], dp[i - 1][2]);
			dp[i][2] = c + max(dp[i - 1][0], dp[i - 1][1]);
		}
	}
	cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << endl;

	return 0;
}


Measured memory_bytes: 5760
using System;

class RemainingTime {
    static void Main(string[] args)
    {
        int A, B;
        string[] s;

        s = Console.ReadLine().Split(' ');

        A = int.Parse(s[0]);
        B = int.Parse(s[1]);

        Console.WriteLine((A+B) % 24);
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  
  int len=S.size();
  
  bool flag=1;
  
  for (int i=0; i<len;i++){
  	if (S.at(i)!=S.at(len-1-i)) flag=0;
  }
  
  for (int i=0; i< (len-1)/2;i++){
  	if (S.at(i)!=S.at((len-3)/2-i)) flag=0;
  }
  
  for (int i=0; i < (len-1)/2;i++){
  	if (S.at((len+1)/2+i)!=S.at(len-1-i)) flag=0;
  }
  
  if (flag==1) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  
}

Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.Scanner;

public class Main{

	static final Scanner s=new Scanner(System.in);

	public static void main(String args[]){
		String b;
		while(!(b=s.next()).equals("-")){
			char buf[]=b.toCharArray();
			ArrayDeque<Character> deque=new ArrayDeque<>();
			for(char c:buf)
				deque.add(c);
			for(int i=s.nextInt(); i>0; i--){
				for(int j=s.nextInt(); j>0; j--){
					deque.add(deque.poll());
				}
			}
			for(int i=0; i<buf.length; i++)
				buf[i]=deque.poll();
			System.out.println(String.valueOf(buf));
		}
	}
}

Measured memory_bytes: 26100
#include"bits/stdc++.h"
using namespace std;

int main() {
  int a, b, ba, ans;
  cin >> a >> b;
  ba = b / 0.1;
  ans = -1;
  for(int i = ba; i <= ba + 9 ; i++ ) {
    if((int)(i * 0.08) == a) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}

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

int main() {
  
  int n,q;
  cin >> n >> q;
  
  string s;
  
  cin >> s;
  
   n=s.size();
  
  vector<int> a(n-1);
  int m=0;
  
  for(int i=0;i<n-1;i++){
     if(s.at(i) == 'A'&& s.at(i+1) == 'C') m++;
	 a.at(i) = m;
  
  }	
  int l,r;
 for(int i=0;i<q;i++){
	cin >> l >> r;
     if(l==1)  cout << a.at(r-2)<< endl;
	 
     else {
	    cout << a.at(r-2)-a.at(l-2)<< endl;
     }
 } 
  
}


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

struct City{
  int pref;
  int year;
  int index;
};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);

  int n, m;
  cin >> n >> m;
  vector<City> cities(m);
  rep(i, m) {
    City c;
    cin >> c.pref >> c.year;
    c.index = i;
    cities[i] = c;
  }

  sort(cities.begin(), cities.end(),
       [](const City& c1, const City& c2) {
        if (c1.pref != c2.pref) return c1.pref < c2.pref;
        return c1.year < c2.year; 
       });
  
  vector<City> ans(m);
  int prev_pref = cities[0].pref;
  int count = 1;
  rep(i, m) {
    int index = cities[i].index;
    if (prev_pref != cities[i].pref) {
      count = 1;
      prev_pref = cities[i].pref;
    }
    ans[index].pref = cities[i].pref;
    ans[index].year = count;
    count++;
  }

  rep(i, m) {
    printf("%06d%06d\n", ans[i].pref, ans[i].year); 
  }
  return 0;
}


Measured memory_bytes: 3840
#define _CRT_SECURE_NO_WARNINGS
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <array>
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <utility>
#include <assert.h>
using namespace std;

typedef unsigned long long ull;
typedef signed long long ll;
#define INF (1LL << 48)

struct PT { ll x; ll y; };
string to_s(ull x) { return to_string(x); }
string to_s(ll x) { return to_string(x); }
ll to_ll(const string& x) { return stoll(x); }
ull to_ull(const string& x) { return stoull(x); }



constexpr int MAX_N = 2000;
constexpr int MAX_Y = 20000;
short dp[MAX_N + 1][MAX_Y + 1];

int main(int argc, char* argv[])
{
	fill((short*) dp, (short*) dp + (MAX_N + 1) * (MAX_Y + 1), -1);
	dp[0][0] = 0;
	for (int i = 1; i <= MAX_N; i++) {
		for (int j = 0; j <= MAX_Y; j++) {
			if (dp[i - 1][j] != -1) {
				dp[i][j + 1] = j;
				dp[i][j + 5] = j;
				dp[i][j + 10] = j;
			}
		}
	}

	for (;;) {
		ll N, Y;
		cin >> N >> Y;
		if (cin.fail()) break;

		short y = (short) (Y / 1000);
		if (dp[N][y] != -1) {
			short result[11] = {};
			while (N > 0) {
				result[y - dp[N][y]]++;
				y = dp[N][y];
				N--;
			}
			printf("%d %d %d\n", result[10], result[5], result[1]);
		} else {
			printf("-1 -1 -1\n");
		}
	}

	return 0;
}


Measured memory_bytes: 78464
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9+7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
unsigned day;
if(dow < dow1) dow += 7;
day = dow - dow1;
day += 7 * n - 6;
return day;
}
unsigned DayToWeekNumber(unsigned day)
{
  return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
  return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main(){
  int a,b,c,d; cin>>a>>b>>c>>d;
  rep(i,c-a)cout<<"R";
  rep(i,d-b)cout<<"U";
  rep(i,c-a)cout<<"L";
  rep(i,d-b)cout<<"D";
  cout<<"L";
  rep(i,d-b+1)cout<<"U";
  rep(i,c-a+1)cout<<"R";
  cout<<"D"<<"R";
  rep(i,d-b+1)cout<<"D";
  rep(i,c-a+1)cout<<"L";
  cout<<"U"<<endl;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

queue<int> qu;

int main() {
  int s;
  cin >> s;
  
  const int ma = pow(10, 8) + 1500000;
  const int ma2 = pow(10, 7) - 1;
  int sum = 0;
  int k = 1;
  int nex = 10;
  qu.push(sum);
  ll ans = 0;
  rep1 (i, ma) {
    if (i == nex) {
      k++;
      nex *= 10;
    }
    sum += k;
    while (!qu.empty() && qu.front() < sum - s) {
      qu.pop();
    }
    if (!qu.empty() && qu.front() == sum - s) {
      ans++;
      qu.pop();
    }
    if (i < ma2) {
      qu.push(sum);
    }
  }

  ll num = 9 * pow(10, 7);
  for (int k = 8; k <= s; k++) {
    if (s % k == 0) {
      int n = s / k;
      if (k == 8 && n > num) ans += 0;
      else {
        (ans += (num - n + 1)) %= MOD;
      }
    }

    int l, m;
    if (s % k) {
      l = s / k;
      m = s % k;
    }
    else {
      l = s / k - 1;
      m = k;
    }
    if (l - m > 0) {
      ll jou;
      if ((l - m) % (1 + k) == 0) {
        jou = (l - m) / (1 + k) - 1;
      }
      else {
        jou = (l - m) / (1 + k);
      }
      (ans += jou + 1) %= MOD;
    }
    num = num * 10 % MOD;
  }
  ans = (ans + MOD) % MOD;
  cout << ans << endl;
}


Measured memory_bytes: 41092
mod = 998244353

n,s = map(int, input().split())
a = list(map(int, input().split()))
m = 3000
DP = [0]*(m+1)
ans = 0
for ai in a:
    DP[0] += 1
    for j in reversed(range(ai,m+1)):
        DP[j] += DP[j-ai]
        DP[j] %= mod
    ans += DP[s]
    ans %= mod
print(ans)

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

using namespace std;

const int N = 16, mod = 1e9 + 7;

void add(int& x, int y) {
  x += y;
  if (x >= mod) {
    x -= mod;
  }
}

void sub(int& x, int y) {
  x -= y;
  if (x < 0) {
    x += mod;
  }
}

int mul(int x, int y) {
  return (long long) x * y % mod;
}

int n, m, a[N], size[1 << N], dp[N + 1][1 << N], fac[1 << N + 1], ifac[1 << N + 1], inv[1 << N + 1];

int binom(int n, int m) {
  return n < 0 || m < 0 || n < m ? 0 : mul(fac[n], mul(ifac[m], ifac[n - m]));
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    cin >> a[i];
  }
  reverse(a, a + m);
  int all = 1 << n;
  fac[0] = ifac[0] = inv[1] = 1;
  for (int i = 1; i <= all; ++i) {
    if (i > 1) {
      inv[i] = mul(mod - mod / i, inv[mod % i]);
    }
    fac[i] = mul(fac[i - 1], i);
    ifac[i] = mul(ifac[i - 1], inv[i]);
  }
  for (int i = 1; i < all; ++i) {
    size[i] = size[i - (i & -i)] + 1;
  }
  dp[0][0] = 1;
  for (int i = 1; i <= m; ++i) {
    int x = a[i - 1];
    for (int j = 0; j < all; ++j) {
      dp[i][j] = dp[i - 1][j];
      for (int k = 0; k < n; ++k) {
        if (j >> k & 1) {
          add(dp[i][j], mul(dp[i - 1][j ^ (1 << k)], binom(all - x + 1 - j + (1 << k) - 1, (1 << k) - 1)));
        }
      }
    }
  }
  int answer = 0;
  for (int i = 0; i < all; ++i) {
    int result = mul(dp[m][i], fac[all - 1 - i]);
    for (int j = 0; j < n; ++j) {
      if (i >> j & 1) {
        result = mul(result, fac[1 << j]);
      }
    }
    if (size[i] & 1) {
      sub(answer, result);
    } else {
      add(answer, result);
    }
  }
  cout << mul(all, answer) << '\n';
  return 0;
}

Measured memory_bytes: 5376
using AtCoderBeginnerContest158.Questions;
using AtCoderBeginnerContest158.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest158.Questions
{
    public class QuestionC : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var ab = inputStream.ReadIntArray();
            var a = ab[0];
            var b = ab[1];

            for (int i = 1; i <= 1010; i++)
            {
                var tax8 = (int)(i * 0.08);
                var tax10 = (int)(i * 0.1);

                if (tax8 == a && tax10 == b)
                {
                    yield return i;
                    yield break;
                }
            }

            yield return -1;
        }
    }
}


namespace AtCoderBeginnerContest158
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionC();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest158.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest158.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int a[200000];
int dp[200000];

int main(){
	int n,m;cin>>n>>m;
	rep(i,m){
		scanf("%d",&a[i]);
		dp[a[i]]=-1;
	}
	dp[0]=1;
	for(int i=1;i<=n;i++){
		if(dp[i]==-1)continue;
		if(i>=2&&dp[i-2]!=-1)(dp[i]+=dp[i-2])%=MOD;
		if(dp[i-1]!=-1)(dp[i]+=dp[i-1])%=MOD;
	}
	cout<<dp[n]<<endl;
}

Measured memory_bytes: 1024
n, m = map(int, input().split())
ka = [list(map(int, input().split())) for i in range(n)]
ans = [0] * m

for i in range(n):
    for j in range(1, len(ka[i])):
        for k in range(1, m+1):
            if ka[i][j] == k:
                ans[k-1] += 1
                break

print(ans.count(n))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  long table[n+1] = {0};
  for (int i=1; i<n+1; i++) {
    for (int j=i; j<=n+1; j+=i) {
      table[j] += 1;
    }
  }
  int64_t sum = 0;
  for (long i=1; i<n+1; i++) {
    sum += i*table[i];
  }
  cout << sum << endl;
}


Measured memory_bytes: 81664
#include <bits/stdc++.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()
typedef long long ll;

using namespace std;

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


const int NM = 101001;//ここを問題の制約を見ながらいじる．配列の確保に使う．
int A[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．

// Main program
void solve(){
  int A1,A2,A3;
    cin >> A1 ;
      cin >> A2 ;
    cin >> A3 ;


    int ans;
    if(A1+A2+A3 >=22 ){
      cout << "bust"; 
    }
  else{
    cout << "win";
  }
}

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////

int main() {
	ll S;
	cin >> S;

	ll l = 0;
	ll r = 1000000001;

	while (r - l > 1) {
		ll m = (r + l) / 2;
		if (m*m > S - 1) { r = m; }
		else { l = m; }
	}

	ll M=r;

	ll x1 = 0;
	ll y1 = 0;

	ll N, x2, y3;

	if (M*(M - 1) >= S) {
		N = M * (M - 1);
		x2 = M;
		y3 = M - 1;
	}
	
	else { N = M * M; x2 = M; y3 = M; }

	ll y2 = 1;
	ll x3 = N - S;

	cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3;

	system("PAUSE");

}





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

using namespace std;

#define pb push_back

const int maxi = 1e6+10;
int a[maxi];
string s;
int n;
int t;
vector<int> v[maxi];

int main()
{
    cin>>s;

    cout<<s[0]<<s[1]<<s[2]<<endl;
    return 0;
}
//Moj mali posao za Bari
//cekam da se vrati, donijece mi stvari
//a kad se vrati, pune se ormari
//svima da se hvalim, korzo da zapalim


Measured memory_bytes: 27072
import math
n,k = map(int,input().split())
alist = list(map(int,input().split()))

max_length = max(alist)
cur_length = 0

while(max_length - cur_length > 1):
    next_length = (max_length+cur_length)//2

    test_k = 0
    for i in range(n):
        test_k += math.ceil(alist[i]/next_length)-1

    if test_k <= k:
        max_length = next_length
    else:
        cur_length = next_length
        

print(max_length)

Measured memory_bytes: 30996
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{
		long N = nextLong();
		long K =nextLong();

		System.out.println((long)(K*Math.pow(K-1, N-1)));

	}





	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



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

int main(){
	int n;	cin>>n;
	pair<int,int> data[n];

	for(int i=0;i<n;i++){
		cin>>data[i].second>>data[i].first;
	}
	sort(data,data+n);

	string ans="Yes";
	int x=0;
	for(int i=0;i<n;i++){
		x += data[i].second;
		if(x>data[i].first){
			ans="No";
			break;
		}
	}


	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#define MAX 20000

typedef struct Data{
  int area,pos;
} Data;

Data t[MAX];
int u[MAX];
int n,i;
char str[MAX+1];
int T,U;
int ans,A;
Data B,X;

void D_push(Data data){
  t[T++] = data;
}

Data D_pop(){
  return t[--T];
}

void push(int x){
  u[U++] = x;
}

int pop(){
  return u[--U];
}

void init(){
  ans = T = U = 0;
}

Data makeData(int x, int y){
  Data res;
  res.area = x;
  res.pos = y;
  return res;
}

int main(){
  init();
  scanf("%s", str);
  n = strlen(str);

  for( i = 0 ; i < n ; i++){

    if(str[i] == '/'){

      if( U == 0 ) continue;
      A = pop();
      X = makeData( i-A, A);
      ans += i - A;
      while( T > 0 ){
        B = D_pop();
        if( B.pos < A ){
          D_push(B);
          break;
        }
        X.area += B.area;
        if(B.pos<X.pos) X.pos = B.pos;
      }
      D_push(X);
    }else if( str[i] == '\\' ){
      push(i);
    }

  }

  printf("%d\n%d", ans, T);
  for( i = 0 ; i < T ; i++ ){
    printf(" %d", t[i].area);
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 2108
if __name__ == '__main__':
    game_count = int(input())
    deck_taro = [''] * game_count
    deck_hanako = [''] * game_count
    for i in range(game_count):
        data = [x for x in input().split(' ')]
        deck_taro[i] = data[0]
        deck_hanako[i] = data[1]

    point_taro = 0
    point_hanako = 0
    for i in range(game_count):
        if deck_taro[i] < deck_hanako[i]:
            point_hanako += 3
        elif deck_taro[i] > deck_hanako[i]:
            point_taro += 3
        else:
            point_hanako += 1
            point_taro += 1

    print('{0} {1}'.format(point_taro, point_hanako))


Measured memory_bytes: 5620
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

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

int main() {
	char c;
	cin >> c;
    
	char ans = c+1;
	
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-12;
const int N=200000+10,maxn=200000+10,inf=0x3f3f3f3f;


int main()
{
    int n,y;
    scanf("%d%d",&n,&y);
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n && i+j<=n;j++)
        {
            int k=n-i-j;
            if(i*1000+j*5000+k*10000==y)
            {
                printf("%d %d %d\n",k,j,i);
                return 0;
            }
        }
    }
    puts("-1 -1 -1");
    return 0;
}
/********************

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


Measured memory_bytes: 256
import math
A,B,H,M = map(int,input().split())
kakudoA = (H+M/60)*30
kakudoB = M*6
kakudo = min(abs(kakudoA-kakudoB),360-abs(kakudoA-kakudoB))
henn2 = A**2+B**2-2*A*B*math.cos(math.radians(kakudo))
print(henn2**0.5)

Measured memory_bytes: 62468
import numpy as np
from scipy.sparse.csgraph import floyd_warshall

N = int(input())
A = [[int(x) for x in input().split()] for _ in range(N)]

if np.any(A != floyd_warshall(A)):
    print(-1)
else:
    ans = 0
    A += np.diag([float('inf')] * N)
    for i in range(N):
        for j in range(i + 1, N):
            if np.min(A[i] + A[j]) != A[i, j]:
                ans += int(A[i, j])
    print(ans)


Measured memory_bytes: 24864
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		sc.close();

		if ((a * b) % 2 == 0) {
			System.out.println("Even");
		}
		else {
			System.out.println("Odd");
		}

	}

}

Measured memory_bytes: 21844
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INF = INT_MAX/10;

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

int main() {
	int n;
	char s, t, b;

	while(cin >> n, n) {
		cin >> s >> t >> b;

		int sx = (s-'A')%3, sy = (s-'A')/3;
		int tx = (t-'A')%3, ty = (t-'A')/3;
		int bx = (b-'A')%3, by = (b-'A')/3;

		vector<vvi> dp(3, vvi(3, vi(n+1)));
		dp[sy][sx][0] = 1;
		FOR(i, 1, n) {
			REP(x, 3) {
				REP(y, 3) {
					REP(d, 4) {
						int nx = x + dx[d];
						int ny = y + dy[d];
						if(nx < 0 || 2 < nx || ny < 0 || 2 < ny) {
							nx = x;
							ny = y;
						}
						if(nx == bx && ny == by) {
							nx = x;
							ny = y;
						}

						dp[ny][nx][i] += dp[y][x][i-1];
					}
				}
			}
		}

		double ans = (double)dp[ty][tx][n]/(1<<(2*n));
		printf("%.8f\n", ans);
	}

	return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	string s;
	cin >> s;
	string a = "12";
	int q;
	cin >> q;
	int t;
	int f;
	char c;
	string x;
	int var = 0;
	//a = s;
	zip(i, 0, q)
	{
		cin >> t;
		if (t == 1)
		{
			var++;
		}
		else
		{
			cin >> f >> c;
			if (f == 1)
			{
				x = c;
				if (var % 2)
				{
					a =  a + x;
				}
				else
				{
					a = x + a;
				}
			}
			else
			{
				x = c;
				if (var % 2)
				{
					a = x + a;
				}
				else
				{
					a = a + x;
				}
			}
		}
	}
	if (var % 2)
	{
		reverse(all(a));
	}
	//cout << a << en;
	//return 0;
	string y = s;
	reverse(all(y));
	for (int i = 0; i < a.size(); i++)
	{
		if (a[i] == '1' || a[i] == '2')
		{
			if (a[i] == '1')
			{
				cout << s;
				i++;
			}
			else
			{
				cout << y;
				i++;
			}
		}
		else
		{
			cout << a[i];
		}
	}
	cout << en;


	return 0;
}



Measured memory_bytes: 1452
from heapq import heappush,heappop

x, y, z, k = map(int, input().split())
a = sorted(list(map(int, input().split())))[::-1]
b = sorted(list(map(int, input().split())))[::-1]
c = sorted(list(map(int, input().split())))[::-1]

h = []
heappush(h, (0, 0, 0, 0))
val = a[0] + b[0] + c[0]
searched = set()

cnt = 0
while cnt < k:
    cost, ia, ib, ic = heappop(h)
    if (ia, ib, ic) in searched:
        continue
    else:
        searched.add((ia, ib, ic))
        cnt += 1
    print(val - cost)
    if ia < x-1:
        heappush(h, (cost + a[ia] - a[ia+1], ia+1, ib, ic))
    if ib < y-1:
        heappush(h, (cost + b[ib] - b[ib+1], ia, ib+1, ic))
    if ic < z-1:
        heappush(h, (cost + c[ic] - c[ic+1], ia, ib, ic+1))


Measured memory_bytes: 4212
from math import atan
from math import degrees

a, b, x = map(int, input().split())
if 1 <= x <= ((a ** 2) * b) / 2:
    print(degrees(atan(a * (b ** 2) / (2 * x))))
else:
    print(degrees(atan((2 * b / a) - (2 * x) / (a ** 3))))


Measured memory_bytes: 38384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#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 fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<62;



int main(void) {

    int n;
    cin>>n;
    vi x(n),y(n);
    rep(i,n)cin>>x[i]>>y[i];
    int ans=INF;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i==j)continue;
            int p = x[i]-x[j];
            int q = y[i]-y[j];
            vi group;
            for(int k=0;k<n;k++){
                for(int l=0;l<n;l++){
                    if(k==l)continue;

                    if(x[k]-x[l]==p && y[k]-y[l]==q){
                        group.push_back(k);
                    }
                }
            }
            ans=min(ans,n-(int)group.size());
        }
    }
    if(n==1)ans=1;
    fin(ans);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
vector<int> G[MAX_N];

pl D[MAX_N];
ll ts[MAX_N];
pi ans[MAX_N];

pl dist(int v, int p) {
	pl res(0, 1);
	rep(i, 0, sz(G[v])) {
		int n = G[v][i];
		if(n == p) continue;
		pl tmp = dist(n, v);
		res.fst += tmp.fst + tmp.sec;
		res.sec += tmp.sec;
	}
	return res;
}

void solve() {
	cin >> N;
	rep(i, 0, N) {
		cin >> D[i].fst;
		D[i].fst *= -1;
		D[i].sec = i;
	}
	rep(i, 0, N) ts[i] = 1;
	sort(D, D + N);
	rep(i, 0, N - 1) {
		int at = lower_bound(D, D + N, pl(D[i].fst + (N - 2 * ts[i]), -inf)) - D;
		if(at == N || D[at].fst != D[i].fst + (N - 2 * ts[i]) || at <= i) {
			cout << "-1\n"; return;
		}
		ts[at] += ts[i];
		ans[i] = pi(D[i].sec, D[at].sec);
		G[D[i].sec].pb(D[at].sec);
		G[D[at].sec].pb(D[i].sec);
	}
	if(dist(D[N - 1].sec, -1).fst != -D[N - 1].fst) {
		cout << "-1\n"; return;
	}
	rep(i, 0, N - 1) {
		cout << ans[i].fst + 1 << " " << ans[i].sec + 1 << "\n";
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 18560
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long
const ll MOD = 1000000007;

const double pi = atan2(0, -1);

int main(){
	int N;
	cin >> N;
	double x, y, the, themx;
	vector<pair<double, double>> P(N);
	for (int i = 0;i < N;i++) {
		cin >> x >> y;
		P[i] = { x,y };
	}
	if (N == 2) {
		cout << "0.5000000" << endl << "0.5000000" << endl;
		return 0;
	}
	//cout << pi << endl;
	vector<double> angles, sub;
	for (int i = 0;i < N;i++) {
		angles = sub;
		themx = 0;
		for (int j = 0;j < N;j++) {
			if (i == j)continue;
			x = P[j].first - P[i].first;
			y = P[j].second - P[i].second;
			the = atan2(y, x);
			angles.push_back(the);
			angles.push_back(the + 2 * pi);
		}
		sort(all(angles));

		for (int i = 1;i < angles.size();i++) {
			the = angles[i] - angles[i - 1];
			themx = max(themx, the);
		}
		if (themx > pi) {
			themx = (themx - pi) / (2 * pi);
			printf("%.10f\n",themx);
		}
		else {
			printf("%.10f\n", (double)0);
		}
	}
}

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


int main()
{
	int A[1000];
	int N;
	int count = 0;
	int tmp;
	bool flag = true;

	cin >> N;

	for(int i=0; i<N; i++){
		cin >> tmp;
		if(tmp%2 == 0){
			A[count] = tmp;
			count++;
		}
	}

	for(int i=0; i<count; i++){
		if(A[i]%3!=0 && A[i]%5!=0){
			flag = false;
			break;
		}
	}

	cout << (flag? "APPROVED" : "DENIED");


	return 0;
}

Measured memory_bytes: 256
using System;

    class Program
    {
        static void Main()
        {
            string input = Console.ReadLine();
            int count = 0;
            int ans = 0;
            foreach(char i in input)
            {
                if (i == 'R')
                {
                    count++;
                    if (count > ans) ans = count;
                }
                else count = 0;
            }
            Console.WriteLine(ans);
        }
    }

Measured memory_bytes: 25876
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		int group[] = {1,1,3,1,2,1,2,1,1,2,1,2,1};
		Scanner scanner = new Scanner(System.in);
		int x = Integer.parseInt(scanner.next());
		int y = Integer.parseInt(scanner.next());
		if(group[x] == group[y]){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

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

#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  int n1 = n % 10;
  switch (n1) {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
      cout << "hon" << endl;
      break;
    case 0:
    case 1:
    case 6:
    case 8:
      cout << "pon" << endl;
      break;
    case 3:
      cout << "bon" << endl;
      break;
  }
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <cstdlib>
#include <queue>

int a[100003];
int main()
{
    int n;
    scanf("%d", &n);
    for(int i=0;i<n;i++)
        scanf("%d", &a[i]);
    std::sort(a, a+n);
    long long int ans = 0;
    if(n % 2 == 0)
    {
        ans = - a[n/2] + a[n/2-1];
        for(int i=0;i<n/2;i++)
            ans -= 2LL * a[i];
        for(int i=n/2;i<n;i++)
            ans += 2LL * a[i];
    }
    else
    {
        long long int tmp = 0;
        tmp += a[n/2];
        tmp += a[n/2-1];
        for(int i=0;i<=n/2;i++)
            tmp -= 2LL * a[i];
        for(int i=n/2+1;i<n;i++)
            tmp += 2LL * a[i];
        ans -= a[n/2];
        ans -= a[n/2+1];
        for(int i=0;i<n/2;i++)
            ans -= 2LL * a[i];
        for(int i=n/2;i<n;i++)
            ans += 2LL * a[i];
        ans = std::max(tmp, ans);
    }

    printf("%lld", ans);
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define INPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.in"
#define OUTPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.out"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

typedef long long ll;
#define pb push_back
#define mp make_pair

void solve()
{
    ll n, m;
    cin >> n >> m;
    if(n == 1 && m == 1)
    {
        cout << 1;
    }
    else if(n == 1 || m == 1)
    {
        cout << max(n, m) - 2;
    }
    else
    {
        cout << (n - 2) * (m - 2);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0);
    //freopen(INPUT, "r", stdin);freopen(OUTPUT, "w", stdout);
    int t = 1;
    //cin >> t;
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}



Measured memory_bytes: 256
#pragma warning(disable: 4996)

#include <iostream>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <functional>
#include <cstdio>
#include <cctype>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <bitset>
#include <numeric>
#include <string>
#include <set>
#include <tuple>
#include <utility>
#include <regex>
#include <deque>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
using namespace std;

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

	int n;
	cin >> n;
	cout << (n + 2 - 1) / 2;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 全何種類で何種類買うか取得
n,k = map(int, input().split())
# 値段を格納
prices = [int(p) for p in input().split()]
# ソート
prices.sort()
#最安値を出力
print("%d" % sum(prices[:k]))

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

//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3", "Ofast", "unroll-loops", "fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


#define int long long
#define endl '\n'

using namespace std;

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long double l; cin >> l;
    cout.setf(ios :: fixed);
    cout.precision(12);
    cout << l / 3 * l / 3 * l / 3 << endl;

    return 0;
}


Measured memory_bytes: 512
#[allow(dead_code)]
pub struct Scanner<'a> {
    _buf: &'a str,
    iter: ::std::str::SplitWhitespace<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    pub fn new(buf: &'a str) -> Self {
        Scanner {
            _buf: buf,
            iter: buf.split_whitespace(),
        }
    }

    pub fn array<T>(&mut self, n: usize) -> Vec<T>
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        let mut res = Vec::with_capacity(n);
        for _ in 0..n {
            res.push(self.value());
        }
        res
    }

    pub fn value<T>(&mut self) -> T
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        self.next().parse().unwrap()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.next().chars().collect()
    }

    fn next(&mut self) -> &str {
        self.iter.next().unwrap()
    }
}

// n ビットで表せる最大値
fn fmax(n: i64) -> i64 {
    assert!(n > 0);
    let m = (n-1) / 2;
    (4_i64.pow(m as u32+1) - 1) / 3
}

// n ビットで表せる最小値
fn fmin(n: i64) -> i64 {
    assert!(n > 0);
    if n == 1 { return 0; }
    let m = n / 2;
    -2 * (4_i64.pow(m as u32) - 1) / 3
}

fn main() {
    let mut _input = String::new();
    {
        use ::std::io::Read;
        ::std::io::stdin().read_to_string(&mut _input).unwrap();
    }
    let mut sc = Scanner::new(&_input);

    let mut n = sc.value::<i64>();

    assert_eq!( 1, fmax(1));
    assert_eq!( 1, fmax(2));
    assert_eq!( 5, fmax(3));
    assert_eq!( 5, fmax(4));
    assert_eq!(21, fmax(5));
    assert_eq!(  0, fmin(1));
    assert_eq!( -2, fmin(2));
    assert_eq!( -2, fmin(3));
    assert_eq!(-10, fmin(4));
    assert_eq!(-10, fmin(5));

    let mut ans = String::new();
    let mut bits_prev = -1;
    loop {
        let mut bits = -1;
        for i in 1.. {
            if fmin(i) <= n && n <= fmax(i) {
                bits = i;
                break;
            }
        }

        if bits_prev != -1 {
            for _ in 0..(bits_prev-bits-1) {
                ans += "0";
            }
        }

        if bits == 1 {
            if n == 0 {
                ans += "0";
            }
            else {
                ans += "1";
            }
            break;
        }

        ans += "1";
        n -= (-2_i64).pow(bits as u32-1);
        bits_prev = bits;
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
 
int w[10000]={0},s[10000]={0};
 
int main ()
{
	int a,b,c,d,e,f,i,j,k=0,mxw=0,mxs=0;
	cin>>a>>b>>c>>d>>e>>f;
	for(i=0;i<=f/100;i++)
		for(j=0;j<=f/100;j++)
		{
			w[i*a+j*b]=1;
		}	
//	cout<<mxw<<endl;
	for(i=0;i<=3000;i++)
		for(j=0;j<=3000;j++)
		{
			if(i*c+j*d>3000)
				continue;
			s[i*c+j*d]=1;
		}
	int tw,ts;
	double mx=-1;
	for(i=1;i<=f/100;i++)
		for(j=0;j<=3000;j++)
		{
			if(w[i]!=1||s[j]!=1)
				continue;
			if(j+i*100>f)
				continue;
			if(e*i<j)
				continue;
			if(j*100.0/(double)(i+j)>mx)
			{
		//		cout<<i<<j<<endl;
				tw=i;
				ts=j;
				mx=j*100.0/(double)(i+j);
			}
			
		}
	if(tw==0)
		tw=a;
	printf("%d %d\n",tw*100+ts,ts);
	return 0;
} 

Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    const a = arg.split("\n")[0].split(" ")[0];
    const b = arg.split("\n")[0].split(" ")[1];
    const c = arg.split("\n")[0].split(" ")[2];
    
    console.log(b - a == c - b ? "YES" : "NO");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

ll inf = 1000000000000000001;

int main(){
  int n;
  cin >> n;
  ll ans = 1;

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

  for(int i=0;i<n;i++){
    if(a[i] == 0){
      cout << '0' << endl;
      return 0;
    }
  }
  for(int i=0;i<n;i++){
      if(a[i] <= inf / ans && a[i]*ans <= 1000000000000000000){
        ans *= a[i];
      }
      else {
        ans = -1;
        break;
      }
  }

  
      cout << ans << endl;
}

Measured memory_bytes: 3976
#include <iostream>
#include <string>

using namespace std;

int main() {
    
    string S;
    cin >> S;

    int nCnt = 0;
    int nMax = 0;
    for (int i = 0; i < (int)S.size(); ++i) {
        char s = S[i];
        if (  s == 'A' 
            | s == 'T'
            | s == 'C'
            | s == 'G'
         ) {
             nCnt++;
        }
        else {
            if (nMax < nCnt) nMax = nCnt;
            nCnt = 0;
        }
    }

    if (nMax < nCnt) nMax = nCnt;

    cout << nMax << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

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

    int a, b;
    cin >> a >> b;
    int ans = 0;
    if (a % b != 0) ans = 1;
    cout << ans << endl;
}


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

int partition(int *, int, int);

int main(){
  int *A;
  int n, i, q;
  
  scanf("%d",&n);
  A = malloc(n * sizeof(int));
  for(i = 0; i < n; i++){
    scanf("%d",&A[i]);
  }
  q = partition(&A[0], 0, n - 1);

  for(i = 0; i < n; i++){
    if(i){
      printf(" ");
    }
    if(i == q){
      printf("[");
	}
    printf("%d",A[i]);
    if(i == q){
      printf("]");
    }
  }
  printf("\n");
  
  
  return 0;
}

int partition(int *A, int p, int r){
  int x, i, j, temp;
  x = A[r];
  i = p - 1;
  for(j = p; j < r; j++){
    if(A[j] <= x){
      i = i + 1;
      temp = A[i];
      A[i] = A[j];
      A[j] = temp;
    }
  }
  temp = A[i + 1];
  A[i + 1] = A[j];
  A[j] = temp;
  
  return i + 1;
}



Measured memory_bytes: 2104