akhauriyash/Code-Regression huggingface dataset:
N = [int(e) for e in input().split()]
if(N[0] == N[1]):
    print('Draw')
elif(N[0] == 1):
    print('Alice')
elif(N[1] == 1):
    print('Bob')
elif(N[0] > N[1]):
    print('Alice')
else:
    print('Bob')

Measured memory_bytes: 38384
#include<cstdio>
#define Powered using
#define by namespace
#define Wshine std;
Powered by Wshine

int n,i,min=999999;
long long num[200],x;
int main()
{
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		long long count=0;
		scanf("%lld",&num[i]);
		x=num[i];
		while(x%2!=1)
		{
			x=x/2;
			count++;
		}
		if(min>count)
		{
			min=count;
		}
	}
	printf("%d",min);
	return 0;
} 

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

int		main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int A, B;
	cin >> A >> B;
	int count = 0;
	while (A <= B) {
		string s = to_string(A);
		int j = s.size() - 1;
		int i = 0;
		while (i != j) {
			if (s[i] != s[j])
				break;
			i++;
			j--;
			if (i == j)
				count++;
		}
		A++;
	}
	cout << count << "\n";
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<long long> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    long long cmp = v[n-1]/2;
    int ite1 = lower_bound(v.begin(), v.end(), cmp) - v.begin();
    if(ite1 == 0){
        cout << v[n-1] << " " << v[0] << endl;
        return 0;
    }
    int ite2 = ite1--;
    if(abs(v[ite1]*2-v[n-1]) <= abs(v[ite2]*2-v[n-1]))
        cout << v[n-1] << " " << v[ite1] << endl;
    else
        cout << v[n-1] << " " << v[ite2] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<vector>
#include<limits.h>
using namespace std;
#define INF LLONG_MAX
#define inf INT_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef pair<int, int> P;
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 mypow(ll a, ll b) {
	if (b == 0)return 1;
	if (b % 2)return mypow(a, b - 1)*a;
	else return mypow(a, b / 2)*mypow(a, b / 2) ;
}
/*
//Conbination!
ll c[51][51];
void comb(int n) {
	rep(i, 51) {
		rep(j, i + 1) {
			if (j == 0 || j == i)c[i][j] = 1;
			else c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
		}
	}
}
*/
int a[26];
int main() {
	string s;
	cin >> s;
	rep(i, s.size())a[s[i] - 'a']++;
	int ans = inf;
	for (int i = 0; i < 26; i++) {
		string z = s;
		int cnt = 0;
		while (true) {
			rep(j, s.size() - 1) {
				if (s[j] != s[j + 1])goto kaage;
			}
			break;
		kaage:;
			string t = "";
			cnt++;
			rep(j, s.size() - 1) {
				if (s[j + 1] - 'a' == i)t += s[j + 1];
				else t += s[j];
			}
			s = t;
		}
		ans = min(ans, cnt);
		s = z;
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

int main()
{
    long a,b,c,k,res=0,xa,xb,xc,k1,k2,k3;
    cin >> a >> b >> c >> k;
    xa = min(k,a);
    k1 = k - xa;
    xb = min(k1, b);
    k2 = k1 - xb;
    xc = min(k2, c);
    k3 = k2 - xc;
    res = xa*1 + xb*0 + xc*(-1);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<stack>
#include<cstring>
using namespace std;
const int M=1e9+7;
int main(){
	int n;
	cin>>n;
	int a[n+1];
	int ans=0;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int j=1;j<=n;j++){
		if(j&1 && a[j]&1)ans++;
	}
	cout<<ans;
	return 0;
}

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

int main(){
	ios::sync_with_stdio(false);
    cin.tie();
    
    int l,r,d;
    cin>>l>>r>>d;
    int i,ans=0;
    for(i=l;i<=r;i++){
    	if(i%d==0) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll A, B, C, K;
  cin >> A >> B >> C >> K;
  bool unfair = false;
  ll ans = 0;
  if (K % 2 == 0)
  {
    ans = A - B;
    if (ans > 1e18)
      unfair = true;
  }
  else
  {
    ans = B - A;
    if (ans > 1e18)
      unfair = true;
  }
  if (unfair)
    cout << "Unfair" << endl;
  else
    cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int Digit(int n) {
	int sum = 0;
	while (n > 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	int ans = 0;
	for (int i = 1;i <= n;++i) {
		if (a <= Digit(i) && Digit(i) <= b)ans+=i;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
# t=int(input())
# for _ in range(t):
n=int(input())
arr=[int(x) for x in input().split()]
maxa=arr[0]
count=0
for i in range(n):
    if arr[i] >= maxa:
        maxa=arr[i]
    else:
        count+=(maxa-arr[i])
print(count)


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

int main(){
	int a,b;
	cin>>a>>b;
	char c[a][b];
	for(int i=0;i<a;i++){
		for(int j=0;j<b;j++){
			cin>>c[i][j];
		}
	}
	for(int k=-2;k<b;k++) cout<<'#';
	cout<<endl;
	for(int l=0;l<a;l++){
		cout<<'#';
		for(int m=0;m<b;m++){
			cout<<c[l][m];
		}
		cout<<'#'<<endl;
	}
	for(int n=-2;n<b;n++) cout<<'#';
	cout<<endl;
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  for(int i = 9; i > 0; i--) {
    if(n % i == 0 && n / i < 10) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int N;
    ll K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        A[i]--;
    }

    int loopsiz = 0;
    int toloop = 0;
    vector<int> num(N, -1);
    int pos = 0;
    num[pos] = 0;
    while (1) {
        int npos = A[pos];
        if (~num[npos]) {
            toloop = num[npos];
            loopsiz = num[pos] + 1 - num[npos];
            break;
        }
        num[npos] = num[pos] + 1;
        pos = npos;
    }

    if (K > toloop) {
        K -= toloop;
        K %= loopsiz;
        K += toloop;
    }

    for (int i = 0; i < N; ++i) {
        if (K == num[i]) {
            cout << i + 1 << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 4784
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
const ll inf=1001001001001001;
const int INF=1001001001;
//const int mod=1000000007;
ll mod=998244353;
const double pi=3.14159265358979323846;
bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;}
bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;}
void outvi(vi v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
void outvvi(vvi v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
vi segsum;
ll N=1;
ll powe(ll a,ll p){
    if(p==0)return 1;
    if(p&1)return (a*powe(a,p-1))%mod;
    ll k=powe(a,p/2);
    return (ll)((k*k)%mod);
}
void update(ll i,ll x){
    i=N+i-1;
    segsum[i]=x;
    while(i>0){
        i=(i-1)/2;
        segsum[i]=segsum[i*2+1]+segsum[i*2+2];
    }
}
ll sum(ll a,ll b,ll k,ll l,ll r){
    if(r<=a||b<=l)return 0;
    if(a<=l&&r<=b)return segsum[k];
    ll c1=sum(a,b,k*2+1,l,(l+r)/2);
    ll c2=sum(a,b,k*2+2,(l+r)/2,r);
    return c1+c2;
}
vi so;
ll id(ll i){
    return lb(so,i);
}
int main(){
    ll n;cin>>n;
    vvi res(4,vi(n));
    while(N<n)N*=2;
    segsum=vi(N*2-1);
    vector<P> v(n);
    rep(i,n)cin>>v[i].fi>>v[i].se;
    so=vi(n);
    rep(i,n)so[i]=v[i].se;
    sort(all(so));
    sort(all(v));
    rep(i,n){
        update(id(v[i].se),/*segsum[id(v[i].se)+N-1]+*/1);
        res[1][i]=sum(0,id(v[i].se),0,0,N);
        res[0][i]=i-res[1][i];
    }
    segsum=vi(N*2-1);
    reverse(all(v));
    rep(i,n){
        update(id(v[i].se),/*segsum[id(v[i].se)+N-1]+*/1);
        res[3][n-1-i]=sum(0,id(v[i].se),0,0,N);
        res[2][n-1-i]=i-res[3][n-1-i];
    }
    ll ans=(ll)(n*powe(2,n-1))%mod;
    rep(i,n){
        ans=(ans+(((ll)((powe(2,res[0][i])-1)*(ll)(powe(2,res[1][i])-1))%mod)*(ll)(powe(2,res[2][i])-1)%mod)*(ll)(powe(2,res[3][i])-1))%mod;
        ans=(ans+((ll)(powe(2,res[0][i])-1)*(ll)(powe(2,res[1][i])-1)%mod)*(ll)(powe(2,res[2][i])-1))%mod;
        ans=(ans+((ll)(powe(2,res[0][i])-1)*(ll)(powe(2,res[1][i])-1)%mod)*(ll)(powe(2,res[3][i])-1))%mod;
        ans=(ans+((ll)(powe(2,res[0][i])-1)*(ll)(powe(2,res[3][i])-1)%mod)*(ll)(powe(2,res[2][i])-1))%mod;
        ans=(ans+((ll)(powe(2,res[3][i])-1)*(ll)(powe(2,res[1][i])-1)%mod)*(ll)(powe(2,res[2][i])-1))%mod;
        ans=(ans+(ll)(powe(2,res[2][i])-1)*(ll)(powe(2,res[1][i])-1))%mod;
        ans=(ans+(ll)(powe(2,res[3][i])-1)*(ll)(powe(2,res[0][i])-1))%mod;
    }
  while(ans<0)ans+=mod;
    cout<<(ans+mod)%mod<<endl;
}


Measured memory_bytes: 19428
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }


struct v {
    int down, up;
};

bool solve() {
    int n;
    cin >> n;
    vector<v> a, b;
    rep(i,n) {
        string s;
        cin >> s;
        int m = s.size();
        int h = 0;
        int down = 0;
        rep(j,m) {
            if (s[j] == '(') {
                h++;
            } else {
                h--;
            }
            down = min(down, h);
        }
        int up = h - down;
        down = abs(down);
        if (down < up) {
            a.push_back({down, up});
        } else {
            b.push_back({down, up});
        }
    }
    sort(all(a), [](v lhs, v rhs) {
        if (lhs.down != rhs.down) return lhs.down < rhs.down;
        else return lhs.up > rhs.up;
    });
    sort(all(b), [](v lhs, v rhs) {
        if (lhs.up != rhs.up) return lhs.up > rhs.up;
        else return lhs.down > rhs.down;
    });
    int h = 0;
    rep(i,a.size()){
        h -= a[i].down;
        if (h < 0) return false;
        h += a[i].up;
    }
    rep(i,b.size()){
        h -= b[i].down;
        if (h < 0) return false;
        h += b[i].up;
    }
    return h == 0;
}

int main(void){
    cout << ((solve()) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 11252
#include<cmath>
#include<cstdio>

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

using namespace std;

const double EPS=1e-7;
const double INF=1e77;

const int N_BIN=50;
double nCr[N_BIN+1][N_BIN+1];
void binom(){
	rep(n,N_BIN+1) nCr[n][0]=1;
	rep(n,N_BIN) rep(r,n+1) nCr[n+1][r+1]=nCr[n][r+1]+nCr[n][r];
}

int main(){
	binom();

	int n,m,L; scanf("%d%d%d",&n,&m,&L);
	double p[100];
	int rest[100],v[100];
	rep(i,n) scanf("%lf%d%d",p+i,rest+i,v+i), p[i]/=100;

	double t[100][51],q[100][51];
	rep(i,n) rep(j,m+1) {
		if(v[i]>0) t[i][j]=(double)L/v[i]+j*rest[i];
		else       t[i][j]=INF;
		q[i][j]=nCr[m][j]*pow(p[i],j)*pow(1-p[i],m-j);
	}

	rep(i,n){
		if(v[i]==0){ puts("0"); continue; }

		double ans=0;
		rep(j,m+1){
			double pr=q[i][j];
			rep(k,n) if(i!=k) {
				double tmp=0;
				rep(l,m+1) if(t[k][l]<0 || t[i][j]+EPS<t[k][l]) tmp+=q[k][l];
				pr*=tmp;
			}
			ans+=pr;
		}
		printf("%.15f\n",ans);
	}

	return 0;
}

Measured memory_bytes: 920
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

template<class T>T gcd(T a, T b){if(a<b){a^=b;b^=a;a^=b;}return b?gcd(b,a%b):a;}
template<class T>T lcm(T a, T b){return a*b/gcd(a,b);}

int N;
int A[100002];
int L[100002];
int R[100002];

int main(){
    cin>>N;
    repn(i,N){
        cin>>A[i];
    }

    repn(i,N){
        L[i+1]=gcd(L[i],A[i]);
        R[N-i+1]=gcd(R[N-i+2],A[N-i+1]);
    }

    int ans=0;
    repn(i,N){
        ans=max(ans,gcd(L[i],R[i+1]));
        //cout<<"i="<<i<<' '<<L[i]<<','<<R[i+1]<<endl;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<algorithm>

using namespace std;

int main() {
	int i;
	int N;
	double A[10000];
	double  wari[10000];
	double sum=0;
	double  result=0;
	cin >> N;

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

	for (i = 0; i < N; ++i) {
		wari[i] = 1/A[i];
		//cout << "wari" << endl;
		//cout << wari[i] << endl;
	}

	for (i = 0; i < N; ++i) {
		sum += wari[i];
		
	}
	//cout << "sum" << sum << endl;

	result = 1 / sum;
	cout << result << endl;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using vec_b = vector<bool>;
using vec_str = vector<string>;
using graph = mat;
using edge = pair<ll,ll>;
using wgraph = vector<vector<edge>>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back


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

    ll mon = 100, cnt = 0;
    while(mon < X) {
        mon = (ll)(mon * 1.01);
        ++cnt;
    }
    _PR(cnt);


    return 0;
}

/*



*/

Measured memory_bytes: 3636
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long x = in.nextLong();
            long years = 0;

            out.println(answer(x, 0, 100l));


        }

        public long answer(long x, long years, long current) {

//        double y = ceil(x*1.0000/100.0000);
//        double lgy = Math.log(y);
//        double xx = Math.log(1.0100);
//        double an =  lgy/xx;
//        return (long)ceil(an);
            double cd = current * 1.00000;
            long y = 0;
            while (x > cd) {
                cd = Math.floor(cd * 1.01);
                y++;
            }
            return y;
        }

    }
}



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

//vector<vector<int>> vec(縦,vector<int>(横));
/*deque<型> 配列の先頭にも用がある時はvectorの代わりに。
入力はstringでもらってからpush_back()*/
//printf("%書式指定" ,出力したい物);\nで改行



int main(){
  long int X;
  cin>>X;
  
  long int sum=100;
  int i=0;
  
  while(sum<X)
  {
    sum*=1.01;
    i++;
  }
  
  cout<<i<<endl;
    
  
}

Measured memory_bytes: 3632
#include <cstdio>
#include <map>
#include <vector>
#define fi first
#define sec second
using namespace std;
typedef pair<int,int> P;

int m, n;

int main(){
	while(scanf("%d", &m),m){
		if(m == 1){
			int a,b,c,d;
			scanf("%d%d%d%d%d",&a,&b,&n,&c,&d);
			printf("%d %d\n", c-a, d-b);
			continue;
		}
		map<P,bool> ma;
		map<P,bool>::iterator it;
		vector<P> v;
		P s;
		for(int i = 0; i < m; i++){
			int x, y;
			scanf("%d%d", &x, &y);
			if(i == 0){
				s.fi = x;
				s.sec = y;
			} else{
				x -= s.fi; y -= s.sec;
				v.push_back(P(x,y));
			}
		}
		scanf("%d", &n);
		for(int i = 0; i < n; i++){
			int x, y;
			scanf("%d%d", &x, &y);
			ma[P(x,y)] = 1;
		}
		for(it = ma.begin(); it != ma.end(); it++){
			P p = it->fi;
			bool ok = true;
			for(int i = 0; i < m-1; i++){
				if(ma.count(P(p.fi+v[i].fi,p.sec+v[i].sec)) == 0){
					ok = false;
					break;
				}
			}
			if(ok){
				printf("%d %d\n", p.fi-s.fi, p.sec-s.sec);
				break;
			}
		}
	}
}

Measured memory_bytes: 1100
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int n;
	int ans=0;
	int tmp=0;
	cin>>n; 
	for(int i=0;i<n;i++){
		char a;
		cin>>a;
		if(a=='I') tmp++;
		else tmp--;
		ans=ans<tmp?tmp:ans;
	} 
	cout<<ans;
	return 0;
}


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

int main() {
	int a, b;
	cin >> a >> b;
	int cnt = 1;
	int ans = 0;
	while (cnt < b) {
		cnt += a - 1;
		ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    int x;
    cin >> x;
    repi(i,x+1,1){
        if(int(i * 1.08) == x){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
lis=[]
cnt=0
for i in range(n-1):
  if a[i+1]==a[i]:
    cnt+=1
  else:
    if cnt>=1:
      lis.append([a[i],cnt])
    cnt=0
if cnt>=1:
  lis.append([a[n-1],cnt])
lis.sort(reverse=True)
if len(lis)>=2:
  if lis[0][1]>=3:
    print(lis[0][0]**2)
  else:
    print(lis[0][0]*lis[1][0])
elif len(lis)==1:
  if lis[0][1]>=3:
    print(lis[0][0]**2)
  else:
    print(0)
else:
  print(0)


Measured memory_bytes: 14672
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
int n,q;
bool check1(int mid, vector <pair<char,char>> & magic, string &s){
    if(mid <-1) return true;
    if(mid >=n) return false;
    //cout<<q<<endl;
    rep(i,q){
        //cout<<mid<<' '<<magic[i].F<<i<<endl;
        if(s[mid]==magic[i].F) mid += (magic[i].S == 'R') ? 1:-1;
        if(mid == -1) {return true; }
        if(mid == n) {return false;}
    }
    return false;
}
bool check2(int mid, vector <pair<char,char>> & magic, string &s){
    if(mid <0||mid>=n) return true;
    rep(i,q){
        if(s[mid]==magic[i].F) mid += (magic[i].S == 'R') ? 1:-1;
        if(mid == n) return true; 
        if(mid == -1) return false;
    }
    return false;
}
signed main(void){
    cin>>n>>q;
    
    string s; cin>>s;
    vector <pair<char,char>> magic(q);
    rep(i,q){
        cin>>magic[i].F>>magic[i].S;
    }
    /// disapper in leftside
    int l = -1, r = 200010;
    
    while(abs(l-r)>1){
        int mid = (l+r)/2;
        if(check1(mid, magic, s)) {l = mid; }
        else {r = mid;}
    }
    int ans1 = l;
    //cout<<ans1<<' '<<'*'<<endl;
    r = 200010;
    // rightside
    while(abs(l-r)>1){
        int mid = (l+r)/2;
        if(check2(mid, magic, s)) { r = mid;}
        else l = mid;
    }
    
    int ans2 = l;
    
    cout<<ans2-ans1<<endl;
}


Measured memory_bytes: 900
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(),b= sc.nextInt(),c = sc.nextInt(),tmp;
		tmp = a;
		a = b;
		b = tmp;
		tmp = a;
		a = c;
		c = tmp;
		System.out.println(a+" "+b+" "+c);
		

	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define Graph vector<vector<ll>>
constexpr ll INF=(1ll<<60);
constexpr ll mod=1000000007;
constexpr double pi=3.14159265358979323846;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<typename T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}

int main(){
    ll x;cin>>x;
    x-=400;
    
    cout<<8-x/200<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

typedef long long ll;

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; }
const int INF = 1e9;
const long long INFL = 1LL<<60;

int main() {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  int z = X;
  rep(i, N) {
    int x;
    cin >> x;
    chmax(z, x);
  }
  if (Y <= z) {
    cout << "War" << endl;
    return 0;
  }
  rep(i, M) {
    int y;
    cin >> y;
    if (y <= z) {
      cout << "War" << endl;
      return 0;
    }
  }
  cout << "No War" << endl;
  return 0;
}


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

using namespace std;

int len;
string str;
set<string> st;

void solve(int idx,string s,int S){
  if(idx == len){
    st.insert(s);
    return;
  }
  for(char ch = 'a' ; ch <= 'z' ; ch++){
    string next = s;
    int num = ch - 'a';
    next += ch;
    if(ch == 'a' || ((S >> num) & 1)){
      if(ch == str[idx]){
        solve(idx+1,next,S);
      }
    }else if(!((S >> num) & 1)){
      if(ch-1 == str[idx]){
        solve(idx+1,next,S|(1<<num));
      }else if(ch != 'z' && ((S >> (1+num)) & 1) && 
               ch == str[idx] && ((S >> num) & 1)){
        solve(idx+1,next,S);
      }
    }
  }
}

int main(){
  while(cin >> str, str != "#"){
    len = str.size();
    st.clear();
    solve(0,"",0);
    set<string>::iterator it;
    len = st.size();
    cout << len << endl;
    if(len <= 10){
      for(it = st.begin() ; it != st.end() ; ++it){
        cout << *it << endl;
      }
    }else{
      vector<string> vec;
      for(it = st.begin() ; it != st.end() ; ++it){
        vec.push_back(*it);
      }
      for(int i = 0 ; i < 5 ; i++){
        cout << vec[i] << endl;
      }
      for(int i = len-5 ; i < len ; i++){
        cout << vec[i] << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3396
import java.util.Scanner;

public class Main {

	private static final long x = (long) Math.pow(10, 18);

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		String c[] = new String[h];

		for (int i = 0; i < h; i++) {
			String s = sc.next();
			System.out.println(s);
			System.out.println(s);
		}

		sc.close();
	}

}


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


int main() {
 #define int long long
  int A,B,C,D,N;
  cin >> N;
  A=N-1;

  for(int i=2;(i*i)<=N;i++){
    if((N%i)==0&&((N/i)+i-2)<A){
      A=(N/i)+i-2;
    }
  }
cout << A << endl;

}



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

#define int long long 
#define ll long long 
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define ff first
#define ss second
#define vi vector<ll>
#define mod 1000000007
#define MOD 1000000007
#define full(a) a.begin(),a.end()
#define inf INT_MAX
#define minf INT_MIN
#define dd double
#define fori(x,n) for(ll i=x;i<n;i++)
ll dp[1000][1000];

ll fun(char a[][1000],ll i,ll j,ll n,ll m){
    if(i==n and j==m)return 1;
    if(dp[i][j]!=-1)return dp[i][j];

    ll ans=0;
    if(i+1<=n and a[i+1][j]!='#')ans=(ans+fun(a,i+1,j,n,m))%mod;
    if(j+1<=m and a[i][j+1]!='#')ans=(ans+fun(a,i,j+1,n,m))%mod;

    return dp[i][j]=ans;

}

int32_t main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    memset(dp,-1,sizeof dp);
    
    ll n,m;
    cin>>n>>m;
    char a[n][1000];

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


    cout<<fun(a,0,0,n-1,m-1)%mod;

    
    return 0;  
}
    

Measured memory_bytes: 12500
// SeeAlso: https://atcoder.jp/contests/abc155/tasks/abc155_c

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 200005
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int main() {
    ll n;
    map<string, int> m;
    cin >> n;
    rep(i, n) {
        string s;
        cin >> s;

        m[s]++;
        // if(m.at(s)==std::out_of_range) {

        // } else {
        //     m.insert(make_pair(s, 1));
        // }
    }

    set<string> ans;
    ll temp = 0;
    for(auto it =m.begin();it!=m.end();it++) {
        auto v = *it;
        if(temp<v.second) {
            ans.clear();
            temp = v.second;
            ans.insert(v.first);
        } else if (temp==v.second) {
            ans.insert(v.first);
        }
    }
    for(auto it =ans.begin();it!=ans.end();it++) {
        print(*it);
    }
    return 0;
}


Measured memory_bytes: 34560
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}



signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  while(1){
    int n;
    cin>>n;
    if(n == 0) break;
    vector<int> A(n);
    cin>>A;

    int sum = 0;
    for(int i=0;i<n;i++) sum += A[i];

    int ans = 0;
    for(int i=0;i<n;i++)
      if(A[i] * n <= sum) ans++;

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



Measured memory_bytes: 3168
H,W = map(int,input().split())
K = 0
L = 0
#条件分岐
#H = 奇数 W = 奇数
if H == 1:
    K = 1
elif W == 1:
    K = 1
elif H == 2:
    K = W
elif W == 2:
    K = H
else:
    if H%2 == 1 and W%2 == 1:
        K = (H//2+1)*(W//2+1)
        L = (H//2)*(W//2)
    #H = 奇数 W = 偶数
    elif H%2 == 1 and W%2 == 0:
        K = (H//2+1)*(W//2)
        L = (H//2)*(W//2)
    #H = 偶数 W = 奇数
    elif H%2 == 0 and W%2 == 1:
        K = (H//2)*(W//2+1)
        L = (H//2)*(W//2)
    else:
        K = H*(W//2)
        L = 0
print(K+L)


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int main(){
  int n;
  while(cin >>n,n){
    vector<pair<pair<int,int>, char> > team;
    map<int,char> team_n;
    char c;
    int x;
    for(int i=0; i<n; i++){
      cin >>c;
      team_n[-i] = c;
      team.push_back(make_pair(make_pair(0,0),-i));
      for(int j=0; j<n-1; j++){
	cin >>x;
	if(x == 0){team[i].first.first++;}
	if(x == 1){team[i].first.second--;}
      }
    }
    sort(team.begin(),team.end());
    for(int i=team.size()-1; i>=0; i--){
      cout <<team_n[team[i].second]<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1192
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
using namespace std;
typedef long long LL;
template<typename T>inline T chkmax(T A,T B){return A>B?A:B;}
template<typename T>inline T chkmin(T A,T B){return A<B?A:B;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
}
LL a[60],n,k,m;
int main()
{
	n=50;
	read(k);
	For(i,1,50)a[i]=(k/n)+n-1+(k%n?1:0);
	m=n-(k%n?k%n:n);
	while(m--)
	{
		LL Max=0,pos=0;
		For(i,1,n)if(a[i]>Max)Max=a[i],pos=i;
		For(i,1,n)if(i!=pos)a[i]++;
		a[pos]-=n;
	}
	printf("%lld\n",n);
	For(i,1,n)printf("%lld ",a[i]);
	puts("");
	return 0;
}


Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        BigInteger a = BigInteger.TEN.pow(n);
        BigInteger b = BigInteger.valueOf(9).pow(n).multiply(BigInteger.valueOf(2));
        BigInteger c = BigInteger.valueOf(8).pow(n);
        BigInteger d = BigInteger.TEN.pow(9).add(BigInteger.valueOf(7));

        System.out.println(
                c.subtract(b).add(a).remainder(d)
        );
    }
}


Measured memory_bytes: 88492
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    x,n=map(int,input().split())
    P = list(map(int,input().split()))
    n_lis = [0]*102
    for p in P:
        n_lis[p] += 1
    dis = 0
    while 1:
        if n_lis[x-dis] == 0:
            print(x-dis)
            break
        elif n_lis[x+dis] == 0:
            print(x+dis)
            break
        dis += 1

if __name__=='__main__':
    main()

Measured memory_bytes: 9144
from collections import defaultdict,deque, Counter
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
ans = 'Good'

S = input()
for _ in range(len(S)-1):
    if S[_] == S[_+1]: ans = 'Bad'


print(ans)

Measured memory_bytes: 21372
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp;
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque};
fn main() {
    input!(a:i64, b:i64);

    if a * b < 0 || a * b == 0 {
        println!("Zero");
    }else if a * b > 0 {
        if a > 0 {
            println!("Positive");
        }else{
            println!("{}", if ((b - a).abs() + 1) % 2 == 0 {"Positive"}else{"Negative"});
        }
    }
}


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

namespace AtCoder_Cs
{
	public class ABC86_A
	{
		public static void Main()
		{
			var lst = Console.ReadLine().Split(' ');
			var res = int.Parse(lst[0]) * int.Parse(lst[1]);

			var resString = (res % 2 == 0) ? "Even" : "Odd";
			Console.WriteLine($"{resString}");
		}

	}

}


Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
#include <cmath>
#define PI 3.14159265


int main(){
  double a, b, C;
  std::cin >> a >> b >> C;

  double theta = C * PI / 180.0;
  double S, c, L, h;

  S = a * b * sin(theta) / 2;

  c = sqrt(a*a + b*b - 2*a*b*cos(theta));
  L = a + b + c;

  h = 2 * S / a; // S = 1/2 * a * h

  printf("%.8lf\n%.8lf\n%.8lf\n", S, L, h);
}



Measured memory_bytes: 3436
INF = 99999999999
N = int(input())
a = list(map(int, input().split()))
ss = [0] * (N + 1)
s = 0
for i, n in enumerate(a):
    s += n
    ss[i + 1] = s


def psum(l, r):
    return ss[r] - ss[l]

min_ns = [[0, 0, 0, 0] for _ in range(N - 3)]

l = 1
for r in range(2, N - 1):
    min_n = abs(psum(0, l) - psum(l, r))
    while True:
        if l + 1 < r and min_n > abs(psum(0, l + 1) - psum(l + 1, r)):
            min_n = abs(psum(0, l + 1) - psum(l + 1, r))
            l += 1
        else:
            break
    min_ns[r - 2][0] = psum(0, l)
    min_ns[r - 2][1] = psum(l, r)

a.reverse()
s = 0
for i, n in enumerate(a):
    s += n
    ss[i + 1] = s

l = 1
for r in range(2, N - 1):
    min_n = abs(psum(0, l) - psum(l, r))
    while True:
        if l + 1 < r and min_n > abs(psum(0, l + 1) - psum(l + 1, r)):
            min_n = abs(psum(0, l + 1) - psum(l + 1, r))
            l += 1
        else:
            break
    min_ns[N - r - 2][2] = psum(0, l)
    min_ns[N - r - 2][3] = psum(l, r)

ans = INF
for l in min_ns:
    ans = min(ans, max(l) - min(l))
print(ans)


Measured memory_bytes: 69112
N, K = map(int, input().split())
a = [[int(t) for t in input().split()] for d in range(N)]
a.sort(key=lambda x: x[1], reverse=True)
x=[]
y=[]
st = set()

for i in range(K):
    t, d = a[i]
    if(t in st):
        x.append(d)
    else:
        y.append(d)
        st.add(t)
        
X = sum(x)
Y = sum(y)
V = len(y)
res = X + Y + V ** 2

for i in range(K, N):
    if not x:
        break
    t, d = a[i]
    if t in st:
        continue
    st.add(t)
    X -= x.pop()
    Y += d
    V += 1
    res = max(res, X + Y + V ** 2)
    
print(res)

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

using namespace std;

#define INF 9999999999;
#define D(x) cout << x << endl;

typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;

int n, m;
int g[10][10];

int ans;
bool used[10];
void dfs(int v, int cnt) {
  if (cnt == n) {
    ans++;
    return;
  }
  used[v] = 1;
  for (int i = 0; i < n; i++) {
    if (!used[i] && g[v][i]) {
      dfs(i, cnt + 1);
    }
  }
  used[v] = 0;
}

int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a][b] = g[b][a] = 1;
  }

  dfs(0, 1);
  D(ans);

  return 0;
}


Measured memory_bytes: 256
<?php
$C=str_split(fgets(STDIN));
$s='';
foreach($C as $c){
	$n=ord($c);
	if(65<=$n && $n<=90)$s.=chr($n+32);
	elseif(97<=$n && $n<=122)$s.=chr($n-32);
	else $s.=$c;
}
echo $s;

Measured memory_bytes: 15452
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define h1 7897897897897897
#define h2 7897466719774591
#define b1 98762051
#define b2 98765431
#define inf 1000000000
#define pi 3.1415926535897932384626
#define LMAX 9223372036854775807
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a));
#define all(x) (x).begin(), (x).end()
#define flush fflush(stdout)
#define debug printf("Hello\n")
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
int n, m, k, x, y, sum, cnt, ans;
int main () {
	ios::sync_with_stdio(false);
	cin.tie(0);
	scanf("%d", &n);
	multiset<int>m;
	FOR(i, 0, n-1) {
		scanf("%d", &x);
		if (i==0) {
			m.insert(x);
		  continue;
		}
		auto it = m.lower_bound(x);
		if (it == m.begin()) {
			m.insert(x);
		} else {
			it--;
			int tmp = *it;
			m.erase(it);
			m.insert(x);
		}
	}
	printf("%d\n", m.size());
	
	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

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

	
	int N;
	cin >> N;

	int G = 0;
	rep(i, N) {
		int A, K;
		cin >> A >> K;
		if (K > 10000) {
			while (A % K) {
				int kari = (A + K - 1) / K;
				int amari = A % K;
				int hiku = (amari + kari - 1) / kari * kari;
				A -= hiku;
			}
		}
		else {
			while (A % K) {
				A = (ll)A * (K - 1) / K;
				if (A < K) {
					A = 0;
					break;
				}
			}
		}
		G ^= A / K;
	}
	
	if (G) co("Takahashi");
	else co("Aoki");

	Would you please return 0;
}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] h = new int[N];
		for(int i = 0; i < N; i++)
			h[i] = sc.nextInt();
		int[] dp = new int[N];
		Arrays.fill(dp, 1000000000);
		dp[0] = 0;
		for(int i = 0; i < N; i++)
			for(int j = 1; j <= K;j++)
				if(i+j < N)
					dp[i+j] = Math.min(dp[i+j], dp[i]+Math.abs(h[i]-h[i+j]));
		System.out.println(dp[N-1]);
	}

}

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

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

    vector<bool> A_odd_is_true(N, true);
    for(int i = 0; i < N; ++i){
        if(A[i] % 2 == 0) A_odd_is_true[i] = false;
    }

    int odd_sum = accumulate(A_odd_is_true.begin(), A_odd_is_true.end(), 0);
    if( odd_sum % 2 !=0 ){
        cout << "NO" << "\n";
    }else{
        cout << "YES" << "\n";
    }

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int h, w;
    cin >> h >> w;
    string a;
    
    for(int i = 0; i < w+1; ++i){
        cout << "#";
    }
    cout << "#" << endl;
    
    vector<string> x(h);
    for(int i = 0; i < h; ++i){
        cin >> x.at(i);
    }
    
    for(int i = 0; i < h; ++i){
        cout << "#" << x.at(i) << "#" << endl;
    }
    
    for(int i = 0; i < w+1; ++i){
        cout << "#";
    }
    cout << "#" << endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long int llint;

int main(){
	int n, m, i, j, a=0;
	cin>>n;
	string s[n];
	int ans[n];
	for(i=0; i<n; i++) ans[i]=0;
	for(i=0; i<n; i++) cin>>s[i];
	cin>>m;
	string t;
	for(i=0; i<m; i++){
		cin>>t;
		for(j=0; j<n; j++){
			if(t==s[j]) {
				s[j]="0";
				break;
			}
		}
	}
	for(i=0; i<n; i++){
		for(j=i; j<n; j++){
			if(s[i]==s[j] && s[i]!="0") ans[i]++;
		}
	}
	for(i=0; i<n; i++){
		if(a<ans[i]) a=ans[i];
	}
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>

int main(){
  int A, B; std::cin >> A >> B;
  std::vector<std::string> m(100);
  for(auto i=0; i<50; ++i)
    m[i] = std::string(100, '#');
  for(auto i=50; i<100; ++i)
    m[i] = std::string(100, '.');

  auto c = 0;
  auto l = 1;
  for(auto i=1; i<A; ++i){
    m[l][c] = '.';
    c += 3;
    if(c >= 100){
      ++l;
      c %= 100;
    }
  }
  c = 0;
  l = 51;
  for(auto i=1; i<B; ++i){
    m[l][c] = '#';
    c += 3;
    if(c >= 100){
      ++l;
      c %= 100;
    }
  }

  std::cout << "100 100\n";
  for(auto i=0; i<100; ++i)
    std::cout << m[i] << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

int main(){
    int n,k; cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(all(a));
    int su = 0;
    rep(i,k) su += a[i];
    cout << su << endl;
    return 0;
}

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

using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    int res = 0;
    for (int i = 0; i < 3; i++) {
        res += s[i] == t[i];
    }
    cout << res;
    return 0;
}


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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(10);
    /*start*/
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    int index = 0;
    int ans = n * 2;
    rep(i, n)
    {
        string a = s.substr(n - 1 - i, i + 1);
        string b = t.substr(0, i + 1);
        if (a == b)
        {
            index = a.size();
        }
    }
    c(ans - index);
    return 0;
}

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

int n,h,e[N],f[N],g[N];

int get(int x){
	return f[x]==x?x:f[x]=get(f[x]);
}

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}
 
int main(){
	n=read();h=read();
	for (int i=0;i<=2*h;i++) f[i]=i;
	for (int i=1;i<=n;i++){
		int a=read(),b=read(),c=read(),d=read();
		int l=(c?-c:a)+h,r=(d?d:-b)+h;
		e[l]++;e[r]--;f[get(l)]=get(r);g[f[r]]=1;
	}
	for (int i=0;i<=h-1;i++)
		if (e[i]>0) {printf("NO\n");return 0;}
	for (int i=h+1;i<=2*h;i++)
		if (e[i]<0) {printf("NO\n");return 0;}
	for (int i=0;i<=2*h;i++)
		if (e[i]) g[get(i)]=0;
	for (int i=0;i<=2*h;i++)
		if (f[i]==i&&g[i]) {printf("NO\n");return 0;};
	printf("YES\n");return 0;
}

Measured memory_bytes: 256