akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
int n,p[1005],a[1005][1005],ans,sum;
vector<pii > pr,pp;
int main()
{
    scanf("%d",&n);
    rep(i,1,n) rap(j,1,n) scanf("%d",&a[i][j]);
    rep(i,1,n) p[i]=1;
    rep(i,1,n) {
        int to=a[i][1];
        if(to>i&&a[to][1]==i) pr.pb(mpr(i,to));
    }
    sum=n*(n-1)/2;
    while(sum!=0){
        ans++;
        rap(i,0,pr.size()){
            sum--;
            int x=pr[i].fi,y=pr[i].se;
            p[x]++;p[y]++;
            if(p[x]!=n)
            {
                int to=a[x][p[x]];
                if(a[to][p[to]]==x) pp.pb(mpr(x,to));
            }
            if(p[y]!=n)
            {
                int to=a[y][p[y]];
                if(a[to][p[to]]==y) pp.pb(mpr(y,to));
            }
        }
        pr.clear();
        if(pp.size()==0&&sum!=0) {printf("-1");return 0;}
        while(!pp.empty()) pr.pb(pp.back()),pp.pop_back();
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;
ll ans = 1;
ll N;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    vector<l_l> a(2 * N);
    for(int i = 0; i < 2 * N; i++) {
        cin >> a[i].first;
        a[i].second = i / N;
    }
    sort(a.begin(), a.end());
    ll aleft = 0;
    ll bleft = 0;
    for(auto now : a) {
        if(now.second == 0) {
            if(bleft > 0) {
                ans *= bleft;
                ans %= mod;
                bleft--;
            } else {
                aleft++;
            }
        } else {
            if(aleft > 0) {
                ans *= aleft;
                ans %= mod;
                aleft--;
            } else {
                bleft++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
 
long long gcd(long x,long y){
    if(y==0)return x;

    return gcd(y,x%y);
}
long long lcm(long x,long y){
    return x*y/gcd(x,y);
}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main()
{
    long long ans=0,N,B[110]={};
    cin>>N;

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

    for(int i=0;i<N;i++){
        ans+=min(B[i],B[i+1]);
    }

    ans+=B[N-1];

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
long long int a,s,d[1000][1000],f[1000],g[1000],h,i,j;
int main(void)
{
	scanf("%d %d",&a,&s);
	for(i=0;i<a;i++){
		for(j=0;j<s;j++){
			scanf("%d",&d[i][j]);
		}
	}
	for(i=0;i<s;i++)
		scanf("%d",&f[i]);
		for(i=0;i<a;i++){
			for(j=0;j<s;j++){
			g[i]=g[i]+f[j]*d[i][j];
//			printf("                     %d %d %d %d\n",g[i],f[j],d[i][j],f[j]*d[i][j]);
		}
	}
	for(i=0;i<a;i++)
		printf("%d\n",g[i]);
	return 0;
}

Measured memory_bytes: 3080
S=list(input())
L=len(S)
for i in range(L):
    if S[i] != S[L-i-1] :
        print("No")
        exit()
for n in range(int((L-1)/2)):
    if  S[n] != S [int((L-1)/2)-n-1]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <numeric>
#include <tuple>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <limits>
#include <unordered_map>
#include <type_traits>
#include <map>
#include <cstdio>
#include <string>

using namespace std;
using str = string;

#define rep(a,l,r) for(int a=(l);a<(r);a++)
#define get cin>>
#define put cout<<

int gcd_euclid(int u, int v) {
  int r;
  while (0 != v) {
    r = u % v; u = v; v = r; /* swap */
  }
  return u;
}

// 最大公約数算出
int calc_gcd(const vector<int> vec){
	int gcd = *min_element(vec.begin(), vec.end());
	for (const int ele: vec){
		gcd = gcd_euclid(gcd,ele);
	}
	return gcd;
}

// 最小公倍数
int calc_lcm(const vector<int> vec) {
	int tmp = 1;
	for (const int ele: vec){
		tmp *= ele;
	}
	int gcd = calc_gcd(vec);
	return tmp/gcd;
}

std::string join(const std::vector<std::string>& v, const char* delim = 0) {
  std::string s;
  if (!v.empty()) {
    s += v[0];
    for (decltype(v.size()) i = 1, c = v.size(); i < c; ++i) {
      if (delim) s += delim;
      s += v[i];
    }
  }
  return s;
}

// nが奇数、偶数の場合の場合分け
// n & 1 ? odd : even

// distinctはsortしてunique + erase
// https://qiita.com/ysk24ok/items/30ae72f4f1060b088588
//sort(vec.begin(), vec.end());
//vec.erase(unique(vec.begin(), vec.end()), vec.end());

void run() {

	int a,b,c;
	get a >> b >>c;

	put min({(a+b),(b+c),(a+c)});
}


int main() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);run();return 0;}


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

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

    int a;
    int b;

    cin >> a >> b;
    if ((a * b) % 2 == 1) {
      cout << "Odd" << endl;
    } else {
      cout << "Even" << endl;
    }

    return 0;
}

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


using namespace std;


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

  sort(A,A+N);
  long long int ans=0;
  if(N%2){
    if(A[N/2]*2-A[N/2-1]-A[N/2+1]>=0){
        for(int i=N-1;i>=N/2+2;i--){
          ans+=A[i]*2;
        }
        ans+=A[N/2]+A[N/2+1];
        for(int i=N/2-1;i>=0;i--){
          ans-=A[i]*2;
        }
      }
     else{
       for(int i=N-1;i>N/2;i--){ 
        ans+=A[i]*2;
      }
      ans-=A[N/2]+A[N/2-1];
      for(int i=N/2-2;i>=0;i--){
        ans-=A[i]*2;
      }
    }
  }
  else{
    for(int i=N-1;i>=N/2+1;i--){
    ans+=A[i]*2;
    }
    for(int i=0;i<=N/2-2;i++){
      ans-=A[i]*2;
    }
    ans+=A[N/2]-A[N/2-1];
  }

  
  
  
  
  
  
  
  
  
  
  
  cout<<ans;
  return 0;
}










Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>

using namespace std;

int main ()
{
    int n, c_sum[300010], c, cost=999999999;
    memset(c_sum, 0, sizeof(c_sum));
    string s;
    cin>>n>>s;
    if (s[0]=='E') c_sum[0]=1;
    for (int i=1; i<n; i++)
    {
        if (s[i]=='E') c_sum[i]=c_sum[i-1]+1;
        else c_sum[i]=c_sum[i-1];
    }
    for (int i=0; i<n; i++)
    {
        c=0;
        if (i>0) c=i-c_sum[i-1];
        c+=c_sum[n-1]-c_sum[i];
        cost=min(cost, c);
    }
    cout<<cost<<'\n';
    return 0;
}


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

int main(){
    int N,M;
    cin>>N>>M;
    int x=N*(N-1)/2+M*(M-1)/2;
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=3.1415926535897932384626433832795;
const ll INF = 1LL<<62;
const ll MINF = -1LL<<62;

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)


int main() {
	IO;
	int x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	vector<int> p(a), q(b), r(c);
	for(int i=0;i<a;++i) cin>>p[i];
	for(int i=0;i<b;++i) cin>>q[i];
	for(int i=0;i<c;++i) cin>>r[i];

	sort(p.begin(), p.end());
	reverse(p.begin(),p.end());
	p.resize(x);

	sort(q.begin(), q.end());
	reverse(q.begin(),q.end());
	q.resize(y);
	
	ll ans=0;
	for(auto i:p) ans+=i;
	for(auto i:q) ans+=i;

	sort(r.begin(), r.end());
	
	auto add=[&](vector<int>& from) {
		assert(!from.empty());
		assert(r.back()>from.back());
		ans+=r.back()-from.back();
		r.pop_back();
		from.pop_back();
	};
	
	while(!r.empty()) {
		if(!p.empty() && !q.empty()) {
			int val=min(p.back(), q.back());
			if(val>=r.back()) {
				break ;
			}
			
			if(p.back()<q.back()) {
				add(p);
				continue ;
			}else {
				add(q);
				continue ;
			}
		}else if(p.empty() && !q.empty()) {
			if(q.back()>=r.back()) {
				break ;
			}else {
				add(q);
				continue ;
			}
		}else if(!p.empty() && q.empty()) {
			if(p.back()>=r.back()) {
				break ;
			}else {
				add(p);
				continue ;
			}
		}else break ;
	}
	
	cout<<ans<<"\n";


	return 0;
}


Measured memory_bytes: 1408
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
int main()
{
fast;
ll n;
cin>>n;
vector<string>v;
for(ll i=0;i<n;i++)
{
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    v.pb(s);
}
ll ans=0;
map<string,ll>m;
for(ll i=0;i<n;i++)
{
    m[v[i]]++;
}
for(auto i=m.begin();i!=m.end();i++)
{
    string x=(*i).fi;
    ll cnt=(*i).se;
    cnt--;
    ll y=(cnt*(cnt+1))/2;
    ans+=y;
}
cout<<ans<<endl;

return 0;
}


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

int main()
{
   int x;

   for(int i = 0; i < 5; i++)
   {
       cin>>x;
       if(x == 0)
       {
           cout<<i + 1<<endl;
           //_getch();
           return 0;
       }
   }

   //_getch();
   return 0; 
}

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

int main() {
  string S;
  cin >> S;
  int cnt = 0;
  for (int i = 0; i < S.size(); i++) cnt += (S[i] == '0');
  cout << min(cnt, (int)S.size() - cnt) * 2 << endl;
  return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}


signed main(void) {
	int n;
	cin >> n;
	map<int, int>a;
	rep(i, n) {
		int tmp;
		cin >> tmp;
		a[tmp]++;
	}
	vector<int>b;
	for (auto itr = a.rbegin(); itr != a.rend(); ++itr) {
		if (b.size()>= 2)break;
		int key = itr->first;
		int value = itr->second;
		if (value >= 2) {
			b.pb(key);
		}
		if (value >= 4) {
			if (b.size() < 2)b.pb(key);
		}
	}
	if (b.size() < 2) {
		print(0);
	}
	else {
		print(b[0] * b[1]);
	}
}

Measured memory_bytes: 9728
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


vl primes;
vl dicP;
bool isPrime(ll x){
    if(x == 2 || x == 3) return true;
    rep(i,2,sqrt(x)+1){
        if(x%i == 0)
            return false;
    }
    return true;
}

void generatePrimes(){
    rep(i,2,1000){
        if(isPrime(i)) {
            primes.pb(i);
            dicP.pb(0);
        }
    }
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll n;
    cin >> n;
    ll ans = 1;
    generatePrimes();

    rep(i,2,n+1){
        ll temp = i;
        rp(j,sz(primes)){
            if(primes[j] > temp) break;
            while(temp%primes[j] == 0){
                temp /= primes[j];
                dicP[j]++;
            }
        }
    }
    rp(i,sz(dicP)){
        if(dicP[i] != 0)
            ans = ans*(dicP[i]+1)%MOD;
    }
    cout << ans<<endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

static MOD: u64 = 1_000_000_007;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn binary_power(x: u64, n: u64) -> u64 {
    if n == 0 {
      return 1;
    }
    if n % 2 == 0 {
      return (binary_power(x, n / 2) % MOD).pow(2) % MOD;
    } else {
      return binary_power(x, n - 1) % MOD * x % MOD;
    }
}
  
fn inverse_mod(n: u64) -> u64 {
    binary_power(n, MOD-2)
}  

fn combination(fact: &Vec<u64>, n: u64, m: u64) -> u64 {
    fact[n as usize] * inverse_mod(fact[(n-m) as usize]) %MOD * inverse_mod(fact[m as usize])%MOD
}

fn main() {
    let k: u64 = input();
    let s: String = input();
    let s: Vec<char> = s.chars().collect();
    let n = s.len() as u64;
    let mut fact: Vec<u64> = Vec::new();
    fact.push(1);
    for i in 1..n+k {
        fact.push(fact[i as usize - 1]*(i) % MOD);
    }

    let mut ans = 0;
    let mut comb = 1;
    for i in 0..(k + 1) {
        // println!("{}C{} * 25 ^ {} * 26 ^ {}", i+n-1, n-1, i, k-i);
        // println!("= {}", combination(i + n - 1, n - 1) % MOD * binary_power(25, i) % MOD * binary_power(26, k - i) % MOD);
        ans += combination(&fact, i + n - 1, n - 1) % MOD * binary_power(25, i) % MOD * binary_power(26, k - i) % MOD;
        ans %= MOD;

        comb = comb * (i + n + 2) % MOD * inverse_mod(n-1) % MOD;
    }
    // println!("{}", combination(1, 0));
    println!("{}", ans);
}




Measured memory_bytes: 23568
#include<stdio.h>

int main(void)
{
  int n,m;
  int t[120];
  int p[120];
  int x[120];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&t[i]);
  }
  scanf("%d",&m);
  for(int i=0;i<m;i++){
    scanf("%d %d",&p[i],&x[i]);
  }

  for(int i=0;i<m;i++){
    int sum=0;
    for(int j=0;j<n;j++){
      if(j!=p[i]-1){
        sum+=t[j];
      }
    }
    printf("%d\n",sum+x[i]);
  }
  return 0;
}


Measured memory_bytes: 128
//is there any case of -1 or any special corner cases ?
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr));
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;while(t--) 
const int maxx  = 3*1e5 , limit = 9*1e18 , MOD=1e9+7;
#define boost  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n';

int32_t main(){
    boost;
    int n,d;cin>>n>>d;
    
    int res =0 ;
    for(int i = 0 ;i < n ; i++ ){
        int x,y;
        cin>>x>>y;
        int val = x*x + y*y;
        if(val <= d*d){
            res++;
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3640
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	k := iScan()
	a := iSScan(n)
	ng, ok := 0, mod
	for ok-ng > 1 {
		med := (ng + ok) / 2
		c := 0
		for _, v := range a {
			c += (v+med-1)/med - 1
		}
		if c <= k {
			ok = med
		} else {
			ng = med
		}
	}
	fmt.Println(ok)
}


Measured memory_bytes: 5848
import java.io.*;
import java.util.*;
public class Main {

    private static void solver(InputReader sc, PrintWriter out) {
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        int m = t.length();
        if(m-n!=1){
            out.println("No");
            return;

        }
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)!=t.charAt(i)){
                out.println("No");return;
            }
        }
        out.println("Yes");
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }

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

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

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

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
}
class Pair{
    int x,y;
    Pair(int x, int y){
        this.x = x;
        this.y = y;
    }
}

Measured memory_bytes: 33140
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	vector<int>arr(n);
	for(int i=0;i<n;i++)
		cin>>arr[i];
	vector<bool>dp(k+1,0);
	for(int i=0;i<=k;i++){
		for(int j=0;j<n;j++){
			if(i>=arr[j] && !dp[i-arr[j]])
				dp[i]=1;
		}
	}
	if(dp[k]==1)
		cout<<"First";
	else
		cout<<"Second";
	return 0;
}

Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

vector<ll> h;
ll ans=0;


//[l,r)
void dfs(ll l,ll r){
    if(l>=r){return;}
    ll mi=E,w=-1;
    for(ll i=l;i<r;i++){
        if(mi>h[i]){mi=h[i]; w=i;}
    }
    ans+=mi;
    for(ll i=0;i<r;i++){h[i]-=mi;}
    dfs(l,w);
    dfs(w+1,r);
}


int main(){
    ll n;
    cin>>n;
    h.resize(n);
    for(auto &i:h){cin>>i;}
    dfs(0,n);
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define ll long long
ll digitpower(ll a,ll b){//aのb乗を計算
  if(b==1){
    return a;
  }else if(b==0){
    return 1;
  }
  if(b%2==1){
    ll tmp = digitpower(a,(b-1)/2);
    tmp%=d9_7;
    tmp*=tmp;
    tmp%=d9_7;
    tmp*=a;
    return (tmp)%d9_7;
  }else{
    ll tmp = digitpower(a,(b)/2);
    tmp%=d9_7;
    tmp*=tmp;
    tmp%=d9_7;
    return (tmp)%d9_7;
  }
}
string s;
ll calc(int now){
  ll ans=0;
  int size=s.size();
  if(now==size-1){
    if(s[size-1]== '0'){
      return 1;
    }else{
      return 3;
    }
  }else{
    if(s[now]=='0'){
      return calc(now+1)%d9_7;
    }else{
      ans=digitpower(3,size-1-now);
      return (ans+2*calc(now+1))%d9_7;
    }
  }
}
int main(void){
  cin>>s;
  cout<<calc(0)%d9_7<<endl;
  return 0;
}

Measured memory_bytes: 3584
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map(String::toInt)
    var sum = 0
    var sum2 = 0
    var ave = a.average().toInt()
    for (i in 0 until n) {
        sum += Math.pow((a[i] - ave).toDouble(), 2.0).toInt()
        sum2 += Math.pow((a[i] - ave - 1).toDouble(), 2.0).toInt()
    }
    println(Math.min(sum,sum2))
}

Measured memory_bytes: 37612
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first	
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define INF 1e9
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
ll powe(ll x,ll y){ll res=1;while(y>0){if(y&1)res=res*x;y=y>>1;x=x*x;}return res;}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
void ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mid=(low+high)/2;if(low>high)return;if(ar[mid]>x){y=mid;ceilsearch(ar,low,mid-1,x,y);}else{ceilsearch(ar,mid+1,high,x,y);}}
int main()
{
	fastio();
	ll N,M;
	cin>>N>>M;
	ll ar[N];
	cn(ar,N);
	s(ar,N);
	ll sum=0;
    for(ll i=0;i<N-M;i++)
    {
        sum+=ar[i];
    }
    cout<<sum<<endl;
}

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


int main(){
  long long n,k,i;
  cin >> n >> k;
  vector<long long> h(n);
  for(i=0;i<n;++i){
    cin >> h[i];
  }
  long long su=0;
  sort(h.begin(),h.end(),greater<long long>());
  for(i=0;i<n;++i){
    if(i<k){
      continue;
    }else{
      su=su+h[i];
    }
  }
  cout << su << endl;
  return 0;
}


Measured memory_bytes: 1920
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) for(int sz=0;sz<int(vec.size());sz++) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    V<int> a(n);
    int allg = 0;
    V<bool> div(1000001, false);
    bool pac = true;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        allg = gcd(a[i], allg);
        if (pac) {
            for (int j = 2; j * j <= a[i]; j++) {
                if (a[i] % j == 0) {
                    if (div[j]) {
                        pac = false;
                        break;
                    }
                    div[j] = true;
                    while (a[i] % j == 0) a[i] /= j;
                }
            }
            if (a[i] != 1) {
                if (div[a[i]]) {
                    pac = false;
                }
                div[a[i]] = true;
            }
        }
    }

    if (pac) cout << "pairwise coprime\n";
    else if (allg == 1) cout << "setwise coprime\n";
    else cout << "not coprime\n";

    return 0;
}


Measured memory_bytes: 7440
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

int main(){
    ll x;
    cin>>x;
    ll ans=0;
    ans+=x/500*1000;
    x=x%500;
    ans+=x/5*5;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

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

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


int main(){
  int a, b;
  cin >> a >> b;
  if((a+b)%3 == 0 || a%3 == 0 || b%3 == 0){
    cout << "Possible" << endl;
  }
  else{
    cout << "Impossible" << endl;
  }
}






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

int main(){
  ll N,a=0;
  cin>>N;
  ll A[N+2];
  A[0]=0;
  A[N+1]=0;
  for(ll i=1;i<N+1;i++) cin>>A[i];
  for(ll i=0;i<N+1;i++) a+=abs(A[i]-A[i+1]);
  for(ll i=1;i<N+1;i++){
    cout<<a-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1])<<endl;
  }
}



Measured memory_bytes: 2048
import sys

x, y = map(int, input().split())
y -= (x * 2)

if(y % 2 == 1):
  print('No')
  sys.exit()

if(y == 0):
  print('Yes')
  sys.exit()

for i in range(x):
  y -= 2
  if(y == 0):
    print('Yes')
    sys.exit()

print('No')


Measured memory_bytes: 9184
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll i,j,k,n,a,c,b,r,p,cnt=0;
    map<ll,ll>m;
    vector<ll>v,u,w;
    cin>>n>>k;
    for(i=0;i<n;i++)
    {
        cin>>p;
        v.push_back(p);
    }
    i=0;
    j=1;
    p=v[0];
    while(m[p]==0)
    {
       u.push_back(p);
       m[p]=j;
       j++;
       p=v[p-1];

    }
    j=j-1;
    ll q=j-m[p]+1;
   ll sz=u.size()-q;
    if(k<=u.size())
    {
        cout<<u[k-1]<<endl;
    }
    else
    {
        k=k-sz;
        ll ans=k%q;
        for(i=sz;i<u.size();i++)
        {
            w.push_back(u[i]);
        }
        if(ans==0)
        {
            cout<<w[w.size()-1]<<endl;
        }
        else
            cout<<w[ans-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 18572
from collections import deque
def readinput():
    n,m,k=list(map(int,input().split()))
    a=list(map(int,input().split()))
    b=list(map(int,input().split()))
    return n,m,k,a,b

def main(n,m,k,a,b):
    qa=deque(a)
    qb=deque(b)
    count=0
    res=k
    while(len(qa)>0 and len(qb)>0):
        if qa[0] < qb[0]:
            res-=qa[0]
            qa.popleft()
        else:
            res-=qb[0]
            qb.popleft()
        if res<0:
            return count
        count+=1
    else:
        if len(qa)==0:
            while(len(qb)>0):
                res-=qb[0]
                qb.popleft()
                if res<0:
                    return count
                count+=1
            return count
        else:
            while(len(qa)>0):
                res-=qa[0]
                qa.popleft()
                if res<0:
                    return count
                count+=1
            return count

import sys
INFTY=sys.maxsize
def find(t,s):
    '''
    単調増加配列sからs[i]がtを超えない最大のiを返す
    '''
    ss=s[:]
    ss.append(INFTY)
    left=0
    right=len(ss)
    while(left<right):
        middle=(left+right)//2
        #print(left,middle,right,t,ss)
        if ss[middle]==t:
            #print(middle, ss)
            return middle
        if t<ss[middle]:
            right=middle
        else:
            left=middle+1
    else:
        return left-1

def main2(n,m,k,a,b):
    sa=[0]
    for i in range(1,n+1):
        sa.append(sa[i-1]+a[i-1])
    sb=[0]
    for i in range(1,m+1):
        sb.append(sb[i-1]+b[i-1])
    maxab=0
    nb=m+1
    for na in range(0,n+1):
        res=k-sa[na]
        if res>=0:
            nb=find(res,sb[:nb+1])
            #print(na,nb,sa,sb)
            maxab=max(maxab,na+nb)
    return maxab

from bisect import bisect_left, bisect_right
def main3(n,m,k,a,b):
    sa=[0]
    for i in range(1,n+1):
        sa.append(sa[i-1]+a[i-1])
    sb=[0]
    for i in range(1,m+1):
        sb.append(sb[i-1]+b[i-1])
    maxab=0
    nb=m+1
    for na in range(0,n+1):
        res=k-sa[na]
        if res>=0:
            nb=bisect_right(sb,res)-1
            #print(na,nb,res,sa,sb)
            maxab=max(maxab,na+nb)
    return maxab

def main4(n,m,k,a,b):
    sa=[0]
    for i in range(1,n+1):
        sa.append(sa[i-1]+a[i-1])
    sb=[0]
    for i in range(1,m+1):
        sb.append(sb[i-1]+b[i-1])
    maxab=0
    nb=m
    for na in range(0,n+1):
        res=k-sa[na]
        while res<sb[nb] and nb>=0:
            nb-=1
        else:
            if nb>=0:
                maxab=max(maxab,na+nb)
        #print(na,nb)
    return maxab

def readinput2():
    m=2*10**5
    n=2*10**5
    a=[10**9]*n
    b=[10**9]*m
    k=1
    return n,m,k,a,b

if __name__=='__main__':
    n,m,k,a,b=readinput()
    ans=main3(n,m,k,a,b)
    print(ans)


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

int gcd(int a, int b)
{
    int c;

    if (a < b) {
        a+=b; b=a-b; a-=b;
    }

    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }

    return a;
}

int main(void){
    int a, b, ans = 0;
    cin >> a >> b;
    if(a > b) {
        ans += a;
        a--;
    }
    else {
        ans += b;
        b--;
    }
    if(a > b) {
        ans += a;
        a--;
    }
    else {
        ans += b;
        b--;
    }
    cout << ans << endl;

}

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

template<class T>
void prvec(vector<T> &vec) 
{
    for (T &ele: vec) {
        cout << ele << "";
    }
    cout << endl;
    return;
}

template<class T>
void prvecvec(vector<vector<T>> &vecvec) 
{
    for (int i = 0; i < (int)vecvec.size(); ++i) {
        prvec(vecvec[i]);
    }
    return;
}


int main() 
{
	// freopen("./input.txt", "r", stdin);
    string S;
    cin >> S;
    long long ans = 0;
    int cnt = 0, len = S.length();
    for (int i = 0; i < len; ++i) {
        if (S[i] == 'W') {
            ans += (i - cnt++);
        }
    }
    cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
const long long INF = (1LL << 32);
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
//typedef vector<pair<ll, ll>> vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

#define Endl endl

/*--------------------template--------------------*/

map<ll, ll> mp;

int main() {
    cin >> n;
    vi v(n);
    REP(i,n) {
        cin >> v[i];
        mp[v[i]]++;
    }
    cin >> m;
    vi va(m);
    REP(i,m) {
        cin >> va[i];
        ans += ((mp[va[i]] ? 1 : 0));
    }
    cout << ans << endl;
}


Measured memory_bytes: 13276
// 2nd.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include<string>
#include<vector>
using namespace std;

int main()
{
	int n;
	cin >> n;
	int a = 0;
	int b = 0;
	int c = 0;
	int d = 0;

	vector<string> ans(n);
	for (int i = 0; i < n; i++)
	{
		cin >> ans[i];
		if (ans[i] == "AC")
			a++;
		else if (ans[i] == "WA")
			b++;
		else if (ans[i] == "TLE")
			c++;
		else
			d++;


	}
	cout << "AC" << " " << "x" << " " << a << endl;
	cout << "WA" << " " << "x" << " " << b << endl;
	cout << "TLE" << " " << "x " << c << endl;
	cout << "RE" << " x " << d << endl;


	return 0;

}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


Measured memory_bytes: 6348
#include<cstdio>
const int mod=1000000007;
const int N=200050;
int a[N],p[N],f[N];
int main(){
	int n=0,m,i,x;
	scanf("%d",&m);
	for(i=1;i<=m;++i){
		scanf("%d",&x);
		if(!n||x!=a[n])a[++n]=x;
	}
	f[1]=1;p[a[1]]=1;
	for(i=2;i<=n;++i){
		f[i]=(f[i-1]+f[p[a[i]]])%mod;
		p[a[i]]=i;
	}
	printf("%d\n",f[n]);
	return 0;
}

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


ll solve() {
    ll N;
    cin >> N;
    vector<ll> P(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> P[i];
    }
    ll m = N+1;
    ll ans = 0;
    for ( int i = 0; i < N; i++ ) {
        m = min(m,P[i]);
        if ( P[i] <= m ) ans++;
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

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

int main()
{

    int N;
    cin >> N;
    vector<string> S(N, "");
    for (int i = 0; i < N; ++i){
        cin >> S[i];
    }
    bool is_ok = true;

    set<string> s;
    for (int i = 0; i < N; ++i)
    {
        if(s.count(S[i])!= 0){
            is_ok = false;
        }else{
            s.insert(S[i]);
        }
    }

    for (int i = 1; i < N; ++i)
    {
        if (S[i - 1][S[i - 1].size() - 1] != S[i][0])
        {
            is_ok = false;
            break;
        }
        }

    if( is_ok ){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

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

ll a,b,c;

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

	cin>>a>>b>>c;
	ll dif=(a%2)*b*c;
	dif=min(dif,(b%2)*a*c);
	dif=min(dif,(c%2)*a*b);
	cout<<dif<<endl;

	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>
#include <deque>
#include <limits>
#include <map>
#include <set>
#include <functional>

using namespace std;

const long long MOD = 1000000007;

const int64_t S_MAX = 2005;
int64_t dp[S_MAX];

void init_dp()
{
  dp[0] = 0;
  dp[1] = 0;
  dp[2] = 0;
  dp[3] = 1;
  dp[4] = 1;
  dp[5] = 1;
}

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

  init_dp();

  for (int64_t i = 6; i <= S; i++) {
    dp[i] = 1;
    for (int64_t k = 0; k <= i - 3; k++) {
      dp[i] += dp[k];
      dp[i] %= MOD;
    }
  }

  cout << dp[S] << endl;

  return 0;
}


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

using namespace std;
//FILE *fi=freopen("1.txt","r",stdin);
int n,m;
int main()
{
    cin>>n>>m;
    int sum = 0;
    for(int i=1;i<=m;i++)
    {
        int x;
        cin>>x;
        sum+=x;
    }
    if(n-sum<0)
    {
        cout<<-1;
        return 0;
    }
    cout<<n-sum;
    return 0;
}


Measured memory_bytes: 3624
n,*a = map(int,open(0).read().split())
a.sort()
l = 0
r = n-1
b = [a[0],a[n-1]]
ans = abs(b[0]-b[1])
while(r-l>1):
  c = max([(abs(a[i]-b[j]),i,j) for i in (l+1,r-1) for j in (0,1)])
  ans += c[0]
  b[c[2]] = a[c[1]]
  if c[1] == l+1:
    l += 1
  else:
    r -= 1
print(ans)

Measured memory_bytes: 20024
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LINF = 9223372036854775807;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k; cin >> k;
	cout << a[k-1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define pb push_back
const int N=100005;
const int MOD=1e9+7;
 

// lower_bound - which does not compare less than val
// upper_bound - which compares greater than val
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
 
 
 void solve()
 {
	 int n;
cin>>n;
vector<int> v(n);

for(int i=0;i<n;i++)
{
	cin>>v[i];
}
sort(v.begin(),v.end());
vector<int> res(v[n-1]+1);
for(int i=0;i<=v[n-1];i++)
{
res[i]=0;
}
for(int i=0;i<n;i++)
{
	for(int j=v[i];j<=v[n-1];j+=v[i])
	{
		if(res[j]==0 )
		{
			if(j==v[i])
			 res[j]=1;
			 else
			 res[j]=-1;
		}
		else if(res[j]==1)
		{
			res[j]=-1;
		}
	}
}

int x=0;
for(int i=0;i<n;i++)
{
	if(res[v[i]]==1)
	{
	x++;
    }
}
cout<<x<<endl;
 }
int32_t main() 
{
 ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  /* stuff you should look for
  * int overflow, array bounds
  * special cases (n=1?)
  * do smth instead of nothing and stay organized
*/

	solve();
	
	
}


Measured memory_bytes: 12632
#include<stdio.h>
int main(void)
{
	while(1){
	char n[10001];
	int a=0,b=0,i=0,c;
	if(scanf("%s",n)==EOF){
		break;
	}
	while(n[i]!='\0'){
		i+=1;
	}
	for(c=0;c<i;c++){
		if(n[c]=='J'){
			if(n[c+1]=='O'){
				if(n[c+2]=='I'){
					a+=1;
				}
			}
		}
		else if(n[c]=='I'){
			if(n[c+1]=='O'){
				if(n[c+2]=='I'){
					b+=1;
				}
			}
		}
	}
	printf("%d\n%d\n",a,b);
	}
	return 0;
}


Measured memory_bytes: 2032
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<long long , long long>
#define pb push_back
#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
ll power(ll x,ll y,ll m){ll r=1;for(;y;y>>=1){if(y&1)r=r*x%m;x=x*x%m;}return r;}
const ll mod = 1e9 + 7;
const ld pi = 3.14159265358979;
    
int run_test(){
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	int prevans  = 0;
	char cur = s[0];
	int count = 1;
	for(int i=1; i<n; i++){
		if(s[i] == cur){
			count++;
		}
		else{
			prevans += count - 1;
			count = 1;
			cur = s[i];
		}
	}
	prevans += count - 1;
	int ans = min(n-1, prevans + 2*k);	
	cout << ans;
	return 0;
}
    
int main(){
   FAST;
    ll t;
    t = 1;
     
    while(t--){
        run_test();
    }
}

Measured memory_bytes: 3724
import math as f

K = int(input())
total = 0

for i in range(1, K + 1):
    for j in range(1, K + 1):
        ij = f.gcd(i, j)
        if ij == 1:
            total += K
            continue
        for k in range(1, K + 1):
            total += f.gcd(ij, k)

print(total)


Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5+5;
const int MOD = 1e9+7;

int a[N],n;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	cin >> n;
	for(int i=0;i<n;++i) cin >> a[i];
	int l=0,r=1,x=a[0];
	ll ans = 1;
	while(r<n){
		while(l<r && (x&a[r])) x ^= a[l++];
		x ^= a[r++];
		ans += r-l;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

int main(){
  int grid_num = 0;
  while(~scanf("%d",&grid_num)){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    
    int res = INF;
    for(int w=1;w<=grid_num;w++){
      int p_x[4];
      int p_y[4];
      p_x[0] = (a-1)%w;
      p_x[1] = (b-1)%w;
      p_x[2] = (c-1)%w;
      p_x[3] = (d-1)%w;
      p_y[0] = (a-1)/w;
      p_y[1] = (b-1)/w;
      p_y[2] = (c-1)/w;
      p_y[3] = (d-1)/w;

      int ab_dist = abs(p_x[0]-p_x[1]) + abs(p_y[0]-p_y[1]);
      int cd_dist = abs(p_x[2]-p_x[3]) + abs(p_y[2]-p_y[3]);
      res = min(ab_dist+cd_dist,res);
    }

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

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        queue<string>q;
        while(!q.empty()) q.pop();
        q.push("3");
        q.push("5");
        q.push("7");
        char c[4]={'3','5','7'};
        int ans=0;
        while(!q.empty())
        {
            bool flag=false;
            string t=q.front();
            q.pop();
            for(int i=0;i<3;i++)
            {
               string tt=t+c[i];
//               cout<<tt<<endl;
               int num3=0,num5=0,num7=0;
               for(int j=0;j<tt.size();j++)
               {
                   if(tt[j]=='3') num3++;
                   if(tt[j]=='5') num5++;
                   if(tt[j]=='7') num7++;
               }
               stringstream ss;
               int xx;
               ss<<tt;
               ss>>xx;
               q.push(tt);
               if(xx<=n)
               {
//                   cout<<xx<<endl;
                   if(num3 && num5 &&num7)
                   {
//                       cout<<xx<<endl;
                       ans++;
                   }
               }
               else
               {
                   flag=true;
                   break;
               }
            }
            if(flag) break;
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 1280