akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
#B
import sys
#sys.setrecursionlimit(100000)

tmp = input().split()
n,k = list(map(lambda a: int(a), tmp))

tmp = input().split()
a = list(map(lambda a: int(a), tmp))

b=[]
c=[]
for i in range(0,n):
	b.append(0)
	c.append(0)

for i in range(0,n):
	for j in range(0,i+1):
		if(a[i]>a[j]):
			c[i]+=1
	for j in range(i+1,n):
		if(a[i]>a[j]):
			b[i]+=1
			c[i]+=1

sum=0
tmp=0
for i in range(0,n):
	sum+=b[i]
	tmp+=c[i]
sum*=k
sum+=tmp*k*(k-1)//2

sum%=1000000007

#print(tmp)
print(sum)

#print(a)
#print(b)
#print(c)


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define RALL(a)     (a).rbegin(),(a).rend()
#define PRINT(a)   cout << (a) << endl

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

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

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main(){
  int h,w,k;
  cin >> h >> w >> k;
  vector<string> s(h);
  REP(i,h)cin>>s[i];

  vi hh;
  REP(i,h)REP(j,w){
    if(s[i][j]=='#'){
      hh.emplace_back(i);
      break;
    }
  }
  hh.emplace_back(h);
  // REP(i,hh.size()){
  //   cout << hh[i] << endl;
  // }

  vector<vector<int>> ans(h, vector<int>(w));

  int cnt=0;
  REP(i,hh.size()-1){
    int x = hh[i];
    int y = hh[i+1];
    int now=0;
    cnt++;
    REP(j,w){
      if(s[x][j]=='#' && now++){
        cnt++;
        now++;
      }
      if(i==0){
        FOR(k,0,x)ans[k][j]=cnt;
      }
      FOR(k,x,y)ans[k][j]=cnt;
    }
  }

  REP(i,h)REP(j,w){
    cout << ans[i][j];
    cout << (j==w-1 ? "\n" : " ");
  }
}



Measured memory_bytes: 4116
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 200005


int N,K;
double A[SIZE];

bool isOK(double len){

    ll ret = 0;
	for(int i = 0; i < N; i++){

		ret += (ll)ceil(A[i]/len)-1;
	}

	return ret <= K;
}

int main(){

	scanf("%d %d",&N,&K);

	double maximum = 0;

	for(int i = 0; i < N; i++){

		scanf("%lf",&A[i]);
		maximum = max(maximum,A[i]);
	}

	double left = 0,right = maximum,mid = (left+right)/2;
	double ans = maximum;

	for(int loop = 0; loop < 100; loop++){

		if(isOK(mid)){

			ans = mid;
			right = mid-EPS;
		}else{

			left = mid+EPS;
		}
		mid = (left+right)/2.0;
	}

	printf("%.0lf\n",ceil(ans));

	return 0;
}


Measured memory_bytes: 5424
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int T, card[16];
bool is_good_set(int a, int b, int c);
bool is_same_number(int a, int b, int c);
bool is_sequence(int a, int b, int c);
bool is_all_good_set();
int win();

int main() {
  cin >> T;
  for(int t=0;t<T;++t) {
    for (int i=0;i<9; ++i) {
      cin >> card[i];
    }
    string color;
    for (int i=0;i<9; ++i) {
      cin >> color;
      if(color=="G") card[i] += 10;
      else if(color=="B") card[i] += 20;
    }
    cout << win() << endl;
  }
}


bool is_good_set(int a, int b, int c) {
  return is_same_number(a,b,c) || is_sequence(a,b,c);
}

bool is_same_number(int a, int b, int c) {
  return a == b && b == c;
}

bool is_sequence(int a, int b, int c) {
  return a+2 == b+1 && b+1 == c;
}

bool is_all_good_set() {
  return is_good_set(card[0],card[1],card[2]) && is_good_set(card[3],card[4],card[5]) && is_good_set(card[6],card[7],card[8]);
}

int win() {
  sort(card,card+9);
  do {
    if(is_all_good_set()) return 1;
  } while(next_permutation(card,card+9));
  return 0;
}

Measured memory_bytes: 3184
A, B, C = map(lambda x:int(x), input().split(' '))
K = int(input())
count = 0
while count < K:
    if A >= B:
        B *= 2
        count+=1
    elif B >= C:
        C *= 2
        count+=1
    else:
        break
if A < B < C:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c,n) for(int i=c;i<n;i++)
 
int main() {
  int n,m,ans=0;
  cin>>n>>m;
  
  vector<pair<int,int>> p;
  rep(i,0,m){
    int tmp1,tmp2;
    cin>>tmp1>>tmp2;
    p.emplace_back(make_pair(tmp1,tmp2));
  }
  
  vector<int> per;
  rep(i,1,n+1){per.emplace_back(i);}
  
  do{
    if(per[0]!=1){break;}
    bool empty=true;
    //rep(i,0,n){cout<<per[i];}
      rep(i,0,n-1){
        bool chk=false;
        rep(j,0,m){
          if((per[i]==p[j].first&&per[i+1]==p[j].second)||(per[i+1]==p[j].first&&per[i]==p[j].second)){
            chk=true;continue;
          }
        }
        if(chk==false){empty=false;}
      }
    if(empty==true){ans++;}
      //cout<<per[i];}
    //cout<<endl;
  }while(next_permutation(per.begin(),per.end()));

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

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

int main(){
    ll N, K, S;
    cin >> N >> K >> S;
    vector<ll> A(N);

    if(S != 1e9){
        for(int i = 0; i < N; i++){
            A[i] = S + 1;
        }
    }else{
        for(int i = 0; i < N; i++){
            A[i] = S - 1;
        }
    }
    

    for(ll i = 0; i < K; i++){
        A[i] = S;
    }

    for(ll i = 0; i < N; i++){
        cout << A[i] << " ";
    }
}   


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
char a[10];
int c,d;
int main(){
    scanf("%s",a);
    if(a[0]=='A'&&a[1]=='C') {puts("Yes");return 0;}
    if(a[1]=='A'&&a[2]=='C') {puts("Yes");return 0;}
    if(a[2]=='A'&&a[3]=='C') {puts("Yes");return 0;}
    if(a[3]=='A'&&a[4]=='C') {puts("Yes");return 0;}
    puts("No");
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <valarray>

using namespace std;

int main() {
    string s;
    cin >> s;
    for (char i = 'a'; i <= 'z'; i++) {
      bool exist = false;
      for (int j = 0; j < s.length(); j++) {
        if (s[j] == i)
          exist = true;
      }
      if (!exist) {
        cout << i << '\n';
        return 0;
      }
    }
    cout << "None";
    return 0;
}


Measured memory_bytes: 512
import heapq
INF = float('inf')
yen = 10**15
def pcc(src, adj):
	pq = [(0,src)]
	heapq.heapify(pq)
	dist = [INF]*n
	dist[src] = 0
	while pq:
		d,u = heapq.heappop(pq)
		if d>dist[u]:continue
		for w, v in adj[u]:
			if dist[v] > dist[u] + w:
				dist[v] = dist[u] + w
				heapq.heappush(pq, (dist[v], v))
	return dist

n,m,s,t = map(int, input().split())
s,t = s-1,t-1
adjs = [[] for _ in range(n)]
adjt = [[] for _ in range(n)]
for _ in range(m):
	u,v,a,b = map(int, input().split())
	u,v = u-1, v-1
	adjs[u].append((a,v))
	adjs[v].append((a,u))
	adjt[u].append((b,v))
	adjt[v].append((b,u))

dist_s = pcc(s,adjs)
dist_t = pcc(t,adjt)
ans = [0]*(n)
ans[n-1] = yen -dist_s[n-1] - dist_t[n-1]
for i in range(n-2,-1,-1):
	ans[i] = max(ans[i+1], yen - dist_s[i] - dist_t[i])
print(*ans, sep = '\n')


Measured memory_bytes: 81508
#参考
#https://atcoder.jp/contests/abc147/submissions/8918513

#　Nは人の数。1~Nの背番号を持つ。　N<=15
N = int(input())

#証言。N個の空配列を作成。
evidences = [[] for _ in range(N)]

#作成した空配列に対し、一人につきA個の証言を格納していく。
# x:人のインデックス。-1して 0 ~ N-1の範囲にしている。
# y:正直者(1)か嘘つき(0)かの情報。
for i in range(N):
    A = int(input())
    for _ in range(A):
        x, y = map(int, input().split())
        evidences[i].append((x - 1, y))

result = 0

#今回の解法Point　Bits探索
#最大で2^15通りなら全探索で良い！
#正直者・嘘つきの情報をN桁の2進数に置き換える。
for i in range(1, 2**N):
    consistent = True
    
    #jは(背番号-1)
    for j in range(N):
      #ビットシフト　iをjビットだけ右>>にずらす。
      #嘘つきと宣言している箇所はスキップ（continue）
        if (i >> j) & 1 == 0:
            continue
            
        #背番号jの人の証言を確認する。
        for x, y in evidences[j]:
          #もし言動に矛盾が生じたら、そのパターンiはbreakさせて、また別のiを調査する
            if (i >> x) & 1 != y:
                consistent = False
                break
        if not consistent:
            break
            
    #もし証言が全て一致した場合のみ、この先のifを通過する
    if consistent:
      #bin(i) で10進数の整数iを2進数に変換
      #その際、0b111111...のように、文頭に数字以外がつくため、
      #数字だけを見たい場合は[2:]をつけて、0bの部分を除外してる
      #
      #その残った文字列に対し、.count('1')で1の数をカウントしている。
        result = max(result, bin(i)[2:].count('1'))
print(result)


Measured memory_bytes: 42736
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int A,B;
    cin >> A >> B;
    if((A * B) & 1)cout << "Odd" << endl;
    else cout << "Even" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)




int main() {
    ll k;
    cin >> k;
    
    if(k == 0){
        cout << 2 << '\n' << 1 << ' ' << 1 << '\n';
        return 0;
    }
    if(k == 1){
        cout << 2 << '\n' << 2 << ' ' << 0 << '\n';
        return 0;
    }
    
    vector<ll> ans(50);
    if(k >= 51){
        ll t = 50;
        REP(i, 50){
            ans[i] = (50 - i) + (k - 1 - 50) / 50;
        }
        REP(i, (k - 1) % 50 + 1){
            ans[i]++;
        }
        
        cout << 50 << '\n';
        REP(i, 49){
            cout << ans[i] << ' ';
        }
        cout << ans[49] << '\n';
    }
    else{
        cout << k << '\n';
        REP(i, k - 1){
            cout << k - i << ' ';
        }
        cout << 1 << '\n';
    }
}

Measured memory_bytes: 256
//From Naruto to Hokage
//#include <RJ>
#include<bits/stdc++.h>
using namespace std;

#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    ll m,d;
    ll ans=0;
    cin>>m>>d;
    rep(i,1,m){
        rep(j,22,d){
            ll a=j%10;
            ll b=j/10;
            if(a>=2 && b>=2 && (a*b)==i) ans++;
        }
    }
    cout<<ans;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

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

int main() {
    for(int H, W; cin >> H >> W, !(H == 0 && W == 0);) {
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                cout << '#';
            }
            cout << '\n';
        }
        cout << '\n';
    }
    return 0;
}



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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 212345;
pair<int,int> a[MAX_N];
int ans[MAX_N];

int main2() {
  int N = nextInt();
  REP(i, N) a[i] = { nextInt(), i };
  sort(a, a+N);
  REP(i, N) {
    ans[ a[i].second ] = i < N/2 ? a[N/2].first : a[N/2-1].first;
  }
  REP(i, N) {
    printf("%d\n", ans[i]);
  }
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 4480
#include <algorithm>
#include <cstdio>
#include <ctype.h>
#include <functional>
#include <iostream>
#include <cassert>
#include <cfloat>
#include <climits>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
int main() {
	string S;
	cin >> S;
	int n = S.size();
	if (n <= 1) {
		cout << -1 << " " << -1 << endl;
		return 0;
	}
	for (int i = 0; i < n - 1; i++) {
		if (S[i] == S[i + 1]) {
			cout << i+1 << " " << i+2 << endl;
			return 0;
		}
	}
	for (int i = 0; i < n - 2; i++) {
		if (S[i] == S[i + 2]) {
			cout << i + 1 << " " << i + 3 << endl;
			return 0;
		}
	}
	

	
	cout << -1 << " " << -1 <<endl;
	return 0;
}

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


// nck % m ( m is prime )
const int N = 1e6+6;
const ll m = 1e9+7;
vector<ll> factorial(N);
vector<ll> inverse(N);

ll binpow(ll a, ll b, ll x) {
	a %= x;
	ll res = 1;
	while (b > 0) {
		if (b & 1) { res = res * a % x; }
		a = a * a % x;
		b >>= 1;
  }
  return res;
}

void pre(){
  factorial[0] = 1;
  inverse[0] = binpow(1,m-2,m);
  for(int i=1; i<N; ++i){
    factorial[i] = i * factorial[i-1] % m;
    inverse[i] = binpow(factorial[i],m-2,m);
  }
}

ll nck(int n, int k){
  ll ans = factorial[n];
  ans = ans * inverse[k] % m;
  ans = ans * inverse[n-k] % m;
  return ans;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
  pre();
  int n,k;
  cin>>n>>k;
  vector<ll> arr(n);
  for(int i=0; i<n; ++i){
    cin>>arr[i];
  }
  sort(arr.begin(), arr.end());
  ll total = 0;
  ll total2 = 0;
  for(int i=0; i<n; ++i){
    if( i >= (k-1) ){
      total += (arr[i]) * nck(i,k-1) % m;
    }
  }
  reverse(arr.begin(),arr.end());
  for(int i=0; i<n; ++i){
    if( i >= (k-1) ){
      total2 += (arr[i]) * nck(i,k-1) % m;
    }
  }
  total -= total2;
  total %= m;
  cout<<total<<'\n';
	return 0;
}


Measured memory_bytes: 16640
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  int N; cin >> N;
  set<string> s{};
  for (int i = 0; i < N; ++i) {
    string S; cin >> S;
    s.emplace(S);
  }
  auto ans = s.size();
  cout << ans << CRLF;
  
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 19184
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int n = sc.nextInt();
			if(n==0) break;
			
			ArrayList<String> list = new ArrayList<String>();
			int[] p = new int[n];
			
			for(int i=0;i<n;i++){
				list.add(sc.next());
				p[i] = sc.nextInt();
			}
			
			int m = sc.nextInt();
			String[] s = new String[m];
			String[][] map = new String[m][];
			int q;
			for(int i=0;i<m;i++){
				s[i] = sc.next();
				q = sc.nextInt();
				map[i] = new String[q];
				for(int j=0;j<q;j++){
					map[i][j] = sc.next();
				}
			}
			
			boolean flag, check;
			while(true){
				flag = false;
				for(int i=0;i<m;i++){
					if(list.contains(s[i])==true){
						check = false;
						for(int j=0;j<map[i].length;j++){
							if(list.contains(map[i][j])==false){
								check = true;
								break;
							}
						}
						if(check==false){
							q = 0;
							for(int j=0;j<map[i].length;j++){
								q += p[list.indexOf(map[i][j])];
							}
							if(q<p[list.indexOf(s[i])]){
								p[list.indexOf(s[i])] = q;
								flag = true;
							}
						}
					}
				}
				if(flag==false) break;
			}
			System.out.println(p[list.indexOf(sc.next())]);
		}
	}	
}

Measured memory_bytes: 25100
#include <bits/stdc++.h>
#define mem(ar,num) memset(ar,num,sizeof(ar))
#define me(ar) memset(ar,0,sizeof(ar))
#define lowbit(x) (x&(-x))
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int    prime = 999983;
const int    INF = 0x7FFFFFFF;
const LL     INFF =0x7FFFFFFFFFFFFFFF;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-6;
const LL     mod = 1e9 + 7;
LL solve(LL a,LL b,LL c,LL d,LL v)
{
    if(v%5==0)
        return a;
    int tmp = v%5;
    v = v-tmp+5;
    LL sum = b*5+c*10+d*50;
    return a + sum/v*(5-tmp);
}
int main(void)
{

   int n;
   cin>>n;
   set<char>se;
   while(n--)
   {
       char c;
       cin>>c;
       se.insert(c);
   }
   if(se.size() == 3)
    cout<<"Three"<<endl;
   else
    cout<<"Four"<<endl;
   return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int n;
  int A[101][101] = {{}};
  int i, j;

  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    int u, k;
    scanf("%d %d", &u, &k);
    --u;
    for(j = 0; j < k; j++) {
      int v;
      scanf("%d", &v);
      --v;
      A[u][v] = 1;
    }
  }

  for(i = 0; i < n; i++) {
    for(j = 0; j < n; j++) {
      if(j) printf(" ");
      printf("%d", A[i][j]);
    }
    puts("");
  }

  return 0;
}

Measured memory_bytes: 664
import math
import sys

def insertion_sort(a, n, g):
    ct = 0
    for i in range(g,n):
        v = a[i]
        j = i-g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j-g
            ct += 1
        a[j+g] = v
    return ct

n = int(input())
a = list(map(int, sys.stdin.readlines()))
m = 0
b = 0
ct= 0
g = []
while True:
    b = 2.25*b+1
    if b > n:
        break
    g.append(math.ceil(b))
    m += 1
g = g[::-1]

for i in g:
    ct += insertion_sort(a, n, i)

print(m)
print(*g, sep=" ")
print(ct)
print(*a, sep="\n")

Measured memory_bytes: 118556
function Main(input) {
  var dataList = input.split("\n");
  dataList.shift();
  dataList.pop();
  var max1 = -1;
  var max1IndexList = [];
  var max2 = -1;
  var max21IndexList = [];
  for (var i = 0; i < dataList.length; i++) {
    dataList[i] = Number(dataList[i]);
    if (max1 < dataList[i]) {
      max1 = dataList[i];
    }
  }
  for (var i = 0; i < dataList.length; i++) {
    if (max1 === dataList[i]) continue;
    if (max2 < dataList[i]) {
      max2 = dataList[i];
    }
  }
  for (var i = 0; i < dataList.length; i++) {
    if (max1 === dataList[i]) max1IndexList.push(i);
    if (max2 === dataList[i]) max21IndexList.push(i);    
  }
  if (max1IndexList.length > 1) {
    for (var i = 0; i < dataList.length; i++) {
      console.log(max1);
    }
  } else {
    for (var i = 0; i < dataList.length; i++) {
      if (max1 === dataList[i]) {
        console.log(max2);
      } else {
        console.log(max1);
      }
    }    
  }
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 34724
module Main where
import Data.List

main :: IO ()
main = do
  n <- readLn :: IO Int
  ls <- getInts 
  print $ solve ls

solve :: [Int] -> Int
solve ls = loop ls' 0
  where
    ls' = sort ls
    loop (l1:l2:ls) acc = loop ls (acc + min l1 l2)
    loop _ acc = acc

getInts :: IO [Int]
getInts = map read . words <$> getLine


Measured memory_bytes: 1020
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;
typedef long long ll;

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

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a,b;
  cin>>a>>b;
  if(a<b){
    REP(i,b){
      cout<<a;
    }
    cout<<endl;
  }else{
    REP(i,a){
      cout<<b;
    }
    cout<<endl;
  }
}


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

using namespace std;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using D = double;
using uint = unsigned int;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

const int maxn = 2005;

int ans[3 * maxn][maxn];
int MOD;
int n;

inline int mul(int a, int b)
{
	return ((ll)a * b) % MOD;
}

inline void upd(int &a, int b)
{
	a += b;
	if (a >= MOD) a -= MOD;
}

int main()
{
	scanf("%d", &n);
	scanf("%d", &MOD);
	
	ans[0][0] = 1;
	for (int numset = 0; numset < 3 * n; numset++)
	{
		for (int specset = 0; specset <= n; specset++)
		{
			//cout << numset << ' ' << specset << ' ' << ans[numset][specset] << endl;
			upd(ans[numset + 1][specset], ans[numset][specset]);
			if (specset < n)
			{
				if (numset + 2 <= 3 * n) upd(ans[numset + 2][specset + 1], mul(ans[numset][specset], (numset + 1)));
				if (numset + 3 <= 3 * n) upd(ans[numset + 3][specset + 1], mul(ans[numset][specset], (numset + 1) * (numset + 2) % MOD));
			}
		}
	}
	int answer = 0;
	for (int specset = 0; specset <= n; specset++) upd(answer, ans[3 * n][specset]);
	cout << answer << endl;
    return 0;
}


Measured memory_bytes: 47360
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	static void solve(){//Here is the main function
      ArrayList<Integer> one = nextIntArray();
      int N = one.get(0);
      int A = one.get(1);
      int B = one.get(2);
      int output = 0;
      for(int i = 0; i < N; i++){
        int t = nextInt();
        if(t < A || B <= t){
          output++;
        }
      }
      myout(output);
	}
	//Method addition frame start



	//Method addition frame end

	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
}


Measured memory_bytes: 32792
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn solve(h: usize, w: usize, targets: Vec<(usize, usize)>) -> usize {
    let mut counter_in_row: Vec<usize> = vec![0; h];
    let mut counter_in_column: Vec<usize> = vec![0; w];

    for t in &targets {
        //println!("{:?}", entry);
        counter_in_row[t.0] += 1;
        counter_in_column[t.1] += 1;
    }

    let max_row = *counter_in_row.iter().max().unwrap();
    let max_column = *counter_in_column.iter().max().unwrap();

    let num_candidates = counter_in_row.iter().filter(|x| **x == max_row).count()
        * counter_in_column
            .iter()
            .filter(|x| **x == max_column)
            .count();

    let mut cross_targets: usize = 0;
    for t in &targets {
        if counter_in_row[t.0] == max_row && counter_in_column[t.1] == max_column {
            cross_targets += 1;
        }
    }

    if cross_targets == num_candidates {
        return max_row + max_column - 1;
    } else {
        return max_row + max_column;
    }
}

fn main() {
    let line = read_as_vec::<usize>();
    let (h, w, m) = (line[0], line[1], line[2]);
    let mut targets: Vec<(usize, usize)> = vec![];
    for _ in 0..m {
        let line = read_as_vec::<usize>();
        targets.push((line[0] - 1, line[1] - 1));
    }

    let ans = solve(h, w, targets);
    println!("{}", ans);
}


Measured memory_bytes: 11212
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

struct edge{
  int to,cost;
};

int main()
{
  int N;
  cin >> N;
  vector<P> A(N-1);
  vector<vector<edge>> vec(N,vector<edge>());
  REP(i,N-1){
    cin >> A[i].first >> A[i].second;
    A[i].first--;
    A[i].second--;
    edge e = {A[i].second,i};
    vec.at(A[i].first).push_back(e);
    edge e2 = {A[i].first,i};
    vec.at(A[i].second).push_back(e2);
  }

  vector<int> ans(N-1,0);
  REP(i,N){
    int y=0;
    for(auto x:vec.at(i)){
      if(ans.at(x.cost)!=0){
        y=ans.at(x.cost);
      }
    }
    int cnt=1;
    for(auto x:vec.at(i)){
      if(cnt==y){
        cnt++;
      }
      if(ans.at(x.cost)==0){
        ans.at(x.cost)=cnt;
        cnt++;
      }
    }
  }
  
  int MAX = 0;
  REP(i,N-1){
    MAX = max(MAX,ans.at(i));
  }

  cout << MAX << endl;
  REP(i,N-1){
    cout << ans.at(i) << endl;
  }
}

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

using namespace std;

const int MAXN = 20;

int N;
int ans = 0;
vector <pair <int,int> > adj[MAXN];
vector <int> state(MAXN);

void bf(int p){
  if(p == N){
    bool ok = true;
    for(int i = 0; i < N && ok; i++){
      for(pair <int, int> j : adj[i]){
        if(state[i]){
          if(state[j.first] != j.second){
            ok = false;
            break;
          }
        }
      }
    }
    if(ok){
      int cont = 0;
      for(int i = 0; i < N; i++){
        cont += state[i];
      }
      ans = max(cont, ans);
    }
  }else{
    state[p] = 0;
    bf(p + 1);
    state[p] = 1;
    bf(p + 1);
  }
}

int main(){
  cin >> N;
  for(int i = 0; i < N; i++){
    int Ai;
    cin >> Ai;
    for(int j = 0; j < Ai; j++){
      int who, type;
      cin >> who >> type;
      who--;
      adj[i].push_back({who, type});
    }
  }
  bf(0);
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
d,n = map(int,input().split())

if d is 0:
    if n == 100:
        print(n+1)
    else:
        print(n)
elif d is 1:
    if n == 100:
        print((n+1)*100)
    else:
        print(n*100)
elif d is 2:
    if n == 100:
        print((n+1)*100**2)
    else:
        print(n*100**2)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
#define rep(i, n) for (ll i=0;i<(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(x) (x).begin(),(x).end()
 
using namespace std;
//using ll=long long;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pi;

const long double PI=3.14159265358979323846;

ll h,w;
ll ans;
//vector<char> masu;

template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}


int main(){
  ll n,x,y;
  cin>>n>>x>>y;

  x--;y--;
  vector<ll> v(n);

  map<ll, ll> m;

  ll tmp;
  rep(i, n){
    rep(j, n){
      if(i==j) continue;
      tmp = j-i;      
      tmp = min(tmp, abs(x-i)+abs(y-j)+1);
      m[tmp]++;
    }
  }

  rep(i, n-1){
    cout << m[i+1]<<endl;
  }
  
}


Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
using namespace std;

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

    string S, T, ans;
    cin >> S >> T;
    int l = T.size();
    if (S.size() < l){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    rep(i,S.size()-l+1){
        string S2 = S.substr(i,l);
        rep(j, l){
            if (S2[j] == '?' || S2[j] == T[j]){
                if (j == l-1){
                    string tmp = S;
                    S.replace(i,l,T);
                    if(ans.empty()) ans=S;
                    else ans=min(ans,S);
                    S=tmp;
                    break;
                }else continue;
            }else break;
        }
    }

    if (ans.empty()){
        cout << "UNRESTORABLE" << endl;
    }else{
        rep(i, ans.size()) if(ans[i] == '?') ans[i]='a';
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;


public class Main {


    static void solve() {
        Scanner scan = new Scanner(System.in);
        int[] arr = new int[5];
        for (int i=0;i<5;i++) {
            arr[i] = scan.nextInt();
        }

        for (int i=0;i<5;i++) {
            if(arr[i] == 0) {
                System.out.println(i+1);
                return;
            }
        }


//        int x1 = scan.nextInt();
//        int x2 = scan.nextInt();
//        int x3 = scan.nextInt();
//        int x4 = scan.nextInt();
//        int x5 = scan.nextInt();




//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
//
//            scase();
//        }
    }


//    static void solveCase(int t, int x, String s) {
//
//    }

    static void scase() {

    }




    public static void main(String[] args) {
        solve();
        //        Main m = new Main();
        //        Scanner scan = new Scanner(System.in);

        //        long n = scan.nextLong();
        //        long r = scan.nextLong();
        //        List<Long> list = new ArrayList<>();
        ////        int[] arr = new int[n];
        //        for (long i=0;i<n;i++){
        //            list.add(scan.nextLong());
        //        }
//            System.out.println(ch);
        //        solve(n, arr);
        //        scan.close();
    }


//
//    class Counter extends HashMap<Integer, Integer> {
//        public int get(int k) {
//            return containsKey(k) ? super.get(k) : 0;
//        }
//
//        public void add(int k, int v) {
//            put(k, get(k) + v);
//        }
//    }


//    static class TreeNode {
//        int val;
//        TreeNode left;
//        TreeNode right;
//
//        TreeNode(int x) {
//            val = x;
//        }
//    }

    static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }

}

Measured memory_bytes: 27020
import kotlin.math.abs


fun gcd(a:Long, b:Long): Long {
    if(b==0L)
        return a
    return gcd(b, a % b)
}

fun main() {
    val n = readLine()!!.toInt()
    val m = Array(2){HashMap<Pair<Long,Long>, Int>()}
    val t = LongArray(n+1)
    val mod = (1e9+7).toLong()
    var zero = 0L

    t[0] = 1L
    for(i in 1..n) {
        t[i] = (t[i-1] * 2L) % mod
    }

    for(i in 1..n) {
        var (a,b) = readLine()!!.split(" ").map { it.toLong() }
        if(a==0L && b==0L) {
            ++zero
            continue
        }
        if(a == 0L || b == 0L) {
            if(a==0L) {
                b = 1L
                // a: 0  b : 1
                m[0][a to b] = (m[0][a to b]?:0) + 1
            } else {
                a = 1L
                // a : 1 b : 0
                m[1][a to b] = (m[1][a to b]?:0) + 1
            }
            continue
        }
        val g = gcd(a,b)
        if( g != 0L) {
            a /= g
            b /= g
        }
        val idx = if((a <= 0 && b <= 0) || (a>=0 && b>=0)) 0 else 1
        val p = abs(a) to abs(b)
        m[idx][p] = (m[idx][p]?:0) + 1
    }
    val list = ArrayList<Long>()

    for((k,v) in m[0]) {
        val r = k.second to k.first
        var c = t[v]
        if(m[1].contains(r)) {
            c = (c + t[m[1][r]!!] -1L + mod) % mod
            m[1].remove(r)
        }
        list.add(c)
    }

    for((_,v) in m[1]) {
        list.add(t[v])
    }

    var ans = 1L
    for(v in list) {
        ans *= v
        ans %= mod
    }
    ans = (ans + mod - 1L + zero) % mod
    print(ans)
}

Measured memory_bytes: 85392
#ABC136D

s = input()
s += 'R'
n = len(s)
a = [0]*n
fo,ba = 0,0
rl = 0

for i in range(n-1):
    if s[i] == 'R' and s[i+1] == 'R':
        fo += 1
    elif s[i] == 'R' and s[i+1] == 'L':
        rl = i
        fo += 1
    elif s[i] == 'L' and s[i+1] == 'L':
        ba += 1
    elif s[i] == 'L' and s[i+1] == 'R':
        ba += 1
        if fo % 2 == 1:
            a[rl] += fo//2 + 1
            a[rl+1] += fo//2
        else:
            a[rl] += fo//2
            a[rl+1] += fo//2
            
        if ba % 2 == 1:
            a[rl+1] += ba//2 + 1
            a[rl] += ba//2
        else:
            a[rl+1] += ba//2
            a[rl] += ba//2
            
        fo = 0
        ba = 0
        
print(*a[:n-1])

Measured memory_bytes: 48684
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	int N, M;
	cin >> N>> M;
	vector<pair<int, bool>> vec(M);
	rep(i,0,M){
		int p;
		string s;
		cin >> p >> s;
		if (s == "AC"){
			vec[i] = make_pair(p-1, true);
		}
		else{
			vec[i] = make_pair(p-1, false);
		}
	}
	vector<bool> qs(N, false);
	vector<int > cnt_vec(N,0);
	int cnt_ac = 0, cnt_wa = 0;
	rep(i,0,M){
		if (!qs[vec[i].first]){
			if (vec[i].second){
				cnt_ac++;
				qs[vec[i].first] = true;
			}
			else{
				cnt_vec[vec[i].first]++;
			}
		}
	}
	rep(i,0,N){
		if(qs[i])
			cnt_wa += cnt_vec[i];
	}
	cout << cnt_ac << " " << cnt_wa << endl;

}
// 100000 7
// 7777 AC
// 7777 AC
// 7777 AC
// 1 WA
// 1 AC
// 1 AC
// 1 AC
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Measured memory_bytes: 1408
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0] * n
        self.size = [1] * n
    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x==y:
            return
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)


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

Friend = [[] for _ in range(N)]
Block  = [[] for _ in range(N)]

for _ in range(M):
    a,b = map(int,input().split())
    a-=1
    b-=1
    Friend[a].append(b)
    Friend[b].append(a)

for _ in range(K):
    c,d = map(int,input().split())
    c-=1
    d-=1
    Block[c].append(d)
    Block[d].append(c)

UF = UnionFind(N)

for i in range(N):
    for friend in Friend[i]:
        UF.union(i,friend)

li = [0]*N
for i in range(N):
    li[i] += (UF.size[UF.find(i)]-1-len(Friend[i]))


for i in range(N):
    for block in Block[i]:
        if UF.same_check(block,i):
            li[i]-=1
         
print(*li) 

Measured memory_bytes: 113344
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Text;

public class ALDS1_11_B
{
    public struct Node
    {
        public int Id;
        public List<int> Adj;
        public int Start;
        public int End;
        public Node(int id)
        {
            Id = id + 1;
            Adj = new List<int>();
            Start = -1;
            End = -1;
        }
    }

    public static void Main(string[] args)
    {
        //var exStdIn = new System.IO.StreamReader( "input.txt" );
        //System.Console.SetIn( exStdIn );

        int n = int.Parse(Console.ReadLine());
        var g = new Node[n];
        for (int i = 0; i < n; i++)
        {
            g[i] = new Node(i);
        }

        for (int i = 0; i < n; i++)
        {
            int[] val = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            for (int j = 2; j < val[1] + 2; j++)
            {
                g[val[0] - 1].Adj.Add(val[j] - 1);
            }
        }

        int time = 0;
        for (int i = 0; i < n; i++)
        {
            if (g[i].Start != -1)
            {
                continue;
            }
            time = Dfs(i, time, g);
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++)
        {
            sb.Append(g[i].Id);
            sb.Append(" ");
            sb.Append(g[i].Start);
            sb.Append(" ");
            sb.Append(g[i].End);
            sb.AppendLine();
        }
        Console.Write(sb.ToString());
    }

    public static int Dfs(int index, int time, Node[] g)
    {
        if (g[index].Start != -1)
        {
            return time;
        }
        time++;
        g[index].Start = time;
        for (int i = 0; i < g[index].Adj.Count; i++)
        {
            time = Dfs(g[index].Adj[i], time, g);
        }
        time++;
        g[index].End = time;
        return time;
    }
}



Measured memory_bytes: 18356
S = []
for _ in range(2):
    S.append(int(input()))  # S += [input()] とも書ける

if {S[0],S[1]} == {1,2}:
    print(3)
elif {S[0],S[1]}=={2,3}:
    print(1)
elif {S[0],S[1]}== {3,1}:
    print(2)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
void FastInputOutput(){
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}
inline ll power(ll x, ll p, ll m){
    ll res = 1;
    while(p){
        if(p & 1)
            res = ((res % m) * (x % m)) % m;
        x = ((x % m) * (x % m)) % m;
        p >>= 1;
    }
    return res % m;
}
long double ModLog(long double base, long double x) {
    return (logl(x) / logl(base));
}
int gcd (int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
int lcm(int a, int b){
    return a / gcd(a, b) * b;
}
const ll P = 1e9 + 9;
const int N = 1e3 + 1;

class TeamBuilder{
public:
    vector<int> adj[N];
    int canReach[N], rechable[N];
    int vst[N], cnt;
    void dfs(int u, int p){
        vst[u] = 1;
        ++cnt;
        for(auto v: adj[u]){
            if(vst[v] == 0){
                ++rechable[v];
                dfs(v, u);
            }else if(vst[v] == 1){
                ++rechable[v];
            }
        }
        vst[u] = 2;
    }
    vector<int> specialLocations(vector<string> all){
        memset(vst, 0, sizeof(vst));
        memset(canReach, 0, sizeof(canReach));
        memset(rechable, 0, sizeof(rechable));
        for(int i = 0; i < all.size(); ++i)
            adj[i].clear();
        for(int i = 0; i < all.size(); ++i){
            for(int j = 0; j < all[i].size(); ++j)
                if(all[i][j] == '1')
                    adj[i].push_back(j);
        }
        for(int i = 0; i < all.size(); ++i){
            cnt = 0;
            memset(vst, 0, sizeof(vst));
            dfs(i, -1);
            canReach[i] = cnt;
        }
        int n = all.size();
        printf("%d\n", n);
        int cnReachAll = 0, rechableFromAll = 0;
        for(int i = 0; i < n; ++i){
            cnReachAll += canReach[i] == n;
            rechableFromAll += rechable[i] == n;
            printf("%d %d %d\n", i, rechable[i], canReach[i]);
        }
        puts("");
        vector<int> ans;
        ans.push_back(cnReachAll);
        ans.push_back(rechableFromAll);
        return ans;
            
    }
};
int a[200000];
int main(){
    int n;
    scanf ("%d" , &n );
    for (int i =0 ; i < n ;i++)scanf ("%d" , a + i );
    ll sum , xo ;
    sum = xo =0;
    ll ans = 0;
    for (int i =0 , j =0 ; j < n ; j++)
    {
        sum += a[j]; xo^=a[j];
        while (sum != xo)
        {
            sum-=a[i];
            xo ^= a[i];
            i++;
        }
        ans += (j - i + 1 );
            
    }
    printf ("%lld\n" , ans );
}


Measured memory_bytes: 1024
def main():

    A = []
    for i in range(3):
        A.append(list(map(int, input().split())))
    cand = []
    for j in range(3):
        cand += [sorted(A[j])]
        cand += [sorted([A[i][j] for i in range(3)])]
    cand += [sorted([A[i][i] for i in range(3)])]
    cand += [sorted([A[i][2-i] for i in range(3)])]
    # print(cand)

    b = []
    N = int(input())
    for i in range(N):
        b.append(int(input()))
    b = set(sorted(b))
    # print(b)
    for i in range(len(cand)):
        if cand[i][0] in b and cand[i][1] in b and cand[i][2] in b:
            return "Yes"

    return "No"

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    double R;
    cin >> R;
    cout << setprecision(10) << R*6.28318530717958623200 << endl;
}

Measured memory_bytes: 3776