akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define M 100000
#define N 101
int A[N][N],d[N],c[N],p[N],n;

int main(){
  int i,j,m,u,sum=0;

  scanf("%d",&n);

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

  d[1]=0;
  while(1){
    m=M;
    for(i=1; i<=n; i++){
      for(j=1; j<=n; j++){
	    	if(A[i][j] != -1){
					if(c[i]!=2 && d[i]<m){
						m = d[i];
						u = i;
					}
				}	
      }
    }

		if(m==M) break;
		c[u] = 2;
		for(i=1; i<=n; i++){
			if(A[u][i]!=-1){
				if(c[i]!=2 && A[u][i]<d[i]){
					p[i] = u;
					d[i] = A[u][i];
				}
			}
		}
  }
    for(i=1; i<=n; i++)
    	sum += d[i];
  printf("%d\n",sum);

  return 0;
}
    


Measured memory_bytes: 1988
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
long long modexp(long long b, long long e, long long m){
	long long r = 1;
	while(e > 0){
		if(e&1){
			r = (r*b)%m;
		}
		b = (b*b)%m;
		e >>= 1;
	}
	return r;
}
int main(){
	long long fact[4005];
	fact[0] = 1;
	for(int i=1;i<4005;i++){
		fact[i] = (fact[i-1]*i)%MOD;
	}
	int s;
	cin >> s;
	long long ans = 0;
	for(int i=1;i<=s/3;i++){
		int tt = s-3*i;
		long long temp = fact[tt+i-1]*modexp((fact[i-1]*fact[tt])%MOD,MOD-2,MOD);
		temp %= MOD;
		ans = (ans+temp)%MOD;
	}
	cout << ans << '\n';
}

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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int n;
int s[125252];

int main(){
    scanf("%d",&n);
    REP(i,n)scanf("%d",s+i);
    ll ans = 0;
    FOR(d,1,n/2){
        int t = 0;
        ll tmp = 0;
        int l = 0, r = n-1;
        while(true){
            t++;
            l += d;
            if(l==r || l>=n)break;
            r -= d;
            if(l==r || r<0)break;
            int a = n-1-t*d;
            int b = a-d;
            if(a<=0 || b<=0)break;
            tmp += s[l];
            tmp += s[r];
            CHMAX(ans, tmp);
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 640
def main():
    K = int(input())
    ans = 0
    counter = 0
    while True:
        ans += 1
        s_ans = str(ans)
        c_flag = True
        l_ans = len(s_ans)
        skip = 0
        for j in range(1, l_ans):
            if abs(int(s_ans[j])-int(s_ans[j-1])) > 1:
                c_flag = False
                skip = 10**(l_ans-j-1)-1
                break
            if j < l_ans-1 and abs(int(s_ans[j])-int(s_ans[j+1])) > 1:
                c_flag = False
                skip = 10**(l_ans-j-2)-1
                break
        if c_flag == True:
            counter += 1
        else:
            ans += skip
        if counter == K:
            break
    
    print(ans)

main()


            

Measured memory_bytes: 44908
#include <stdio.h>

int main(void)
{
	float w;
	
	while (scanf("%f", &w) != EOF){
		if (w > 91.00){
			printf("heavy\n");
		}
		else if (w > 81.00){
			printf("light heavy\n");
		}
		else if (w > 75.00){
			printf("middle\n");
		}
		else if (w > 69.00){
			printf("light middle\n");
		}
		else if (w > 64.00){
			printf("welter\n");
		}
		else if (w > 60.00){
			printf("light welter\n");
		}
		else if (w > 57.00){
			printf("light\n");
		}
		else if (w > 54.00){
			printf("feather\n");
		}
		else if (w > 51.00){
			printf("bantam\n");
		}
		else if (w > 48.00){
			printf("fly\n");
		}
		else {
			printf("light fly\n");
		}
	}
	return (0);
}

Measured memory_bytes: 604
import java.util.Scanner;
import java.util.Arrays;
import java.util.stream.Stream;
import java.util.stream.IntStream;
import java.lang.StringBuilder;

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

    int Q = sc.nextInt();
    int H = sc.nextInt();
    int S = sc.nextInt();
    int D = sc.nextInt();
    int N = sc.nextInt();

    long amount = 0;
    int halfValue = Math.min(Q * 2, H);
    int literValue = Math.min(halfValue * 2, S);
    int twoLiterValue = Math.min(literValue * 2, D);  

    long twoLiterNum = N / 2;
    long literNum = N % 2;
    amount += twoLiterNum * twoLiterValue;
    amount += literNum * literValue;

    System.out.println(amount);
  }
}


Measured memory_bytes: 23764
open Scanf
open Printf
(* #load "str.cma" ;; *)

let (n,m) = sscanf (read_line ()) "%d %d" (fun n m -> (n,m));;
let wsp_regex = Str.regexp "[ ]+";;
let words = Str.split wsp_regex (read_line ());;
let intlist = List.sort compare (List.map (fun x -> int_of_string x) words);;
let list_input =
  let rec loop list num =
    match num with 
      0 -> list
    | x -> loop ((sscanf (read_line ()) "%d %d" (fun b c  -> (b,c)))::list) (x-1)
  in loop [] m;;
let query = List.sort (fun x y -> -compare (snd x) (snd y)) list_input;;

(* let () = List.iter (fun x -> printf "%d " x) intlist;;
   let () = print_newline();;
   let () = List.iter (fun x -> printf "%d %d:" (fst x) (snd x)) query;; *)

let ans () =
  let rec loop lists querys count sum =
    match lists,querys with
      [], _ -> sum
    | l :: list_rest, [] -> loop list_rest [] 0 (sum + l)
    | l :: list_rest, (b,c) :: query_rest -> 
      if (c <= l) then
        loop list_rest [] 0 (sum+l)
      else if (c > l && b > count) then
        loop list_rest querys (count+1) (sum+c)
      else (* (c > l && b <= count) *)
        loop lists query_rest 0 sum
  in loop intlist query 0 0;;

let () = printf "%d\n" (ans());;

Measured memory_bytes: 27008
d = dict()

n = int(input())
w0 = input().strip()
d[w0] = True
c = w0[-1]

ok = True
for _ in range(n-1):
    w = input().strip()
    if w in d or w[0] != c:
        ok = False
        break

    d[w] = True
    c = w[-1]

print('Yes' if ok else 'No')

Measured memory_bytes: 3064
// https://atcoder.jp/contests/abc118/tasks/abc118_c

// http://ctylim.hatenablog.com/entry/2015/08/30/191553
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cstdio>

#define ALL(a) (a).begin(), (a).end()
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define RSORT(c) sort((c).rbegin(), (c).rend())
#define MAXINDEX(c) distance((c).begin(), max_element((c).begin(), (c).end()))
#define MININDEX(c) distance((c).begin(), min_element((c).begin(), (c).end()))
#define DEBUG(x) std::cerr << #x << " = " << (x) << " (" << __FILE__ << "::" << __LINE__ << ")" << std::endl;
#define ERROR(s) std::cerr << "Error::" << __FILE__ << "::" << __LINE__ << "::" << __FUNCTION__ << "::" << (s) << std::endl;
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)

#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;

template <typename T>
T inputValue()
{
  T a;
  // std::cin >> a;
  scanf("%llu", &a);
  return a;
}

void inputArray(int *p, int a)
{
  rep(i, a)
  {
    std::cin >> p[i];
    // scanf("%d",p+i);
  }
}

template <typename T>
void inputVector(std::vector<T> *p, int a)
{
  rep(i, a)
  {
    T input;
    // std::cin >> input;
    scanf("%llu", &input);
    p->push_back(input);
  }
}

template <typename T>
void output(T a, int precision)
{
  if (precision > 0)
  {
    std::cout << std::setprecision(precision) << a << "\n";
  }
  else
  {
    std::cout << a << "\n";
  }
}

using namespace std;

int gcd(int a, int b)
{
  while (1)
  {
    if (a < b)
      swap(a, b);
    if (!b)
      break;
    a %= b;
  }
  return a;
}

typedef unsigned long long int ulli;
int main(int argc, char **argv)
{

  ulli N = inputValue<ulli>();
  ulli K = inputValue<ulli>();
  vector<ulli> v;
  inputVector<ulli>(&v, N);


  vector<ulli> bitSum(64,0);

  EACH(k, v)
  {
    ulli t = *k;
    for(int i=0; i<64&&t!=0; i++){
      bitSum[i] = bitSum[i] + (t&1) ;
      t = t >> 1;
    }
  }

  // ulli d = 0;

  int flag = 0;

  ulli sum0 = 0;
  for (int i = 63; i >= 0; i--)
  {

    ulli K_bit = (K >> i) & 1ll;
    ulli A_bit = (bitSum[i] > N / 2 ? 0 : 1);
    ulli D_bit = A_bit;
    if (!flag)
    {
      D_bit = K_bit && A_bit;
      flag = K_bit && (!A_bit);
    } 
    // K: kkkkkk1kkkkk 
    // A: aaaaaa0aaaaa
    // D: dddddddddddd
    // 1-0のパターンの左は D=K&A
    // 右は D=A

    if (!D_bit)
    {
      sum0 = sum0 + (bitSum[i] << i);
    }else{
      sum0 = sum0 + ((N-bitSum[i]) << i);
    }
  }
  cout << sum0 << endl;

}


Measured memory_bytes: 1400
#include <array>
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define WRAP(y,x,h,w) (0<=y && y<h && 0<=x && x<w)

typedef long long ll;
typedef unsigned long long ull;
typedef string str;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {
	string s1, s2;
	cin >> s1 >> s2;
	int ans = 0;
	FOR(i, 1, min(s1.size(), s2.size()) + 1) {
		set<array<int,26>> alp;
		array<int, 26> now;
		now.fill(0);
		REP(j, s1.size() - i + 1) {
			if (j == 0) {
				REP(k, i) {
					now[s1[k] -'a']++;
				}
			}
			else {
				now[s1[j+i-1] - 'a']++;
				now[s1[j-1] - 'a']--;
			}
			alp.insert(now);
		}
		now.fill(0);
		REP(j, s2.size() - i + 1) {
			if (j == 0) {
				REP(k, i) {
					now[s2[k] - 'a']++;
				}
			}
			else {
				now[s2[j + i-1] - 'a']++;
				now[s2[j - 1] - 'a']--;
			}
			if (alp.find(now) != alp.end()) {
				ans = i;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3604
n,k = gets.split.map(&:to_i)
px = gets.split.map(&:to_i)
y = 0
for i in 0..(k-1)
  y += px[i]
end
z = y
ma = y
for j in 0..(n-k-1)
  z -= (px[j]-px[j+k])
  if ma < z
    ma = z
  end
end
puts (ma+k).to_f/2

Measured memory_bytes: 14980
#include <iostream>
using namespace std;
int main(){

    int input,count;
    

    while(cin>>input,input){
        count=0;
        for(int i=1;i<input;i++){
            int sum = 0;
            for(int j=i;j<input;j++){
                sum += j;
                if(input == sum){
                    count++;
                    break;
                }
            }
        }

        cout<<count<<endl;

    }

    return 0;
}


Measured memory_bytes: 3056
import copy
N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
B = copy.deepcopy(A)
table = [[True]*N for i in range(N)]
ans = 0
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        for k in range(N):
            if k == i or k == j:
                continue
            else:
                if B[i][k] == B[i][j]+B[j][k]:
                    table[i][k] = False
                B[i][k] = min(B[i][k], B[i][j]+B[j][k])


if A == B:
    for i in range(N):
        for j in range(N):
            if table[i][j]:
                ans += B[i][j]
    print(ans//2)
else:
    print(-1)


Measured memory_bytes: 58204
def dfs(pos, Str, res):
    #print(pos, Str, res)
    if pos == 4:
        if res == 7:
            print(Str + "=7")
            exit()
        return
    dfs(pos+1, Str + "+" + s[pos], res + int(s[pos]))
    dfs(pos+1, Str + "-" + s[pos], res - int(s[pos]))

s = input()
dfs(1, s[0], int(s[0]))

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define msg(x) debug() << x
#define int long long
const int xx = 2e5;
const int MOD = 1e9 + 7;

signed main(){

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

  int n , x;
  cin >> n >> x;
  vector<int>L(n);
  for(int i=0;i<n;i++){
    cin >> L[i];
  }
  vector<int>D(n+1,0);

  for(int i=1;i<=n;i++){
    D[i] = D[i-1] + L[i-1];
  }
  int cnt = 0;
  for(int i=0;i<=n;i++){
    if(D[i]<=x) cnt++;
  }
  cout << cnt << '\n';
  
}


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

constexpr int32_t MOD = 1e9 + 7; //10^9
/*global*/

string S;

//#define int int64_t
signed main()
{
	unsigned long long dp[13] = { 0 }, dp_next[13];
 
	dp[0] = 1;
	cin >> S;
 
	for (const char& s : S) {
		for (int i = 0; i < 13; i++) dp_next[i] = 0;
 
		if (s == '?') {
			for (int i = 0; i < 10; i++) {
				for (int j = 0; j < 13; j++) {
					dp_next[((j * 10 + i) % 13)] += dp[j];
				}
			}
		}
		else {
			for (int i = 0; i < 13; i++) {
				dp_next[(i * 10 + s-'0') % 13] += dp[i];
			}
		}
 
		for (int i = 0; i < 13; i++) {
			dp[i] = dp_next[i] % MOD;
		}
	}
 
	cout << dp[5];	
}


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

int main() {
    int a, b, c, cnt=0,cont2=0;
    cin >> a >> b >> c;
    int d[c];
    for(int i=1; i<=c; i++) {
        if(c%i==0) {
            d[cnt]=i;
          cnt++;
        }
    }
    for(int i=0; i<cnt; i++) {
        if(a<=d[i]&&b>=d[i]) {
            cont2++;
        }
    }
    cout << cont2 << endl;
}


Measured memory_bytes: 3100
defmodule Main do
  def main do
    [n, k] = 
      IO.gets("")
      |> String.trim()
      |> String.split()
      |> Enum.map(&String.to_integer/1)
#    d = 
#      IO.gets("")
#      |> String.trim()
#      |> String.to_integer()
    a =  
      IO.stream(:stdio, :line) 
      |> Enum.take(2 * k) 
      |> Enum.map(&String.trim(&1)) 
      |> Enum.map(&String.split(&1)) 
      |> Enum.map(&Enum.map(&1, fn str -> String.to_integer(str) end))
	
    n - solve(a, [])
    |> IO.puts()

  end
  
  def solve([], acc), do: Enum.sort(acc) |> Enum.dedup() |> Enum.count()
  def solve([_ | [a | tail]], acc), do: solve(tail, acc ++ a)
end
    

Measured memory_bytes: 33984
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

//               0123456789
const int kMod = 1000000007;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }

  ll ans = 1;
  vector<int> counts(N);
  for (int i = 0; i < N; ++i) {
    int x = A[i];
    if (x == 0) {
      ans *= 3 - counts[x];
      ans %= kMod;
    } else {
      ans *= counts[x - 1] - counts[x];
      ans %= kMod;
    }
    counts[x] += 1;
  }
  
  cout << ans << endl;
  
  return 0;
}


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

int main(void){
    int n;
    cin >> n;
    int a[n];
    for (int i=0; i<n; i++) cin >> a[i];
    for (int i=0; i<n; i++){
        if (i != n-1) cout << a[i] << ' ';
        else cout << a[i];
    }
    cout << endl;
    
    int v, j;
    for (int i=1; i<n; i++){
        v = a[i];
        j = i - 1;
        while (j>=0 && a[j]>v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        
        for (int i=0; i<n; i++){
            if (i != n-1) cout << a[i] << ' ';
            else cout << a[i];
        }
        cout << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
int main() {
	int r,g,b,k;
	cin >> r >> g >> b >> k;
	while (g <= r) {
		k--;
		g*=2;
	}
	while (b <= g) {
		k--;
		b*=2;
	}
	if (k >=0)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

Measured memory_bytes: 3632
n = gets.chomp.to_i
a = Array.new(2) { gets.chomp.split.map(&:to_i) } 

dp = Array.new(2) { Array.new(n, 0)}
dp[0][0] = a[0][0]

2.times do |i|
  n.times do |j|
    next if i == 0 and j == 0
    if i == 0
      dp[i][j] = dp[i][j-1] + a[i][j]
    else
      dp[i][j] = [dp[i][j-1] + a[i][j], dp[i-1][j] + a[i][j]].max
    end
  end
end
puts dp[1][n-1]

Measured memory_bytes: 1788
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define INF 2140000000
#define MOD 1000000007

int main() {
	
	int a, b;

	cin >> a >> b;
	
	
	if (a > b) {
		cout << a + a - 1;
	}
	else if (a == b) {
		cout << a + b;
	}
	else {
		cout << b + b - 1;
		
	}
	
	

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
 
int32_t main() {
 
	int n;	cin >> n;
	int a[n];
	int neg = 0;
	int zero = 0;
	int sum = 0;
	int mn = 1e18;
	
	for(int x=0;x<n;x++){
		cin >> a[x];
		sum += (abs(a[x]));
		mn = min(mn , abs(a[x]));
		neg += (a[x] < 0LL);
		zero += (a[x] == 0LL);
	}
	
	// cout << mn << endl;
	// cout << neg << endl;
	// cout << zero << endl;
	// cout << sum << endl;
	
	if(neg % 2 == 0){
		cout << sum;
	}else{
		if(zero > 0)
			cout << sum;
		else{
			//cout << "here" << endl;
			cout << sum - 2 * mn;
		}
	}
	

	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define mm(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define pf(a) printf("%d\n",a)
#define pf2(a,b) printf("%d %d\n",a,b)
#define p_f(a) printf("%d ",a)
#define fi first
#define se second
#define db double
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const db eps=1e-9;
string s;
int main()
{
    cin>>s;
    if(s!="AAA"&&s!="BBB")cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

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

using namespace std;

int main(void)
{
  string S;

  cin >> S;

  sort(S.begin(), S.end());

  rep(S.length() - 1)
  {
    if(S[i] == S[i + 1])
    {
      cout << "no" << endl;
      return 0;
    }
  }

  cout << "yes" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define PI 3.141592653589793
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

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

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

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    cin>>n;
    string s;
    ll r=0,g=0,b=0;
    cin>>s;
    
    rep(i,s.size()){
        if(s[i]=='R') r++;
        else if(s[i]=='G') g++;
        else b++;
    }
    ll ans=r*g*b;
    rep(i,n){
        for(ll j=1;i-j>=0 && i+j<n;j++){
            if(s[i-j]!=s[i] && s[i]!=s[i+j] && s[i-j]!=s[i+j]) ans--;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3648
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner stdIn = new Scanner(System.in);
		int r = stdIn.nextInt();
		int c = stdIn.nextInt();
		int[][] number = new int[r][c];
		int[] count_x = new int[r];
		int[] count_y = new int[c];
		int count = 0;
		
		Arrays.fill(count_x,0);
		Arrays.fill(count_y,0);
		
		for(int i=0;i<r;i++)
		{
			for(int j=0;j<c;j++)
			{
				number[i][j] = stdIn.nextInt();
				count_x[i]+=number[i][j];
				count_y[j]+=number[i][j];
				count += number[i][j];
			}
		}
		
		for(int i=0;i<r;i++)
		{
			for(int j=0;j<c;j++)
			{
				System.out.print(number[i][j]+" ");
			}
			System.out.println(count_x[i]);
		}
		
		for(int i=0;i<c;i++)
		{
			System.out.print(count_y[i]+" ");
		}
		
		System.out.println(count);
		
	}
}

Measured memory_bytes: 39604
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var s = Console.ReadLine().Trim();
        getAns(n, s);
    }
    static void getAns(int n, string s)
    {
        if (n % 2 == 1) { Console.WriteLine("No"); return; }
        var n2 = n / 2;
        var s1 = s.Substring(0, n2);
        var s2 = s.Substring(n2);
        Console.WriteLine(s1 == s2 ? "Yes" : "No");
    }
}


Measured memory_bytes: 13140
#include<stdio.h>


int array[100][5];


int main(void){
	int i, j, n, x;
	int sum= 0, max_sum=0, min_sum=500;

	scanf("%d", &n);

	//input
	while(n > 0){
		for(i = 0; i < n; i++){
			for(j = 0; j < 5; j++){
				scanf("%d", &x);
				sum+=x;			
			}
			if(sum > max_sum){
				max_sum = sum;
			}
			if(sum < min_sum){
				min_sum = sum;
			}
			sum = 0;
		}
		printf("%d %d\n", max_sum, min_sum);
		max_sum = 0;
		min_sum = 500;
		scanf("%d", &n);
	}

	return 0;
}

Measured memory_bytes: 1028
def factorization(n):
 p=2
 fcr=[]
 while p*p<=n:
  while n%p==0:
   fcr.append(p)
   n//=p
  p+=1
 if n>1:
  fcr.append(n)
 return fcr

q=int(input())

cnt=1
p_list=[1]
q_list=[0]
for i in range(3,10**5+1,2):
 a=factorization(i)
 b=factorization((i+1)//2)

 if len(a)==len(b)==1:
  cnt+=1
  q_list.append(1)
 else:
  q_list.append(0)

 p_list.append(cnt)

for i in range(q):
 l,r=map(int,input().split())

 c=p_list[r//2]-p_list[l//2]
 if q_list[l//2]==1:
  print(c+1)
 else:
  print(c)

Measured memory_bytes: 4356
#include <cstdio>
#include <string>
#include <map>
#include <algorithm>
#include <utility>
#include <iostream>

using namespace std;

char s[49];

int main() {
  int n;
  scanf("%d %s", &n, s);
  map<pair<string, string>, int> cnt;
  for (int i = 0; i < (1 << n); ++i) {
    string t = "", rt = "";
    for (int j = n - 1; j >= 0; --j) {
      if (i >> j & 1) {
        t += s[n + j];
      } else {
        rt += s[n + j];
      }
    }
    ++cnt[{t, rt}];
  }
  long long ans = 0;
  for (int i = 0; i < (1 << n); ++i) {
    string t = "", rt = "";
    for (int j = 0; j < n; ++j) {
      if (i >> j & 1) {
        t += s[j];
      } else {
        rt += s[j];
      }
    }
    if (cnt.count({t, rt}) != 0) {
      ans += cnt[{t, rt}];
    }
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 48192
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    li = LI()
    print(li.index(0) + 1)
    return


if __name__ == "__main__":
    solve()


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

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

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)2e5+111;
ll const LG=(ll)log2(N)+1;



void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        char c;
        cin>>c;
        if(c>='a'&&c<='z'){
                cout<<'a'<<endl;
        }else{
                cout<<"A"<<endl;
        }
        
        
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}


Measured memory_bytes: 3612
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;


int main()
{
	FAST;
	int row,column;
	string str[1000];
	
	cin >> row >> column;

	for(int i=0 ; i<row ; i++)
		cin >> str[i];

	for(int i=0 ; i<=column+1 ; i++)
		cout << "#";

	cout << "\n";
	for(int i=0 ; i<row ; i++)
	{
		cout << "#";
		cout << str[i] << "#";
		cout << "\n";
	}
	for(int i=0 ; i<=column+1 ; i++)
		cout << "#";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PI 3.141592653589
#define ll long long
using namespace std;

int main(){
  int n;
  cin >> n;
  
  string s[n];
  map<string, int> mp;

  for(int i=0; i<n; ++i){
    cin >> s[i];

    mp[s[i]]++;
  }

  int maxv = 0;
  for(int i=0; i<n; ++i){
    maxv = max(maxv, mp[s[i]]);
  }

  for(auto itr=mp.begin(); itr!=mp.end(); ++itr){
    if(itr->second == maxv){
      cout << itr->first << endl;
    }
  }
  return 0;
}

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

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int plan1 = n * a;
    int plan2 = b;
    if (plan1 <= plan2) cout << plan1 << endl;
    else cout << plan2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int A,B,C,D;
int N; cin>>N;
A=N/1000;
B=(N/100)%10;
C=(N/10)%10;
D=N%10;
if(A+B+C+D==7){
cout<<A<<"+"<<B<<"+"<<C<<"+"<<D<<"="<<7<<endl;}
else if(A+B+C-D==7){
cout<<A<<"+"<<B<<"+"<<C<<"-"<<D<<"="<<7<<endl;}
else if(A+B-C+D==7){
cout<<A<<"+"<<B<<"-"<<C<<"+"<<D<<"="<<7<<endl;}
else if(A-B+C+D==7){
cout<<A<<"-"<<B<<"+"<<C<<"+"<<D<<"="<<7<<endl;}
else if(A+B-C-D==7){
cout<<A<<"+"<<B<<"-"<<C<<"-"<<D<<"="<<7<<endl;}
else if(A-B+C-D==7){
cout<<A<<"-"<<B<<"+"<<C<<"-"<<D<<"="<<7<<endl;}
else if(A-B-C+D==7){
cout<<A<<"-"<<B<<"-"<<C<<"+"<<D<<"="<<7<<endl;}
else if(A-B-C-D==7){
cout<<A<<"-"<<B<<"-"<<C<<"-"<<D<<"="<<7<<endl;}}


Measured memory_bytes: 256
N = int(input().strip())
H = list(map(int, input().strip().split(' ')))
min_cost = [float('inf')]*(N+1)
min_cost[0] = 0
for i in range(N):
  if i+1 < N:
  	min_cost[i+1] = min(min_cost[i+1], min_cost[i]+abs(H[i]-H[i+1]))
  if i+2 < N:
  	min_cost[i+2] = min(min_cost[i+2], min_cost[i]+abs(H[i]-H[i+2]))
  
print(min_cost[N-1])


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
  string s,t;
  cin >> s >> t;
  int n=s.size();
  int m=t.size();
  vector<char> ss(n);
  vector<char> tt(m);
  rep(i,n){
    ss.at(i)=s.at(i);
  }
  sort(ss.begin(),ss.end());
  rep(i,m){
    tt.at(i)=t.at(i);
  }
  sort(tt.begin(),tt.end());
  reverse(tt.begin(),tt.end());
  bool a=false;
  if(n<m){
    rep(i,n){
      int S=ss.at(i);
      int T=tt.at(i);
      if(S<T){
        a=true;
        break;
      }
      else if(S==T){
         if(i==n-1)a=true;        
      }
      else if(S>T)break;
    }
  }
  else if(n==m){
    rep(i,n){
      int S=ss.at(i);
      int T=tt.at(i);
      if(S<T){
        a=true;
        break;
      }
      else if(S>T)break;
    }
  }
  else{
    rep(i,m){
      int S=ss.at(i);
      int T=tt.at(i);
      if(S<T){
	    a=true;
        break;
      }
      else if(S>T){
        break;
      }
    }
  }
  if(a) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import sys
def input():
	return sys.stdin.readline().strip()

N = int(input())
S = input()
Q = int(input())
k = list(map(int, input().split()))

DM_total = [(0,0,0)]
C_list = []

for i in range(N):
	if S[i] == "D":
		DM_total.append((DM_total[-1][0] + 1, DM_total[-1][1], DM_total[-1][2]))
	elif S[i] == "M":
		DM_total.append((DM_total[-1][0], DM_total[-1][1] + 1, DM_total[-1][2] + DM_total[-1][0]))
	else:
		DM_total.append(DM_total[-1])
	if S[i] == "C":
		C_list.append(i)


for q in range(Q):
	ans = 0
	for c in C_list:
		if k[q] > c:
			ans += DM_total[c + 1][2]
		else:
			ans += DM_total[c + 1][2] - DM_total[c + 1 - k[q]][2]
			ans -= DM_total[c + 1 - k[q]][0] * (DM_total[c + 1][1] - DM_total[c + 1 - k[q]][1])

	print(ans)

Measured memory_bytes: 143060
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main() {
    int cnt = 0, n;
    char temp, old = '#';
    scanf("%d", &n);
    getchar();
    for (int i = 0; i < n; i++) {
        scanf("%c", &temp);
        if (temp != old) cnt++;
        old = temp;
    }
    printf("%d", cnt);
    return 0;
}


Measured memory_bytes: 256
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful -----

#include<bits/stdc++.h>
using namespace std;

#define NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define dloop(i,n) for(int i=n-1;i>=0;i--)
#define iii tuple<int,int,int>
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define int long long
#define ld long double
#define pb push_back
#define endl "\n"
#define setbits __builtin_popcountll
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007
#define inf (int)1e18

int32_t main(){
	NINJA;

	int n; cin >> n;
	cout << n + n*n + n*n*n << endl;	
	
	return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define ggr getchar(); getchar();return 0;
using namespace std;
typedef pair<ll, ll>P;
ll a, b;
signed main() {
	cin >> a >> b;
	cout << a - b + 1 << endl;
	ggr
}

Measured memory_bytes: 256
S = input()

if len(S) % 2 == 0:
    S1 = S[:int(len(S)/2)]
    S2 = S[int(len(S)/2):]
else:
    S1 = S[:int((len(S)/2))]
    S2 = S[int((len(S)/2)+1):]

#print(S1, S2)
count = 0
for i in range(len(S1)):
    if S1[i] != S2[len(S2) -1 - i]:
        count += 1

print(count)

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

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

    static class A_Three_letter_acronym {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            String a = in.next().toUpperCase();
            String b = in.next().toUpperCase();
            String c = in.next().toUpperCase();
            StringBuilder sb = new StringBuilder("");
            sb.append(a.charAt(0));
            sb.append(b.charAt(0));
            sb.append(c.charAt(0));
            out.printLine(new String(sb));
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void printLine(String s) {
            writer.println(s);
        }

        public void close() {
            writer.close();
        }

    }
}



Measured memory_bytes: 22740
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
class Main{
    Integer[][] array = new Integer[1000][1000];
    public void run(){
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
            int width = Integer.parseInt(br.readLine());
            for(int i = 0; i < width; i++){
                for(int j = 0; j < width; j++){
                    array[i][j] = 0;
                }
            }
            br.lines()
                .forEach(n -> createMap(n.split(" ")));
            for(int i = 0; i < width; i++){
                System.out.print(array[i][0]);
                for(int j = 1; j < width; j++){
                    System.out.print(" " + array[i][j]);
                }
                System.out.println();
            }
        }catch(Exception e){
            System.out.println(e);
        }
    }

    public void createMap(String[] n){
        for(int i = 2; i < n.length ; i++){
            array[Integer.parseInt(n[0]) - 1][Integer.parseInt(n[i]) - 1] = 1;
        }
    }
    public static void main(String[] args){
        new Main().run();
    }
}

Measured memory_bytes: 37420
import numpy as np
import heapq as hq
import math

n,m = map(int,input().split())
a = list(map(lambda x:-int(x), input().split()))
hq.heapify(a)

for i in range(m):
    tmp = hq.heappop(a)
    hq.heappush(a, math.ceil(tmp/2))
ans = - sum(a)
print(ans)


Measured memory_bytes: 23060
// 2015/07/03 Tazoe

#include <iostream>
using namespace std;

int F[102][102];

void DFS(int Y, int X, int C)
{
	if(F[Y][X]!=C)
		return;

	F[Y][X] = 6;

	DFS(Y-1, X, C);		// 上
	DFS(Y, X+1, C);		// 右
	DFS(Y+1, X, C);		// 下
	DFS(Y, X-1, C);		// 左
}

int main()
{
	while(true){
		int w, h;
		cin >> w >> h;

		if(w==0 && h==0)
			break;

		for(int y=0; y<=h+1; y++){
			for(int x=0; x<=w+1; x++){
				F[y][x] = 0;		// 初期化
			}
		}

		int xs, ys;
		cin >> xs >> ys;

		int xg, yg;
		cin >> xg >> yg;

		int n;
		cin >> n;

		for(int i=0; i<n; i++){
			int c, d, x, y;
			cin >> c >> d >> x >> y;

			F[y][x] = F[y][x+1] = F[y+1][x] = F[y+1][x+1] = c;

			if(d==0){
				F[y][x+2] = F[y][x+3] = F[y+1][x+2] = F[y+1][x+3] = c;
			}
			else{
				F[y+2][x] = F[y+2][x+1] = F[y+3][x] = F[y+3][x+1] = c;
			}
		}

		if(F[ys][xs]==0){
			cout << "NG" << endl;
			continue;
		}

		DFS(ys, xs, F[ys][xs]);

		if(F[yg][xg]==6){
			cout << "OK" << endl;
		}
		else{
			cout << "NG" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

const int mxN = 1e5+3;
vector<int> G[mxN];

int main(){
	int n, m;
	cin >> n >> m;
	while(m--) {
		int a, b;
		scanf("%d%d", &a, &b);
		a--, b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	vector<int> ans(n, -1);
	queue<int> Q;
	ans[0] = 0;
	Q.push(0);
	while(!Q.empty()) {
		int p = Q.front();
		Q.pop();
		for(auto& e: G[p]) {
			if(ans[e]==-1) {
				ans[e] = p;
				Q.push(e);
			}
		}
	}
	bool found = false;
	for(int i = 0; i < n; ++i) {
		if(ans[i]==-1) found = true;
	}
	if(found) {
		puts("No");
	}else{
		puts("Yes");
		for(int i = 1; i < n; i++){
			printf("%d\n", ans[i]+1);
		}
	}
}

Measured memory_bytes: 10312
N = int(input())

if N == 3:
    print(2, 5, 63)
    exit()

two = []
three = []
six = []
for i in range(0, 30000, 12):
    two.append((i + 2, i + 4))
    two.append((i + 8, i + 10))
    three.append((i + 3, i + 9))
    six.append(i + 6)
    six.append(i + 12)

if N <= 10002:
    two_num = N - 2
    three_num = 2
    six_num = 0
elif N <= 15000:
    two_num = 10000
    three_num = N - 10000
    six_num = 0
else:
    two_num = 10000
    three_num = 5000
    six_num = N - 15000
if two_num % 2 == 1:
    two_num -= 1
    six_num += 1
if three_num % 2 == 1:
    three_num -= 1
    six_num += 1

ans = []
for i in range(two_num // 2):
    a, b = two[i]
    ans.append(a)
    ans.append(b)
for i in range(three_num // 2):
    a, b = three[i]
    ans.append(a)
    ans.append(b)
for i in range(six_num):
    ans.append(six[i])

print(*ans)


Measured memory_bytes: 43248
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val ans = mutableListOf<Pair<Int,Int>>()
    val s = if (n % 2 == 0) n + 1 else n
    for (i in 1..n) {
        for (j in (i+1)..n) {
            if (i + j != s) {
                ans.add(Pair(i, j))
            }
        }
    }
    println(ans.size)
    for (p in ans) {
        println("${p.first} ${p.second}")
    }
}

Measured memory_bytes: 31656
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const int inf = 1000000007;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

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




string t;

int main() {

	cin >> t;

	rep(i, t.size()) {
		if (t[i] == '?') {
			t[i] = 'D';
		}
	}

	cout << t << endl;

	return 0;
}


Measured memory_bytes: 3752
#include<iostream>
#include<vector>
#include<string>

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

// おまけ
long long lcm(long long a, long long b){
    return a * (b / gcd(a, b));
}

int main(){
    long long a, b;
    std::cin >> a >> b;
    std::cout << lcm(a, b) << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int n,a[200005],freq[2000005];
long long sol=0;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++)
    {
        if(i>=a[i])
        sol=sol+1LL*freq[i-a[i]];
        if(a[i]+i<=400005)
        {
            freq[a[i]+i]++;
        }
    }
    cout<<sol;
}


Measured memory_bytes: 5960
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

ll f(ll b, ll n) {
    if (n < b) return n;
    return f(b, n / b) + n % b;
}
ll fast(ll b, ll n) {
    if (n < b) return n;
    return n / b + n % b;
}
int main() {
    ll n, s;
    cin >> n >> s;
    if (n == s) {
        cout << n + 1 << endl;
        return 0;
    }
    for (ll i = 2; i * i <= n; i++) {
        if (s == f(i, n)) {
            cout << i << endl;
            return 0;
        }
    }
    set<ll> ans;
    for (ll p = 1; p * p <= n; p++) {
        ll b = (n - s) / p + 1;
        if (b > 1 && f(b, n) == s) {
            ans.insert(b);
        }
    }
    if (ans.size())
        cout << *ans.begin() << endl;
    else
        cout << "-1" << endl;
    return 0;
}


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

int main() {
	long long N, A, B, X, Y, Cur = 1;
	vector<long long> V;
	vector<vector<long long> > ANS;
	cin >> N >> A >> B;
	if (A * B < N || N + 1 < A + B) {
		cout << -1 << endl;
		return 0;
	}
	X = N, Y = B;
	for (int i = 0; i < B; i++) {
		if (X == Y) {
			V.push_back(1);
			X--, Y--;
		}
		else if (X - A >= Y - 1) {
			V.push_back(A);
			X -= A;
			Y--;
		}
		else {
			V.push_back(X - Y + 1);
			Y--;
			X = Y;
		}
	}
	for (int i = 0; i < B; i++) {
		vector<long long> VV = {};
		for (int j = 0; j < V[i]; j++) {
			VV.push_back(Cur);
			Cur++;
		}
		ANS.push_back(VV);
	}
	for (int i = B - 1; i >= 0; i--) {
		for (int j = 0; j < ANS[i].size(); j++) {
			cout << ANS[i][j];
			if (i == 0 && j == ANS[i].size() - 1) cout << endl;
			else cout << " ";
		}
	}
}

Measured memory_bytes: 15080
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, H;
    cin >> N >> H;
    int a[N], b[N];
    rep(i, N) cin >> a[i] >> b[i];
    sort(a, a+N, greater<int>());
    sort(b, b+N, greater<int>());
    int ans = 0;
    rep(i, N) {
        if (b[i] < a[0]) break;
        H -= b[i];
        ans++;
        if (H <= 0) {
            cout << ans << endl;
            return 0;
        }
    }

    ans += (H / a[0]);
    if (H % a[0] != 0) ans++;
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
long long mod = 1e9+7;

bool check(long long d) {
  for(long long i=1; i*i<=d; i++) {
    if(i*i == d) return true;
  }
  return false;
}

int main(void) {
  int n, d; cin >> n >> d;
  vector< vector<int> > x(n, vector<int>(d));
  for(int i=0; i<n; i++) {
    for(int j=0; j<d; j++) cin >> x[i][j];
  }

  int cnt = 0;
  for(int i=0; i<n; i++) {
    for(int j=i+1; j<n; j++) {
      long long sum = 0;
      for(int k=0; k<d; k++) {
        sum += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      }
      cnt += check(sum);
    }
  }
  cout << cnt << endl;



  return 0;
}

// EOF


Measured memory_bytes: 256