akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
using namespace std;

int sai[100000][6];
int x[100000];
int main(){
    int y[6];
    string S;
    cin>>y[0]>>y[1]>>y[2]>>y[3]>>y[4]>>y[5];
    cin>>S;
    for(int i=0;i<S.size();i++){
        if(S[i]=='N'){
            x[i+1]=0;
        }
        if(S[i]=='E'){
            x[i+1]=1;
        }
        if(S[i]=='S'){
            x[i+1]=2;
        }
        if(S[i]=='W'){
            x[i+1]=3;
        }
    }
    for(int i=0;i<6;i++){
        sai[0][i]=y[i];
    }
    for(int i=1;i<=S.size();i++){
        if(x[i]==2){
            sai[i][0]=sai[i-1][4];
            sai[i][1]=sai[i-1][0];
            sai[i][2]=sai[i-1][2];
            sai[i][3]=sai[i-1][3];
            sai[i][4]=sai[i-1][5];
            sai[i][5]=sai[i-1][1];
        }
        if(x[i]==3){
            sai[i][0]=sai[i-1][2];
            sai[i][1]=sai[i-1][1];
            sai[i][2]=sai[i-1][5];
            sai[i][3]=sai[i-1][0];
            sai[i][4]=sai[i-1][4];
            sai[i][5]=sai[i-1][3];
        }
        if(x[i]==0){
            sai[i][0]=sai[i-1][1];
            sai[i][1]=sai[i-1][5];
            sai[i][2]=sai[i-1][2];
            sai[i][3]=sai[i-1][3];
            sai[i][4]=sai[i-1][0];
            sai[i][5]=sai[i-1][4];
        }
        if(x[i]==1){
            sai[i][0]=sai[i-1][3];
            sai[i][1]=sai[i-1][1];
            sai[i][2]=sai[i-1][0];
            sai[i][3]=sai[i-1][5];
            sai[i][4]=sai[i-1][4];
            sai[i][5]=sai[i-1][2];
        }
    }
    cout<<sai[S.size()][0]<<endl;
    return 0;
}



Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

    int x;
    cin >> x;

    for (ll i=-1000; i<1001; i++) {
        for (ll j=-1000; j<1001; j++) {
            if (i*i*i*i*i - j*j*j*j*j == x) {
                cout << i << " " << j << "\n";
                return 0;
            }
        }
    }
}


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

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

  int n;
  cin >> n;
  int ans = 0;
  rep(i, 1, n + 1) {
    int d = to_string(i).size();
    if (d % 2 == 1) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k,x;
string s;
int main(){
	cin >> n >> k >> s;
	for(int i=1;i<n;i++)
		if(s[i]==s[i-1])x++;
	printf("%d",x+min(n-x-1,2*k));
	return 0;
}

Measured memory_bytes: 512
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    states = ["AC", "WA", "TLE", "RE"]
    counts = [0] * 4
    for _ in range(int(input())):
        counts[states.index(input())] += 1

    for state, count in zip(states, counts):
        print("%s x %s" % (state, count))
resolve()

Measured memory_bytes: 67884
#include <stdio.h>

int main(void) {
	int color[4], count = 3;
	scanf("%d %d %d", &color[0],&color[1],&color[2]);
	
	if(color[0] == color[1] && color[1] == color[2]){
		count = 1;
	}else{
		if(color[0] == color[1]){
			count--;
		}else if(color[0] == color[2]){
			count--;
		}else if(color[1] == color[2]){
			count--;
		}
	}
	printf("%d", count);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cctype>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#define MAXSIZE 200000
#define PI 3.141592653589
using namespace std;


int main(){
    int R[MAXSIZE],n;

    std::cin >> n;
    for(int i=0;i<n;i++){
      std::cin >> R[i];
    }

    int maxv=-2000000000;
    int minv=R[0];

    for(int i=1;i<n;i++){
      maxv=max(maxv,R[i]-minv);
      minv=min(minv,R[i]);
    }

    std::cout << maxv << '\n';



}

Measured memory_bytes: 3872
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=100010, SQ=2200;

ll n, m, k, u, v, x, y, t, a, b, ans;
ll A[MAXN];
vector<int> Prime;
map<ll, int> cnt;

ll F(ll x){
	ll res=1;
	for (ll p:Prime) if (x%p==0){
		if (x%(p*p)) res*=p*p, x/=p;
		else res*=p, x/=p*p;
	}
	ll tmp=round(sqrt(x));
	if (tmp*tmp==x) res*=tmp;
	else res*=x*x;
	return res;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	for (int i=2; i<SQ; i++){
		bool bad=0;
		for (int p:Prime) if (i%p==0){
			bad=1;
			break ;
		}
		if (!bad) Prime.pb(i);
	}
	
	cin>>n;
	for (int i=1; i<=n; i++){
		cin>>A[i];
		for (ll p:Prime) while (A[i]%(p*p*p)==0) A[i]/=p*p*p;
		cnt[A[i]]++;
	}
	if (cnt.count(1)){
		cnt.erase(1);
		ans++;
	}
	while (cnt.size()){
		ll x=cnt.begin()->first, y=F(x);
		ans+=max(cnt[x], cnt[y]);
		cnt.erase(x);
		cnt.erase(y);
	}
	cout<<ans<<"\n";
	
	return 0;
}


Measured memory_bytes: 10636
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=9e18;
typedef pair<int,int> P;
ll power(int a,int b){
	int sum=1;
	for (; b; b>>=1){
		if (b&1)	sum=1ll*sum*a%MOD;
		a=1ll*a*a%MOD;
	}
	return sum;
}
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll n,a[100005]={},b[100005]={},f=0;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i];
    b[a[i]]++;
  }
  if(n%2) {
    for(int i=0; i<n; i+=2) {
      if(i==0) {
        if(b[i]!=1) {
          f=1;
        }
      }
      else {
        if(b[i]!=2) {
          f=1;
        }
      }
    }
  }
  else {
    for(int i=1; i<n; i+=2) {
      if(b[i]!=2) {
        f=1;
      }
    }
  }
  if(f) {
    cout << 0 << endl;
  }
  else {
    cout << power(2,n/2) << endl;
  }
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stack>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <assert.h>
#include <unordered_map>

using namespace std;

const int maxN = 2010;

#define FORU(i, l, r) for (int i = l; i <= r; ++i)
#define FORD(i, r, l) for (int i = r; i >= l; --i)
#define REPU(i, r) for (int i = 0; i < r; ++i)
#define F first
#define S second
#define PB push_back
#define LL long long
#define BIT(x, i) ((x >> i) & 1)
#define PINT pair < int, int >
#define MP make_pair

vector < int > lst, chosen;
int res, a[maxN], n, q, k;

void choose() {
    if (lst.size() >= k) {
        sort(lst.begin(), lst.end());
        REPU(t, lst.size() - k + 1)
            chosen.PB(lst[t]);
    }
    lst.clear();
}

int main() {
    cin >> n >> k >> q;
    FORU(i, 1, n) cin >> a[i];
    res = 1e9;
    FORU(i, 1, n) {
        FORU(j, 1, n) {
            if (a[j] < a[i]) choose();
            else lst.PB(a[j]);
        }
        choose();
        if (chosen.size() >= q) {
            sort(chosen.begin(), chosen.end());
            res = min(res, chosen[q - 1] - chosen[0]);
        }
        chosen.clear();
    }
    cout << res << endl;
}


Measured memory_bytes: 256
char*U="ixcm",*p,a[9],b[9];w,e;D(char*s){for(w=0,e=1;*s;s++)e=(p=strchr(U,*s))?w+=e*pow(10,p-U),1:*s-48;return w;}main(v,i,d){for(scanf("%*d");~scanf("%s%s",a,b);puts(""))for(v=D(a)+D(b),i=4;i--;d&&putchar(U[i]))d=v/pow(10,i),(d%=10)>1&&putchar(48+d);}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    int ans = 0;
    int sum = 0;
    rep(i,n-1){
        if (h[i] >= h[i+1]){
            sum++;
        }
        else{
            ans = max(ans, sum);
            sum = 0;
        }
        
    }
    ans = max(ans, sum);
    cout << ans << endl;
}

Measured memory_bytes: 3732
import itertools

n, m = map(int, input().split())
connect = [set() for _ in range(n)]

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    connect[a].add(b)
    connect[b].add(a)

ans = 0
for order in itertools.permutations(list(range(1,n))):
    ok = True
    now = 0
    for to in order:
        if to not in connect[now]:
            ok = False
            break
        now = to

    if ok:
        ans += 1

print(ans)

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

int main()
{
	string s;
	cin >> s;
	int a = 0, b = 0;
	for (int i = 0; i < 3; i++)
	{
		for (int j = i+1; j < 4; j++)
		{
			if (s[i] == s[j] && j != i && s[j] != '0')
			{
				a += 2;
				s[j] = '0';
			}
		}
	}
	if (a != 4)
	{
		cout << "No" << endl;
	}
	else
	{
		cout << "Yes" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll a,b,k; cin>>a>>b>>k;
	ll cur=min(a,k);
	a-=cur; k-=cur;
	cur=min(b,k);
	b-=cur; k-=cur;
	cout<<a<<" "<<b<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i, n) for(ll i = 0; i < (n); i++)
//pow(x,n)
//cout << fixed << setprecision(桁数);

int main() {
    int64_t n, k;
    cin >> n >> k;

    int64_t kai=n/k;
    int64_t a = n-k*kai;
    int64_t b = k*(kai+1)-n;
    cout << min(a,b) << endl;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
 
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpi;
typedef vector<pair<ll, ll> > vpl;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string w;
  cin >> w;
  int a[26]={0};
  rep(i,(int)w.size()){
    a[w[i]-'a']++;
  }
  rep(i,26){
    if(a[i]%2!=0){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define ll long long
# define pb push_back
# define fi first
# define se second
# define mp make_pair
# define gcd(m,n)  __gcd(m, n)
# define pr_double(x) cout << fixed << setprecision(10) << x


using namespace std;

int main() {
    string n;
    cin>>n; ll sum=0;
    for(ll i=0;i<n.size();i++)
    {
        sum+=(n[i]-'0');
    }
    if(sum%9==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

int		main(void)
{
	vector<int> sum(4);
	int n;
	cin >> n;

	for (int i = 0; i < n; ++i)
	{
		string s;
		cin >> s;

		if (s == "AC")
			++sum[0];
		else if (s == "WA")
			++sum[1];
		else if (s == "TLE")
			++sum[2];
		else
			++sum[3];
	}
	cout << "AC x " << sum[0] << endl;
	cout << "WA x " << sum[1] << endl;
	cout << "TLE x " << sum[2] << endl;
	cout << "RE x " << sum[3] << endl;
}



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

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REP1(i, n) for(ll i = 1;i < n;i++)
#define REPR(i, n) for(ll i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)

#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())

#define ll long long
#define ALL(a)  (a).begin(),(a).end()

#define pb(a) push_back(a)

int n,k;


int main(){
  int ans=0;
  cin >> n >> k;
  if (n>=(k*2-1))
  {
    cout<<"YES"<<endl;
    return 0;
  }


    cout<<"NO"<<endl;
    return 0;
}

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


int main(){

    string S, T;
    cin >> S >> T;


    bool can = false;
    for( int i = 0; i < S.size(); i++ ){
        S.insert( S.begin(), S.back() );
        S.pop_back();
        if( S == T ){
            can = true;
            break;
        }
    }
    
    if( can ) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;

}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#define MAXN 100+5

typedef long long ll;

const int INF=0x7fffffff;

using namespace std;

int f[MAXN][10+5];
int p[MAXN][10+5];

int main() {
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=10;j++){
			scanf("%d",&f[i][j]);
		}
	}
	
	for(int i=1;i<=n;i++){
		for(int j=0;j<=10;j++){
			scanf("%d",&p[i][j]);
		}
	}
	ll ans=-INF,temp=-INF;
	for(int b=1;b<=1023;b++){//b的二进制代表10个时间段Joisino店铺的开关情况 ，最多有1023个b 
		ll cc=0;
		for(int i=1;i<=n;i++){//枚举n个店铺的开关情况 
			int c=0;			//与当前店铺同时开的时间段有多少个 
			for(int j=1;j<=10;j++){//枚举当前店铺10个时间段的开关情况 
				if((b>>(j-1)&1)&&f[i][j]){	//通过b>>j取出第j个时间段的开关情况，& 1 取最后一位
				//如果取出来是1，并且当前店铺这个时间段也开着，那么就是同时开放的 
					c++;
				}
			}
			cc+=p[i][c];//与当前店铺同时开放的时间段数量是c，收益就是p[i][c] 
		}
		if(cc>ans){
			ans=cc;
		}
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#include<ctype.h>

int main(void){
	char y,g[3000]={'\0'};
	int a[26]={0},i=0,k;
	while((y=getchar())!=EOF){
		y=tolower(y);
		for(k=0;k<26;k++){
			if(y=='a'+k){
				a[k]++;
			}
		}
	}
	for(k=0;k<26;k++){
		printf("%c : %d\n",'a'+k,a[k]);
	}
	return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <queue>
#define MAXN 1000000 + 5

int a[MAXN] = {};

using namespace std;

int main()
{
    int n, k, iter, temp;
    long long ans = 0LL;
    queue <int> q1, q2;
    cin >> n >> k;
    for(iter = 0; iter < n; iter ++)
        scanf("%d", &a[iter]);
    sort(a, a+n);
    for(iter = n-1; iter >= 0; iter --)
        q1.push(a[iter]);
    while(1)
    {
        if(!q1.empty())
        {
            if(!q2.empty())
                if(q1.front()>q2.front())
                {
                    q2.push((q1.front()>>1));
                    q1.pop();
                }
                else
                {
                    q2.push((q2.front()>>1));
                    q2.pop();
                }
            else
            {
                q2.push((q1.front()>>1));
                q1.pop();
            }
        }
        else
        {
            if(!q1.empty())
                if(q2.front()>q1.front())
                {
                    q1.push((q2.front()>>1));
                    q2.pop();
                }
                else
                {
                    q1.push((q1.front()>>1));
                    q1.pop();
                }
            else
            {
                q1.push((q2.front()>>1));
                q2.pop();
            }
        }
        k --;
        if(!k)
            break;
    }
    while(!q1.empty())
    {
        ans += q1.front();
        q1.pop();
    }
    while(!q2.empty())
    {
        ans += q2.front();
        q2.pop();
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
using namespace std;
int n;
char s[10];
int in(int i){
    cout<<i<<endl;
    cin>>s;
    if(s[0]=='M')return 0;
    else if(s[0]=='F')return 1;
    else return 2;
}
int main(void){
   cin>>n;
   int r=0,l=n-1,p=in(0);
   if(p==2){
       return 0;
   }
   while(1){
       int m=(r+l)/2;
       if(l-r==1){
           if(in(r)!=2)in(l);
           return 0;
       }
    int x=in(m);

       if(x==2){
           return 0;
       }
       if(((m-r)%2==1&&x==p)||((m-r)%2==0&&x!=p)){
           l=m-1;
       }else{
           r=m;
           p=x;
       }
   }
    
}


Measured memory_bytes: 852
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i;
    string s;
    cin>>s;
    for(i=1; i<=s.size(); i++)

    {
        if(s[i]==s[i-1])
        {
            cout<<"Bad"<<endl;
            return 0;

        }

    }
            cout<<"Good"<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;

int main(){
    int n,l;
    cin >> n >> l;
    int t[n];
    int ice[n];

    priority_queue<pair<int,int> > q;
    fill((int *)t, (int *)t+n,0);
    for(int i=0;i<n;i++){
        cin >> ice[i];
        q.push(make_pair(ice[i], i));
    }

    int len, index;
    while(!q.empty()){
        len = q.top().first;
        index = q.top().second;
        q.pop();
        
        if(index == 0){
            t[index] = t[1] + (l - len);
        }else if(index == n-1){
            t[index] = t[n-2] + (l - len);
        }else{
            t[index] = max(t[index-1], t[index+1]) + (l - len);
        }
    }
    int ret = -1;
    for(int i=0;i<n;i++){
        ret = max(ret, t[i]);
    }
    cout << ret << endl;
}

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

int main()
{
    int d[10];
    for(int i=0; i<= 4; i++) d[i] = 0;
    for(int i=0; i<6; i++)
    {
        int z;
        cin >> z;
        d[z]++;
    }
    if(d[1] <= 2 && d[2] <= 2 && d[3] <= 2 && d[4] <= 2) cout << "YES";
    else cout << "NO";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <queue>
#include <complex>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
 
double PI = acos(-1.0);
const double EPS = 1e-10;
typedef complex<double> P,point;
struct C {P p; double r;C(const P &p, double r) : p(p), r(r) { } C(){} };
 
vector<P> C_cp(C a,C b){
	vector<P> ret;
	double L = abs(a.p-b.p);
  
	if( L-a.r-b.r > EPS || (abs(a.p-b.p)<EPS && fabs(a.r-b.r)<EPS) || 
		abs(a.p-b.p) < abs(a.r-b.r)
	)return ret;
  
	double theta = atan2(b.p.imag()-a.p.imag(),b.p.real()-a.p.real());
	double c = (L*L+a.r*a.r-b.r*b.r)/(2*L*a.r);
	ret.push_back(
		P(a.p.real()+a.r*cos(theta+acos(c)),
		  a.p.imag()+a.r*sin(theta+acos(c)))
	);
	if(fabs(L-a.r-b.r) > EPS)
		ret.push_back(
			P(a.p.real()+a.r*cos(theta-acos(c)),
			  a.p.imag()+a.r*sin(theta-acos(c)))
		);
	return ret;
}
  
  
bool have(C a,C b){
	return abs(a.p-b.p) + b.r < a.r + EPS;
}
bool pHave(C a,P b){
	return abs(a.p-b) < a.r + EPS;
}
 
bool hit( C a,C b ){
	return abs(a.p-b.p) < a.r + b.r - EPS;
}
 
double deg(C c,P p){
	p -= c.p;
	return atan2(p.imag(),p.real());
}

int main(){
	int n;
	while(cin >> n && n){
		vector<C> c_;
		for(int i = 0 ; i < n ; i++){
			double x,y,r;
			cin >> x >> y >> r;
			c_.push_back(C(P(x,y),r));
		}
		bool dead[100] = {};
		for(int i = 0 ; i < n ; i++){
			for(int j = 0 ; j < n ; j++){
				if( i != j ){
					if( have(c_[i],c_[j]) ) dead[j] = true;
				}
			}
		}
		vector<C> c;
		for(int i = 0 ; i < n ; i++)
			if( !dead[i] ) c.push_back(c_[i]);
		 
		vector<double> arc[100];
		 
		n = c.size();
		 
		for(int i = 0 ; i < n ; i++){ // kottiga 
			for(int j = 0 ; j < n ; j++){ // kottiwo taberu
				if( i != j && hit(c[i],c[j]) ){
					vector<P> cp = C_cp(c[i],c[j]);
					arc[i].push_back(deg(c[i],cp[0]));
					arc[i].push_back(deg(c[i],cp[1]));
				}
			}
		}
		double answer = 0;
		for(int i = 0 ; i < n ; i++){
			sort(arc[i].begin(),arc[i].end());
			//cout << i << " : ";
			if( arc[i].size() == 0 ) answer += 2 * PI * c[i].r;
			
			for(int j = 0 ; j < arc[i].size() ; j++){
				//cout << arc[i][j] << " ";
				double X = arc[i][j];
				double Y = arc[i][(j+1)%arc[i].size()];
				if( fabs(X-Y) < EPS ) continue;
				if( X > Y ) Y += 2 * PI;
				double Z = (X+Y) / 2.0;
				//cout << c[i].p + c[i].r * P( cos(X) , sin(X) ) << "<" << endl;
				P mid = c[i].p + c[i].r * P( cos(Z) , sin(Z)  );
				int flag = 1;
				for(int k = 0 ; k < n ; k++){
					if( k != i && pHave(c[k],mid) ){
							flag = 0;	
					}
				}
				if(flag)answer += (2 * c[i].r) * PI * ( (Y-X) / (2 * PI) );
			}
			//cout << endl;
		}
		printf("%.10lf\n",answer);
	}
}

Measured memory_bytes: 1420
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#include <numeric>
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


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

	int N, M;
	cin >> N >> M;
	vector<pair<int, int>>p;
	if (N % 2 == 1) {
		for (int i = 0; i < M; i++)p.pb({ i + 1,N - i - 1 });
	}
	else {
		for (int i = N / 2; i >= 0;i--) {
			p.pb({i,N-i+1});
			if (p.size() == M)break;
			if (p.size() == N / 4)break;
		}
		if (p.size() != M) {
			for (int i = 1; i <= N; i++) {
				p.pb({i,N-i});
				if (p.size() == M)break;
			}
		}
	}
	fore(x, p)cout << x.first << " " << x.second << endl;

	return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int a,b,k;
    cin>>a>>b>>k;
    rep(t,k){
        if(t%2==0){
            if(a&1)a--;
            a/=2;
            b+=a;
        }
        else{
            if(b&1)b--;
            b/=2;
            a+=b;
        }
    }
    cout<<a<<" "<<b<<endl;
}


Measured memory_bytes: 256
// Template by [thunder_blade]
// IIIT ALLAHABAD
// includes :)

#include <bits/stdc++.h>
#include <ext/rope> 
#include <ctime>
using namespace __gnu_cxx;
using namespace std;
#define TEST  ll test_case; cin>>test_case; while(test_case--)
#define all(v) (v).begin(),(v).end()
#define fi  first
#define se  second
#define pb push_back
#define mp make_pair
#define ll long long int
#define SPEED ios_base::sync_with_stdio(false);  cin.tie(0);  cout.tie(0);
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define pf(x) printf("%f\n",x)
#define ps(x) printf("%s\n",x)
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define sf(x) scanf("%f",&x)
#define ss(x) scanf("%s",x)
#define pis(x) printf("%d ",x)
#define pls(x) printf("%lld ",x)
#define pfs(x) printf("%f ",x)
#define pss(x) printf("%s ",x)
#define FOR(i,a,b) for(i=a;i<b;i++)
#define mod 1000000007
#define pii pair<int,int>
#define tr(container, it)  for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
ll power(ll a, ll n) {
  ll p = 1;
  while (n > 0) {
    if(n&1) {
      p = ((p%mod) * (a%mod))%mod; 
    } 
    n >>= 1; 
    a = ((a%mod)*(a%mod))%mod;
  } 
  return p%mod;
}

const long long B = 100000007; 
const long long M = 1000000009;
const int N = 500005;
ll a[N];
ll b[N], c[N];
int main()
{
  ll maxi = 0;
  ll k;
  sl(k);
  for(int i=1;i<=k;i++){
   sl(a[i]);
   maxi = max(maxi, a[i]);
 }
  if(a[k]!=2){
    pi(-1);
    return 0;
  }
  b[k] = 3;
  ll pre = 3;
  ll pre2 = 2;
  int f = 0;
  for(int i = k-1;i>=1;i--){
    ll x = pre/a[i];
    x = x * a[i];
    if( x == 0 ){
      f=1;
      break;
    }
    pre = (x + a[i] - 1);

    x = (pre2/a[i]) + ((pre2%a[i])?1:0);
    x = x * a[i];

    if(x > pre)f=1;
    pre2 = x;
  }

  
  if(f){
    pi(-1);
    return 0;
  }
  pls(pre2),pl(pre);
}

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

const int M=1e9;
long long S;
long long x2,y2;

int main()
{
	cin>>S;
	if(S<=M)
	cout<<"0 "<<"0 "<<"1 "<<"1000000000 "<<"1 "<<1000000000-S<<endl;
	else
	{
		y2=M-S%M;
		x2=(S+y2)/M;
		if (x2==M+1&&y2==M)
		{
    		x2=M;
    		y2=0;
  		}
		cout<<"0 "<<"0 "<<"1 "<<"1000000000 "<<x2<<" "<<y2<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;

std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {
    std::stringstream ss(s);
    std::string item;
    while (std::getline(ss, item, delim)) {
        elems.push_back(item);
    }
    return elems;
}

std::vector<std::string> split(const std::string &s, char delim) {
    std::vector<std::string> elems;
    split(s, delim, elems);
    return elems;
}

int _stoi(string s) {
    return atoi(s.c_str());
}

int popValue(stack<int> *S) {
    int retVal = S->top();
    S->pop();
    return retVal;
}

int main(int argc, const char * argv[]) {
    vector<int> S;
    vector<int> T;
    string s;
    int n = -1;
    int q = -1;
    while(cin >> s){
        if (n == -1) {
            n = _stoi(s);
        } else if( n > 0 ) {
            n--;
            S.push_back(_stoi(s));
        } else if ( q == -1) {
            q = _stoi(s);
        } else if( q > 0 ){
            q--;
            T.push_back(_stoi(s));
        }
    }
    
    sort(S.begin(), S.end());
    sort(T.begin(), T.end());
    int j = 0;
    int total = 0;
    for (int i = 0; i < T.size(); i++) {
        int t = T[i];
        while (j < S.size() && S[j] <= t) {
            if (S[j] == t) {
                total++;
                break;
            }
            j++;
        }
    }
    
    cout << total << endl;
    
    return 0;
}

Measured memory_bytes: 1328
#include<stdio.h>

int main(void){
  
  int x = 0, y = 0, z = 0;
  scanf("%d%d", &x, &y);
  
  while(1){

    if(x % y == 0){
      break;
    }

    if(x >= y){
      z = x % y;
      x = y;
      y = z;
      continue;
    }

    if(x < y){
      z = x;
      x = y;
      y = z;
      continue;
    }
  }
  printf("%d\n", y);
  return 0;
}

Measured memory_bytes: 592
#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 a, b, c, k;
    cin >> a >> b >> c >> k;
    int m = max(max(a, b), c);
    int ans = m*pow(2,k) + a + b + c - m;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;

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

    cout << 3 * r * r << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>
#include <queue>

using namespace std;
typedef long long ll;
#define MOD 1000000007

int main() {
    ll S;

    cin >> S;

    ll x1 = 1e9;
    ll y1 = 1;
    ll x2 = (x1 -S % x1) % x1;
    ll y2 = (S + x2) / x1;
    cout << 0 << " " << 0 << " " << x1 << " " << y1 << " " << x2 << " " << y2 <<endl;

    return 0;
}

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

int main() {
  string s, t;
  cin >> s >> t;
  bool found = 0;
  for (int i = 0; i < s.length() - t.length() + 1; i++) {
    int count = 0;
    for (int j = 0; j < t.length(); j++) {
      if (s[s.length() - i - j - 1] == t[t.length() - j - 1] ||
          s[s.length() - i - j - 1] == '?') {
        count += 1;
        if (count == t.length()) {
          found = 1;
        }
      } else
        break;
    }
    if (found) {
      for (int j = 0; j < t.length(); j++) {
        s[s.length() - i - j - 1] = t[t.length() - j - 1];
      }
      break;
    }
  }
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '?')
      s[i] = 'a';
  }
  if (found)
    cout << s << endl;
  else
    cout << "UNRESTORABLE" << endl;
}


Measured memory_bytes: 256
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
min = 0
for i in range(N):
    if abs(T - H[min] * 0.006 - A) > abs(T - H[i] * 0.006 - A):
        min = i
print(min+1)


Measured memory_bytes: 62740
import numpy as np

def manhattan(x,y):
    return np.abs(x[0]-y[0]) + np.abs(x[1]-y[1])

N,M = map(int,raw_input().split())
students = np.zeros((N,2))
checkpoints = np.zeros((M,2))
for i in range(N):
    students[i][0],students[i][1] = map(int,raw_input().split())
#print a
for j in range(M):
    checkpoints[j][0],checkpoints[j][1] = map(int,raw_input().split())

index = np.zeros(N)
for i in range(N):
    min = 200000000
    for j in range(M):
        d = manhattan(students[i],checkpoints[j])
        if min > d:
            min = d
            index[i] = j
    print (index[i]+1).astype(np.int32)


Measured memory_bytes: 18668
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


X = z()
lis = list(range(100, 106))

max_num_item = int(X / 100)
min_num_item = int(X / 105)

for num_item in range(min_num_item, max_num_item + 1):
    tmp_x = X
    tmp_x = tmp_x - 100 * num_item
    if (tmp_x <= num_item * 5):
        print(1)
        exit()
print(0)


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

bool check(vector<int> &v, vector<vector<bool>> &paths, int &N) {
  rep(i, N - 1) {
    int a = v.at(i), b = v.at(i + 1);
    if (!paths.at(a).at(b)) return false;
  }
  return true;
}

int main() {
  int N, M;
  cin >> N >> M;

  vector<vector<bool>> paths(N + 1, vector<bool>(N + 1, false));
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    paths.at(a).at(b) = true;
    paths.at(b).at(a) = true;
  }

  int ans = 0;

  vector<int> v(N, 1);
  iota(next(v.begin()), v.end(), 2);
  do {
    if (check(v, paths, N)) ans++;
  } while (next_permutation(next(v.begin()), v.end()));

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


Measured memory_bytes: 256
#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 pcnt(int x) {
  return __builtin_popcount(x);
}
int f(int x) {
  if (x == 0) return 0;
  return f(x%pcnt(x))+1;
}

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> x(n);
  rep(i,n) x[i] = s[i]-'0';
  int pc = 0;
  rep(i,n) pc += x[i];
  vector<int> ans(n);
  rep(b,2) {
    int npc = pc;
    if (b == 0) npc++; else npc--;
    if (npc <= 0) continue;
    int r0 = 0;
    rep(i,n) {
      r0 = (r0*2)%npc;
      r0 += x[i];
    }
    int k = 1;
    for (int i = n-1; i >= 0; --i) {
      if (x[i] == b) {
        int r = r0;
        if (b == 0) r = (r+k)%npc;
        else r = (r-k+npc)%npc;
        ans[i] = f(r)+1;
      }
      k = (k*2)%npc;
    }
  }

  rep(i,n) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 5248
#include <stdio.h>
int main (void){
  int a, b, h, m, s;
  scanf ("%d", &a);
  s = a % 60;
  b = a / 60;
  m = b % 60;
  h = b / 60;
  printf ("%d:%d:%d\n", h, m, s);
  return 0;
}

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

long long gcd(long long a, long long b)
{
  if(a < b) swap(a, b);
  long long r = a%b;
  while(r != 0)
  {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}

int main()
{
  int n;
  cin >> n;
  vector<long long> t(n);
  int i;
  long long lcm = 0;
  for(i = 0; i < n; i++)
  {
    cin >> t.at(i);
  }
  for(i = 0; i < n-1; i++)
  {
    if(i == 0)
    {
      lcm = t.at(0) / gcd(t.at(0), t.at(1)) * t.at(1);
    }
    else
    {
      lcm = lcm / gcd(lcm, t.at(i+1)) * t.at(i+1);
    }
  }
  if(lcm == 0) lcm = t.at(0);
  cout << lcm << endl;
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var acum = new long[N];
            var array = new int[N - 1][];

            for (var i = 0; i < N - 1; i++)
            {
                array[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            }

            for (var i = 0; i < N; i++)
            {
                var t = 0;
                for (var j = i; j < N - 1; j++)
                {
                    if (t < array[j][1]) t = array[j][1];
                    else if (t % array[j][2] == 0) ;
                    else t = t + array[j][2] - t % array[j][2];
                    t += array[j][0];
                }
                Console.WriteLine(t);
            }
        }
    }
}


Measured memory_bytes: 13396
(* O(|s|) *)
let s = read_line () in
let n = String.length s in
let rec find acc bc i =
  if i < 0 then acc
  else if i >= 1 && s.[i - 1] = 'B' && s.[i] = 'C' then find acc (bc + 1) @@ i - 2
  else if s.[i] = 'A' then find (acc + bc) bc @@ i - 1
  else find acc 0 @@ i - 1 in
find 0 0 @@ n - 1 |> Printf.printf "%d\n"

Measured memory_bytes: 2816
#include <bits/stdc++.h>  // ver2.2.9
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define COUNT(a,k) upper_bound(ALL(a),k)-lower_bound(ALL(a),k)
#define BIGGER(a,k) a.end()-upper_bound(ALL(a),k)
#define SMALLER(a,k) lower_bound(ALL(a),k)-a.begin()
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Pii pair<int,int>
#define VPii vector<Pii>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define itos to_string
#define stoi stoll
#define FI first
#define SE second
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define cyes cout<<"yes"<<endl
#define cno cout<<"no"<<endl
#define _ <<' '<<
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vin(a) rep(iI,0,a.size())cin>>a[iI]
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lY,0,a.size()){if(!a[lY].empty()){Vout(a[lY]);}else cout<<endl;}
#define VPout(a) rep(lX,0,a.size())cout<<a[lX].FI<<' '<<a[lX].SE<<endl
#define Verr(a) rep(iZ,0,a.size()-1)cerr<<a[iZ]<<' ';cerr<<a.back()<<endl
#define VVerr(a) rep(J,0,a.size()){if(!a[J].empty()){Verr(a[J]);}else cerr<<'.'<<endl;}
#define VPerr(a) rep(iX,0,a.size())cerr<<a[iX].FI<<' '<<a[iX].SE<<endl
#define INF 3000000000000000000  //  3.0*10^18(MAXの1/3くらい)
#define MAX LLONG_MAX
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int scomb(int n, int r){  //  nCr (小さい場合)
int a=1;for(int i=n;i>n-r;--i){a=a*i;}for(int i=1;i<r+1;++i){a=a/i;}return a;}
int comb(int n, int r){  //  nCr (%MOD)
int a=1;for(int i=n;i>n-r;--i){a=a*i%MOD;}for(int i=1;
i<r+1;++i){a=a*mypow(i,MOD-2,MOD)%MOD;}return a%MOD;}
int stpow(int n){  //  階乗(%MOD)
if(n==0)return 1;int a=1;rep(i,1,n+1)a=a*i%MOD;return a;}
Vi stpowV(){Vi a(100001);  //  階乗配列(%MOD)
a[0]=1;repeq(i,1,100000)a[i]=a[i-1]*i%MOD;return a;}
void press(auto &v){v.erase(unique(ALL(v)),v.end());}  //  圧縮



signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int n;
  cin >> n;
  if(n%2==1){cNo;return 0;}
  string s;
  cin >> s;
  int m = n/2;
  
  rep(i,0,m){
    if(s[i]!=s[i+m]){cNo;return 0;}
  }
  cYes;
  return 0;
}

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

int main()
{
 int N = 5;
 int A, B, C, D, E;
 cin >> A >> B >> C >> D >> E;
 vector<int> currentTime = {A, B, C, D, E};
 vector<int> nextTime(N);
 for(int i = 0; i < N; i++)
 {
     if(currentTime[i] % 10 == 0)
     {
         nextTime[i] = currentTime[i];
     }
     else
     {
        nextTime[i] = currentTime[i] - currentTime[i] % 10 + 10;
     }
 }
     int BestTime = 999999;
     for(int i = 0; i < N; i++)
     {
         int sumTime = 0;
     for(int j = 0; j < N; j++){
         if(i == j)
         {
             sumTime += currentTime[i];
         }
         else
         {
             sumTime += nextTime[j];
         }
     }
     BestTime = min(BestTime, sumTime);
}
 cout << BestTime << endl;
}

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

const ll INF = 1LL << 60;

vector<ll> calc_divisor(ll n) {
    vector<ll> res;
    for (ll i = 1LL; i*i <= n; ++i) {
        if (n % i == 0) {
            res.push_back(i);
            ll j = n / i;
            if (j != i) res.push_back(j);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

vector<pair<ll, ll>> prime_factorize(ll n) {
    vector<pair<ll, ll>> res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

ll N;
map<ll, ll> mp;

int main() {
    cin >> N;

    // 素因数分解から約数を求める方針
    for (int i = 1; i <= N; i++) {
        vector<pair<ll, ll>> tmp = prime_factorize(i);

        rep(j, tmp.size()) {
            mp[tmp[j].first] += tmp[j].second;
        }
    }

    // 全列挙は無理なので、約数の数が75になる数を探す
    // N=100で、約数の数: 1621986508800 
    // 75 = 3 * 5 * 5
    // debug
    ll a = 1;
    ll a1 = 0; // 素因数が 3つ以上ある 2以上
    ll a2 = 0; // 素因数が 5つ以上ある 4以上

    ll a4 = 0;

    ll b15 = 0; 
    ll b25 = 0; 
    ll b75 = 0; 
    for (auto m : mp) {
        // cout << m.first << " " << m.second << endl;
        if (m.second + 1 >= 3) {
            a1++;
        }
        if ((m.second + 1) >= 5) {
            a2++;
        }

        if ((m.second + 1) >= 15) b15++;
        if ((m.second + 1) >= 25) b25++;
        if ((m.second + 1) >= 75) b75++;
    }


    // 3 * 5 * 5 
    // 5を選ぶ選択肢
    // a2 c 2
    ll ans_5 = a2 * (a2 - 1) / 2;
    // cout << ans << endl;
    // 3を選ぶ選択肢 (a1 - 2) C 1
    ll ans_3 = (a1 - 2);

    ll ans = ans_5 * ans_3;

    // 5 * 15
    ll ans2 = b15 * (a2 - 1);
    ans += ans2;

    // 3 * 25
    ll ans3 = b25 * (a1 - 1);
    ans += ans3;

    // 1 * 75
    ll ans4 = b75;
    ans += ans4;
    // cout << ans4 << endl;

    cout << ans << endl;
}

Measured memory_bytes: 3636
'use strict'

const main = s => {
  s = s.split('\n')[0].split(' ').map(n => Number(n));

  const A = s[1];
  const B = s[2];

  const ans = ((A - B) % 2 === 0) ? 'Alice' : 'Borys';
  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * AtCoder Beginner Contest 1xx
 *
 * https://atcoder.jp/contests/abc1xx/tasks/abc1xx_c
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        List<Integer> list = IntStream.range(0, n)
                .mapToObj(i -> {
                    return sc.nextInt();
                })
                .collect(Collectors.toList());
        int avg = (int) Math.round(list.stream().mapToInt(m -> m).average().getAsDouble());
        System.out.println(list.stream().mapToInt(m -> (int) Math.pow(m - avg, 2)).sum());
    }
}


Measured memory_bytes: 28884
fun main(arg: Array<String>) {
    val (N, M) = listOfInt()
    val red = Array<Boolean>(N) {false}
    val box = Array<Int>(N) {1}
    red[0] = true
    for (m in 1 .. M) {
        val (x, y) = listOfInt(-1)
        if (red[x]) red[y] = true 
        box[y] += 1; box[x] -= 1
        if (box[x] == 0) red[x] = false 
    }
    println(red.count {it})
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }

Measured memory_bytes: 56784
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  ll n,a[5]={},m=0;
  cin>>n;
  string s[n],tem="MARCH";
  rep(i,0,n) cin>>s[i];
  ll c=0,ans=0;
  rep(i,0,5){
    rep(j,0,n){
      if(s[j][0]==tem[i]) a[i]++;
    }
  }
  rep(i,0,3){
    rep(j,i+1,4){
      rep(k,j+1,5){
        ans+=a[i]*a[j]*a[k];
      }
    }
  }
  co(ans);
  
  return 0;
}

Measured memory_bytes: 6144
h, w = map(int, input().split())
y, x = -1, -1
for i in range(h):
    d = input().split()
    for j in range(w):
        if d[j] == "snuke":
            y, x = i, j
a = chr(ord("A") + x )
print("{0}{1}".format(a, y+1))


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
void chmax(T1 &a, const T2 &b) {
  if(a < b) a = b;
}
template <typename T1, typename T2>
void chmin(T1 &a, const T2 &b) {
  if(a > b) a = b;
}
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i != (int)(s.size())-1) cout << " ";
  }
  cout << "\n";
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
const int _base = 1e9 + 7;
struct RollingHash
{
  vector< unsigned > hashed, power;
  RollingHash(const string& s)
  {
    int sz = s.size();
    hashed.assign(sz + 1, 0);
    power.assign(sz + 1, 0);
    power[0] = 1;
    for(int i = 0; i < sz; i++) {
      power[i + 1] = power[i] * _base;
    }
    for(int i = 0; i < sz; i++) {
      hashed[i + 1] = (hashed[i] + s[i]) * _base;
    }
  }
  unsigned get(int l, int r)
  {
    return((hashed[r] - hashed[l] * power[r - l]));
  }
  unsigned connect(int h1, int h2, int h2len)
  {
    return(h1 * power[h2len] + h2);
  }
  int LCP(RollingHash& b, int l1, int r1, int l2, int r2)
  {
    int len = min(r1 - l1, r2 - l2);
    int low = -1, high = len + 1;
    while(high - low > 1) {
      int mid = (low + high) >> 1;
      if(get(l1, l1 + mid) == b.get(l2, l2 + mid)) low = mid;
      else high = mid;
    }
    return(low);
  }
};
bool solve() {
  int n, m; cin >> n >> m;
  if(n == 0) return false;
  vector<string> e(n);
  string t = "";
  for(int i=0;i<n;++i) {
    cin >> e[i];
  }
  for(int i=0;i<m;++i) {
    string tmp; cin >> tmp;
    for(int j=0;j<(int)(tmp.size());++j) {
      t.push_back(tmp[j]);
    }
  }
  m = (int)(t.size());
  vector<RollingHash> vrh;
  for(int i=0;i<n;++i) {
    vrh.emplace_back(RollingHash(e[i]));
  }
  RollingHash rh(t);
  vector<bitset<(1<<12)>> dp(m+1, bitset<(1<<12)>(0));
  int cnt = 0;
  for(int i=0;i<m;++i) {
    dp[i][0] = 1;
    for(int j=0;j<n;++j) {
      if(i + (int)(e[j].size()) <= m) {
        auto hash1 = rh.get(i, i+(int)(e[j].size()));
        for(int bit=0;bit<1<<n;++bit) {
          if(dp[i][bit] && !(bit>>j&1)) {
            auto hash2 = vrh[j].get(0, (int)(e[j].size()));
            if(hash1 == hash2) {
              dp[i+(int)(e[j].size())][bit | (1<<j)] = 1;
            }
          }
        }
      }
    }
    cnt += dp[i][(1<<n)-1];
  }
  cnt += dp[m][(1<<n)-1];
  cout << cnt << "\n";
  return true;
}
int main() {
  cout << fixed << setprecision(10);
  while(1) {
    if(!solve()) break;
  }
}



Measured memory_bytes: 5704
/*#include<iostream>

using namespace std;

int n,a[100],hai,tya,mido,mizu,ao,ki,dai,aka,jiyuu,kakutei,saidai;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		switch(a[i]/400){
		case 0:
			hai++;
			break;
		case 1:
			tya++;
			break;
		case 2:
			mido++;
			break;
		case 3:
			mizu++;
			break;
		case 4:
			ao++;
			break;
		case 5:
			ki++;
			break;
		case 6:
			dai++;
			break;
		case 7:
			aka++;
			break;
		default:
			jiyuu++;
			break;
		}
	}
	if(hai!=0) kakutei++;
	if(tya!=0) kakutei++;
	if(mido!=0) kakutei++;
	if(mizu!=0) kakutei++;
	if(ao!=0) kakutei++;
	if(ki!=0) kakutei++;
	if(dai!=0) kakutei++;
	if(aka!=0) kakutei++;
	saidai=kakutei+jiyuu;
	if(kakutei==0) kakutei=1;
	if(saidai>8) saidai=8;
	cout<<kakutei<<" "<<saidai<<endl;
	return 0;
}*/
#include<iostream>

using namespace std;

int color[8],freecolor,input,n,minoutput,maxoutput;


int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>input;
		if(input<3200) color[input/400]++;
		else freecolor++;
	}
	for(int i=0;i<8;i++){
		if(color[i]!=0) minoutput++;
	}
	maxoutput=minoutput+freecolor;
	if(minoutput==0) minoutput=1; 
	cout<<minoutput<<" "<<maxoutput<<endl; 
	return 0;
}


Measured memory_bytes: 256