akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>

using namespace std;

int main(){
  int N,Alice=0,Bob=0;

  priority_queue<int> que;

  cin>>N;

  for(int i=0;i<N;i++){
    int temp;
    cin>>temp;
    que.push(temp);
  }

  for(int i=0;i<N;i++){
    if(i%2==0)Alice+=que.top();
    else Bob+=que.top();
    que.pop();
  }

  cout<<(Alice-Bob)<<endl;

  return 0;
}


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

int main () {
  string S;
  cin >> S;
  bool ans = false;
  for(int i = 0; i < S.size(); i++) {
    for(int j = 0; j < S.size(); j++) {
      if (i != j && S.at(i) == S.at(j)) {
        ans = true;
        break;
      }
    }
    if (ans) break;
  }
  if (ans) cout << "no" << endl;
  else cout << "yes" << endl;
}

Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll,ll>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n;
cin >> n;
vector<ll> ans;
while(n != 0){
    if(n % (-2) == -1){
        ans.emplace_back(1);
        n--;
    }else{
        ans.emplace_back(n % 2);
    }
    n /= -2;
}
if(ans.empty()) ans.emplace_back(0);
reverse(ans.begin(),ans.end());

rep(i,ans.size()){
    cout << ans[i];
}
cout << endl;
}

Measured memory_bytes: 3648
#include<iostream>
#include<stdio.h>
#include<ios>
#include<cmath>
#include<string>
#include<string.h>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<assert.h>
#include<bitset>
#include<tuple>
#include<climits>
#include<deque>
#include<utility>
#include<unordered_map>
#include<unordered_set>
#include<iterator>
#include<sstream>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define l     long
#define ll    long long
#define nitro ios_base::sync_with_stdio(false);cin.tie(0);
#define vi    vector<int>
#define pub   push_back
#define puf   push_front
#define pob   pop_back
#define pof   pop_front
#define PI    3.1415926535897932384626433
#define endl  '\n'
#define gap   ' '
int main()
{
    nitro
    int k,a,b;cin>>k>>a>>b;
    if(a%k==0 or b%k==0) cout<<"OK";
    else if(((a/k)+1)*k<=b) cout<<"OK";
    else cout<<"NG";
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <utility>
#include <functional>

using namespace std;

#define INF (1 << 30)

int main() {
	int n, m, ab[50][2], cd[50][2];

	cin >> n >> m;
	for (int i = 0; i < n; ++i)
		cin >> ab[i][0] >> ab[i][1];
	for (int i = 0; i < m; ++i)
		cin >> cd[i][0] >> cd[i][1];

	for (int i = 0; i < n; ++i) {
		pair<int, int> minp(INF, INF);
		for (int j = 0; j < m; ++j) {
			pair<int, int> t(abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]), j + 1);
			minp = min(minp, t);
		}
		cout << minp.second << endl;
	}

	return 0;
}

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

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

  vector<int> dp(n, INT_MAX);
  dp[0]=0;

  if(n>1) {
    dp[1] = abs(h[1]-h[0]);
  }

  for(int i=2;i<n;i++) {
    dp[i] = min(abs(h[i]-h[i-2])+dp[i-2], abs(h[i]-h[i-1])+dp[i-1]);
  }
  cout<< dp[n-1];
}


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

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

int field[12][12];
bool used[12][12];

void dfs(int y, int x) {
  if (y < 0 || y >= 12) return;
  if (x < 0 || x >= 12) return;
  if (used[y][x]) return;
  if (!field[y][x]) return;

  used[y][x] = true;
  for (int i=0; i<4; i++) {
    int newy = y + dy[i];
    int newx = x + dx[i];
    dfs(newy, newx);
  }
}

int main() {
  while (1) {
    for (int i=0; i<12; i++) {
      for (int j=0; j<12; j++) {
        if (scanf("%1d", &field[i][j]) != 1) return 0;
        used[i][j] = false;
      }
    }

    int ans = 0;
    for (int i=0; i<12; i++) {
      for (int j=0; j<12; j++) {
        if (!used[i][j] && field[i][j]) {
          ans++;
          dfs(i, j);
        }
      }
    }

    printf("%d\n", ans);
  }
}

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

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

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

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(){
    int n,k;cin >> n >> k;
    vi h(n);
    rep(i,n)cin >> h[i];
    vi dp(101000,MINF);
    dp[0] = 0;
    for(int i=0;i<n;i++){
        for(int j=1;j<=k;j++){
            if(j<n)chmin(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
def gcd(a,b)
  if b == 0
    a
  else
    gcd(b,a%b)
  end
end

def lcm(a,b)
  a*b/gcd(a,b)
end

n,m = gets.chomp.split(" ").map(&:to_i)
s = gets.chomp
t = gets.chomp
nm = gcd(n,m)
i = n/nm
j = m/nm
(nm+1).times do |k|
  if s[k*i] != t[k*j]
    puts "-1"
    exit
  end
end
puts lcm(n,m)

Measured memory_bytes: 14620
import sys
input = sys.stdin.readline

MOD = 1000000007
n, m = map(int, input().split())
hole = [0]*(n+1)

for i in range(m): hole[int(input())] = 1

dp = [0]*(n+1)
dp[0] = 1

for i in range(1, n+1):
    if hole[i]: dp[i] = 0
    else:
        dp[i] += dp[i-1] + dp[i-2]
        dp[i] %= MOD

print(dp[n])

Measured memory_bytes: 41692
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
using namespace std;
int n,a[12];
priority_queue<int> q;
int main()
{
	scanf("%d",&n);
	int t;
	for(register int i=1;i<=n;i++)
	{
		scanf("%d",&t);
		q.push(t);
	}
	for(register int i=1;i<=n;i++)
	{
		t=q.top();
		q.pop();
		a[i&1]+=t;
	}
	printf("%d",(a[1]-a[0]));
	putchar(10);
	return 0;
}

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

template <typename T>
struct LRPrique {
    using F = function<int(int)>;
    const F f;
    priority_queue<T> L;
    priority_queue<T, vector<T>, greater<>> R;
    int L_sz, R_sz;
    T L_sum, R_sum;
    // f(sz) -> size of L
    // e.g.) median : [](int sz) -> int { return (sz + 1) / 2; }
    LRPrique(F f)
        : f(f), L_sz(0), R_sz(0), L_sum(0), R_sum(0) {}
    void L_push(T x) {
        ++L_sz;
        L_sum += x;
        L.emplace(x);
    }
    void R_push(T x) {
        ++R_sz;
        R_sum += x;
        R.emplace(x);
    }
    T L_pop() {
        T ret = L.top();
        L.pop();
        --L_sz;
        L_sum -= ret;
        return ret;
    }
    T R_pop() {
        T ret = R.top();
        R.pop();
        --R_sz;
        R_sum -= ret;
        return ret;
    }
    void emplace(T x) {
        if (L.empty() or L.top() > x)
            L_push(x);
        else
            R_push(x);
    }
    void flatten() {
        int gL_sz = f(L_sz + R_sz);
        while (L.size() < gL_sz) {
            T tp = R_pop();
            L_push(tp);
        }
        while (L.size() > gL_sz) {
            T tp = L_pop();
            R_push(tp);
        }
    }
    T get() {
        flatten();
        return L.top();
    }
};

signed main() {

    // MedianPrique
    LRPrique<ll> lr([](int sz) -> int { return (sz + 1) / 2; });

    int Q;
    cin >> Q;
    ll margin = 0;

    while (Q--) {
        int T;
        cin >> T;
        if (T == 1) {
            int a, b;
            cin >> a >> b;
            lr.emplace(a);
            margin += b;
        } else {
            ll med = lr.get();
            ll mn  = margin + (lr.R_sum - med * lr.R_sz) + (med * lr.L_sz - lr.L_sum);
            cout << med << ' ' << mn << endl;
        }
    }
}


Measured memory_bytes: 6536
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

#define x first
#define y second
typedef pair<double,double> pdd;
typedef pair<int,int> pii;

const double EPS = 1e-9;

int H, R;
vector<pdd> h, w;
int U, M, S;
double du, dm, ds;
vector<pdd> u, m, s;

bool in(pdd house, pdd tree, pdd wind, double d) {
	pdd v;
	double dist;
	v = make_pair(house.x - tree.x, house.y - tree.y);
	dist = sqrt(v.x*v.x + v.y*v.y);
	if(dist > wind.y)
		return false;

	double theta;
	theta = atan2(v.y, v.x);
	double tmp = theta - M_PI*wind.x/180.0 + 4*M_PI;
	while(tmp - 2*M_PI >= -M_PI) tmp -= 2*M_PI;
	
	if(abs(tmp) > d*M_PI/180.0/2.0 + EPS)
		return false;

	return true;
}

void solve() {
	vector<pii> cnt;
	cnt.resize(H);
	for(int i = 0; i < cnt.size(); i++)
		cnt[i] = make_pair(0,-(i+1));

	for(int i = 0; i < h.size(); i++) {
		for(int j = 0; j < w.size(); j++) {
			bool fu, fm, fs;
			fu = fm = fs = false;
			for(int k = 0; k < u.size(); k++)
				fu |= in(h[i], u[k], w[j], du);

			for(int k = 0; k < m.size(); k++)
				fm |= in(h[i], m[k], w[j], dm);

			for(int k = 0; k < s.size(); k++)
				fs |= in(h[i], s[k], w[j], ds);

			if(!fu && !fm && !fs && in(h[i], make_pair(0.0, 0.0), w[j], du))
				cnt[i].x++;
		}
	}
	sort(cnt.rbegin(), cnt.rend());

	if(cnt[0].x == 0) {
		cout << "NA" << endl;
		return;
	}
	cout << -cnt[0].y;
	for(int i = 1; i < cnt.size() && cnt[i-1].x == cnt[i].x; i++)
		cout << " " << -cnt[i].y;
	cout << endl;
}

int main() {
	while(cin >> H >> R, H || R) {
		h.clear(); w.clear();
		u.clear(); m.clear(); s.clear();

		h.resize(H);
		for(int i = 0; i < H; i++)
			cin >> h[i].x >> h[i].y;
		cin >> U >> M >> S >> du >> dm >> ds;
		u.resize(U);
		for(int i = 0; i < U; i++)
			cin >> u[i].x >> u[i].y;

		m.resize(M);
		for(int i = 0; i < M; i++)
			cin >> m[i].x >> m[i].y;
		s.resize(S);
		for(int i = 0; i < S; i++)
			cin >> s[i].x >> s[i].y;
		w.resize(R);
		for(int i = 0; i < R; i++)
			cin >> w[i].x >> w[i].y;

		solve();
	}
}

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

int main() {
	int n, a, b, c, d,x,y;
	cin >> n >> a >> b >> c >> d;
	if (n%a > 0) {
		x = (n / a + 1)*b;
	}
	else {
		x = (n / a)*b;
	}
	if (n%c > 0) {
		y = (n / c + 1)*d;
	}
	else {
		y = (n / c)*d;
	}
	cout << min(x, y) << endl;
	return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;

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



Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,k,q;
  cin>>n>>k>>q;
  vector<int> s(n,0);
  vector<int> a(q);
  for(int i=0;i<q;i++){
    cin>>a[i];
    s[a[i]-1]++;
  }
  for(int i=0;i<n;i++){
    if(s[i]<=q-k){
      cout<<"No"<<endl;
    }else{
      cout<<"Yes"<<endl;
    }
  }
  return 0;
}

  
  


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

int main()
{
    int a,b,i,flag,c;
    c=0;
    scanf("%d %d",&a,&b);
    if(a>=1&&a<=9&&b>=1&&b<=9)
    {
        c=a*10+b;
    }
    if(a>=1&&a<=9&&b>=10&&b<=99)
    {
        c=a*100+b;
    }
    if(a>=1&&a<=9&&b==100)
    {
        c=a*1000+b;
    }
    if(a>=10&&a<=99&&b>=1&&b<=9)
    {
        c=a*10+b;
    }
    if(a>=10&&a<=99&&b>=10&&b<=99)
    {
        c=a*100+b;
    }
    if(a>=10&&a<=99&&b==100)
    {
        c=a*1000+b;
    }
    if(a==100&&b>=1&&b<=9)
    {
        c=a*10+b;
    }
    if(a==100&&b>=10&&b<=99)
    {
        c=a*100+b;
    }
    if(a==100&&b==100)
    {
        c=100100;
    }
    flag=0;
    for(i=1; i<=400; i++)
    {
        if((i*i)==c)
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
    {
        printf("Yes\n");
    }
    if(flag==0)
    {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
//
// Created by shiota on 2020/04/26.
//

#include<iostream>
#include<vector>
#include<map>
#include<algorithm>


using namespace std;

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

  int N = int(s.length());
  reverse(s.begin(), s.end());

  map<int, int> cnt;
  cnt[0]++;
  int sum= 0, ans = 0, base = 1;
  for(int i = 0; i<N; i++){
    sum += base * (s[i] - '0');
    sum %= 2019;
    base *= 10;
    base %= 2019;
    ans += cnt[sum];
    cnt[sum]++;
  }
  cout << ans <<endl;





}

Measured memory_bytes: 3356
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int N,L[1000],sum;
cin>>N;
  sum=0;
for(int i=0;i<N;i++){
  cin>>L[i];
}
  
sort(L,L+N);
  for(int i=0;i<N-1;i++){
    sum+=L[i];
  }
  
  if(sum>L[N-1]){
   cout<<"Yes"<<endl; 
  }
  
  else cout<<"No"<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

int main(void)
{
    int N, M;
    cin >> N >> M;

    vector<int> imos(N + 5, 0);
    for (int i = 0; i < M; i++) {
        int L, R;
        cin >> L >> R;

        imos[L]++;
        imos[R+1]--;
    }

    for (int i = 0; i < N + 4; i++)
        imos[i + 1] += imos[i];

    int cnt = 0;
    for (int i = 0; i < N + 5; i++)
        if (imos[i] == M)
            cnt++;

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main() {
    int32_t n, q;

    cin >> n;
    vector<int32_t> A(n);
    for (int32_t i = 0; i < n; i++) {
        cin >> A[i];
    }

    cin >> q;
    vector<int32_t> m(q);
    int32_t m_max = 0;
    for (int32_t i = 0; i < q; i++) {
        cin >> m[i];
        m_max = max(m_max, m[i]);
    }

    vector<bool> dp(m_max+1);
    fill(dp.begin(), dp.end(), false);
    dp[0] = true;

    for (int32_t i = 0; i < n; i++) {
        for (int32_t j = m_max; j >= 0; j--) {
            if (j - A[i] >= 0) {
                dp[j] = dp[j] || dp[j-A[i]];
            }
        }
    }

    for (int32_t i = 0; i < q; i++) {
        cout << (dp[m[i]] ? "yes" : "no") << endl;
    }

    return 0;
}

Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std ;
#define int long long
#define pb push_back
#define mp make_pair
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define sorta(v) stable_sort(v.begin(),v.end())
#define sortd(v) stable_sort(v.begin(),v.end(),greater <> ())
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define I(a) insert(a)
#define F first
#define S second
const int N=1e9+7;

int power(int x, int y){ 
    int res = 1; 
    while (y > 0){
        if (y & 1) 
            res = ((res) * (x));
        res %= N; 
        y = y >> 1; 
        x = ((x) * (x)); 
    }
    return res; 
}

int powmod(int a,int b,int n){
    int x=1, y=a; 
    while (b > 0) {
        if (b%2 == 1) {
            x = (x*y) % n;
        }
        y = (y*y) % n; 
        b /= 2;
    
    }
    return x % n;
}

int32_t main(){
    fastIO
    int t=1;
    //cin>>t;
    while(t--){
    	int n,w;
    	cin>>n>>w;
    	vector<int>weight(n,0),value(n,0);
    	for(int i=0;i<n;i++)
    	    cin>>weight[i]>>value[i];
    	vector<vector<int>>dp(n+1,vector<int>(w+1,0));
    	for(int i=1;i<=n;i++){
    	    for(int j=1;j<=w;j++){
    	        dp[i][j]=dp[i-1][j];
    	        if(weight[i - 1] <= j)
    	            dp[i][j] = max(value[i-1]+dp[i-1][j-weight[i-1]],dp[i][j]);
    	    }
    	}
    	cout<<dp[n][w]<<"\n";
    }
    return 0;
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=2e5+7;
int ok[maxn][2];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin>>n>>m;
    for(int i=0,u,v;i<m;i++)
    {
        cin>>u>>v;
        if(u==1) ok[v][0]=1;
        if(v==n) ok[u][1]=1;
    }
    for(int i=1;i<n;i++)
    {
        if(ok[i][0]&&ok[i][1])
        {
            cout<<"POSSIBLE\n";
            return 0;
        }
    }
    cout<<"IMPOSSIBLE\n";
}

Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>


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

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long MOD = 1'000'000'007LL;
const long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	
	ll N; cin >> N;
	ll res = 0;
	for (ll i = 0; i < N; i++) {
		ll x; cin >> x;
		res += x - i - 1;
	}
	cout << res << endl;
	return 0;

}



Measured memory_bytes: 3216
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

from collections import Counter

N = I()
A = LI()
sum = sum(A)
a = Counter(A)

Q = I()
for i in range(Q):
    b,c = LI()
    sum += a[b]*(c-b)
    print(sum)
    a[c] += a[b]
    a[b] = 0

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

#define FOR0(i,n) for (int i = 0; i < n; i++)
#define FOR(i,j, n) for (int i = j; i < n; i++)
// bool isEven(ll n) {return (n%2!=0)?false:true;};
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
// #define int ll

using namespace std;

//atcode abc 176
//A

int main(){
    ll n;
    cin>>n;
    ll res = 0;

    ll prev;
    ll curr;

    cin>>prev;

    if(n==1){
        cout<<0<<endl;
        return 0;
    }

    for (ll i = 1; i < n; ++i)
    {
        cin>>curr;
        if(curr<prev){
            res+=prev-curr;
            continue;
        }
        prev = curr;
    }
    cout<<res<<endl;
}

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


int dp[101][10010]={0};

void solve(){
	int n,w;
	cin>>n>>w;
	vector<pair<int,int>> v(n+1);
	for(int i=1;i<=n;i++){
		cin>>v[i].second>>v[i].first;

	}
	sort(v.begin(),v.end());
	for(int i=1;i<=n;++i){
//	cout<<v[i].first<<v[i].second<<endl;
		for(int j=0;j<=w;++j){
			if(j-v[i].first>=0){
				dp[i][j]=max(dp[i-1][j-v[i].first]+v[i].second,dp[i-1][j]);
			}else{
				dp[i][j]=dp[i-1][j];
			}
		}
	}

cout<<dp[n][w]<<endl;

}


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

Measured memory_bytes: 7000
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
    ll a, b, c, ans=false;
    cin >> a >> b >> c;
    for(int i = a; i <= a*b; i++){
        if(i*a % b == c){
            cout << "YES";
            return 0;
        }
    }
    cout << "NO";
}  

Measured memory_bytes: 256
def solve():
  ans = 0
  cnt = 0
  N, K = map(int, input().split())
  A = [list(map(int, input().split())) for _ in range(N)]
  A.sort()
  for a,b in A:
    cnt += b
    if cnt>=K:
      ans = a
      break
  return ans
print(solve())

Measured memory_bytes: 27512
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long int
#define phi 1.6180339
#define rep(i,n) for(auto i=0;i<(n);i++)
#define endl "\n"
#define For(i,a,b) for(auto i=(a);i<(b);i++)
#define op1 cin.tie(NULL)
#define op2 cout.tie(NULL)
#define op3 std::ios_base::sync_with_stdio(false)
#define MAXX 1000001
using namespace std;
vector<int> arr(MAXX);
void trozen()
{
    int n;cin>>n;
    int temp=n%1000;
    if(temp==0) cout<<0<<endl;else cout<<(1000-temp)<<endl;
}
int32_t main()
{
    op1;op2;op3;
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    trozen();
    return 0;
}


Measured memory_bytes: 11028
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;
int main()
{
    IOS
 	// freopen("input.txt","r",stdin);
 	// freopen("output.txt","w",stdout);
 	// freopen("error.txt","w",stderr);
    string s,t;
    cin>>s>>t;
    ll n=s.size();
    int ans=t.size();
    for(int i=0;i<n;i++)
    {
    	int cur=0;
    	if(n-1-i+1>=t.size())
    	{
    		for(int j=0;j<t.size();j++){
    			if(t[j]!=s[i+j])
    			{
    				++cur;
    			}
    		}
    		ans=min(ans,cur);
    	}
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
import sys
sys.setrecursionlimit(10**6)
N,M=map(int,input().split())
G=[set() for i in range(N)]
for i in range(M):
    x,y=map(int,input().split())
    G[x-1].add(y-1)
dp=[-1 for i in range(N)]
def search(k):
    if dp[k]!=-1:
        return dp[k]
    res=0
    for r in G[k]:
        if search(r)+1>res:
            res=search(r)+1
    dp[k]=res
    return res
for i in range(N):
    if dp[i]==-1:
        search(i)
print(max(dp))


Measured memory_bytes: 153036
#include<iostream>
#include<assert.h>
int main ()
  {
     long long int n;
      //std::string s;
      std::cin>>n ;//>> b >>c>>s;
     // d=a+b+c;
      long long int  k=1,m;
      //double m;
      for (long long int i=1; i<n+1;i++)
       {
           k=k*i;
           k=k%1000000007;
       }
      assert(k!=0);
      std::cout<<k/*1000000007*/<<std::endl; //<< " " << s <<std::endl;
 return 0;
  }

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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int x[10000];
	int i;
	for ( i = a; i <= b; i++) {
		x[i] = i;
	}
	int sum = 0;
	for (i = a; i <= b; i++) {
		if (c % x[i] == 0) sum++;
	}

	cout << sum<<endl;


	return 0;
}


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

int main(){
  bool f=true;
  ll N,ans=0;
  cin>>N;
  ll A[N];
  for(ll i=0;i<N;i++){
    cin>>A[i];
    if(i+1==A[i]) f=false;
  }
  if(f){
    cout<<ans<<endl;
    return 0;
  }
  for(ll i=0;i<N;i++){
    if(A[i]==i+1){
      if(i+1<N){
        swap(A[i],A[i+1]);
        ans++;
      }else{
        swap(A[i],A[i-1]);
        ans++;
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    int a,b;
    cin >> a >> b;
    cout << (a+b+1)/2 << endl;
}

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

int main(void){
  vector<int> a;
  int n,i,l;
  
  cin >> n;
  a = vector<int>(n);
  for (i=0; i<n; i++){
    cin >> a[i];
  }
  
  for (i=l=0;i<n && l!=1; i++){
    l = a[l]-1;
  }
  cout << (i==n?-1:i) << endl;
  return 0;
}

Measured memory_bytes: 640
# ABC111C - /\/\/\/
from collections import Counter

n = int(input())
lst = list(map(int, input().rstrip().split()))
even = Counter(lst[::2]).most_common(2)
odd = Counter(lst[1::2]).most_common(2)
ans = 0
if even[0][0] != odd[0][0]:
    print(n - even[0][1] - odd[0][1])
else:
    if len(even) == 1:
        print(n // 2)
    else:
        print(n - max(even[0][1] + odd[1][1], even[1][1] + odd[0][1]))


Measured memory_bytes: 15588
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        int S,h,m,s;
        Scanner sc=new Scanner(System.in);
        S=sc.nextInt();
        h=S/3600;
        S-=(h*3600);
        m=S/60;
        S-=(m*60);
        s=S;
        System.out.println(h+":"+m+":"+s);
    }
}


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

using namespace std;
using ll = long long;

int main() {

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

	int A, B; cin >> A >> B;

	if (A + B >= 10)cout << "error";
	else cout << A + B;

	return 0;

}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
#define REP(i,a,b) for(in i=(in)(a);i<(in)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const in inf=1e9+7;
using P=pair<in,in>;
vector<in> dx={0,1,-1,0};
vector<in> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in n,d;
    cin>>n>>d;
    vector<in> a(n);
    in x,y;
    rep(i,n){
        cin>>x>>y;
        a[i]=x*x+y*y;
    }
    sort(all(a));
    in cnt=0;
    rep(i,n){
        if(a[i]<=d*d) cnt ++;
        else break;
    }
    cout<<cnt<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 4756
a,b = map(int, input().split())
ans = [['.' for i in range(50)]+['#' for i in range(50)]for j in range(100)]

x,y = 0,51
while a>1:
    ans[x][y] = '.'
    y+=2
    if y>99:
        x+=2
        y=51
    a-=1

x,y = 0,0
while b>1:
    ans[x][y] = '#'
    y+=2
    if y>48:
        x+=2
        y=0
    b-=1

print(100,100)

for i in range(100):
    print(''.join(ans[i]))


Measured memory_bytes: 38640
import numpy as np
import math
A, B = map(int, input().split())

x_a = np.arange(math.ceil(12.5 * A), math.ceil(12.5 * (A + 1)))
x_b = np.arange(10 * B, 10 * (B + 1))

a_set = set(x_a)
b_set = set(x_b)
#aとbに共通するものを抽出
c_set = a_set & b_set
c = list(c_set)

if len(c) != 0:
    print(min(c))

else:
    print("-1")


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

char x[1010],y[1010];
int main()
{
	scanf("%s%s",x+1,y+1);
	int a = strlen(x+1);
	int b = strlen(y+1);
	
	int ans = 12345;
	for(int i=1;i<=a-b+1;i++)
	{
		int count = 0;
		for(int j=i;j<=i+b-1;j++)
		{
			if(x[j]!=y[j-i+1]) count++;
		}
		ans = ans<count?ans:count;
	}
	printf("%d",ans);
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
#define fori(x,a,b) for (int x=a;x<=b;x++)
#define int long long
using namespace std;
const int mod = 1e9+7;
int f[1010][1010];
int a[1010][1010];
 main()
{
    int h,w;
    cin>>h>>w;
    fori(i,1,h)
    {
        fori(j,1,w)
        {
            char ch;
            cin>>ch;
            if (ch=='#') a[i][j] = -1;
        }
    }

    f[1][1] = 1;
    fori(i,1,h)
    {
        fori(j,1,w)
        {
            if (a[i][j]==-1) f[i][j] = 0;
            else
            {
                if (a[i-1][j]==0 ) f[i][j]+=f[i-1][j];
                if (a[i][j-1]==0)  f[i][j]+=f[i][j-1];
            }
            if (f[i][j]>=mod) f[i][j]-=mod;
        }
    }
    cout<<f[h][w];
}


Measured memory_bytes: 16128
#include <iostream>
#include <fstream>
#include <cmath>

using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
typedef long long ll;
const ll INF = 1ll << 60;

int main()
{

    int k, x;
    cin >> k;
    cin >> x;

    int ans;
    int l = x - k + 1;
    int r = x + k - 1;
    for (int i = l; i <= r; ++i)
        cout << i << " ";
    return 0;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
count = 0

n.times.map{
  gets.chomp.split(' ').map(&:to_i)
}.each { |(d1, d2)|
  if(d1 == d2)
    count += 1
  else
    count = 0
  end

  if(count >= 3)
    puts "Yes"
    exit
  end
}

puts "No"


Measured memory_bytes: 14324
#include <bits/stdc++.h>
#include <numeric>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

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

    int H, W; cin >> H >> W;
    vector<string> grid(H+2);
    grid[0] = grid[H+1] = string(W+2, '#');
    rep(i, 1, H+1) {
        string in;
        cin >> in;
        grid[i] = "#" + in + "#";
    }
    vector<vector<int>> score(H+2, vector<int>(W+2, 0));

    rep(hi, 1, H+1) {
        int left = -1;
        rep(wi, 1, W+1) {
            if (grid[hi][wi-1] == '#' and grid[hi][wi] == '.') left = wi;
            if (grid[hi][wi] == '.' and grid[hi][wi+1] == '#') {
                int scr = wi-left+1;
                rep(wj, left, wi+1) {
                    score[hi][wj] += scr;
                }
            }
        }
    }

    rep(wi, 1, W+1) {
        int top = -1;
        rep(hi, 1, H+1) {
            if (grid[hi-1][wi] == '#' and grid[hi][wi] == '.') top = hi;
            if (grid[hi][wi] == '.' and grid[hi+1][wi] == '#') {
                int scr = hi-top+1;
                rep(hj, top, hi+1) {
                    score[hj][wi] += scr;
                }
            }
        }
    }
/*
    rep(hi, 0, H+2) {
        rep(wi, 0, W+2) {
            printf("%d ", score[hi][wi]);
        }
        printf("\n");
    }
*/

    int res = 0;
    rep(hi, 1, H+1) {
        rep(wi, 1, W+1) {
            res = max(res, score[hi][wi]);
        }
    }

    cout << max(0, res-1) << endl;
}

Measured memory_bytes: 23936
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m,x;
  cin >> n >> m >> x;
  vector<vector<int>> text(n,vector<int>(m+1));
  for(int i=0;i<n;i++){
    cin >> text.at(i).at(m);
    for(int j=0;j<m;j++){
      cin >> text.at(i).at(j);
    }
  }
  
  int ans=1200001;
  for(int i=0;i<(1<<n);i++){
    int count=0;
    vector<int> learn(m);
    for(int j=0;j<n;j++){
      if((i>>j)&1){
        count+=text.at(j).at(m);
        for(int k=0;k<m;k++){
          learn.at(k)+=text.at(j).at(k);
        }
      }
    }
    bool flag=true;
    for(int j=0;j<m;j++){
      if(learn.at(j)<x){
        flag=false;
        break;
      }
    }
    if(flag)	ans=min(ans,count);
  }
  if(ans==1200001)	ans=-1;
  cout << ans;
}

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

int main() {
	int n; cin>>n;
	int s=0;
	vector<int> a(n+2,0);
	for (int i=0; i<=n; i++) {
		if (i<n)
			cin>>a[i+1];
		s+=abs(a[i+1]-a[i]);
	}
	for (int i=0; i<n; i++)
		cout<<(s-abs(a[i+1]-a[i])-abs(a[i+2]-a[i+1])+abs(a[i+2]-a[i]))<<endl;
	return 0;
}

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

void Nor(int* di){
    int j;
    j=di[0];
    di[0]=di[1];
    di[1]=di[5];
    di[5]=di[4];
    di[4]=j;
}
void Eas(int* di){
    int j;
    j=di[0];
    di[0]=di[3];
    di[3]=di[5];
    di[5]=di[2];
    di[2]=j;
}

void Rol(int* di){
    int j;
    j=di[1];
    di[1]=di[3];
    di[3]=di[4];
    di[4]=di[2];
    di[2]=j;
}
 int main(){
    int di1[6],di2[6];
    int i,j,k,l,m,n;
    for (n=0;n<6;n++){
        cin>>di1[n];
    }
    for (n=0;n<6;n++){
        cin>>di2[n];
    }
    i=0;
    k=0;
    while(true){
        
        if(di1[0]==di2[0]){
            for(l=0;l<5;l++){
                if(di1[1]==di2[1]){
                    if(di1[2]==di2[2] and di1[3]==di2[3] and di1[4]==di2[4] and di1[5]==di2[5]){
                        k=1;
                        break;
                    }else{
                     
                        break;
                    }
                    
                }
                if(l==4){
                    return 0;
                }
                Rol(di2);
            }
        }
        if(i==4){
            Rol(di2);
        }
        i+=1;
        if(i==9){
            break;
        }
        Nor(di2);
    }
    if(k==1){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
 }


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

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

int main()
{
    int n; cin >> n;
    ll X; cin >> X;
    vector<ll> x(n);
    for (int i = 0; i < n; i++) {
        int y; cin >> y; 
        x[i] = abs(y - X);
    }

    ll ans = x[0];
    for (int i = 1; i < n; i++) {
        ans = gcd(ans, x[i]);
    }
    cout << ans << endl;
    return 0;
}

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

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

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

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

int main() {
    ll n, x, m;
    cin >> n >> x >> m;
    
    ll v = x, y;
    vector<bool> b(m, false);
    while (1) {
        if (b[v]) {
            y = v;
            break;
        }
        b[v] = true;
        v = (v*v) % m;
    }
    
    v = x;
    ll d1 = 0, s1 = 0;
    while (1) {
        if (v == y) {
            break;
        }
        d1++;
        s1 += v;
        v = (v*v) % m;
    }
    
    v = y;
    ll d2 = 0, s2 = 0;
    while (1) {
        d2++;
        s2 += v;
        v = (v*v) % m;
        if (v == y) break;
    }
    
    ll d3 = max(0LL, (n - d1) % d2), s3 = 0;
    v = y;
    rep (i, d3) {
        s3 += v;
        v = (v*v) % m;
    }
    //cout << "d:" << d1 << ", " << d2 << ", " << d3 << endl;
    //cout << "s:" << s1 << ", " << s2 << ", " << s3 << endl;
    ll ans = s1 + s2 * max(0LL, (n - d1) / d2) + s3;
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3604
//encoding:utf-8
//#include <iostream> //c++
//#include<stack> //スタックに関して　最新のデータから捨てる
//#include<queue> //キューに関して　最古のデータから捨てる
//#include<math.h>
//#include<vector>
//#include<algorithm> //sort とかにいる
#include<bits/stdc++.h>//vector,algorithm,que
#include<time.h> //時間にかんして

#define ll long long
#define MOD 1000000007
#define INF (1<<29)
using namespace std;
int main(){
int N;
cin>>N;
vector<ll> a(N);
ll tmp;
for(int i=0;i<N;i++){
  cin>>a[i];
}
int cnt_4=0,cnt_2=0,cnt_0=0;
for(int i=0;i<N;i++){
  if(a[i]%4==0){
    cnt_4+=1;
  }
  else if(a[i]%2==0){
    cnt_2 += 1;
  }
  else{cnt_0+=1;
  }
}
string ans="No";
if(cnt_0==0){
  if(cnt_2 > 1 || cnt_4 > 0) ans = "Yes";
}
else{
  if (cnt_2 % 2 == 0 && cnt_4+1 >= cnt_0) ans="Yes";
  else if (cnt_2 % 2 == 1 && cnt_4 >= cnt_0) ans = "Yes";
}
cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
function main(input) {
  const args = input.split(' ');
  const n = parseInt(args[0], 10);
  const a = parseInt(args[1], 10);
  const b = parseInt(args[2], 10);
  console.log(Math.min(n*a,b));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author ogiekako
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		MyScanner in = new MyScanner(inputStream);
		MyPrintWriter out = new MyPrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, MyScanner in, MyPrintWriter out) {
        long[] A = new long[]{in.nextInt(), in.nextInt(), in.nextInt()};
        Arrays.sort(A);
        if (A[0]%2 ==0 || A[1]%2==0 || A[2]%2==0) {
            out.println(0);
            return;
        }
        out.println(A[0] * A[1]);
    }
}

class MyScanner {
    private final InputStream in;

    public MyScanner(InputStream in) {
        this.in = in;
    }

    private static final int BUFSIZE = 65536;
    int bufLen;
    int bufPtr;
    byte[] buf = new byte[BUFSIZE];

    public int read() {
        if (bufLen == -1)
            throw new InputMismatchException();
        if (bufPtr >= bufLen) {
            bufPtr = 0;
            try {
                bufLen = in.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (bufLen <= 0)
                return -1;
        }
        return buf[bufPtr++];
    }

    public int nextInt() {
        int c = read();
        if (c == -1) throw new NoSuchElementException();
        while (c != '-' && (c < '0' || '9' < c)) {
            c = read();
            if (c == -1) throw new NoSuchElementException();
        }
        if (c == '-') return -nextInt();
        int res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while ('0' <= c && c <= '9');
        return res;
    }

}

class MyPrintWriter {
    PrintWriter out;

    public MyPrintWriter(OutputStream outputStream) {
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public void println(int a) {
        out.println(a);
    }

    public void println(Object... os) {
        if (os.length == 0) {
            out.println();
            return;
        }
        for (int i = 0; i < os.length - 1; i++) {
            out.print(os[i]);
            out.print(' ');
        }
        out.println(os[os.length - 1]);
    }

    public void close() {
        out.close();
    }

}



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

int main() {
    string s;
    cin>>s;
    int cnt=0;
    for(int i=0;i<s.size();i++){
        if(s.at(i)=='S'){
            cnt++;
        }
        else{
            int x=cnt;
            x--;
            cnt=max(0,x);
        }
    }
    cout<<2*cnt<<endl;
    return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static void Main() {
        var nk = ReadInts();
        int n = nk[0], k = nk[1];

        var ans = k * Math.Pow(k - 1, n - 1);
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 3032
#include<stdio.h>
int main()
{
	int a,s[10]={},b;
	scanf("%d",&a);
	while(a!=0){
	for(int i=0;i<a;i++){
		scanf("%d",&b);
		s[b]++;
	}
	for(int i=0;i<10;i++){
		for(int j=0;j<s[i];j++){
			printf("*");
		}
		if(s[i]==0)
			printf("-");
		printf("\n");
	}
	for(int i=0;i<10;i++){
		s[i]=0;
	}
	scanf("%d",&a);
	}
	return 0;
}

Measured memory_bytes: 1000
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N, K;
  cin >> N >> K;
  map<long, long> mp;
  rep (i, N) {
    long a, b;
    cin >> a >> b;
    mp[a] += b;
  }
  for (auto it: mp) {
    K -= it.second;
    if (K <= 0) {
      cout << it.first << endl;
      return;
    }
  }
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 4224
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        System.out.println(Math.max(0, a-b*2));
        
    }

    private static char[] rotateArray(char[] c, int d){
        char[] newc = new char[c.length];
        for(int i=0;i<c.length;i++){
            newc[(i+d)%c.length] = c[i];
        }
        return newc;
    }
    
    private static void sort(int[] d, int left, int right){
        if(left>=right){return;}
        int p = d[(left+right)/2];
        int l=left, r=right;
        int tmp;
        while(l<=r){
            while(d[l]<p){l++;}
            while(d[r]>p){r--;}
            if(l<=r){
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            }
        }
        sort(d, left, r);
        sort(d, l, right);
    }
}

Measured memory_bytes: 22996
function Main(arg){
    arg=arg.trim().split('\n');
    var n=Number(arg.shift());
    var a=arg[0].split(' ').map(str=>parseInt(str,10));
    const b=arg[1].split(' ').map(str=>parseInt(str,10));
    const c=arg[2].split(' ').map(str=>parseInt(str,10));
    var ans=0;

    for(var i=0;i<n;i++){
        ans+=b[a[i]-1];
        if(a[i]+1==a[i+1]){
            ans+=c[a[i]-1];
        }
    }
    console.log(ans)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST
{
    static void Main()
    {
        Sol mySol = new Sol();
        mySol.Solve();
    }
}

class Sol
{

    public Sol()
    {
        arr = rla(' ');

        for (int i = 1; i < 3; i++) {
            for (int j = 0; j < i; j++) {
                if (MAX == 0) { MAX = arr[i] + arr[j]; }
                else
                {
                    MAX = arr[i] + arr[j] < MAX ? arr[i] + arr[j] : MAX;
                }
            }
        }

        Console.WriteLine(MAX);
    }

    public void Solve()
    {

    }
    static long[] arr;
    static long MAX = 0;
    static String rs() { return Console.ReadLine(); }
    static int ri() { return int.Parse(Console.ReadLine()); }
    static long rl() { return long.Parse(Console.ReadLine()); }
    static double rd() { return double.Parse(Console.ReadLine()); }
    static String[] rsa(char sep = ' ') { return Console.ReadLine().Split(sep); }
    static int[] ria(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
    static long[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
    static double[] rda(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
}

Measured memory_bytes: 11220
import bisect

a,b,n=map(int,input().split())
l1=[int(input()) for i in range(a)]
l2=[int(input()) for i in range(b)]
x=[int(input()) for i in range(n)]
l1.sort()
l2.sort()
for i in range(n):
    idx1=bisect.bisect_left(l1,x[i])
    if idx1<a:
        p=abs(l1[idx1-1]-x[i])
        q=abs(l1[idx1]-x[i])
        for j in range(2):
            if j==0:
                po=l1[idx1-1]
                idx3=bisect.bisect_left(l2,po)
                if idx3<b:
                    dis=min(abs(l2[idx3-1]-po),abs(l2[idx3]-po))
                else:
                    dis=po-l2[-1]
                dis1=p+dis
            else:
                po=l1[idx1]
                idx3=bisect.bisect_left(l2,po)
                if idx3<b:
                    dis=min(abs(l2[idx3-1]-po),abs(l2[idx3]-po))
                else:
                    dis=po-l2[-1]
                dis1=min(dis1,q+dis)
    else:
        p=x[i]-l1[-1]
        po=l1[-1]
        idx3=bisect.bisect_left(l2,po)
        if idx3<b:
            dis=min(abs(l2[idx3-1]-po),abs(l2[idx3]-po))
            dis1=dis+p
        else:
            dis1=po-l2[-1]+p
    idx2=bisect.bisect_left(l2,x[i])
    if idx2<b:
        p=abs(l2[idx2-1]-x[i])
        q=abs(l2[idx2]-x[i])
        for j in range(2):
            if j==0:
                po=l2[idx2-1]
                idx3=bisect.bisect_left(l1,po)
                if idx3<a:
                    dis=min(abs(l1[idx3-1]-po),abs(l1[idx3]-po))
                else:
                    dis=po-l1[-1]
                dis2=p+dis
            else:
                po=l2[idx2]
                idx3=bisect.bisect_left(l1,po)
                if idx3<a:
                    dis=min(abs(l1[idx3-1]-po),abs(l1[idx3]-po))
                else:
                    dis=po-l1[-1]
                dis2=min(dis2,q+dis)
    else:
        p=x[i]-l2[-1]
        po=l2[-1]
        idx3=bisect.bisect_left(l1,po)
        if idx3<a:
            dis=min(abs(l1[idx3-1]-po),abs(l1[idx3]-po))
            dis2=dis+p
        else:
            dis2=po-l1[-1]+p
    print(min(dis1,dis2))

Measured memory_bytes: 16196