akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> pi;
typedef pair<int,int> vi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i <= b; i++)


int main() {
	int N, A[3][3];
	bool result[3][3];
	pi b;
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			cin >> A[i][j];
			result[i][j] = false;
		}
	}
	cin >> N;
	int number;
	for(int i = 0; i < N; i++){
		cin >> number;
		b.PB(number);
	}
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < N; k++){
				if(b[k] == A[i][j]){
					result[i][j] = true;
				}
			}
		}
	}
	
	string answer = "No";
	for(int i = 0; i <3;i++){
		if(result[i][0] && result[i][1] && result[i][2]){
			answer = "Yes";
			break;
		}
		else if(result[0][i] && result[1][i] && result[2][i]){
			answer = "Yes";
			break;
		}
		else if(result[1][1] && result[2][2] && result[0][0]){
			answer = "Yes";
			break;
		}
		else if(result[0][2] && result[1][1] && result[2][0]){
			answer = "Yes";
			break;
		}
	}
	cout << answer << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char a[12];
	long long m=0,s=0,l;
	cin>>a;
	l=strlen(a);
	l--;
	for(int i=0;i<(1<<l);i++)
	{
		m=a[0]-'0';
		for(int j=0;j<l;j++)
		{
			if(i&(1<<j))
			{
				s+=m;
				m=0;
			}
			m=m*10+a[j+1]-'0';
		}
		s=s+m;
	}
	cout<<s<<'\n';
}


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

using namespace std;

// MACROS

#define ll long long
#define ull unsigned long long
#define ld long double

#define vi vector<int>
#define vll vector<ll>
#define vld vector<ld>
#define u_s unordered_set

#define pii pair<int,int>
#define pll pair<ll,ll>

#define FOR(i, n) for (ll (i) = 0; i < n; i++)
#define FORN(i, a, b) for (ll (i) = a; i < b; i++)
#define FORE(i, l) for (auto (i) : l)

#define pb push_back
#define pob pop_back
#define emp emplace
#define fi first
#define se second

#define all(n) (n).begin(), (n).end()
#define in(n) cin >> (n);
#define debug(n) cout << #n << ": " << n << '\n';

// FUNCTIONS

template< typename T >
inline T gcd(T a, T b) { if (b) return gcd(b, a % b); return a; }

template< typename T >
inline T ext_gcd(T a, T b, T & x, T & y) { if (a == 0) { x = 0; y = 1; return b; } T x1, y1; T g = ext_gcd(b % a, a, x1, y1); x = y1 - (b / a) * x1; y = x1; return g; }

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);	
    //cout << setprecision(15);
    ll n, r;
    cin >> n >> r;
    cout << max(0LL, 100 * (10 - n)) + r << '\n';
}



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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);
typedef string ss;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

vll enum_div(ll n)//n�̖񐔂��
{
	vll w;
	for (int i = 1; i*i <= n; ++i)
	{
		if (n%i == 0)
		{
			w.push_back(i);
			//cout << i << endl;
			if (i != 1 && i*i != n)
			{
				w.push_back(n / i);
				//cout << n/i << endl;
			}
		}
	}
	return w;
}

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

    ll ans = (ll)pow(2, 60);
    REP(i,1,sqrt(n)+1)if(n %i == 0){
        ans = min(ans, i + n/i - 2);
    }

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

Measured memory_bytes: 256
#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double EPS = 1e-10;


int main(void) {
  string S, T;
  cin >> S >> T;

  int ans = 1010;
  for (int i = S.length() - T.length(); i >= 0; --i) {
    int mistake = 0;
    for (int j = 0; j < T.length(); ++j) {
      if (T[j] != S[i + j]) ++mistake;
    }
    ans = min(ans, mistake);
  }

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

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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define foe(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define long long long 
#define db double 
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

const int INF = 1e9+7;
const int MOD = 1e9+7;
const int dx[4] = {0,0,-1,1};
const int dy[4] = {-1,1,0,0};

int main()
{
  fastio;
  int h, n; cin >> h >> n;
  int sum = 0;
  for (int i = 1; i <= n; i++){
    int x; cin >> x;
    sum += x;
  }
  cout << (sum >= h ? "Yes" : "No");
  return 0;
}

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

int main(){
	string a,b;
	cin>>a>>b;
	int l1=a.length();
	int l2=b.length();

	int dp[l1+1][l2+1];

	for(int i=0;i<l1+1;i++){
		dp[i][0]=0;
	}
	for(int j=0;j<=l2;j++){
		dp[0][j]=0;
	}

	for(int i=1;i<=l1;i++){
		for(int j=1;j<=l2;j++){
			if(a[i-1]==b[j-1]){
				dp[i][j]=1+dp[i-1][j-1];
			}
			else{
				dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
			}
		}
	}

	/*for(int i=0;i<=l1;i++){
		for(int j=0;j<=l2;j++){
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}
	cout<<dp[l1][l2]<<endl;*/

	int i=l1;
	int j=l2;
	string str="";
	char ch[dp[l1][l2]+1];
	ch[dp[l1][l2]]='\0';

	int ind=dp[l1][l2];
	while(i>0 && j>0){
		//cout<<a[i-1]<<" "<<b[j-1]<<endl;
		if(a[i-1]==b[j-1]){
			str=str+a[i-1];
			i--;
			j--;
		}
		else{
			if(dp[i-1][j]<dp[i][j-1]){
				j--;
			}
			else{
				i--;
			}
		}
	}
	reverse(str.begin(), str.end()); 
	cout<<str<<endl;
	return 0;
}


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

const int MAX = 510000;
const int MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  // 前処理
  COMinit();
  long long H, W, Hdis, Wdis;
  cin >> H >> W >> Hdis >> Wdis;
  long long Hdiff = H - Hdis;
  long long Wdiff = W - Wdis;
  long long pattern1[Hdiff];
  long long pattern2[Hdiff];
  long long ans = 0;
  for(int i = 0; i < Hdiff; i++){
    pattern1[i] = COM(Wdis + i - 1, i);
  }
  for(int j = 0; j < Hdiff; j++){
    long long Hcanmove = H - j - 1;
    long long Wcanmove = Wdiff - 1;
    pattern2[j] = COM(Hcanmove + Wcanmove, Hcanmove);
  }
  for(int k = 0; k < Hdiff; k++){
    long long patt = (pattern1[k] * pattern2[k]) % MOD;
    ans += patt % MOD;
    ans %= MOD; 
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 13568
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
using namespace std;
int l,cnt=0,m=0;
int head[50];
struct node{
	int to,nxt,cap;
}e[1000010];
void add(int u,int v,int c){
	e[++cnt].to=v;e[cnt].nxt=head[u];head[u]=cnt;e[cnt].cap=c;
}
int low(int x){
	return x&-x;
}
int main(){
	scanf("%d",&l);
	int i,j;
	for(i=2;i<=19;++i){
		add(i,i+1,0);add(i,i+1,(1<<(20-i-1)));m+=2;
	}
	while(l){
		int x=log2(low(l));l^=low(l);
		if(x==19){add(1,2,0);add(1,2,1<<18);m+=2;}
		else{add(1,20-x,l);m++;}
	}
	printf("%d %d\n",20,m);
	for(i=1;i<=20;++i){
		for(j=head[i];j;j=e[j].nxt){
			printf("%d %d %d\n",i,e[j].to,e[j].cap);
		}
	}
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int n,tmp,rem=-1,ans=0;cin>>n;
    for(int i=0;i<n;i++){
        cin>>tmp;
        if(tmp==rem){
            ans++;
            rem=-1;
        }
        else rem=tmp;
    }
    cout<<ans<<endl;
}


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

#define ll long long
#define mx  505
#define mod 1000000009
#define lim 10000000
#define inf 2000000000
#define N 18
#define eps 100000
#define PI acos(-1)

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    int a[5];cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    
    cout<<a[2]*10+a[1]+a[0]<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int sx, sy, tx, ty;
int X, Y;

int main(){
	cin >> sx >> sy >> tx >> ty;
	X = tx - sx;
	Y = ty - sy;

	for(int i = 0; i < X; i++){
		cout << "R";
	}
	for(int i = 0; i < Y; i++){
		cout << "U";
	}
	for(int i = 0; i < X; i++){
		cout << "L";
	}
	for(int i = 0; i < Y; i++){
		cout << "D";
	}
	cout << "D";
	for(int i = 0; i < X + 1; i++){
		cout << "R";
	}
	for(int i = 0; i < Y + 1; i++){
		cout << "U";
	}
	cout << "L";
	cout << "U";
	for(int i = 0; i < X + 1; i++){
		cout << "L";
	}
	for(int i = 0; i < Y + 1; i++){
		cout << "D";
	}
	cout << "R";
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; 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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  
  	int a,b;
  	cin >> a >> b;
  	cout << 6 - (a+b) << endl;
  	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
double dist(double a,double b,double c,double d){
	if(floor(b/10)==floor(d/10)) swap(a,b),swap(c,d);
	if(floor(a/10)==floor(c/10)){
		if(b==d) return abs(a-c);
		a-=floor(a/10)*10,c-=floor(c/10)*10;
		return abs(b-d)+min(a+c,20-a-c);
	}
	return abs(a-c)+abs(b-d);
}
double inf=1e9;
int main(){
	int N,x[10000],y[10000];
	cin>>N;
	rep(i,N) cin>>x[i]>>y[i];
	int a=inf,b=-inf,c=inf,d=-inf;
	rep(i,N){
		chmin(a,x[i]+y[i]);
		chmax(b,x[i]+y[i]);
		chmin(c,x[i]-y[i]);
		chmax(d,x[i]-y[i]);
	}
	int A=(a+b)/2,C=(c+d)/2;
	int X=(A+C)/2,Y=(A-C)/2;
	X-=X%10,Y-=Y%10;
	double ans=inf;
	for(int p=X-50;p<=X+50;p+=10){
		for(double q=Y-50;q<=Y+50;q+=0.5){
			double tmp=0;
			rep(i,N) chmax(tmp,dist(x[i],y[i],p,q));
			chmin(ans,tmp);
		}
	}
	for(int q=Y-50;q<=Y+50;q+=10){
		for(double p=X-50;p<=X+50;p+=0.5){
			double tmp=0;
			rep(i,N) chmax(tmp,dist(x[i],y[i],p,q));
			chmin(ans,tmp);
		}
	}
	printf("%.5f\n",ans);
}

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

int main(){
    int n;
    cin >> n;
    int a[201];
    for(int i=0;i<n;i++)cin >> a[i];
    int res=0;
    while(true){
        bool Odd_exist=false;
        for(int i=0;i<n;i++){
            if(a[i]%2==1)Odd_exist=true;
        }
        if(Odd_exist) break;
        
        for(int i=0;i<n;i++)a[i]/=2;
        res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cctype>
#include <functional>
#include <map>
#include <cmath>

using namespace std;
typedef long long ll;

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)

int main(){
    const int INF = 1e9;
    int n;
    int i=6,j=9;
    vector<int> unit;
    unit.push_back(1);
    cin >> n;

    while(i <= n){
        unit.push_back(i);
        i *= 6;
    }

    while(j <= n){
        unit.push_back(j);
        j *= 9;
    }
    
    sort(unit.begin(),unit.end());

    int dp[100001];
    rep(i,n+1){
        dp[i] = INF;
    }

    dp[0] = 0;
    dp[1] = 1;
    reps(i,2,n+1){
        for(auto elem : unit){
            if(i - elem >= 0){
                dp[i] = min(dp[i] ,dp[i-elem]+1);
            }
        }
    }
    cout << dp[n] << endl;

    return 0;

}


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

#define ff first
#define ss second
#define mp make_pair

using namespace std;

typedef long long ll;

int main() {
    int n,p;

    scanf("%d%d", &n, &p);

    if(n < 10 && p < 10) printf("%d\n", n*p);
    else printf("-1\n");

    return 0;
}

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

#define LL long long

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int INF=9999999;
const int MAXN=100000;

int N;
int a[MAXN+1];
queue<int> Que;
int t,ans;
bool vis[100001];
bool tp[100001];
int ans2;

int main(){
	N=read();
	for(int i=1;i<=N;i++){
		a[i]=read();
	}
	for(int i=1;i<=N;i++){
		if(a[i]==i){
			if(i==1){
				swap(a[i],a[i+1]);
				ans++;
			}
			else if(i==N){
				ans++;
			}
			else if(a[i-1]==i-1){
				swap(a[i],a[i-1]);
				ans++;
			}
			else if(a[i+1]==i+1){
				swap(a[i],a[i+1]);
				ans++; 
			}
			else {
				int l=1,r=N;
				for(int j=i-1;j>=1;j--){
					if(a[j]==j) {
						l=j; break;
					}
				} 
				for(int j=i+1;j<=N;j++){
					if(a[j]==j) {
						r=j; break;
					}
				} 
				if(i-l<r-i) swap(a[i],a[i-1]);
				else swap(a[i],a[i+1]);
				ans++;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

int change(char s){
	return s - '0';
}

int main(){
	/*input*/
	char s[11] = {'\0'};	cin >> s;
	/*calculation*/
	int s_l = 0;
	int ans = 10000;
	for(int i = 0; s[i]; i++)s_l++;
	for(int i = 0; i < s_l - 2; i++){
		int tmp = change(s[i])*100 + change(s[i+1])*10 + change(s[i+2]);
		int min;
		(tmp - 753 > 0)?min=tmp-753:min=753-tmp;
		if(ans > min)ans = min;
	}
	/*output*/
	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 all(x) (x).begin(), (x).end()
typedef long long ll;

int main()
{
    double x, t;
    cin >> x >> t;

    cout << x / t << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
static const int N = 1000;
int lcs(string X,string Y){
  int c[N+1][N+1];
  int m = X.size();
  int n = Y.size();
  int maxl = 0;
  X = ' ' + X;
  Y = ' ' + Y;
  for(int i = 0;i<=m;i++) c[i][0] = 0;
  for(int j = 0;j<=n;j++) c[0][j] = 0;

  for(int i = 1; i<= m; i++){
    for(int j = 1; j <= n; j++){
      if(X[i] == Y[j]){
	c[i][j] = c[i-1][j-1]+1;
      }else{
	c[i][j] = max(c[i-1][j],c[i][j-1]);
      }
      maxl = max(maxl,c[i][j]);
    }
  }
  return maxl;
}

int main(){
  string s1,s2;
  int n;
  cin>>n;
  for(int i = 0; i<n;i++){
    cin>>s1>>s2;
    cout<<lcs(s1,s2)<<endl;
  }
  return 0;
}



Measured memory_bytes: 7068
n,m = map(int,input().split())
ab = sorted([list(map(int,input().split())) for _ in range(m)])
relaypoint = []
for i in range(m):
  if ab[i][0] == 1:
    relaypoint.append(ab[i][1])
  else:
    break
ab.sort(key = lambda ab:ab[1],reverse = True)
relaypoint = set(relaypoint)
x = len(relaypoint)
j = 0
flag = 0
while(ab[j][1] == n):
  if ab[j][0] in relaypoint:
    flag = 1
  j += 1
if flag == 1:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

Measured memory_bytes: 97368
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = Integer.valueOf(sc.nextLine());
        String[] values = sc.nextLine().split(" ");
        sc.close();
        double sum = 0;
        for (int i = 0; i < num; i++) {
            sum += 1.0 / Integer.parseInt(values[i]);
        }
        System.out.println(1.0 / sum);
    }
}

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

using namespace std;

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


vector<int> a(n);

for(int i = 0;i < n;i++){
	cin >> a[i];
}
sort(a.begin(),a.end());

int l = a[n/2];
int s = a[n/2-1];

cout << l-s <<endl;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class AGC004
{
    static void Main(string[] args) {
        var slp = Console.ReadLine().Split();
        long A = long.Parse(slp[0]);
        long B = long.Parse(slp[1]);
        long C = long.Parse(slp[2]);
        long res = 0;
        if (A % 2 == 0) goto END;
        if (B % 2 == 0) goto END;
        if (C % 2 == 0) goto END;
        var num = new long[] { A, B, C };
        Array.Sort(num);
        res = num[0] * num[1];
        END: Console.WriteLine(res);
    }
}


Measured memory_bytes: 3032
package main

import (
    "fmt"
    "os"
)

func main() {
    var a int
    var b int
    fmt.Fscanf(os.Stdin, "%d %d", &a, &b)

    var c = a * b
    if (c % 2) == 0 {
        fmt.Printf("Even\n")
    } else {
        fmt.Printf("Odd\n")
    }
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){

	int n,b,f,r,v,a[4][3][10]={0};

	cin>>n;
	for(int i=0;i<n;i++){
		cin>>b>>f>>r>>v;
		a[b-1][f-1][r-1]=v+a[b-1][f-1][r-1];
	}
	for(int i=0;i<4;i++){
		for(int k=0;k<3;k++){
			for(int j=0;j<10;j++){
				cout<<" "<<a[i][k][j];
		}
			cout<<endl;
		}
		if(i!=3){
		cout<<"####################"<<endl;
		}
	}

	return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define FOR(i,a,n) for(int i=a,i##_len=(int)n;i<i##_len;++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0}, DY[9]={-1,0,1,0,-1,1,1,-1,0};
const int INF=1001001001; const long long INFLL=1001001001001001001ll;
template<class T> ostream& operator << (ostream &os, const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; }
template<class T> istream& operator >> (istream &is, vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
    #ifdef int
        cerr<<"\x1b[7m"<<"'int' is defined as 'long long' !!!!"<<"\x1b[m"<<endl;
    #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(12)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

signed main() {
    string s;
    cin>>s;
    int n=SZ(s);
    bool b=false;
    int pre=0;
    int ans=0;
    REP(i,n) {
        if(s[i]=='A' && !b) b=true,pre=i;
        if(s[i]=='Z' && b) {
            chmax(ans,i-pre+1);
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 720
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;
long long int MOD = 1000000007;


int main(){
	
	while(true){
		int n;
		cin >> n;
		if(n == 0){
			break;
		}
		
		vector<int> v;
		
		string str1, str2;
		cin >> str1 >> str2;
		
		int num = (str1[0] - str2[0] + 10) % 10;
		v.push_back(num);
		
		for(int i = 1; i < n; i++){
			int d1 = str1[i] - str1[i - 1];
			int d2 = str2[i] - str2[i - 1];
			num = (d1 - d2 + 100) % 10;
			v.push_back(num);
		}
		
		num = (str2[n - 1] - str1[n - 1] + 10) % 10;
		v.push_back(num);
		
		sort(v.begin(), v.end());
		
		int ans = 10000;
		
		do{
			int cnt = 0;
			int pre = 0;
			int S = 0;
			for(int i = 0; i < v.size(); i++){
				S += v[i];
				if(S % 10 == 0){
					cnt += i - pre;
					pre = i + 1;
				}
			}
			ans = min(ans, cnt);
		}while(next_permutation(v.begin(), v.end()));
		
		cout << ans << endl;
	}
	
	return 0;
}



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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
#define INF 1e7
#define LINF 1e15
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
// 'a' = 97 'z' = 122 => 'a' = 0 'z' = 25
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main() {
    int n, W;
    cin >> n >> W;
    vector<ll> weight(n), value(n);
    rep(i, n) cin >> weight[i] >> value[i];
    vector<vector<ll>> dp(n+1, vector<ll>(W+2));
    rep(i, n){
        rep(sum_w, W+1){
            if(sum_w - weight[i] >= 0){
                chmax(dp[i+1][sum_w], dp[i][sum_w - weight[i]] + value[i]);
            }
            chmax(dp[i+1][sum_w], dp[i][sum_w]);
        }
    }
    cout << dp[n][W] << endl;
}




Measured memory_bytes: 80256
//do not think about past and stay in this moment
//organize and work - Abhinav IIITA
#include <bits/stdc++.h>
#include <ctime>
using namespace std;
#define int long long
#define ld long double
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end() 
const ld pi = acos(-1.0);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



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

int arr[3000000];
void input(int n){
	for(int i=0;i<n;++i)
	cin>>arr[i];
}

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



void solve(){
	    
	string s;
	cin>>s;
	int p=0,r=0;
	int a=0;
	for(int i=0;i<sz(s);++i){
	    if(s[i]=='g'){
	        if(p==0 && r==0){
	            r++;   
	        }
	        else if(p<r){
	            p++;
	            a++;
	        }else{
	            r++;
	        }
	    }else{
	        if(p==0 && r==0){
	            r++;
	            a--;
	        }
	        else if(p<r){
	            p++;
	        }else{
	            r++;
	            a--;
	        }
	    }
    }
    cout<<a;
}


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


int32_t main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); 	
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(n);i++)
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
int n,ok=-1;
string s;
string ans[4]={"SS","SW","WS","WW"};
signed main(){
    cin>>n>>s;
    rep(i,4){
        for(int j=1;j<n;j++){
            if((s[j]=='o')^(ans[i][j-1]==ans[i][j]))ans[i]+='W';
            else ans[i]+='S';
        }
        if(ans[i][0]==ans[i][n]&&((s[0]=='o')^(ans[i][0]=='S')^(ans[i][1]==ans[i][n-1])))ok=i;
    }
    if(ok==-1)cout<<-1<<endl;
    else cout<<ans[ok].substr(0,n)<<endl;
	return 0;
}

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

using namespace std;

#define int ll
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;

signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    

    int n;
    cin >> n;

    vi a(n + 1, 0);
    for (int i = 1; i <= n; ++i)
        cin >> a[i];

    vi p(n + 1, 0);
    for (int i = 1; i <= n; ++i)
        p[i] = p[i - 1] + a[i];

    int s[n + 1][n + 1];
    int dp[n + 1][n + 1];
    for (int i = 0; i <= n; ++i){
        for (int j = 0; j <= n; ++j){
            dp[i][j] = 1e13;
            s[i][j] = 0;
        }
    }

    for (int i = 1; i <= n; ++i){
        for (int j = i; j <= n; ++j){
            s[i][j] = p[j] - p[i - 1];
        }
    }

    for (int i = 0; i <= n; ++i){
        dp[i][1] = a[i];
    }

    for (int i = 0; i < n; ++i){
        dp[i][2] = a[i] + a[i + 1];
    }

    for (int k = 3; k <= n; ++k){
        for (int i = 1; i <= n; ++i){
            if (i + k - 1 > n) continue;

            int j = i + k - 1;

            for (int l = i + 1; l <= j - 1; ++l){
                dp[i][k] = min(dp[i][k], dp[i][l - i + 1] + dp[l + 1][j - (l + 1) + 1] + s[i][j]);
            }

            dp[i][k] = min(dp[i][k], a[i] + dp[i + 1][k - 1] + s[i + 1][j]);
            dp[i][k] = min(dp[i][k], a[j] + dp[i][k - 1] + s[i][j - 1]);
        }
    }

    cout << dp[1][n] << '\n';
}


Measured memory_bytes: 2816
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX_N 100
using namespace std;

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

  int Odd = 0;
  for (int i = 1; i <= N; i++) {
    if (i % 2) Odd++;
  }
  double Ans = (double)Odd / (double)N;
  cout << setprecision(10) << Ans << endl;
  return 0;
}


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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
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;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



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

    map<char,int> mp;

    for(int i=0;i<s.size();i++){
        mp[s[i]]++;
    }

    for(auto a:mp){
        if(a.second%2!=0){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 256
package main

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

func main() {
	sc := NewScanner()
	A := sc.NextIntArray()
	fmt.Println(A[0] * A[1])
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

int N,L,a[100002]={0};
int memo[100002];
int rec(int id)
{
  if(~memo[id])return memo[id];

  int wait=0;
  if(a[id-1]>a[id])wait=max(wait,rec(id-1));
  if(a[id]<a[id+1])wait=max(wait,rec(id+1));
  return memo[id] = wait + L-a[id];
}

int main()
{
  memset(memo,-1,sizeof(memo));
  cin>>N>>L;
  for(int i=1;i<=N;i++)cin>>a[i];
  int ans=0;
  for(int i=1;i<=N;i++)ans=max(ans,rec(i));
  cout<<ans<<endl;
}

Measured memory_bytes: 1592
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int n; cin >> n;
    vector<int> num(n);
    REP(i, n) cin >> num[i];
    int cnt_2 = 0, cnt_4 = 0;
    REP(i, n){
        if(num[i] % 4 == 0) cnt_4++;
        else if(num[i] % 2 == 0) cnt_2++;
    }
    if(cnt_4 + cnt_2 / 2 >= n / 2) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 640
#include <iostream>
#define N 100010
using namespace std;
int main(void){
    int n,m,h[N],ma[N];
    cin >> n >> m;
    for(int i = 1;i <= n;i++){
          cin >> h[i];
          ma[i] = 0;
    }
    
    for(int i = 0;i < m;i++){
          int a,b;
          cin >> a >> b;
          ma[a] = max(ma[a],h[b]);
          ma[b] = max(ma[b],h[a]);
    }
    int ans = 0;
    for(int i = 1;i <= n;i++){
          ans += h[i] > ma[i];
    }
    cout << ans << endl;
}


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

bool is_prime[200001];
long long sum[10010];

void calc_prime(int n){
	for(int i = 0; i <= n; ++i)
		is_prime[i] = true;
	is_prime[0] = is_prime[1] = false;
	int c = 1;
	for(int i = 2; i <= n; ++i){
		if(is_prime[i]){
			sum[c] = sum[c - 1] + i;
			c++;
			for(int j = i * 2; j <= n; j += i)
				is_prime[j] = false;
		}
	}
}

int main() {
	calc_prime(200000);
	int n;
	while(cin >> n && n){
		printf("%lld\n", sum[n]);
	}
	return 0;
}

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

typedef struct node {
	struct node *left;
	struct node *right;
	struct node *parent;
	int key;
} node_t;

struct node *root = NULL;

int n;

void constructTree(int);
struct node* newNode(int);
void insert(struct node*);

void printInorder(struct node*);
void printPreorder(struct node*);

int main()
{
	int i, insertCount = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		char cmd[10];
		scanf("%s", cmd);
		if (cmd[0] == 'i') {
			int newKey;
			scanf("%d", &newKey);
			(insertCount == 0) ? constructTree(newKey) : insert(newNode(newKey));
			insertCount++;
		}
		else {
			printInorder(root);
			printf("\n");
			printPreorder(root);
			printf("\n");
		}
	}
	return 0;
}

void constructTree(int insertValue) {
	root = newNode(insertValue);
}

struct node* newNode(int insertValue) {
	struct node *newNode = (struct node*) malloc(sizeof(struct node));
	newNode->left = NULL;
	newNode->right = NULL;
	newNode->parent = NULL;
	newNode->key = insertValue;

	return(newNode);
}

void insert(struct node *newNode) {
	struct node *y = (struct node*) malloc(sizeof(struct node));
	struct node *x = root;

	while (x != NULL) {
		y = x;
		if (newNode->key < x->key) {
			x = x->left;
		}
		else {
			x = x->right;
		}
	}
	newNode->parent = y;

	if (y == NULL) {
		root = newNode;
	}
	else if (newNode->key < y->key) {
		y->left = newNode;
	}
	else {
		y->right = newNode;
	}
}

void printInorder(struct node *x) {
	if (x != NULL) {
		printInorder(x->left);
		printf(" %d", x->key);
		printInorder(x->right);
	}
}

void printPreorder(struct node *x) {
	if (x != NULL) {
		printf(" %d", x->key);
		printPreorder(x->left);
		printPreorder(x->right);
	}
}



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

using namespace std;

int main()
{
  long long N;
  bool breakFlag = false;
  bool zeroFlag = false;
  long double res = 1;
  long long ans;
  cin >> N;
  vector<long long> A(N, 0);
  for (long long i = 0; i < N; i++)
  {
    cin >> A.at(i);
    if (A[i] == 0)
    {
      zeroFlag = true;
    }
  }
  for (long long i = 0; i < N; i++)
  {
    res *= A[i];
    if (res > abs(1000000000000000000))
    {
      breakFlag = true;
      break;
    }
  }
  if (breakFlag && !zeroFlag)
  {
    cout << -1 << endl;
  }
  else if (zeroFlag)
  {
    cout << 0 << endl;
  }
  else
  {
    ans = res;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    string S;
    cin >> S;
    int l =S.length();
    if (S[l-1]=='1' || S[l-1]=='0' || S[l-1]=='6' || S[l-1]=='8') cout << "pon"; 
    else if (S[l-1]=='2' || S[l-1]=='4' || S[l-1]=='5' || S[l-1]=='7' || S[l-1]=='9') cout << "hon"; 
    else cout << "bon";
}

Measured memory_bytes: 3612
#include<stdio.h>
#include<math.h>

int main()
{
  int  x, a, b;
  
  scanf("%d %d %d", &x, &a, &b);
  a = abs(a - x);
  b = abs(b - x);
  if(a < b){
    printf("A\n");
  }else{
    printf("B\n");
  }
  
  return 0;
}

Measured memory_bytes: 128
N = int(input())
T = list(map(int,input().split()))
A = list(map(int,input().split()))
exact = [0] * N # 高さが確定した場所
seem = [0] * N # 高さが確定しない場所のあり得る最大値

cur = 0
for i in range(len(T)):
  if cur < T[i]:
    exact[i] = T[i]
    cur = T[i]
  else:
    seem[i] = cur
    
cur = 0
for i in range(len(A)-1,-1,-1):
  if cur < A[i]:
    if exact[i] != 0 and exact[i] != A[i]: # 既に記録された確定数値が今回の値と異なる場合
      print(0)
      exit(0)
    if exact[i] == 0 and seem[i] < exact[i]:# ここで確定させる数値が高橋くん的にあり得るかチェック
      print(0)
      exit(0)
    exact[i] = A[i]
    cur = A[i]
  else:
    # 既に確定している数値が今入れようとしている数値より大きければNG
    if exact[i] != 0 and exact[i] > cur:
      print(0)
      exit(0)
    seem[i] = min(seem[i],cur)
    
DIV = 10 ** 9 + 7
ans = 1
for i in range(N):
  if exact[i] != 0: # 確定数値があれば場合の数は変わらない
    continue
  else:
    ans *= seem[i]
    ans %= DIV

print(ans)

Measured memory_bytes: 18752
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/


int main() {
 map<int,int> mp;
 int n,k;
 cin >> n >> k;
 rep(i,n){
   int a;
   cin >> a;
   mp[a]++;
 }
 vector<int> vec;
 for(auto m:mp){
   vec.push_back(m.second);
 }
 ll ans = 0;
 sort(All(vec));
 int cnt = max(0,(int)mp.size()-k);
 cout << accumulate(vec.begin(),vec.begin()+cnt,0) << endl;
}

Measured memory_bytes: 10748
#include<iostream>
using namespace std;
int main(){
    int N;
    cin>>N;
    int A[N],i,j,c=0,k;
    for(i=0;i<N;i++) cin>>A[i];
    int flag=1;
    while(flag){
        flag=0;
        for(j=N-1;j>0;j--){
            if(A[j]<A[j-1]){
                k=A[j];
                A[j]=A[j-1];
                A[j-1]=k;
                c++;
                flag=1;
            }
        }
    }
    for(i=0;i<N;i++){
        cout<<A[i];
        if(i!=N-1) cout<<" ";
    }
    cout<<endl;
    cout<<c<<endl;
}


Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_N 400002
int N, K, L;

struct union_find_tree {
	int par[MAX_N]; // 親
	int depth[MAX_N]; // 木の深さ

	// n要素で初期化
	void init(int n) {
		rep(i, 0, n) {
			par[i] = i;
			depth[i] = 0;
		}
	}

	// 木の根を求める
	int find(int x) {
		if(par[x] == x) return x;
		else return par[x] = find(par[x]);
	}

	// xとyの属する集合を併合
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(depth[x] < depth[y]) {
			par[x] = y;
		} else {
			par[y] = x;
			if(depth[x] == depth[y]) depth[x]++;
		}
	}

	// xとyが同じ集合に属するか否か
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

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

	cin >> N >> K >> L;

	union_find_tree uft1;
	uft1.init(N);

	rep(k, 0, K) {
		int p, q;
		cin >> p >> q;
		p--, q--;
		uft1.unite(p, q);
	}

	union_find_tree uft2;
	uft2.init(N);

	rep(l, 0, L) {
		int r, s;
		cin >> r >> s;
		r--, s--;
		uft2.unite(r, s);
	}

	map<pair<int, int>, int> m;
	rep(i, 0, N) m[make_pair(uft1.find(i), uft2.find(i))] += 1;

	rep(i, 0, N) cout << m[make_pair(uft1.find(i), uft2.find(i))] << " " ;
	cout << endl;
}


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

int main() {
  int n;
  cin>>n;
  int ans=0;
  rep(i,n){
    int a;
    cin>>a;
    while(a%2==0){
      a/=2;
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N, sum;
  cin >> N;
  sum = 0;
  for (int i=0; i <N ;i++){
    int r,l;
    cin >>r >>l;
    sum += l-r+1;
  }
  cout << sum <<endl;
}

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

int main (void)
{
int a[7];
int b[7];
for(int i=0;i<7;i++)
{
cin>>a[i]>>b[i];}
for(int i=0;i<7;i++)
{
cout<<a[i]-b[i]<<endl;}


}

Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
#define I_O		ios::sync_with_stdio(false),cin.tie(0)
#define ll		long long
#define ff		first
#define ss		second
#define mod 		1000000007
#define rep(i,n)	for(ll i=1;i<=n;i++)
#define repv(i,a,n)	for(ll i=a;i<=n;i++)
#define pb 		push_back
#define newl		'\n'
#define deb(x)		cout<<x<<" "
int main() 
{  
	I_O;
	int a,sum;	cin>>a;
	sum = a + (a*a) + (a*a*a);
	cout<<sum;
} 


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main(final String args[]) {
        Scanner scan = new Scanner(System.in);
        double X = scan.nextDouble();
        double K = 100;
        int i = 0;
        while(X > K){
            K = Math.floor(K * 1.01);
            i++;
        }
        System.out.println(i);

    }
}


Measured memory_bytes: 37452
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
 
using namespace std;
 
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define minimize(a, x) a = std::min(a, x)
#define maximize(a, x) a = std::max(a, x)
 
typedef long long ll;
ll const Inf = 1LL<<60;
 
int N;
 
int main() {
  cin >> N;
  deque<long double> radius(N);
  rep(i, N) {
    cin >> radius[i];
  }
 
  if(N == 1) {
    printf("%.10Lf\n", radius[0] * 2.0);
    exit(0);
  }
 
  vector<long double> positions;
  vector<int> lasts;
//  vector<long double> starts;
  long double start = 0.0;
  rep(i, N) {
    long double x = 0.0;
    rep(j, i) {
      long double px = positions[j];
      long double s = radius[i] + radius[j]; s *= s;
      long double h = abs(radius[i] - radius[j]); h *= h;
      long double w = sqrt(s - h);
      if(x < px + w) {
        x = px + w;
      }
    }
    positions.push_back(x);
    lasts.push_back(i);
    minimize(start, x - radius[i]);
//    starts.push_back(min(-radius[0], x - radius[i]));
  }
 
//  rep(i, radius.size()) { cout << radius[i]; }; cout << endl << radius[0] << endl;
//  cout << "-----------------\n";rep(i, positions.size()) { printf("%.10Lf %.5Lf\n", positions[i], radius[lasts[i]]); } cout << "-----------------\n";
 
  long double ret = 0.0;
  rep(i, positions.size()) {
    maximize(ret, positions[i] - start + radius[lasts[i]]);
  }
  printf("%.10Lf\n", ret);
 
  return 0;
}

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

int W,H,gx,gy,ans,MAP[22][22],dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

void dfs(int cnt,int x,int y){
	if(x==gx && y==gy){
		ans=min(ans,cnt);
		return;
	}
	if(cnt>=10 || cnt>=ans)return;
	for(int k=0;k<4;k++){
		if(MAP[x+dx[k]][y+dy[k]]==1)continue;
		int nx=x,ny=y;
		while(MAP[nx][ny]==0){
			nx+=dx[k];
			ny+=dy[k];
		}
		if(MAP[nx][ny]==-1)continue;
		if(MAP[nx][ny]==1){
			MAP[nx][ny]=0;
			dfs(cnt+1,nx-dx[k],ny-dy[k]);
			MAP[nx][ny]=1;
		}
		else if(MAP[nx][ny]==3){
			dfs(cnt+1,nx,ny);
		}
	}
}

int main(){
	while(cin>>W>>H,W){
		int sx,sy;
		for(int i=0;i<484;i++)MAP[i/22][i%22]=-1;
		for(int i=1;i<=H;i++){
			for(int j=1;j<=W;j++){
				cin>>MAP[j][i];
				if(MAP[j][i]==2){
					MAP[j][i]=0;
					sx=j;
					sy=i;
				}
				if(MAP[j][i]==3){
					gx=j;
					gy=i;
				}
			}
		}
		ans=1145141919;
		dfs(0,sx,sy);
		cout<<(ans==1145141919?-1:ans)<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main() {
    int x;
    cin >> x;
    if (x==0) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	int result;
	int check;
	// 入力
	int N;
	cin >> N;
	int d[N];
	for(int i = 0; i < N; i++){
		cin >> d[i];
	}
	
	//ソート
	sort(d, d + N, greater<int>());

	//段数判定
	result = 1;
	check = d[0];
	for(int i = 0; i < N - 1; i++){
		if(check > d[i + 1])
		{
			check = d[i + 1];
			result++;
		}
	}
	
	cout << result;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 999999999
#define MAX 100005
using namespace std;

 #define EXPLORED 2
#define VISITED 1
#define UNVISITED 0
typedef long long int ll;
 typedef pair<int,int> ii;
 typedef vector<ii> vii;
 typedef vector <int > vi;
//vector <vi> adj(MAX); 

int main()
{
  
 //  freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
 //ios::sync_with_stdio(false); 
 //cin.tie(0);
 ll n,arr[100005];
 cin>>n;
 for(ll i=0;i<n;i++)
  cin>>arr[i];
ll pp=arr[0],ans=0;
for(ll i=0;i<n;)
{
  pp=arr[i];
  // cout<<pp<<" "<<i<<endl;
  ans++;
 // i++;
  while(arr[i]==pp)
    i++;
  if(arr[i]<pp)
  {
    //i++;
    while(arr[i]<=pp)
    {
      pp=arr[i];
      i++;
    }
  }
  else
  {
    //i++;
    while(arr[i]>=pp)
    {
     // cout<<arr[i]<<endl;
      pp=arr[i];
      i++;
    }
  }
 //cout<<pp<<" "<<i<<endl;
  //pp=arr[i];
}
cout<<ans<<endl;
return 0;

}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}



ll cnt[100];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N , M ; cin >> N >> M ;
  rep(i,M){
    ll a, b ; cin >> a >> b;
    cnt[a]++;
    cnt[b]++;
  }

  rep(i,N+1){
    if(i==0) continue;
    cout << cnt[i] << endl;
  }
  
  //cout << fixed << setprecision(16) << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256