akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}

int main(void){
  fast_io
  int n,k,s;
  cin>>n>>k>>s;
  rep(i,n){
    if(s == (int)1e9){
      if(i < k){
        cout<<s<<" ";
      }else{
        cout<<1<<" ";
      }
    }else{
      if(i < k){
        cout<<s<<" ";
      }else{
        cout<<(int)1e9<<endl;
      }
    }
  }
  cout<<endl;
  return 0;
}

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

#define ll long long int

using namespace std;

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

  if (a[0] > 0) {
    cout << -1;
    return 0;
  }

  ll ans = 0;
  ll count = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] - a[i - 1] > 1) {
      cout << -1;
      return 0;
    }
    else if (a[i] - a[i - 1] == 1) {
      count++;
    }
    else {
      ans += count;
      count = a[i];
    }
  }
  ans += count;
  cout << ans;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
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 ll INF = 1e18;


int main(){
    ll n;
    cin >> n;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    int zero,two,odd;
    rep(i,n){
        int now = a[i]%4;
        if(now==0)zero++;
        else if(now==2)two++;
        else odd++;
    }
    if(zero>=odd||(zero+1==odd&&two==0)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


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

using namespace std;
typedef long long ll;
const int N = 1e5 + 10;
int a[N];
int b[N];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < s.size(); i++) {
        a[i + 1] = (s[i] == 'A') ? 1 : 2;
        a[i + 1] += a[i];
    }
    for (int i = 0; i < t.size(); i++) {
        b[i + 1] = (t[i] == 'A') ? 1 : 2;
        b[i + 1] += b[i];
    }
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int u, v, w, p;
        cin >> u >> v >> w >> p;
        u--; w--;
        if ((a[v] - a[u]) % 3 == (b[p] - b[w]) % 3) {
            cout << "YES\n";
        } else {
            cout << "NO\n";
        }
    }
    return 0;
}


Measured memory_bytes: 1744
//I am so vegetable
//#define err
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = acos(-1.0);
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }


int main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
    #ifdef err
	double be = clock();
    #endif
    char a;cin>>a;
    if(islower(a))cout<<'a';
    else cout<<'A';
    #ifdef err
	double en = clock();
    cout<<"time: "<<fixed<<setprecision(8)<<en-be;
    #endif
	return 0;
}

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

string add_str(string str1, string str2){
  if(str1.size() > str2.size()) swap(str1, str2);
  while(str1.size() < str2.size()){
    str1 = '0'+str1;
  }
  //cout << "str_add" << endl;
  //cout << str1 << " " << str2 << endl;
  reverse(str1.begin(), str1.end());
  reverse(str2.begin(), str2.end());
  string ans;
  int kuriagari = 0;
  for(int i=0; i<str1.size(); ++i){
    int tmp1 = str1[i] - '0';
    int tmp2 = str2[i] - '0';
    int add = tmp1 + tmp2 + kuriagari;
    if(add > 9){
      add -= 10;
      kuriagari = 1;
    }else{
      kuriagari = 0;
    }
    ans = ans + (char)('0'+add);
  }
  if(kuriagari == 1){
    ans = ans + '1';
  }
  reverse(ans.begin(), ans.end());
  //cout << ans << endl;
  return ans;
}

string multi_char(string str, char c){
  int loop_num = c-'0';
  string ans;
  if(loop_num == 0) return ans;
  ans = str;
  for(int i=0; i<loop_num-1; ++i){
    ans = add_str(ans, str);
  }
  //cout << "Multi_char" << endl;
  //cout << str << " " << c << endl;
  //cout << ans << endl;
  return ans;
}

string multi_str(string str1, string str2){
  if(str1.size() > str2.size()) swap(str1, str2);
  string ans;
  string zeros;
  for(int i=str1.size()-1; i>=0; --i){
    string tmp = multi_char(str2, str1[i]);
    tmp = tmp + zeros;
    ans = add_str(ans, tmp);
    zeros = zeros + '0';
  }
  //cout << "multi_str" << endl;
  //cout << str1 << " " << str2 << endl;
  //cout << ans << endl;
  return ans;
}

int main(){
  string str;
  cin >> str;
  string mul = multi_str(str, str);
  mul = multi_str("3", mul);
  cout << mul << endl;
  return 0;
}

Measured memory_bytes: 256
s=int(input())
a=set()
a.add(s)
cnt = 1
while True:
    cnt += 1
    if s % 2 == 0:
        if s // 2 in a:
            print(cnt)
            exit()
        else:
            a.add(s // 2)
            s = s // 2
    else:
        if s * 3 + 1 in a:
            print(cnt)
            exit()
        else:
            a.add(s * 3 + 1)
            s = s * 3 + 1

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

int a[100005], b[100005];

int main(){

  int n, x, max = 0;
  scanf("%d", &n);
  for (int i=0; i<n; i++){
    scanf("%d", &a[i]);
    b[a[i]]++;
    b[a[i]+1]++;
    b[a[i]+2]++;
  }
  x = 0;
  for (int i=1; i <= 100005; i++)
    if(b[i] > max){
      max = b[i];
    }
  printf("%d\n", max);
}


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

using namespace std;

void print_num(vector<int> num, int len)
{
    for (int i = 0; i < len; i++)
    {
        if (i > 0)
        {
            cout << " ";
        }
        cout << num[i];
    }
    
    cout << endl;
}

int selection_sort(vector<int> &num, int len)
{
    int swap_cnt = 0;
    
    for (int i = 0; i < len; i++)
    {
        int min = i;
        for (int j = i; j < len; j++)
        {
            if (num[j] < num[min])
            {
                min = j;
            }
        }
        
        if (i != min)
        {
            swap(num[i], num[min]);
            swap_cnt++;
        }
    }
    
    return swap_cnt;
}

int main()
{
    int cnt = 0;
    int tmp = 0;
    int swap_cnt = 0;
    vector<int> num;
    
    cin >> cnt;
    for (int i = 0; i < cnt; i++)
    {
        cin >> tmp;
        num.push_back(tmp);
    }
    
    swap_cnt = selection_sort(num, cnt);
    
    print_num(num, cnt);
    cout << swap_cnt << endl;
    
    return 0;
}



Measured memory_bytes: 3164
#include<bits/stdc++.h>
#define rep(i,n) for(long long int i=0;i<n;i++)
#define lli long long int
#define ll long long 
#define dd double
#define endl "\n"
#define mod 1000000007
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define limit 1000000000000000000
const double pi=3.14159265358;

using namespace std;

int main()
{
	fast
	
	lli a[5],pos=0;
	for(int i=0;i<5;i++)
	{
		cin>>a[i];
		if(a[i]==0)
		pos=i+1;
	}
	cout<<pos<<endl;
}

Measured memory_bytes: 3616
#include<stdio.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

void run (void) {
  const i32 mod = 1000000007;
  i64 ans = 0;
  i64 way = 1;
  for (i32 c = getchar(); c == '0' || c == '1'; c = getchar()) {
    if (c == '1') {
      ans = (3 * ans + way) % mod;
      way = 2 * way % mod;
    } else {
      ans = 3 * ans % mod;
    }
  }
  ans = (ans + way) % mod;
  printf ("%" PRIi64 "\n", ans);
}

int main (void) {
  run();
  return 0;
}

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

#define ll long long

using namespace std;

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	if (k == n)
		return cout << 1 << endl, 0;
	int ind;
	for (int i = 0, a; i < n; i++) {
		cin >> a;
		if (a == 1)
			ind = i + 1;
	}
	int ans = n;
	for (int i = 0; i <= k; i++) {

		ans = min(ans,
				max(0, (ind - i - 1 + k - 2)) / (k - 1)
						+ max(0, (n - ind - (k - i - 1) + k - 2)) / (k - 1)
						+ 1);
	}

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



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <utility>
#include <vector>

using namespace std;

int main() {
    string t;
    cin >> t;
    for(int i = 0; i < t.size(); i++) {
        if(t[i] == '?') {
            t[i] = 'D';
        }
    }

    for(int i = 0; i < t.size(); i++) {
        cout << t[i] << "";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3488
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    double xp0, xp1, yp0, yp1, xp2, yp2, xp3, yp3;
    int q;
    int i;
    double s1x0, s1y0, s2x0, s2y0, s3x0, s3y0, s10, s20;
    double s1x1, s1y1, s2x1, s2y1, s3x1, s3y1, s11, s21;

    q = sc.nextInt();
    for(i = 0;i < q;i++){
      xp0 = sc.nextDouble();
      yp0 = sc.nextDouble();
      xp1 = sc.nextDouble();
      yp1 = sc.nextDouble();
      xp2 = sc.nextDouble();
      yp2 = sc.nextDouble();
      xp3 = sc.nextDouble();
      yp3 = sc.nextDouble();

      s1x0 = xp1 - xp0;
      s1y0 = yp1 - yp0;
      s2x0 = xp2 - xp0;
      s2y0 = yp2 - yp0;
      s3x0 = xp3 - xp0;
      s3y0 = yp3 - yp0;

      s10 = s1x0 * s2y0 - s1y0 * s2x0;
      s20 = s1x0 * s3y0 - s1y0 * s3x0;

      s1x1 = xp3 - xp2;
      s1y1 = yp3 - yp2;
      s2x1 = xp0 - xp2;
      s2y1 = yp0 - yp2;
      s3x1 = xp1 - xp2;
      s3y1 = yp1 - yp2;

      s11 = s1x1 * s2y1 - s1y1 * s2x1;
      s21 = s1x1 * s3y1 - s1y1 * s3x1;

      if(s10 * s20 > 0 || s11 * s21 > 0){
        System.out.println("0");  //no
      }else if(s10 == 0 && s20 == 0 &&
               (s1x0 * s2x0 < 0 || s1y0 * s2y0 < 0) &&
               (s1x0 * s3x0 < 0 || s1y0 * s3y0 < 0)
              ){
        System.out.println("0");  //no
      }else if(s20 == 0 && s21 == 0 &&
               (s1x1 * s2x1 < 0 || s1y1 * s2y1 < 0) &&
               (s1x1 * s3x1 < 0 || s1y1 * s3y1 < 0)
              ){
        System.out.println("0");  //no
      }else{
        System.out.println("1");  //yes
      }
    }

/*fin*/
    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

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

int main()
{
    int n, a[10000];
    int min = 1000000, max = -1000000;
    long sum = 0;
 
    cin >> n;
 
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        
        if (a[i] < min) {
            min = a[i];
        }
        if (a[i] > max) {
            max = a[i];
        }
        sum += a[i];
    }
 
    cout << min << " "
         << max << " "
         << sum << endl;
 
    return 0;
}

Measured memory_bytes: 3120
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int i, tmp;
    int[] count = new int[4];
    String s = sc.nextLine();
    for(i = 0;i < s.length();i++){
      if(s.charAt(i) == 'K')count[0]++;
      else if(s.charAt(i) == 'U')count[1]++;
      else if(s.charAt(i) == 'P')count[2]++;
      else if(s.charAt(i) == 'C')count[3]++;
    }
    for(i = 0;i < 3;i++)if(count[i] < count[i + 1]){
      tmp = count[i]; count[i] = count[i + 1]; count[i + 1] = tmp;
    }
    out.println(count[3]);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 26368
#include<iostream>
using namespace std;
int main(){
	int h,w,cnt=0;
	char a[52][52];
	cin>>h>>w;
	for(int i=0;i<h;i++){
		cin>>a[i];
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(a[i][j]=='#'){
				cout<<'#';
			}else{
				if(i==0){
					if(j==0){
						cnt+=(a[i+1][j]=='#');
						cnt+=(a[i][j+1]=='#');
						cnt+=(a[i+1][j+1]=='#');
					}else if(j==w-1){
						cnt+=(a[i+1][j]=='#');
						cnt+=(a[i][j-1]=='#');
						cnt+=(a[i+1][j-1]=='#');
					}else{
						cnt+=(a[i+1][j]=='#');
						cnt+=(a[i][j+1]=='#');
						cnt+=(a[i+1][j+1]=='#');
						cnt+=(a[i+1][j-1]=='#');
						cnt+=(a[i][j-1]=='#');
					}
				}else if(i==h-1){
					if(j==0){
						cnt+=(a[i-1][j]=='#');
						cnt+=(a[i][j+1]=='#');
						cnt+=(a[i-1][j+1]=='#');
					}else if(j==w-1){
						cnt+=(a[i-1][j]=='#');
						cnt+=(a[i][j-1]=='#');
						cnt+=(a[i-1][j-1]=='#');
					}else{
						cnt+=(a[i-1][j]=='#');
						cnt+=(a[i][j+1]=='#');
						cnt+=(a[i-1][j+1]=='#');
						cnt+=(a[i-1][j-1]=='#');
						cnt+=(a[i][j-1]=='#');
					}
				}else{
					if(j==0){
						cnt+=(a[i-1][j]=='#');
						cnt+=(a[i][j+1]=='#');
						cnt+=(a[i-1][j+1]=='#');
						cnt+=(a[i+1][j+1]=='#');
						cnt+=(a[i+1][j]=='#');
					}else if(j==w-1){
						cnt+=(a[i-1][j]=='#');
						cnt+=(a[i][j-1]=='#');
						cnt+=(a[i-1][j-1]=='#');
						cnt+=(a[i+1][j-1]=='#');
						cnt+=(a[i+1][j]=='#');
					}else{
						cnt+=(a[i-1][j-1]=='#');
						cnt+=(a[i-1][j]=='#');
						cnt+=(a[i-1][j+1]=='#');
						cnt+=(a[i][j-1]=='#');
						cnt+=(a[i][j+1]=='#');
						cnt+=(a[i+1][j-1]=='#');
						cnt+=(a[i+1][j]=='#');
						cnt+=(a[i+1][j+1]=='#');
					}
				}
				cout<<cnt;
				cnt=0;
			}
		}
		cout<<endl;
	} 
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>
#include<bitset>

//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const double PI = 3.1415926535897932;



int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;
	
	ll n, x, m;
	cin >> n >> x >> m;

	vector<ll> used(m + 1, 0);
	used[x]++;
	ll sum = 1;
	ll ans = 0;
	ll i=x;

	if (n <= 10000000)
	{
		for (int i = 0; i < n; i++)
		{
			ans += x;
			x = (x * x) % m;
		}
		cout << ans << endl;
		ret;
	}

	do
	{
		ans += i;
		used[i] = sum;
		i = (i * i) % m;
		sum++;
	} while (!used[i]);

	if (i == 0)
	{
		cout << ans << endl;
		ret;
	}

	ll res = 0;
	ll xx = i;
	ll j;
	for ( j = 0; j < sum - used[i]; j++)
	{
		res += xx;
		xx = (xx * xx) % m;
	}
	ans += ((n - (sum - 1)) / (sum - used[i])) * res;
	n -= sum - 1;
	n %= (sum - used[i]);

	for (int i = 0; i < n; i++)
	{
		ans += xx;
		xx = (xx * xx) % m;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3988
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define fi first
#define se second

ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum[ohara],pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>m;
    rep(i,m)cin>>a[i];
    sort(a,a+m);
    rep(i,m-1){
        sum[i]=abs(a[i]-a[i+1]);
    }
    sort(sum,sum+m-1);
    reverse(sum,sum+m-1);
    rrep(i,n-1,m-1)ans+=sum[i];
    Cout(ans);
    return 0;
}


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

int main(){

    int X;
    cin >> X;

    if(X >= 400 && X <= 599) cout << "8" << endl;
    if(X >= 600 && X <= 799) cout << "7" << endl;
    if(X >= 800 && X <= 999) cout << "6" << endl;
    if(X >= 1000 && X <= 1199) cout << "5" << endl;
    if(X >= 1200 && X <= 1399) cout << "4" << endl;
    if(X >= 1400 && X <= 1599) cout << "3" << endl;
    if(X >= 1600 && X <= 1799) cout << "2" << endl;
    if(X >= 1800 && X <= 1999) cout << "1" << endl;

    return 0;
}

Measured memory_bytes: 3632
h,w,k = map(int,input().split())
s = []
m = []
for i in range(h):
    tl = input()
    s.append(tl)
c = 0
f = 1
hhh = 1
for e,i in enumerate(s):
    if "#" in i:
        c+=1
        M = [0]*w 
        M[0] = c
        f = 1
        for E,j in enumerate(i):
            if E == 0:
                if j == '.':
                    f=0
                # print(2)
            elif j == '#':
                c+=f
                f = 1
            M[E]=c
        for i in range(hhh):m.append(M)
        hhh =1
    else:
        hhh+=1
for i in range(hhh-1):m.append(M)

for i in m:
    print(*i)

Measured memory_bytes: 7568
import java.io.*;
import java.util.*;
 
public class Main {
 
	void submit() {

        int H = nextInt();
        int N_SIZE = nextInt();        
        int N_sum = 0;
        
        for(int i=0; i<N_SIZE; i++){
            N_sum += nextInt();
        }
        
        if(N_sum>=H){
    	    out.println("Yes");
        }else{
    	    out.println("No");
        }
	}
 
	void preCalc() {
 
	}
 
	void stress() {
 
	}
 
	void test() {
 
	}
 
	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		preCalc();
		submit();
		//stress();
		//test();
		out.close();
	}
 
	static final Random rng = new Random();
 
	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}
 
	public static void main(String[] args) throws IOException {
		new Main();
	}
 
	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
 
	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}
 
	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
 
	int nextInt() {
		return Integer.parseInt(nextToken());
	}
 
	long nextLong() {
		return Long.parseLong(nextToken());
	}
 
	double nextDouble() {
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 32036
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
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 irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#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 rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -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 INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

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

signed main(void)
{
    ll w, h, x, y;
    cin >> w >> h >> x >> y;
    int r = 0;
    double area = 0.0;
    
    if (2*x == w && 2*y == h) r = 1;
    
        area = (double)h * w/2;
        printf ("%.10lf %d", area, r);
    
    
    
    
}

Measured memory_bytes: 3768
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  int answer=0;
  int max, mid, min;
  cin >> max;
  cin >> mid;
  cin >> min;
  int temp;
  while (max<mid||mid<min||max<min) {
    if (mid > max) {
      temp = max;
      max = mid;
      mid = temp;
    }

    if (min > max) {
      temp = max;
      max = min;
      min = temp;
    }

    if (min > mid) {
      temp = mid;
      mid = min;
      min = temp;
    }
  }

  if (max%2!=min%2&&max%2==mid%2) {
    answer++;
    max++;
    mid++;
  } else if (max%2!=mid%2&&min%2==max%2) {
    answer++;
    max++;
    min++;
  } else if (mid%2!=max%2&&min%2==mid%2) {
    answer++;
    mid++;
    min++;
  }

  while (min!=mid) {
    min += 2;
    answer++;
  }

  while (min!=max) {
    min++;
    answer++;
  }
  cout << answer << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

// refarence: https://atcoder.jp/contests/abc153/submissions/9741217
func solution(h int) int {
	if h == 0 {
		return 0
	}
	if h == 1 {
		return 1
	}
	return 1 + 2*solution(h/2)
}

func main() {
	var h int
	fmt.Scan(&h)
	fmt.Println(solution(h))
}


Measured memory_bytes: 512
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int n;
bool a[7][7];
int fn(int p,int q){
  int i;
  if(p==n){
    return 1;
  }else{
    for(i=0;i<7;i++){
      if(a[q][i]){
	a[q][i]=a[i][q]=0;
	if(fn(p+1,i))
	  return 1;
	a[q][i]=a[i][q]=1;
      }
    }
  }
  return 0;
}
int main(){
  int i;
  while(cin>>n){
    memset(a,0,7*7);
    for(i=0;i<n;i++){
      char s,t;
      cin>>s>>t;
      a[s-'0'][t-'0']=a[t-'0'][s-'0']=1;
    }
    for(i=0;i<7;i++){
      if(fn(0,i))
	break;
    }
    if(i==7)
      cout<<"No"<<endl;
    else
      cout<<"Yes"<<endl;
  }
  return 0;
}

Measured memory_bytes: 852
/**
 *    author:  tourist
 *    created: 19.12.2019 14:51:57       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int low = 1, high = n;
  while (low < high) {
    int mid = (low + high) >> 1;
    vector<pair<int, int>> st;
    bool ok = true;
    for (int i = 0; i < n; i++) {
      int diff = a[i] - (i == 0 ? 0 : a[i - 1]);
      if (diff > 0) {
        st.emplace_back(0, diff);
        continue;
      }
      while (diff < 0) {
        int take = min(st.back().second, -diff);
        diff += take;
        st.back().second -= take;
        if (st.back().second == 0) {
          st.pop_back();
        }
      }
      int k = 0;
      while (!st.empty() && st.back().first == mid - 1) {
        k += st.back().second;
        st.pop_back();
      }
      if (st.empty()) {
        ok = false;
        break;
      }
      int x = st.back().first;
      st.back().second -= 1;
      if (st.back().second == 0) {
        st.pop_back();
      }
      st.emplace_back(x + 1, 1);
      if (k > 0) {
        st.emplace_back(0, k);
      }
    }
    if (ok) {
      high = mid;
    } else {
      low = mid + 1;
    }
  }
  cout << low << '\n';
  return 0;
}


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

#define int long long int 


int32_t main()
{
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    reverse(a,a+n);
    int sum=0;
    for(int i=0;i<k;i++)
     sum+=a[i];
     cout<<sum<<endl;
}


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

int main() {
  string s;
  cin >> s;
  int A = 0;
  int Z = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == 'A') {
     A = i;
     break;
   }
  }
  for (int i = A; i < s.size(); i++) {
    if (s.at(i) == 'Z') {
      Z = i;
    }
  }
  cout << Z - A + 1 << endl;
}

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

using namespace std;

int
main(void){
	long long n, k; cin >> n >> k;
	vector<int> vec(n);
	for(int i = 0; i < n; i++){
		cin >> vec[i];
		vec[i]--;
	}
	vector<int> steps(n, -1);
	int cur = 0;
	int num = 0;
	int cyc = 0;
	while(true){
		if(steps[cur] != -1){
			cyc = cur;
			break;
		}
		steps[cur] = num++;
		cur = vec[cur];
	}
	if(steps[cyc] >= k){
		for(int i = 0; i < n; i++){
			if(steps[i] == k){
				cout << i + 1;
				return 0;
			}
		}
	}
	k -= steps[cyc];
	for(int i = 0; i < n; i++) steps[i] = -1;
	cur = cyc;
	num = 0;
	
	//for(int i = 0; i < n; i++) cout << steps[i] << " ";
	//cout << endl;
	while(true){
		if(steps[cur] != -1){
			cyc = cur;
			break;
		}
		steps[cur] = num++;
		cur = vec[cur];
		//cout << num << "...\n";
	}
	//for(int i = 0; i < n; i++) cout << steps[i] << " ";
	//cout << endl;
	//cout << num << ".." << endl;
	k = k%num;
	for(int i = 0; i < n; i++){
		if(steps[i] == k) cout << i + 1;
	}
}

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

using namespace std;
typedef long long ll;

#define INF (long long)(10e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

int main(void)
{
    string sd, t;
    cin >> sd >> t;
    int tl = t.size();
    int sdl = sd.size();
    
    for(int i = sdl - tl; i >=0; i--) {
        bool f = true;
        for(int j = 0; j < tl; j++) {
            if(sd[i+j] == '?' || sd[i+j] == t[j]) {
            } else {
                f = false;
            }
        }
        if(f) {
            REP(j, tl) {
                sd[i + j] = t[j];
            }
            REP(j, sdl) {
                if(sd[j] == '?') sd[j] = 'a';
            }
            cout << sd << endl;
            return 0;
        }
    }
    cout << "UNRESTORABLE" << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;
typedef long long ll;  /* 10^18 くらいまでいける */

int main(){
  ll n, m;  // n問, m回提出
  cin >> n >> m;

  map<ll, pair<bool, ll>> problems; // キー: 問題番号, 値: pair<ACしたか, WAした数>

  ll ac_count = 0;
  ll wa_count = 0;

  ll p;  // 問題番号
  string s;  // AC or WA
  rep(i, m){
    cin >> p >> s;

    if (problems[p].first){  // AC済み
      continue;
    }

    if (s == "AC"){  // 初AC
      problems[p].first = true;
      ac_count++;
      wa_count += problems[p].second;
    }else if (s == "WA"){  // 未ACでWA
      problems[p].second++;
    }
  }

  cout << ac_count << " " << wa_count << endl;


  return 0;
}

Measured memory_bytes: 6528
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
long long n,a[20][20],dp[(1<<17)];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			cin>>a[i][j];
	for(int i=0;i<(1<<n);i++)
		for(int j=1;j<=n;j++)//hong
			if(i&(1<<(j-1)))
			{
				dp[i]=dp[i^(1<<(j-1))];
				for(int k=1;k<=n;k++)//lie
					if(i&(1<<(k-1)))
						dp[i]+=a[k][j];
			}
	for(int i=0;i<(1<<n);i++)
		for(int j=i;j>0;j=((j-1)&i))
			dp[i]=max(dp[i],dp[j]+dp[i^j]);
	cout<<dp[(1<<n)-1];
	return 0;
}

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

int gcd(int x, int y) {
	if (x<=y) return gcd(y, x);
	if (x%y == 0) return y;
	else return gcd(y, x%y);
}

int main() {
	int p, q; cin >> p >> q;
	int r = q/gcd(p, q);
	int s = r;
	int res = 1;
	for (int i = 2; i*i <= r; ++i) {
		if (s%i == 0) {
			res *= i;
			while (s%i == 0) s /= i;
		}
	}
	res *= s;
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3104
n,m = map(int,raw_input().split())
h = map(int,raw_input().split())
q = [1] * (n+1)
q[0] = 0
for a in range(m):
  a,b = map(int,raw_input().split())
  if h[a-1]>h[b-1]:q[b] = 0
  if h[a-1]<h[b-1]:q[a] = 0
  if h[a-1]==h[b-1]:
    q[a]=0
    q[b]=0
print q.count(1)


Measured memory_bytes: 81900
from math import cos, radians

A, B, H, M = map(int, input().split())

one_minute = 360 / 60
one_hour = 360 / 12
one_hour_minute = one_hour / 60

long_needle = one_minute * M
short_needle = one_hour * H + one_hour_minute * M

theta = abs(long_needle-short_needle)
if theta > 180:
    theta = 360 - theta

theta = radians(theta)

ans = A**2 + B**2 - (2*A*B*cos(theta))

print(ans**0.5)


Measured memory_bytes: 9388
import collections
n = int(input())
s = [str(input()) for i in range(n)]

temp = collections.Counter(s)
temp = temp.most_common()

ans = []
num = temp[0][1]

for i,j in temp:
    if num == j:
        ans.append(i)
    else:
        break

print(*sorted(ans))


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

int main() {
	int a,b,c,kotae;
	cin >> a >> b >> c;
	for(int i = a; i<=b; i++){
		if(c % i == 0){
			kotae =kotae + 1;
		}
	}
	cout << kotae << endl;
	return 0;
}

Measured memory_bytes: 1164
import numpy as np
A = np.array([input().split() for _ in range(3)],np.int64).reshape(3,3)
N = int(input())
for i in range(N):
    b = int(input())
    A[A==b] = 0
    
if np.any(np.all(A==0,axis=0)) or np.any(np.all(A==0,axis=1)) or A[0][0] == A[1][1] == A[2][2] == 0 or A[2][0] == A[1][1] == A[0][2] == 0:
    print('Yes')
else:
    print('No')

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

int main() {
	set<string> prev;
	char endletter = 0;
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		string str;
		cin >> str;

		if (prev.count(str) > 0) {
			cout << "No" << endl;
			return 0;			
		}
		prev.insert(str);

		if (endletter != 0 && endletter != str.at(0)) {
			cout << "No" << endl;
			return 0;
		}
		endletter = str.at(str.length() - 1);
	}
	cout << "Yes" << endl;


	return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> pll;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(make_pair(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
    char ch;
    cin >> ch;
    printf("%c\n", ch + 1);
    return 0;
}

Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);



int main() {
    int n,m; cin >> n >> m;
    string s; cin >> s;

    int now = n;
    vector<int> ans;
    while(now != 0) {
        if(now <= m) {
            ans.push_back(now);
            break;
        }
        bool flag = true;
        for(int i=m; i > 0; i--) {
            if(s[now-i] == '0') {
                ans.push_back(i);
                now -= i;
                flag = false;
                break;
            }
        }
        if(flag) {
            cout << -1 << endl;
            return 0;
        }
    }

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


    return 0;
}



Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,max = 0,temp = 0,count = 0;
  cin >> N;
  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
    if(max < vec.at(i)){
      max = vec.at(i);
    }
  }
  
  while(true){
  for(int i = 0; i < N; i++){
    if(max > vec.at(i) && temp < vec.at(i)){
      temp = vec.at(i);
    }
  }
  if(temp != max){
    count++;
    max = temp;
    temp = 0;
  } else {
    break;
  }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
from itertools import accumulate

N, *A = map(int, open(0).read().split())

C = [0] * (N + 1)
D = [0] * (N + 1)
for a in A:
    C[a] += 1
    D[C[a]] += 1

T = [0] + [s // i for i, s in enumerate(accumulate(D[1:]), 1)]

ans = []
x = N
for k in range(1, N + 1):
    while 0 < x and T[x] < k:
        x -= 1
    ans.append(x)

print("\n".join(map(str, ans)))

Measured memory_bytes: 44444
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

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

long gcm(long a, long b) {
	return a * b / gcd(a, b);
}

int main() {
	long A, B, C, D;
	cin >> A >> B >> C >> D;
	long t = gcm(C, D);
	long ans = B / C - (A - 1) / C + B / D - (A - 1) / D - (B / t - (A - 1) / t);
	cout << B - A + 1 - ans;
}

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

int n, a[1010];

int dp[1010][1010];
int dp2[1010] = {};

int ok(int l, int r){
    int &res = dp[l][r];
    if(res != -1) return res;
    if((r-l) % 2 == 1) return res = false;
    res = false;
    if(l+0 == r) res = true;
    for(int i = l+2; i < r; i += 2) if(ok(l,i) && ok(i,r)) res = true;
    if(abs(a[l] - a[r-1]) <= 1 && ok(l+1, r-1)) res = true;
    return res;
}

int main(){
    while(cin >> n && n){
        rep(i, n) cin >> a[i];
        memset(dp, -1, sizeof dp);
        memset(dp2, 0, sizeof dp2);
        dp2[0] = 0;
        rep(i, n){
            dp2[i+1] = max(dp2[i+1], dp2[i]);
            for(int j = i + 2; j <= n; j += 2){
                if(ok(i, j)) dp2[j] = max(dp2[j], dp2[i] + j - i);
            }
        }
        cout << dp2[n] << endl;
    }
}

Measured memory_bytes: 7092
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >>S;
  int count =0;
  for (int i=0;i<S.size();i++){
    if(S.at(i)!=S.at(S.size()-i-1)){
      S.at(S.size()-i-1) = S.at(i);
      count ++;
    }
  }
  cout <<count<<endl;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

int main(void)
{
  ll a, b, c;
  cin >> a >> b >> c;

  if(a%2 == 0 || b%2 == 0 || c%2 == 0) {
    cout << 0 << endl;
  } else {
    ll ans = min(a*b, b*c);
    ans = min(ans, a*c);
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,m,k,a[10001],r,c,dir,ans[101][101];
int main() {
    cin>>n>>m>>k;
    for (int i=0; i<k; i++) cin>>a[i];
    r=1; c=0; dir=1;
    for (int i=0; i<k; i++) {
        for (int j=0; j<a[i]; j++) {
            if (dir==1) {
                if (c==m) {r++; dir=0;}
                else c++;
            }
            else {
                if (c==1) {r++; dir=1;}
                else c--;
            }
            ans[r][c]=i;
        }
    }
    for (int i=0; i<n; i++) {
        for (int j=0; j<m; j++) cout<<ans[i+1][j+1]+1<<' ';
        cout<<'\n';
    }
}

Measured memory_bytes: 3676
///not today

#include<bits/stdc++.h>
using namespace std;

#define SZ(x) (int)(x).size()
#define pb push_back
#define ll long long
#define xmax(x, y) (x) = max((x), (y))
#define xmin(x, y) (x) = min((x), (y))
#define F first
#define S second
#define pii pair<int, int>
#define pll pair<long long, long long>
#define int long long
#define pipii pair< int, pair<int, int> >
#define plpll pair< ll, pair<ll, ll> >

using namespace std;

const int maxn = 2000 + 5;
int l[maxn];

int32_t main(){
    int n;
    cin >>n;
    for(int i = 0; i < n; i ++)
        cin >>l[i];
    sort(l, l + n);
    int ans = 0;
    for(int i = 0 ; i < n - 2; i ++){
        for(int j = i + 1; j < n - 1; j ++){
            int sum = l[i] + l[j];
            int ind = lower_bound(l + j + 1, l + n, sum) - l;
            ind --;
            ans += ind - j;
        }
    }
    cout <<ans <<endl;
    return false;
}


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

int main(){
  int N;
  cin >> N;
  vector<string> w(N);
  for(int i = 0; i < N; ++i) cin >> w[i];
  
  map<string, int> m;
  m[w[0]]++;
  for(int i = 1; i < N; ++i){
    string s1, s2;
    s1 = w[i - 1];
    s2 = w[i];
    if(s1[s1.size() - 1] != s2[0]){
      cout << "No" << endl;
      return 0;
    }
    m[s2]++;
    if(2 <= m[s2]){
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
  return 0;
}

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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxN = 2e5 + 10;
const int inf = 1e9;

int n, ans = inf;
vector <pair <int, int>> d[4];
map <int, vector <int>> mp[4];
bool ok = 1;

void Try(int s, int t, bool flag)
{
    for (auto &p: mp[s])
    {
        if (mp[t].count(p.fi))
        {
            vector <int> &vec = mp[t][p.fi];
            for (auto &f: p.se)
            {
                auto it = upper_bound(all(vec), f);
                if (it != vec.end())
                {
                    ok = 0;
                    if (flag)
                    {
                        uin(ans, (*it - f) * 5);
                    }
                    else
                    {
                        uin(ans, (*it - f) * 10);
                    }
                }
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for1(i, n)
    {
        int x, y;
        char c;
        cin >> x >> y >> c;
        switch (c)
        {
        case 'U':
            d[0].eb(x, y);
            break;
        case 'R':
            d[1].eb(x, y);
            break;
        case 'D':
            d[2].eb(x, y);
            break;
        case 'L':
            d[3].eb(x, y);
            break;
        }
    }
    for0(i, 4)
    {
        for (auto &p: d[i])
        {
            if (i == 0 || i == 2)
            {
                mp[i][p.fi].eb(p.se);
            }
            else
            {
                mp[i][p.se].eb(p.fi);
            }
        }
        for (auto &p: mp[i])
        {
            sort(all(p.se));
        }
    }
    Try(0, 2, 1);
    Try(1, 3, 1);
    for0(i, 4)
    {
        mp[i].clear();
        for (auto &p: d[i])
        {
            mp[i][p.fi - p.se].eb(p.fi);
        }
        for (auto &p: mp[i])
        {
            sort(all(p.se));
        }
    }
    Try(0, 3, 0);
    Try(1, 2, 0);
    for0(i, 4)
    {
        mp[i].clear();
        for (auto &p: d[i])
        {
            mp[i][p.fi + p.se].eb(p.se);
        }
        for (auto &p: mp[i])
        {
            sort(all(p.se));
        }
    }
    Try(0, 1, 0);
    Try(3, 2, 0);
    if (ok)
    {
        cout << "SAFE";
    }
    else
    {
        cout << ans;
    }
    return 0;
}


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

public class Program
{
    public void Proc()
    {
        int inpt = int.Parse(Reader.ReadLine());
        int ans = inpt;

        for (int i = inpt; i <= 999; i++) {
            string t = i.ToString();
            if(t.Distinct().Count() == 1) {
                ans = i;
                break;
            }
        }

        Console.WriteLine(ans);
    }




    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"

750

";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 13396
while True:
    try:
        S = input()
    except EOFError:
        break
    while len(S) > 1:
        T = ''
        for i in range(0,len(S) - 1):
            x = int(S [i])
            y = int(S [i + 1])
            T += str((x + y) % 10)
        S,T = T,S
    print(S)

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

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

    int A, B, C, D;
    std::cin >> A >> B >> C >> D;

    int res = 0;
    for(int i=0;i<=200;++i){
        if(A <= i && i < B && C <= i && i < D){
            ++res;
        }
    }

    std::cout << res << std::endl;
}


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

int main()
{
	double l[10],v1,v2; char c;

	while(cin >> l[0])
	{
		double sl = l[0];
		for(int i=1; i<10; i++)
		{
			cin >> c >> l[i];
			sl += l[i];
		}

		cin >> c >> v1 >> c >> v2;


		double t = v1 / (v1+v2);

		double r = 0;
		for(int i=0; i<10; i++)
		{
			r += l[i];
			if(t < r/sl+1e-10)
			{
				cout << i+1 << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 0
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int A, B;
  string op;
  cin >> A >> op >> B;

  if (op == "+") {
    cout << A + B << endl;
  } else
    cout << A - B << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef vector<int> VI;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
constexpr auto INF = 1000000000;
constexpr auto LLINF = 9223372036854775807;
constexpr auto mod = 1000000007;

int w, h, c[50][50];
int dx[8] = { -1,0,1,-1,1,-1,0,1 }, dy[8] = { -1,-1,-1,0,0,1,1,1 };
void search(int x, int y) {
	if (x >= 0 && x < w && y >= 0 && y < h) {
		if (c[y][x] == 1) {
			c[y][x] = 0;
			FOR(k, 8)search(x + dx[k], y + dy[k]);
		}
	}
}

int main() {
	while (1) {
		cin >> w >> h;
		if (w == 0 && h == 0)break;
		FOR(i, h)FOR(j, w)cin >> c[i][j];
		int cnt = 0;
		FOR(i, h)FOR(j, w)if (c[i][j] == 1) {
			search(j, i);
			cnt++;
		}
		cout << cnt << endl;
	}
	

	return 0;
}


Measured memory_bytes: 3088