akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

void how_many_decendable(const vector<vector<ll>>&tree,vector<ll>&res,ll from,ll parent=-1)
{
    res[from]=0;
    for(auto c:tree[from]){
        if(c!=parent){
            how_many_decendable(tree,res,c,from);
            res[from]=max(res[from],res[c]+1);
        }
    }
}
void tree_distance(const vector<vector<ll>>&tree,vector<ll>&res,ll from,ll parent=-1,ll dist=0)
{
    res[from]=dist;
    for(auto c:tree[from]){
        if(c!=parent){
            tree_distance(tree,res,c,from,dist+1);
        }
    }
}
void get_parent(const vector<vector<ll>>&tree,vector<ll>&res,ll from,ll parent=-1)
{
    for(auto c:tree[from]){
        if(c!=parent){
            get_parent(tree,res,c,from);
        }
    }
    res[from]=parent;
}
int main()
{
    ll n=in(),u=in()-1,v=in()-1;
    vector<vector<ll>>tree(n);
    for(ll i=0;i<n-1;++i){
        ll a=in()-1,b=in()-1;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }

    vector<ll>decendable_root_v(n);how_many_decendable(tree,decendable_root_v,v);
    vector<ll>dist_from_v(n);      tree_distance(tree,dist_from_v,v);
    vector<ll>parent_root_v(n);    get_parent(tree,parent_root_v,v);
    ll ans=-1;
    for(
        ll up=0,upto=u;
        up<dist_from_v[upto];
        ++up,upto=parent_root_v[upto]
    ){
        ans=max(ans,dist_from_v[upto]+decendable_root_v[upto]-1);
    }
    cout<<ans<<endl;
}


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

int main(){
  int n=3,c=0,d=0;
  char s;
  
  rep(i,n){
  cin >> s;
  if(s == 'R'){
  	c++;
    d = 1;
  }
  else if(s == 'S' && i==2){
  }
  else if (s=='S' && i != 2){
    c=0;
  }
  }
  if(c == 0){
   c =d;
  }
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>

using namespace std;

int main(void){

  long long X;
  long long n = 100;

  cin >> X;

  for(long long i=1; i<10000; i++){
    n*=1.01;
    if(n>=X){
      cout << i << endl;
      break;
    }
  }

  return 0;
}


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

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
constexpr ll LINF = 4e18;

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 (a>b) { a=b; return 1; } return 0; }

int main() {
    int n;
    cin >> n;
    vector<P> cd(n);
    rep (i, n) {
        ll x, y;
        cin >> x >> y;
        cd[i] = make_pair(x-y, x+y);
    }
    ll mx = -LINF, mi = LINF;
    rep (i, n) {
        chmax(mx, cd[i].first);
        chmin(mi, cd[i].first);
    }
    ll xx = mx - mi;
    mx = -LINF; mi = LINF;
    rep (i, n) {
        chmax(mx, cd[i].second);
        chmin(mi, cd[i].second);
    }
    ll yy = mx - mi;
    
    ll ans = max(xx, yy);
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 6404
#include<bits/stdc++.h>
using namespace std;
long long a1[13]={1,2,4,7,12,20,29,38,52,101},a2[13]={1,2,4,7,12,20,30,39,67,101},n,an[15][15],no=1;
int main(){
	cin>>n;
	for (int i=1;i<=n;i++)an[i][i]=0;
	for (int i=1;i<=n;i++){
		for (int j=i+1;j<=n;j++)an[i][j]=an[j][i]=no*a1[j-i-1];
		no*=a2[n-i];
	}
	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++)cout<<an[i][j]<<' ';
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, a;
  set<int> s;
  cin>>n;
  for(int i=0; i<n; i++) {
    cin>>a;
    s.insert(a);
  }
  if(s.size()==n) cout<<"YES";
  else cout<<"NO";
}

Measured memory_bytes: 9600
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

//#include "Union_Find.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <array>
#include <bitset>

using namespace std;
#define REP(i,a,n) for(int i = (a); i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
#define FLOAT setprecision(16)
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(begin(dest), end(dest), val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
// all_of

#if 1
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

string s;
int main() {
	cin >> s;
	s.insert(s.begin() + 4, ' ');
	cout << s << endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = Integer.parseInt(sc.next()) - 1;
		}
		int count = 0;
		int now = 0;
		while (true) {
			if (now == 1) {
				System.out.println(count);
				break;
			}
			if (count >= n) {
				System.out.println(-1);
				break;
			}
			count++;
			now = a[now];
		}
		sc.close();
	}
}

Measured memory_bytes: 51132
#include <iostream>

using namespace std;

long long gcd(long long a, long long b){
	if(a%b == 0) return b;
	return gcd(b, a%b);
}

bool solve(){
	long long A, B, C, D; cin >> A >> B >> C >> D;
	if(A < B) return false;
	if(D < B) return false;
	if(C >= B) return true;
	long long a = A%B;
	long long d = gcd(B, D);
	long long m = B - d + A%B%d; 
	return m <= C;
}

int main(){
	int T;
	while(cin >> T){
		for(int i=0;i<T;i++){
			cout << (solve() ? "Yes" : "No") << endl;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    ll a,b;cin>>a>>b;
    cout<<a*b<<endl;
}

Measured memory_bytes: 3608
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <set>
#include <queue>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 100005;

int H, W;
int cnt;
int dx[5] = {0, 1, 0, -1, 0};
int dy[5] = {0, 0, 1, 0, -1};
char s[55][55];
bool vis[55][55];
int d[55][55];
struct Point {
	int x, y;
	Point () {} 
	Point (int _x, int _y) { 
		x = _x; y = _y;
	}
};

bool check(int x, int y) {
	if(vis[x][y]) return false;
	if(s[x][y] == '#') return false;
	if(x < 1 || x > H) return false;
	if(y < 1 || y > W) return false;
	return true;
}

int solve() {
	queue <Point> Q;
	for(int i = 1; i <= H; i++)
		for(int j = 1; j <= W; j++)
			d[i][j] = inf;
	d[1][1] = 1;
	if(s[1][1] == '.') Q.push(Point(1, 1));
	while(!Q.empty() ) {
		Point t = Q.front();
		Q.pop();
		for(int i = 1; i <= 4; i++) {
			int nx = t.x + dx[i];
			int ny = t.y + dy[i];
			if(check(nx, ny)) {
				d[nx][ny] = d[t.x][t.y] + 1;
				Q.push(Point(nx, ny));
				vis[nx][ny] = true;
			}
		}
	}
	if(d[H][W] == inf) return -1;
	else return cnt - d[H][W];
}

int main()
{
	while(scanf("%d %d", &H, &W) != EOF)
	{
		cnt = 0;
		for(int i = 1; i <= H; i++) {
			for(int j = 1; j <= W; j++) {
				scanf(" %c", &s[i][j]);
				if(s[i][j] == '.') cnt++;
			}
		}
		printf("%d\n", solve());
	}
	return 0;
}

Measured memory_bytes: 256
#define LOCAL
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char c) {return to_string((string) &c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    const double pi = 3.14159265358979;    
    double a,b; cin >> a >> b;
    double h,m; cin >> h >> m;
    double tk = 30 * h + 0.5 * m;
    double lk = 6 * m;
    double the;
    if(lk > tk){
        the = lk - tk;
    }
    else{
        the = tk - lk;
    }
    the = the  * pi / 180.0;
    double ans = a * a + b * b - 2.0 * a * b * cos(the);

    cout << fixed << setprecision(15);
    cout << sqrt(ans) << endl;
}


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

using namespace std;

using ll = long long;

ll Solve() {
    ll l;
    cin >> l;

    vector<ll> a(l + 1);
    for (int i = 1; i <= l; ++i) cin >> a[i];

    constexpr int N = 5;
    vector<vector<ll>> dp(l + 1, vector<ll>(N, 1e11));
    dp[0][0] = dp[0][1] = 0;

    for (int i = 1; i <= l; ++i) {
        for (int j = 0; j < N; ++j) {
            for (int k = 0; k <= j; ++k) dp[i][j] = min(dp[i][j], dp[i - 1][k]);
            if (j == 0 || j == 4) dp[i][j] += a[i];
            else if (j == 1 || j == 3) dp[i][j] += (a[i] == 0 ? 2 : (a[i] % 2 == 1));
            else if (j == 2) dp[i][j] += (a[i] == 0 ? 1 : (a[i] % 2 == 0));
        }
    }

    return *min_element(dp[l].begin(), dp[l].end());
}

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

    cout << Solve() << endl;

    return 0;
}


Measured memory_bytes: 15872
#include <climits>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <map>

using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	int q;
	scanf("%d", &q);

	char* s = new char[n];
	scanf("%s", s);

	map<int,int> x;

	for (int i = 0; i < n-1; i++)
	{
		if (s[i] == 'A' && s[i + 1] == 'C')
		{
			if (x.size() == 0)
				x.emplace(i, 1);
			else
				x.emplace(i, (*prev(x.end())).second + 1);
		}
	}

	for (size_t i = 0; i < q; i++)
	{
		int a;
		scanf("%d", &a);
		int b;
		scanf("%d", &b);

		if (a == b)
		{
			printf("0\n");
			continue;
		}
		a--;
		b--;
		int num[2] = { 0,0 };
		auto itr = x.lower_bound(b);
		if (itr != x.begin())
			num[1] = (*prev(itr)).second;
		itr = x.lower_bound(a);
		if (itr != x.begin())
			num[0] = (*prev(itr)).second;

		printf("%d\n", num[1] - num[0]);
	}


	return 0;
}

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

typedef long long ll;
using namespace std;

int main() {
    int N;
    cin >> N;
    int a = 0, b = 0, ab = 0;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        for (int j = 1, l = s.length(); j < l; j++) {
            if (s[j - 1] == 'A' && s[j] == 'B') {
                ans++;
            }
        }
        bool p = s[s.length() - 1] == 'A', q = s[0] == 'B';
        if (p && q) {
            ab++;
        } else if (p) {
            a++;
        } else if (q) {
            b++;
        } else {

        }
    }
    if (ab > 0) {
        ans += ab - 1;
        if (b > 0) {
            ans++;
        } else if (a > 0) {
            ans++;
        }
    }
    ans += min(a, b);
    cout << ans << endl;
}

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

using namespace std;

//typeDef
typedef long long           lli;
typedef long                li;
typedef vector<int>         vi;
typedef vector<li>          vli;
typedef vector<lli>         vlli;
typedef map<int, int>       mii;
typedef set<int>            seti;
typedef queue<int>          qi;
typedef deque<int>          dqi;
typedef stack<int>          stacki;
typedef multiset<int>       mseti;

//loop
#define rep(i, n)         for(int i = 0; i < n; ++i)
#define fori(i, a, b)     for(int i = a; i <= b; ++i)
#define ifor(i, a, b)     for(int i = a; i >= b; --i)

//Pair
#define mp                  make_pair
#define iPair               pair<int, int>
#define lliPair             pair<lli, lli>

//Extras
#define mod1                    1e9 + 7
#define mod2                    1e9 + 9
#define inf                     int(1e9)
#define INF                     lli(1e18)
#define pi                      3.14159265358979
#define pb                      push_back
#define pf                      push_front
#define popb                    pop_back()
#define popf                    pop_front()
#define ff                      first
#define ss                      second
#define all(v)                  v.begin(), v.end()
#define iter(container, it)     for(auto it = container.begin(); it != container.end(); ++it)

//functions
lli gcd(lli a, lli b) { return (a == 0) ? b : gcd(b % a, a); }
lli lcm(lli a, lli b) { return a / gcd(a, b) * b; }


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

      int n;
      cin >> n;
      cout << "ABC" << n;
    

      return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main():
    S,W=mis()
    print('unsafe' if W>=S else 'safe')



main()



Measured memory_bytes: 9980
N, M = list(map(int, input().split()))
PY = [list(map(int, input().split())) + [i, 0] for i in range(M)] 
d = {}
for i in sorted(PY, key=lambda x: x[1]):
    if i[0] in d:
        d[i[0]] += 1
    else:
        d[i[0]] = 1
    i[3] = d[i[0]]
for i in PY:
    print(str(i[0]).zfill(6) + str(i[3]).zfill(6))

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

// マクロ //
#define rep(v,times) for(int v = 0; v < (int)(times); v++)
#define req(v,first,endplus1) for(int v = first; v < (int)(endplus1); v++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) (x) * (x)

// 型エイリアス //
using lint = long long;
using pii = pair<int, int>;
using vpii = vector<pii>;
using plili = pair<lint, lint>;
using vplili = vector<plili>;
using vi = vector<int>;
using vli = vector<lint>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvli = vector<vli>;
using vvb = vector<vb>;
using vvc = vector<vc>;
using vvs = vector<vs>;
using mii = map<int, int>;
using mili = map<int, lint>;
using mci = map<char, int>;
using mcli = map<char, lint>;
using msi = map<string, int>;
using msli = map<string, lint>;


// 関数 //
template<class T, class Q> lint gcd_(T a, Q b) {
    int t;
    while (b != 0) {
        t = a % b;
        a = b;
        b = t;
    }
    return a;
}

template<class T, class Q> lint lcm_(T a, Q b) {
    return a * b / gcd_(a, b);
}

template<class T, class Q> double distance(T a, Q b) {
    double dist;
    dist = sqrt(x2(a.first - b.first) + x2(a.second - b.second));
    return dist;
}

lint perm(int a) {
    lint perm = 1;
    for (int i = a; i >= 1; i--) {
        perm *= i;
    }
    return perm;
}

lint combination(int n, int m) {
    long double c = 1;
    for (int i = n, k = 1; i > m; i--, k++) {
        c *= i;
        c /= k;
    }
    return (lint)c;
}

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

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

// 定数 //
const double pi = acos(-1);
const int mod = 1000000007;
const int inf = 1045141919;
const lint linf = ((1LL << 62) - 1);
const int dx4[4] = { 1,0,-1,0 };
const int dy4[4] = { 0,1,0,-1 };
const int dx8[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy8[8] = { 0,1,1,1,0,-1,-1,-1 };

// End of Template //



int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
        
    string S, T;
    cin >> S >> T;

    int cnt = 0;
    rep(i, S.size()) {
        if (S[i] != T[i]) cnt++;
    }

    cou(cnt);

}

Measured memory_bytes: 3884
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
using namespace std;
using ll = long long;
const ll INF = +10010010000;

typedef pair<ll,ll> P;
const ll MO = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n)cin >> a[i];
    ll s1,s2,s1_p,mini=INF;
    rep(i,n)s2+=a[i];
    s1_p = 0;
    rep(i,n-1){
        s1 = s1_p+a[i];
        s2 -=a[i];
        mini = min(mini,abs(s1-s2));
        s1_p = s1;
    }
    cout << mini << endl;
    return 0;
}

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

string data[22];

int solve(int x, int y){

  if(x < 0 || y < 0 || x == 12 || y == 12 || data[y][x] == '0') return 0;

  data[y][x] = '0';

  int dx[] = {0, 0, 1, -1};
  int dy[] = {1, -1, 0, 0};
  for(int i=0;i<4;i++) solve(x+dx[i], y+dy[i]);

  return 1;
}
    
int main(){

  while(cin >> data[0]){
    for(int i=1;i<12;i++) cin >> data[i];

    int ans = 0;
    for(int i=0;i<12;i++) for(int j=0;j<12;j++) ans += solve(i, j);

    cout << ans << endl;
  }

}

Measured memory_bytes: 1192
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int sankaku,eikaku,tyokkaku,donkaku;
int hen[3];
bool musi;

int main(void){

  sankaku = eikaku = tyokkaku = donkaku = 0;
  musi = false;

  while( cin >> hen[0] >> hen[1] >> hen[2] ){

    if( !musi ){

      sort( hen , hen + 3 );

      if( hen[2] >= hen[0] +  hen[1] ){
	musi = true;
	continue;
      }
      sankaku++;

      for( int i = 0 ; i < 3 ; i++ )
	hen[i] = pow( (double)hen[i] , 2 );

      if( hen[2] == hen[0] + hen[1] ) tyokkaku++;
      if( hen[2] < hen[0] + hen[1] ) eikaku++;
      if( hen[2] > hen[0] + hen[1] ) donkaku++;
      
      
    }
  }
  cout << sankaku << " " << tyokkaku << " " << eikaku << " " << donkaku << endl;
  return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const int M = 2e5+5;
int d[M],U[M],V[M],col[M],wt[M];
vector<int> vtr[M];
int adj(int x,int e)
{
	return U[e]+V[e]-x;
}
int main()
{
	int n,m;
	cin>>n>>m;
	vector<pair<int,int>> vec;
	for(int i=1;i<=n;i++)
	{
		cin>>d[i];
		vec.pb({d[i],i});
	}
	sort(all(vec));
	for(int i=1;i<=m;i++)
	{
		cin>>U[i]>>V[i];
		vtr[U[i]].pb(i);
		vtr[V[i]].pb(i);
	}
	// col => 1-2
	// wt => 1-1e9
	for(int i=1;i<=m;i++)
	{
		int u = U[i],v = V[i];
		if(col[u] && col[v])
			continue;
		if(d[u]!=d[v])
			continue;
		if(col[u])
			col[v] = 3-col[u];
		else if(col[v])
			col[u] = 3 - col[v];
		else
		{
			col[u] = 1;
			col[v] = 2;
		}
		wt[i] = d[u];
	}
	for(auto u:vec)
	{
		int x = u.ss;
		if(col[x])
			continue;
		for(auto ed:vtr[x])
		{
			int v = adj(x,ed);
			if(col[v] && d[v]<=d[x])
			{
				col[x] = 3-col[v];
				wt[ed] = d[x];
				break;
			}
		}
	}
	string s;
	for(int i=1;i<=n;i++)
	{
		if(col[i]==0)
		{
			cout<<"-1\n";
			return 0;
		}
		if(col[i]==1)
			s.pb('W');
		else
			s.pb('B');
	}
	cout<<s<<"\n";
	for(int i=1;i<=m;i++)
	{
		if(wt[i]==0)
			wt[i] = 1e9;
		cout<<wt[i]<<"\n";
	}
	return 0;
}

Measured memory_bytes: 15732
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#define rgi register long long
using namespace std;
long long n,ans[100005];
string s[100005];
map<string,long long>h;
long long fans,indx;
int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(rgi i=1;i<=n;++i)
	{
		cin>>s[i];
		sort(s[i].begin(),s[i].end());
		h[s[i]]++;
	}
	sort(s+1,s+n+1);
	for(rgi i=1;i<=n;++i)
	{
		if(s[i]==s[i-1])
			continue;
		if(h[s[i]]>1)
			ans[++indx]=h[s[i]];
	}
	for(rgi i=1;i<=indx;++i)
		fans+=((ans[i]*(ans[i]-1))>>1);
	cout<<fans<<endl;
	return 0;
}

Measured memory_bytes: 16640
X = input()

simo2 = X[-2:]
ue = X[:-2]

if int(X) < 100:
    print('0')
    exit()

if int(simo2)%5 !=0:
    if int(simo2)//5 + 1 <= int(ue):
        print('1')
    else:
        print('0')
else:
    if int(simo2)//5 <= int(ue):
        print('1')
    else:
        print('0')

Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n;
vector<i64> a;
int main() {
  cin >> n;
  read_n(a, n);
  i64 k = 0;
  for (i64 i = 0; i < n - 1; ++i) {
    k = a[i] - k;
  }
  i64 x = a[n - 1] - k;
  cout << x << ' ';
  for (i64 i = 0; i < n - 1; ++i) {
    x = 2 * (a[i] - x / 2);
    cout << x << ' ';
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2048
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CoinChangingProblem solver = new CoinChangingProblem();
        solver.solve(1, in, out);
        out.close();
    }

    static class CoinChangingProblem {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            final int INF = (int) 1e9;
            int n = in.nextInt();
            int variety = in.nextInt();
            int[] coins = new int[variety];
            for (int i = 0; i < variety; i++) {
                coins[i] = in.nextInt();
            }
            // 1を含むので払えない金額というのが存在しなくなる
            Arrays.sort(coins);
            int[] dp = new int[n + 1];
            Arrays.fill(dp, INF);
            dp[0] = 0;
            // n 円払うときの最小の枚数
            for (int idx = 0; idx < variety; idx++) {
                for (int i = coins[idx]; i <= n; i++) {
                    dp[i] = Math.min(dp[i], dp[i - coins[idx]] + 1);
                }
            }
            out.println(dp[n]);
        }

    }
}




Measured memory_bytes: 26908
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

int main(){
   int a, b, c, d;
   cin >> a >> b >> c >> d;
   cout << min(a, b) + min(c, d) << endl;

   return 0;
}

Measured memory_bytes: 256
use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

chomp (my $n = <STDIN>);
chomp (my @a = split / /, <STDIN>);
my @b;
for my $i (0..$n-1) {
  if ($i % 2 == 0) {
    push @b, $a[$i];
  } else {
    unshift @b, $a[$i];
  }
}
@b = reverse @b if $n % 2 == 1;
say join(' ', @b);

Measured memory_bytes: 42020
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
 
int main(){
 
  long long N;
  vector<char> ans;
  
  cin >> N;
  
  while(N!=0){
    
    N -=1;
    
   ans.push_back('a' +N%26); 
    
    N /=26;
  }
  
  for(int i=ans.size()-1; i>=0; i--){
    
   cout<< ans[i];
  }
  return 0;
}

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
 
int main() {
    int x;
    int i = 1;
    while(i <= 10000) {
    cin >> x;
    if ( x == 0 ) break;
        cout << "Case" << " " << i << ":" << " " << x << endl;
        i = i + 1;
    }
    return 0;
}



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define deb(x) cout << #x <<  " " << x << endl;
#define all(x) x.begin(), x.end()
typedef std::vector<int> vi;
typedef std::vector<vector<int>> vvi;
typedef std::vector<string> vs;
typedef std::vector<bool> vb;
typedef std::pair<int, int> pii;
typedef long long ll;
const int inf = 1e9 + 5;

template <typename T>
void print(T v){ for(auto i= v.begin(); i!=v.end(); i++)cout<<setw(2)<<*i<<" ";cout<<endl; }
template <typename T>
void print_vv(T v, bool same_line=true){
for(auto i= 0; i<v.size(); i++){cout<<"{";for(auto j = 0; j!=v[i].size(); j++){cout<<setw(3)<<v[i][j]<<",";}cout<<"},";if(same_line) cout<<endl;}cout<<endl;}

int main(){
    int n;
    while(cin>>n){
        // vi dp(n+1); // p-bility of having i heads so far
        vector<vector<double>> dp(n+1, vector<double>(n+1));

        double phead;
        dp[0][0] = 1;      
        for(int coins = 1; coins<=n; coins++){
            scanf("%lf", &phead);
            for(int heads = 0; heads<=coins; heads++){
                dp[coins][heads] = (heads-1>=0 ? dp[coins-1][heads-1]*phead : 0) + dp[coins-1][heads] * (1-phead);
            }
            // print_vv(dp);
        }

        double ans = 0;
        for(int heads = (n+1)/2; heads<=n; heads++)
            ans+=dp[n][heads];

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

    }    
    return 0;
}

Measured memory_bytes: 70656
# 02 AtCoder Beginner Contest 106 B - 105
import sys
import math

N = int(input())


def divisor(n):
    ans = 0
    for i in range(1, n + 1, 2):  # 偶数は回答に含めないため、約数が　2の倍数となる数字は存在しない
        if n % i == 0:
            ans += 1
            # if i != int(math.sqrt(n)):
            #     ans += 1

    return ans


ans = 0
for i in range(105, N + 1, 2):  # 偶数は回答に含めない
    if divisor(i) == 8:
        ans +=1

print(ans)


Measured memory_bytes: 3060
n=int(input())
print(0)
a=input()
d={}
if a=="Vacant":
    exit(0)
elif a=="Male":
    d["Male"] = 1
    d["Female"] = 2
else:
    d["Male"] = 2
    d["Female"] = 1
print(n-2)
a=input()
if a=="Vacant":
    exit(0)
elif d[a]==2:
    print(n-1)
    exit(0)

M=n-2
m=0

while M-m>=2:
    x=(M+m+1)//2

    print(x)
    a=input()
    if a=="Vacant":
        exit(0)

    if (x+d[a])%2==1:
        m=x
    else:
        M=x
        
    x=(M+m+1)//2

print(M)
a=input()
if a=="Vacant":
    exit(0)
print(m)
a=input()
if a=="Vacant":
    exit(0)


Measured memory_bytes: 9252
//#pragma comment(linker, "/STACK:102400000,102400000") 
//#include <windows.h>
//#include <unordered_map>
//#include <unordered_set>
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define eps 1e-10
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 1e6 + 5;
const int dir[8][2] = { { 0,1 },{ 1,1 },{ 1,0 },{ 1,-1 },{ 0,-1 },{ -1,-1 },{ -1,0 },{ -1,1 } };
const int dir8x[8] = { -1,-1,-1,0,0,1,1,1 };
const int dir8y[8] = { -1,0,1,1,-1,-1,0,1 };
const ll mod = 1e9 + 7;
const double PI = acos(-1.0);
ll po(ll a, ll b, ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a, ll b) { if (a == 0) { return b; } else { return gcd(b%a, a); } }

ll n, num[70];
ll dp[70][3][2];

int cmp(int x, int y)
{
	if (x > y)return 2;
	else if (x < y)return 0;
	else return 1;
}

void solve()
{
	memset(dp, 0, sizeof(dp));
	dp[0][1][0] = 1;
	cin >> n;
	int cnt = 0;
	while (n)
	{
		cnt++;
		num[cnt] = (n & 1);
		n >>= 1;
	}
	for (int i = 1; i <= 65; i++)
	{
		for (int k = 0; k <= 2; k++)
		{
			for (int z = 0; z <= 1; z++)
			{
				for (int p = 0; p <= 1; p++)
				{
					for (int q = 0; q <= p; q++)
					{
						int nk = cmp((p + q + z)%2, num[i]);
						if (nk == 1)nk = k;
						int nz = (p + q + z) / 2;

						dp[i][nk][nz] += dp[i - 1][k][z];
						dp[i][nk][nz] %= mod;
					}
				}
			}
		}
	}
	ll res = 0;
	for (int i = 0; i < 2; i++)
	{
		res += dp[65][i][0];
		res %= mod;
	}
	printf("%lld\n", res);
}

int main()
{

	solve();
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e5) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()


int main() {
    ll n, ans = IINF;
    set<P> st;
    cin >> n;
    REP(i,n){
        ll x, y;
        cin >> x >> y;
        st.insert({x,y});
    }
    for(auto a : st){
        for(auto b : st){
            ll p = a.first - b.first, q = a.second - b.second;
            if(p == 0 && q == 0)continue;
            set<P> ls = st;
            ll cnt = 0;
            while(!ls.empty()){
                P now = *ls.begin();
                cnt++;
                while(ls.count(now)){
                    ls.erase(now);
                    now.first += p;
                    now.second += q;
                }
            }
            ans = min(ans, cnt);
        }
    }
    if(n==1) ans = 1;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>

using namespace std;

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

template<typename A, typename B> bool chmin(A &a, const B &b){ return b < a && (a = b, true); }
template<typename A, typename B> bool chmax(A &a, const B &b){ return a < b && (a = b, true); }

int main(){
  string s;
  int n,m;
  cin >> n >> s;
  m = s.size();
  for (int i = 0; i < m; i++){
    for (int j = 0; j < n; j++){
      if (s[i] == 'Z'){
        s[i] = 'A';
      }
      else{
        s[i]++;
      }
    }
  }
  cout << s << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

char str[500];

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    scanf("%s",str);
    int i;
    int cnt=0;
    for(i=0; i<n-2; i++) {
        if(str[i]=='A' && str[i+1]=='B' && str[i+2]=='C' ) {
            cnt++;
        }
    }
    printf("%d\n", cnt);

    return 0;
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  long long D;
  cin >> D;
  vector<vector<long long>> v (N, vector<long long>(2));
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 2; j++){
      cin >> v[i][j];
    }
  }
  int count = 0;
  for(int i = 0; i < N; i++){
    if((v[i][0])*(v[i][0])+(v[i][1])*(v[i][1]) <= D*D){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 14028
#include <iostream>
#include <cstdio>
#include <cstring>

int main() {
    int n,m;
    int i,j;
    int a[10];
    memset(a, -1, sizeof(a));

    scanf("%d %d", &n, &m);

    int flag = 1;
    for(i = 0; i < m; i++) {
        int s,c;
        scanf("%d %d", &s, &c);
        if(a[s] == -1 || a[s] == c) {
            a[s] = c;
        } else if(a[s] != -1) {
            flag = 0;
        }
     }

    if(a[1] == 0 && n > 1) flag = 0;

    if(a[1] == -1) a[1] = 1;

    bool first = true;
    if(flag == 0) {
        printf("-1");
    } else if (n == 1 && m == 0) {
        printf("0");
    }
    else {
        for(i = 1; i <= n; i++) {
            if (first && a[i] != -1) {
                first = false;
                printf("%d", a[i]);
            } else if (!first) {
                if(a[i] != -1)
                printf("%d", a[i]);
                else printf("0");
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
import sys
import bisect

def lis(arr):
    queue = []
    queue.append(arr[0])
    for num in arr[1:]:
        if num > queue[-1]:
            queue.append(num)
        else:
            idx = bisect.bisect_left(queue, num)
            queue[idx] = num
    return len(queue)
    
    
if __name__ == '__main__':
    N = sys.stdin.readline()
    N = int(N)
    arr = []
    for i in range(N):
        tmp = sys.stdin.readline()
        arr.append(int(tmp))
    
    sys.stdout.write(str(lis(arr)))
    sys.stdout.write('\n')
    

Measured memory_bytes: 11196
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef pair<int,int> pi;
typedef long long int ll;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n,k;
    cin>>n>>k;
    int a[n],ans=mod;
    for (int i=0;i<n;i++) {
        cin>>a[i];
    }
    for (int i=0;i<(n-k+1);i++) {
        int x = a[i];
        int y = a[i+k-1];
        if ((x<0 && y<0)||(x>0 && y>0)) ans = min(ans,(int)max(abs(x),abs(y)));
        else {
            x = abs(x);
            y = abs(y);
            ans = min(ans,min(2*x+y,2*y+x));
        }
    }
    cout<<ans;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    vector<int> d(n);
    rep(i, 0, m){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        d[a[i]]++;
        d[b[i]]++;
    }
    rep(i, 0, n){
        if(d[i] % 2){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 2560
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

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

int main(){
	int H, W;
	cin >> H >> W;
	vector<string> A;
	for (int i = 0; i < H; i++){
		string a;
		cin >> a;
		A.push_back(a);
	}
	for (int j = 0; j < W + 2; j++){
		cout << "#";
	}
	cout << endl;
	for (int i = 0; i < H; i++){
		cout << "#";
		cout << A[i];
		cout << "#" << endl;
	}
	for (int j = 0; j < W + 2; j++){
		cout << "#";
	}
	cout << endl;
	return 0;
}


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

int main() {
    ll N,x=0,r=0;
    string S;
    map<char,ll> m;
    vector<ll> t(5);
    cin >> N;

    m['M']=0, m['A']=0, m['R']=0, m['C']=0, m['H']=0;

    rep(i,N) {
        cin >> S;
        if(m.count(S.at(0)))
            m.at(S.at(0))++;
    }

    for(auto p : m) {
        t.at(x) = p.second;
        x++;
    }

    rep(i,3)
        for(int j=i+1; j<4; j++)
            for(int k=j+1; k<5; k++)
                r += t.at(i)*t.at(j)*t.at(k);
    
    cout << r << endl;
}

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

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

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

ll long_floor(ll x,ll y,ll g){
    return x/g - (y-1)/g;
}

int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll g = lcm(c,d);
    ll ans = (b-a+1) - (long_floor(b,a,c) + long_floor(b,a,d) - long_floor(b,a,g));
    cout << ans << endl;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
  input! {
    s: String,
    _: String,
    a: usize,
    b: usize,
    u: String,
  };
  if u == s { 
    println!("{} {}", a-1, b);
  } else {
    println!("{} {}", a, b-1);
  }
}


Measured memory_bytes: 2128
X = int(input())

if 400 <= X <= 599:
  print(8)
elif 600 <= X <= 799:
  print(7)
elif 800 <= X <= 999:
  print(6)
elif 1000 <= X <= 1199:
  print(5)
elif 1200 <= X <= 1399:
  print(4)
elif 1400 <= X <= 1599:
  print(3)
elif 1600 <= X <= 1799:
  print(2)
elif 1800 <= X <= 1999:
  print(1)

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

int k;
queue<long long> Q;

int main()
{
	cin >> k;

	for (int i = 1; i <= 9; i++)
		Q.push(i);

	int j = 1;

	while (j < k) {
		long long p = Q.front();
		Q.pop();
		j++;

		long long u = p % 10;

		if (u != 0)
			Q.push(p * 10 + u - 1);

		Q.push(p * 10 + u);

		if (u != 9)
			Q.push(p * 10 + u + 1);
	}

	cout << Q.front() << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <iostream>
#include <math.h>
#define PI 3.1415926
using namespace std;
struct point {
    double x,y;
    point(double x,double y) {
        this -> x = x;
        this -> y = y;
    }
};
const double arc = PI * 60 / 180.0;

int depth;

void koch(int d,point a,point b) {
    if(d == depth) return ;
    double p1x = a.x, p1y = a.y;
    double p2x = b.x, p2y = b.y;
    double sx = (2*p1x + p2x) / 3;
    double sy = (2*p1y + p2y) / 3;
    double tx = (p1x + 2*p2x) / 3;
    double ty = (p1y + 2*p2y) / 3;
    double ux = sx + (tx-sx)*cos(arc) - (ty-sy)*sin(arc);
    double uy = sy + (tx-sx)*sin(arc) + (ty-sy)*cos(arc);

    koch(d+1,a,point(sx,sy));
    printf("%.8f %.8f\n",sx,sy);
    koch(d+1,point(sx,sy),point(ux,uy));
    printf("%.8f %.8f\n",ux,uy);
    koch(d+1,point(ux,uy),point(tx,ty));
    printf("%.8f %.8f\n",tx,ty);
    koch(d+1,point(tx,ty),b);
}

int main() {
    cin >> depth;
    printf("0.00000000 0.00000000\n");
    koch(0,point(0,0),point(100,0));
    printf("100.00000000 0.00000000\n");
    return 0;
}



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

int main(){
    priority_queue<int> price;
    int N,M; cin >> N >> M;
    for(int i = 0; i < N; i++){
        int in;
        cin >> in;
        price.push(in);
    }
    for (int i = 0; i < M; i++){
        int a;
        a = price.top() / 2;
        price.pop();
        price.push(a);
    }
    int64_t sum = 0;
    while(!price.empty()){
        sum += price.top();
        price.pop();
    }
    cout << sum << endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  string ans;
  rep (i, n) {
    ans.push_back(s[i]);
    ans.push_back(t[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};

const int MX=3010;
int dp[MX][MX][4];
int f[MX][MX];


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

    int R,C,K;
    cin>>R>>C>>K;
    int r[K],c[K],v[K];
    //int f[R+10][C+10]{};
    rep(i,K){
        cin>>r[i]>>c[i]>>v[i];
        r[i]--;
        c[i]--;
        f[r[i]][c[i]]=v[i];
    }
    //int dp[R+10][C+10][4];
    rep(i,R+1) rep(j,C+1) rep(k,4) dp[i][j][k]=-INF;
    dp[0][0][0]=0;

    rep(i,R){
        rep(j,C){
            for(int k=2;k>=0;k--){
                if(dp[i][j][k]>=0){
                    dp[i][j][k+1]=max(dp[i][j][k+1],dp[i][j][k]+f[i][j]);
                }
            }
            rep(k,4){
                if(dp[i][j][k]>=0){
                    if(i+1<R){
                        dp[i+1][j][0]=max(dp[i+1][j][0],dp[i][j][k]);
                    }
                    if(j+1<C){
                        dp[i][j+1][k]=max(dp[i][j+1][k],dp[i][j][k]);
                    }
                }
            }
        }
    }
    int ans=-INF;
    rep(i,4){
        ans=max(ans,dp[R-1][C-1][i]);
    }
    cout<<ans<<endl;



}


Measured memory_bytes: 361036
n = int(input())
s = [input() for i in range(n)]

fi = 0
sec = 0
thi = 0
forth = 0

for i in range(n):
    cnt =  s[i].count("AB")
    if cnt>=1:
        fi+=cnt

    syo = s[i][0]
    saigo = s[i][-1]

    if syo =="B" and saigo == "A":
        sec+=1
    elif syo == "B":
        thi+=1
    elif saigo=="A":
        forth+=1

su=0
if sec>=1:
    su += sec-1

su+=fi

if sec>=1:
    su+=min(1,thi)
    su+=min(1,forth)
    su+=min(thi-min(1,thi),forth-min(1,forth))
else:
    su+=min(thi,forth)

#print(fi,sec,thi,forth)
print(su)


Measured memory_bytes: 3700
#include <stdio.h>

int main(void) {

	int i, n, x;

	scanf("%d", &n);

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

		if (x % 3 == 0) {
			printf(" %d", x);
			continue;
		}

		 if (x % 10 == 3) {

			printf(" %d", i);
			continue;

		}

		 do {

			 if (x % 10 == 3) {
				 printf(" %d", i);
				 break;
			 }
			 else
				 x /= 10;

		 } while(x != 0);

	
		
	}
printf("\n");

	return(0);

}


Measured memory_bytes: 2100
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

INF = 999999999999999999999999
MOD = 10**9+7

x,n = get_nums_l()
if n == 0:
    print(x)
    exit()
P = set(get_nums_l())

log(P)

min_ = INF
ans = INF

for a in range(-1, 102):
    if a not in P:
        y = abs(x-a)
        # log(a, y)
        if y < min_:
            min_ = y
            ans = a

print(ans)

Measured memory_bytes: 67600