akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC(T, v) static_cast<T>(v)
#define SI(v) SC(int, v.size())
#define SL(v) SC( LL, v.size())
#define RF(e, v) for(auto & e: v)
#define ei else if
#define UR assert(false)

// ---- ----

#define LB(v, x) distance(v.begin(), lower_bound(ALL(v), x))
#define UB(v, x) distance(v.begin(), upper_bound(ALL(v), x))

LL INF = 1e12;

int main() {
	int a, b, q;
	cin >> a >> b >> q;
	vector<LL> s(a + 2), t(b + 2);
	s.front() = -INF;
	t.front() = -INF;
	inc1(i, a) { cin >> s[i]; }
	inc1(i, b) { cin >> t[i]; }
	s.back() = INF;
	t.back() = INF;
	
	inc(i, q) {
		LL x;
		cin >> x;
		
		int pa = LB(s, x);
		int pb = LB(t, x);
		
		LL sl = s[pa - 1];
		LL tl = t[pb - 1];
		LL sr = s[pa];
		LL tr = t[pb];
		
		LL L = min(sl, tl);
		LL l = max(sl, tl);
		LL r = min(sr, tr);
		LL R = max(sr, tr);
		
		LL ans = INF;
		setmin(ans, abs(x - L));
		setmin(ans, abs(x - R));
		
		if((sl <= tl) == (sr <= tr)) {
			setmin(ans, abs(x - l) + abs(l - r));
			setmin(ans, abs(x - r) + abs(r - l));
		} else {
			setmin(ans, abs(x - l) + abs(l - R));
			setmin(ans, abs(x - r) + abs(r - L));
		}
		
		cout << ans << "\n";
	}
	
	return 0;
}


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

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979323846;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define CIN(v) cin >> v;
#define COUT(v) cout << v << "\n";

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

  int H, A;
  CIN(H >> A);
  int c = H / A;
  if (H % A != 0)
    c++;
  COUT(c);

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        sc.nextLine();
        StringBuilder sb = new StringBuilder(sc.nextLine());

        sb.setCharAt(k-1, Character.toLowerCase(sb.charAt(k-1)));
        System.out.println(sb);
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); 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; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    vc<ll> A(5);
    rep(i,3){
        ll a, b;
        cin >> a >> b;
        A[a]++, A[b]++;
    }
    ll cnt = 0;
    repe(i,1,5){
        if (A[i] % 2) cnt++;
        if(A[i]==0){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout<<(cnt<=2?"YES":"NO")<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int d[3] = {-1,0,1};
int main(){
   string s;cin>>s;
   sort(ALL(s));
   char c = 'a';
   int now = 0;
   int n = s.size();
   rep(i,n){
       if(s[i]==c){
           c++;
           now++;
       }
       if(now==26){
           cout<<"None";
           return 0;
       }
   }
   cout<<c;
}



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

int main() 
{
  string S;
  cin >> S;

  for (int i = 0; i < S.size(); i++) 
  {
    if (S.at(i) == 'a') 
    {
        cout << "vowel" << endl;
    }
    else if(S.at(i) == 'i')
    {
        cout << "vowel" << endl;
    }
    else if(S.at(i) == 'u')
    {
        cout << "vowel" << endl;
    }
    else if(S.at(i) == 'e')
    {
        cout << "vowel" << endl;
    }
    else if(S.at(i) == 'o')
    {
        cout << "vowel" << endl;
    }
    else
    {
       cout << "consonant" << endl;
    }
  }  
  return 0;
}

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

int main() {
  int N, X, Y;
  cin >> N >> X >> Y;


  X -= 1;
  Y -= 1;
  int cnt[N];
  for (int i = 0; i < N; i++) cnt[i] = 0;

  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      int dist = j - i;
      dist = min(dist, min(abs(i - X) + abs(j - Y) + 1, abs(j - X) + abs(i - Y) + 1));
      cnt[dist] += 1;
    }
  }

  for (int i = 1; i < N; i++) {
    cout << cnt[i] << endl;
  }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
vector <int> a[100002];
int d[100002]={0};
bool v[100002]={0};
int dfs(int n)
{   int k=0,z=0;
//cout<<n<<v[n]<<endl;
    if(v[n]==1)
    return d[n]+1;
    else
    {   //cout<<n<<v[n]<<endl;
        for(int i=0;i<a[n].size();i++)
        {//cout<<n<<v[n]<<endl;
            if(v[a[n][i]]==1)
            k=d[a[n][i]]+1;
            else
            k=dfs(a[n][i]);
            //cout<<a[n][i]<<endl;
            
            if(z<k)
            z=k;
            //cout<<z<<" "<<n<<" "<<a[n][i]<<endl;
            
        }
        d[n]=z;
        
    }
    v[n]=1;
    //cout<<d[n]<<" "<<n<<endl;
    return z+1;
}
int main()
{
    int n,m;
    cin>>n>>m;
    int c,b;
    
    while(m--)
    {
        cin>>c>>b;
        a[c].push_back(b);
        
        
    }
    int k=0,z=0;
     for(int i=1;i<=n;i++)
        {       //cout<<z<<"+"<<i<<endl;
            if(v[i]==1)
            {
                k=d[i];
                
            }
            else
            {//cout<<i<<endl;
            k=dfs(i);
            k=d[i];
            }if(z<k)
            z=k;
            
            //cout<<"+"<<z<<endl;
        }
       cout<<z<<endl;
    
}

Measured memory_bytes: 8192
import itertools
N=int(input())
S=[list(input()) for _ in range(N)]
d={'M':0,'A':1,'R':2,'C':3,'H':4}
a=[0]*5
l=set('MARCH')
for s in S:
    if s[0] in l:
        a[d[s[0]]]+=1
for i in reversed(range(5)):
    if a[i]==0:
        del a[i]
X=list(itertools.combinations(a,3))
len_x=len(X)
ans=0
def f(ary,i):
    if i==0:
        return ary[i]
    return ary[i]*f(ary,i-1)
for x in X:
    ans+=f(x,2)
print(ans)

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

#define REP(i, N) for(int i = 0; i < N; ++i)
#define FOR(i, M, N) for(int i = M; i < N; ++i)

int main() {
	int N = 0;
	cin >> N;
	float a[110][2];
	float ai = 0;

	REP(i, N) {
		a[i][1] = i;
		cin >> a[i][0];
		ai += a[i][0];
	}
	ai /= (float)N;

	REP(i, N) {
		a[i][0] = abs(a[i][0] - ai);
	}

	REP(i, N) {
		if (a[0][0] > a[i][0])
		{
			a[0][0] = a[i][0];
			a[0][1] = a[i][1];
		}
	}
	cout << a[0][1] << endl;
	system("pause");
	return 0;
}


Measured memory_bytes: 504
#include <stdio.h>

int main(void)
{
  char x;
  
  scanf("%c", &x);
  
  if (x == 'A'){
    printf("T\n");
  }
  else if(x == 'T'){
    printf("A\n");
  }
  else if (x == 'C'){
    printf("G\n");
  }
  else {
    printf("C\n");
  }
  return (0);
}

Measured memory_bytes: 128
#include "bits/stdc++.h"

int main() {

    int N;
    std::cin >> N;
    std::vector<int> d(N);
    for (auto& v : d)std::cin >> v;
    std::sort(begin(d), end(d));
    int ans = d[N / 2] - d[N / 2 - 1];
    std::cout << ans << std::endl;
}

Measured memory_bytes: 640
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb push_back
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
int a[N],k;
void solve(){
  int A;cin>>A;
  string s;int i=A;
    int num=1;
    while(i>0){
        s=(char)(((i-1)%26)+'a')+s;
        i=(i-1)/26;
    }
    cout<<s;
}
int32_t main()
{
  ibs;cti;
  solve()
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  // int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main()
{
    int a[10],b[3],c,d,i,j,s=0;
    for(i=0;i<10;i++)
    {
        cin >> a[i];
    }
    for(d=0;d<3;d++)
    {
    for(j=0;j<10;j++)
    {
        if(a[j]>s)
        {
            s=a[j];
            c=j;
        }
    }
    cout<<s<<endl;
    a[c]=0;
    s=0;
    }
    return 0;
}

Measured memory_bytes: 1160
package main

import (
	"fmt"
	"strconv"
)

func dfs(s string, i int, lasti int, sum int) int {
	if i == len(s)-1 {
		last, _ := strconv.Atoi(s[lasti:len(s)])
		return sum + last
	}

	n, _ := strconv.Atoi(s[lasti : i+1])
	sum1 := dfs(s, i+1, lasti, sum)
	sum2 := dfs(s, i+1, i+1, sum+n)

	return sum1 + sum2
}

func main() {
	var s string
	fmt.Scan(&s)

	sum := dfs(s, 0, 0, 0)
	fmt.Println(sum)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long
#define mod 1000000007

void solve() {
        int x, y; cin >> x>> y;
        for (int j = 0; j<= x; j++) {
                        if ((j * 4 + (x- j) * 2) == y) {
                                cout << "Yes\n";
                                return;
                        }
        }
        cout << "No\n";

}

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int t = 1;
        //cin >> t;
        lp(i, t) {
                solve();
        }
return 0;
}


Measured memory_bytes: 3636
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 1e5 + 5;
int main()
{
    abdelrahman010
    string s;
    cin >> s;
    bool f1 = false , f2 = false;
    for(auto &i : s)
    {
        f1 |= (i == 'A');
        f2 |= (i == 'B');
    }
    if(f1 && f2)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}

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


int check_balls(std::vector<int> &ball, int ind, int N){
    int cnt = 0;
    for(int i=2; i*ind < N+1; i++){
        cnt += ball.at(i*ind);
    }
    return cnt;
}

int main(){
    int N;

    cin >> N;
    std::vector<int> seq(N+1,0);
    for(int i=1; i < N + 1; i++){
        cin >> seq.at(i);
    }
    std::vector<int> ball(N+1, 0);
    int balls;
    for(int i=0; i < N; i++){
        balls = check_balls(ball, N-i, N);
        // cout << N-i << "の上: " << balls << endl;
        // cout << N-i << "のラベル: " << seq.at(N-i) << endl;
        ball.at(N-i) = (seq.at(N-i) + balls)%2;
        // cout << N-i << "自身: " << (seq.at(N-i) + balls)%2 << endl;
    }
    int sum_balls = std::accumulate(ball.begin(), ball.end(), 0);
    cout << sum_balls << endl;
    for(int i=1; i < N + 1; i++){
        if(ball.at(i)==1){
            cout << i << endl;
        }

    }
    return 0;


}


Measured memory_bytes: 2432
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

struct UnionFind
{
  vector<int> par;
  vector<int> sz;

  UnionFind(int n)
  {
    init(n);
  }

  void init(int n)
  {
    par.resize(n);
    sz.resize(n);
    REP(i, n)
    {
      par[i] = i;
      sz[i] = 1;
    }
  }

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

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

  bool same(int x, int y)
  {
    return find(x) == find(y);
  }
};

int main()
{
  int N, M;
  cin >> N >> M;
  vector<int> X(M), Y(M), Z(M);
  REP(i, M)
  {
    cin >> X[i] >> Y[i] >> Z[i];
    X[i]--, Y[i]--;
  }
  UnionFind uf(N);
  REP(i, M)
  uf.unite(X[i], Y[i]);
  set<int> st;
  REP(i, N)
  st.insert(uf.find(i));
  cout << st.size() << endl;
  return 0;
}

Measured memory_bytes: 6912
n = int(input())
p = list(map(int, input().split()))
p_good = [i for i in range(1, n+1)]
cnt = 0
for i in range(n):
    if p[i] != p_good[i]:
        cnt += 1
if cnt == 0 or cnt == 2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
using namespace std;

int main(){
    int A,B;
    cin >> A >> B;
    int ans;
    if(A > 9 || B > 9){
        ans = -1;
    }
    else{
        ans = A*B;
    }
    cout << ans << endl;
}


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

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

	string ans = "APPROVED";
	for (int i = 0; i < n; i++) {
		if (a[i] % 2 == 0) {
			if (a[i] % 3 != 0 && a[i] % 5 != 0) {
				ans = "DENIED";
			}
		}
	}
	cout << ans << endl;
	return 0;
}
  

Measured memory_bytes: 256
#include <iostream> 
#include <sstream> 
#include <iomanip> 
#include <algorithm> 
#include <cmath> 
#include <string> 
#include <vector> 
#include <list> 
#include <queue> 
#include <stack> 
#include <set> 
#include <map> 
#include <bitset> 
#include <numeric> 
#include <climits> 
#include <cfloat> 
using namespace std; 

class Point
{
public:
    int y, x;
    Point(){
        y = x = 0;
    }
    Point(int y0, int x0){
        y = y0;
        x = x0;
    }
    Point operator+(const Point& p) const{
        return Point(y + p.y, x + p.x);
    }
    Point operator-(const Point& p) const{
        return Point(y - p.y, x - p.x);
    }
    Point operator*(int a) const{
        return Point(y * a, x * a);
    }
    double length2() const{
        return y * y + x * x;
    }
    double dist2(const Point& p) const{
        return (y - p.y) * (y - p.y) + (x - p.x) * (x - p.x);
    }
    int dot(const Point& p) const{
        return y * p.y + x * p.x; // |a|*|b|*cosÆ
    }
    int cross(const Point& p) const{
        return x * p.y - y * p.x; // |a|*|b|*sinÆ
    }
};

int segmentCircleCollide(const Point& a1, const Point& a2, const Point& c, int r)
{
    int num = 0;
    if(a1.dist2(c) < r * r)
        ++ num;
    if(a2.dist2(c) < r * r)
        ++ num;
    if(num == 2)
        return -1;
    if(num == 1)
        return 1;
    if((a2 - a1).dot(c - a1) > 0 && (a1 - a2).dot(c - a2) > 0){
        int s = (a2 - a1).cross(c - a1);
        int t = r * r * (a2 - a1).length2();
        if(s * s == t)
            return 1;
        if(s * s < t)
            return 2;
    }
    return 0;
}

bool convexContain(const vector<Point>& cp, const Point& p)
{
    int n = cp.size();
    bool ret1 = true;
    bool ret2 = true;
    for(int i=0; i<n; ++i){
        int a = (cp[(i+1)%n] - cp[i]).cross(p - cp[i]);
        if(a < 0)
            ret1 = false;
        if(a > 0)
            ret2 = false;
    }
    return ret1 || ret2;
}

int main()
{
    for(;;){
        vector<Point> p(3);
        for(int i=0; i<3; ++i){
            cin >> p[i].x >> p[i].y;
            if(p[i].x == 0)
                return 0;
        }

        Point c;
        int r;
        cin >> c.x >> c.y >> r;

        char ret = 'd';
        int num = 0;
        for(int i=0; i<3; ++i){
            if(p[i].dist2(c) <= r * r)
                ++ num;
        }
        if(num == 3)
            ret = 'b';
        else if(num > 0)
            ret = 'c';

        if(ret == 'd'){
            if(convexContain(p, c))
                ret = 'a';
            for(int i=0; i<3; ++i){
                int tmp = segmentCircleCollide(p[i], p[(i+1)%3], c, r);
                if(ret == 'd' && tmp > 0)
                    ret = 'c';
                if(ret == 'a' && tmp == 2)
                    ret = 'c';
            }
        }

        cout << ret << endl;
    }
}

Measured memory_bytes: 0
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


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


    int N; cin >> N;
    vl A(N); REP(i, N) cin >> A[i];

    ll ans = LINF;
    vl a(N, 0);
    vl s(N, 0);

    // +-+-
    REP(i, N) a[i] = A[i];
    ll cnt = 0;
    s[0] = a[0];
    if (s[0] <= 0) {
        ll dif = abs(s[0]) + 1;
        cnt += dif;
        a[0] += dif;
        s[0] = 1;
    }    
    FOR(i, 1, N) {
        s[i] = s[i-1] + A[i];

        if (i % 2 == 1 && s[i] >= 0) {
            ll dif = abs(s[i]) + 1;
            cnt += dif;
            a[i] -= dif;
            s[i] = -1;
        }
        else if (i % 2 == 0 && s[i] <= 0) {
            ll dif = abs(s[i]) + 1;
            cnt += dif;
            a[i] += dif;
            s[i] = 1;
        }
    }
    ans = min(ans, cnt);

    // -+-+
    REP(i, N) a[i] = A[i];
    cnt = 0;
    s[0] = A[0];
    if (s[0] >= 0) {
        ll dif = abs(s[0]) + 1;
        cnt += dif;
        a[0] -= dif;
        s[0] = -1;
    }    
    FOR(i, 1, N) {
        s[i] = s[i-1] + A[i];

        if (i % 2 == 1 && s[i] <= 0) {
            ll dif = abs(s[i]) + 1;
            cnt += dif;
            a[i] += dif;
            s[i] = 1;
        }
        else if (i % 2 == 0 && s[i] >= 0) {
            ll dif = abs(s[i]) + 1;
            cnt += dif;
            a[i] -= dif;
            s[i] = -1;
        }
    }
    ans = min(ans, cnt);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
    for (T& x: vec) { is >> x; }
    return is;
}

int main() {
	ll ans = 0;
	ll tmp;
	int n; cin >> n;
	vector<int> a(n);
	cin >> a;
	int ma = 0, mi = 9999999;
	REP(i, n){
		ma = max(ma, a[i]);
		mi = min(mi, a[i]);
	}
	bool ch;
	if(ma - mi >= 2) ch = false;
	else if(ma - mi == 1){
		int nma = 0, nmi = 0;
		REP(i, n){
			if(a[i] == ma) nma++;
			else nmi++;
		}
		if(nmi + 1 <= ma && ma <= nma / 2 + nmi) ch = true;
		else ch = false;
	}
	else {
		if(n / 2 >= ma || ma == n-1) ch = true;
		else false;
	}
	if (ch) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	//cout << ans << endl;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
int main(){
 int n,ans=0;
  string s;
  cin>>n>>s;
  rep(i,n-2){
   if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
 
ll n,k,x,y;
 
int main(){
  ll ans=0;
  cin >> n ;
  vi a(n+1),b(n+1),c(n+1),d(n+1);
  REP(i,n+1) cin>>a[i];



  if (n==0){
    if (a[0]==1){
      cout<<1<<endl;
      return 0;
    }else{
      cout<<-1<<endl;
      return 0;
    }
  }
  


  if (a[0]!=0){
    cout<<-1<<endl;
    return 0;
  }

 
 


  ll nown=1;
  b[0]=1;
  c[0]=1;
  for(ll i=1;i<n+1;i++){
    nown=min(nown,llMAX/2)*2;
    b[i]=nown;
    nown-=a[i];
    c[i]=nown;
    if (nown<0){
      cout<<-1<<endl;
      return 0;
    }
  }

  
  d[n]=a[n];
  for(ll i=n-1;i>=0;i--){
    d[i]=d[i+1]+a[i];
  }

  for(ll i=n;i>=0;i--){
    if (b[i]<=d[i]){
      //この時点のnownとしたから数えたやつを比較
      i++;
      if (i==n+1)break;
      b[i]=d[i];
      c[i]=d[i]-a[i];
      for(ll j=i+1;j<n+1;j++){
        b[j]=d[j];
      }
      break;
      
    }
  }
  

 
  
 
 
 
  int flag=0;
  for(ll i=0;i<n+1;i++){
    ans+=b[i];
    flag+=(b[i]<=0);
    //flag+=(c[i]<0);
  }
  if (flag!=0){
    cout<<-1<<endl;
    return 0;
  }
 
 
 
  cout<<ans<<endl;
  return 0;
}
 
/*
10
0 0 1 1 2 3 5 8 28 21 34
*/

Measured memory_bytes: 6424
'use strict'

const main = (input) => {
  const args = input.split('\n');
  args.shift()
  const lines = args.map((s)=>{
    return s.split('').sort().join('')
  })
  lines.sort()
  let count = 0
  let temp = {}
  lines.forEach((s) => {
    if(temp[s]) {
      temp[s] += 1
    } else {
      temp[s] = 1
    }
  })

  Object.keys(temp).forEach((i) => {
    count += temp[i]*(temp[i]-1)/2
  })

  console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 61968
#include <stdio.h>

int isprime(int n) {
	int i;
	for(i = 2; i * i <= n; i++) {
		if(n % i == 0) {
			return 0;
		}
	}
	return 1;
}

int main() {
	int n,i;
	int sousi[2];
	int prime[10100][2];
	for (i = 0; i < 10100; i++) {
		prime[i][0] = i;
		prime[i][1] = isprime(i);
	}
	while(1) {
		sousi[0] = 0;
		sousi[1] = 0;	 
		scanf("%d",&n);
		if(n == 0) {
			break;
		}
		for(i = n; i > 2; i--) {
			if(prime[i][1] == 1 && prime[i - 2][1] == 1) {
				sousi[0] = prime[i - 2][0];
				sousi[1] = prime[i][0];
				break;
			}
		}
		printf("%d %d\n",sousi[0],sousi[1]);
	}
	return 0;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  
  vector<vector<char>> board(h, vector<char> (w));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++)
      cin >> board.at(i).at(j);
  }
  
  bool flag;
  for (int i = 0; i < h; i++) {
    flag = true;
    for (int j = 0; j < w; j++) {
      if (board.at(i).at(j) == '#')
        flag = false;
    }
    if (flag) {
      for (int j = 0; j < w; j++) {
        board.at(i).at(j) = ' ';
      }
    }
  }
  
  for (int i = 0; i < w; i++) {
    flag = true;
    for (int j = 0; j < h; j++) {
      if (board.at(j).at(i) == '#')
        flag = false;
    }
    if (flag) {
      for (int j = 0; j < h; j++)
        board.at(j).at(i) = ' ';
    }
  }
  
  for (int i = 0; i < h; i++) {
    flag = false;
    for (int j = 0; j < w; j++) {
      if (board.at(i).at(j) != ' ') {
        cout << board.at(i).at(j);
        flag = true;
      }
    }
    if (flag)
      cout << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 1000
#define N 10000

int n,s;
int a[MAX],b[MAX],T[N+1];
int partition(int a[],int p,int r);
void quickSort(int a[], int p, int r);
int partition(int a[], int p, int r);
int solve();

int main(){
  int i;
  int result;
  scanf("%d",&n);
  s = N;
  for(i = 0 ; i<n; i++){
    scanf("%d",&a[i]);
    if(a[i] < s){
      s = a[i];
    }
  }
    result = solve();
    printf("%d\n",result);
    return 0;
  }

int partition(int a[], int p, int r){
  int i, j,t,k;
  k = a[r];
  i = p-1;
  for(j = p ;j< r; j++ ){
    if(a[j] <= k){
      i++;
      t = a[i];
      a[i] = a[j];
      a[j] = t;
    }
  }
  t = a[i + 1];
  a[i + 1] = a[r];
  a[r] = t;
  return i + 1;
}

void quickSort(int a[], int p, int r){
  int q;
  if(p < r){
    q = partition(a, p, r);
    quickSort(a, p,q-1);
    quickSort(a, q + 1, r);
  }
}

int solve(){
  int i, cur;
  int S,v,m,a1;
  int result = 0;
  int V[MAX];
  for(i = 0 ; i< n; i++){
    b[i] = a[i];
    V[i] = 0;
	 }
  quickSort(b,0,n-1);

  for(i = 0; i<n; i++){
    T[b[i]] = i;
  }
  for(i = 0; i<n;i++){
    if(V[i]) continue;
    cur = i;
    S = 0;
    m = N;
    a1= 0;
    while(1){
      V[cur] = 1;
      a1++;
      v = a[cur];
      if(v < m) {
	m = v;
	  }
      S += v;
    cur = T[v];
    if(V[cur]) break;
  }

  if(S + (a1 -2)*m<m + S + (a1 +1) *s) {
    result += S + (a1 -2) * m;
  }
  
  else{
    result += m + S + (a1 +1) *s;
  }
  }
  return result;
}





Measured memory_bytes: 2096
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;
using namespace std;

#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl

ll n, cnt, ans, a, b, c, d, tmp, tmpp, m, h, w, x, y, sum, pos, k;
ld doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge
{
    int to, cost;
};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin >> n >> s;
    map<string, ll> mp;
    string first = "", second = "";
    rep(i, n) first += s[i];
    rrep(i, n, 2 * n) second += s[i];
    for (int bit = 0; bit < (1 << (n)); bit++)
    {
        string red = "", blue = "";
        rep(i, n)
        {
            if (bit & (1 << i))
            {
                red += first[i];
            }
            else
            {
                blue += first[i];
            }
        }
        string match = red + '.' + blue;
        mp[match]++;
    }
    for (int bit = 0; bit < (1 << (n)); bit++)
    {
        string red = "", blue = "";
        rep(i, n)
        {
            if (bit & (1 << i))
            {
                red += second[i];
            }
            else
            {
                blue += second[i];
            }
        }
        reverse(all(red));
        reverse(all(blue));
        string match = blue + '.' + red;
        ans += mp[match];
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 67968
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <functional>
#include <utility>
#include <fstream>

using namespace std;

#define ll long long
#define INF 2000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define dum(x) cout<<#x<<'='<<x<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl;


int a[100010];
int am[100010];
int ap[100010];
int bc[100010];

int main() {
    int N;
    cin >> N;
    rep(i, N) {
        cin >> a[i];
        am[i] = a[i] - 1;
        ap[i] = a[i] + 1;
        bc[a[i]]++;
        bc[am[i]]++;
        bc[ap[i]]++;
    }
    int ans = *max_element(bc, bc + 100010);
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
#include<complex>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)

int main() {

	int n;
	cin >> n;

	double ans = 0;

	if (n % 2 == 0) ans = n / 2;
	else ans = n / 2 + 1;

	ans /= n;

	cout << fixed << setprecision(10) << ans << endl;

	return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    string S;
    cin >> S;
    S[3] = '8';
    cout << S << endl;
    return 0;
}


Measured memory_bytes: 256
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
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; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
const long long MOD = 1000000007;

int main(void){
    ll a;
    ll b;
    ll c;
    cin >> a >> b >> c;
    ll left = 4*a*b;
    ll right = ( c-(a+b) ) * (c-(a+b) );
    if( ((c-(a+b))>0) && left < right){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;

int main() {
  long n,a[300000], num[300000];
  cin >> n;
  for(int i = 0; i < 300000; i++)
    num[i] = 0;
  
  for(int i = 1; i < n; i++) {
    cin >> a[i];
    num[a[i]-1]++;
  }
  
  for(int i = 0; i < n; i++)
    cout << num[i] << endl;
  
  return 0;
}

Measured memory_bytes: 7536
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int cnt1 = 0;
        int cnt2 = 0;
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == 'R') {
                cnt1++;
            } else if (s.charAt(i) == 'B') {
                cnt2++;
            }
        }
        if (cnt1 > cnt2) {
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }
}


Measured memory_bytes: 23124
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll MOD=(ll)998244353;
//}}}

int main(){
  int x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> x1 >> y1 >> x2 >> y2;
  int x = x2 - x1;
  int y = y2 - y1;
  x3 = x2 - y;
  y3 = y2 + x;
  x4 = x3 - x;
  y4 = y3 - y;

  printf("%d %d %d %d\n", x3, y3, x4, y4);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ls x<<1
#define rs x<<1|1
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-6;
const ull hashp=1e7+19;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=1e5+100;
struct node{
	int l,r;
	bool operator < (const node&z)const {return l<z.l;}
}arr[maxn];
int cmp1(node a,node b){
	if(a.l!=b.l)return a.l<b.l;
	return a.r<b.r;
}
int cmp2(node a,node b){
	if(a.l!=b.l)return a.l<b.l;
	return a.r>b.r;
}
int suml[maxn],sumr[maxn],ans;
void work(int sta,int n){
	if(sta)sort(arr+1,arr+n+1,cmp1);
	else sort(arr+1,arr+n+1,cmp2);
	int mn=inf;
	for(int i=1;i<=n;i++){
		mn=min(mn,arr[i].r);
		suml[i]=mn;
	}
	mn=inf;
	for(int i=n;i;i--){
		mn=min(mn,arr[i].r);
		sumr[i]=mn;
	}
	rep1(i,n){
		ans=max(ans,max(0,suml[i]-arr[i].l+1)+max(0,sumr[i+1]-arr[n].l+1));
	}
}
void solve()
{
	int n;scd(n);
	rep1(i,n){
		scdd(arr[i].l,arr[i].r);
	}
	work(0,n);
	work(1,n);
	int mx=0,mark;
	rep1(i,n){
		if(mx<arr[i].l){
			mx=arr[i].l;
			mark=i;
		}
	} 
	int mn=inf;
	int markr=-1;
	rep1(i,n){
		if(i==mark)continue;
		if(mn>arr[i].r){
			mn=arr[i].r;
			markr=i;
		}
	}
	if(mn>arr[mark].r){
		mn=arr[mark].r;
		markr=mark;
	}
	int dis=0;
	rep1(i,n){
		if(i==mark||i==markr)continue;
		dis=max(dis,arr[i].r-arr[i].l+1);
	}
	ans=max(ans,dis+max(0,mn-mx+1));
	ac;
}
int main(){
    //IOS;
    solve();
    return 0;
}


Measured memory_bytes: 1792
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


print(180*(I()-2))


Measured memory_bytes: 61936
#include<iostream>
#include<vector>
#include<queue>

std::vector<int> to[100005];
const int INF = 1001001001;

int main() {
	int N, M;
	std::cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int A, B;
		std::cin >> A >> B;
		A--;
		B--;
		to[A].push_back(B);
		to[B].push_back(A);
	}

	std::queue<int> q;
	std::vector<int> dist(N, INF);
	std::vector<int> pre(N);

	q.push(0);
	dist[0] = 0;
	while (!q.empty()) {
		int v = q.front();
		q.pop();
		for (int u : to[v]) {
			if (dist[u] != INF) continue;
			q.push(u);
			dist[u] = dist[v] + 1;
			pre[u] = v;
		}
	}

	std::cout << "Yes" << std::endl;
	for (int i = 1; i < N; i++) {
		int ans = pre[i] + 1;
		std::cout << ans << std::endl;
	}

	return 0;
}

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

using namespace std;

#define ll unsigned long long
#define endl "\n"
#define MOD 1000000007

vector <ll> ad[200006];
vector <ll> vis(200006,0);

ll ans=0, n, m;

void addedge(ll x, ll y){
  ad[x].push_back(y);
  ad[y].push_back(x);
}

ll dfs(ll node){
  vis[node]=1;
  ++ans;
  for(ll x:ad[node]){
    if(!vis[x]){
      dfs(x);
    }
  }
  return ans;
}

void solve(){
  cin >> n >> m;
  for(ll i=0;i<m;i++){
    ll x,y;
    cin >> x >> y;
    addedge(x,y);
  }
  ll k=0;
  for(ll i=1;i<=n;i++){
    ans=0;
    if(!vis[i])
      k=max(k, dfs(i));      
  }
  cout << k << endl;
}  

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


Measured memory_bytes: 21916
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	_, g, b := nextInt(), nextInt(), nextInt()
	if (g*10+b)%4 == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 640
import math
while True:
    n = int(input())
    if n == 0:
        break
    dset = list(map(int, input().split()))
    mean = sum(dset)/len(dset)
    sigma = math.sqrt(sum([(x-mean)**2 for x in dset])/len(dset))
    print('%.06f' % sigma)

Measured memory_bytes: 7804
a = int(input())
b = {}
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = ''.join(sorted(list(input())))
    if strings not in b.keys():
      check = False
      b[strings] = 1
    if check == True:
      ans += b[strings]
      b[strings] += 1

print(ans)

Measured memory_bytes: 17932
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,A[100001],B[100001];
	int Amax=-1,Bmax;
	scan(N);
	rep(i,N){
		scan(A[i]);scan(B[i]);
		if(A[i]>Amax){
			Amax=A[i];
			Bmax=B[i];
		}
	}
	prin(Amax+Bmax);

	return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

struct Hashing {
    ull seed, mod;
    vector <ull> hs, pw;

    Hashing(ull seed = 31, ull mod = 1000173169) :
        seed(seed),
        mod(mod) {}

    void build(int n, const string& s) {
        hs.assign(n + 1, 0);
        pw.assign(n + 1, 1);
        pw[0] = 1;

        for (int i = 1; i <= n; ++i)
            pw[i] = pw[i - 1] * seed % mod;
        for (int i = 1; i <= n; ++i)
            hs[i] = (hs[i - 1] * seed + s[i]) % mod;
    }

    ull hash(int l, int r) {
        return (hs[r] - hs[l - 1] * pw[r - l + 1] % mod + mod) % mod;
    }
};

int solve()
{
    string s, t;
    std::cin >> s >> t;
    int a, b;
    std::cin >> a >> b;
    string u;
    std::cin >> u;

    if (u == s)
        cout << (a - 1) << " " << b << endl;
    else
        cout << a << " " << (b - 1) << endl;

    return 0;
}

int main()
{
    solve();

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
int main()
{
    ll n,i,j,a,b,c,k,v[200005];
    cin>>n>>k;
    for(i=1;i<=n;i++)cin>>v[i];
    b=1;
    for(i=1;i<=k;i++)b*=v[i];
    for(i=k+1;i<=n;i++)
    {
        if(v[i-k]>=v[i])cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
    return 0;
}


Measured memory_bytes: 5160
n = int(input())
s = input()
left_l = [0]
right_l = [0]
lcnt = 0
for i in range(1, n):
    if s[i - 1] == "W":
        lcnt += 1
    else:
        pass
    left_l.append(lcnt)
rcnt = 0
for j in range(1,n):
    if s[-j] == "E":
        rcnt += 1
    else:
        pass
    right_l.append(rcnt)
right_l.reverse()
minVal = n
for k in range(n):
    if left_l[k] + right_l[k] <= minVal:
        minVal = left_l[k] + right_l[k]
    else:
        continue
print(minVal)

Measured memory_bytes: 18080
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define rusha scanf("%d",&n);rep(i,1,n)scanf("%d",&a[i]);
#define rushb scanf("%d",&t);while(t--)
#define debug(x) cout<<" L-B-W-- "<<x<<" --N-B\n"
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vii vector<int>
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof a)
#define all(x) (x.begin(),x.end())
#define judgef printf("%s\n",f?"Yes":"No")
#define Judgef printf("%s\n",f?"YES":"NO")
#define sz(x) ((int)(x).size())
#define sf(x) (sizeof(x))
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
using namespace std;
typedef long long ll;
typedef double db;
const double pai = acos(-1.0);
const double eps = 1e-8;
//const int mod=998244353;
const int mod=1e9+7;
const int inf=1e9+7;
//const ll inf=0x7f7f7f7f1234abcd;
const int maxn=1e5+10;
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
inline ll ksm(ll x,ll y){ll res=1;while(y){if(y&1)res=res*x%mod;x=x*x%mod;y>>=1;}return res;}
inline ll inv(ll a,ll p){if(a==1)return 1;return (p-p/a)*inv(p%a,p)%p;}
inline ll lcm(ll a,ll b){return a * b / __gcd(a, b);}
int t,n,m,k;
//ll a[maxn];
inline __int128 read()
{
    __int128 x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}

inline void write(__int128 x)
{
    if(x<0)
    {
        putchar('-');
        x=-x;
    }
    if(x>9)
        write(x/10);
    putchar(x%10+'0');
}

int main()
{
    ll s;
    long double x;
    cin>>s>>x;
    __int128 p=s*x;
    write(p);
    return 0;
}


Measured memory_bytes: 3768