akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cassert>
#include <random>
#include <bitset>
using namespace std;
 

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define pb push_back
#define forn(i, n) for (int i = 0; i < n; ++i)
#define int long long

 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
 
 
const int MAXN = 2e5 + 5;
const ll MOD = 1e9 + 7;
const ll INF = INT64_MAX;


random_device rd;
mt19937 rnd(rd());


signed main() {
	FAST_IO;
	int n;
	cin >> n;
	vector<int> a(n);
	int allx = 0;
	forn(i, n) {
		cin >> a[i];
		allx ^= a[i];
	}
	forn(i, n) {
		cout << (allx ^ a[i]) << " ";
	}
	cout << "\n";
 	return 0;
}

Measured memory_bytes: 4716
import java.util.Scanner;

public class Main {
    void run() {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        if (a + b >= c)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
    public static void main(String[] args) {
        new Main().run();
    }
}


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

int main () {
  string s;
  cin >> s;
  int one = 0;
  int zero = 0;

  rep(i, s.size()) {
    if (s[i] == '1') one++;
    else zero++;
  }

  cout << min(one, zero) * 2 << endl;
}


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

int main()
{
	int n, k;
	
	scanf("%d %d", &n, &k);
	
	double ans = 0.0;
	for(int i = 1; i <= n; i++){
		if(i < k){
			ans += ((double)(1.00/(double)n)*pow(0.5,ceil(log2((double)k/(double)i))));
		}else{
			ans += (double)(1.00/(double)n);
		}
	}
	
	printf("%.12lf\n",ans);
}


Measured memory_bytes: 640
N = int(input())
S = list(input().split())

flag=[0]*4
for i in range(N):
    if S[i]=='P':
        flag[0]=1
    elif S[i]=='W':
        flag[1]=1
    elif S[i]=='G':
        flag[2]=1
    elif S[i]=='Y':
        flag[3]=1

if sum(flag)==4:
    print('Four')
else:
    print('Three')


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

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

  int a[n];
  rep (i, n) cin >> a[i];

  int ans = 0;
  // int flag = -1; // 0:<, 1:=, 2:>
  for (int i = 0; i < n; i++) {
    while (i+1 < n && a[i] == a[i+1])
      i++;

    if (i+1 < n && a[i] < a[i+1]) {
      while (i+1 < n && a[i] <= a[i+1])
        i++;
    }
    else if (i+1 < n && a[i] > a[i+1]) {
      while (i+1 < n && a[i] >= a[i+1])
        i++;
    }

    ans++;

    // if (i == n-1 && flag == -1) {
    //   ans++;
    //   break;
    // } else if (i == n-1) break;
    // if (flag == -1 || flag == 1) {
    //   if (flag == -1) ans++;
    //   if (a[i] < a[i+1]) flag = 0;
    //   else if (a[i] == a[i+1]) flag = 1;
    //   else flag = 2;
    // }
    // if (flag == 0) {
    //   if (a[i] > a[i+1]) flag = -1;
    // } else if (flag == 2) {
    //   if (a[i] < a[i+1]) flag = -1;
    // }
  }

  cout << ans << endl;

  return 0;
}


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

#define ll long long
using P=pair<int,int>;

const int MOD=1e9+7;
const int INF=1<<31;
const int MAX=1e5;

int n;
int k;
int h;


void solve(){
    int cnt=0;
    cin>>n>>k;
    for(int i=0; i<n; i++){
        cin>>h;
        cnt+=h>=k;
    }
    cout<<cnt<<endl;
}

signed main(){
    //while(1)
    solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
        #define int long long int
        #define pb push_back
        #define mk make_pair
        #define ft first
        #define sc second
        #define ppb pop_back
        #define sz size
        #define forn(i,a,n) for(i=a;i<n;i++)
        #define M 998244353 
        #define inf 2e18

        bool compare(pair<int,int> a,pair<int,int> b){
            if(a.first==b.first)
                return a.second<b.second;
            return a.first<b.first;
        }

        signed main() {
 
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        int n;
        cin>>n;
        vector<int> v(n+1);
        for(int i=1;i<=n;i++)
            cin>>v[i];

        map<int,int> m;
        m[0]=0;
        int ans=0;
        for(int i=1;i<=n;i++){

            if(m.count(i-v[i])){
                ans+=m[i-v[i]];
            }
            m[v[i]+i]++;
        }
        cout<<ans;


        return 0;
    }

Measured memory_bytes: 17120
#include<bits/stdc++.h>
/*
g++ -std=c++11 -Wall -g -fsanitize=undefined -D_GLIBCXX_DEBUG abc/abc057/c.cpp
*/
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int func(ll a, ll b){
    ll c = max(a, b);
    return int(log10(c)) + 1;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);//おまじないでcin, cout早くする
    ll N;
    cin >> N;
    int ans = func(1, N);
    ll k = sqrt(N);
    for(int i = 2; i <= k; i++){
        if(N % i == 0){
            ans = min(ans, func(i, N/i));
        }
    }
    cout << ans << "\n";
    return 0;
}

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

int main() {
    int N, Q;
    string S;
    set<int> pos[26];

    cin >> N >> S;

    for (int i = 0; i < N; i++)
        pos[S[i] - 'a'].insert(i);

    cin >> Q;
    for (int q = 1; q <= Q; q++) {
        int t;
        cin >> t;

        if (t == 1) {
            int idx;
            string c;

            cin >> idx >> c;
            pos[S[idx - 1] - 'a'].erase(idx - 1);
            S[idx - 1] = c[0];
            pos[S[idx - 1] - 'a'].insert(idx - 1);
        } else {
            int a, b;
            cin >> a >> b;

            int answer = 0;
            for (int c = 0; c < 26; c++) {
                auto ptr = pos[c].lower_bound(a - 1);
                if (ptr != pos[c].end() && *ptr <= b - 1)
                    answer += 1;
            }

            cout << answer << endl;
        }
    }
}


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

int main() {
    int n, k;cin >> n >> k;
    int ans = 1;
    while(true){
        if(n/k > 0){
            n /= k;
            ans++;
        }
        else break;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
//cout<<setprecision(20)
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int LBI(vector<llint>&ar,llint in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
int UBI(vector<llint>&ar,llint in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	llint i,n,m;cin>>n>>m;
	vector<vector<int>>go(n);
	llint bo=0,nibu=0,ren=0;
	for(i=0;i<m;i++){
		int u,v;cin>>u>>v;u--;v--;
		go[u].pub(v);
		go[v].pub(u);
	}
	vector<int>oto(n);//音～
	for(i=0;i<n;i++){
		if(go[i].size()==0){bo++;oto[i]=1;continue;}//お布団0人
		if(oto[i]){continue;}
		ren++;
		queue<int>que;
		bool ni=true;
		oto[i]=1;que.push(i);
		while(que.size()>0){
			int ter=que.front();que.pop();
			for(auto it:go[ter]){
				if(oto[it]==oto[ter]){ni=false;}
				if(oto[it]==0){
					oto[it]=3-oto[ter];
					que.push(it);
				}
			}
		}
		if(ni){nibu++;}
	}
	cout<<2*n*bo-bo*bo+ren*ren+nibu*nibu<<endl;
	return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c) { return b / c - (a - 1) / c; }

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}

int main() {
    long long k, n, max = -1;
    string s;
    cin >> k >> n;
    vector<int> as(n);
    for (int i = 0; i < n; i++) {
        cin >> as[i];
    }
    max = k - as[n - 1] + as[0];
    for (int i = 0; i < n - 1; i++) {
        if (as[i + 1] - as[i] > max) {
            max = as[i + 1] - as[i];
        }
    }
    cout << k - max << endl;
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int N;
int A [100] [100];
bool used [100] [100];

int main()
{
	scanf("%d",&N);
	if(N == 2){
		printf("-1\n");
		return 0;
	}
	memset(A,-1,sizeof(A));

	FOR(i,0,N){
		used [i] [i] = true;
	}

	bool flag = false;
	FOR(i,0,N - 1){
		vector<int> v;
		FOR(j,i,i + 3) v.push_back(j % N);
		int idx = 1 + flag;
		FOR(j,i,i + 3){
			A [j % N] [i] = v [idx];
			used [j % N] [v [idx]] = true;
			(++idx) %= 3;
		}
		flag = !flag;
	}

	FOR(i,0,N){
		int x = 0;
		FOR(j,0,N - 1) if(A [i] [j] == -1){
			while(used [i] [x] == true) x++;
			A [i] [j] = x;
			used [i] [x] = true;
		}
	}

	FOR(i,0,N) FOR(j,0,N - 1){
		printf("%d%s",A [i] [j] + 1,j == N - 2 ? "\n" : " ");
	}

	return 0;
}


Measured memory_bytes: 384
def B():
    a = [list(map(int, input().split())) for i in range(3)]
    n = int(input())
    b = [int(input()) for i in range(n)]

    for i in range(3):
        for j in range(3):
            for k in range(n):
                if(a[i][j] == b[k]):
                    a[i][j] = 1  

    if all(a[i][i] == 1 for i in range(3)) or (a[0][2] == a[1][1] == a[2][0] == 1):
        print("Yes")
        return
    else:
        for i in range(3):
            if all(a[i][j] == 1 for j in range(3)) or all(a[j][i] == 1 for j in range(3)):
                print("Yes")
                return

    print("No")

B()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <cstdio>
using namespace std;
typedef long long ll;

int gcd(int a,int b){
    int t;
    while(b>0){
        t=b;
        b=a%b;
        a=t;
    }
    return a;
}

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

int main(){
    ll c=10,d,e,f,k,l,m,n,o=0,o1,p,q,r,x,y,z,max1=0,ans=0;
    string t,u;
    cin>>n;
    map<string, ll> map1;
    ll a[c],b[n]={};
    string s;
    for(ll i=0;i<n;i++){
        cin>>s;
        sort(s.begin(),s.end());
        map1[s]++;
    }
    for(auto i:map1){
        ans+=i.second*(i.second-1)/2;
    }
    cout<<ans<<endl;
}

   




Measured memory_bytes: 11904
#include<iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#include <numeric>
using namespace std;
int main(){
int n;
cin>>n;
int L[2*n];
for(int i=0; i<2*n; ++i){
cin>>L[i];
}
sort(L,L+2*n);
int ans=0;
for(int i=0; i<n; ++i){
ans+=L[2*i];
}
cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using  namespace std;
typedef  long long ll;
const ll N = 1e12+5;
ll a,b;
bool isPrime(ll n){             //O(sqrt(n))
    if(n < 2)   return 0;       //{0, 1}
    for(ll i = 2 ; i <= n/i ; ++i)
        if(n%i == 0)
            return 0;
    return 1;
}
vector<ll> getDivisors(ll n){       //O(sqrt(n))
    vector<ll> ret;
    ll i;
    for(i = 1 ; i < n/i ; ++i){
        if(n%i == 0){
            ret.push_back(i);
            ret.push_back(n/i);
        }
    }
    if(i*i == n)    ret.push_back(i);
    return ret;
}
set <ll>s;
vector <ll> m;
int main() {
    scanf("%lld %lld", &a, &b);
    vector <ll> o = getDivisors(a);
    vector <ll> t = getDivisors(b);
    for(auto v : o) {
        for (auto u : t) {
            if (v == u && isPrime(v))
                s.insert(v);
        }
    }
    cout<<s.size()+1<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,c,p=0;
cin>>n;
cin>>m;
cin>>c;
int a[m];
int b[n][m];
for (int i = 0; i < m; ++i)
{cin>>a[i];}
for (int i = 0; i < n; ++i)
{for (int j = 0; j < m; ++j)
{cin>>b[i][j];
}
}

for (int i = 0; i < n; ++i)
{int t=0;
	for (int j = 0; j < m; ++j){t+=b[i][j]*a[j];}
if(t+c>0){p++;}}
cout<<p;


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;

int main(void){
    int n, x, t;
    cin >> n >> x >> t;
    cout << ((n + x - 1) / x) * t << endl;
    return 0;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
#define rep1(i,n) for(ll i=1; i<=n; ++i)
#define revrep(i,n) for(ll i=n-1; n>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;
#define fastio cin.tie(nullptr); ios_base::sync_with_stdio(false);
#define endl '\n'
template <class T> bool updmax(T& a, T b) { if (b > a) { a = b; return true;} return false;}
template <class T> bool updmin(T& a, T b) { if (b < a) { a = b; return true;} return false;}
template <class T> T permutation(ll n, ll k) { T f(1); for (ll i=0; i<k; ++i, --n) f *= n; return f; }
template <class T> T factorial(ll n) { return permutation<T>(n,n); }
template <class T> T binomial(ll n, ll k) { return permutation<T>(n,k) /= factorial<T>(k); }

template <ll Mod>
class modint {
    public:
    ll n=0;
    modint(){}
    modint(ll n):n(n){ clamp(); }
    modint& operator = (modint const& a) = default;
    modint& operator = (int a) { n = a; clamp(); return *this; }
    modint operator - () { modint t = *this; t.n = -t.n; t.clamp(); return t; }
    modint& operator *= (modint const& a) { n *= a.n; clamp(); return *this; }
    modint& operator *= (ll a) { n *= a; clamp(); return *this; }
    modint& operator /= (modint const& a) { *this *= a.inv(); return *this; }
    modint& operator += (modint const& a) { n += a.n; if (n >= Mod) n -= Mod; return *this; }
    modint& operator -= (modint const& a) { n -= a.n; if (n < 0) n += Mod; return *this; }
    modint& operator %= (modint const& a) { n %= a.n; clamp(); return *this; }
    friend modint operator * (modint a, modint b) { modint t(a); t.n *= b.n; t.clamp(); return t; }
    friend modint operator + (modint a, modint b) { modint t(a); t.n += b.n; t.clamp(); return t; }
    friend modint operator - (modint a, modint b) { modint t(a); t.n -= b.n; t.clamp(); return t; }
    friend ostream& operator << (ostream& os, modint const& a) { os << a.n; return os; }
    friend bool operator == (modint const& a, int b) { return a.n == b; }
    void clamp() { n %= Mod; if (n < 0) n += Mod; }
    modint inv() const { return this->pow(Mod-2); }
    ll get() { return n; }
    modint pow(ll p) const {
        ll a=1, e=n;
        while (p > 0) {
            if (p&1) { a *= e; a %= Mod; }
            e *= e; e %= Mod; p >>= 1;
        }
        return modint(a);
    }
};

const ll Mod = (ll)1e9+7;
using mint = modint<Mod>;

mint dp[2005];
int main() {
    fastio;
    ll s;
    cin >> s;
    ll n = s;
    dp[0] = 1;
    for (int i=1; i<s+1; ++i) {
        for (int j=0; j<i-3+1; ++j) {
            dp[i] += dp[j];
        }
    }
    cout << dp[s] << endl;
}


Measured memory_bytes: 3592
#include <stdio.h>

int main(void) {

  int age, fee;

  scanf("%d %d", &age, &fee);

  if(age>=13){
    printf("%d\n", fee);
  }else if(age<=5){
    printf("0\n");
  }else{
    printf("%d\n", fee/2);
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;
typedef long long  ll;
const int MAXN = 2e5 + 5;
vector<int> g[MAXN];

int main(){
    faster
    int n, m; cin >> n >> m;
    for(int i = 0;i < m;i++){
        int a,b; cin >> a >> b;
        a--;b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<int> p(n, -1);
    vector<bool> was(n, false);
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int v = q.front();
        q.pop();
        if(was[v])continue;
        was[v] = true;
        for(int to : g[v]){
            if(!was[to]){
                q.push(to);
                if(p[to] < 0)
                    p[to] = v;
            }
        }
    }
    for(int i = 1;i < n;i++){
        if(p[i] < 0){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    for(int i = 1;i < n;i++){
        cout << p[i] + 1 << "\n";
    }
    return 0;
}



Measured memory_bytes: 12772
#include                        <bits/stdc++.h>
#include                        <ext/pb_ds/assoc_container.hpp>
#define lb                      lower_bound
#define ub                      upper_bound
#define fe(x)                   *(x.begin())
#define le(x)                   *(x.rbegin())
#define pb                      push_back
#define load(node,n)            bool operator < (const node &n) const
#define fbo(x)                  find_by_order(x)
#define ook(x)                  order_of_key(x)
#define all(x)                  (x).begin(),(x).end()
#define FOR(i,n)                for(int i = 1; i<=n; i++)
#define REP(i,n)                for(int i = 0; i<n;  i++)
#define TT                      int TC;  scanf("%d",&TC);  while(TC--)
#define read                    freopen("input.txt","r",stdin)
#define write                   freopen("output.txt","w",stdout)
#define dbg(...)                debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#define set(x)                  tree<x,null_type,less<x>,rb_tree_tag,tree_order_statistics_node_update>
using                           namespace __gnu_pbds;
using                           namespace std;
typedef                         long long ll;
typedef                         pair<ll,ll> pll;
typedef                         pair<int,int> pii;

vector<string> vec_splitter(string s){
    s += ','; vector<string> res;
    while(!s.empty()) res.push_back(s.substr(0,s.find(','))), s = s.substr(s.find(',') + 1);
    return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused))int idx,
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T){
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") "; stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str(); debug_out(args, idx + 1, LINE_NUM, T...);
}






main(){
//read;

double a;
cin>>a;
double pi = acos(-1);
double ans = 2*pi*a;
printf("%.6f",ans);






return 0;
}


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

using namespace std;

int main() 
{
    int n, m, i;
    scanf("%d", &n);
    
    vector<int> v;
    
    for(i = 0; i < n; i++)
    {
        scanf("%d", &m);
        v.emplace_back(m);
    }
    
    scanf("%d", &m);
    
    for(i = 0; i < m; i++)
    {
        scanf("%d", &n);
        printf("%d\n", binary_search(v.begin(), v.end(), n));
    }
    
    return 0;
}


Measured memory_bytes: 3508
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
import math
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

l = []
def f(al):
    if len(al) == N:
        l.append(al)
    for i in range(N):
        if i not in al:
            f(al + [i])
for i in range(N):
    f([i])

ans = 0
for v in l:
    a = 0
    for i in range(len(v)-1):
        x = L[v[i]]
        y = L[v[i + 1]]
        a += ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** 0.5

    ans += a
print(ans / len(l))

Measured memory_bytes: 11372
#include<stdio.h>
#define MAX 100005
#define NIL -1

struct Node_struct{int p,l,r;};
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX],G[MAX],Y[MAX];


void print(int u){
  int c;
  printf("node %d: parent = %d, ",u,T[u].p);

  c = siblingserch(u);
  printf("sibling = %d, ",c);
  
  printf("degree = %d, ",G[u]);
  
  printf("depth = %d, ",D[u]);

  printf("height = %d, ",Y[u]);
  
  if(T[u].p == -1) printf("root\n");
  else if(T[u].l == NIL && T[u].r == NIL) printf("leaf\n");
  else printf("internal node\n");

}

int siblingserch(int u)
{
  if(T[u].p == NIL)
    {
      return -1;
    }
  if(T[T[u].p].l != NIL && T[T[u].p].l != u)
    {
      return T[T[u].p].l;
    }
  if(T[T[u].p].r != NIL && T[T[u].p].r != u)
    {
      return T[T[u].p].r;
    }
  else
    {
      return -1;
    }
}

int calcheight(int u)
{
  int count1 = 0,count2 = 0;
  if(T[u].l != NIL)
    {
      count1 = calcheight(T[u].l) + 1;
    }
  if(T[u].r != NIL)
    {
      count2 = calcheight(T[u].r) + 1;
    }
  if(count1 > count2)
    {
      Y[u] = count1;
      return Y[u];
    }
  else
    {
      Y[u] = count2;
      return Y[u];
    }
  
}

void calcdegree(int u)
{
  if(T[u].l == NIL && T[u].r == NIL)
    {
      G[u] = 0;
    }
  else if(T[u].r != NIL && T[u].l == NIL)
    {
      G[u] = 1;
    }
  else if(T[u].r == NIL && T[u].l != NIL)
    {
      G[u] = 1;
    }
  else
    {
      G[u] = 2;
    }
}

void calcDepth(int u,int p){
  D[u] = p;
  if(T[u].l != NIL)calcDepth(T[u].l,p+1);
  if(T[u].r != NIL)calcDepth(T[u].r,p+1);
}


int main(){
  int i,l,r;
  int n;
  int id;
  int root = NIL;
  scanf("%d",&n);
  for(i = 0;i < n;i++)
    {
      T[i].p = T[i].l = T[i].r = NIL;
    }

  for(i = 0;i < n;i++)
    {
      scanf("%d",&id);
      scanf("%d %d",&l,&r);
      T[id].l = l;
      if(l != -1)
	{
	  T[l].p = id;
	}
      T[id].r = r;
      if(r != -1)
	{
	  T[r].p = id;
	}
    }

  for(i = 0;i < n;i++)
    {
      if(T[i].p == -1) root = i;
    }

  calcDepth(root,0);

  for(i = 0;i < n;i++)  calcdegree(i);

  for(i = 0;i < n;i++)  calcheight(i);


  for(i = 0;i < n;i++) print(i);

  return 0;
}



Measured memory_bytes: 2104
//#pragma warning(disable:4996)
//#pragma comment(linker, "/STACK:336777216")
//#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000000;
const int INF = 1e17;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

const int N=200005;

void solve()
{

    int n;
    cin>>n;
    int cnt[n+1]={0},x;
    for(int i=2;i<=n;i++)
    {
        cin>>x;
        cnt[x]++;
    }
    for(int i=1;i<=n;i++)
        cout<<cnt[i]<<endl;
}


int32_t main()
{
    IOS;
    int t;
    t=1;
    // cin>>t;
    while(t--)
    {
        
        solve();
    }
    return 0;
}


Measured memory_bytes: 5212
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 100000000
#define INF 300000000000000000
#define MOD 1000000007
#define mod 1000000007
#define INT_MAX_ 2147483647
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define rep(i,n)for (ll i = 0; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
#define me memset
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[5]={-1,0,1,0,0};
int dy[5]={0,-1,0,1,0};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp1(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    ll n,x;cin>>n>>x;
    V<ll>a(n);
    for(ll i=0;i<n;i++)cin>>a[i];
    ll ans=0;
    if(a[0]>x){
        ans+=a[0]-x;
        a[0]=x;
    }
    for(ll i=1;i<n;i++){
        if(a[i]+a[i-1]>x){
            ans+=a[i]+a[i-1]-x;
            a[i]-=a[i]+a[i-1]-x;
        }
    }
    cout<<ans<<endl;
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------





































Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#define ll long long

using namespace std;

int main(){
  string s;
  cin >> s ;
  int lens = s.size();
  int cnt = 0;
  for( int i = 0 ; i < lens / 2 ; i++ )
    if( s[i] != s[lens - i - 1] ) cnt++;
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <string>
using namespace std;


int main(void)
{
    string Str = "";
    cin >> Str;

    if(Str.find("7") != std::string::npos)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }




    return 0;
}


Measured memory_bytes: 3624
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
import numpy as np
 
MOD = 10 ** 9 + 7
 
N = int(readline())
X = np.array(read().split(),np.int64)
 
def cumprod(A, MOD = MOD):
    L = len(A); Lsq = int(L**.5+1)
    A = np.resize(A, Lsq**2).reshape(Lsq,Lsq)
    for n in range(1,Lsq):
        A[:,n] *= A[:,n-1]; A[:,n] %= MOD
    for n in range(1,Lsq):
        A[n] *= A[n-1,-1]; A[n] %= MOD
    return A.ravel()[:L]
def make_fact(U, MOD = MOD):
    x = np.arange(U, dtype = np.int64); x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact,fact_inv
 
U = 10 ** 5 + 5
fact, fact_inv = make_fact(U)
 
inv = np.zeros(U,np.int64)
inv[1:] = fact_inv[1:] * fact[:-1] % MOD
 
coef = inv[1:N].cumsum() % MOD
 
answer = (np.diff(X) * coef % MOD).sum() % MOD
answer *= fact[N-1]; answer %= MOD
 
print(answer)

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

namespace TYC
{
	typedef long long ll;
	typedef pair<int, int> pii;

	const int N = 3e5 + 10;
	const int mod = 1e9 + 7, INV2 = (mod + 1) >> 1;

	int n, S, A[N], Cnt[N], D[N], PD[N], C1[N], C2[N];
	pii P[N];


	inline int qpow(int x, int tim)
	{
		int ans = 1;
		for (; tim; tim >>= 1, x = (ll)x * x % mod)
			if (tim & 1)
				ans = (ll)ans * x % mod;
		return ans;
	}

	inline int inv(const int x) { return qpow(x, mod - 2); }

#define lowbit(x) (x & (-x))

	inline void add(int x)
	{
		int w = PD[A[x]];
		for (; x <= n; x += lowbit(x)) 
			C1[x]++, C2[x] = (C2[x] + w) % mod;
	}

	inline void del(int x)
	{
		int w = (mod - PD[A[x]]) % mod;
		for (; x <= n; x += lowbit(x))
			C2[x] = (C2[x] + w) % mod;
	}

	inline int getnum(int x)
	{
		if (!x)
			return 0;
		int ans = 0;
		for (; x; x -= lowbit(x))
			ans += C1[x];
		return ans;
	}

	inline int getsum(int x)
	{
		if (!x)
			return 0;
		int ans = 0;
		for (; x; x -= lowbit(x))
			ans = (ans + C2[x]) % mod;
		return ans;
	}

	void init()
	{
		for (int i = n - 1; i; i--)
			Cnt[i] += Cnt[i + 1];
		S = 1;
		for (int i = 1; i <= n; i++)
		{
			Cnt[i] -= (n - i);
			S = (ll)S * Cnt[i] % mod;
			D[i] = (ll)(Cnt[i] - 1 + mod) * inv(Cnt[i]) % mod;
		}
		for (int i = 1; i <= n; i++)
			if (!D[i - 1])
				PD[i] = D[i];
			else
				PD[i] = (ll)PD[i - 1] * D[i] % mod;
	}

	void work()
	{
		scanf("%d", &n);
		for (int i = 1; i <= n; i++)
		{
			scanf("%d", &A[i]);
			Cnt[A[i]]++;
			P[i] = pii(A[i], i);
		}
		sort(P + 1, P + 1 + n, greater<pii>());
		init();
		if (!S)
			return void(puts("0"));
		
		int l = 1, r, last = 1, ans = 0;
		for (int val = n; val; val--)
		{
			if (P[l].first == val)
			{
				for (r = l; r < n && val == P[r + 1].first; ++r);
				int num = r - l + 1;
				if (num > 1)
					ans = (ans + (ll)num * (num - 1) / 2 % mod * S % mod * INV2) % mod;
				int t = D[val] ? inv(PD[val]) : 1;
				for (int i = l; i <= r; i++)
				{
					int p = P[i].second;
					ans = (ans + (ll)(getsum(n) - getsum(p)) * S % mod * t % mod * INV2) % mod;
					ans = (ans - (ll)getsum(p - 1) * S % mod * t % mod * INV2 % mod + mod) % mod;
					ans = (ans + (ll)getnum(p - 1) * S) % mod;
				}
				for (int i = l; i <= r; i++)
					add(P[i].second);
				l = r + 1;
			}
			if (!D[val])
			{
				for (int i = last; i < l; i++)
					del(P[i].second);
				last = l;
				continue;
			}
		}
		printf("%d\n", ans);
	}
}

int main()
{
	TYC::work();
	return 0;
}

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

int main(void)
{
	int a, b, c;
	cin >> a >> b >> c;

	if (b-a == c-b) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#define NMAX 105
#define WMAX 10005
#define DIAGONAL 1
#define TOP 0
using namespace std;
struct Item
{
    int value,weight;
};
int N,W;
Item items[NMAX+1];
int C[NMAX+1][WMAX+1],G[NMAX+1][WMAX+1];
void compute(int &maxValue,vector<int> &selection)
{
    for(int w=0; w<=W; w++)
    {
        C[0][w]=0;
        G[0][w]=DIAGONAL;
    }
    for(int i=1; i<=N; i++)C[i][0]=0;
    for(int i=1; i<=N; i++)
    {
        for(int w=1; w<=W; w++)
        {
            C[i][w]=C[i-1][w];
            G[i][w]=TOP;
            if(items[i].weight>w)continue;
            if(items[i].value+C[i-1][w-items[i].weight]>C[i-1][w])
            {
                C[i][w]=items[i].value+C[i-1][w-items[i].weight];
                G[i][w]=DIAGONAL;
            }
        }
    }
    maxValue=C[N][W];
    selection.clear();
    for(int i=N,w=W; i>=1; i--)
    {
        if(G[i][w]==DIAGONAL)
        {
            selection.push_back(i);
            w-=items[i].weight;
        }
    }
    reverse(selection.begin(),selection.end());
}
void input()
{
    cin>>N>>W;
    for(int i=1; i<=N; i++)
    {
        cin>>items[i].value>>items[i].weight;
    }
}
int main()
{
    int maxValue;
    vector<int>selection;
    input();
    compute(maxValue,selection);
    cout<<maxValue<<endl;
    return 0;
}

Measured memory_bytes: 11060
#include <iostream>
#include <vector>
int main(){
	int n, tmp, c = 0;
	std::vector <int> a;
	std::cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++){
		std::cin >> tmp;
		a[i] = tmp;
		if (i > 0){
			if (a[i] == a[i-1]){
				a[i] = -1;
				c++;
			}
		}
	}
	std::cout << c << std::endl;
	return 0;
}
		

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final long N = sc.nextLong();
			final long K = sc.nextLong();
			
			final long MOD = 1000000007;
			long answer = 0;
			
			for(long k = K; k <= N + 1; k++) {
				final long min = k * (k - 1) / 2;
				final long max = (N + 1) * (N) / 2 - (N + 1 - k) * (N - k) / 2;
				
				answer += (max - min + 1);
				answer %= MOD;
			}
			
			System.out.println(answer);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}


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

int main(){
  while(1){
    long long a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(!a&&!b&&!c&&!d&&!e)break;
    long long na,nb,nc;
    cin>>na>>nb>>nc;
    long long ans=0;
    if(d<=nc)ans=(nc*e)+nb*b+na*a;
    else {
      ans=min(nc*c+nb*b+na*a,d*e+nb*b+na*a);
      long long tmp=ans;
      nb=nb-(d-nc);
      if(nb<0) na+=nb,nb=0;
      if(na<0) tmp=min(tmp,d*e);
      else tmp=min(tmp,d*e+nb*b+na*a);
      ans=min(ans,tmp);
    }
    cout <<ans<<endl;
  }
  return 0;
}

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

typedef long long int ll;
typedef long double ld;

#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define rep1(i, n)    for(ll i = 1; i <= (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define bpc(a) __builtin_popcount(a)
#define ff first 
#define ss second  
#define mk0(a) memset(a,0,sizeof(a))
#define mk_1(a) memset(a,-1,sizeof(a))

const ll MAX=2e5+2;
const ll MAX1=1e2+5;
const ll INF=1e15+2;
const ll MOD=1e9+7;

#define pb push_back
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define pi pair<ll,ll>
#define map1 unordered_map

inline ll nc(){static char buf[100000],*p1=buf,*p2=buf;return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;}

inline ll read(){ll ret=0;bool f=0;char ch=nc();while(ch>'9'|| ch<'0') f^=ch=='-',ch=nc();
while(ch<='9'&& ch>='0') ret=ret*10+ch-'0',ch=nc();return f?-ret:ret;}

ll power(ll base,ll ind,ll mod){ll res=1;while(ind){if(ind&1)res=(res*base)%mod;base=(base*base)%mod;ind>>=1;}return res;}

ll inv(ll den,ll mod){return power(den,mod-2,mod);}

ll a[MAX],h[MAX],bit[MAX];
ll n,max_val;
ll dp[MAX];

ll query(ll ind)
{
    if(ind<=0)
        return 0;
    ll val=-INF;
    for(int i=ind;i>0;i-=i&(-i))
        val=max(bit[i],val);
    return val;
}

void update(ll ind)
{
    for(int i=ind;i<=n;i+=i&(-i))
        bit[i]=max(bit[i],dp[ind]);
}

int main()
{
    faster;
    cin>>n;
    
    ll bound=0;
    rep1(i,n)
        cin>>h[i],bound=max(bound,h[i]);
    rep1(i,n)
        cin>>a[i];
    
    for(int i=1;i<=n;++i)
    {
        
        ll max_val=query(h[i]-1);
        
        dp[h[i]]=max(dp[h[i]],max_val+a[i]);
        update(h[i]);
        
    }
    ll mxx=-INF;
    rep1(i,bound)
        mxx=max(mxx,dp[i]);
    cout<<mxx<<endl;    
        
}

Measured memory_bytes: 6528
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

//Doctor's Memorable Codes
public class Main{

	public static void main(String[] args) {
		Map<String, Character> t = new HashMap<String, Character>();
		t.put("101", ' ');
		t.put("000000", '\'');
		t.put("000011", ',');
		t.put("10010001", '-');
		t.put("010001", '.');
		t.put("000001", '?');
		t.put("100101", 'A');
		t.put("10011010", 'B');
		t.put("0101", 'C');
		t.put("0001", 'D');
		t.put("110", 'E');
		t.put("01001", 'F');
		t.put("10011011", 'G');
		t.put("010000", 'H');
		t.put("0111", 'I');
		t.put("10011000", 'J');
		t.put("0110", 'K');
		t.put("00100", 'L');
		t.put("10011001", 'M');
		t.put("10011110", 'N');
		t.put("00101", 'O');
		t.put("111", 'P');
		t.put("10011111", 'Q');
		t.put("1000", 'R');
		t.put("00110", 'S');
		t.put("00111", 'T');
		t.put("10011100", 'U');
		t.put("10011101", 'V');
		t.put("000010", 'W');
		t.put("10010010", 'X');
		t.put("10010011", 'Y');
		t.put("10010000", 'Z');
		Map<Character, String> r = new HashMap<Character, String>();
		r.put('A', "00000");
		r.put('B', "00001");
		r.put('C', "00010");
		r.put('D', "00011");
		r.put('E', "00100");
		r.put('F', "00101");
		r.put('G', "00110");
		r.put('H', "00111");
		r.put('I', "01000");
		r.put('J', "01001");
		r.put('K', "01010");
		r.put('L', "01011");
		r.put('M', "01100");
		r.put('N', "01101");
		r.put('O', "01110");
		r.put('P', "01111");
		r.put('Q', "10000");
		r.put('R', "10001");
		r.put('S', "10010");
		r.put('T', "10011");
		r.put('U', "10100");
		r.put('V', "10101");
		r.put('W', "10110");
		r.put('X', "10111");
		r.put('Y', "11000");
		r.put('Z', "11001");
		r.put(' ', "11010");
		r.put('.', "11011");
		r.put(',', "11100");
		r.put('-', "11101");
		r.put('\'', "11110");
		r.put('?', "11111");
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			char[] m = sc.nextLine().toCharArray();
			StringBuilder sb = new StringBuilder();
			for(char c:m)sb.append(r.get(c));
			String s = sb.toString();
			sb = new StringBuilder();
			int i=0;
			while(i<s.length()){
				int k;
				for(k=3;i+k<=s.length();k++){
					String sub = s.substring(i,i+k);
					boolean f = false;
					for(String v : t.keySet()){
						if(v.equals(sub)){
							f = true;
							break;
						}
					}
					if(f)break;
				}
				if(i+k>s.length())break;
				sb.append(t.get(s.substring(i,i+k)));
				i+=k;
			}
			System.out.println(sb);
		}
	}
}

Measured memory_bytes: 0
# -*- coding: utf-8 -*-

def main():
    A1 = list(map(int, input().split()))
    A2 = list(map(int, input().split()))
    A3 = list(map(int, input().split()))
    bingo = A1 + A2 + A3
    # print(bingo)

    n = int(input())

    for i in range(n):
        b = int(input())
        if b in bingo:
            bingo[bingo.index(b)] = -1

    # print(bingo)

    # 行判定
    if bingo[0] == -1 and bingo[1] == -1 and bingo[2] == -1: return True
    if bingo[3] == -1 and bingo[4] == -1 and bingo[5] == -1: return True
    if bingo[6] == -1 and bingo[7] == -1 and bingo[8] == -1: return True

    # 列判定
    if bingo[0] == -1 and bingo[3] == -1 and bingo[6] == -1: return True
    if bingo[1] == -1 and bingo[4] == -1 and bingo[7] == -1: return True
    if bingo[2] == -1 and bingo[5] == -1 and bingo[8] == -1: return True

    # 斜め判定
    if bingo[0] == -1 and bingo[4] == -1 and bingo[8] == -1: return True
    if bingo[2] == -1 and bingo[4] == -1 and bingo[6] == -1: return True

if __name__ == "__main__":
    if main():
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	foods := make(map[int]int)

	for i := 0; i < n; i++ {
		var d int
		fmt.Scan(&d)

		lst := make([]int, d)
		for i := range lst {
			fmt.Scan(&lst[i])
		}

		for _, v := range lst {
			foods[v]++
		}
	}

	count := 0
	for _, v := range foods {
		if v == n {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
struct UnionFind{
	vector<int> par,ran;
	UnionFind(int n):par(n),ran(n,0){
		for(int i=0;i<n;i++){
			par[i]=i;
		}
	}
	int find(int x){
		return (x==par[x]?x:par[x]=find(par[x]));
	}
	bool same(int x,int y){
		return find(x)==find(y);
	}
	void unite(int x,int y){
		x=find(x);
		y=find(y);
		if(x==y){
			return;
		}else{
			if(ran[x]<ran[y]){
				par[x]=y;
			}else{
				par[y]=x;
				if(ran[x]==ran[y]){
					ran[x]++;
				}
			}
		}
	}
};
int main(){
	int n,q;
	cin>>n>>q;
	UnionFind uf(n);
	for(int i=0;i<q;i++){
		int a,b;
		cin>>a>>b;
		a--;b--;
		uf.unite(a,b);
	}
	int cnt[200000]={};
	for(int i=0;i<n;i++){
		cnt[uf.find(i)]++;
	}
	int ans=0;
	for(int i=0;i<n;i++){
		ans=max(ans,cnt[i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5260
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace msol2020
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
            solve_msol2020B();
            Console.Out.Flush();
        }

        public static void solve_msol2020C()
        {
        }

        public static void solve_msol2020B()
        {
            int[] abc = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int k = Convert.ToInt32(Console.ReadLine());
            int a = abc[0];
            int b = abc[1];
            int c = abc[2];
            while (k > 0 && b >= c)
            {
                c = c * 2;
                k--;
            }
            while (k > 0 && a >= b)
            {
                b = b * 2;
                k--;
            }
            while (k > 0 && b >= c)
            {
                c = c * 2;
                k--;
            }
            if (a < b && b < c)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }

        public static void solve_msol2020A()
        {
            int x = Convert.ToInt32(Console.ReadLine());
            int q = 8;
            for (int i = 400; i <= 1800; i += 200)
            {
                if (i <= x && i + 199 >= x)
                {
                    Console.WriteLine(q);
                    break;
                }
                q--;
            }

        }
    }
}

Measured memory_bytes: 28528
import itertools
import math
import numpy as np

def min_start(a, b):
    if a < b:
        return b, a
    return a, b

def main():
    N = int(input())
    point = list()
    length = list()
    for _ in range(N):
        point.append([int(x) for x in input().split()])
    point = np.array(point)

    for a in range(N):
        temp = list()
        for b in range(a, N):
            temp.append(np.linalg.norm(point[b]-point[a]))
        length.append(temp.copy())
    ans = 0
    for route in itertools.permutations([x for x in range(N)]):
        temp = 0
        for i in range(1, N):
            a = route[i - i]
            b = route[i]
            if a > b:
                ans += length[b][a-b]
            else:
                ans += length[a][b-a]
            
    print(ans / math.factorial(N))

if __name__ == "__main__":
    main()


Measured memory_bytes: 12448
bingo=[]
for i in range(3):
  num=list(map(int,input().split()))
  bingo.append(num)
N=int(input())
atari=[0,0,0,0,0,0,0,0,0]
for i in range(N):
  num=int(input())
  for j in range(9):
    if bingo[j//3][j%3]==num:
      atari[j]=1

if (atari[1]==1 and atari[2]==1 and atari[0]==1)or(atari[3]==1 and atari[4]==1 and atari[5]==1)or(atari[6]==1 and atari[7]==1 and atari[8]==1):
  print("Yes")
elif (atari[0]==1 and atari[3]==1 and atari[6]==1)or(atari[1]==1 and atari[4]==1 and atari[7]==1)or(atari[2]==1 and atari[5]==1 and atari[8]==1):
  print("Yes")
elif (atari[0]==1 and atari[4]==1 and atari[8]==1)or(atari[2]==1 and atari[4]==1 and atari[6]==1):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
int main() {
	int n, m;
	cin >> n >> m;
	ll x[n], y[n], z[n];
	rep(i, n) cin >> x[i] >> y[i] >> z[i];
	ll ans = 0;
	rep(bit, 8) {
		vector<pair<ll, ll>> vec;
		int a = bit & 1 ? 1 : -1, b = bit >> 1 & 1 ? 1 : -1, c = bit >> 2 & 1 ? 1 : -1;
		rep(i, n) vec.push_back({x[i] * a + y[i] * b + z[i] * c, i});
		sort(vec.begin(), vec.end());
		ll p = 0, q = 0, r = 0;
		rep(i, m) {
			p += x[vec[i].second] * a;
			q += y[vec[i].second] * b;
			r += z[vec[i].second] * c;
		}
		ans = max(ans, abs(p) + abs(q) + abs(r));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256