akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ld long double
#define mx 200005
#define fr first
#define se second
#define End cout<<"\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

int main()
{
   fast;
   int a,b,c;
   cin >> a >> b >> c;
   if(a+b+c>=22) cout << "bust\n";
   else cout << "win\n";


   return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  ProCon
//
//  Created by hashimotoryoma on 2017/08/20.
//  Copyright © 2017年 hashimotoryoma. All rights reserved.
//

#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <vector>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))

using namespace std;

typedef long long ll;

int group(int n){
    if(n==2)
        return 2;
    else if(n==4 || n==6 || n==9 || n==11)
        return 1;
    else
        return 0;

}

int main() {
    // insert code here...    return 0;
    //////
    // input from txt
    /*
     std::ifstream in("input.txt");
     std::cin.rdbuf(in.rdbuf());
     std::ofstream out("output.txt");
     std::cout.rdbuf(out.rdbuf());
     ////
     */
    int a,b,c;
    cin >> a >> b >> c;
    int A=b+c,B=c+a,C=a+b;
    cout << min(A,min(B,C))<<endl;
    return 0;
}


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

bool dfs(int v,vector<vector<int>> &chil,vector<int> &x,vector<int> &dp){
    bool res=true;
    for(int i=0;i<chil[v].size();i++){
        res&=dfs(chil[v][i],chil,x,dp);
    }
    int sum=0;
    vector<int> dp2(5001,0);
    dp2[0]=true;
    for(int i=0;i<chil[v].size();i++){
        int mi=dp[chil[v][i]];
        int xval=x[chil[v][i]];
        sum+=mi+xval;
        vector<int> nextdp2(5001,0);
        for(int j=0;j<=5000;j++){
            if(j-mi>=0) nextdp2[j]|=dp2[j-mi];
            if(j-xval>=0) nextdp2[j]|=dp2[j-xval];
        }
        dp2=nextdp2;
    }
    
    int best=-1;
    for(int i=0;i<=x[v];i++){
        if(dp2[i]) best=i;        
    }
    if(best==-1) return false;
    dp[v]=sum-best;
    return res;
}

int main(){
    int n;
    cin>>n;
    vector<vector<int>> chil(n);
    for(int i=1;i<n;i++){
        int p;
        cin>>p;
        p--;
        chil[p].push_back(i);
    }

    vector<int> x(n);
    vector<int> dp(n);
    for(int i=0;i<n;i++) cin>>x[i];

    bool ispos=dfs(0,chil,x,dp);
    cout<<(ispos?"POSSIBLE":"IMPOSSIBLE")<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, i;

signed main() {
	cin >> n >> i;
	cout << n-i+1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define Vecpr vector<pair<lli,lli>>
int main() {
  lli A,B,C,D;
  string a,b,c;
  cin >>a;
  if(a[0]==a[2])Out("Yes");
  else Out("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//切り上げの割り算は(a + b - 1) / bでできる
//時間を意識しろ
//コードテストちゃんとして
//画面とにらめっこするな書け
//WA出すたびにABCは五億円払え
//わからない問題はとばせ
//躊躇なくぐぐれ

//ここから
int main(){
    string S;
    cin>>S;
    ll N=S.size();
    ll A=0;
    ll Ans=0;
    rep(i,N-1){
        if(S.at(i)=='A'){
            A++;
        }else if(S.at(i)=='B'&&S.at(i+1)=='C'){
            i++;
            Ans+=A;
        }else{
            A=0;
        }
    }
    cout<<Ans<<endl;
}



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

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

int main(){
    
    while(1){

        int t, n; cin >> t >> n;
        if(!t) break;

        bool field[200][200];
        memset(field, true, sizeof(field));

        for(int i = 0; i < n; i++){
            int x, y; cin >> x >> y;
            x += 100;
            y += 100;
            field[x][y] = false;
        }

        int x, y; cin >> x >> y;
        x += 100;
        y += 100;


        //幅優先
        queue<pair<int, pair<int, int> > > q;      //turn, {x, y}
        field[x][y] = false;
        q.push({0, {x, y}});

        int ans = 1;
        while(!q.empty()){

            int x = q.front().second.first;
            int y = q.front().second.second;
            int turn = q.front().first;
            q.pop();
            if(turn == t) continue;
        
            for(int h = 0; h < 6; h++){
                int nx = x + dx[h];
                int ny = y + dy[h];

                if(field[nx][ny]){
                    field[nx][ny] = false;
                    q.push({turn + 1, {nx, ny}});
                    ans++;
                }
            }
        }

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



Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);
    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

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

    long double l; cin >> l;
    cout << fixed << setprecision(10) << l*l*l / 27.0 << endl;
    

    return 0;
}

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

int main()
{
    int n,t=0,x=0,y=0,f=0;
    cin>>n;
    for(int i=0,tt,tx,ty;i<n;i++)
    {
        cin>>tt>>tx>>ty;
        if((abs(tx-x)+abs(ty-y))%2!=(tt-t)%2||abs(tx-x)+abs(ty-y)>(tt-t))
            f=1;
        t=tt,x=tx,y=ty;
    }
    if(!f)cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

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


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


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

    ll s;
    cin >> s;
    if(s < 1200) cout << "ABC";
    else if(s < 2800) cout << "ARC";
    else cout << "AGC";
    cout << endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;

class Dice {
    public:
        int D[6];

        void constractor(int d1, int d2, int d3, int d4, int d5, int d6);
        void Rotate_E();
        void Rotate_N();
        void Rotate_S();
        void Rotate_W();

};

void Dice::constractor (int d1, int d2, int d3, int d4, int d5, int d6) {
    D[0] = d1;
    D[1] = d2;
    D[2] = d3;
    D[3] = d4;
    D[4] = d5;
    D[5] = d6;
}

void Dice::Rotate_E () {
    int tmp;

    tmp = D[2];
    D[2] = D[0];
    D[0] = D[3];
    D[3] = D[5];
    D[5] = tmp;
}

void Dice::Rotate_N () {
    int tmp;

    tmp = D[4];
    D[4] = D[0];
    D[0] = D[1];
    D[1] = D[5];
    D[5] = tmp;
}

void Dice::Rotate_S () {
    int tmp;

    tmp = D[4];
    D[4] = D[5];
    D[5] = D[1];
    D[1] = D[0];
    D[0] = tmp;
}

void Dice::Rotate_W () {
    int tmp;

    tmp = D[2];
    D[2] = D[5];
    D[5] = D[3];
    D[3] = D[0];
    D[0] = tmp;
}

bool Dice_Compare (Dice dice0, Dice dice1) {

    for (int X = 0; X < 6; X++) {

        Dice dice[2];
        dice[0] = dice0;
        dice[1] = dice1;

        if (X == 0) {

            dice[1].Rotate_S();
        
        } else if (X == 1) {

        } else if (X == 2) {

            dice[1].Rotate_W();
            dice[1].Rotate_S();

        } else if (X == 3) {

            dice[1].Rotate_E();
            dice[1].Rotate_S();

        } else if (X == 4) {

            dice[1].Rotate_S();
            dice[1].Rotate_S();

        } else {

            dice[1].Rotate_N();

        }

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

            dice[1].Rotate_E();

            for (int i = 0; i < 6; i++) {
                if (dice[0].D[i] != dice[1].D[i]) {
                    // cout << "X: " << X << " i: " << i << endl;
                    break;
                }

                if (i == 5) {
                    // cout << "X: " << X << endl;
                    return true;
                }
            }
        }

    }

    return false;

}

int main () {

    Dice dice[100];

    int n;
    cin >> n;

    for (int i = 0; i < n; i++) {
        
        int d1, d2, d3, d4, d5, d6;

        cin >> d1 >> d2 >> d3 >> d4 >> d5 >> d6;
        dice[i].constractor(d1, d2, d3, d4, d5, d6);

    }

    bool X = false;

    for (int i = 0; i < n - 1; i++) {

        bool answer = false;

        for (int j = i + 1; j < n; j++) {
            answer = Dice_Compare(dice[i], dice[j]);

            if (answer) {
                X = true;
                break;
            }
        }
        if (answer) {
            break;
        }
    }

    if (X) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 3120
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int n=sc.nextInt(),sum=0,f=0;
    int[] a=new int[n],b=new int[n],c=new int[n];
    for(int i=0;i<n;i++){
      a[i]=sc.nextInt();
      if(a[i]%2==0){
        f++;
      }
    }
    sum=(int)Math.pow(3,n)-(int)Math.pow(2,f);
    System.out.print(sum);
  }
}


Measured memory_bytes: 21844
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

int main(int argc, char const *argv[]){
    int N,K;
    cin >> N >> K;
    int x[N];
    for(int i=0;i<N;i++){
        cin >> x[i];
    }
    int ans = 0;
    for(int i=0;i<N;i++){
        if (x[i] > K-x[i]){
           ans = ans + 2*(K-x[i]);
        }
        else{
            ans = ans + 2*x[i];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import defaultdict
ans = defaultdict(int)
N = int(input())

for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            ans[i*i+j*j+k*k+i*j+j*k+k*i] += 1
for i in range(N):
    print(ans[i+1])


Measured memory_bytes: 11640
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn input_u64_vec() -> Vec<u64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn main() {
    let n: i32 = input();
    let a_vec = input_u64_vec();

    let mut max = 0;
    let mut min = 10000000000u64;
    for a in a_vec {
        if a > max {
            max = a;
        }
        if a < min {
            min = a;
        }
    }
    println!("{}", max - min);

}


Measured memory_bytes: 4352
N = int(input())
if N % 2 == 0:
    print(N // 2, N, N)
    quit()
for h in range(1, 3500+1):
    hN = h * N
    for n in range(h, 3500+1):
        b = (4 * h * n - n * N - hN)
        if b <= 0:
            continue
        a = (n * hN)
        if a % b == 0:
            print(h, n, a // b)
            quit()


Measured memory_bytes: 3060
# Problem: https://atcoder.jp/contests/abc087/tasks/abc087_b
# Python 3rd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
int1 = lambda x: int(x) - 1
intp1 = 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 MI1(): return map(int1, 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 solver(yen500, yen100, yen050, objectSum):
    result = 0
    # algorithm
    for yen500v in range(0, intp1(yen500)):
        for yen100v in range(0, intp1(yen100)):
            for yen050v in range(0, intp1(yen050)):
                nowtotal = yen500v*500+yen100v*100+yen050v*50
                if nowtotal == objectSum:
                    result = intp1(result)
    return result


if __name__ == "__main__":
    A = II()
    B = II()
    C = II()
    X = II()
    print("{}".format(solver(A, B, C, X)))


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
    int P, Q, R;
    cin >> P >> Q >> R;
    vector<int> times = {P + Q, Q+ R, P + R};
    cout << *min_element(times.begin(), times.end());
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  ll b=mod, u=1, v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a, b);
    u-=t*v; swap(u, v);
  }
  u%=mod;
  if(u<0)u+=mod;
  return u;
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}
/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll K;
  cin >> K;
  rep(i, K)cout << "ACL";
  return 0;
}


Measured memory_bytes: 3548
package main

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

type UnionFind struct {
	par []int
}

func newUnionFind(N int) *UnionFind {
	u := new(UnionFind)
	u.par = make([]int, N)
	for i := range u.par {
		u.par[i] = -1
	}
	return u
}

func root(u *UnionFind, x int) int {
	if u.par[x] < 0 {
		return x
	}
	u.par[x] = root(u, u.par[x])
	return u.par[x]
}

func unite(u *UnionFind, x, y int) {
	xr := root(u, x)
	yr := root(u, y)
	if xr == yr {
		return
	}
	u.par[yr] += u.par[xr]
	u.par[xr] = yr
}

func same(u *UnionFind, x, y int) bool {
	if root(u, x) == root(u, y) {
		return true
	}
	return false
}

func size(u *UnionFind, x int) int {
	return -u.par[root(u, x)]
}

func perm(n int, k int) int {
	v := 1
	if 0 < k && k <= n {
		for i := 0; i < k; i++ {
			v *= (n - i)
		}
	} else if k > n {
		v = 0
	}
	return v
}

func fact(n int) int {
	return perm(n, n-1)
}

func comb(n int, k int) int {
	return perm(n, k) / fact(k)
}

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *Io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func main() {
	io := NewIo()
	defer io.Flush()
	N := io.NextInt()
	M := io.NextInt()
	// fmt.Scan(&N, &M)

	result := make([]int, M)
	bList := make([][]int, M)
	for i := 0; i < M; i++ {
		A := io.NextInt()
		B := io.NextInt()
		bList[i] = []int{A - 1, B - 1}
		result[i] = 0
	}

	u := newUnionFind(N)
	incon := comb(N, 2)

	for i := range bList {
		result[M-1-i] = incon
		a := bList[M-1-i][0]
		b := bList[M-1-i][1]
		if !same(u, a, b) {
			incon -= size(u, a) * size(u, b)
			unite(u, a, b)
		}
	}

	for i := range result {
		io.PrintLn(result[i])
	}
}

Measured memory_bytes: 11648
#include "bits/stdc++.h"
using namespace std;
const int N=1e5+20;
int n,r[N],l[N],dp[N];
char a[N];

int main()
{
	scanf(" %s",a+1);
	n=strlen(a+1);

	for(int i=1;i<=n;i++)
		if(a[i]=='L')
			l[i]=l[i-1]+1;
	for(int i=n;i>=1;i--)
		if(a[i]=='R')
			r[i]=r[i+1]+1;

	for(int i=1;i<=n;i++)
	{
		if(a[i]=='L')
		{
			int moves=l[i];
			if(moves&1) dp[i-moves+1]++;
			else dp[i-moves]++;
		}
		else
		{
			int moves=r[i];
			if(moves&1) dp[i+moves-1]++;
			else dp[i+moves]++;
		}
	}

	for(int i=1;i<=n;i++) printf("%d ",dp[i]);
}

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


int main() {

  long long t = 0;
  
  int N, M, K; cin >> N >> M >> K;
  
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  
  vector<long long> B(M);
  for (int i = 0; i < M; i++) {
  cin >> B[i];
   t += B[i];
}
  
  int j = M;
  int ans = 0;
  for (int i = 0; i < N+1; i++) {
    while (j > 0 && t > K) {
      j--;
      t -= B[j];
    }
    if (t > K) break;
    ans = max(ans, i + j);
//    if (i == N) break;
    t += A[i];
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 6420
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<int,int>
int main()
{
    cin.tie(0),cout.tie(0),ios::sync_with_stdio(0);
    double n,d,cnt=0;
    cin>>n>>d;
    while(n--)
    {
        double x,y;
        cin>>x>>y;
        double dis=sqrt((x*x)+(y*y));

        if(dis<=d)
            cnt++;
    }
    cout<<cnt;
    return 0;
}


Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x,y;cin >> x >> y;
    if(y>=2*x&&(y-2*x)%2==0&&x*4>=y){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int p[100000],n;

inline int check(){
	for(int i=1;i<n;i++){
		if(i == p[i])
			return i;
	}
	return false;
}

int main(){
	int i,pos,a;
	cin >> n;
	n++;
	for(i=1;i<n;i++){
		cin >> pos;
		p[i] = pos;
	}
	for(i=1;pos = check();i++){
		a = p[pos];
		p[pos] = p[pos+1];
		p[pos+1] = a;
	}
	cout << i-1 << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int LLI;

int main()
{
	int a, b, ans = 0;
	cin >> a >> b;
	int arr[a];
	for(int i = 0; i < a; i++)
		cin >> arr[i];
	sort(arr,arr+a);
	for(int i = a - b; i < a; i++)
		ans += arr[i];
	cout << ans;
}

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

char table[5][6] = {
	{'a','f','k','p','u','z'} ,
	{'b','g','l','q','v','.'} ,
	{'c','h','m','r','w','?'} ,
	{'d','i','n','s','x','!'} ,
	{'e','j','o','t','y',' '}
} ;

main(){
	string s ;
	while( cin >> s ){
		if( cin.eof() ) break ;
		if( s.size() % 2 ){
			cout << "NA" << endl ;
			continue ;
		}
		bool t = false ;
		for( int i=0 ; i<s.size() ; i+=2 ){
			if( s[i]-'0' >= 1 && s[i]-'0' <= 6 &&
				s[i+1]-'0' >= 1 && s[i+1]-'0' <= 5 ){}
			else t = true ;
		}
		
		if( t ){
			cout << "NA" << endl ;
			continue ;
		}
		
		for( int i=0 ; i<s.size() ; i+=2 ) cout << table[s[i+1]-'0'-1][s[i]-'0'-1] ;
		cout << endl ;
	}
}

Measured memory_bytes: 1176
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#pragma warning( disable:4996 )
#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
using namespace std;
long long gcd(long long a, long long b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a%b);
}

long long lcm(long long a, long long b) {
	return a * b / gcd(a, b);
}
bool sortbysec(const pair<int, int> &a,
	const pair<int, int> &b)
{
	return (a.second < b.second);
}
int main(void) {
	/*int s;
	scanf("%d", &s);
	if (s % 10 == s % 100 / 10 || s % 100 / 10 == s % 1000 / 100 || s / 1000 == s % 1000 / 100) {
		printf("Bad\n");
	}
	else {
		printf("Good\n");
	}*/

	/*int n, l;
	scanf("%d %d", &n, &l);
	int absmin = 99999999;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		sum += l + i;
		if (abs(absmin) > abs(l + i)) {
			absmin = l + i;
		}
	}
	sum -= absmin;
	printf("%d\n", sum);*/

	/*long long a, b, c, d;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
	long long start = a + ((a%c==0)?0:(c - a % c));
	//if (a%c == 0)start -= c;
	long long end = b - ((b%c==0)?0:(b%c));
	//if (b%c == 0)end += c;
	long long ccount = (end - start >= 0) ? (end - start) / c + 1 : 0;
	start = a + ((a%d == 0) ? 0 : (d - a % d));
	//if (a%d == 0)start -= d;
	end = b - ((b%d == 0) ? 0 : (b%d));
	//if (b%d == 0)end += d;
	long long dcount = (end - start >= 0) ? (end - start) / d + 1 : 0;
	long long gcdcd = lcm(c, d);
	start = a + ((a%gcdcd == 0) ? 0 : (gcdcd - a % gcdcd));
	//if (a%(d*c) == 0)start -= (d*c);
	end = b - ((b%gcdcd == 0) ? 0 : (b%gcdcd));
	//if (b% (d*c) == 0)end += (d*c);
	long long ecount = (end - start >= 0) ? (end - start) / gcdcd + 1 : 0;
	printf("%lld\n", (b-a + 1) - ccount - dcount + ecount);*/

	int n;
	scanf("%d", &n);
	vector<pair<int, int>> v;
	for (int i = 0; i < n; i++) {
		int a, b;
		scanf("%d %d", &a, &b);
		v.push_back(make_pair(a, b));
	}
	sort(v.begin(), v.end(), sortbysec);
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		sum += v[i].first;
		if (v[i].second < sum) {
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 2420
import java.util.Scanner;


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

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int ans = s.size();
	REP(i, s.size() - 1) {
		if (s[i] != s[i + 1]) {
			ans = min(ans, max(i + 1, s.size() - i - 1));
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  long long ans=0;
  int y=0;
  long long minn=100000000000;
  rep(i,n){
    long long q;
    cin >> q;
    if(q<0)y=1-y;
    ans+=abs(q);
    minn=min(minn,abs(q));
  }
  if(y==1)cout << ans-2*minn << endl;
  else cout << ans << endl;
}


Measured memory_bytes: 256
//{{{
#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)1e9+7;
//}}}

int main(){
  int N;
  cin >> N;
  int ans = (N == 5 || N == 7 || N == 3);
  puts(ans ? "YES" : "NO");
  return 0;
}


Measured memory_bytes: 256
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ

vector<int>v;
int main(){
	int a,b;scanf("%d%d",&a,&b);
	init_UF(110000);
	for(int i=0;i<b;i++){
		int p,q;scanf("%d%d",&p,&q);p--;q--;
		UNION(p,q);
	}
	int L=0;
	int R=0;
	for(int i=0;i<a;i++){
		if(UF[i]>=0)continue;
		if(FIND(0)==FIND(i)){
			L=-UF[i];
		}else if(FIND(1)==FIND(i)){
			R=-UF[i];
		}
	}
	if(L>R)swap(L,R);
	long long ret=(long long)L*(L-1)/2+(long long)(a-L)*(a-L-1)/2;
	printf("%lld\n",ret-b);
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template


// Trie tree (Prefix tree)
struct node{
    node *next[26] = {};
    int len[26] = {};
    bool ok = false;
    int exist = 0;
    int num = 0;
    node() {
        rep(i, 26) len[i] = 1;
    }
};

class Trie{
    
public:
    node *root;
    Trie(){
        root = new node();
    }
    
    void add(string &s){
        node *cur = root;
        for(char &c : s){
            if(!cur->next[c - 'a']){
                cur->next[c - 'a'] = new node();
                cur->exist++;
            }
            cur = cur->next[c - 'a'];
        }
        cur->ok = true;
        cur->num++;
    }
    
    // 縮約パート lenはその子のノードが何文字分縮約されているかを表す。numはcount(下参照)
    int dfs(node *n){
        if(!n) return 0;
        rep(i, 26){
            while(n->next[i] && n->next[i]->exist == 1 && !n->next[i]->ok){
                rep(j, 26){
                    if(n->next[i]->next[j]){
                        n->next[i] = n->next[i]->next[j];
                        n->len[i]++;
                        break;
                    }
                }
            }
            n->num += dfs(n->next[i]);
        }
        return n->num;
    }
    
    // ノードnの子に登録した文字列(のprefix)がいくつあるかを数える
    int count(node *n){
        return n ? n -> num : 0;
    }
    
    // 辞書順がlで定義された時のsの順番
    int ord(string &s, string &l){
        node *cur = root;
        int ret = 0;
        for(int i = 0; i < s.size();){
            char c = s[i];
            ret += cur->ok;
            rep(j, l.size()){
                if(c == l[j]){
                    i += cur->len[c - 'a'];
                    cur = cur->next[c - 'a'];
                    break;
                }
                else{
                    ret += count(cur->next[l[j] - 'a']);
                }
            }
        }
        return ret;
    }
    
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    vector<string> S(N);
    rep(i, N) cin >> S[i];
    Trie trie;
    rep(i, N) trie.add(S[i]);
    trie.dfs(trie.root);
    int Q;
    cin >> Q;
    rep(i, Q){
        int k;
        string s;
        cin >> k >> s;
        k--;
        output(trie.ord(S[k], s) + 1);
    }
    
    return 0;
}

Measured memory_bytes: 132480
#include<bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define mod 1000000007
#define bitcount __builtin_popcountll
#define ll long long
#define pb push_back
#define pi pair<int,int>
#define pii pair<pi,int>
#define mp make_pair
int main()
{
	int i,j,k;
	int n,arr[10005];
	sd(n);
	int maxi=0,mini=1000;
	for(i=1;i<=n;i++)
	{
		sd(j);
		maxi=max(maxi,j);
		mini=min(mini,j);
	}
	printf("%d\n",maxi-mini );
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int top,S[1000];

void push(int x){
  S[++top] = x;
}

int pop(){
  top--;
  return S[top+1];
}

int main(){
  int p,q;
  top = 0;
  char s[100];

  while(scanf("%s",s) != EOF){
    if(s[0] == '+'){
      p = pop();
      q = pop();
      push(p+q);
    }
      else if(s[0] == '-'){
        p = pop();
        q = pop();
        push(q-p);
      }
      else if(s[0] == '*'){
        p = pop();
        q = pop();
        push(p*q);
      }
      else push(atoi(s));
    }

    printf("%d\n",pop());
    return 0;
  }


Measured memory_bytes: 2144
#include<iostream>

using namespace std;

int main(){

	int n,bot, top, sum, cnt;


	while (1){
		cin >> n;
		if (n == 0) break;

		sum = 0, cnt = 0, bot = 0, top = 0;
		while (top < n){
			if (sum == n){
				cnt++;
				top++;
				sum += top;
			}
			else if (sum < n){
				top++;
				sum += top;
			}
			else{
				sum -= bot;
				bot++;
			}
		}

		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool Finish_read;
template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}
template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}
template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}
template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}
/*================Header Template==============*/
string s,goal="AKIHABARA";
int pos[]={0,4,6,8},vis[10];
int main() {
	cin>>s;
	if(s.length()>9) {
		puts("NO");
		return 0;
	}
	for(int i=0;i<(1<<4);i++) {
		memset(vis,0,sizeof vis);
		string o="";
		for(int j=0;j<4;j++)
			if(i&(1<<j))
				vis[pos[j]]=1;
		for(int j=0;j<9;j++)
			if(!vis[j])
				o+=goal[j];
		if(o==s) {
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n, a;
    cin >> n >> a;
    n %= 500;
    if (n > a) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>

using namespace std;
#define     loop(n,i,a)     for(int i=a;i<n;i++)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     vi              vector<int>
#define     vll             vector<ll>
#define     sz(x)           (int)x.size()
#define     pb              push_back
int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };

int main() {
	int n;cin>>n;
	ll res=0;
	vi v(n);
	loop(n,i,0)cin>>v[i];
	sort(allv(v));
	loop(n,i,0){
		loop(n,j,i+1){
			ll l=j+1,r=n-1,c=j;
			while(l<=r){
				ll mid=(l+r)/2;
				if(v[i]+v[j]>v[mid]){
					c=mid;
					l=mid+1;
				}
				else r=mid-1;
			}
			res+=(c-j);
		}
	}
	cout<<res<<endl;
	return 0;
}


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

int funcX(int x)
{
 int r = 0; 
 while (x > 1)
 {
    if (x%2==0) {r++;  x/=2; /*cout << "x : "<<x << endl;*/ }
    else break;
 }
  return r;
}

int main() 
{
  int N;
  cin >> N;
  int t; 
  
  for (int i = 1; i <= N; i++) 
  {
    int A;
    cin >> A;
    int s = funcX(A);
    if (i ==1)  t = s;
    else if (t > s)  t = s;
   }
  cout << t << endl;
  return 0;
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    string s;
    cin >> s;
    int first = (s[0]-'0')*10 + (s[1]-'0');
    int last = (s[2]-'0')*10 + (s[3]-'0');
    //cout << first << " " << last << endl;
    if( 0 < first && first < 13 )
    {
        if( 0 < last && last < 13 ) cout << "AMBIGUOUS" << endl;
        else cout << "MMYY" << endl;
    }
    else if( 0 < last && last < 13 ) cout << "YYMM" << endl;
    else cout << "NA" << endl;


}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
typedef vector<ll> vll;

//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
#define fake false
	

int main() {
	int H, W;
	cin >> H >> W;
	string tmp;
	vector<string> dst;
	for (int i = 0; i < H; i++) {
		cin >> tmp;
		dst.push_back(tmp);
		dst.push_back(tmp);
	}
	for (int i = 0; i < dst.size(); i++) {
		cout << dst[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int i = (b); i --> (a);)
#define all(v) (v).begin(),(v).end()
#define trav(x,v) for(auto &x : v)
#define sz(v) int(v.size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;

const ll md = 1e9+7;

ll inv(ll a, ll b){
	return a-1 ? b - inv(b%a, a) * b / a : 1;
}

const int LIM = 1e6+10;

int main(){
	vector<ll> fs(LIM, 1), ifs(LIM);
	rep(i,1,LIM) fs[i] = fs[i-1] * i % md;
	rep(i,0,LIM) ifs[i] = inv(fs[i], md);

	auto choose = [&](int n, int k){
		if(k < 0 || k > n) return 0LL;
		if(n < 0) return 0LL;
		return fs[n] * ifs[k] % md * ifs[n-k] % md;
	};

	auto ways = [&](int n, int k){
		ll ans = choose(n-1, k);
		ll cover = 0;
		int z = n-1 - k;
		if(z < 0) cover = choose(n, k);
		else cover = choose( n-2 - z, z);
		ans -= cover;
		ans %= md;
		if(ans < 0) ans += md;
		return ans;
	};
	
	auto solve = [&](int n){
		ll ans = 0;
		ans += fs[n-1];
		rep(k,1,n-1) ans += fs[n-1-k] * fs[k] % md * ways(n,k) % md;
		ans %= md;
		if(ans < 0) ans += md;
		return ans;
	};

	int n;
	cin >> n;
	cout << solve(n) << endl;
}

Measured memory_bytes: 15872
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
 
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
 
using namespace std;
 
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
 
const int INF=1<<29;
const double EPS=1e-9;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

struct node {
	int key;
	node *left;
	node *right;
	node(int k) : key(k), left(nullptr), right(nullptr){
	}
};

void insert(node *to, node *v) {
	if (v->key < to->key) {
		if (to->left != nullptr) {
			insert(to->left, v);
		} else {
			to->left = v;
		}
	} else {
		if (to->right != nullptr) {
			insert(to->right, v);
		} else {
			to->right = v;
		}
	}
}

bool find(node *to, node *v) {
	if (to->key == v->key) {
		return true;
	}
	bool ret = false;
	if (v->key < to->key) {
		if (to->left != nullptr) {
			ret |= find(to->left, v);
		}
	} else {	
		if (to->right != nullptr) {
			ret |= find(to->right, v);
		}	
	}
	return ret;
}

void print_first(node *target) {
	cout << " " << target->key;
	if (target->left != nullptr) print_first(target->left);
	if (target->right != nullptr) print_first(target->right);
}
void print_mid(node *target) {
	if (target->left != nullptr) print_mid(target->left);
	cout << " " << target->key;
	if (target->right != nullptr) print_mid(target->right);
}

void deletetree(node *target) {
	if (target->left != nullptr) deletetree(target->left);
	if (target->right != nullptr) deletetree(target->right);
	delete target;
}

int main() {
	int N;
	int num;
	string inst;

	cin >> N;
	
	cin >> inst;
	cin >> num;
	N--;

	node *root = new node(num);
	for (int i = 0; i < N; ++i) {
		cin >> inst;
		if (inst == "insert") {
			cin >> num;
			node *v = new node(num);
			insert(root, v);

		} else if (inst == "print") {
			print_mid(root);
			cout << endl;
			print_first(root);
			cout << endl;
		} else if (inst == "find") {
			cin >> num;
			node *v = new node(num);
			if (find(root, v)) {
				cout << "yes" << endl;
			} else {
				cout << "no" << endl;
			}
		}
	}
	deletetree(root);
	
}

Measured memory_bytes: 16840
a = [int(input()) for _ in range(5)]
b = []

temp = -1
s = 10
for i in range(5):
    x = a[i]
    if x % 10 == 0:
        b.append(x)
    else:
        b.append(x - (x % 10) + 10)
        if x % 10 < s:
            s = x % 10
            temp = i

if s == 10:
    print(sum(a))
else:
    print(sum(b) - b[temp] + a[temp])

Measured memory_bytes: 3064
#include <stdio.h>
int main(){
  int A[101][101],a[101],flag[101];
    int n,i,j,k=1,m=0,v,sum=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        for(j=0;j<n;j++)
	  scanf("%d",&A[i][j]);
    a[0] = 0;
    flag[0] = 1;
    for(i =1;i<n;i++){
      flag[i]=0;
    }
    while(1){
        v=2000;
        for(i=0;i<k;i++){
            for(j=0;j<n;j++){
                if(A[a[i]][j]<v&&A[a[i]][j]!=-1&&flag[j]!=1){
                    v=A[a[i]][j];
                    m=j;
                }
            }
        }
        if(k!=n){
            a[k]=m;
            flag[m]=1;
            sum+=v;
            k++;
        }
        else break;
    }
    printf("%d\n",sum);
    return 0;
} 



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

int main() {
  int L, R, D;
  cin >> L >> R >> D;
  int ans = 0;
  for (int i = L; i <= R; i++) {
    if (i % D == 0) ans++;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3620