akhauriyash/Code-Regression huggingface dataset:
/*
          ঘরে থাকুন , সুস্থ থাকুন ।
    stay home , stay safe .
    wan-_-s
*/

#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define stay_home_stay_safe return 0
#define pb push_back
#define __ ios_base::sync_with_stdio(false); cin.tie(NULL);

void scan(ll &n) { scanf("%lld",&n) ; }
void scan(ll &n, ll &m) { scanf("%lld%lld",&n,&m) ; }
void scan(vector<ll> &v) { ll n = v.size() ; for(ll i=0 ;i<n;i++) scanf("%lld",&v[i]) ; }

 const ll N = 200007 ;
/// vector<ll> adj[N] ;
/// void edge (ll u , ll v) {    adj[u].pb(v) ;    adj[v].pb(u) ; }

vector<ll> pde(ll n ) {
    vector<ll>p ;
    ll i ;
    for (i = 2 ;i* i<= n; i++) {
        if (n%i==0){
            p.pb(i) ;
            while(n%i==0) {
                n/=i ;
            }
        }
    }
    if(n>1)p.pb(n) ;
    return p ;
}

void solve() {
     ll n ;
     cin >> n ;
    ll ans = 0 , i , j ;
    vector<ll>v = pde(n) ;
    ll sz = v.size() ;
    for (i = 0; i<sz ; i++) {
        if (n%v[i]==0) {
                j = v[i] ;
            while(n%j==0) {
                n/=j ;
                j*=v[i] ;
                ans++ ;
            }
        }
    }
    cout << ans << endl ;
}




int main() {
  //  __ ;
    ll t = 1 ;
   // cin >> t ;
    while(t--) { solve() ;}
    stay_home_stay_safe ;
}








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

int main() {
  int N;
  cin >> N;
  int candivide = -1;
  int ans = 0;
  for (int i = 1; i <= N; i++) {
    int tmp_divide = 0;
    int tmp_num = i;
    while (tmp_num > 0) {
      if (tmp_num % 2 == 0) {
        ++tmp_divide;
        tmp_num /= 2;
      } else {
        break;
      }
    }

    if (candivide < tmp_divide) {
      ans = i;
      candivide = tmp_divide;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

class Main {
    private static void solve() {
        Scanner scanner = new Scanner(System.in);

        while (true) {
            int n = scanner.nextInt();
            if (n == 0) {
                break;
            }

            Set<Integer> numbers = new HashSet<Integer>();
            for (int i = 1; i < n; i++) {
                numbers.add((i * i) % n);
            }

            int[] results = new int[(n - 1) / 2 + 1];
            int[] numbersArray = new int[numbers.size()];
            int index = 0;
            for (int i: numbers.toArray(new Integer[numbers.size()])) {
                numbersArray[index++] = i;
            }

            for (int i = 0; i < numbersArray.length; i++) {
                int a = numbersArray[i];
                for (int j = 0; j < numbersArray.length; j++) {
                    if (i == j) {
                        continue;
                    }
                    int b = numbersArray[j];
                    int c = a - b;
                    if (c < 0) {
                        c += n;
                    }
                    if (c > (n - 1) / 2) {
                        c = n - c;
                    }
                    results[c]++;
                }
            }
            for (int i = 1; i < (n - 1) / 2 + 1; i++) {
                System.out.println(results[i]);
            }
        }
    }

    public static void main(String... arg) {
        solve();
    }
}

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

vector<int> adj[200005];
int colour[200005];
void dfs(int u, int p){
	for(int v : adj[u]){
		if(v == p) continue;
		colour[v] = 3 - colour[u];
		dfs(v, u);
	}
}

int v[4];

int main(){
	//freopen("i.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n; cin >> n;
	for(int i = 0;i < n-1;i++){
		int a, b; cin >> a >> b;
		a--; b--;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	
	colour[0] = 1;
	dfs(0,-1);
	
	int one = 0, two = 0, three = 0;
	for(int i = 1;i <= n;i++){
		if(i % 3 == 1) one++;
		else if(i % 3 == 2) two++;
		else three++;
	}
	
	vector<int> O, T;
	for(int i = 0;i < n;i++){
		if(colour[i] == 1) O.push_back(i);
		else T.push_back(i);
	}
	
	if(O.size() >= one && T.size() >= two){
		while(O.size() > one){
			colour[O.back()] = 3;
			O.pop_back();
		}
		
		while(T.size() > two){
			colour[T.back()] = 3;
			T.pop_back();
		}
	}
	else if(O.size() < one){
		for(int i = 0;i < n;i++){
			if(colour[i] == 1) colour[i] = 3;
		}
		while(T.size() > two){
			if(one == 0) colour[T.back()] = 3;
			else colour[T.back()] = 1, one--;
			
			T.pop_back();
		}
	}
	else{
		for(int i = 0;i < n;i++){
			if(colour[i] == 2) colour[i] = 3;
		}
		while(O.size() > one){
			if(two == 0) colour[O.back()] = 3;
			else colour[O.back()] = 2, two--;
			
			O.pop_back();
		}
	}
	

	
	for(int i = 0;i < n;i++){
		cout << v[colour[i]] * 3 + colour[i] << " ";
		v[colour[i]]++;
	}
}


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

using namespace std;

typedef long long ll;
typedef pair<string,string> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int n;cin>>n;
    string s;cin>>s;
    string pre=s.substr(0,n),suf=s.substr(n,n);
    reverse(suf.begin(),suf.end());
    map<string,ll> mp;
    for(int i=0;i<(1<<n);i++){
        string red="",blu="";
        int st=i;
        for(int j=0;j<n;j++){
            if(st%2) red+=suf[j];
            else blu+=suf[j];

            st/=2;
        }
        mp[red+"$"+blu]++;
    }
    ll res=0;
    for(int i=0;i<(1<<n);i++){
        string red="",blu="";
        int st=i;
        for(int j=0;j<n;j++){
            if(st%2) red+=pre[j];
            else blu+=pre[j];

            st/=2;
        }
        res += mp[red+"$"+blu];
    }
    cout<<res<<endl;
}


Measured memory_bytes: 67200
N, x, y = [int(i) for i in input().split()]

cnt = [0] * N
for i in range(1, N+1):
  for j in range(i+1, N+1):
    temp = min(abs(j-i), abs(x-i) + 1 + abs(j-y), abs(y-i) + 1 + abs(j-x))
    cnt[temp] += 1

for i in range(1, N):
  print(cnt[i])

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

int main() {
  int a, b;
  
  cin >> a;
  cin >> b;
  
  int tap = 0;
  int socket = 1;
  while (socket < b) {
    --socket;
    socket += a;
    ++tap;
  }
  
  cout << tap;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

class SquareDivision{
    private:
        const int bucketSize = 256;
        ll N, B;
        vector<ll> data;
        vector<ll> bucketSum;
        vector<ll> bucketAdd;

    public:
        void prepare(int n){
            B = (n + bucketSize - 1)/ bucketSize;
            N = B * bucketSize;
            data.assign(N, 0);
            bucketSum.assign(B, 0);
            bucketAdd.assign(B, 0);
        }

        void add(int s, int t, int x){
            for(int k=0; k<B; k++){
                int l = k * bucketSize;
                int r = (k + 1) * bucketSize;

                if(r <= s || t <= l) continue;

                if(s <= l && r <= t){
                    bucketAdd[k] += x;
                }
                else{
                    for(int i=max(s, l); i<min(t, r); i++){
                        data[i] += x;
                        bucketSum[k] += x;
                    }
                }
            }
        }

        ll getsum(int s, int t){
            ll sum=0;
            for(int k=0; k<B; k++){
                int l = k * bucketSize;
                int r = (k + 1) * bucketSize;

                if(r <= s || t <= l) continue;

                if(s <= l && r <= t){
                    sum += bucketSum[k] + bucketAdd[k] * bucketSize;
                }
                else{
                    for(int i=max(s, l); i<min(t, r); i++){
                        sum += data[i] + bucketAdd[k];
                    }
                }
            }

            return sum;
        }
};

int main(){
    int n, q; cin>>n>>q;
    SquareDivision ans;
    ans.prepare(n);

    while(q--){
        int c; cin>>c;
        if(c == 0){
            int s, t, x; cin>>s>>t>>x;
            ans.add(s, t+1, x);
        }
        else{
            int s, t; cin>>s>>t;
            cout << ans.getsum(s, t+1) << endl;
        }
    }
}


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

int main() {
  int n;
  
  while(cin >> n, n) {
    vector<vector<int> > G(n, vector<int>(n-1, 0));
    vector<int> win(n), lose(n);
    vector<pair<int, string> > team(n);
    
    for(int i=0; i<n; i++) {
      team[i].first = i;
      cin >> team[i].second;
      for(int j=0; j<n-1; j++) {
	cin >> G[i][j];
	win[i]  += G[i][j] == 0;
	lose[i] += G[i][j] == 1;
      }
    }
    
    for(int i=0; i<n-1; i++) {
      for(int j=i+1; j<n; j++) {
	if(win[i] == win[j]) {
	  if(lose[i] == lose[j]
	     && team[i].first > team[j].first) {
	    swap(win[i], win[j]);
	    swap(lose[i], lose[j]);
	    swap(team[i], team[j]);
	  }
	  else if(lose[i] > lose[j]) {
	    swap(win[i], win[j]);
	    swap(lose[i], lose[j]);
	    swap(team[i], team[j]);
	  }
	} else if(win[i] < win[j]){
	  swap(win[i], win[j]);
	  swap(lose[i], lose[j]);
	  swap(team[i], team[j]);
	}
      }
    }
    for(int i=0; i<n; i++) cout << team[i].second << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#include <atcoder/all>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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 long long INF = 1e18;
//const ll mod = 1000000007;
ll N, Q;
struct S{
    atcoder::modint998244353 sz, sum;
};
 
S op(S l, S r) {
    return {l.sz + r.sz, l.sum + r.sum};
}
S e() {
    return {0, 0};
}

struct F{
    bool update;
    atcoder::modint998244353 val;
};

S mapping(F b, S a) {
    if(!b.update) return a;
    return {a.sz, a.sz * b.val};
}
F composition(F l, F r) {
    if(l.update) return l;
    return r;
}
F id() {
    return {false, atcoder::modint998244353(0)};
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> Q;
    vector<S> a(N);
    atcoder::modint998244353 digit = 1;
    for(int i = 0; i < N; i++) {
        //cerr << i << " " << digit.val() << endl;
        a[N-1-i] = S({digit, digit});
        digit *= 10;
    }
    atcoder::lazy_segtree<S,op,e,F,mapping,composition,id> seg(a);
    //cout << seg.all_prod().sz.val() << " " << seg.all_prod().sum.val() << endl;
    for(int q = 0; q < Q; q++) {
        ll l, r, d;
        cin >> l >> r >> d;
        l--;
        seg.apply(l, r, {true, d});
        auto tmp = seg.all_prod();
        cout << tmp.sum.val() << endl;
    }
    return 0;
}

Measured memory_bytes: 10892
//abc070_c.cpp
//Sun Jun  3 08:56:40 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
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){
	long long temp = gcd(a,b);
	return (a/temp)*b;
}


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

	long long ans = 1LL;

	for (int i=0;i<n;i++){
		long long xx;
		cin >> xx;
		ans = lcm(ans,xx);
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef signed long long ll;

using namespace std;

int main(){
	ll a,ab,abc,all,M,x;
	M=1000000007;
	a=0;
	ab=0;
	abc=0;
	all=1;
	
	string S;
	cin >> S;
	ll l=S.length();
	
	for( int i=0; i<l ; ++i){
		x=S[i];
		if (x=='A') a+=all;
		if (x=='B') ab+=a;
		if (x=='C') abc+=ab;
		
		if (x=='?') {
			abc=abc*3+ab;
			ab=ab*3+a;
			a= a*3+all;
			all*=3;
		}
		abc%=M;
		ab%=M;
		a%=M;
		all%=M;	
	}
	cout << abc%M << endl;
}



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

int main(){
    Int N, K, S; cin >> N >> K >> S;
    vector<Int> ans;

    rep(i,K) ans.push_back(S);
    rep(i,N-K){
        if(S != 1e9) ans.push_back(S+1);
        else ans.push_back(S-1);
    }

    rep(i, N) cout << ans[i] << " ";
    cout << endl;
}


Measured memory_bytes: 2292
#include <stdio.h>
int main(void){
    int n,m,i,j,a[200001],b[200001],ac[200001],nc[200001];
    scanf("%d %d",&n,&m);
    for(j=0;j<m;j++){
        scanf("%d %d",&a[j],&b[j]);
    };
    for(i=1;i<=n;i++){
        ac[i]=nc[i]=0;
    };
    for(j=0;j<m;j++){
        if(a[j]==1){
            ac[b[j]]=1;
        };
        if(b[j]==1){
            ac[a[j]]=1;
        };
        if(a[j]==n){
            nc[b[j]]=1;
        };
        if(b[j]==n){
            nc[a[j]]=1;
        };
    };
    for(i=2;i<n;i++){
        if(ac[i]==1 && nc[i]==1){
            printf("POSSIBLE");
            return 0;
        }
    };
    printf("IMPOSSIBLE");
    return 0;
};


Measured memory_bytes: 3328
#include<iostream>
#include<map>
#include<string>
#include<vector>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef int Def;
typedef vector<Def> vi;
typedef pair<Def,Def> pii;
int main(){
	int n;
	while(cin>>n,n){
		vi in(n);
		rep(i,n)cin>>in[i];
		string s;
		cin>>s;
		rep(i,s.size()){
			int t=in[i%n];
			if(t>=26){
				t-=26;
				if(islower(s[i]))s[i]=toupper(s[i]);
				else s[i]=tolower(s[i]);
			}
			if(islower(s[i])){
				s[i]-=t;
				if(s[i]<'a')s[i]='Z'-('a'-s[i])+1;
			}else{
				s[i]-=t;
				if(s[i]<'A')s[i]='z'-('A'-s[i])+1;
			}
		}
		cout<<s<<endl;
	}
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const ll MOD = 1e9 + 7;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

int main() {
    ll n,k,ans = 0; cin >> n >> k;

    if(k == 0){
        cout << n*n;
        return 0;
    }
    for(int i = 1; i <= n; i ++){
        if(k > i-1) continue;
        else{
            ans += (n/i)*(i-1-(k-1));
            if(n%i >= k)ans += (n%i-(k-1));
        }
    }
    cout << ans;

}


Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC075_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var n = nm[0];
            var m = nm[1];

            var edges = new List<int>[n+1];
            for (int i = 1; i <= n; i++)
            {
                edges[i] = new List<int>();
            }

            for (int i = 0; i < m; i++)
            {
                var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
                var a = ab[0];
                var b = ab[1];

                edges[a].Add(b);
                edges[b].Add(a);
            }

            var ans = 0;
            while (true)
            {
                var deleted = false;
                for (int i = 1; i <= n; i++)
                {
                    if (edges[i].Count ==1)
                    {
                        edges[edges[i][0]].Remove(i);
                        edges[i] = new List<int>();
                        ans++;
                        deleted = true;
                    }
                }

                if (!deleted) break;
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a,b,c = LI()
    ans = 10 ** 5
    ans = min(ans, a + b)
    ans = min(ans, a + c)
    ans = min(ans, c + b)
    print(ans)
    return

#B
def B():
    n = II()
    w = LI()
    ans = inf
    for i in range(n):
        ans = min(ans, abs(sum(w[:i]) - sum(w[i:])))
    print(ans)
    return

#C
def C():
    n, m = LI()
    a = IR(m)+[inf]
    dp = [0] * (n + 3)
    dp[0] = 1
    for i in range(n + 1):
        if a[bisect_left(a, i + 1)] != i + 1:
            dp[i + 1] += dp[i] % mod
        if a[bisect_left(a, i + 2)] != i + 2:
            dp[i + 2] += dp[i] % mod
    print(dp[n] % mod)
    return

#D
def D():
    h, w = LI()
    s = SR(h)
    dp = [[0] * w for _ in range(h)]
    for x in range(w):
        for y in range(h):
            if s[y][x] == ".":
                dp[y][x] += 1
    for y in range(h):
        x = 0
        q = 0
        while 0 <= x < w:
            if s[y][x] == ".":
                dp[y][x] += q
                q += 1
            else:
                q = 0
            x += 1
        x = w - 1
        q = 0
        while 0 <= x < w:
            if s[y][x] == ".":
                dp[y][x] += q
                q += 1
            else:
                q = 0
            x -= 1
    for x in range(w):
        y = 0
        q = 0
        while 0 <= y < h:
            if s[y][x] == ".":
                dp[y][x] += q
                q += 1
            else:
                q = 0
            y += 1
        y = h - 1
        q = 0
        while 0 <= y < h:
            if s[y][x] == ".":
                dp[y][x] += q
                q += 1
            else:
                q = 0
            y -= 1
    print(max(map(lambda x: max(x), dp)))
    return


#Solve
if __name__ == '__main__':
    D()


Measured memory_bytes: 214412
s = input()
flag = True
ko = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
if s[0] == 'A':
    pass
else:
    flag = False
cnt = 0
for i in range(2, len(s)-1):
    if s[i] == 'C':
        cnt += 1
        id = i
if cnt == 1:
    pass
else:
    flag = False
if flag:
    for i in range(1, len(s)):
        if id != i:
            if s[i] not in ko:
                flag = False
if flag:
    print("AC")
else:
    print("WA")

Measured memory_bytes: 38384
while True:
	try:
		s = [] ; right = 0 ; left = 0
		x = map(float,raw_input().split(','))
		for val in xrange(4):
			if x[0]-x[2] != 0:
				if (x[0]-x[2])*(x[5]-x[1]) > (x[1]-x[3])*(x[4]-x[0]): left += 1
				else: right += 1
			else:
				if x[1] < x[3]:
					if x[0] < x[4]: left += 1
					else: right += 1
				else:
					if x[0] > x[4]: left += 1
					else: right += 1
			a=x[0] ; x[0]=x[2] ; x[2]=x[4] ; x[4]=x[6] ; x[6]=a
			b=x[1] ; x[1]=x[3] ; x[3]=x[5] ; x[5]=x[7] ; x[7]=b
		if right == 4 or left == 4: print 'YES'
		else: print 'NO'
	except: break

Measured memory_bytes: 4308
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  int n,a,b;
  cin >> n>>a>>b;
  
  int aika=0;
  int bika=0;
  int bue=0;
  vector<int> p(n);
  rep(i,n){
  cin>>p[i];
    if(p[i]<=a)aika++;
    else if(p[i]<=b)bika++;
    else bue++;
  }
  
  cout << min(min(aika,bika),bue) << endl;
  
}

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

typedef long long int ll;
typedef long double ld;

//****************************************************                
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define endl "\n" //comment it for interactive questions
#define trace1(a) cerr << #a << ": " << a << endl;
#define trace2(a,b) cerr << #a << ": " << a << " " << #b << ": " << b << endl;
#define trace3(a,b,c) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << endl;
#define trace4(a,b,c,d) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << #d << ": " << d << endl;
#define OC freopen("input.txt" , "r", stdin); freopen("output.txt" , "w", stdout)
#define MOD (ll)1e9+7; //change it for other mods
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        //*******************************************************
//Some Functions

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

void solve()
{
    ll n;
    cin >> n;
    ll sum = 0;
    vll b(n-1);
    for(ll i=0;i<n-1;i++) {
    	cin >> b[i];
    }
    sum += (b[0] + b[n-2]);
    for(ll i=1;i<n-1;i++) {
    	sum+=min(b[i], b[i-1]);
    }
    cout << sum << "\n";
}

int main()
{
    FAST_IO;
    // #ifndef ONLINE_JUDGE 
   	// 	OC;
    // #endif
    ll t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 256
C = ['KIHBR','AKIHBR','AKIHABR','AKIHBAR','AKIHBRA','AKIHABAR','AKIHBARA','AKIHABARA',
    'KIHABR','KIHABAR','KIHABRA','KIHBAR','KIHBARA','KIHBRA','KIHABARA','AKHABRA']
print('YES' if input() in C else 'NO')

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setpercision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
template<class T> inline bool chmin(T& a, T b){
    if(a>b){a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){
    if(a<b){a=b;return true;}return false;}
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    ll H,N;cin>>H>>N;
    ll sum=0;
    rep(i,N){
        ll p;cin>>p;
        sum+=p;
    }
    if(sum>=H)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
function check(s::Char,t::Char)
    s==t || s=='?'
end
change(x::Char) = x=='?' ? 'a' : x
function main()
    s,t=chomp.(readlines())
    ans=String[]
    for start=1:length(s)-length(t)+1
        if all([check(s[i],t[i-start+1]) for i=start:start+length(t)-1])
            k= start==length(s)-length(t)+1 ? s[1:start-1]*t : s[1:start-1]*t*s[start+length(t):end]
            push!(ans,k)
        end
    end
    isempty(ans) ? print("UNRESTORABLE") : foreach(x->print(change(x)),minimum(ans))
end
main()

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

int main(int argc, char *argv[]) {
  int hills[10] = {0};

  for (int i = 0; i < 10; i++)
    cin >> hills[i];
  sort(hills, hills + 10);
  for (int i = 0; i < 3; i++)
    cout << hills[9-i] << endl;
  return 0;
}

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

int main() {
    int D, N;
    cin >> D;
    cin >> N;

    if(D==0) {
        if(N!=100) cout << N << endl;
        else cout << N+1 << endl;
    }
    else if(D==1) {
        if(N!=100) cout << 100 * N <<endl;
        else cout << 100 * (N+1) <<endl;
    }
    else{
        if(N!=100) cout << 10000 * N <<endl;
        else cout << 10000 * (N+1) <<endl;
    }
}


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

using namespace std;

typedef long long ll;

struct dsu {
  public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), sz(n, 1), parent(n) { std::iota(parent.begin(), parent.end(), 0); }

    void merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = find(a), y = find(b);
        if (x == y) return;
        if (sz[x] < sz[y]) std::swap(x, y);
        sz[x] += sz[y];
        parent[y] = parent[x];
    }

    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return find(a) == find(b);
    }

    int find(int a) {
        assert(0 <= a && a < _n);
        if (parent[a] == a) return a;
        return parent[a] = find(parent[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return sz[a];
    }

  private:
    int _n;
    std::vector<int> parent;
    std::vector<int> sz;
};

void solve() {
    int n, q;
    cin >> n >> q;
    dsu d(n);
    for (int i = 0; i < q; i++) {
        int type;
        cin >> type;
        if (type == 0) {
            int u, v;
            cin >> u >> v;
            d.merge(u, v);
        }
        else {
            int u, v;
            cin >> u >> v;
            cout << d.same(u, v) << '\n';
        }
    }
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	for (; q > 0; q--) {
		solve();
		//cout << endl;
	}
}

Measured memory_bytes: 4612
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
string s;
int k,a[100005],minn=30,f;
int main()
{
	cin>>s>>k;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!='a')
		{
		f=1;break;	
		}
	}
	
	if(!f||s.size()==1)
	{
		k%=26;
		for(int i=1;i<=k;i++)
		{
			if(s[s.size()-1]=='z')
			{
				s[s.size()-1]='a';
			}
			else s[s.size()-1]++;
		
		}
	}
	else{
	
	for(int i=0;i<s.size();i++)
	{
	if(s[i]=='a')a[i]=0;
	else 
	a[i]='z'-s[i]+1;
	
	minn=min(minn,a[i]);
	}
	for(int i=0;i<s.size();i++)
	{
		if(k>=a[i])
		{
			s[i]='a';k-=a[i];
		}
		
	}
	if(k)
	{    k%=26;
		for(int i=1;i<=k;i++)
		{
			if(s[s.size()-1]=='z')
			{
				s[s.size()-1]='a';
			}
			else s[s.size()-1]++;
		
		}
			
			}
			}
			cout<<s;
	return 0;
}

Measured memory_bytes: 896
a, b, h, m = map(int, input().split())

import math

a_rad = (h+m/60)/12*2*math.pi
b_rad = m/60*2*math.pi

#print(a_rad, b_rad)

x_a, y_a = a*math.sin(a_rad), a*math.cos(a_rad)
x_b, y_b = b*math.sin(b_rad), b*math.cos(b_rad)

#print(x_a, y_a)
#print(x_b, y_b)

print(math.sqrt((x_a - x_b)**2 + (y_a - y_b)**2))




Measured memory_bytes: 62364
n,w=map(int,input().split())
wv=[list(map(int,input().split())) for i in range(n)]
v=[[] for i in range(4)]
# print(v)
for i in range(n):
    v[wv[i][0]-wv[0][0]].append(wv[i][1])
# print(v)
for i in range(4):
    v[i].sort(reverse=True)
# print(v)
ans=0
for i in range(len(v[0])+1):
    tmp=[[0,0] for t in range(4)]        
    tmp[0][0]=sum(v[0][:i])
    tmp[0][1]=wv[0][0]*i
    for j in range(len(v[1])+1):
        tmp[1][0]=sum(v[1][:j])
        tmp[1][1]=(wv[0][0]+1)*j
        for k in range(len(v[2])+1):
            tmp[2][0]=sum(v[2][:k])
            tmp[2][1]=(wv[0][0]+2)*k
            for l in range(len(v[3])+1):
                tmp[3][0]=sum(v[3][:l])
                tmp[3][1]=(wv[0][0]+3)*l
                if tmp[0][1]+tmp[1][1]+tmp[2][1]+tmp[3][1]<=w:
                    ans=max(ans,tmp[0][0]+tmp[1][0]+tmp[2][0]+tmp[3][0])
print(ans)

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

a = list(map(int, input().split('/')))

# print(a)

if a[0] <= 2018:
    print('Heisei')
else:
    if a[0] == 2019 and a[1] <= 4:
        print('Heisei')
    else:
        print('TBD')

Measured memory_bytes: 2940
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

s = [0] * (len(a) * len(b))
ans = [0] * (3000 * len(c))

i = 0
for A in a:
    for B in b:
        s[i] = A + B
        i += 1
s.sort(reverse=True)

i = 0
for S in s[:3000]:
    for C in c:
        ans[i] = C + S
        i += 1
ans.sort(reverse=True)

for i in ans[:k]:
    print(i)


Measured memory_bytes: 98844
n=input().split()
mx = 0
mx2 = 0
for i in n:
    if mx < len(i):
        mx = len(i)
        mxm = i
    elif mx2 < n.count(i):
        mx2 = n.count(i)
        mxh = i
print(mxh,mxm)


Measured memory_bytes: 5548
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]

res = [0] * N

for i in A:
    res[i-1] += 1

ans = [''] * N

for i in range(N):
    if Q - res[i] >= K:
        print('No')
    else:
        print('Yes')

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

int main(){
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> a(n+1);
  for(int i = 0; i < m; i++){
    int k;
    cin >> k;
    a.at(k)++;
  }
  
  int ans = 0, cnt = 0;
  for(int i = x; i < n; i++) ans += a.at(i);
  for(int i = x; i > 0; i--) cnt += a.at(i);
  ans = min(ans, cnt);
    
  cout << ans << endl;
}

Measured memory_bytes: 256
s = input()
n = len(s) - 1
ans = 0
w = ""
for i in range(0, 2**n):
    for j, r in enumerate(s):
        x = i & 1
        i >>= 1
        w += r
        if j == n:
            continue
        if x:
            ans += int(w)
            w = ""
        else:
            pass
    ans += int(w)
    w = ""
print(ans)



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

int main() {
  int n,x;
  cin >> n >> x;
  vector<int> l(n);
  for (int i = 0;i < n;i++){
    cin >> l[i];
  }
  
  vector<int> d(n+1);
  d[0] = 0;
  for (int i = 1;i < n+1;i++){
    d[i] = d[i-1] + l[i-1];
  }
  
  int ans = 0;
  for (int i = 0;i < n+1;i++){
    if (d[i] <= x){
      ans++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3628
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String code = sc.next();
    String ans = "Good";
    for (int i=0; i<code.length()-1; i++) {
      if (code.substring(i, i+1).equals(code.substring(i+1, i+2))) {
        ans = "Bad";
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
lint N;
lint memo[100100];

lint rec(lint N){
  if(N == 0) return 0;
  if(memo[N] != -1) return memo[N];
  lint num = N;
  for(lint i = 0; pow(6, i) <= N; i++) num = min(num, rec(N - pow(6, i)) + 1);
  for(lint i = 0; pow(9, i) <= N; i++) num = min(num, rec(N - pow(9, i)) + 1);
  return memo[N] = num;
}

signed main(){
  cin >> N;
  for(lint i = 0; i <= N; i++) memo[i] = -1;
  cout << rec(N) << endl;
}

Measured memory_bytes: 5760
from collections import deque
n = int(input())

ls = [list() for _ in range(n)]
ls2 = [list() for _ in range(n)]
edge = []
for i in range(n-1):
    x,y = map(int,input().split())
    ls[x-1].append(i)
    ls2[y-1].append(i)
    edge.append([x-1,y-1])

d = deque()
color = [0]*(n-1)
d.append(0)
while len(d):
    c = d.pop()
    cl = []
    for i in ls2[c]:
        if color[i]:
            cl.append(color[i])
    idx = 1
    for i in ls[c]:
        while(1):
            if not idx in cl:
                break
            else:
                idx += 1
        color[i] = idx
        cl.append(idx)
        d.append(edge[i][1])

print(max(color))
for i in color:
    print(i)

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

int main() {
  int b,t,A;
  int i;
  t=0;
  for (i=0;i<2;i++){
    cin >> A;
    b=-(A%10000/1000*10+A/10000)+A%100;
    if (b+i<=0)
      t+=((i+1)/2*2-1)*(A/100);
    else
      t+=((i+1)/2*2-1)*(A/100+1);
  }
  cout << t << endl;
}


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

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main(){
    int n;
    cin >> n;
    vector<pair<ll,ll>> pairs(n);
    rep(i,n){
        ll x, l;
        cin >> x;
        cin >> l;
        pairs.at(i) = make_pair(x-l, x+l);
    }
    sort(pairs.begin(), pairs.end(), compare_by_b);

    int ans = 0;
    ll cur = -1e+10;

    rep(i,n){
        if (cur > pairs.at(i).first) continue;
        ans ++;
        cur = pairs.at(i).second;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
  int n,l;cin>>n>>l;
  multiset<string>st;
  for(int i=0;i<n;i++)
  {
      string s;cin>>s;
      st.insert(s);
  }
  for(auto it:st)
  {
      cout<<it;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

ll dp[3010][3010];
vector<ll>a;
ll n;

ll rec(ll i,ll j){
    if(dp[i][j]!=0)return dp[i][j];
    if(i==j){
        dp[i][i]=0;
        return 0;
    }
    ll len = j-i;
    if((n-len)%2==0){
        dp[i][j]=rec(i+1,j)+a[i];
        chmax(dp[i][j],rec(i,j-1)+a[j-1]);
        if(j<n)chmax(dp[i][j],rec(i,j-1)+a[j-1]);
    }
    else{
        dp[i][j]=rec(i+1,j)-a[i];
        chmin(dp[i][j],rec(i,j-1)-a[j-1]);
        if(j<n)chmin(dp[i][j],rec(i,j-1)-a[j-1]);
    }
    return dp[i][j];
}

int main(){
    cin >> n;
    a.resize(n);
    rep(i,n)cin>>a[i];
    rep(i,3010)rep(j,3010)dp[i][j]=0;
    cout << rec(0,n) << endl;

    return 0;
}

Measured memory_bytes: 71168
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)

#include <iostream>
#include <iomanip>
#include <math.h>
using ll = long long;

using namespace std;

const int INF = 1001001001;
// 10^ vector: 可変長配列
vector<int> to[100005];
int main()
{
  int a, b;

  cin >> a >> b;

  cout << a*b << endl;

  return 0;
}

Measured memory_bytes: 5980
using System;
using System.Linq;

namespace ConsoleApp4
{
    class Program
    {
        static void Main()
        {
            var str = Console.ReadLine().Split(' ');
            var A = int.Parse(str[0]);
            var B = int.Parse(str[1]);
            var K = int.Parse(str[2]);

            if (B < A + K - 1)
            {
                foreach (var VARIABLE in Enumerable.Range(0, B - A + 1).Select(x => A + x))
                {
                    Console.WriteLine(VARIABLE);
                }
            }
            else
            {
                foreach (var VARIABLE in Enumerable.Range(0, K).Select(i => new int[] { i + A, B - i }).SelectMany(x => x).Distinct().OrderBy(x => x))
                {
                    Console.WriteLine(VARIABLE);
                }

            }
        }

    }
}


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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

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

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) \
    sort(all(x));  \
    (x).erase(unique(all(x)), (x).end())
#define int long long
#define mp make_pair

/* function */
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

/* const */
const int inf = 1e9 + 7;
const int dxl[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dyl[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dxs[4] = {1, 0, -1, 0};
const int dys[4] = {0, 1, 0, -1};

/* main */
signed main(void)
{
    int n, cnt = 0;
    cin >> n;
    array<int, 200> a;
    rep(i, n)
    {
        cin >> a[i];
    }
    rep(i, n)
    {
        if (a[i] % 2 != 0)
        {
            cout << cnt << endl;
            return 0;
        }
        if (i == (n - 1))
        {
            rep(i, n)
            {
                a[i] /= 2;
            }
            i = 0;
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

int main() {
  while (true) {
    int n, m, a;
    cin >> n >> m >> a;
    if (n == 0 && m == 0 && a == 0) return 0;

    int amida[1001][n + 1];
    for (int i = 0; i < 1001; i++)
      for (int j = 0; j < n + 1; j++)
	amida[i][j] = 0;
    
    for (int i = 0; i < m; i++) {
      int h, p, q;
      cin >> h >> p >> q;
      for (int j = p; j < q; j++)
	amida[h][j] = 1;
    }

    for (int i = 1000; i > 0; i--) {
      if (amida[i][a]) a++;
      else if (amida[i][a - 1]) a--;
    }
    cout << a << endl;
  } 
}

Measured memory_bytes: 3440
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#define ll long long int
#define MOD 1000000007LL
using namespace std;
typedef pair<ll,ll> P;
struct edge{ll u,v,cost;};
ll par[1000000];//親
ll fukasa[1000000];//深さ
//初期化
void init(ll n){
    for(int i=0;i<n;i++){
        par[i]=i;
        fukasa[i]=0;
    }
}
//木の根を求める
ll find(int x){
    if(par[x]==x){
        return x;
    }else{
        return par[x]=find(par[x]);
    }
}
//xとyの集合を併合
void unite(ll x,ll y){
    x=find(x);
    y=find(y);
    if(x==y){
        return;
    }
    if(fukasa[x]<fukasa[y]){
        par[x]=y;
    }else{
        par[y]=x;
        if(fukasa[x]==fukasa[y]){
            fukasa[x]++;
        }
    }
}
bool same(ll x,ll y){
    return find(x)==find(y);
}
bool comp(const edge& e1,const edge& e2){
    return e1.cost<e2.cost;
}
edge es[364364];
ll kruskal(ll V,ll E){
    sort(es,es+E,comp);
    init(V);
    ll res=0;
    for(int i=0;i<E;i++){
        edge e=es[i];
        if(!same(e.u,e.v)){
            unite(e.u,e.v);
            res+=e.cost;
        }
    }
    return res;
}
struct P2{ll num,x,y;};
bool cx(const P2 &l,const P2 &r){
    return l.x<r.x;
}
bool cy(const P2 &l,const P2 &r){
    return l.y<r.y;
}
int main() {
    ll n;
    cin>>n;
    P2 s[n];
    for(int i=0;i<n;i++){
        cin>>s[i].x>>s[i].y;
        s[i].num=i;
    }
    sort(s,s+n,cx);
    for(int i=0;i<n-1;i++){
        es[i]=edge{s[i].num,s[i+1].num,min(abs(s[i].x-s[i+1].x),abs(s[i].y-s[i+1].y))};
    }
    sort(s,s+n,cy);
    for(int i=0;i<n-1;i++){
        es[n+i-1]=edge{s[i].num,s[i+1].num,min(abs(s[i].x-s[i+1].x),abs(s[i].y-s[i+1].y))};
        
    }
    int e=2*(n-1);
    cout<<kruskal(n,e)<<endl;
}

Measured memory_bytes: 14848
#include<stdio.h>
#include<math.h>
# define N 100
int main(){
  int n,p[N+1],m[N+1][N+1];
  int i,l,k,j;
  scanf("%d",&n);


  for(i = 1;i <= n; i++){

    scanf("%d",&p[i-1]);
    scanf("%d",&p[i]);

  }


for ( i = 1; i <= n; i++ ) m[i][i] = 0;
   for ( l = 2; l <= n; l++ ) {
    for ( i = 1; i <= n - l + 1; i++ ) {
        j = i + l - 1;
       m[i][j] = (1 << 21);
       for (  k = i; k <= j - 1; k++ ) {
       m[i][j] = fmin(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
      }
    }
  }

   printf("%d\n",m[1][n]);
  return 0;
}

Measured memory_bytes: 640
n=int(input())
list=[input().split() for _ in range(n)]
ans=0
for i in range(n):
  if list[i][1]=="JPY":
    ans+=float(list[i][0])
  elif list[i][1]=="BTC":
    ans+=float(list[i][0])*380000.0
print(ans)

Measured memory_bytes: 3060
N = int(input())
L = list(map(int, input().split()))

N = len(L)
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if abs(L[i] - L[j]) < L[k] and L[k] < L[i] + L[j] and (L[i]-L[j])*(L[j]-L[k])*(L[k]-L[i]) != 0:
                ans += 1
                #print(i+1, j+1, k+1)

print(ans)

Measured memory_bytes: 9212
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int[] c = new int[n];
        int[] sum = new int[m];
        List<Integer> idx = new ArrayList<>();
        List<List<Integer>> list = new ArrayList<>();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            idx.add(i);
            int cc = Integer.parseInt(sc.next());
            c[i] = cc;
            List<Integer> templist = new ArrayList<>();
            for (int j = 0; j < m; j++) {
                int temp = Integer.parseInt(sc.next());
                sum[j] += temp;
                templist.add(temp);
            }
            list.add(templist);
        }
        for (int i = 0; i < m; i++) {
            if (sum[i] < x) {
                System.out.println(-1);
                return;
            }
        }
        for (int i = 0; i < (1 << n); i++) {
            int tempAns = 0;
            int[] tempSum = new int[m];
            for (int j = 0; j < n; j++) {
                if ((i >> j & 1) == 1) {
                    tempAns += c[j];
                    for (int k = 0; k < m; k++) {
                        tempSum[k] += list.get(j).get(k);
                    }
                }
            }
            boolean isOK = true;
            for (int j = 0; j < m; j++) {
                if (tempSum[j] < x) {
                    isOK = false;
                    break;
                }
            }
            if (isOK) {
                ans = Math.min(ans, tempAns);
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 37492
#include <iostream>

using namespace std;

int main()
{
int a[100],x,y,i,ii,input,temp;
cin >> x;
y=x;
for(i=0;i<x;i++)
{
    cin >> input;
    a[i]=input;
}
for(ii=1;ii<x;ii++)
{
for(i=0;i<y-1;i++)
{
        temp=a[i];
        a[i]=a[i+1];
        a[i+1]=temp;
}
y--;
}
for(i=0;i<x-1;i++)
{
    cout << a[i] << " ";
}
cout << a[x-1] << endl;
}


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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{    
   

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li n,l;

    cin>>n>>l;

    vector<string> v(n);

    f(i,0,n-1)
    {
        cin>>v[i];
    }

    sort(v.B,v.E);

    string ans="";

    for(string s:v)
        ans+=s;

    cout<<ans;

    return 0;
}

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

using namespace std;

int main() {
	long long int L, N, M;
	string S;
	cin >> S;
	int f = 0;
	for( size_t i = 0; i < S.size(); i++ ) {
		if( S[i] == 'C'&&f == 0 ) {
			f++;
		} else if( S[i] == 'F'&&f == 1 ) {
			f++;
		}
	}
	if( f == 2 ) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 764
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  vector<int>in(6);
  rep(i,6)cin>>in[i];
  string s;
  cin>>s;
  rep(i,s.size()){
    if(s[i]=='S'){
      int tmp=in[1];
      in[1]=in[0];
      in[0]=in[4];
      in[4]=in[5];
      in[5]=tmp;
    }else if(s[i]=='E'){
      int tmp=in[2];
      in[2]=in[0];
      in[0]=in[3];
      in[3]=in[5];
      in[5]=tmp;
    }else if(s[i]=='W'){
      int tmp=in[3];
      in[3]=in[0];
      in[0]=in[2];
      in[2]=in[5];
      in[5]=tmp;
    }else{
      int tmp=in[0];
      in[0]=in[1];
      in[1]=in[5];
      in[5]=in[4];
      in[4]=tmp;
    }
  }
  cout<<in[0]<<endl;
}

Measured memory_bytes: 1204
#include <iostream>

using namespace std;

long long n,a,b,x[100010],res;

int main()
{
    cin >> n >> a >>b;
    for (int i=1;i<=n;i++)
        cin >> x[i];
    for (int i=1;i<n;i++)
        res+=min(b,a*(x[i+1]-x[i]));
    cout << res << "\n";
}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif

    ll X;
    cin >> X;

    ll c = 100;

    ll ans = 0;
    while (c < X) {
        c += c / 100;
        ++ans;
    }

    cout << ans << "\n";

    cout << flush;
    return 0;
}

Measured memory_bytes: 3608