akhauriyash/Code-Regression huggingface dataset:
// C++ program to find the longest repeated
// non-overlapping substring
#include<bits/stdc++.h>
using namespace std;

// Returns the longest repeating non-overlapping
// substring in str
int longestRepeatedSubstring(string str)
{
	int n = str.length();
	int LCSRe[n+1][n+1];

	// Setting all to 0
	memset(LCSRe, 0, sizeof(LCSRe));

	string res; // To store result
	int res_length = 0; // To store length of result

	// building table in bottom-up manner
	int i, index = 0;
	for (i=1; i<=n; i++)
	{
		for (int j=i+1; j<=n; j++)
		{
			// (j-i) > LCSRe[i-1][j-1] to remove
			// overlapping
			if (str[i-1] == str[j-1] &&
				LCSRe[i-1][j-1] < (j - i))
			{
				LCSRe[i][j] = LCSRe[i-1][j-1] + 1;

				// updating maximum length of the
				// substring and updating the finishing
				// index of the suffix
				if (LCSRe[i][j] > res_length)
				{
					res_length = LCSRe[i][j];
					index = max(i, index);
				}
			}
			else
				LCSRe[i][j] = 0;
		}
	}

	// If we have non-empty result, then insert all
	// characters from first character to last
	// character of string
	if (res_length > 0)
		for (i = index - res_length + 1; i <= index; i++)
			res.push_back(str[i-1]);

	return res.size();
}

// Driver program to test the above function
int main()
{
    int n;
    cin>>n;
	string str;
	cin>>str;
	cout << longestRepeatedSubstring(str);
	return 0;
}


Measured memory_bytes: 97920
const main = (lines: string) => {
  const data = lines.split("\n");
  const [N, D] = data[0].split(" ").map(str => parseInt(str));
  const points = data
    .slice(1)
    .map(data => data.split(" ").map(str => parseInt(str)));

  let ans = 0;

  for (let i = 0; i < N - 1; i++) {
    for (let j = i + 1; j < N; j++) {
      let sumOfSquare = 0;
      for (let k = 0; k < D; k++) {
        sumOfSquare += Math.pow(points[i][k] - points[j][k], 2);
      }
      const distance = Math.sqrt(sumOfSquare);

      if (Number.isInteger(distance)) {
        ans += 1;
      }
    }
  }

  console.log(ans);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 11468
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
 
public class Main {
  public static void main(String... args) {
  	Scanner sc = new Scanner(System.in);
    Integer[] lines = new Integer[sc.nextInt()];
    
    for(int i = 0; sc.hasNext(); i++) {
      lines[i] = sc.nextInt();
    }
    
    List<Integer> list = Arrays.asList(lines);
    
    if(Collections.max(list) >= sum(list)) {
    	System.out.println("No");
    } else {
    	System.out.println("Yes");
    }
  }
  
  public static int sum(List<Integer> values) {
    int sum = 0;
    
    for(int value : values) {
      sum += value;
    }
    
    return sum - Collections.max(values);
  }
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <string.h>

int main(void) {
	char str[1001], tmp[1001], in[10];
	int q, a, b;
	int i;
	
	scanf("%s", str);
	scanf("%d", &q);
	
	while (q--) {
		scanf("%s %d %d", in, &a, &b);
		if (strcmp(in, "print") == 0) {
			for (i = a; i <= b; i++) putchar(str[i]);
			puts("");
		}
		else if (strcmp(in, "replace") == 0) {
			scanf("%s", tmp);
			strncpy(&str[a], tmp, b - a + 1);
		}
		else {		
			strcpy(tmp, str);
			for (i = 0; i <= b - a; i++) tmp[a + i] = str[b - i];
			strcpy(str, tmp);
		}
	}
	
	return 0;
}

Measured memory_bytes: 600
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
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;
	}
}

// 二項係数計算
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;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
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;
}

int main() {
	long long  int x;
	cin >> x;
	long long int ans = 0;
	ans = ans + x / 500 * 1000;
	x = x % 500;
	ans = ans + x / 5 * 5;
	cout << ans;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> ipair;
typedef pair<ll, ll> lpair;
// age, distance, v, from, color
typedef tuple<int, int, int, int, int> ituple;
priority_queue<ituple> q;

// const int INF = INT_MAX;
// const ll INF = LLONG_MAX;
// const int MOD = ((int)1e9 + 7);
// const ld EPS = (1e-10);
#define PI acosl(-1)
#define MAX_N (100000 + 2)
VI edge[MAX_N];
map<ipair, int> memo;
int colors[MAX_N];
int ages[MAX_N];
int vv[MAX_N];
int dd[MAX_N];
int cc[MAX_N];
int distances[MAX_N];

void exec(){
  int n, m, Q, a, b, tmp_v, tmp_d, tmp_c;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++){
    scanf("%d%d", &a, &b);
    edge[a].push_back(b);
    edge[b].push_back(a);
  }

  for (int i = 0; i < MAX_N; i++){
    distances[i] = -1;
  }

  scanf("%d", &Q);
  for (int j = 1; j <= Q; j++){
    scanf("%d%d%d", &vv[j], &dd[j], &cc[j]);
  }
  for (int j = Q; j >= 1; j--){
    q.push(ituple(j, dd[j], vv[j], -1, cc[j]));

    while (!q.empty()) {
      ituple e = q.top();
      q.pop();

      int v = get<2>(e);
      int from = get<3>(e);
      int d = get<1>(e);
      int age = get<0>(e);
      int color = get<4>(e);

      // printf("v = %d, from = %d, d = %d, age = %d, color = %d\n", v, from, d, age, color);

      if (distances[v] != -1 && d <= distances[v]) {
        continue;
      }

      if (ages[v] == 0 || ages[v] < age) {
        ages[v] = age;
        colors[v] = color;
      }

      distances[v] = d;

      if (d == 0) {
        continue;
      }

      for (int i = 0; i < edge[v].size(); i++){
        if (edge[v][i] == from) {
          continue;
        }

        q.push(ituple(age, d - 1, edge[v][i], v, color));
      }

    }
  }

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

}

void solve(){
  int t = 1;
  // scanf("%d", &t);
  for (int i = 0; i < t; i++){
    exec();
  }
}

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


Measured memory_bytes: 11052
/**
 *    author:  zjsdut
 *    created: 2020/03/14 20:03:43
 **/
#include <bits/stdc++.h>

using namespace std;

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

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

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

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

void scan() {}

template <class T, class... Args> void scan(T &a, Args &... rest) {
  cin >> a;
  scan(rest...);
}

using ll = long long;
using vl = vector<ll>;
using vb = vector<bool>;
using vi = vector<int>;
using pii = pair<int, int>;
template <typename T> using vv = vector<vector<T>>;
#define rng(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define up(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define down(i, b, a) for (int i = int(b); i >= int(a); i--)
#define rep(n)                                                                 \
  for (int _iter_##n = 0, _num_##n = (int)n; _iter_##n < _num_##n; ++_iter_##n)
#define FOR(x, cont) for (const auto &x : cont)
#define For(x, cont) for (auto &x : cont)
#define all(x) begin(x), end(x)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ep emplace
#define SZ(x) (int)(x).size()
#define UNIQ(vec) (vec).erase(unique(all(vec)), end(vec))
#define LB(cont, x) int(lower_bound(all(cont), x) - begin(cont))
#define UB(cont, x) int(upper_bound(all(cont), x) - begin(cont))

template <typename T>
ostream &operator<<(ostream &stream, const vector<T> &vec) {
  if (!vec.empty()) {
    stream << vec[0];
    for (size_t i = 1; i != vec.size(); ++i)
      stream << ' ' << vec[i];
  }
  return stream;
}

template <typename T> void print(const vector<T> &t) { cout << t << '\n'; }

template <typename T> void print(const vector<vector<T>> &t) {
  for (const auto &row : t) {
    print(row);
  }
}

template <typename T> void print(const T &t) { cout << t << ' '; }

template <typename T, typename... Args>
void print(const T &t, const Args &... rest) {
  print(t);
  print(rest...);
}

template <typename T> void println(const T &t) { cout << t << '\n'; }

template <typename T, typename... Args>
void println(const T &t, const Args &... rest) {
  print(t);
  println(rest...);
}

int main() {
#if defined LOCAL
  ifstream in("in.txt");
  cin.rdbuf(in.rdbuf());
#endif
  ll a, b, c;
  scan(a, b, c);
  if (c - a - b <= 0) {
    println("No");
  } else {
    ll t = c - a - b;
    println(4 * a * b < t * t ? "Yes" : "No");
  }
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  int d[N]={},result=0;
  for (int i=0;i<N;i++){
    cin >> d[i];
  }
  for (int i=0;i<N;i++){
    for (int j=i;j<N;j++){
      if(i != j){
        result = result + d[i] * d[j];
        // cout << result;
      }
    }
  }
  cout << result;
}

Measured memory_bytes: 256
from copy import copy
import random
random.seed(0)
import math
import sys
input = sys.stdin.readline
D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for _ in range(D)]
last = [0]*26
ans = [0]*D
score = 0
for i in range(D):
    ps = [0]*26
    for j in range(26):
        pl = copy(last)
        pl[j] = i+1
        ps[j] += s[i][j]
        for k in range(26):
            ps[j] -= c[k]*(i+1-pl[k])
    idx = ps.index(max(ps))
    last[idx] = i+1
    ans[i] = idx+1
    score += max(ps)
for k in range(1,25001):
    na = copy(ans)
    x = random.randint(1,365)
    y = random.randint(1,26)
    na[x-1] = y
    last = [0]*26
    ns = 0
    for i in range(D):
        last[na[i]-1] = i+1
        ns += s[i][na[i]-1]
        for j in range(26):
            ns -= c[j]*(i+1-last[j])
    if k%100 == 1:
        T = 300-(298*k/25000)
    p = pow(math.e,-abs(ns-score)/T)
    if ns > score or random.random() < p:
        ans = na
        score = ns
random.seed(1)
for k in range(1,5001):
    na = copy(ans)
    x = random.randint(1,365)
    y = random.randint(1,365)
    na[x-1],na[y-1] = na[y-1],na[x-1]
    last = [0]*26
    ns = 0
    for i in range(D):
        last[na[i]-1] = i+1
        ns += s[i][na[i]-1]
        for j in range(26):
            ns -= c[j]*(i+1-last[j])
    if ns > score:
        ans = na
        score = ns
for a in ans:
    print(a)

Measured memory_bytes: 89208
#include <iostream>

using namespace std;

int H, W;
const int MAX_H = 100, MAX_W = 100;
char a[MAX_H + 2][MAX_W + 2];


void solve() {
	for (int i = 0; i <= H + 1; i++) {
		for (int j = 0; j <= W + 1; j++) {
			if (i == 0 || j == 0 || i == H + 1 || j == W + 1) {
				a[i][j] = '#';
			}
		}
	}
}

int main() {

	cin >> H >> W;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cin >> a[i][j];
		}
	}

	solve();

	for (int i = 0; i <= H + 1; i++) {
		for (int j = 0; j <= W + 1; j++) {
			if (j == W + 1) {
				cout << a[i][j];
				cout << endl;
			}
			else {
				cout << a[i][j];
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
import bisect

n = int(input())
a = sorted(list(map(int, input().split())))
a_t = [0]
for i in range(n):
    a_t.append(a[i] + a_t[i])
a_t = a_t[1:]
ans = 0
mi = 0
for i in range(n):
    index = bisect.bisect_right(a, a[i] * 2) - 1
    if index == n - 1:
        if not mi:
            mi = i
for i in range(n - 1, -1, -1):
    index = bisect.bisect_right(a, a_t[i] * 2) - 1
    if index >= mi:
        mi = i
        ans += 1
print(ans)

Measured memory_bytes: 14480
using System;

class MainClass
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        string[] inputs = Console.ReadLine().Split(' ');
        int[] nums = Array.ConvertAll(inputs, int.Parse);

        for (int i = n - 1; i >= 0; i--)
        {
            if (i != 0)
                Console.Write(nums[i] + " ");
            if (i == 0)
                Console.WriteLine(nums[i]);
        }
    }
}

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

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }	//最大公約数(Greatest Common Divisor)
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }			//最小公倍数(Least Common Multiple)


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

	bool ans[3];
	ans[0] = ans[1] = ans[2] = true;

	rep(i, s.size() / 2) {
		if (s[i] != s[s.size()-1 - i]) {
			ans[0] = false;
		}
	}
	rep(i, s.size() / 4) {
		if (s[i] != s[s.size()/2-1 - i]) {
			ans[1] = false;
		}
	}
	rep(i, s.size() / 4) {
		if (s[s.size()/2+1+i] != s[s.size()-1 - i]) {
			ans[2] = false;
		}
	}

		if (ans[0]&&ans[1]&&ans[2])		cout << "Yes" << endl;
		else		cout << "No" << endl;




}

Measured memory_bytes: 256
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    A, B, K = read_int_list()
    a = A - K
    if a < 0:
      a = 0

    b = B - abs(A - K)
    if b < 0:
      b = 0
    if A > K:
      b = B

    if A == 0 and B == 0:
      a = b = 0
    print(a, b)


main()


Measured memory_bytes: 3572
#include<stdio.h>
#include<string.h>
int main(){
char str[1001];
int i;
scanf("%s",str);
for(i=0;i<strlen(str);i++){
str[i]-=3;
if(str[i]<65) str[i]+=26;
}
printf("%s\n",str);
return 0;
}

Measured memory_bytes: 948
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int N;
int a[205000];
int ans[205000];

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    int num = 0;
    for(int i = 1; i <= N; i++) cin >> a[i];
    for(int i = N; i >= 1; i--) {
        int now = a[i];
        for(int j = i; j <= N; j += i) {
            now ^= ans[j];
        }
        ans[i] = now;
        if(ans[i]) num++;
    }
    cout << num << endl;
    if(num == 0) return 0;
    for(int i = 1; i <= N; i++) {
        if(ans[i]) cout << i << " ";
    }
    cout << endl;
    return 0;
}


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

using namespace std;

#define N 100000

int a[N + 1];

int main(){
	int n, a, b;

	scanf("%d%d%d", &n, &a, &b);

	if ((b - a) % 2){
		printf("Borys\n");
	}
	else{
		printf("Alice\n");
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<char, int> P;
vector<P> c(26);
vector<char> in(100);
int n;

int main() {
  while(cin >> n && n != 0) {
    for(int i = 0; i < 26; i++) {
	c[i].first = 'A' + i;
    	c[i].second = 0;
     }	
    for(int i = 0; i < n; i++) cin >> in[i];

    for(int i = 0; i < n; i++) {
      c[(int)(in[i] - 'A')].second++;
      vector<P> check = c;
      sort(check.begin(), check.end(), [](const P &l,const P &r){
	  return l.second > r.second;});
	
      if(check[0].second - check[1].second > n - (i + 1)) {
	cout << check[0].first << " " << i + 1 << endl;
	goto END;
      }
    }
  sort(c.begin(), c.end(), [](const P &l,const P &r){ return l.second > r.second;});
    if(c[0].second == c[1].second) cout << "TIE" << endl;      
    else cout << c[0].first << " " << n << endl;
  END:;
  }
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           ((ll)x.size())
#define hell            (1000000007)
#define inf             ((ll)5e18 + 5)
#define PI              ((double)3.14159265358979323844)
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

ll add(ll a,ll b) {
    return ((a%hell)+(b%hell))%hell;
}
ll sub(ll a,ll b) {
    return ((a%hell)-(b%hell)+hell)%hell;
}
ll mul(ll a,ll b) {
    return ((a%hell)*(b%hell))%hell;
}

#define N  200005

ll expo(ll base,ll exponent){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%hell;
        base=(1LL*base*base)%hell;
        exponent>>=1;
    }
    return ans%hell;
}

ll fac[N];

ll ncr(ll n,ll r) {
    if (r==0) {
        return 1;
    }
    if (r>n) {
        return 0;
    }
    ll ans=fac[n];
    ans=(ans*expo(fac[r],hell-2))%hell;
    ans=(ans*expo(fac[n-r],hell-2))%hell;
    return ans;
}

void init() {
    fac[0]=1;
    for(ll i=1;i<N;i++) {
        fac[i]=(fac[i-1]*i)%hell;
    }
}

void solve() {
    ll s;
    cin>>s;
    ll x=1;
    ll ans=0;
    while (true) {
        if (x*3>s) break;
        ll temp=s-3*x;
        ans=add(ans, ncr(temp+x-1, temp));
        x++;
    }
    cout<<ans<<endl;
}

signed main() {
    ios
    ll test=1;
    init();
    //cin>>test;
    while (test--) solve();
    return 0;
}

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

using namespace std;
typedef long long ll;
ll MAX_N = 200005;

int main() {
  ll n, k;
  ll a[MAX_N];
  ll c[MAX_N];
  scanf("%lld %lld", &n, &k);
  for (ll i=0; i<n; i++) {
    scanf("%lld", &a[i]);
    c[a[i]]++;
  }
  sort(c, c+n+1, greater<ll>());
 
  ll s = 0;
  for (ll i=0; i<k; i++) {
    s += c[i];
  }

  printf("%lld\n", max(0ll, n-s));

  return 0;
}


Measured memory_bytes: 3456
for v in range(1000):
  s = input()
  s = int(s)
  if s == 0:
    break
  else:
    x=[]
    A = input().split()
    B = [int(l) for l in A]
    for i in range(s):
      for j in range(s):
        if i==j:
          pass
        else:
          w=B[i]-B[j]
          w = abs(w)
          x.append(w) 
  print(min(x))


Measured memory_bytes: 48692
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  long a, b, c=0, d=0, e, f, g, h, n;
  cin >> a >> b;
  int x[a]={};
  rep(i,0,2*b){
    cin >> c;
    x[c-1]++;
  }
  rep(i,0,a) co(x[i]);
  
  return 0;
  
}

Measured memory_bytes: 256
#include <stdio.h>


int main()
{
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    int ab=a-b,bc=b-c,ac=a-c;
    if(ab<0){ab*=-1;}
    if(bc<0){bc*=-1;}
    if(ac<0){ac*=-1;}
    if((ab<=d&&bc<=d)||ac<=d){printf("Yes\n");}
    else {printf("No\n");}

    return 0;
}

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(300000)
from itertools import combinations_with_replacement
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N, M, Q = MI()
ABCD = [tuple(MI()) for i in range(Q)]

ans = 0
for arr in combinations_with_replacement(range(1, M + 1), N):
    A = list(arr)
    score = 0
    for a, b, c, d in ABCD:
        if A[b - 1] - A[a - 1] == c:
            score += d
    ans = max(ans, score)
print(ans)


Measured memory_bytes: 68252
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5+5;
int dist = 0;
int disttravelled;
bool found = false;
int foundcount;
int col[MAXN];
bool visited[MAXN];
vector<int> v1[MAXN];
int n;
void dfs(int curr){
    visited[curr] = true;
    col[curr] = 1;

    if(curr!=1){
        dist++;
    }
    if(curr == n){

        found =true;
        return;
    }
    for(int x:v1[curr]){
        if(!visited[x]){

            dfs(x);
            if(found){
                return;
            }
            if(curr == 1){
                dist = 0;
            }
        }
    }
    col[curr] = 0;
    dist--;
}
void dfs2(int curr,int par){
   
    foundcount++;
    for(int x:v1[curr]){
        if(x==par){
            continue;
        }
        if(col[x] == 1){
            disttravelled++;
            if(disttravelled>dist){
                continue;
            }
        }
        dfs2(x,curr);
    }

}
int main(){

    cin>>n;
    for(int i=1;i<n;i++){
        int x,y;
        cin>>x>>y;
        v1[x].push_back(y);
        v1[y].push_back(x);
    }
    dfs(1);
    
    dist/=2;
   
    dfs2(1,1);
    
    if(foundcount>(n/2)){
        cout<<"Fennec"<<endl;
    }else{
        cout<<"Snuke"<<endl;
    }
}


Measured memory_bytes: 13184
class Dice:
    def __init__(self, men):
        self.men = men

    def throw(self, direction):
        if direction == "E":
            pmen = men[:]
            men[0] = pmen[3]
            men[1] = pmen[1]
            men[2] = pmen[0]
            men[3] = pmen[5]
            men[4] = pmen[4]
            men[5] = pmen[2]
        elif direction == "W":
            pmen = men[:]
            men[0] = pmen[2]
            men[1] = pmen[1]
            men[2] = pmen[5]
            men[3] = pmen[0]
            men[4] = pmen[4]
            men[5] = pmen[3]
        elif direction == "S":
            pmen = men[:]
            men[0] = pmen[4]
            men[1] = pmen[0]
            men[2] = pmen[2]
            men[3] = pmen[3]
            men[4] = pmen[5]
            men[5] = pmen[1]
        elif direction == "N":
            pmen = men[:]
            men[0] = pmen[1]
            men[1] = pmen[5]
            men[2] = pmen[2]
            men[3] = pmen[3]
            men[4] = pmen[0]
            men[5] = pmen[4]
        elif direction == "C":
            pmen = men[:]
            men[0] = pmen[0]
            men[1] = pmen[2]
            men[2] = pmen[4]
            men[3] = pmen[1]
            men[4] = pmen[3]
            men[5] = pmen[5]
        elif direction == "U":
            pmen = men[:]
            men[0] = pmen[0]
            men[1] = pmen[3]
            men[2] = pmen[1]
            men[3] = pmen[4]
            men[4] = pmen[2]
            men[5] = pmen[5]

men = map(int, (raw_input()).split(" "))
d1 = Dice(men)
men = map(int, (raw_input()).split(" "))
d2 = Dice(men)

flag = False

for i in range(4):
    d1.throw("W")
    for j in range(4):
        d1.throw("S")
        if d1.men == d2.men:
            flag = True

for i in range(4):
    d1.throw("C")
    for j in range(4):
        d1.throw("S")
        if d1.men == d2.men:
            flag = True

if flag:
    print "Yes"
else:
    print "No"

Measured memory_bytes: 6528
S = list(input())
M = len(S)
k1 = ['0']*M
k2 = ['1']*M

for i in range(1, M, 2):
    k1[i] = '1'
    k2[i] = '0'

cnt1 = 0
cnt2 = 0

for i in range(M):
    if k1[i] != S[i]:
        cnt1 += 1
    if k2[i] != S[i]:
        cnt2 += 1

print(min(cnt1, cnt2))

Measured memory_bytes: 5540
#include<stdlib.h>
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
int c[101],n,k;
int max(int a,int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}
void swap(int i,int j){
	int a;
	a=c[i];
	c[i]=c[j];
	c[j]=a;
	return;
}
int cf(){
	int ans=0,t;
	for(int i=0;i<=n-k;i++){
		t=1;
		for(int j=i;j<i+k;j++){
			t*=c[j];
		}
		ans=max(ans,t);
	}
	return ans;
}
int cf2(){
	int ans=0;
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			swap(i,j);
			ans=max(ans,cf());
			swap(i,j);
		}
	}
	return ans;
}
int main(){
    while(1){
		int ck,ck2;
		cin>>n>>k;
		if(n==0&&k==0)break;
		for(int i=0;i<n;i++){
			cin>>c[i];
		}
		ck=cf();
		ck2=cf2();
		if(ck>ck2){
			cout<<"NO GAME" <<endl;
		}else{
			cout<<ck2-ck<<endl;
		}
	}
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

#define debug(x) cerr<<#x<<'='<<x<<'\n'
int a[100010], b[100010], c[100010];
int n;
long long ab[100010], bc[100010];
int main(void) {
	 cin>>n;
	 for (int i=1; i<=n; i++) {
	 	scanf("%d", a+i);
	 }
	 for (int i=1; i<=n; i++) {
	 	scanf("%d", b+i);
	 }
	 for (int i=1; i<=n; i++) {
	 	scanf("%d", c+i);
	 }
	 sort(a+1, a+1+n);
	 sort(b+1, b+1+n);
	 sort(c+1, c+1+n);
	 for (int i=1; i<=n; i++) {
	 	int k=lower_bound(a+1, a+1+n, b[i])-a-1;
	 	if (b[i]==a[k]) k--;
	 	ab[i]=ab[i-1]+k;
	 //	debug(ab[i]);
	 }
	 long long ans=0;
	 for (int i=1; i<=n; i++) {
	 	int k=lower_bound(b+1, b+1+n, c[i])-b-1;
	 //	debug(b[k]);
	 	if (c[i]==b[k]) k--;
	 //	debug(b[k]);
	 	bc[i]=bc[i-1]+ab[k];
	 //	debug(bc[i]);
	 }
	 cout<<bc[n];
	 return 0;
}

Measured memory_bytes: 2944
#include <stdio.h>
#include <string.h>

int iDentical(int *aiA, int *aiB);

int aiRot[24][7] = {  // サイコロのパターン表
    {0, 1, 2, 3, 4, 5, 6}, {0, 1, 3, 5, 2, 4, 6}, {0, 1, 4, 2, 5, 3, 6}, {0, 1, 5, 4, 3, 2, 6}, {0, 2, 6, 3, 4, 1, 5}, {0, 2, 3, 1, 6, 4, 5},
    {0, 2, 1, 4, 3, 6, 5}, {0, 2, 4, 6, 1, 3, 5}, {0, 3, 1, 2, 5, 6, 4}, {0, 3, 2, 6, 1, 5, 4}, {0, 3, 5, 1, 6, 2, 4}, {0, 3, 6, 5, 2, 1, 4},
    {0, 4, 1, 5, 2, 6, 3}, {0, 4, 2, 1, 6, 5, 3}, {0, 4, 5, 6, 1, 2, 3}, {0, 4, 6, 2, 5, 1, 3}, {0, 5, 1, 3, 4, 6, 2}, {0, 5, 3, 6, 1, 4, 2},
    {0, 5, 4, 1, 6, 3, 2}, {0, 5, 6, 4, 3, 1, 2}, {0, 6, 2, 4, 3, 5, 1}, {0, 6, 3, 2, 5, 4, 1}, {0, 6, 5, 3, 4, 2, 1}, {0, 6, 4, 5, 2, 3, 1}
};
char achFlag[102];

int main() {
    int iInputN;
    int iCount;
    int iCount2;
    int iDice[110][7];

    scanf("%d", &iInputN);
    
    for (iCount = 0; iCount < iInputN; iCount++) {
        for (iCount2 = 1; iCount2 <= 6; iCount2++) {
            scanf("%d", &iDice[iCount][iCount2]);
        }
    }

    for (iCount = 0; iCount < iInputN; iCount++) {
        for (iCount2 = iCount + 1; iCount2 < iInputN; iCount2++) {
            if (iDentical(iDice[iCount], iDice[iCount2])) {
                printf("No\n");
                return 0;
            }
        }
    }

    printf("Yes\n");

    return 0;
}

int iDentical(int *aiA, int *aiB) {
    int iCount;
    int iCount2;

    // 0初期化
    memset(achFlag, 0, sizeof(achFlag));

    for (iCount = 1; iCount <= 6; iCount++) {
        achFlag[aiA[iCount]]++;
        achFlag[aiB[iCount]]--;
    }

    for (iCount = 1; iCount <= 6; iCount++) {
        if (achFlag[aiB[iCount]]) return 0;
    }

    for (iCount = 0; iCount < 24; iCount++) {
        if (aiB[1] == aiA[aiRot[iCount][1]]) {
            for (iCount2 = 2; ; iCount2++) {
                if (iCount2 > 6) return 1;
                if (aiB[iCount2] != aiA[aiRot[iCount][iCount2]]) break;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    ll MOD = 1000000007;
    int N, M;
    cin >> N >> M;
    vector<ll> s(N);
    vector<ll> t(M);
    
    for (int i = 0; i < N; i++)
        cin >> s[i];
    for (int i = 0; i < M; i++)
        cin >> t[i];
    
    vector<vector<ll>> dp(N+1, vector<ll>(M+1, 0));
    vector<vector<ll>> sum_dp(N+1, vector<ll>(M+1, 0));
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= M; j++) {
            if (s[i-1] == t[j-1]) {
                dp[i][j] = (sum_dp[i-1][j-1]+1) % MOD;
                sum_dp[i][j] = ((sum_dp[i][j-1]-sum_dp[i-1][j-1]+sum_dp[i-1][j])%MOD+dp[i][j])%MOD;
                //ll d_sum = 0;
                //for (int k = 0; k < i; k++)
                //    for (int l = 0; l < j; l++)
                //        d_sum = (d_sum + dp[k][l]) % MOD;
                //dp[i][j] = (d_sum + 1) % MOD;
            }
            else {
                dp[i][j] = 0;
                sum_dp[i][j] = (sum_dp[i][j-1]-sum_dp[i-1][j-1]+sum_dp[i-1][j])%MOD;
            }
        }
    }
    ll ans = 0;
    for (int i = 1; i <= N; i++)
        for (int j = 1; j <= M; j++)
            ans = (ans + dp[i][j]) % MOD;
    if ((ans+1)%MOD >= 0)
        cout << (ans+1)%MOD << endl;
    else
        cout << (ans+1)%MOD + MOD << endl;
}

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

int map[4003][4003]={};

int main() {
	string a,b;
	while(cin>>a>>b){
    	int maxmiam=0;
    	for(int i=1;i<a.size()+1;i++){
			for(int j=1;j<b.size()+1;j++){
				if(a[i-1]==b[j-1]){
					map[i][j]=map[i-1][j-1]+1;
				}else {
					map[i][j]=0;
				}
				maxmiam=max(maxmiam,map[i][j]);
			}
		}
	cout<<maxmiam<<endl;
	}
	return 0;
}

Measured memory_bytes: 63756
def main():
    n = int(input())
    a = []
    b = []
    for _ in range(n):
        ta, tb = [int(i) for i in input().split()]
        a.append(ta)
        b.append(tb)
    a = sorted(a)
    b = sorted(b)

    if n % 2:
        mid_idx = (n + 1)//2 -1
        print(b[mid_idx] -a[mid_idx] + 1)
    else:
        mid_idx = [n//2 - 1, n//2]
        mid_a = (a[mid_idx[1]] + a[mid_idx[0]])
        mid_b = (b[mid_idx[1]] + b[mid_idx[0]])
        print(mid_b - mid_a + 1)

if __name__ == '__main__':
    main()



Measured memory_bytes: 27000
//String Equivalence

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define YN(flag) (flag?"Yes":"No")
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

vector<string>ans;

void f(string s,int n){
    if(s.size()==n){ans.pb(s);return;}
    int mx=0;
    rep(i,0,s.size())mx=max(mx,(ll)s[i]-'a');
    rep(i,0,mx+2){
        string t=s;
        t.pb('a'+i);
        f(t,n);
    }
    return;
}

signed main (){
    int n;cin>>n;
    f("a",n);
    sort(range(ans));
    for(auto i:ans)cout<<i<<nnn;
    return 0;
}

Measured memory_bytes: 7232
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    string s;
    cin>>s;
    string s1="CODEFESTIVAL2016";
    int ans=0;
    for(int i=0;i<s.length();i++)
        if(s[i]!=s1[i])ans++;
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------









Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c,d,e; cin>>a>>b>>c>>d>>e;
    int k; cin>>k;
    if(abs(e-a)>k) cout<<":("<<endl;
    else cout<<"Yay!"<<endl;
    
}

Measured memory_bytes: 256
import java.util.*;
import java.util.regex.*;

class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final String S = sc.next();
        sc.close();

        if (Pattern.matches("^(dream|dreamer|erase|eraser)*", S)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 34028
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <list>
#include <set>
#include <map>
#include <functional>
#include <unordered_map>
#include <cmath>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

#define xx first
#define yy second
#define $1 first
#define $2 second

typedef vector<ll> Vll;
ll find(Vll& C, ll x) { return (C[x] == x) ? x : C[x] = find(C, C[x]); }
void merge(Vll& C, ll x, ll y) { C[find(C, x)] = find(C, y); }
//union
void solveCase() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	ll n, m; cin >> n >> m;
	vector<ll> C; C.resize(n+1);
	for (int i = 1; i <= n; i++) C[i] = i;
	for (int i = 0; i < m; i++) {
		ll u, v; cin >> u >> v;
		merge(C, u, v);
	}
	unordered_map <ll, ll> mp;
	for (int i = 1; i <= n; i++) {
		mp[find(C, i)]++;
	}
	vector<ll> dq;
	for (auto iter = mp.begin(); iter != mp.end(); iter++) {
		dq.push_back((*iter).second);
	}
	sort(dq.begin(), dq.end());
	ll ans = 0;
	ll now_fr = 0;

	for (int i = 0; i<dq.size(); i++) {
		ans += dq[i]-now_fr;
		now_fr = dq[i];
	}
	cout << ans;
}


int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	solveCase();
}

Measured memory_bytes: 16068
from decimal import Decimal, getcontext
from itertools import combinations
from heapq import *


getcontext().prec = 30

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
        return True

while True:
    N = int(input())
    if N ==0:
        exit()

    tree = UnionFind(N)

    pos = dict()
    for i in range(N):
        pos[i] = tuple(map(Decimal, input().split()))

    data = []

    for a,b in combinations(range(N), 2):
        x1,x2,x3,xr = pos[a]
        y1,y2,y3,yr = pos[b]
        cost = max(((x1-y1)**2 + (x2-y2)**2 + (x3-y3)**2).sqrt() -xr -yr, 0)
        data.append((a, b, cost))

    res = 0
    data.sort(key=lambda x: x[2])

    for a, b, cost in data:
        if tree.union(a,b):
            res += cost
    print("{:.03f}".format(res))


Measured memory_bytes: 7692
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <limits>

using namespace std;

typedef long long ll;

int main (int argc, char* argv[]) {
	ll n;
	cin >> n;
	vector<ll> h(n);
	for (ll i = 0; i < n; i++) {
		cin >> h[i];
	}
	ll max_step = 0;
	ll prev_step = 0;
	for (ll i = n - 2; i >= 0; i--) {
		if (h[i] >= h[i + 1]) {
			prev_step++;
			max_step = max(max_step, prev_step);
		} else {
			prev_step = 0;
		}
	}
	cout << max_step << endl;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
public class AtCoder
{
    public static void Main()
    {
        //入力を保持する
        var input = Console.ReadLine().Split().Select(v => int.Parse(v)).ToArray();
        //部屋の数
        var N = input[0];
        //ルートの数
        var M = input[1];
        //部屋とルートの組み合わせDictionary
        var setDic = new Dictionary<int, List<int>>();
        //部屋とルートDictionaryに組み合わせを記録
        for (int m = 0; m < M; m++)
        {
            var root = Console.ReadLine().Split().Select(e => int.Parse(e)).ToArray();
            var A = root[0];
            var B = root[1];
            if (!setDic.ContainsKey(A))
            {
                setDic.Add(A, new List<int> { B });
            }
            else 
            {
                setDic[A].Add(B);
            }
            if (!setDic.ContainsKey(B))
            {
                setDic.Add(B, new List<int> { A });
            }
            else
            {
                setDic[B].Add(A);
            }
        }

        var q = new Queue<int>();
        q.Enqueue(1);
        var ans = new int[N - 1];
        while (q.Count != 0)
        {
            var room = q.Dequeue();
            foreach (var toPath in setDic[room])
            {
                if (toPath != 1 && ans[toPath - 2]==0)
                {
                    ans[toPath - 2] = room;
                    q.Enqueue(toPath);

                }

            }
        }

        Console.WriteLine("Yes");
        foreach (var a in ans)
        {
            Console.WriteLine(a);
        }

    }
}


Measured memory_bytes: 55728
program ABC_085_B_KagamiMochi
   integer N, i, dm, m, countN
   integer, allocatable :: d(:)
   read(*, *) N
   allocate(d(1: N))
   read(*, *) d(1: N)
   do i = 1, N - 1
      dm = maxval(d(i+1:N))
	  m  = maxloc(d(i+1:N), 1) + i
	  if (d(i) < dm) then
	      d(m) = d(i)
		  d(i) = dm
	  end if
   end do
   countN = 1
   do i = 1, N - 1
       if(d(i) > maxval(d(i+1: N))) then
	      countN = countN + 1
	   end if
   end do
   write(*, *) countN
end program ABC_085_B_KagamiMochi

Measured memory_bytes: 768
#include<iostream>
#include<cmath>
#include<vector>
#include<limits.h>


using namespace std;

int main(){

  int n=0,m=0,l=0,term=0;
long int matrix_a[120][120]={};
long int matrix_b[120][120]={};
long  int matrix_c[120][120]={};

//cout << INT_MAX << endl;

    cin >> n >> m >> l;
/*    if(n >= 100 || m >= 100 || l >=100 ){
      //cout  << "Too Large" << endl;
      return 0;
}*/

//cout << INT_MAX << endl;

  for(int i=0 ; i<n ; i++){
    for(int j=0 ; j<m ; j++){
      cin >> matrix_a[i][j];                   //??????????´?
    }
  }

  for(int i=0 ; i<m ; i++){
    for(int j=0 ; j<l ; j++){
      cin >> matrix_b[i][j];                   //??????????´?
    }
  }


  for (int i = 0 ; i < n ; i++) {
         for (int j = 0 ; j < l ; j++) {
             // Multiply the row of A by the column of B to get the row, column of product.
             for (int k = 0 ; k < m ; k++) {
                 matrix_c[i][j] += matrix_a[i][k] * matrix_b[k][j];
             }

         }
     }



  /* ??????????????????????????? */
/*    for(int i=0; i<n; ++i){
      for(int j=0; j<l ; ++j){
        matrix_c[i][j] = matrix_a[i][j] * matrix_b[i][j];

        // ????????????????¨????
        for(int i=0;i<n;i++){
          for(int j=0 ; j<l ; j++){
             term = 0;
            for(int k=0 ; k<m ; k++)
              term = term + matrix_a[i][k] * matrix_b[k][j];
            matrix_c[i][j] = term;
          }
        }

      }
    }
*/
    for(int i=0;i<n;i++){
      for(int j=0;j<l;j++){
        if(j==0){
            cout << matrix_c[i][j];                        //?????????????????????????????¨???
          }
          else{
            cout << ' ' << matrix_c[i][j];                //????????\??????????????¨???
          }
        }
        cout << endl;
    }
    return 0;



}

Measured memory_bytes: 1504
length_count = int(input())
strings = input()

abc_count = 0
a = False
b = False

strings_list = list(strings)

for i in range(length_count):
    
    if strings_list[i] == 'A':
        a = True
        b = False

    elif strings_list[i] == 'B' and a:
        if b:
            a = False
            b = False
        b = True
        
    elif strings_list[i] == 'C' and a and b:
        abc_count += 1
        a = False
        b = False
    else:
        a = False
        b = False

print(abc_count)


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

int main() {
  int menber,day,zan;
  int cnt = 0;
  
  cin >> menber >> day >> zan;
  
  vector<int> vec(menber);
  for(int i = i; i < menber; i++) cin >> vec.at(i);
  
  for(int i = 0; i < menber; i++){
    cnt++;
    for(int j = 1; j < day; j++){
      if(j*vec.at(i)+1 <= day) cnt++;
    }
  }
  
  cout << cnt + zan;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;


int main() {
  double r;
  cin >> r;
  double s = r*r*M_PI;
  double l = 2*r*M_PI;
  cout << fixed << setprecision(6) << s << " " << fixed << setprecision(6) << l <<endl;
  return 0;
}



Measured memory_bytes: 3232
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N = 1e+5;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

int main() {
    char c[N];
    cin >> c;
    c[3] = '8';
    cout << c << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
h_li = list(map(int,input().split()))
tmp = h_li[0]
move = 0
res = [0]
for i,x in enumerate(h_li[1::]):
    if tmp >= x:
        move += 1
        tmp = x
        if i == len(h_li)-2:
            res.append(move)
    else:
        res.append(move)
        move = 0
        tmp = x
        
print(max(res))


Measured memory_bytes: 14252
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        while(true){
            String tmpStr = br.readLine();

            if(tmpStr == null){
                break;
            }

            double inputV = Double.parseDouble(tmpStr);
            for(int i = 1;  ; i++){
                int height = i * 5 - 5;
                double v = Math.sqrt(2*9.8*height);
                //System.out.println(v);
                if(v >= inputV){
                    System.out.println(i);
                    break;
                }
            }
        }
    }
}


Measured memory_bytes: 24240