akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<cmath>
#include<stack>
#include<algorithm>
#define rg register
#define ll long long
#define LDB long double
#define ull unsigned long long
#define view(i,x) for(rg int i=hd[x];i!=-1;i=e[i].nt)
#define go(i,x,a) for(rg int i=a;i<x;i++)
#define inf 0x3f3f3f3f
#define INF 0x7fffffff
using namespace std;

const int maxn=105;
int n,m,mp[maxn][maxn],x,y;
short f[maxn][maxn][maxn][maxn],a[maxn][maxn],b[maxn][maxn];
char s[maxn];

inline int rd(){
	int ret=0,af=1; char gc=getchar();
	while(gc < '0' || gc > '9'){ if(gc=='-') af=-af; gc=getchar(); }
	while(gc >= '0' && gc <= '9') ret=ret*10+gc-'0',gc=getchar();
	return ret*af;
}

int main(){
	n=rd(); m=rd();
	go(i,n+1,1){
		scanf("%s",s+1);
		go(j,m+1,1){
			if(s[j] == 'o') mp[i][j]=1;
			if(s[j] == 'E') x=i,y=j;
			a[i][j]=b[i][j]=mp[i][j];
		}
	}
	go(i,n+1,1)	go(j,m+1,1) a[i][j]+=a[i-1][j],b[i][j]+=b[i][j-1];
	short ans=0;
	for(rg int i=x;i>=1;i--)
	 for(rg int j=y;j>=1;j--)
	  for(rg int p=x;p<=n;p++)
	    for(rg int q=y;q<=m;q++){
			if(i > 1 && i-1 > p-x) ans=max(ans,f[i-1][j][p][q]=max((int)f[i-1][j][p][q],f[i][j][p][q]+b[i-1][min(q,m-y+j)]-b[i-1][max(j-1,q-y)]));
			if(j > 1 && j-1 > q-y) ans=max(ans,f[i][j-1][p][q]=max((int)f[i][j-1][p][q],f[i][j][p][q]+a[min(p,n-x+i)][j-1]-a[max(i-1,p-x)][j-1]));
			if(p < n && x-i < n-p) ans=max(ans,f[i][j][p+1][q]=max((int)f[i][j][p+1][q],f[i][j][p][q]+b[p+1][min(q,m-y+j)]-b[p+1][max(j-1,q-y)]));
			if(q < m && y-j < m-q) ans=max(ans,f[i][j][p][q+1]=max((int)f[i][j][p][q+1],f[i][j][p][q]+a[min(p,n-x+i)][q+1]-a[max(i-1,p-x)][q+1]));
		}
	printf("%d",ans);
	return 0;
}//Faze


Measured memory_bytes: 227712
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n; cin>>n;
    vector<int> p(n);
    for(int i=0; i<n; i++){
        cin>>p[i];
        p[i]--;
    }

    int base = 30000;
    vector<int> a(n), b(n);
    for(int i=0; i<n; i++){
        a[i] = 30000 * (i + 1);
        b[i] = 30000 * (n - i);
    }

    for(int i=0; i<n; i++){
        a[p[i]] += i;
    }

    for(int i=0; i<n; i++){
        cout << a[i] << " \n"[i == n-1];
    }
    for(int i=0; i<n; i++){
        cout << b[i] << " \n"[i == n-1];
    }
}

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  string s;cin>>s;
  vector<int> num(12);
  int i,j;
  int ind=-1;
  rep(i,12)
  {
    if(s[i]!='?')
    {
      num[i]=s[i]-'0';
    }
    else
    {
      ind=i;
    }
  }
  int oks=0;
  int ansnum=-1;
  rep(i,10)
  {
    num[ind]=i;
    int ch=num[11];
    int sum=0;
    for(j=1;j<=6;j++)
    {
      int q=j+1;
      int pq=(num[11-j]*q)%11;
      sum+=pq;
    }
    for(j=7;j<=11;j++)
    {
      int q=j-5;
      int pq=(num[11-j]*q)%11;
      sum+=pq;
    }
    sum%=11;
    int dig=11;
    dig-=sum;
    if(sum<=1)dig=0;
    if(dig==ch)
    {
      oks++;
      ansnum=i;
    }
  }
  if(oks>=2)cout<<"MULTIPLE"<<endl;
  else cout<<ansnum<<endl;
}



Measured memory_bytes: 3224
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    int n, m;
    cin >> n >> m;
    akari<int> cond(n, -1);
    for (int i = 0; i < m; i++)
    {
        int s, c;
        cin >> s >> c;
        s--;
        if (cond[s] != -1 && cond[s] != c)
        {
            cout << -1 << endl;
            return;
        }
        cond[s] = c;
    }
    if (n == 1 && (cond[0] == 0 || cond[0] == -1))
    {
        cout << 0 << endl;
        return;
    }
    int beg = 1;
    for (int i = 1; i < n; i++)
    {
        beg *= 10;
    }
    for (int x = beg; x < beg * 10; x++)
    {
        bool ok = 1;
        int t = beg;
        for (int i = 0; i < n; i++)
        {
            if (cond[i] != -1 && x / t % 10 != cond[i])
            {
                ok = 0;
            }
            t /= 10;
        }
        if (ok)
        {
            cout << x << endl;
            return;
        }
    }
    cout << -1 << endl;
}

int main()
{
    solve();
    return 0;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 205, MAXC = 60;

ll c[MAXC][MAXC];

ll dp[MAXC];

vi ans;

void solve(){
	ll n;
	REP(i, 0, MAXC){
		c[i][i] = c[i][0] = 1;
		REP(j, 1, i){
			c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
		}
		for(int j = 2; j <= i; j += 2){
			dp[i] += c[i][j];
		}
		//cout << i << " " << dp[i] << endl;
	}
	cin >> n;
	/*for(int cur = 1; n; cur++){
		int ind;
		for(ind = 0; dp[ind] <= n; ind++);
		ind--;
		REP(i, 0, ind){
			ans.pb(cur);
		}
		n -= dp[ind];
		cout << ind << endl;
	}*/
	for(int cur = 1; n; cur++){
		int ind;
		for(ind = 0; dp[ind] <= n; ind++);
		ind--;
		n -= dp[ind];
		vi pos;
		int cur1 = 0;
		vi vals;
		for(int i = ind / 2, j = 0; i >= 0; i--, j++){
			ll s = 0;
			REPN(j, 0, i){
				s += c[i][j] * c[ind - i][j];
			}
			ll v = n / s;
			if (v <= 5){
				REP(j, 0, v){
					pos.pb(i);
					vals.pb(++cur1);
				}
				n %= s;
			}
		}
		int i = 0;
		for(int j = SZ(vals) - 1; j >= 0; j--){
			for(; i < pos[j]; i++){
				ans.pb(cur);
			}
			ans.pb(vals[j] + cur);
		}
		for(; i < ind; i++){
			ans.pb(cur);
		}
		for(int j = 0; j < SZ(vals); j++){
			ans.pb(vals[j] + cur);
		}
		cur += cur1;
		//cout << ind << endl;
	}
	printf("%d\n", SZ(ans));
	REP(i, 0, SZ(ans)){
		printf("%d ", ans[i]);
	}
	putchar('\n');
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 256
N, X = map(int, input().split())

L = [0]*(N+1)
L[0] = 1

for i in range(N):
    L[i+1] = L[i]*2 + 3
P = [0]*(N+1)
P[0] = 1
for i in range(N):
    P[i+1] = P[i]*2 + 1


def solve(n, x):
    #print(n, x)
    if x == L[n]:
        return(P[n])
    elif x <= n:
        return(0)
    else:
        ret = 0
        if x >= L[n-1] + 1:
            ret += P[n-1]
            x -= L[n-1] + 1
            if x > 0:
                ret += 1 + solve(n-1, x - 1)
        else:
            ret = solve(n-1, x-1)
        return(ret)


print(solve(N, X))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define FORN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define FORR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define repr(i, n) FORR(i, n, 0)
#define repnr(i, n) FORR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll n;
	cin >> n;
	Vec l(n);
	rep(i, n) cin >> l[i];
	sort(all(l));

	ll ans = 0;
	rep(i, n-2){
		FOR(j, i+1, n-1){
			ll tmp = lower_bound(all(l), l[i]+l[j])-l.begin()-j-1;
			ans += tmp;
		}
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;

bool dp[100001];

int main(){
    int N, K;
    cin >> N >> K;
    int a[101];
    rep(i, 0, N){ cin >> a[i]; }
    // 必ず負ける = true
    dp[0] = true;
    string ans = "First";
    rep(k, 1, K+1){
        bool lose = true;
        rep(j, 0, N){
            bool a_lose;
            if (k >= a[j]){ a_lose = !dp[k-a[j]]; }
            else a_lose = true;
            lose = lose && a_lose;
        }
        dp[k] = lose; 
    }
    if(dp[K]) ans = "Second";
    cout << ans;
}

/*
int dp[100001][2];

int counterpart(int p){
    return abs(1 - p);
}

int get_winner(int k, int p, int* a, int n){
    if(dp[k][p] != -1){
        return dp[k][p];
    }
    int winner = counterpart(p);
    rep(i, 0, n){
        if(k==a[i]){ winner = p; }
        else if(k - a[i] > 0){
            if(get_winner(k-a[i], counterpart(p), a, n) == p){
                winner = p;
            }
        }
    }
    dp[k][p] = winner;
    return dp[k][p];
}

int main(){
    int N, K;
    cin >> N >> K;
    int a[101];
    rep(i, 0, N){ cin >> a[i]; }

    rep(i, 0, K+1){
        rep(p, 0, 2){
            dp[i][p] = -1;
        }
    }
    string ans = "First";
    if(get_winner(K, 0, a, N) == 1){ ans = "Second"; }
    cout << ans;
    return 0;
}
*/



Measured memory_bytes: 384
import std;

ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "next", long, "cost");
alias PQueue(T, alias less = "a>b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    auto a = aryread.sort!"a>b"().array();
    long[] b;
    a.each!(x => b ~= x.only.cycle.take(2).array());
    writeln(b.take(n).sum() - b[0]);
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 16876
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<bool> vbool;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<llint> vllint;
typedef vector<vllint> vvllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define coutans rep(i, ans.size())cout << ans[i] << endl;
#define mod (llint)1000000007
#define int_max 2147483647
#define ll_max (llint)9223372036854775807

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(llint a, llint b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aのb乗を求める(1000000007で割った余りやで)
llint modpow(llint a, llint b) {
	if (b == 0)return 1;
	if (b == 1)return a;
	llint tmp = modpow(a, b / 2);
	tmp %= mod;
	tmp = tmp * tmp % mod;
	if (b % 2)return tmp * a % mod;
	else return tmp;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= mod;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, mod);
		ans %= mod;
	}
	return ans;
}


int main() {
	string s;
	cin >> s;
	bool b = true;
	rep(i, 3) {
		if (s[i] == s[i + 1]) {
			b = false;
		}
	}
	if (b)cout << "Good" << endl;
	else cout << "Bad" << endl;
	return 0;
}

Measured memory_bytes: 256
num=int(input())
taro_point=hanako_point=0

for n in range(num):
  taro_card,hanako_card = input().split()
  min_cards_num=min(len(taro_card),len(hanako_card))
  
  if taro_card==hanako_card:
    taro_point+=1
    hanako_point+=1
  else:
    for c in range(min_cards_num):
      if taro_card[c]<hanako_card[c] :
        hanako_point+=3
        #print("hanako3point")
        break
      elif(taro_card[c]>hanako_card[c]):
        taro_point+=3
        #print("taro3point")
        break
      #最後まで同じ文字の場合は文字数が多いほうの勝ち
      elif c == min_cards_num -1:
        #print("同じ文字数")
        if len(hanako_card)>len(taro_card):
          hanako_point+=3
          #print("hanako3point")
        else:
          taro_point+=3
          #print("taro3point")

print(taro_point,hanako_point)


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


signed main(){
    int N;
    int T[100001]={},x[100001]={},y[100001]={};
    cin >> N;
    REP(i,N){
        cin >> T[i+1] >> x[i+1] >> y[i+1];
    }
    REP(i,N){
        int sum1=T[i+1]-T[i];
        int sum2=abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
        if(sum1<sum2 || (sum1+sum2)%2==1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
 
struct BiconectedGraph {  
  typedef pair<int,int> P;  
  int n;  
  vector<vector<int> > G; // original graph
  vector<vector<int> > C;
  vector<vector<int> > T; // tree after build
  vector<int> ord;
  vector<int> low;
  vector<int> belong; // i belong belong[i] 
  vector<P> B;
  BiconectedGraph() {};
  BiconectedGraph(int sz) : n(sz), G(sz), C(sz), T(sz) {};
    
  void add_edge(int u, int v) {
    G[u].push_back(v);
    G[v].push_back(u); // undirected graph
  }
    
  
  bool is_bridge(int u, int v){
    if ( ord[u] > ord[v] ) swap(u, v);
    return ord[u] < low[v];
  }
  
  void dfs(int u, int p, int &k) {
    ord[u] = low[u] = k;
    ++k;
    for ( int v : G[u] ) {
      if ( v == p ) continue;
      if ( ord[v] >=0 ) {
	low[u] = min(low[u], ord[v]);
      } else {
	dfs(v, u, k);
	low[u] = min(low[u], low[v]);
      }
      if ( is_bridge(u, v) ) B.push_back(P(u, v));
    }
  }
    
  void fill_component(int c, int u) {
    C[c].push_back(u);
    belong[u] = c;
    for ( int v : G[u] ) {
      if ( belong[v] >= 0 || is_bridge(u,v) ) continue;
      fill_component(c, v);
    }
  }
    
  void add_component(int u, int &k) {
    if ( belong[u] >=0 ) return;
    fill_component(k++, u);
  }
    
  int build() {
    int k = 0;
    ord.resize(n);
    low.resize(n);
    belong.resize(n);
    fill(ord.begin(), ord.end(), -1);
    fill(belong.begin(), belong.end(), -1);
    for ( int u = 0; u < n; u++ ) {
      if ( ord[u] >= 0 ) continue;
      dfs(u, -1, k);
    }
    k = 0;
    for ( int i = 0; i < (int)B.size(); i++ ) {
      add_component(B[i].first, k);
      add_component(B[i].second, k);
    }
      
    for ( int u = 0; u < n; u++ ) add_component(u, k);
    for ( int i = 0; i < (int)B.size(); i++ ) {
      int u = belong[B[i].first], v = belong[B[i].second];
      T[u].push_back(v);
      T[v].push_back(u);
    }
    return k;
  }
};

signed main() {
  int N, M;
  cin >> N >> M;
  
  BiconectedGraph bg(N);
  for ( int i = 0; i < M; i++ ) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    bg.add_edge(a, b);    
  }

  cout << bg.build()-1 << endl;  
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n, k, s;
    cin >> n >> k >> s;

    const int INF = 1000 * 1000 * 1000;

    if (s == INF) {
    for (int i = 0; i < k; ++i)
        cout << s << ' ';
    for (int i = 0; i < n - k; ++i)
        cout << INF -1 << ' ';
    cout << endl;
    exit(0);
    }   

    for (int i = 0; i < k; ++i)
        cout << s << ' ';
    for (int i = 0; i < n - k; ++i)
        cout << s + 1 << ' ';
    cout << endl;

}

Measured memory_bytes: 1280
def main():
    n, k = map(int, input().split())
    p = 10 ** 9 + 7
    ans = 0
    for i in range(k, n + 2):
        if i == n + 1:
            ans += 1
        else:
            ans += n * i - (i - 1) * i + 1

        ans %= p

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9184
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

from collections import deque,defaultdict,Counter
def main():
    N = int(input())
    G = [[] for _ in range(N)]
    for i in range(N):
        A = list(map(int,input().split()))
        for a in A[2:]:
            a -= 1
            G[i].append(a)
    
    q = deque([0])
    dist = [-1] * N
    dist[0] = 0
    while q:
        v = q.popleft()
        for e in G[v]:
            if dist[e] >= 0:
                continue
            dist[e] = dist[v] + 1
            q.append(e)
    
    ans = [(i + 1,dist[i]) for i in range(N)]
    for t in ans:
        print(*t)
if __name__ == '__main__':
    main()


Measured memory_bytes: 6044
#include<stdio.h>

int main(){
  int N,M;
  scanf("%d%d", &N , &M);
  int L[M], R[M];
  for(int i = 0; i < M; i++){
    scanf("%d%d", &L[i], &R[i]);
  }
  int max_L = L[0], min_R = R[0];
  for(int i = 0; i < M; i++){
  	if(max_L < L[i]) max_L  = L[i];
  }
  for(int i = 0; i  < M; i++){
  	if(min_R > R[i]) min_R  = R[i];
  }
  if( min_R - max_L >=  0) printf("%d", min_R - max_L + 1);
  else printf("0");
  return 0; 
}

Measured memory_bytes: 896
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		int n = stdIn.nextInt();

		List<Integer> numberList = IntStream.range(0, n).mapToObj(i -> stdIn.nextInt()).collect(Collectors.toList());

		int m = stdIn.nextInt();

		Set<Integer> allSumSet = getAllSumSet(numberList);

		for (int i = 0; i < m; i++) {
			String result = allSumSet.contains(stdIn.nextInt()) ? "yes":"no";
			System.out.println(result);
		}


		stdIn.close();
	}

	private static Set<Integer> getAllSumSet(List<Integer> inputNumberList) {
		Set<Integer> allPattern = new TreeSet<>();

		int allSize = (int)Math.pow(2, inputNumberList.size());
		int digits = inputNumberList.size();

		for (int i = 1; i < allSize; i++) {
			String boolStr = String.format("%"+digits+"s", Integer.toBinaryString(i)).replaceAll(" ", "0");

			allPattern.add(sum(inputNumberList, boolStr));
		}

		return allPattern;
	}

	private static int sum(List<Integer> numberList, String boolStr) {

		int sum = 0;

		for (int i = 0; i < boolStr.length(); i++) {
			if(boolStr.charAt(i) == '1') {
				sum += numberList.get(i);
			}
		}

		return sum;
	}
}



Measured memory_bytes: 577864
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
 
int main(){
  int K;
  int X,Y,Z;
  cin >> X >> Y >> Z >> K;
  vector<long long> A(X),B(Y),C(Z);
  
  for(int i = 0; i < X; i ++) cin >> A[i];
  for(int i = 0; i < Y; i ++) cin >> B[i];
  for(int i = 0; i < Z; i ++) cin >> C[i];
  
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  sort(B.begin(), B.end());
  reverse(B.begin(), B.end());
  sort(C.begin(), C.end());
  reverse(C.begin(), C.end());
 
  vector<long long> ABC;
  for (int a = 0; a < X; a++)
  {
    for (int  b = 0; b < Y; b++)
    {
      if ((a+1) * (b+1) > K) break;
      
      for (int c = 0; c < Z; c++)
      {
        if ((a+1) * (b+1) * (c+1) > K) break;
        ABC.push_back(A[a]+B[b]+C[c]);
      }
    }
  }
  
  sort(ABC.begin(), ABC.end());
  reverse(ABC.begin(), ABC.end());
  
  for (int i = 0; i < K; i ++){
    cout << ABC[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 1404
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;
typedef tuple<double, int, LL> TP;
constexpr LL kInf = 1e18;

int main() {
  int N, Q; cin >> N >> Q;
  vector<TP> tps; tps.reserve(2*N);
  for (int i = 0; i < N; ++i) {
    int S, T, X; cin >> S >> T >> X;
    tps.push_back({S-X-0.5, 1, X});
    tps.push_back({T-X-0.5, -1, X});
  }

  for (int i = 0; i < Q; ++i) {
    int D; cin >> D;
    tps.push_back({D, 0, i});
  }

  sort(tps.begin(),tps.end());

  vector<LL> ans(Q);
  multiset<LL> s;
  for (auto [t, e, x] : tps) {
    if (e > 0) {  // add
      s.insert(x);
    } else if (e < 0) {  // del
      s.erase(x);
    } else {
      ans[x] = (s.empty()) ? -1 : *(s.begin());
    }
  }
  for (int v : ans) cout << v << endl;
}


Measured memory_bytes: 28336
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int a[3*n];
  for(int i=0;i<n*3;i++) cin>>a[i];
  sort(a,a+3*n);
  reverse(a,a+3*n);
  int ans=0;
  for(int i=0;i<n;i++) ans+=a[i*2+1];
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.nextLine();
		if(S.equals("ABC")) {
			System.out.println("ARC");
		}else if(S.equals("ARC")) {
			System.out.println("ABC");
		}
	}
}


Measured memory_bytes: 35776
import math
n, h = map(int, input().split())
a_max = 0
b_list = []
for i in range(n):
    a, b = map(int, input().split())
    a_max = max(a_max, a)
    b_list.append(b)
b_list = sorted(b_list, reverse=True)
count = 0
flag = 0
for i in range(len(b_list)):
    if a_max < b_list[i]:
        h -= b_list[i]
        count += 1
    else:
        flag = 1
        count += math.ceil(h/a_max)
        break
    if h <= 0:
        flag = 1
        break
if flag == 0:
    count += math.ceil(h/a_max)
print(count)


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

int main() {
  int N, M;
  cin >> N >> M;
  int l = 0;
  int r = pow(10, 5);
  for (int i = 0; i < M; ++i) {
    int li, ri;
    cin >> li >> ri;
    l = max(l, li);
    r = min(r, ri);
  }
  if (l <= r) {
    cout << r - l + 1 << endl;
  } else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(int& a){printf("%d",a);}
void print(long long& a){printf("%lld",a);}
void print(double& a){printf("%.15lf",a);}
template<class T> void print(T& a){cout<<a;}
template<class T> void print(vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(Head& head, Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(T& a){cerr<<a;}
template<class T> void dprint(vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(Head& head, Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    int a,b,c;
    in(a,b,c);
    yn(b>a&&c>b);
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	while(cin>>n>>m&&n!=0&&m!=0){
		int sum=0;
		vector<int>data;
		for(int i=0;i<n;i++){
			int p;
			cin>>p;
			sum+=p;
			data.push_back(p);
		}
		sort(data.begin(),data.end(),greater<int>());
		for(int i=m-1;i<n;i+=m){
			sum-=data[i];
		}
		cout<<sum<<endl;
	}
}

Measured memory_bytes: 1228
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    ll x, t; cin >> x >> t;
    if(x<t){
        cout << 0 << endl;
    }
    else{
        cout << x-t << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
	using std::cin;
	using std::cout;
#include <string>
    using std::string;
#include <vector>
    using std::vector;

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

    vector<int>  buf(3);

    cin >> buf[0];
    cin >> buf[1];

    int count = 0;

    for(int i = 0;i < n-2; ++i){
        cin >> buf[2];

        if((buf[0] < buf[1])&&(buf[1] < buf[2])){
            count++;
        }else if((buf[2] < buf[1])&&(buf[1] < buf[0])){
          	count++;
        }

        buf[0] = buf[1];
        buf[1] = buf[2];
    }

    cout << count;

	return 0; 
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll, ll> pair_t;
using Graph = vector<vector<ll>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = 1 << 29;
/****** define constant end ********/

/****** define variable start ******/
ll n;
vl a;
/******* define variable end *******/
ll solve()
{
    cin >> n;
    a.resize(n);
    vl count(n);
    REP(i, n)
    {
        count[i] = 0;
    }
    REP(i, n)
    {
        cin >> a[i];
        count[a[i] - 1]++;
    }
    vl comb(n);
    ll sum = 0;
    for (ll i = 1; i <= n; i++)
    {
        if (i - 1 == 0)
        {
            comb[i - 1] = 0;
        }
        else
        {
            comb[i - 1] = i * (i - 1) / 2;
        }
    }
    vector<bool> check(n);
    vector<bool> check2(n + 2);
    REP(i, n)
    {
        check[i] = false;
        check2[i] = false;
    }
    REP(i, n)
    {
        if (check[count[a[i] - 1] - 1] == true && check2[a[i]] == true)
        {
            continue;
        }
        sum += comb[count[a[i] - 1] - 1];
        check[count[a[i] - 1] - 1] = true;
        check2[a[i]] = true;
    }
    //cout << sum << endl;
    REP(i, n)
    {
        if (count[a[i] - 1] - 2 < 0)
        {
            cout << sum << endl;
        }
        else
        {
            //cout << comb[count[a[i] - 1] - 1] << " " << comb[count[a[i] - 1] - 2] << endl;
            cout << sum - comb[count[a[i] - 1] - 1] + comb[count[a[i] - 1] - 2] << endl;
        }
    }
    return 0;
}
int main()
{
    //clock_t start = clock();
    cout << std::fixed << std::setprecision(10);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll end_solve = solve();
    /*
    clock_t end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    printf("time %lf[ms]\n", time);
    */

    return (int)end_solve;
}


Measured memory_bytes: 7296
#include <stdio.h>

int main()
{
  int A,B,K,i;
  scanf("%d %d %d",&A,&B,&K);
  if(K<=(B-A+1)/2){
    for(i=0;i<K;++i)  printf("%d\n",i+A);
    for(i=B-K+1;i<=B;++i)  printf("%d\n",i);
  }
  else{
    int n = (B-A+1)/2;
    if((B-A+1)%2==0){
      for(i=0;i<n;++i)  printf("%d\n",i+A);
      for(i=B-n+1;i<=B;++i)  printf("%d\n",i);
    }
    else{
    for(i=0;i<=n;++i)  printf("%d\n",i+A);
    for(i=B-n+1;i<=B;++i)  printf("%d\n",i);
    }
  }
  return 0;
}

Measured memory_bytes: 128
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static class LowerBoundComparator<T extends Comparable<? super T>>
          implements Comparator<T>
  {
    public int compare(T x, T y)
    {
      return (x.compareTo(y) >= 0) ? 1 : -1;
    }
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int n = sc.nextInt();
    List<Integer> l = new ArrayList<>(n);
    for (int i = 0; i < n; i++) {
      l.add(sc.nextInt());
    }

    Collections.sort(l);
    int ans = 0;

    for (int ai = 0; ai < n - 2; ai++) {
      for (int bi = ai + 1; bi < n - 1; bi++) {
        int a = l.get(ai);
        int b = l.get(bi);

        int ci = - Collections.binarySearch(l, a + b, new LowerBoundComparator<>()) - 1;

        ans += (ci - 1) - bi;
      }
    }
    os.println(ans);
  }
}

Measured memory_bytes: 44540
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
#define pb push_back
#define ins insert
#define pll pair<ll,ll>
#define fi first
#define se second
#define mpr make_pair
#define vtr vector
#define itor iterator 
#define N ll(1e9+7)
#define endl '\n'
using namespace std;
//ll power(ll a,ll b,ll mod)
//{
//	if(b==0)return 1;
//	ll ans=1;
//	while(b>0)
//	{
//		if(b&1)ans=(ans*a)%mod;
//		a=(a*a)%mod;
//		b>>=1;
//	}
//	return ans;
//}
int main()
{
	ll k;
	cin>>k;
	queue<ll> q;ll i,el;
	for(i=1;i<=9;i++)
	{
		q.push(i);
	}
	while(k--)
	{
		el=q.front();
		q.pop();
		ll rem=el%10;
		if(rem!=0)q.push(10ll*el+rem-1);
		q.push(10ll*el+rem);
		if(rem!=9)q.push(10ll*el+rem+1);
	}
	cout<<el;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int l = sc.nextInt();
		int r = sc.nextInt();
		long ans = 2018;

		if (r - l > 2018) {
			System.out.println(0);
			System.exit(0);
		} else {
			l %= 2019;
			r %= 2019;

			for (int i = l; i < r; i++) {
				for (int j = i + 1; j <= r; j++) {
					long mul = i * j;
					mul %= 2019;
					if (mul < ans) {
						ans = mul;
					}
				}
			}
		}

		System.out.println(ans);
		sc.close();
	}
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans=1;
    char c=s[0];
    for(int i=1;i<n;i++){
        if(s[i]!=c){
            ans++;
            c=s[i];
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
int n, a, z, c, p;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> p;
  FOR(i, 1, n){
    cin >> a;
    if(p < a){
      if(z == -1){
        c++;
        z = 0;
      }else{
        z = 1;
      }
    }else if(p > a){
      if(z == 1){
        c++;
        z = 0;
      }else{
        z = -1;
      }
    }
    p = a;
  }
  cout << c + 1 << endl;
  return 0;
}

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

#define max_size 100000

vector<vector<int> > adj(max_size);
vector<int> visited(max_size,0);
vector<int> indegree(max_size,0); 
vector<int> dp(max_size,-1);



int dfs(int src){
    visited[src]=1;
    int max_length=0;
    int length=0;
    if(dp[src]!=-1){
        visited[src]=0;
        return dp[src];
    }
    for(int i=0;i<adj[src].size();i++){
        if(!visited[adj[src][i]]){
            length=1+dfs(adj[src][i]);
            max_length=max(max_length,length);
        }
    }
    visited[src]=0;
    
    dp[src]=max_length;
    return max_length;
}

int main(){
    
    int N,M,x,y;
    int maximum=0;
    cin>>N>>M;
    for(int i=0;i<M;i++){
        cin>>x;
        cin>>y;
        adj[x-1].push_back(y-1);
        indegree[y-1]++;
    }
    
    for(int i=0;i<N;i++){
        if(indegree[i]==0){
            int temp_max=dfs(i);
            maximum=max(maximum,temp_max);
        }
    }
    cout<<maximum;
}


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


int main()
{
	int A, B;
	cin >> A >> B;
	if (A == B)
		cout << "Draw" << endl;
	else if (A == 1 || (B != 1 && A > B))
		cout << "Alice" << endl;
	else
		cout << "Bob" << endl;
	return 0;


}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 60);
typedef pair<ll, ll> pii;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
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;
}

string A;
vi AA;
int main()
{
    cin >> A;
    REP(i, A.size())
    {
        AA.push_back(int(A[i]));
    }
    int ans = 0;
    bool flg = true;
    while (true)
    {
        flg = true;
        REP(i, AA.size() - 1)
        {
            if (AA[i] != AA[i + 1])
            {
                AA.erase(AA.begin() + i);
                ans++;
                AA.erase(AA.begin() + i);
                ans++;
                flg = false;
                break;
            }
        }
        if (flg || AA.size() == 0)
        {
            break;
        }
    }
    cout << ans << endl;
    // system("pause");
}

Measured memory_bytes: 1528
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(a == max({a,b,c})) cout << "A" << endl;
  else if(b == max({a,b,c})) cout << "B" << endl;
  else if(c == max({a,b,c})) cout << "C" << endl;
}


Measured memory_bytes: 3096
N = int(input())
xy = [[0 for i in range(2)] for j in range(N)]
for n in range(N):
    xy[n][0],xy[n][1] = map(int, input().split())
route = N*(N-1)
Length = 0
for i in range(N-1):
    for j in range(i+1,N):
        Length = Length + ((xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2)**(1/2)
Length_ave = Length*((N-2)*2+2)/route
print(Length_ave)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
ll N;
ll A[201010];
pair<ll, ll> X[201010], Y[201010];

int main()
{
    cin >> N;
    rep(i, 0, N)
    {
        cin >> A[i];
        X[i] = make_pair(A[i] + i, i);
        Y[i] = make_pair(-(A[i] - i), i);
    }
    sort(X, X + N);
    sort(Y, Y + N);

    ll ans = 0;
    rep(i, 0, N)
    {
        auto p = X[i];
        auto lb = upper_bound(Y, Y + N, p);
        auto ub = lower_bound(Y, Y + N, make_pair(p.first + 1LL, 0LL));
        ll num = ub - lb;
        ans += num;
    }

    cout << ans << endl;
}

Measured memory_bytes: 11388
import sys
N=int(input())
print(0)
s=input()
a=s
if s=='Vacant':
  sys.exit()
left=0
right=N
while True:
  n=(left+right)//2
  print(n)
  s=input()
  if s=='Vacant':
    sys.exit()
  if n%2!=0:
    if s==a:
      right=n
    else:
      left=n
  else:
    if s!=a:
      right=n
    else:
      left=n

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

int main() 
{
    int n, m, X, Y;
    cin >> n >> m >> X >> Y;
    int minn = Y, maxx = X;
    while (n--)
    {
        int x; cin >> x;
        maxx = max(x, maxx);
    }
    while (m--)
    {
        int y; cin >> y;
        minn = min(y, minn);
    }
    cout << (maxx<minn?"No War":"War");
    return 0;
}

Measured memory_bytes: 256
n=int(input())
l=[]
for i in range(n):
	l+=[int(input())]
ans=sum(l);
l.sort()
if ans%10==0:
	for i in range(n):
		if l[i]%10!=0:
			ans-=l[i]
			break
	else:
		ans = 0
print(ans)	


Measured memory_bytes: 3060
using System;
class Program
{
    public static void Main()
    {
        bool f = false;
        string n = Console.ReadLine();
        for (int i = 0; i < n.Length; i++)
            if (n[i] == '9')
                f = true;
        if (f)
            Console.WriteLine("Yes");
        else
            Console.WriteLine("No");
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int c=0,i;
    string a,s;
    cin>>a>>s;
    for(i=0;i<s.size();i++)
    {
        if(a[i]!=s[i])
            c++;
    }
    cout<<c<<endl;
}



Measured memory_bytes: 3916
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n, q = MI()
    s = SI()
    td = [SI().split() for _ in range(q)]
    ans = n
    # 左に落ちるゴーレムのうち、最右のインデックス
    l = -1
    r = n
    while l + 1 < r:
        m = (l + r) // 2

        def ok(m):
            for t, d in td:
                if s[m] == t: m += (d == "R") * 2 - 1
                if m == -1: return True
                if m == n: return False
            return False

        if ok(m): l = m
        else: r = m
    ans -= l + 1
    # 右に落ちるゴーレムのうち、最左のインデックス
    l = -1
    r = n
    while l + 1 < r:
        m = (l + r) // 2

        def ok(m):
            for t, d in td:
                if s[m] == t: m += (d == "R") * 2 - 1
                if m == -1: return False
                if m == n: return True
            return False

        if ok(m): r = m
        else: l = m
    ans -= n - r

    print(ans)

main()


Measured memory_bytes: 41392
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int A,N;
	cin>>N>>A;
	cout<<(N*N-A)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;

int M;

inline int madd(int x,int y) {
	if (x+y<M) return x+y; else return x+y-M;
}
inline int msub(int x,int y) {
	if (x-y>=0) return x-y; else return x-y+M;
}
inline int mmul(int x,int y) {
	return int(ll(x)*y % M);
}

template<class T,int N,int P,int M>
void matmul(T res[][M], const T A[][P], const T B[][M]) { // res[NxM] = A[NxP] * B[PxM]
	static T tmp[N][M];
	rep(i,0,N) rep(j,0,M) tmp[i][j]=0;
	rep(i,0,N) rep(j,0,M) rep(k,0,P) {
		tmp[i][j]=madd(tmp[i][j],mmul(A[i][k],B[k][j]));
	}
	rep(i,0,N) rep(j,0,M) res[i][j]=tmp[i][j];
}

template<class T,int N>
void matpow(T res[][N], const T A[][N], ll p) { // res[1xN] *= A[NxN]^p
	static T tmp[N][N];
	rep(i,0,N) rep(j,0,N) tmp[i][j]=A[i][j];
	while (p>0) {
		if (p%2) matmul<T,1>(res,res,tmp);
		matmul<T,N>(tmp,tmp,tmp);
		p/=2;
	}
}

int len(ll x) {
	assert(x>0);
	int res=0;
	while (x>0) {
		x/=10;
		res++;
	}
	return res;
}

ll find_len(ll L,ll A,ll B) {
	int z=len(A);
	ll l=0,r=L;
	while (l<r) {
		ll m=l+(r-l)/2;
		if (z==len(A+B*m)) l=m+1; else r=m;
	}
	return l;
}

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	ll L,A,B;
	cin>>L>>A>>B>>M;
	
	int sum=0;
	while (L>0) {
		ll k=find_len(L,A,B);
		int p=1;
		rep(i,0,len(A)) p=mmul(p,10);
		int r[1][3]={{sum,int(A%M),1}};
		int X[3][3]={{p,0,0},
		             {1,1,0},
		             {0,int(B%M),1}};
		matpow(r,X,k);
		sum=r[0][0];
		L-=k;
		A+=B*k;
	}
	
	cout<<sum<<"\n";
}


Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n, x = sc.nextInt()
    val ls = List.fill(n)(sc.nextInt())

    println(ls.scanLeft(0)((acc, m) => acc + m).takeWhile(m => m <= x).length)
  }

  def printArray[T](arr: Array[T]): Unit = {
    for (i <- 0 until (arr.length - 1)) {
      print(s"${arr(i)} ")
    }

    println(arr(arr.length - 1))
  }
}


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

int cost(const vector<int> a, int d) {
  int c = 0;
  for (auto& A : a) {
    c += (A - d) * (A - d);
  }
  return c;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int& A : a)
    cin >> A;

  int ret = 1e+9;
  for (int d = -100; d <= 100; ++d) {
    ret = min(ret, cost(a, d));
  }
  cout << ret << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<string > vecstr;
int main()
{
  int n, k;
  cin >> n >> k;
  int ans = 1;
  while(n/k > 0 ){
    n /= k;
    ans ++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256