akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const ll LL_INF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  string s;
  while(N != 0){
    if(N & 1){
      if(N < 0){
        N = (abs(N) + 1) / 2;
      }else{
        N = - N / 2;
      }
      s = '1' + s;
    }else{
      N = - N / 2;
      s = '0' + s;
    }
  }
  if(s.empty()) cout << 0 << endl;
  else cout << s << endl;
  return 0;
}


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

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

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

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

  int n;
  cin >> n;
  map<int, int> a;
  rep(i, n) {
    int x;
    cin >> x;
    a[x]++;
  }

  if (3 < a.size()) {
    cout << "No" << endl;
    return 0;
  }

  auto it = a.begin();

  vector<int> aa, cnt;
  while (it != a.end()) {
    aa.push_back(it->first);
    cnt.push_back(it->second);
    it++;
  }

  if (aa.size() == 1) {
    if (aa[0] == 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    return 0;
  }

  if (aa.size() == 2) {
    if (aa[0] != 0) {
      cout << "No" << endl;
      return 0;
    }
    if (cnt[0] == 1 && cnt[1] == 2) {
      cout << "Yes" << endl;
      return 0;
    }
    if (cnt[0] * 2 == cnt[1]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    return 0;
  }

  if ((aa[0] ^ aa[1]) != aa[2]) {
    cout << "No" << endl;
    return 0;
  }

  if (cnt[0] == cnt[1] && cnt[0] == cnt[2]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 3840
using System;
 
class ABC_163_C
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string[] input = Console.ReadLine().Split(' ');
        int[] ans = new int[N];
 
        for (int i = 0; i < N-1; i++)
        {
            int p = int.Parse(input[i]);
            ans[p-1]++; 
        }
 
        for (int i = 0; i < N; i++)
        {
        	Console.WriteLine(ans[i]);
        }
 
	}
}

Measured memory_bytes: 42040
#include<bits/stdc++.h>
#define pb push_back 
#define mp make_pair
using namespace std;

const int maxn=90007;
typedef long long ll;

ll n,m,ans;
ll a[307][307];
ll f[307];

ll dis[307][307];

struct edge{
	ll x,y,z;
};

vector<edge>e;

bool operator<(const edge &a,const edge &b)
{
	if(a.z<b.z) return 1;
	return 0;
}

/*
ll find(ll x)
{
	if(f[x]==x) return x;
	return f[x]=find(f[x]);
}

void link(ll x,ll y,ll z)
{
	ll tx=find(x);
	ll ty=find(y);
	if(tx==ty) return;
	dis[x][y]=dis[y][x]=z;
	ans+=z;
	f[ty]=tx;
	return;
}
*/

int main()
{
	ll i,j,k,T;
	cin>>n;

	for(i=1;i<=n;++i) f[i]=i;
	
	for(i=1;i<=n;++i)
	for(j=1;j<=n;++j)
	{
		if(i==j) dis[i][j]=0;
		else dis[i][j]=2e9+7;
		scanf("%d",&a[i][j]);
		if(i<j)
		{
			edge t;
			t.x=i,t.y=j,t.z=a[i][j];
			e.pb(t);
		}
	}
	sort(e.begin(),e.end());
	
	for(int p=0;p<e.size();++p)
	{
		ll x=e[p].x;
		ll y=e[p].y;
		ll z=e[p].z;
		
		if(dis[x][y]<z)
		{
			return 0*printf("-1\n");
		}
		
		if(dis[x][y]>z)
		{
			dis[x][y]=dis[y][x]=z;
			ans+=z;
			
			k=x;
			for(i=1;i<=n;++i)
			for(j=1;j<=n;++j)
			{
				if(i!=j&&i!=k&&j!=k)
				{
					dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
				}
			}
			
			k=y;
			for(i=1;i<=n;++i)
			for(j=1;j<=n;++j)
			{
				if(i!=j&&i!=k&&j!=k)
				{
					dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
				}
			}
			
		}
	}
	
	for(k=1;k<=n;++k)
	for(i=1;i<=n;++i)
	for(j=1;j<=n;++j)
	{
		if(i!=j&&i!=k&&j!=k)
		{
			dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
		}
	}
	
	for(i=1;i<=n;++i)
	for(j=1;j<=n;++j)
	{
		if(dis[i][j]!=a[i][j])
		{
			return 0*printf("-1\n");
		}
	}
	
	cout<<ans<<endl;
	
	return 0;
}


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

namespace CSharpSample01
{

	class Program
	{

		static void Main(string[] args)
		{
			var inputNum = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			var N = inputNum[0];
			var M = inputNum[1];

			long taskNum = Console.ReadLine().Split(' ').Select(int.Parse).Sum();

			var answer = N - taskNum;

			if (answer >= 0)
			{
				Console.WriteLine(answer);
			}
			else
			{
				Console.WriteLine(-1);
			}


		}
	}
}

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

int main() {
  int n;
  cin>>n;
  string s, t;
  cin>>s>>t;
  for (int i=0; i<n; i++) {
    bool flag = true;
    for (int j=0; i+j<n; j++) {
      if (s[i+j] != t[j]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      cout<<n + i<<endl;
      return 0;
    }
  }
  cout<<2 * n<<endl;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
*A, = map(int,input().split())
*B, = map(int,input().split())

A += [-1]
B += [-1]
A.sort(reverse=True)
B.sort(reverse=True)

mod = 10**9+7
for a,b in zip(A[:-1],A[1:]):
    if a==b:print(0);exit()
for a,b in zip(B[:-1],B[1:]):
    if a==b:print(0);exit()

i=0
j=0
ans = 1
for n in range(N*M,0,-1):
    while A[i]>n:i+=1
    while B[j]>n:j+=1
    if A[i]==B[j]==n:continue
    elif A[i]==n:
        ans *= j
        j-=1
    elif B[j]==n:
        ans *= i
        i-=1
    else:
        ans *= max(0,i*j - (N*M-n))
        i-=1
        j-=1
    ans %= mod
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <functional>
#include <algorithm>

using namespace std;
int main()
{
	int i, j;
	int num[5];
	
	for(i = 0; i < 5; i++)
	{
		cin >> num[i];
	}
	
	stable_sort(num, num + 5, greater<int>());
	
	for(i = 0; i < 4; i++)
	{
		cout << num[i] << " ";
	}
		
		cout << num[4] << endl;
	
	return 0;
}

Measured memory_bytes: 1220
N = int(input())
ans = [0] * (N + 1)   

for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            a = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if a <= N:
                ans[a] += 1
                
for i in range(1, N+1):
    print(ans[i])

Measured memory_bytes: 74464
#include<bits/stdc++.h>
using namespace std;
//#define int long long
typedef pair<int,int> P;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define vi vector<int>
#define vvi vector<vector<int>>

int n,k;
vi imos(200010,0);
void display(vector<int>&a){
    rep(i,0,n){
        cout<<a[i];
        if(i!=n-1){cout<<' ';}
    }
    cout<<endl;
}

void query(vector<int>&a){
    rep(i,0,n){
        imos[max(0,i-a[i])]++;
        imos[min(200001,i+a[i]+1)]--;
        }
    rep(i,1,200010){
        imos[i]+=imos[i-1];
    }
    rep(i,0,n){
        a[i]=imos[i];
        imos[i]=0;
    }
}



signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>n>>k;
    vi a(n);
    rep(i,0,n){
        cin>>a[i];
    }
    if(k > 1+(int)(-1+sqrt(-1+8*n))/2){
        rep(i,0,n){
            a[i]=n;
        }
    }
    else{rep(i,0,k)query(a);}
    rep(i,0,n){
        cout<<a[i];
        if(i!=n-1){cout<<' ';}
    }
    cout<<endl;
}

Measured memory_bytes: 4792
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>

typedef  long long ll;
#define mop 1000000007
#define mop2 998244353

using namespace std;

int main() {
	
	ll n, m;
	cin >> n >> m;
	for (ll i = 0; i < m; i++) {
		ll tmp;
		cin >> tmp;
		n -= tmp;
	}
	cout << max(-1LL, n) << endl;

	
}


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



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int s,w;
    cin>>s>>w;
    if(s<=w) cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
}/*
./problem.exe
*/

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

int gcd(long long a, long long b){
  long long M = max(a, b), m = min(a, b);
  while(m != 0){
  	long long r = M%m;
    M = m; m = r;
  }
  return M;
}

int digit_sum(long long n){
  long long ans;
  while(n != 0){
  	ans += n%10;
  	n /= 10;
  }
  return ans;
}

int main(){
  int m, d;
  cin >> m >> d;
  if(d < 22){
  	cout << 0 << endl;
  }
  else{
  	int ans;
  	int count;
  	for(int i = 22; i <= d; i++){
      	if(i/10 != 1 && i%10 != 0 && i%10 != 1){
          
        
    	if((i/10)*(i%10) <= m){
        	count++;
        }}
    }
  cout << count << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD =  1000000007;
const int INF = 1e11;
using Graph = vector<vector<int>>;

signed main(){

  //100以下の素数
  vector<int> prime;
  for( int i = 2; i <= 100; i++ ){
    bool fg = 1;
    for( int j = 2; j < i; j++ ){
      if( i%j == 0 ) fg = 0;
    }
    if( fg ) prime.push_back(i);
  }

  int N;
  cin >> N;

  int p = (int)prime.size();

  //N!の素因数分解
  vector<int> fac(p+10);
  for( int i = 1; i <= N; i++ ){
    int n = i;
    for( int j = 0; j < p; j++ ){
      while( n%prime[j] == 0 ){
        n /= prime[j];
        fac[j]++;
      }
    }
  }

  int ans = 0;

  //p^74
  for( int i = 0; i < p; i++ ){
    if( fac[i] >= 74 ) ans++;
  }

  //p^2*q^24 or p^4*q^14
  for( int i = 0; i < p; i++ ){
    for( int j = 0; j < p; j++ ){
      if( i == j ) continue;
      int a = fac[i];
      int b = fac[j];
      if( a>=2 && b>=24 ) ans++;
      if( a >= 4 && b >= 14 ) ans++;
    }
  }

  //p^2*r^4*r^4
  for( int i = 0; i < p; i++ ){
    for( int j = 0; j < p; j++ ){
      for( int k = j+1; k < p; k++ ){
        if( i == j || i == k ) continue;
        if( fac[i] >= 2 && fac[j] >= 4 && fac[k] >= 4 ) ans++;
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3608
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

LL N, M;
string S;
vector<LL>lef, rht;

int dp[3456][10000];

int main(void)
{
	cin >> N >> M;
	cin >> S;
	lef.push_back(0);
	rht.push_back(0);
	for (int i = 0; i < M; ++i)
	{
		LL l, r;
		cin >> l >> r;
		--l;
		if (lef.back() == l)
		{
			rht[rht.size() - 1] = max(rht.back(), r);
		}
		else
		{
			assert(lef.back() < l);
			if (rht.back() < r)
			{
				lef.push_back(l);
				rht.push_back(r);
			}
		}
	}
	if (rht[0] == 0)
	{
		lef.erase(lef.begin());
		rht.erase(rht.begin());
	}
	vector<bool>flag(N);
	int K = lef.size();
	assert(K == rht.size());
	for (int i = 0; i < K; ++i)
	{
		for (int j = lef[i]; j < rht[i]; ++j)
		{
			flag[j] = true;
		}
	}
	for (int i = 0; i < N; ++i)
	{
		if (!flag[i])
		{
			lef.push_back(i);
			rht.push_back(i + 1);
		}
	}
	sort(lef.begin(), lef.end());
	sort(rht.begin(), rht.end());

	//rendを求める
	vector<LL>rend(N);
	for (LL ll : lef)rend[ll]++;
	for (int i = 1; i < N; ++i)rend[i] += rend[i - 1];
	for (int i = 0; i < N; ++i)rend[i] = rht[rend[i] - 1];
	rend.push_back(rend.back());

	//oneを求める
	vector<LL>one;
	one.push_back(0);
	for (char c : S)one.push_back(c - '0');
	for (int i = 0; i < N; ++i)one[i + 1] += one[i];

	const LL MOD = 1000000007;
	//仮想的にdp[-1][0] = 1,dp[-1][n] = 0と置く
	dp[0][one[rend[0]]] = 1;
	//配るDP
	for (int i = 0; i < N; ++i)
	{
		LL P = one[rend[i + 1]] - one[rend[i]];
		for (int j = 0; j <= N; ++j)
		{
			int jj = j + P;
			if (j > 0)
			{
				dp[i + 1][jj - 1] += dp[i][j];//1
				dp[i + 1][jj - 1] %= MOD;
			}
			if (rend[i] - i - j > 0)
			{
				dp[i + 1][jj] += dp[i][j];//0
				dp[i + 1][jj] %= MOD;
			}
		}
	}
	LL ans = dp[N][0];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 117888
#include <bits/stdc++.h>
#define rep(i, l, r) for (__typeof(l) i = (l); i <= (r); ++i)
#define per(i, r, l) for (__typeof(r) i = (r); i >= (l); --i)
using namespace std;
typedef long long ll;
const int mod = 998244353;
int read() {
	int f = 1, x = 0; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return f * x;
}
int qpow(int a, int b) { int res = 1; while (b) { if (b & 1) res = (ll)res * a % mod; a = (ll)a * a % mod; b >>= 1; } return res; }

ll dp[35][35];
ll DP(ll t, ll x) {
	if (!t) return dp[t][x] = 1;
	if (~dp[t][x]) return dp[t][x];
	ll ans = 0;
	for (int d = 0; d <= 9; ++d) if (abs(x - d) <= 1) ans += DP(t-1, d);
	return dp[t][x] = ans;
}
ll d[35], m;
ll calc(ll x) {
	m=0;
	while(x) d[++m]=x%10,x/=10;
	ll answ=0;
	rep(i,1,m-1) 
		rep(j,1,9)
			answ+=DP(i-1,j); 
	ll lst=-1;
	per(i,m,1) {
		rep(j,(i==m)?1:0,d[i]-1){
			if(abs(j-lst)<=1||lst==-1) answ+=DP(i-1,j);
		}
		if(abs(d[i]-lst)<=1||lst==-1) lst=d[i];
		else break;
	}
	return answ;
}
int main() {
	memset(dp, -1, sizeof(dp));
	int k;
	cin >> k;
	ll l = 1, r = 1e10, ans = 0;
	while (l <= r) {
		ll mid = (l + r) >> 1;
		if (calc(mid + 1) >= k) ans = mid, r = mid - 1;
		else l = mid + 1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
K,N = [int(i) for i in input().split()]
AAA = [int(i) for i in input().split()]

BBB = []

for i in range(N-1):
    BBB.append(AAA[i+1]-AAA[i])
BBB.append(K-AAA[-1]+AAA[0])
#print(BBB)
print(K-max(BBB))

Measured memory_bytes: 86220
#include<stdio.h>
int main(void){
	int a,b,c,k;
	scanf("%d %d %d %d", &a, &b, &c, &k);
	
	if(k<=a)
	{
		printf("%d",k);
	}
	else if(k<=a+b){
		printf("%d",a);
	}
	else{
		printf("%d",2*a+b-k);
	}
}

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

/* n の約数を列挙する関数 O(sqrt(n)) */
vector< long long > divisor(long long n) {
	vector< long long > ret;
	for (long long i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret));
	return (ret);
}

/* a と b の最大公約数を返す関数 O(loga) */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

bool coprime(long long a, long long b) {
	if (GCD(a, b) == 1) return true;
	else return false;
}

bool is_prime(long long n) {
	switch (n) {
	case 0: // fall-through
	case 1: return false;
	case 2: // fall-through
	case 3: return true;
	} // n > 3 が保証された

	if (n % 2 == 0) return false;
	if (n % 3 == 0) return false;
	// 2と3の倍数でないので6の倍数ではないことが保証された

	if (n % 6 != 1 && n % 6 != 5) return false;
	// 6の倍数前後の数(素数かもしれない数)であることが保証された

	// 6の倍数前後の数を使って試し割りをする
	for (long long i = 5; i*i <= n; i += 6) {
		if (n%i == 0) return false; // 6n-1
		if (n % (i + 2) == 0) return false; // 6n+1
	}

	return true;
}

int main() {

	long long A, B; cin >> A >> B;
	long long gcd = GCD(A, B);
	vector<long long> yakusuu = divisor(gcd);
	int count = 0;

	for (long long i = 0; i < yakusuu.size(); i++) {
		if (is_prime(yakusuu[i])) count++;
	}

	//1の分
	count++;

	cout << count << endl;

}

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

using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "
#define cout(n) cout<<fixed<<setprecision(n)
int main(){
  ll N;
  cin>>N;
  vector<ll> a(N);
  vector<ll> b(N);
  cinv(a,0,N);
  cinv(b,0,N);
  ll res=0;
  FOR(i,0,N){
    res+=b[i];
  }
  res+=a[0];
  ll inst = res;
  FOR(i,0,N-1){
    inst+= a[i+1]-b[i];
    if(res<inst) res=inst;
  }
  cout<<res<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

int main()
{
	int N, A, B;
	std::cin >> N >> A >> B;
	
	std::cout << std::min(N * A, B) << "\n";
}


Measured memory_bytes: 256
# 2019/08/06

N=int(input())

def solve(N,h,n):
    
    if (4*h*n-(N*n)-(N*h)) and (N*h*n)%(4*h*n-(N*n)-(N*h))==0:
        return (N*h*n)//(4*h*n-(N*n)-(N*h))
    else: return 0
lim=3500
for h in range(1,lim+1):
    if 1/h>=4/N:continue
    for n in range(1,lim+1):
        w=solve(N,h,n)
        if w>0:
            print(h,n,w)
            exit()

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

int main() {
    long long int n, k;

    scanf("%lld%lld", &n, &k);

    long long int ans = 0;

    ans += (n/k) * (n/k) * (n/k);

    if (k % 2 == 0 && n >= k / 2) {
        long long int t = (n - k/2)/k + 1;
        ans += t*t*t;
    }

    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 128
// Remeber Choose Compiler: GCC9
#include <bits/stdc++.h>

using namespace std;

// Debug Output Utility
#ifdef LOCAL
#define dbg(args...)             \
    do {                         \
        cout << #args << " -> "; \
        err(args);               \
    } while (0)
void err() { std::cout << std::endl; }
template <typename T, typename... Args>
void err(T a, Args... args) {
    std::cout << a << ' ';
    err(args...);
}
template <template <typename...> class T, typename t, typename... A>
void err(const T<t> &arg, const A &... args) {
    for (auto &v : arg)
        std::cout << v << ' ';
    err(args...);
}
#else
#define dbg(...)
#endif

// Macro Definitions:
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

// Type Alias:
using int64 = long long;
using PII   = pair<int, int>;

// Global Const Variable
const int64 INF = 0x3f3f3f3f3f3f3f3f;
const int MOD   = 1000000007;
const int MAXN  = 200005;

int a[7][7], tmp[7][7];

void run() {
    int n,m,k,ans=0;
    cin >> n >> m >> k;
    string s;
    for(int i=0;i<n;i++) {
        cin >> s;
        for(int j=0;j<m;j++) a[i][j] = s[j];
    }
    for(int i=0;i<(1<<(n+m));i++) {
        memcpy(tmp,a,sizeof(a));
        for(int j=0;j<n+m;j++) {
            if(i&(1<<j)) {
                if(j<n) for(int p=0;p<m;p++) tmp[j][p]='.';
                else for(int p=0;p<n;p++) tmp[p][j-n]='.'; 
            }
        }
        int cnt = 0;
        for(int i=0;i<n;i++) {
            for(int j=0;j<m;j++) {
                if(tmp[i][j]=='#') cnt++;
            }
        }
        if(cnt==k) ans++;
    }
    cout << ans << endl;
}

// Debug Input Redirection
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif
    run();
}


Measured memory_bytes: 3656
n = int(input())

ans = 0
if n >= 10:
    ans += 9
if n >= 1000:
    ans += 900
if n >= 100000:
    ans += 90000

if n < 10:
    ans += n 

if n < 1000 and n >= 100:
    ans += n - 100 + 1

if n < 100000 and n >= 10000:
    ans += n - 10000 + 1

print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,a,A=0,B=0,O=0,AB=0;
  char s[5];
  while(scanf("%d,%s",&a,s)!=EOF){
    if(s[0]=='A' && s[1]=='B'){
      AB++;
    }
    else if(s[0]=='B'){
      B++;
    }
    else if(s[0]=='O'){
      O++;
    }
    else if(s[0]=='A'){
      A++;
    }
  }
  cout << A << endl << B << endl << AB << endl << O << endl;
}

Measured memory_bytes: 1208
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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


int main(){
ll x,a;
cin>>x>>a;
if(x<a){
    cout<<0<<endl;
}
else{
    cout<<10<<endl;
}
}









Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
#define int long long
int32_t main() {
  string s ;
  cin >> s ;
  int sum = 0 ;
  for (auto x : s ) sum += (x - '0') ;
  if (sum % 9 == 0 ) cout << "Yes" << endl ;
  else cout << "No" << endl ;
}

Measured memory_bytes: 3724
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;
list<long long int> Prime(int M) {
	list<long long int>P;
	P.push_back(2);
	P.push_back(3);
	for (int i = 5; i <= M; i += 6) {
		bool flag = true;
		for (auto j : P) {
			if (i%j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i);
		flag = true;
		for (auto j : P) {
			if ((i + 2) % j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i + 2);
	}
	return P;
}
long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H;
long long int ans;

int main() {
	ios::sync_with_stdio(false);
	cin >> N >> M;
	ans = 1;
	if (abs(N - M) > 1) {
		cout << "0\n";
		return 0;
	}
	if (N == M) {
		for (long long int i = N; i > 1; i--) {
			ans *= i;
			ans %= MOD;
		}
		ans *= ans;
		ans %= MOD;
		ans *= 2;
		ans %= MOD;
		cout << ans << endl;
		return 0;
	}
	for (long long int i = M; i > 1; i--) {
		ans *= i;
		ans %= MOD;
	}
	for (long long int i = N; i > 1; i--) {
		ans *= i;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))


def main():
    n, k = map(int, input().split())
    ab = [tuple(map(int, input().split())) for _ in range(n)]
    ans = 0
    for a, b in ab:
        if k | a == k:
            ans += b
    
    for j in range(30):
        if (k>>j)&1:
            k ^= (1<<j)
            tmp = 0
            for a, b in ab:
                if k | a == k:
                    tmp += b
            ans = max(ans, tmp)
        k ^= (1<<j)
    
    print(ans)


if __name__ == '__main__':
    main()


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

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  rep(i,h) cin >> s[i];
  int ans = 0;
  rep(is,1<<h)rep(js,1<<w) {
    int cnt = 0;
    rep(i,h)rep(j,w) {
      if (is>>i&1) continue;
      if (js>>j&1) continue;
      if (s[i][j] == '#') cnt++;
    }
    if (cnt == k) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int main(void)
{
	vector<bool> buf(55556, true);
	buf[0] = buf[1] = false;

	vector<int> prime;
	for(int i=0; i<buf.size(); i++){
		if(buf[i] == false)
			continue;

		prime.push_back(i);
		for(int j=2*i; j<buf.size(); j+=i)
			buf[j] = false;
	}

	vector<int> ret;
	for(int i=0; i<prime.size(); i++)
		if(prime[i]%5 == 1)
			ret.push_back(prime[i]);

	int N;
	cin >> N;

	for(int i=0; i<N; i++)
		cout << ret[i] << (i==N-1 ? '\n' : ' ');

	return 0;
}


Measured memory_bytes: 256
import fractions


n,m=map(int,input().split())
A=list(map(lambda x: int(x)//2,input().split()))

lcm=A[0]
for i in range(1,n):
    lcm=lcm*A[i]//fractions.gcd(lcm,A[i])
    if lcm>m:
        print(0);exit()

if any([i for i in range(n) if lcm%(A[i]*2)==0]):
    print(0);exit()

ans=m//(2*lcm)
print(ans if (m//lcm)%2==0 else ans+1)

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

string f(string s) {
    string t;

    bool continue2 = false;

    for (int i = 0; i < s.size(); ++i) {
        if (continue2) {
            continue2 = false;
            continue;
        }

        if (i == s.size()-1) {
            t += s[i];
            continue;
        }
        
        if (s[i] == '(' && s[i+1] == ')') {
            continue2 = true;
            continue;
        }

        t += s[i];
    }

    if (s == t) {
        return t;
    }

    return f(t);
}

int main() {

    int n; cin >> n;
    string s; cin >> s;

    string t = f(s);

    int l = 0;
    int r = 0;

    for (int i = 0; i < t.size(); ++i) {
        if (t[i] == ')') {
            ++l;
        } else {
            ++r;
        }
    }

    string ans = "";

    for (int i = 0; i < l; ++i) {
        ans += '(';
    }

    ans += s;

    for (int i = 0; i < r; ++i) {
        ans += ')';
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef int int__;
#define int long long
#define pb push_back
#define pi pair<int,int>
#define vpi vector<pi>
#define vi vector<int>
#define vvi vector<vi>
#define fi first
#define se second
#define forn(i, n)for(int i=0;i<int__(n);i++) 
#define sz(a)int__(a.size())
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a){return out << "(" << a.first << ", " << a.second << ")";}
template<class A>ostream& operator<<(ostream& out,const vector<A>&v){out<<"[";forn(i,sz(v)){if(i)out<<", ";out<<v[i];}return out<<"]";}
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
int Mod(int x){const int mm=1e9 + 7;x%=mm;if(x<0)x+=mm;return x;}
int Pow(int x,int n){if(n==0)return 1;int t=Pow(x,n/2);t=Mod(t*t);if(n&1)t=Mod(t*x);return t;}
#define watch(x) cout << #x << " : " << x << endl;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
#define all(x) x.begin(), x.end()

const int mod = 1e9 + 7;

int__ main() {
	fast;

	int n; cin >> n;
	vi a(n);

	int mx = 0;
	for(int i=0;i<n;i++) {cin >> a[i]; mx = max(mx,a[i]);}

	vvi v(mx+1);
	
	for(int i=0;i<n;i++) {
		int x = a[i];
		
		for(int j=2;j*j<=a[i];j++) {
			int c=0;
			while(x%j==0) {
				x /= j;
				c++;
			}

			if(c > 0) v[j].pb(c);
		}

		if(x > 0) v[x].pb(1);
	}

	int L=1;

	for(int i=2;i<=mx;i++) {
		if(v[i].size() == 0) continue;

		int max_fac=0;
		for(int x:v[i]) max_fac=max(max_fac,x);

		L = Mod(L * Pow(i,max_fac));
	}


	int ans = 0;
	for(int i=0;i<n;i++) {
		int x = Mod(L * Pow(a[i],mod-2));
		ans = Mod(ans + x);
	}

	cout << ans << endl;
}	

Measured memory_bytes: 24320
// HTTF.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define YESNO OUT(three(solve(),YES,NO))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(a);i>=(LL)(b);i--)
#define REP(i,b) FOR(i,zero,b)
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b,zero)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define int LL
#define pb emplace_back
#define eb pb

using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef long long LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr, Vpr, greater<pr> > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5e5 + 1000;
const int SIZE2 = 3010;
const int SIZE3 = 330;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p = 7 + 1e9;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
typedef pair<ld, ut> pld;

#define endl "\n" //インタラクティブでは消す
ut N, M, K, L, Q, D, H, W;
// ut A,B,C,D,E,F,G,H,I,J,O,P,Q,R,T,U;
VI edges[SIZE];
LL vals[SIZE], maps2[SIZE2][SIZE2], answer = zero;
LL maps[SIZE2][SIZE2];
LL DP[SIZE];
bool finished[SIZE];
LL A[SIZE];
string s, t;
LL solve2(LL x) {
	if (finished[x]) return DP[x];
	finished[x] = true;
	
	for (auto next : edges[x]) {
		MX(DP[x], solve2(next) + 1);
	}
	return DP[x];
}
LL solve() {
	cin >> N >> M;
	REP(i, M) {
		int a, b;
		cin >> a >> b;
		edges[a].pb(b);
		A[b] = 1;
	}
	LL ans = 0;
	EFOR(i, 1, N) {
		if (A[i] == 0) {
			MX(ans, solve2(i));
		}
	}
	cout << ans << endl;
	return 0;
}




//!!!!!!!!!!!!!!!!!!!実装を詰める!!!!!!!!!!!!!!!!!!!!!!!!!
signed main() {

	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(12);
	solve();
	cin >> N;
	return 0;

}

Measured memory_bytes: 23296
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	while(scan.hasNext()) {
	    String input = scan.nextLine();
	    String[] inputs = input.split(" ");
	    int a = Integer.parseInt(inputs[0]);
	    int b = Integer.parseInt(inputs[1]);
	    int c = Integer.parseInt(inputs[2]);
	    int count = 0;
	    for (int i = a; i <= b; i++) {
		if (c % i ==0) {
		    count++;
		}
	    }
	    System.out.println(count);
	}
    }
}

Measured memory_bytes: 26248
#include "bits/stdc++.h"
using namespace std;
//#define int long long
#define repo(i, begin, end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define ll long long
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<"  ";
#define fastr ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,a,b) for(int i = a; i < b; i++)
#define rrep(i,a,b) for(int i = (a-1); i >= b; i--) 
#define fi first
#define se second
#define tit(v,i,c) get<c>(v[i])
#define mt make_tuple 
#define pb push_back
#define eb emplace_back
#define mp make_pair
double jk=0.004;
#define power(x,y) pow(x,y)+jk
#define endl "\n"
const long long mod=1e9+7;
const long long N=1000000000;
const ll val=1000005;
int in(){
int n;cin>>n;
return n;}
void _do_(){
	string s,t;
	cin>>s>>t;
	int T,S;
	T=t.size();S=s.size();
	bool good=true;
	rep(i,0,s.size()){
		if(s[i]!=t[i])good=false;
	}
	if(T==S+1&&good)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

}
signed main(){
fastr
//int tc=in();
int tc=1;
while(tc--)_do_();
cerr<<"Time elapsed:";
cerr<<1000*clock()/CLOCKS_PER_SEC<<" ms ";
return 0;}


Measured memory_bytes: 3644
#include <stdio.h>

int main(void)
{
    int a,b,c,t;
    t = 0;
    scanf("%d %d",&a,&b);
    if (b>a) {
        t = a;
        a = b;
        b = t;
    }
    c = a % b;
    while(c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    printf("%d\n",b);
    
    return 0;
}


Measured memory_bytes: 2124
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
const int mod = 1000000007;
typedef long long int ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define ALL(x) x.begin(),x.end();
#define pp pair<ll,ll>
const int INF = 1LL << 30;
const ll LLINF = 1LL << 60;
using namespace std;
int main() {
	ll a, b, c, ct = 0;
	cin >> a >> b >> c;
	if (a == b && b == c)ct = (a%2==0?-1:0);
	else {
		while (a%2+b%2+c%2 == 0) {
			++ct;
			ll aa = a, bb = b, cc = c;
			a = bb / 2 + cc / 2;
			b = aa / 2 + cc / 2;
			c = aa / 2 + bb / 2;
		}
	}
	cout << ct << endl;
	return 0;
}


Measured memory_bytes: 256
N,M,X,Y = list(map(int,input().split()))
x = list(map(int,input().split()))
y = list(map(int,input().split()))

def solve():
    for Z in range(-105,105):
        f = 1
        if not (X < Z and Z <= Y):
            f = 0
        for xx in x:
            if not xx < Z:
                f = 0
        for yy in y:
            if not yy >= Z:
                f = 0
        if f == 1:
            return True
    return False
print("No War" if solve() else "War")


Measured memory_bytes: 3064
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
		if len(os.Args) > 2 {
			wfp, _ = os.Create(os.Args[2])
		}
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	path := make([]Path, n)

	for i := 0; i < n; i++ {
		path[i].x = getNextFloat64(scanner)
		path[i].y = getNextFloat64(scanner)
	}

	p := permutation(n)
	ans := 0.0
	for _, v := range p {
		for i := 1; i < n; i++ {
			ans += math.Sqrt(math.Pow(path[v[i]-1].x-path[v[i-1]-1].x, 2) + math.Pow(path[v[i]-1].y-path[v[i-1]-1].y, 2))
		}
	}

	fmt.Fprintln(writer, ans/float64(len(p)))
	writer.Flush()
}

type Path struct {
	x, y float64
}

func permutation(n int) [][]int {
	if n == 1 {
		return [][]int{
			[]int{
				1,
			},
		}
	}

	p := permutation(n - 1)
	l := len(p)
	for i := 0; i < l; i++ {
		ll := len(p[i])
		for ii := 0; ii <= ll; ii++ {
			ap := make([]int, ll+1)
			for iii := 0; iii < ii; iii++ {
				ap[iii] = p[i][iii]
			}
			ap[ii] = n
			for iii := ii + 1; iii <= ll; iii++ {
				ap[iii] = p[i][iii-1]
			}
			p = append(p, ap)
		}
	}

	return p[l:]
}


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

int main(){
  int a, b; cin >> a >> b;
  if(a >= b*2){
    cout << a-b*2 << endl;
  }else{
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n ; cin >> n ;
	vll a(n) ;
	for(auto &i:a) cin >> i ;
	sort(all(a)) ;
	reverse(all(a)) ;
	map<ll,ll> m ;
	for(int i=0;i<n;i++) m[a.at(i)]++ ;
	ll ans = 0 ;
	for(int i=0;i<n;i++){
		for(int j=31;j>=0;j--){
			ll d = (1ll<<j)-a.at(i) ;
			if(m[a.at(i)]>0&&m.count(d)&&m[d]>(d==a.at(i)?1:0)){
				ans++ ;
				m[a.at(i)]-- ;
				m[d]-- ;
			}
		}
	}
	cout << ans << endl ;
}


Measured memory_bytes: 17148
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string s,t;
  cin >> s;
  t = s;
  reverse(t.begin(), t.end());
  int count = 0;
  for(int i = 0;i < s.size();i++){
    if(s[i] != t[i]) count++;
  }
  cout << count/2 << endl;
}


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

using namespace std;

int main()
{
	int H, W;
	cin >> H >> W;
	int h, w;
	cin >> h >> w;

	cout << (H - h) * (W - w) << endl;
}


Measured memory_bytes: 3628
// After contest.
// f[i]: maximum length of numbers that can be formed using exactly i matches.

#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

const int maxn = 10002;
const int w[] = {0,2,5,5,4,5,6,3,7,6};

int n, m, f[maxn];
bool vis[12];

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> n >> m;

	memset(f, -1, sizeof(f));

	f[0] = 0;
	for (int i = 0; i < m; ++i) {
		int d;
		cin >> d;
		vis[d] = true;

		for (int j = w[d]; j <= n; ++j)
			if (f[j-w[d]] != -1)
				f[j] = max(f[j], f[j-w[d]] + 1);
	}

	string ans;
	int cur = n;
	while (cur) {
		for (int i = 9; i > 0; --i)
			if (vis[i] && cur >= w[i] && f[cur]-1 == f[cur-w[i]]) {
				ans += (char)('0' + i);
				cur -= w[i];
				break;
			}
	}	

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdint>

template <std::uint_fast64_t mod> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 v;

  constexpr modint(const u64 x = 0) noexcept : v(x % mod) {}
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    v += rhs.v;
    if (v >= mod)
      v -= mod;
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (v < rhs.v)
      v += mod;
    v -= rhs.v;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    v = v * rhs.v % mod;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = mod - 2;
    while (exp != 0) {
      if (exp % 2 != 0)
        *this *= rhs;
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

#include <utility>

template <class T, class U> constexpr T power(T x, U exp) {
  T ret = 1;
  while (exp != 0) {
    if (exp % 2 != 0)
      ret *= x;
    exp /= 2;
    x *= x;
  }
  return ret;
}

#include <iostream>
#include <vector>

int main() {
  using mint = modint<1000000007>;

  int b, w;
  std::cin >> b >> w;
  int n = b + w;

  std::vector<mint> fact(n);
  fact[0] = 1;
  for (int i = 1; i < n; ++i) {
    fact[i] = fact[i - 1] * i;
  }
  const auto comb = [&fact](int n, int r) {
    return fact[n] / fact[r] / fact[n - r];
  };

  mint p = 0, q = 0;

  for (int i = 1; i <= n; ++i) {
    std::cout << ((mint(1) - p + q) / 2).v << std::endl;

    if (i >= b) {
      p += comb(i - 1, b - 1) / power(mint(2), i);
    }
    if (i >= w) {
      q += comb(i - 1, w - 1) / power(mint(2), i);
    }
  }
}


Measured memory_bytes: 3712
#include<iostream>
#include<vector>
#include<map>
#include<string>
using namespace std;

void a(){
    string arc = "ARC";
    string abc = "ABC";
    string s;
    cin >> s;
    if(s.compare(arc)){
        cout<<arc;
    }else{
        cout<<abc;
    }
    return;
}

void b(){
    int n,k;
    cin >> n >> k;
    vector<int>vec(n,0);
    for(int i=0;i<k;i++)
    {
        int d;
        cin >>d;
        for(int j=0;j<d;j++)
        {
            int a;
            cin >>a;
            vec[a-1]++;
        }
    }
    int count = 0;
    for(int i=0;i<n;i++)
    {
        if(vec[i]==0)count++;
    }
    cout<<count;
    return;
}

void c(){
   
}

void d(){
    
}
int main(void){
    //a();
    b();
    //c();

}

Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static final int INF = 1000000000;
	static final int T_MAX = 10;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int[][] dist = new int[T_MAX][T_MAX];
		
		while(true){
			int n = sc.nextInt();
			if(n == 0){
				break;
			}
			for(int i = 0; i < T_MAX; i++){
				Arrays.fill(dist[i], INF);
				dist[i][i] = 0;
			}
			int max = 0;
			for(int i = 0; i < n; i++){
				int a = sc.nextInt();
				int b = sc.nextInt();
				max = Math.max(max, Math.max(a, b));
				dist[a][b] = sc.nextInt();
				dist[b][a] = dist[a][b]; 
			}
			for(int k = 0; k <= max; k++){
				for(int i = 0; i <= max; i++){
					for(int j = 0; j <= max; j++){
						dist[i][j] = Math.min(dist[i][j], dist[i][k] + dist[k][j]);
					}
				}
			}
			int idx = 1;
			int min = INF;
			for(int i = 0; i <= max; i++){
				int sum = 0;
				for(int j = 0; j <= max; j++){
					sum += dist[i][j];
				}
				if(min > sum){
					min = sum;
					idx = i;
				}
			}
			System.out.println(idx + " " + min);
		}
		
		sc.close();
	}

}

Measured memory_bytes: 26196
function main()
	N=parse(Int,readline())
	for h=1:3500,w=1:3500
		a=N*h*w
		b=4*h*w-N*(h+w)
		if b>0&&a%b==0
			println("$h $w $(div(a,b))")
			exit()
		end
	end
end
main()


Measured memory_bytes: 111456
#include <bits/stdc++.h>
using namespace std;
vector< vector<int> > vec(9, vector<int>(9, 0));
vector<int> visit(9, 0);	int n, m;

int dfs(int node, int edge){
	int ans=0;	//cout << node << " " << edge << "\n";
	if(edge==(n-1)){
		bool flag=1;
		for(int i=1;n>=i;i++){
			if(!visit[i]){
				flag=0;	break;
			}
		}
		if(flag){
			return 1;
		}
		return 0;
	}
	for(int i=1;n>=i;i++){
		if(vec[node][i]==1 and visit[i]==0){
			visit[i]=1;	
			ans+=dfs(i, edge+1);
			visit[i]=0;
		}
	}
	visit[node]=0;	return ans;
}

int main(){
	cin >> n >> m;
	for(int i=0;m>i;i++){
		int a, b;	cin >> a >> b;	vec[a][b]=vec[b][a]=1;
	}
	visit[1]=1;	cout << dfs(1, 0);
}

Measured memory_bytes: 256