akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main()
{
  int x,i,j,a[3];
  scanf("%d %d %d",&a[0],&a[1],&a[2]);
  for(i=0;i<2;i++){
    for(j=0;j<2-i;j++){
      if(a[j]>a[j+1]){
	x=a[j];
	a[j]=a[j+1];
	a[j+1]=x;
      }
    }
  }
  printf("%d %d %d\n",a[0],a[1],a[2]);
  return 0;
}

Measured memory_bytes: 596
//paths
//E:\workSpace\cf edu\binary search practice
//E:\workSpace\A2oj Ladder  Codeforces Div. 2, B
//E:\workSpace\Contest
#include<bits/stdc++.h>
using namespace std;

#define ll long long

int main()
{

#ifndef ONLINE_JUDGE
	freopen("E:/workSpace/file/input.txt", "r", stdin);
	freopen("E:/workSpace/file/output.txt", "w", stdout);
#endif

	ll x;
	cin >> x;
	if (x)cout << "0\n";
	else cout << "1\n";

}

Measured memory_bytes: 3644
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int, int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n;
    cin >> n;
    int ans = n*800;
    int a = n/15;
    cout << ans - a*200;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")

#define rep(i,n) for(int i=0;i<n;i++)
const long long MOD = 1000000007;
typedef pair<int,int> P;

int main(){
  int n; cin >> n;
  int k; cin >> k;
  long long ans = 1;
  if(n > k){
    cout << 0 << "\n";
  }else{
    rep(i,n){
      ans = (ans*k)%MOD;
      k--;
    }
    cout << ans << "\n";
  }
}


Measured memory_bytes: 3100
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;
typedef string::const_iterator State;

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


int main(void) {
	long long int n, m;
	long long int point = -1;
	long long int result = 0;

	cin >> n >> m;

	vector<long long int> x(n), y(n), z(n), value(n, 0);

	LFOR(i, 0, n-1) {
		cin >> x[i] >> y[i] >> z[i];
	}

	LFOR(i, 1, 8) {
		LFOR(j, 0, n-1) {
			value[j] = 0;
		}

		LFOR(j, 0, n-1) {
			switch (i) {
			case 1:
				value[j] += x[j];
				value[j] += y[j];
				value[j] += z[j];
				break;
			case 2:
				value[j] += x[j];
				value[j] += y[j];
				value[j] -= z[j];
				break;
			case 3:
				value[j] += x[j];
				value[j] -= y[j];
				value[j] += z[j];
				break;
			case 4:
				value[j] += x[j];
				value[j] -= y[j];
				value[j] -= z[j];
				break;
			case 5:
				value[j] -= x[j];
				value[j] += y[j];
				value[j] += z[j];
				break;
			case 6:
				value[j] -= x[j];
				value[j] += y[j];
				value[j] -= z[j];
				break;
			case 7:
				value[j] -= x[j];
				value[j] -= y[j];
				value[j] += z[j];
				break;
			case 8:
				value[j] -= x[j];
				value[j] -= y[j];
				value[j] -= z[j];
				break;
			}
		}
		sort(value.begin(), value.end());
		result = 0;
		LFOR(j, 1, m) {
			result += value[n - j];
		}
		if (result > point) {
			point = result;
		}
	}

	cout << point << endl;
	
	

	return 0;
}

Measured memory_bytes: 256
from bisect import bisect_right

def make_divisers(n):
    upper_result = []
    lower_result = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            lower_result.append(i)

            ii = n//i
            if ii != i:
                upper_result.append(ii)

    return lower_result + upper_result[::-1]

def main():
    N, M = map(int, input().split())
    divisers = make_divisers(M)
    idx = bisect_right(divisers, M/N) - 1
    print(divisers[idx])

if __name__ == "__main__":
    main()

Measured memory_bytes: 9360
import math
N = int(input())
n = 60

x = [None] * N
y = [None] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())

ans = 0
for i in range(n):
    theta = (2 * math.pi / n) * i
    c = math.cos(theta)
    s = math.sin(theta)
    tmp_x = 0
    tmp_y = 0
    for j in range(N):
        if x[j] * c + y[j] * s > 0:
            tmp_x += x[j]
            tmp_y += y[j]
    if tmp_x**2 + tmp_y**2 > ans**2:
        ans = math.sqrt(tmp_x**2 + tmp_y**2)

print(ans)


Measured memory_bytes: 3444
import sys
import copy
input = sys.stdin.readline
n = int(input())
p = list(map(int, input().split()))
for i in range(n):
    for j in range(i, n):
        x = copy.copy(p)
        x[i], x[j] = x[j], x[i]
        y = sorted(x)
        if x == y:
            print("YES")
            exit()
print("NO")

Measured memory_bytes: 3444
#include<stdio.h>
#include<string.h>
int main(void){
  int n,i;
  scanf("%d",&n);
  double x[n],sum;
  char u[n][4];
  for(i=0;i<n;i++){
    scanf("%lf",&x[i]);
    scanf("%s",u[i]);
  }
  for(i=0;i<n;i++){
    if(strcmp("BTC",u[i])==0){
      x[i]=x[i]*380000.0;
    }
  }
  for(i=0;i<n;i++){
    sum+=x[i];
  }
  printf("%.4f",sum);
 
  return 0;
}

Measured memory_bytes: 128
import std.stdio, std.algorithm, std.range, std.conv, std.string, std.math, std.container, std.typecons;
import core.stdc.stdio;
// foreach, foreach_reverse, writeln

void main() {
	int n, k;
	scanf("%d%d", &n, &k);
	long ans = 0;
	long f(long x) {
		return x*x*x;
	}
	ans += f(n/k);
	if (k%2 == 0) ans += f((n+k/2)/k);
	writeln(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  rep(i, k){
    vector<int> b(n, 0);
    rep(j, n){
      b[max(0, j-a[j])]++;
      if(min(n-1, j+a[j])+1<=n-1)
      	b[min(n-1, j+a[j])+1]--;
    }
    int sum = 0;
    bool allN = true;
    rep(j, n){
      sum += b[j];
      a[j] = sum;
      if(a[j] != n) allN = false;
    }
    if(allN){
      rep(j, n){
        cout << n << " ";
      }
      return 0;
    }
  }
  rep(i, n){
    cout << a[i] << " ";
  }
  return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    string S;
    cin >> S;
    int res = 800;
    for(int i = 0; i < S.size() - 2; ++i){
        int x = (S[i] - '0') * 100 + (S[i+1] - '0') * 10 + S[i+2] - '0';
        if(x == 753) res = 0;
        res = min(res, abs(753 - x));
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int head(int a){
  while(a > 9) a /= 10;
  return a;
}

int main(void)
{
  int N;
  scanf("%d", &N);
  int c[100] = {0};
  for(int i = 1; i <= N; i++) c[head(i)*10+i%10]++;

  int ans = 0;
  for(int i = 1; i < 10; i++)
    for(int j = 1; j < 10; j++)
      ans += c[i*10+j]*c[j*10+i];

  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cassert>
using namespace std;
const int INF = 1 << 28;
int dp[41][4];

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

	int n;
	while(cin >> n, n) {
		fill((int*)begin(dp), (int*)end(dp), INF);
		int nt = 0, np = 0;
		dp[0][0] = 0;
		for(int i = 0; i < n; i++) {
			int p, t;
			cin >> p >> t;
			for(int k = 0; k <= 3; k++) {
				if(dp[i][k] == INF) continue;
				// ??´??\
				if(k + 1 <= 3 && abs(np - p) * (k + 1) <= t - nt) {
					dp[i + 1][k + 1] = min(dp[i + 1][k + 1], dp[i][k] + abs(np - p));
				}
				// ??¶????????£?????????
				int dt = (k + 1) * np + p;
				if(dt <= t - nt) {
					dp[i + 1][1] = min(dp[i + 1][1], dp[i][k] + np + p);
				}
			}
			np = p;
			nt = t;
		}

		int ans = INF;
		for(int k = 0; k <= 3; k++) {
			if(dp[n][k] != INF) {
				ans = min(ans, dp[n][k] + np);
			}
		}

		if(ans == INF) {
			int last = 0;
			for(int i = 1; i <= n; i++) {
				for(int j = 0; j <= 3; j++) {
					if(dp[i][j] != INF) last = i;
				}
			}
			cout << "NG " << last + 1 << endl;
		}
		else {
			cout << "OK " << ans << endl;
		}

	}
}

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

const int N = 1e5 + 123;

vector <int> G[N];

int d[N], c[N], f[N];

void dfs(int u) {
  d[u] = d[f[u]] + 1;
  for (int v : G[u]) {
    if (v == f[u]) continue;
    f[v] = u; dfs(v);
  }
}

void dfs2(int u) {
  for (int v : G[u]) {
    if (c[v]) continue;
    c[v] = c[u]; dfs2(v);
  }
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i ++) {
    int u, v;
    scanf("%d %d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(1);
  deque <int> q;
  int a = n;
  while (true) {
    q.push_back(a);
    if (a == 1) break;
    a = f[a];
  }
  int timer = 0;
  while (q.size()) {
    if (timer)
      c[q.front()] = 1, q.pop_front();
    else
      c[q.back()] = 2, q.pop_back();
    timer ^= 1;
  }
  int cnt[3] = {0, 0, 0};
  for (int i = 1; i <= n; i ++)
    if (c[i])
      dfs2(i);
  for (int i = 1; i <= n; i ++)
    cnt[c[i]] ++;
  if (cnt[2] > cnt[1])
    puts("Fennec");
  else
    puts("Snuke");
  return 0;

}

Measured memory_bytes: 12032
#include <algorithm>
#include <climits>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

int main() {
	int N, M, j = 0;
	cin >> N >> M;
	vector<long> A(N), a(N);
	for (long& i : A) cin >> i;
	sort(A.begin(), A.end());
	vector<pair<int, long>> BC(M + 1, make_pair(INT_MAX, 0));
	for (int i = 0; i < M; ++i) cin >> BC[i].first >> BC[i].second;
	sort(BC.begin(), BC.end(), [](pair<int, long>& a, pair<int, long>& b)->bool { return a.second > b.second; });
	for (long& i : a) {
		if (BC[j].first == 0) ++j;
		--BC[j].first;
		i = BC[j].second;
	}
	long ans = 0;
	for (int i = 0; i < N; ++i) ans += max(A[i], a[i]);
	cout << ans;
}

Measured memory_bytes: 3328
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N; cin >> N;
	VI A(N);
	
	int sum = 0;
	REP(i, N) {
		cin >> A[i];
		sum ^= A[i];
	}
	REP(i, N) {
		cout << (sum ^ A[i]);
		if (i != N - 1)cout << " ";
		else cout << endl;
	}

	return 0;
}



Measured memory_bytes: 4724
#include <bits/stdc++.h>
using namespace std;
int n,m,i,j,k,l[7],p[7],ip[7];
double dp[305][305][1<<6],ans;
int main()
{
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++) scanf("%d",&l[i]);
	for(i=1;i<n;i++) p[i]=i;
	sort(l,l+n);reverse(l,l+n);
	do
	{
		for(i=1;i<n;i++) ip[p[i]]=i;
		memset(dp,0,sizeof(dp));
		dp[0][l[0]*n][(1<<n)-1-1]=1;
		for(i=0;i<n*m;i++)
		{
			int p=ip[i%n];
			for(j=i;j<=n*m;j++)
			{
				for(k=0;k<(1<<n);k++) if(dp[i][j][k])
				{
					dp[i+1][j][k]+=dp[i][j][k];
					if((k>>p)&1)
					{
						dp[i+1][min(n*m,max(j,i+l[p]*n))][k^(1<<p)]+=dp[i][j][k];
					}
				}
			}
		}
		ans+=dp[n*m][n*m][0];
	}
	while(next_permutation(p+1,p+n));
	for(i=1;i<n;i++)ans/=i*m;
	printf("%.13f\n",ans);
	return 0;
}

Measured memory_bytes: 46720
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  int T = 0;
  cin >> A >> B;
  for (int i = A; i < B+1; i++) {
    string a = to_string(i);
    int l = a.size();
    bool P = true;
    for (int j = 0; j < l / 2; j++) {
      P = true;
      if (a[j] != a[l-j-1]) {
        P = false;
        break;
      }
    }
    if (P == true) {
      T++;
    }
  }
  cout << T << endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class AGrouping {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int x, y;
	    in >> x >> y;
	    set<int> a{1, 3, 5, 7, 8, 10, 12};
	    set<int> b{4, 6, 9, 11};

	    if(a.find(x) != a.end() && a.find(y) != a.end()) ans(true, out);
	    else if(b.find(x) != b.end() && b.find(y) != b.end()) ans(true, out);
	    else ans(false, out);
	}
};


int main() {
	AGrouping solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import sys
from itertools import permutations
from math import factorial

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def distance2(x1, y1, x2, y2):
    return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5


def main():
    N = int(readline())
    C = [tuple(map(int, readline().split())) for _ in range(N)]

    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            ans += ((C[i][0] - C[j][0]) ** 2 + (C[i][1] - C[j][1]) ** 2) ** 0.5

    print(2 * ans / N)
    return


if __name__ == '__main__':
    main()


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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

int memo[50][50];
vector<string> s(50);
vector<vector<int>> ar(50, vector<int>(50, INF));
queue<pair<int, int>> que;
int h, w;

void bfs() {

	while (!que.empty()) {
		pair<int, int> p = que.front();
		que.pop();

		if (p.first < h - 1) {
			if (s[p.first + 1][p.second] != '#' && memo[p.first + 1][p.second] == 0) {
				que.push(make_pair(p.first + 1, p.second));
				memo[p.first + 1][p.second] = 1;
				ar[p.first + 1][p.second] = ar[p.first][p.second] + 1;
			}
		}
		if (p.first > 0) {
			if (s[p.first - 1][p.second] != '#' &&  memo[p.first - 1][p.second] == 0) {
				que.push(make_pair(p.first - 1, p.second));
				memo[p.first - 1][p.second] = 1;
				ar[p.first - 1][p.second] = ar[p.first][p.second] + 1;
			}
		}

		if (p.second < w - 1) {
			if (s[p.first][p.second + 1] != '#' && memo[p.first][p.second + 1] == 0) {
				que.push(make_pair(p.first, p.second + 1));
				memo[p.first][p.second + 1] = 1;
				ar[p.first][p.second + 1] = ar[p.first][p.second] + 1;
			}
		}
		if (p.second > 0) {
			if (s[p.first][p.second - 1] != '#' &&  memo[p.first][p.second - 1] == 0) {
				que.push(make_pair(p.first, p.second - 1));
				memo[p.first][p.second - 1] = 1;
				ar[p.first][p.second - 1] = ar[p.first][p.second] + 1;
			}
		}
	}
}

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

	cin >> h >> w;
	rep (i, 0, h)
		cin >> s[i];

	int black = 0;
	ar[0][0] = 1;

	que.push(make_pair(0, 0));
	bfs();

	rep (i, 0, h) {
		rep (j, 0, w) {
			if (s[i][j] == '#')
				black++;
		}
	}

	if (ar[h - 1][w - 1] == INF) {
		cout << -1 << endl;
	} else {
		cout << max(h * w - ar[h - 1][w - 1] - black, 0) << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, R: int):
    if N >= 10:
        print(R)
    else:
        print(R + 100*(10-N))

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(N, R)


if __name__ == '__main__':
    main()


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

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;

typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

typedef vector<double> VD;
typedef vector<VD> VVD;

typedef vector<string> VS;
typedef vector<VS> VVS;

typedef vector<bool> VB;
typedef vector<VB> VVB;

typedef pair<int, int> PII;
typedef vector<PII> VPII;

#define fst first
#define snd second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) (x).begin(), (x).end()
#define RANGE(xx,y,mx,my) (0<=(x)&&0<=(y) && (x)<(mx) && y<(my))
#define REP(i, init, N) for(int i = (init); i < (int)(N); i++)

const int INF = 0x3f3f3f3f;
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int N;
map<string, VS> gs;
map<string, VS> memo;

VS dfs(string &key0) {
    if (memo.count(key0)) {
        return memo[key0];
    }

    if (!gs.count(key0)) {
        return memo[key0] = VS({key0});
    }

    VS res;
    for (auto &key : gs[key0]) {
        VS res2 = dfs(key);
        VS t(100000);
        auto it = set_union(ALL(res), ALL(res2), t.begin());
        t.resize(it - t.begin());
        res = t;
    }

    sort(ALL(res));

    return memo[key0] = res;
}

int solve(string &key) {
    memo.clear();
    VS res = dfs(key);
    return res.size();
}

int main(void) {
    while (cin >> N, N) {
        string first_gname;
        gs.clear();
        REP(i, 0, N) {
            string s;
            cin >> s;

            int start;
            string gname;
            {
                auto pos = s.find(':');
                start = pos + 1;
                gname = s.substr(0, pos);
            }

            if (first_gname == "") {
                first_gname = gname;
            }

            VS ms;
            while (true) {
                auto pos = s.find_first_of(",.", start);
                string member = s.substr(start, pos - start);
                ms.PB(member);
                start = pos + 1;
                if (s[pos] == '.') break;
            }

            gs[gname] = ms;
        }

        cout << solve(first_gname) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 2908
//#include<bits/stdc++.h>
#include<cstdio>
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

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	int A[200001];
	rep1(i, N) A[getint()] = i;

	int dai[200002], shou[200002];
	rep1(i, N) {
		dai[i + 1] = i;
		shou[i - 1] = i;
	}

	ll kotae = 0;
	for (int i = N; i > 0; i--) {
		int a = A[i];
		int l = shou[a - 1];
		int r = dai[a + 1];
		kotae += (ll)(a - l + 1) * (r - a + 1) * i;
		dai[l] = r;
		shou[r] = l;
	}

	printf("%lld", kotae);

	Would you please return 0;
}

Measured memory_bytes: 2688
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;

int N,par[100001],r[100001];

int find(int x) {
	if (par[x] == x)return x;
	else return par[x] = find(par[x]);
}

void unite(int x,int y) {
	x = find(x);
	y = find(y);
	if (x == y) return;
	if (r[x] < r[y]) par[x] = y;
	else {
		par[y] = x;
		if (r[x] == r[y]) r[x]++;
	}
}

int main() {
	int M; cin >> N >> M;
	vector<int> A(M), B(M);
	for (int i = 0; i < M; i++) {
		int k, l;
		cin >> k >> l;
		k--; l--;
		A[i]=k; B[i]=l;
	}
	vector<long long> ans(M+1,0);
	for (int i = 0; i < N; i++) {
		par[i] = i; r[i] = 0;
	}
	vector<int> size(N, 1);
	for (int i = 1; i < N; i++)ans[0] += i;
	for (int i = 1; i < M+1; i++) {
		int x, y;
		x = find(A[M-i]);
		y = find(B[M-i]);
		if (x == y)ans[i] = ans[i - 1];
		else {
			ans[i] = ans[i - 1] - size[x] * size[y];
			unite(x, y);
			size[find(x)] = size[x] + size[y];
		}
		
	}
	for (int i = 1; i < M+1; i++)cout << ans[M  - i] << endl;
}




Measured memory_bytes: 4096
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <bitset>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

class UnionFindTree{
public:
    std::vector<int> parent;
    std::vector<int> rank;
 
    UnionFindTree(int n){
        parent.resize(n, 0);
        rank.resize(n, 0);
 
        for(int i = 0; i < n; i++){
            parent[i] = i;
        }
        return;
    }
    ~UnionFindTree(){
        return;
    }
 
    int find(int x){
        if(parent[x] == x){
            return x;
        }
        else{
            return parent[x] = find(parent[x]);
        }
    }
 
    void unite(int x, int y){
        x = find(x);
        y = find(y);
 
        if(x == y){
            return;
        }
 
        if(rank[x] < rank[y]){
            parent[x] = y;
        }
        else{
            parent[y] = x;
            if(rank[x] == rank[y]){
                rank[x]++;
            }
        }
    }
 
    bool is_same(int x, int y){
        return find(x) == find(y);
    }
};

class Edge{
public:
	int from;
	int to;
	int cost;

	Edge(){
		return;
	}
	~Edge(){
		return;
	}
};

bool comp(const Edge &l, const Edge &r){
	return l.cost < r.cost;
}

int main(int argc, char **argv){
	int n, m, a, b, d;
	char tmp;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif

#if INPUT_FROM_FILE
	while(ifs >> n){
#else
	while(std::cin >> n){
#endif
		if(n == 0){ break; }

#if INPUT_FROM_FILE
		ifs >> m;
#else
		std::cin >> m;
#endif
		UnionFindTree uft(n);
		std::vector<Edge> edges(m);
		int min_cost = 0;
		
		for(int i = 0; i < m; i++){
#if INPUT_FROM_FILE
			ifs >> a >> tmp >> b >> tmp >> d;
#else
			std::cin >> a >> tmp >> b >> tmp >> d;
#endif
			edges[i].from = a;
			edges[i].to = b;
			edges[i].cost = d;
		}

		std::sort(edges.begin(), edges.end(), comp);

		for(int i = 0; i < m; i++){
			Edge &e = edges[i];
			if(!uft.is_same(e.from, e.to)){
				uft.unite(e.from, e.to);
				min_cost += e.cost - 100;
			}
		}

		int num_tourou = min_cost / 100;
		std::cout << num_tourou << std::endl;
	}


 
#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}


Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
int main(){
   int N;
   cin>>N;
   string s;
   vector<string>a(N);
   for(int i=0;i<N;i++){
       cin>>a.at(i);
   }
   int M;
   cin>>M;
   vector<string>b(M);
    for(int i=0;i<M;i++){
       cin>>b.at(i);
   }
   int l=0;
   for(int i=0;i<N;i++){
        int m=1;
       for(int j=i+1;j<N;j++){
           if(a.at(i)==a.at(j)){
               m++;
           }
        }
         for(int j=0;j<M;j++){
           if(a.at(i)==b.at(j)){
               m--;
            }
         }
         if(m>l){
             l=m;
         }
   }
    cout<<l<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan= new Scanner(System.in);
		int n=3;
		int[] a= new int[2];
		int sum=0;
		for(int i=0;i<2;i++)
		{
			a[i]=scan.nextInt();
			sum+=a[i];
		}
		n=n*(n+1)/2;
		System.out.println(n-sum);
	}

}


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

typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999

int main(){
    int n,m;
    while(cin>>n>>m){
        if(n==0&&m==0)break;
        
        bool data[2000];
        rep(i,n)data[i]=false;
        
        int x=0;
        int c=0;
        for(int i=0;;i++){
            if(data[i%n]==false){
                c++;
                if(c==m){
                    data[i%n]=true;
//                    cout<<i%n+1<<endl;
                    c=0;
                    x++;
                }
            }
            if(x==n-1)break;
        }
        rep(i,n)if(data[i]==false){cout<<i+1<<endl;break;}
    }
}

Measured memory_bytes: 1156
#include <queue>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>

using namespace std;

int main(){
  const int n = getInt();
  const int m = getInt();

  vector<int> a(m);
  REP(i,n){
    const int k = getInt();
    REP(j,k){
      a[getInt() - 1]++;
    }
  }

  int ans = 0;
  REP(i,m){
    if(a[i] == n) ans++;
  }

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

  return 0;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


class UnionFind:
    def __init__(self, size):
        self.table = [-1 for _ in range(size)]

    def find(self, x):
        if self.table[x] < 0:
            return x
        else:
            self.table[x] = self.find(self.table[x])
            return self.table[x]

    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 != s2:
            if self.table[s1] <= self.table[s2]:
                self.table[s1] += self.table[s2]
                self.table[s2] = s1
            else:
                self.table[s2] += self.table[s1]
                self.table[s1] = s2
            return True
        return False

    def subsetall(self):
        a = []
        for i in range(len(self.table)):
            if self.table[i] < 0:
                a.append((i, -self.table[i]))
        return a

def main():
    n = I()
    xy = [LI() for _ in range(n)]
    xd = {}
    yd = {}

    xi = 0
    yi = 0
    for x,y in xy:
        if x not in xd:
            xd[x] = xi
            xi += 1
        if y not in yd:
            yd[y] = yi
            yi += 1

    uf = UnionFind(xi+yi+n)
    ii = xi + yi
    for i in range(n):
        x,y = xy[i]
        uf.union(xd[x], ii + i)
        uf.union(xi + yd[y], ii + i)

    dx = collections.defaultdict(set)
    dy = collections.defaultdict(set)
    for i in range(n):
        x,y = xy[i]
        ui = uf.find(ii + i)
        dx[ui].add(x)
        dy[ui].add(y)

    r = -n
    for k,xv in dx.items():
        yv = dy[k]
        r += len(xv) * len(yv)

    return r


print(main())



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

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



Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;


int main() {
    int X;
    cin >> X;
    if (X >= 2100) {
        cout << 1 << endl;
        return 0;
    }
    int a = X / 100;
    if (a * 5 >= X % 100) {
        cout << 1 << endl;
    }
    else {
        cout << 0 << endl;
    }

}


Measured memory_bytes: 256
#UnionFind木
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)

    if x == y:
      return

    if self.parents[x] > self.parents[y]:
            x, y = y, x

    self.parents[x] += self.parents[y]
    self.parents[y] = x

  def same(self, x, y):
        return self.find(x) == self.find(y)

  def roots(self):
    return [i for i, x in enumerate(self.parents) if x < 0]

  def members(self, x):
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i) == root]

  def __str__(self):
    return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M = map(int, input().split())

A = [0]*M
B = [0]*M
for i in range(M):
  A[i],B[i] = map(int, input().split())
  A[i] -= 1
  B[i] -= 1

ans = []

A = A[::-1]
B = B[::-1]
uf = UnionFind(N)
total = N*(N-1)//2
ans.append(total)
for i in range(M):
  if uf.same(A[i],B[i]):
    ans.append(total)
    continue
  m = abs(uf.parents[uf.find(A[i])])
  n = abs(uf.parents[uf.find(B[i])])
  #print(uf)
  #print(A[i]+1,m,B[i]+1,n)
  uf.union(A[i],B[i])
  total -= m*n
  ans.append(total)
  
#print(ans)   

print(*ans[:-1][::-1], sep='\n')


Measured memory_bytes: 103512
#include<set>
#include<cstdio>
#include<cstring>
using namespace std;
struct str{
	char a[5];
	bool operator < (const str &p) const
	{
		int i;
		for (i=0;i<5 && a[i]==p.a[i];i++) ;
		return a[i]<p.a[i];
	}
}p;
set <str> que;
char s[5001];
int main()
{
	set <str> :: iterator it;
	int l,k;
	bool b=false;
	scanf("%s",s);
	scanf("%d",&k);
 	l=strlen(s);
 	for (int i=0;i<l;i++)
 	{
 		for (int j=0;j<k;j++) p.a[j]='\0';
 		for (int j=0;j<k && i+j<l;j++)
 		{
 			p.a[j]=s[i+j];
 			if (!que.count(p)) 
			{
				que.insert(p);
				it=que.end();
				if (b) que.erase(*(--it));
 				else if (que.size()>=k) b=true;
			}
 		}
 	}
	 it=que.end();
	printf("%s",(*(--it)).a);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <climits>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define UMap        std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    llong power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    llong power ( llong x, llong n ) { return power( x, n, 1000000007 ); }
    llong gcd   ( llong x, llong y ) { return x % y ? gcd( y, x % y ) : y; }
    llong lcm   ( llong x, llong y ) { return ( x / gcd(x, y) * y ); }
    llong abs   ( llong n )          { return ( n < 0 ) ? -n : n; }
    template<class A, class B>inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B>inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    signed call_of_Cthulhu( signed datum ) {

        int n;
        int cnt = 0;
        read n;
        for ( int i = 0; i < n; i++ ) {
            int t;
            read t;
            while ( t % 2 == 0 ) {
                cnt++;
                t /= 2;
            }
        }

        echo cnt fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); echo std::fixed << std::setprecision(8); int main_result = Rlyeh::call_of_Cthulhu(114514); return main_result;}


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

template<typename T, typename U> void cmax(T &a, U b) { if (a < b) a = b; }
template<typename T, typename U> void cmin(T &a, U b) { if (a > b) a = b; }

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

  long N, X, M;
  cin >> N >> X >> M;

  long now = 0, ans = 0;
  vector<bool> used(M);
  vector<long> hist {-1};

  auto update = [&](long n) {
    now++;
    ans += n;
    used.at(n) = true;
    hist.push_back(n);
  };

  update(X);

  while (now < N) {
    long next = X * X % M;
    if (used.at(next)) break;
    X = next;
    update(X);
  }

  if (now == N) return cout << ans << "\n", 0;

  long x = find(hist.begin(), hist.end(), X * X % M) - hist.begin();
  long len = now - x + 1;
  long sum = accumulate(hist.begin() + x, hist.begin() + x + len, 0L);
  long rem = N - now;

  ans += rem / len * sum;
  ans += accumulate(hist.begin() + x, hist.begin() + x + rem % len, 0L);
  cout << ans << "\n";
}

Measured memory_bytes: 3884
dg = "0123456789"

A,B = map(int,input().split())
S = input()

postcode = True
for i, ch in enumerate(S):
  if i == A:
    if ch != "-":
      postcode = False
      break
  else:
    if ch not in dg:
      postcode = False
      break
      
if postcode:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9056
#include<cstdio>
#include<cstring>
int main(){
	char a[100050]={0};
	while(~scanf("%s",a))
	{
		int k=strlen(a);
		int sum=0;
		for(int i=1;i<k;i++)
		{
			if(a[i-1]!=a[i])
			{
				sum++;
			}
		}
		printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    while(1){
        int m,n;
        cin>>m>>n;
        if(m==0&&n==0)break;
        long long int fie[20][20]={0};
        int ko[20][20]={0};
        fie[1][1]=1;
        int p;
        cin>>p;
        for(int i=0;i<p;i++){
            int a,b;
            cin>>a>>b;
            ko[a][b]=1;
        }
        for(int i=1;i<19;i++){
            for(int j=1;j<19;j++){
                if(!ko[i][j+1])fie[i][j+1]+=fie[i][j];
                if(!ko[i+1][j])fie[i+1][j]+=fie[i][j];
            }
        }
        /*
        for(int i=1;i<19;i++){
            for(int j=1;j<19;j++){
                printf("[%d]",ko[i][j]);
            }
            puts("");
        }
        */
        cout<<fie[m][n]<<endl;
    }
    return 0;
}

Measured memory_bytes: 1156
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
//const ll INF = 1LL << 60;
//typedef pair<ll,ll> P;
typedef pair<int, int> P;
bool chmx(int &a, int b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

bool chmn(int &a, int b) {
	if (b < a) {
		a = b;
		return true;
	}
	return false;
}

int main(){
    int h,w;
    cin >> h>>w;
    int n;
    cin >> n;
    int ans;
    ans=min((n-1)/h+1,(n-1)/w+1);
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> A(n), B(n);
  rep(i, n) cin >> A[i];
  rep(i, n) cin >> B[i];
  if(accumulate(all(A), 0LL) < accumulate(all(B), 0LL)) {
    cout << -1 << endk;
  } else {
    priority_queue<ll> q;
    ll need = 0;
    int ans = 0;
    rep(i, n) {
      if(A[i]>B[i]) q.push(A[i]-B[i]);
      else if(A[i]<B[i]) {
        ans++;
        need += B[i]-A[i];
      }
    }
    while(need > 0) {
      need -= q.top(); q.pop();
      ans++;
    }
    cout << ans << endk;
  }
  return 0;
}


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

namespace ConsoleApp33 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            int T = st[0];
            int X = st[1];

            Console.WriteLine((float)T / X);
        }
    }
}


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

int main()
{
  int a, b; cin >> a >> b;
  string as, bs;
  rep(i, b) as.push_back('0'+a);
  rep(i, a) bs.push_back('0'+b);
  if (as < bs) cout << as << endl;
  else cout << bs << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
using namespace std;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int n,i;
	cin>>n;
	int a[n];
	for(i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	int sum=0;
	for(i=0;i<n-1;i++)sum+=a[i];
	if(sum>a[n-1])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
const double pi = acos(-1.0);
const ll mod = pow(10,9) + 7;
const ll INF = pow(2,31) - 1;

int main()
{
    ll n;
    string s;
    cin >> n >> s;
    rep(i,s.size()){
        if(s[i] + n <= 'Z')cout << (char)(s[i] + n);
        else cout << (char)(s[i] - 26 + n);
    }
    cout << endl;

    return 0;
}

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

int main()
{
  int64_t n, ans = 10e12, j, tmp;
  cin >> n;

  for (int i = 1, s_n = (int)sqrt(n); i <= s_n; i++)
  {
    if (n % i == 0)
      j = n / i;
    tmp = i + j - 2;
    if (ans > tmp)
      ans = tmp;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;

namespace Tree
{
    class Rooted_Trees
    {
        struct Node
        {
            public int id;
            public int parent;
            public int depth;
            public int[] childlen;
            public int type;
            public string GetNodeType()
            {
                switch (type)
                {
                    case 0: return "root";
                    case 1: return "internal node";
                    case 2: return "leaf";
                    default: return null;
                }
            }
        }
        static void Main(string[] args)
        {
            int size = int.Parse(Console.ReadLine());
            var nodes = new Node[size];

            for (int i = 0; i < size; i++)
                nodes[i].parent = -1;

            for (int i = 0; i < size; i++)
            {
                var token = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                var id = token[0];
                nodes[id].id = id;

                var k = token[1];
                if (k == 0) nodes[id].type = 2;
                else nodes[id].type = 1;
                nodes[id].childlen = new int[k];
                for (int j = 0; j < k; j++)
                {
                    nodes[id].childlen[j] = token[2 + j];
                    nodes[token[2 + j]].parent = id;
                    nodes[token[2 + j]].depth = nodes[id].depth + 1;
                }
            }

            for (int i = 0; i < size; i++)
                if (nodes[i].parent == -1)
                    nodes[i].type = 0;
                else nodes[i].depth = nodes[nodes[i].parent].depth + 1;

            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            for (int i = 0; i < size; i++)
            {
                Console.Write("node {0}: parent = {1}, depth = {2}, {3}, [", nodes[i].id, nodes[i].parent, nodes[i].depth, nodes[i].GetNodeType());
                Console.Write(string.Join(", ", Array.ConvertAll(nodes[i].childlen, n => n.ToString())));
                Console.WriteLine("]");
            }

            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 23032
#include<stdio.h>
int main()
{
int a,b;
scanf("%d%d",&a,&b);
if(a<6){
    printf("0\n");
}
else if(a<13){
    printf("%d\n",b/2);
}
else{
    printf("%d\n",b);
}
    return 0;
}



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

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cerr << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

const ll MOD = TEN(9) + 7;

ll powmod(ll x, ll k) {
	ll res = 1;
	for (; k; k /= 2, x = x * x % MOD) {
		if (k & 1) {
			res = res * x % MOD;
		}
	}
	return res;
}

ll pw[18];

ll calc(int i, ll w) {
	if (i >= 9) {
		ll x = (powmod(10, i) - powmod(10, i-1) + MOD) % MOD;
		return (x - w + 1 + MOD) % MOD;
	}
	ll x = (pw[i] - pw[i-1]);
	return max(0ll, x - w + 1);
}

int main() {
	rep(i, 18) pw[i] = TEN(i);

	int S; cin >> S;

	ll same = 0;

	for (int i = 1; i * i <= S; ++i) { //same
		if (S % i == 0) {
			{
				same += calc(i, S / i);
				same %= MOD;
			}
			if (i * i != S) {
				same += calc(S / i, i);
				same %= MOD;
			}
		}
	}

	ll small = 0;

	for (int a = 1; a <= 7; ++a) {
		ll mx = pw[a] - pw[a-1];
		for (int na = 1; na <= mx; ++na) {
			ll num = a * na;
			if (num >= S) {
				break;
			}

			for (int b = a + 1; b <= 8; ++b) {
				ll rem = S - num;
				ll nx = (num + b * (pw[b] - pw[b-1]));
				if (S > nx) {
					num = nx;
					continue;
				}
				if (rem % b == 0) {
					++small;
				}
				break;
			}
		}
	}

	ll adj = (S - 1) / 8;
	for (int i = 1; i * i <= S; ++i) {
		if (S % i == 0) {
			if (i * 8 < S) --adj;
			if (i * i != S && S / i * 8 < S) {
				--adj;
			}
		}
	}

	cout << (same + small + adj) % MOD << endl;

	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int N =2e2+10;
const double pi=acos(-1.0);
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
string t,s;
int check(int p){
    int tmp=0;
    for(int i=p,j=0;j<t.length();j++,i++){
        if(t[j]!=s[i])tmp++;
    }
    return tmp;
}
signed main(){
    cin>>s;
    cin>>t;
    int ans=1e9;
    int n=t.length();
    for(int i=0;i+n-1<s.length();i++){
        ans=min(ans,check(i));
    }
    pi(ans);
    return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
#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++)
using namespace std;
const int MAX = 2000100;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

int main(){
  long k;
  cin>>k;
  string s;
  cin>>s;
  long n=s.size();
  COMinit();
  long ans=0;
  rep2(i,n,k+n+1){
    ans=(ans+modpow(25,i-n,MOD)*modpow(26,k+n-i,MOD)%MOD*COM(i-1,n-1))%MOD;
  }
  cout<<ans<<endl;
}





Measured memory_bytes: 51228