akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

#define BLACK 0
#define GRAY 1
#define WHITE 2
#define N_MAX 101
#define INF 9999999

int A[N_MAX][N_MAX];
int color[N_MAX], d[N_MAX];
int Queue[1000];
int start, end;
int n;

void BFS(int);
void init();

int main() {
	int i, j, k, num, to;
	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d %d", &num, &k);
		for (j = 0; j < k; j++) {
			scanf("%d", &to);
			A[num - 1][to - 1] = 1;
		}
	}

	BFS(0);
	for (i = 0; i < n; i++) {
		printf("%d %d\n", i + 1, d[i]);
	}
	return 0;
}

void init() {
	int i;
	for (i = 0; i < N_MAX; i++) {
		color[i] = WHITE;
		d[i] = INF;
	}
	start = end = 0;
}

void BFS(int a) {
	int b, c;
	int i, j;
	init();
	color[a] = GRAY;
	d[a] = 0;
	Queue[end] = a;
	end++;
	while (start != end) {
		b = Queue[start];
		start++;
		for (c = 0; c < n; c++) {
			if (color[c] == WHITE) {
				if (A[b][c] == 1) {
					color[c] = GRAY;
					d[c] = d[b] + 1;
					Queue[end] = c;
					end++;
				}
			}
			color[b] = BLACK;
		}
	}
	for (i = 0; i < N_MAX; i++) {
		if (d[i] == INF) d[i] = -1;
	}
}


Measured memory_bytes: 2140
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a[3] = {};
  int b[3] = {};
  for (int i = 0; i < 3; ++i) {
    cin >> a[i] >> b[i];
  }
  bool can = false;

  int order[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2},
                     {1, 2, 0}, {2, 0, 1}, {2, 1, 0}};

  for (int o = 0; o < 6; ++o) {
    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 2; ++j) {
        for (int k = 0; k < 2; ++k) {
          int x[6];
          if (i == 0) {
            x[0] = a[order[o][0]];
            x[1] = b[order[o][0]];
          } else {
            x[0] = b[order[o][0]];
            x[1] = a[order[o][0]];
          }

          if (j == 0) {
            x[2] = a[order[o][1]];
            x[3] = b[order[o][1]];
          } else {
            x[2] = b[order[o][1]];
            x[3] = a[order[o][1]];
          }

          if (k == 0) {
            x[4] = a[order[o][2]];
            x[5] = b[order[o][2]];
          } else {
            x[4] = b[order[o][2]];
            x[5] = a[order[o][2]];
          }

          if (x[1] == x[2] && x[3] == x[4]) {
            can = true;
            goto BREAK;
          }
        }
      }
    }
  }

BREAK:
  if (can) {
    cout << "YES"
         << "\n";
  } else {
    cout << "NO"
         << "\n";
  }
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0073

"""
import sys
from sys import stdin
input = stdin.readline


def solve(x, h):
    ans = x * x                 #  ?????¨?????¢???

    diagonal = (x**2 + x**2)**0.5 / 2   #  ?????????????????¢????????´????????????????????????????§??????§????????¢
    oblique = (diagonal**2 + h**2)**0.5 #  ????§???¢?????????
    # ??????????????¬???
    s = (x + oblique + oblique) / 2
    triangle = (s * (s - x) * (s - oblique) * (s - oblique))**0.5 #  ????§???¢ 1????????¢???
    
    triangle *= 4               #  ????§??????????????§???¢???4??¢???????????§?????¨??¨?????¢???????¨????
    ans += triangle
    return ans


def main(args):
    while True:
        x = int(input())
        h = int(input())
        if x == 0 and h == 0:
            break
        result = solve(x, h)
        print('{:.6f}'.format(result))


if __name__ == '__main__':
    main(sys.argv[1:])
    

Measured memory_bytes: 7752
#include <bits/stdc++.h>
using namespace std;
int main(){
 int k;
 string s;
 cin >>k >> s;
 if(s.length() <= k){
 	cout<<s<<"\n";
 }
 else {
 	string str = "";
 	for(int i=0;i<k;i++){
 		str = str+s[i];
 	}
 	str += '.';
 	str += '.';
 	str += '.';
 	cout<<str<<"\n";
 }
  return 0;
	
}


Measured memory_bytes: 3628
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <vector>
#include <cstring>
#include <queue>
#include <map>
#include <set>

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

typedef long long ll;
typedef vector<int> vi; 
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define present(i, c) ((c).find(i) != (c).end())
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i <= n; i++)
#define foreach(i, c) for(auto i : c)

#define TRACE(x...) x
#define watch(x) TRACE(cerr << #x" = " << x << endl)
#define watchc(x) TRACE(cerr << #x" = "); for(auto __i : x) cerr << __i << " "; cerr << endl

#define INF 0x3f3f3f3f

int a[200001];
int h[200001];
vector<int> v;

void get_mod(int x, int level) {
    //watch(x);
    v.pb(x);
    if(h[x] > 0) return;
    h[x]++;
    get_mod(a[x], level+1);
}

int main() {
	
	ifstream infile("input.in");
	if(infile.good()) cin.rdbuf(infile.rdbuf());

    ll n, k;
    cin >> n >> k;

    rep1(i, n) cin >> a[i];

    memset(h, 0, sizeof h);
    v.clear();

    get_mod(1, 0);
    //watchc(v);

    int lst = v[sz(v)-1];
    v.pop_back();
    int i = 0;
    while(v[i] != lst && i < k) i++;
    if(i == k) {
        cout << v[i] << endl;
        return 0;
    }
    ll m =sz(v) - i;
    k -= i;
    ll km = k % m;
    //watch(m); watch(km);

    int res = v[i];
    rep1(i, km) res = a[res];

    cout << res << endl;
	
	if(infile.good()) infile.close();
	return 0;
	
}



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

using namespace std;


constexpr long long mod = 1000000007;
constexpr long long INF = mod * mod;

int main() {
    int n;
    cin >> n;
    vector<long long> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    long long sum = 0;
    for(int i = 0; i < n; i++) {
        sum += a[i];
    }
    long long ans = INF;
    long long range_sum = 0;
    for(int i = 0; i < n; i++) {
        range_sum += a[i];
        ans = min(ans, abs(range_sum - (sum - range_sum)));
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4768
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

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

int n, m;
vector<int> sub, ans;
vector<vector<int>> edge;

void dfs1(int v, int par){
    for(int u : edge[v]){
        if(u == par){
            continue;
        }
        dfs1(u, v);
        sub[v] *= (sub[u] + 1) % m;
        sub[v] %= m;
    }
}

void dfs2(int v, int par, int parSub){
    vector<int> left(SZ(edge[v]) + 1, 1), right(SZ(edge[v]) + 1, 1);
    rep(i, SZ(edge[v])){
        if(edge[v][i] == par){
            left[i+1] = left[i];
            continue;
        }
        left[i+1] = left[i] * ((sub[edge[v][i]] + 1) % m);
        left[i+1] %= m;
    }
    for(int i = SZ(edge[v]); i > 0; i--){
        if(edge[v][i-1] == par){
            right[i-1] = right[i];
            continue;
        }
        right[i-1] = right[i] * ((sub[edge[v][i-1]] + 1) % m);
        right[i-1] %= m;
    }

    /*
    cout << v << endl;
    rep(i, SZ(edge[v]) + 1){
        cout << left[i] << " ";
    }
    cout << endl;
    rep(i, SZ(edge[v]) + 1){
        cout << right[i] << " ";
    }
    cout << endl;
    */

    rep(i, SZ(edge[v])){
        if(edge[v][i] == par){
            continue;
        }
        int tmp = (parSub + 1) % m;
        tmp *= left[i];
        tmp %= m;
        tmp *= right[i+1];
        tmp %= m;
        ans[edge[v][i]] = sub[edge[v][i]] * ((tmp + 1) % m) % m;

        dfs2(edge[v][i], v, tmp);
    }
}

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

    cin >> n >> m;
    edge = vector<vector<int>>(n + 1, vector<int>());
    rep(i, n - 1){
        int x, y;
        cin >> x >> y;
        edge[x].push_back(y);
        edge[y].push_back(x);
    }

    sub = vector<int>(n + 1, 1);
    ans = vector<int>(n + 1);

    dfs1(1, 0);
    /*
    rep(i, n){
        cout << sub[i+1] << " ";
    }
    cout << endl;
    */

    dfs2(1, 0, 0);
    ans[1] = sub[1];
    rep(i, n){
        cout << ans[i+1] << endl;
    }

    return 0;
}


Measured memory_bytes: 20992
import sys
import os

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    K, X = list(map(int, sys.stdin.buffer.readline().split()))
    print('Yes' if K*500 >= X else 'No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int s = stdIn.nextInt();
		int h = s/60/60;
		s = s-(h*60*60);
		int m = s/60;
		s = s-(m*60);
		System.out.println(h+":"+m+":"+s);
	}
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
ll const MOD = 998244353;
// ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}

//Graph in adjcency list
struct Graph{
    struct Edge{
        int from;
        int to;
        ll cost;
        Edge(int a, ll b) : to(a), cost(b) {}
        Edge(int a, int b, ll c) : from(a), to(b), cost(c) {}
    };

    int N;  //頂点数
    vector<vector<Edge>> edges;   //隣接リスト
    vector<ll> dist;   //ノードの深さ
    ll diam;            //木の直径
    vector<int> deg;    //入次数
    vector<int> cycle;  //サイクル

    Graph(int n) : N(n), edges(n), dist(n, INF), diam(INF), deg(n, 0){}

    void connect(int a, int b, ll c){   //辺を追加
        edges[a].emplace_back(Edge(a, b, c));
        deg[b]++;
    }

    bool visited(int v){
        return dist[v] < INF;
    }

    void resetDist(){
        for(int i=0; i<N; i++){
            dist[i] = INF;
        }
    }

    ll dfs(int p, int v){    //深さ優先探索
        if(visited(v)) return 0;

        dist[v] = 1;

        ll res = 1;

        /*
        if(edges[v].size() == 0){
            return 1;
        }else if(edges[v].size() == 1){
            return dfs(v, edges[v][0].to) + 1;
        }
        */

        for(auto e : edges[v]){
            if(e.to == p) continue;
            ll r = dfs(v, e.to) + 1;
            res *= r;
            res %= MOD;
        }

        if(p == -1) res++;
        return res;
    }
};


signed main(){
    int n;
    cin >> n;
    vector<pair<ll,ll>> v(n);
    for(auto& i : v) cin >> i.first >> i.second;

    sort(all(v), [](auto a, auto b){return a.first < b.first;});

    vector<int> par(n, -1);
    priority_queue<int, vector<int>, greater<int>> que;

    RREP(i, n){
        while(!que.empty()){
            int a = que.top();
            if(v[i].first + v[i].second > v[a].first){
                par[a] = i;
                que.pop();
            }else{
                break;
            }
        }
        que.push(i);
    }

    ll ans = 1;

    Graph G(n);
    REP(i, n){
        if(par[i] >= 0){
            G.connect(par[i], i, 1);
        }
    }

    REP(i, n){
        if(par[i] == -1){
            ans *= G.dfs(-1, i);
            ans %= MOD;
        }
    }

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


Measured memory_bytes: 24064
a = []
for _ in range(3):
    a.append(list(map(int,input().split())))

n = int(input())
b = []
for _ in range(n):
    b.append(int(input()))

for i in b:
    for j in range(3):
        for k in range(3):
            if a[j][k] == i:
                a[j][k] = True
ans = "No"
for i in a:
    if i.count(True) == 3:
        ans = "Yes"

for i in range(3):
    if a[0][i] == True and a[1][i] == True and a[2][i] == True:
        ans = "Yes"

if a[0][0] == True and a[1][1] == True and a[2][2] == True:
    ans = "Yes"
if a[0][2] == True and a[1][1] == True and a[2][0] == True:
    ans = "Yes"

print(ans)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	set<ll> a;
	for (ll i = 0; i < n; i++)
	{
		ll q, x;
		cin >> q;

		switch (q)
		{
			case 0:
				cin >> x;
				a.insert(x);
				println(a.size());
				break;

			case 1:
				cin >> x;
				if (a.count(x))
				{
					println(1);
				}
				else
				{
					println(0);
				}
				break;

			case 2:
				cin >> x;
				a.erase(x);
				break;

			case 3:
				ll l, r;
				cin >> l >> r;

				for (auto it = a.equal_range(l).first; it != a.equal_range(r).second; it++)
				{
					println(*it);
				}
				break;
		}
	}

}





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

int main()
{
int a;
int e;
int k;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> a;
	cin >> e;
	cin >> e;
	cin >> e;
	cin >> e;
	cin >> k;

	if( ( e - a ) > k )
		cout << ":(" << endl;
	else
		cout << "Yay!" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define INF 1000000007
using namespace std;

int main(void){
	long long x,y,ans=1,temp;
	cin >> x >> y;
	temp=x;
	while(temp*2<=y){
		ans++;
		temp*=2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE NumericUnderscores #-}
import Data.Char (isSpace)
import Data.List
import Control.Monad
import Control.Monad.Trans.Maybe
import Control.Monad.ST
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS
import qualified Test.QuickCheck as QC
import Data.Coerce

isPairwiseCoprime_naive :: Int -> U.Vector Int -> Bool
isPairwiseCoprime_naive _mbound xs = and [ gcd x y == 1 | x:ys <- tails (U.toList xs), y <- ys ]

toHistogram :: Int -> U.Vector Int -> U.Vector Int
toHistogram mbound xs = U.create $ do
  m <- UM.replicate (mbound + 1) (0 :: Int)
  U.forM_ xs $ \x -> do
    UM.modify m (+ 1) x
  return m

isPairwiseCoprime :: Int -> U.Vector Int -> Bool
isPairwiseCoprime !mbound !xs = maybe False (const True) $ runST $ runMaybeT $ do
  let !m = toHistogram mbound xs
  sieve <- UM.replicate (mbound + 1) True
  UM.write sieve 0 False
  UM.write sieve 1 False
  forM_ [2..mbound] $ \i -> do
    t <- UM.read sieve i
    when t $ do
      let loop !j !u | u >= 2 = return True --break
                     | j > mbound = return False
                     | otherwise = do
                         UM.write sieve j False
                         loop (j + i) (u + m U.! j)
      shouldBreak <- loop (2 * i) (m U.! i)
      when shouldBreak mzero
  return () -- The answer is "Yes" -- pairwise coprime

isSetwiseCoprime :: U.Vector Int -> Bool
isSetwiseCoprime xs = U.foldl' gcd 0 xs == 1 -- not best

main = do
  n <- readLn @Int
  xs <- U.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  let mbound = U.maximum xs
  if isPairwiseCoprime mbound xs then
    putStrLn "pairwise coprime"
  else if isSetwiseCoprime xs then
    putStrLn "setwise coprime"
  else
    putStrLn "not coprime"

prop :: QC.NonEmptyList (QC.Positive Int) -> QC.Property
prop xs' = let xs = U.fromList (coerce xs') :: U.Vector Int
               mbound = U.maximum xs
           in isPairwiseCoprime mbound xs QC.=== isPairwiseCoprime_naive mbound xs

runTest :: IO ()
runTest = QC.quickCheck $ QC.withMaxSuccess 1000 $ QC.mapSize (* 1000) prop


Measured memory_bytes: 40680
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD 1000000007
void bulk(){}template<class H,class...T>void bulk(H&h,T&...t){cin>>h;bulk(t...);}
#define get(...) int __VA_ARGS__; bulk(__VA_ARGS__);

int digsum(int n){if(n<10)return n; return n%10+digsum(n/10);}

int main(){
	get(n);
	rep(i,INF){
	    n-=i;
	    if(n<=0){cout<<i<<endl;return 0;}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVL vector<vector<ll>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<ll,ll>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;
constexpr ll MOD = 1000000007;
using std::cout;
using std::endl;
using std::cin;
using std::sort;
using std::pair;
using std::string;
using std::stack;
using std::vector;
using std::list;
using std::map;
using std::unordered_map;
using std::multimap;
using std::unordered_multimap;
using std::set;
using std::unordered_set;
using std::multiset;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll pow(ll a, ll b) {
	ll ans = 1;
	while (b > 0) {
		if (b % 2 == 1) {
			ans *= a;
			ans %= MOD;
		}
		b /= 2;
		a *= a;
		a %= MOD;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a - b < b) { return comb(a, a - b); }
	ll c = 1;
	FOR(i, a - b + 1, a + 1) {
		c *= i;
		c %= MOD;
	}
	ll k = 1;
	FOR(i, 2, b + 1) {
		k *= i;
		k %= MOD;
	}
	c *= pow(k, MOD - 2);
	return c % MOD;
}
multiset<ll> prime_decomposition(ll n) {
	ll i = 2;
	multiset<ll> table{};
	while (i * i <= n) {
		while (n % i == 0) {
			n /= i;
			table.emplace(i);
		}
		++i;
	}
	if (n > 1) {
		table.emplace(n);
		return table;
	}
	return table;
}

int main() {
	ll n;
	cin >> n;
	VL a(n), b(n), c(n);
	REP(i, n) { cin >> a[i]; }
	REP(i, n) { cin >> b[i]; }
	REP(i, n) { cin >> c[i]; }
	sort(ALL(a));
	sort(ALL(b));
	sort(ALL(c));

	VL bc(n + 1, 0);
	REP(i, n) {
		auto itrc = std::upper_bound(ALL(c), b[i]);
		bc[i + 1] = c.end() - itrc + bc[i];
	}
	
	ll ans = 0;
	REPC(x, a) {
		auto itrb = std::upper_bound(ALL(b), x);
		ll i = itrb - b.begin();
		ans += bc[n] - bc[i];
	}

	cout << ans << endl;
	
}

Measured memory_bytes: 3328
#include<stdio.h>
#define MAX 100

int main(void){
	int adj[MAX+1][MAX+1];
	int i,j,n,u,k,v;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++)adj[i][j]=0;
	}
	for(i=0;i<n;i++){
		scanf("%d %d",&u,&k);
		for(j=0;j<k;j++){
			scanf("%d",&v);
			adj[u][v]=1;
		}
	}
	
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			printf("%d",adj[i][j]);
			if(j!=n)printf(" ");
		}
		printf("\n");
	}
	return 0;
}



Measured memory_bytes: 1852
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel" << endl;
  }
  
  else {
    cout << "consonant" << endl;
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF=999999999;
char a[10][10];
int main() {
    string S;
    cin>>S;
    string T[4]={"dream", "dreamer", "erase", "eraser"};
    reverse(S.begin(),S.end());
    for(int i=0;i<4;i++){reverse(T[i].begin(),T[i].end());}

    bool can=true;
    for(int i=0;i<S.size();){
      bool canT=false;
      for(int j=0;j<4;j++){
        string d=T[j];
        if(S.substr(i,d.size())==T[j]){
          canT=true;
          i+=d.size();
        }
        }
        if(canT==false){can=false;break;}
      }
    if(can){cout<<"YES"<<endl;}
    else{cout<<"NO"<<endl;}
    
    
 return 0;}

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> lb(n, 0); // 左からの黒の累積和
  vector<int> rw(n, 0); // 右からの白の累積和
  rep(i, n) {
    int tmp;
    if (i == 0) {
      tmp = 0;
    } else {
      tmp = lb.at(i - 1);
    }
    char c = s[i];
    if (c == '#') {
      tmp++;
    }
    lb.at(i) = tmp;
  }
  per(i, n) {
    int tmp;
    if (i == n - 1) {
      tmp = 0;
    } else {
      tmp = rw.at(i + 1);
    }
    char c = s[i];
    if (c == '.') {
      tmp++;
    }
    rw.at(i) = tmp;
  }
  // 白と黒の境目をすべて試す
  int res = INT_MAX;
  for (int i = 0; i <= n; i++) {
    int tmp = 0;
    // 黒を白にする数
    if (i != 0) {
      tmp += lb.at(i - 1);
    }
    // 白を黒にする数
    if (i != n) {
      tmp += rw.at(i);
    }
    res = min(res, tmp);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 5208
n = gets.to_i
a = gets.split.map(&:to_i)
b = [0]*n
z = a.inject(:+)

b[-1] = a[-1]*2
n.times{|i|
  b[i] = (a[i-1] - b[i-1]/2)*2
}

z -= b.inject(:+)
puts n.times.map{|i| b[i]+z*[1,-1][i%2]}*" "

Measured memory_bytes: 14980
n=int(input())
if n<600:
  print('8')
elif n<800:
  print('7')
elif n<1000:
  print('6')
elif n<1200:
  print('5')
elif n<1400:
  print('4')
elif n<1600:
  print('3')
elif n<1800:
  print('2')
else:
  print('1')

Measured memory_bytes: 9176
import java.util.Scanner;

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

	int a = scan.nextInt();
	int b = scan.nextInt();

	if(a <= b){
	    System.out.println(a);
	}else{
	    System.out.println(a-1);
	}
    }
}


Measured memory_bytes: 23124
// https://atcoder.jp/contests/abc058/tasks/abc058_b

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  string o, e, r;

  cin >> o >> e;

  ll len = o.length();
  ll len2 = e.length();
  REP(i, len)
  {
    r += o[i];
    if (i <= len2 - 1)
      r += e[i];
  }

  cout << r << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi; 
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(int)(b);i++)
#define per(i,a,b) for(int i=(a);i>=(int)(b);i--)
const int mod = 1e9+7;
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
int main()
{
    ios::sync_with_stdio(false);cin.tie(nullptr);
    string a,b;
    cin>>a>>b;
    int len1=a.size(),len2=b.size();
    int ans=inf;
    rep(i,0,len1-len2) {
        int now=0;
        rep(j,0,len2-1) {
            if(a[i+j]!=b[j]) now++;
        }
        ans=min(ans,now);
    }
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 3652
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let X: Vec<char> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().chars().collect()
    };

    let (m, _) = X.iter()
        .fold((0, 0), |(res, s), &x|
            if x == 'S' { (res, s + 1) }
            else { (res + std::cmp::min(1, s), std::cmp::max(0, s - 1)) }
        );
    let ans = (X.len() as i64) - 2 * m;

    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <queue>
#define NIL -1
using namespace std;

struct Node{
  int parent, left, right;
};

int depth[25];
int height[25];
Node tree[25];
int n;

int setDepth(int x, int d){
  depth[x] = d;
  if(tree[x].left != NIL)
    setDepth(tree[x].left, d + 1);
  if(tree[x].right != NIL)
    setDepth(tree[x].right, d+1);
}

int setHeight(int x, int h){
  height[x] = max(height[x], h);
  
}

int main(){
  cin >> n;
  for(int i = 0; i < n; i++){
    tree[i].parent= tree[i].left = tree[i].right = NIL;
  }
  for(int i = 0; i < n; i++){
    int id, left, right;
    cin >> id >> left >> right;
    tree[id].left = left;
    tree[id].right = right;
    tree[left].parent = id;
    tree[right].parent = id;
  }
  int root;
  for(int i = 0; i < n; i++){
    if(tree[i].parent == NIL)
      root = i;
  }
  setDepth(root,0);

  
  queue<int> heightQueue;
  for(int i = 0; i < n; i++){
    if(tree[i].left == NIL && tree[i].right == NIL){
      heightQueue.push(i);
    }
  }
  while(!heightQueue.empty()){
    if(tree[heightQueue.front()].parent != NIL){
      if(height[tree[heightQueue.front()].parent] < height[heightQueue.front()] + 1){
	height[tree[heightQueue.front()].parent] = height[heightQueue.front()] + 1;
	heightQueue.push(tree[heightQueue.front()].parent);
      }
    }
    heightQueue.pop();
  }

  for(int i = 0 ; i < n; i++){
    cout << "node " << i << ": parent = " << tree[i].parent;
    if(i == root)
      cout << ", sibling = -1, ";
    else if(tree[tree[i].parent].left == i)
      cout << ", sibling = " << tree[tree[i].parent].right << ", ";
    else
      cout << ", sibling = " << tree[tree[i].parent].left << ", ";
    int degree = 0;
    if(tree[i].left != NIL) degree++;
    if(tree[i].right != NIL) degree++;
    cout << "degree = " << degree << ", ";
    cout << "depth = " << depth[i] << ", ";
    cout << "height = " << height[i] << ", ";
    if(tree[i].parent == NIL)
      cout << "root" << endl;
    else if(tree[i].left == NIL && tree[i].right == NIL)
      cout << "leaf" << endl;
    else
      cout << "internal node" << endl;

  }
    
}

Measured memory_bytes: 3052
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int N; cin >> N;
  if(N == 0) cout << 1 << endl;
  else cout << 0 << endl;
    

}


Measured memory_bytes: 3628
import numpy as np
N = int(input())
a = list(map(int,input().split()))
tmp = a[0]
S = sum(a)
ans = np.abs(S-2*tmp)
for i in range(1,N-1):
    tmp += a[i]
    ans = min(ans,np.abs(S-2*tmp))
    
print(ans)
    
    

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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

string s;

int main() {
	ios::sync_with_stdio(0);
	cin >> s;
	loop (i, s.size()) {
		if (s[i] == '?') s[i] = 'D';
	}
	cout << s << ln;
}

Measured memory_bytes: 3788
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int D = sc.nextInt();
		int T = sc.nextInt();
		int S = sc.nextInt();

		if(T*S >= D) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 35676
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

const int My_Inf = 2147483647;
const long long int My_LInf = 9223372036854775807;

struct plant {
	double fertrate;

	double lovewater;
	double vital;
};
double pw;
vector<plant>plants;

double getmon(const double water) {
	double ans = water*pw;
	for (auto p:plants) {
		double rest = p.vital - water*p.lovewater;
		if (rest < 0) {
			ans += 0;
		}
		else {
			ans += rest / p.fertrate;
		}
	}
	return ans;
}

int main() {
	while (1) {
		plants.clear();
		int N; cin >> N; if (!N)break;
		cin >> pw;
		for (int i = 0; i < N; ++i) {
			double vw, pf, vf, t; cin >> vw >> pf >> vf >> t;
			double fertrate = vf / pf;
			double water= vw;
			plants.push_back(plant{ fertrate,water,t });

		}
		double amin = 0;
		double amax = 100;
		while (amin < amax - 1e-9) {
			double amid1 = (amin * 2 + amax) / 3;
			double amid2 = (amin + amax * 2) / 3;
			double mon1 = getmon(amid1);
			double mon2 = getmon(amid2);
			if (mon1 < mon2) {
				amax = amid2;
			}
			else {
				amin = amid1;
			}
		}
		double ans = getmon((amin+amax)/2);
		cout <<setprecision(22)<<fixed<< ans << endl;
	}
	return 0;
}

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

const int MAX = 510000;
const int MOD = 1000000007;

//fac[i] = i!, finv[i] = (i!)^-1 , inv[i] = i^-1
long long fac[MAX], finv[MAX], inv[MAX];

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}//modinv(i,mod)でi^-1のmodをとる。

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}//modpow(a,n,mod)でa^nのmodをとる

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算(nCk)
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    ll N; cin >> N;
    vector<ll> x(N);
    rep(i, 0, N) cin >> x[i];

    COMinit();
    ll ans = 0;
    ll memo = 1;
    rep(i, 1, N){
        ans += (x[i] - x[i-1]) * memo % MOD;
        ans %= MOD;
        memo += inv[i+1];
        memo %= MOD;
    }
    ans *= fac[N-1];
    ans %= MOD;
    cout << ans << endl;

}

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

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Set<String> set = new HashSet<>();

		for (int i = 0; i < n; i++) {
			set.add(scanner.next());
		}

		if (set.size() == 3)
			System.out.println("Three");
		else
			System.out.println("Four");

	}

}


Measured memory_bytes: 22996
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	char a[17],b[17],c[17];
	scanf("%s %s %s",a,b,c);
	if(a[strlen(a) - 1] == b[0] && b[strlen(b) - 1] == c[0])	puts("YES");
	else puts("NO");
	return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

string s;
int K;

int main() {
    cin >> K;
    cin >> s;

    if (s.size() <= K) {
        cout << s << '\n';
        return 0;
    }

    string answer = s.substr(0, K) + "...";
    cout << answer << '\n';

    return 0;
}

Measured memory_bytes: 3628
import java.io.*;
  
public class Main {
  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String input = br.readLine();
    int s = Integer.parseInt(input);
    int h = (int) s / 3600;
    s -= h * 3600;
    int m = (int) s / 60;
    s -= m * 60;
  
    System.out.println(h + ":" + m + ":" + s);
  }
}

Measured memory_bytes: 24176
#!/usr/bin/env python3

def main():
    N = int(input())
    MARCH = 'MARCH'
    count = [0 for i in range(5)]
    for i in range(N):
        s = input()
        if s[0] in MARCH:
            idx = MARCH.index(s[0])
            count[idx] += 1

    total = 0
    for i in range(5):
        for j in range(i + 1, 5):
            for k in range(j + 1, 5):
                total += count[i] * count[j] * count[k]

    print(total)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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;
}

signed main() {
  init();
  ll N, A, B;
  cin >> N >> A >> B;
  ll ans = min(N * A, B);
  COUT(ans);
  return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int n;
    cin >> n;
    vi t(n+1), x(n+1), y(n+1);
    rep(i, n) cin >> t[i+1] >> x[i+1] >> y[i+1];
    bool f = true;
    REP(i, 1, n+1) {
        int d = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]);
        int tt = t[i] - t[i-1];
        if(d > tt || (tt - d) % 2 == 1) f = false;
    }
    string yes = "Yes", no = "No";
    cout << (f ? yes : no) << endl;
    return 0;
}

Measured memory_bytes: 1408
def calc(x):
    if x % 4 == 1:
        return 1
    if x % 4 == 3:
        return 0
    
    if x % 4 == 2:
        return 1 + x
    else:
        return x


# 1,5,9,13,... => 1
# 3,7,11,15,... => 0
A, B = map(int, input().split())
x = calc(A - 1)
y = calc(B)
print(x ^ y)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f; 
typedef long long ll;
ll p=998244353;

ll jie[200005];
ll in[200005];

long long mul(long long a,long long b) //此函数是对两个数相乘可能超范围的处理 
{
    long long ans=0;
    while(b) 
    {
        if(b&1) ans=(ans+a)%p; 
        a=(a+a)%p;
        b>>=1;//b/=2
    }
    return ans;
}
long long surplus(long long a,long long b)
{	
	if(b==0&&p==1)return 0;
    long long result=1;
    long long base=a%p;
    while(b)
    {
        if(b&1) result=mul(result,base)%p;//如果模不超int，这里追求快速的话可以省去mul 
        base=mul(base,base)%p;
        b>>=1;//b/=2
    }
    return result;
}
ll inv(ll x) {
	return surplus(x, p - 2);
}
 
void init() {
	jie[0] = 1;
	for(int i = 1; i <= 200000; i++)
		jie[i] = jie[i-1] * i % p;
 
	in[200000] = inv(jie[200000]) % p;
	for(int i = 200000; i > 0; i--)
		in[i-1] = in[i] * i % p; // (i-1)!'s inv ************
}
 
ll C(ll a, ll b) { // a * inv(b) % mod;
	if( a < 0 || b > a) return 0;
	// show3(jie[a], in[b], in[a-b]); in[0]=1
	return jie[a] * in[b] % p * in[a - b] % p;
 
	// inv(b!)*inv((a-b)!)
}

ll bfx[200005];
int main(){
	ll n,m,k,i,j;
	cin>>n>>m>>k;
	init();
	ll ans=0;
	bfx[n-1-k]=surplus(m-1,n-1-k);
	for(i=1;i<=k;i++){
		bfx[n-1-k+i]=(bfx[n-2-k+i]*(m-1))%p;
	}
	for(i=0;i<=k;i++){
		ans=(ans+(bfx[n-1-i]*C(n-1,i))%p)%p;
	}
	ans=(ans*m)%p;
	cout<<ans;
    return 0;
}


Measured memory_bytes: 8284
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define FLSH fflush(stdout)
#define ll long long int
#define pb push_back
#define mp make_pair
#define in insert
#define MOD 1000000007
#define debug(x) cout << "[ " << #x  << " : " << x << " ]" << endl;

using namespace std;

int main(){

	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	ll k;
	cin >> k;

	ll a = 100;
	ll t;
	for (t = 0; t < 100000000; ++t)
	{
		if(a >= k)
			break;
		a = a*(1.01);
	}
	cout << t << endl;



}

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

int dist[25][25], used[25][25] = {};
string mt[25];
int ans = 0;

void bfs(int a, int b){
    queue<pair<int, int>> q;
    q.push({a, b});
    dist[a][b] = 0;
    used[a][b] = 1;
    while(q.size()){
        auto curr = q.front();
        int i = curr.first, j = curr.second;
        ans = max(ans, dist[i][j]);
        q.pop();
        if(mt[i-1][j] != '#' && !used[i-1][j]){
            q.push({i-1, j});
            dist[i-1][j] = dist[i][j]+1;
            used[i-1][j] = 1;
        }
        if(mt[i+1][j] != '#' && !used[i+1][j]){
            q.push({i+1, j});
            dist[i+1][j] = dist[i][j]+1;
            used[i+1][j] = 1;
        }
        if(mt[i][j-1] != '#' && !used[i][j-1]){
            q.push({i, j-1});
            dist[i][j-1] = dist[i][j]+1;
            used[i][j-1] = 1;
        }
        if(mt[i][j+1] != '#' && !used[i][j+1]){
            q.push({i, j+1});
            dist[i][j+1] = dist[i][j]+1;
            used[i][j+1] = 1;
        }
    }
}

int main()
{
    int n, m;cin>>n>>m;
    string temp = "";
    for(int i=1;i<=m+2;i++)
        temp += "#";
    mt[0] = temp;
    mt[n+1] = temp;
    for(int i=1;i<=n;i++){
        cin>>mt[i];
        mt[i] = "#" + mt[i] + "#";
    }
    // bfs(1, 1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++){
            if(mt[i][j] != '#'){
                for(int i=1;i<=n;i++)
                    for(int j=1;j<=m;j++){
                        used[i][j] = 0;
                    }
                bfs(i, j);
            }
            
        }
    cout<<ans<<endl;
    return 0;
}


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

string s;

int main()
{
  int ans=0;
  cin >> s;

  for (int i=1; i<s.size(); i++) {
    if (s[i] == s[i-1]) {
      if (s[i] == '0') {
        s[i] = '1';
      } else {
        s[i] = '0';
      }
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define VS vector<string>
#define ll long long int
#define debug(x) cout << x << " :" <<#x << endl  
int main(void) {
    ll x, y;
    cin >> x >> y;

    if(abs(x - y) <= 1) cout << "Brown" << endl;
    else cout << "Alice" << endl;                                                                   
}


Measured memory_bytes: 256
#include<algorithm>
#include <bits/stdc++.h>
#include <math.h>
#include <queue>
using namespace std;
int main(void){
	int n,i,ma=0,mi=1000000000;
	cin>>n;
	int a;
	for(i=0;i<n;i++){
		cin>>a;
		ma=max(ma,a);
		mi=min(mi,a);
	}
	cout<<ma-mi<<endl;
	return 0;
}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved

int main(){
    
    long long now=100;

    long long x;
    cin>>x;
    long long ans=0;
    while(now<x){
    now=floor((double)now*1.01);
    ans++;
    }
    cout<<ans<<endl;
    return 0;

}
/*


*/


Measured memory_bytes: 3744
N,K,Q = map(int, input().split())

P = [0] * N


for i in range(Q):
	A = int(input())
	P[A-1] += 1


for j in range(0,len(P)):
	if K - Q + P[j] > 0:
		print('Yes')
	else:
		print('No')

Measured memory_bytes: 4680
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n, m, t;
	cin >> n >> m >> t;
	bool l[10010];
	for (int i = 0; i < t; i++){
		l[i] = true;
	}
	for (int i = 0; i < n; i++){
		int a; cin >> a;
		for (int i = a - m; i <= min(t, a + m - 1); i++) {
			l[i] = false;
		}
	}
	int sum = 0;
	for (int i = 0; i < t; i++){
		if (l[i] == true)sum++;
	}
	cout << sum << endl;
	char c; cin >> c;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=3e5+5;
const int MD=1e9+7;
int a[N][60],s[60];
int main() {
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		ll x;
		scanf("%lld",&x);
		for(int j=0;j<60;j++) {
			if((1LL<<j)&x) a[i][j]=1;
		}
	}
	ll ans=0;
	for(int i=1;i<=n;i++) {
		for(int j=0;j<60;j++) {
			if(a[i][j]) ans=(ans+(1LL<<j)%MD*(i-1-s[j])%MD)%MD;
			else ans=(ans+(1LL<<j)%MD*s[j]%MD)%MD;
		}
		for(int j=0;j<60;j++) s[j]+=a[i][j];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 70528
#include <iostream>
using namespace std;
int main(){
  char c;
  cin >> c;
  int a = 0;
  while(true){
    if(c-a=='a'){
      cout << "a" << endl;
      return 0;
    }else if(c-a=='A'){
      cout << "A" << endl;
      return 0;
    }else{
      a++;
    }
  }
}

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <cmath>
#include <bitset>
#include <string>
#define REP(i,n) for(int i=0;i<n;i++)
using Int = long long;
using namespace std;
int main()
{
    string s; cin >> s;
    int i, j;
    for (i = 0; i < s.size(); i++) {
        if (s[i] == 'A') break;
    }
    for (j = s.size() - 1; j >= 0; j--) {
        if (s[j] == 'Z') break;
    }
    cout << (j - i + 1) << endl;
    return 0;
}

Measured memory_bytes: 640
n = int(input())
a = list(map(int, input().split()))
b = [0] * n

for i in range(n):
    t = n - i - 1
    if i < n / 2:
        b[t] = a[t]
    else:
        to = 0
        j = 0
        for i in range(n // (t + 1)):
            to += b[(i + 1) * (t + 1) - 1]
        if to % 2 != a[t]:
            b[t] = 1

print(b.count(1))

for i in range(n):
    if b[i] == 1:
        print(i + 1, end=" ")


Measured memory_bytes: 7148
import java.util.*

fun main(args:Array<String>){
    var (n,k) = readLine()!!.split(" ").map{it.toInt()}
    val d = readLine()!!.split(" ").map{it.toInt()}.toSet()
    while(true){
        var t = n
        var ok = true
        while(t > 0){
            if(d.contains(t % 10)) ok = false
            t /= 10
        }
        if(ok){
            println(n)
            break
        }
        n++
    }
}


Measured memory_bytes: 36000
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int N;
  cin >> N;
  vector<ll> a(3*N);
  for (int i=0; i<3*N; i++) cin >> a[i];
  ll ans = 0LL;
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  for (int i=1; i<2*N; i++) {
    if (i%2!=0) ans += a[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>

typedef long long ll;
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a;
  char s[10];
  cin >> a;
  cin >> s;
  if(a >= 3200) {
    cout << s << "\n";
  } else {
    cout << "red\n";
  }
  return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
	int a, b;
	cin >> a >> b;
	if (a > 0)
		printf("Positive\n");
	else if (b >= 0)
		printf("Zero\n");
	else {
		b -= a;
		if (b & 1)
			printf("Positive\n");
		else
			printf("Negative\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main()
{
  string s;
  int k,ans;
  cin>>s>>k;

  rep(i,s.size())
  {

    if(s.at(i)!='1')
    {
      cout<<s.at(i)<<endl;
      break;
    }

    else if(s.at(i)=='1' && i==(k-1))
    {
      cout<<1<<endl;
      break;
    }
  }

}

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

int main() {
  int N , K , A ;
  cin >> N >> K;
  A = 1;

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

    if( A * 2 > A + K ){
      A = A + K;
    }    
    else if( A * 2 < A + K ){
      A = A * 2;
    }    
    else if( A * 2 == A + K ){
      A = A * 2;
    }

  }
  cout << A << endl;
}

Measured memory_bytes: 3584
open System

// prelude
let readStr () = stdin.ReadLine()

let readInt () = stdin.ReadLine() |> int
let readInts () = stdin.ReadLine().Split() |> Array.map int
let readInt64s () = stdin.ReadLine().Split() |> Array.map int64

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// start
let N=readInt()
let xy=[|for _ in 1..N -> readInt64s() |> pair|]

let r =
  seq {
    for i in 0..(N-1) do
      for j in 0..(N-1) do
        let (x1,y1)=xy.[i]
        let (x2,y2)=xy.[j]
        let (a,b)=(x1-x2,y1-y2)
        if a<>0L||b<>0L then
          yield (a,b)
  }
  |> Seq.fold (fun map x ->
    let v=
      map
      |> Map.tryFind x
      |> Option.getOr 0
    map
    |> Map.add x (v+1)
  ) Map.empty
  |> Map.fold (fun st _ x -> max st x) 0

printfn "%d" (N-r)
  

Measured memory_bytes: 17244