akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define pb push_back

using namespace std;
using ll = long long int;
const int MOD = 1e9 + 7;
const int N = 51;

array<array<ll, N>, N> mul(array<array<ll, N>, N> a, array<array<ll, N>, N> b, int n)
{
	array<array<ll, N>, N> c;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
		{
			c[i][j] = 0;
			for (int k = 0; k < n; ++k)
			{
				c[i][j] += (a[i][k] * b[k][j]) % MOD;
				c[i][j] %= MOD;
			}
		}
	return c;
}

array<array<ll, N>, N> matpow(array<array<ll, N>, N> a, ll k, int n)
{
	array<array<ll, N>, N> ret;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
			ret[i][j] = i == j;
	while (k)
	{
		if (k & 1) ret = mul(ret, a, n);
		a = mul(a, a, n);
		k >>= 1;
	}
	return ret;
}

void solve()
{
	ll n, k; cin >> n >> k;
	array< array<ll, N>, N> a;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
			cin >> a[i][j];
	array<array<ll, N>, N> b = matpow(a, k, n);
	ll ans = 0;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
		{
			ans += b[i][j];
			ans %= MOD;
		}
	cout << ans;
}

//  ---------------------Template---------------------------
void InputSetup()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	#ifdef LOCAL
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
	#endif
}

int main(void)
{
	auto start = chrono::high_resolution_clock::now();

	InputSetup();
	solve();

	auto finish = chrono::high_resolution_clock::now();
	cerr << "Time elapsed: " << (chrono::duration<long double>(finish-start)).count() << "s\n";
}
//  ---------------------Template---------------------------

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define repf(i, x, n) for (int i = (int)(x); i < (int)(n); i++)
#define repfr(i, x, n) for (int i = (int)(x)-1; i >= (int)(n); i--)
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
#define INF 1e9
using ll = int64_t;
#define waru 1000000007

std::int64_t gcd(std::int64_t a, std::int64_t b) {
  // a >= b && b != 0
  std::int64_t c;
  do {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb) {
  std::int64_t a = max(aa, bb);
  std::int64_t b = min(aa, bb);
  std::int64_t c;
  if (b == 0) {
    return -1;
  }
  do {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}
void rle(std::vector<std::pair<char, std::int64_t>> &data, std::string str) {
  char now = str[0];
  std::int64_t count = 0;
  for (std::int64_t i = 0; i < str.size() + 1; i++) {
    if (i == str.size()) {
      data.push_back(make_pair(str[i - 1], count));
      break;
    } else if (now != str[i]) {
      data.push_back(make_pair(now, count));
      now = str[i];
      count = 0;
    }
    count++;
  }

  return;
}

void Main() {
  //自動整形防止用
  int n, m;
  std::cin >> n >> m;
  std::cout << (n - 1) * (m - 1) << '\n';

  return;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::{cmp::Reverse, collections::*};

#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Chars, Usize1},
};

#[allow(unused_imports)]
use itertools::Itertools;

#[allow(unused_imports)]
use num::Integer;

#[fastout]
pub fn main() {
    input! {
        x1: i32, y1: i32, x2: i32, y2: i32,
    }
    let (x3, y3) = ((y1 - y2) + x2, -(x1 - x2) + y2);
    let (x4, y4) = (-(y2 - y1) + x1, (x2 - x1) + y1);
    println!("{} {} {} {}", x3, y3, x4, y4);
}


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

#define maxn 202
#define FOR(i, l, r) for (int i=l; i<=r; ++i)
#define FORD(i, r, l) for (int i=r; i>=l; --i)
#define REP(i, r) for (int i=0; i<(int)r; ++i)
#define REPD(i, r) for (int i=(int)r-1; i>=0; --i)
#define fi first
#define se second
#define mk make_pair
#define nil NULL
#define y0 __y0
#define y1 __y1
#define x0 __x0
#define x1 __x1
#define next __next
#define sz size
#define Debug(X) {cerr << #X << " = " << X << '\n';}
#define PR(A, n) {cerr << #A << " = "; FOR(i, 1, n) cerr << A[i] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; REP(i, n) cerr << A[i] << ' '; cerr << '\n';}
typedef long long ll;
typedef double db;
typedef pair<db, db> dd;
typedef pair<int, int> ii;
typedef vector<int> vi;
const int inf = 1e9;
template<class T> int getbit(T x, int pos) {return (x>>(pos-1)) & 1;}
template<class T> void turn_on(T &x, int pos) {x = x | ((T)1<<(pos-1));}
template<class T> void turn_off(T &x, int pos) {x = x & ~((T)1<<(pos-1));}
template<class T> T sqr(T a) {return a*a;}

int m, n, d[maxn], f[maxn][maxn], c[maxn][maxn], s, t;
char lake[maxn][maxn];
vector<int> a[maxn];
queue<int> qu;

bool findPath(int s, int t) {
    while (qu.sz()) qu.pop();
    qu.push(s);
    memset(d, 0, sizeof(d));
    while (qu.sz()) {
        int u = qu.front(); qu.pop();
        if (u==t) return true;
        REP(i, a[u].sz()) {
            int v = a[u][i];
            if (d[v]==0 && c[u][v]>f[u][v]) {
                d[v] = u;
                qu.push(v);
            }
        }
    }
    return false;
}

void incFlow() {
    int delta = inf;
    for (int v = t; v!=s; v = d[v]) delta = min(delta, c[d[v]][v] - f[d[v]][v]);
    for (int v = t; v!=s; v = d[v]) {
        f[d[v]][v] += delta;
        f[v][d[v]] -= delta;
    }
}

int main() {
    //freopen("lotus.inp", "r", stdin);
    //freopen(".out", "w", stdout);
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> m >> n;
    FOR(i, 1, m) FOR(j, 1, n) cin >> lake[i][j];
    FOR(i, 1, m) FOR(j, 1, n) {
        if (lake[i][j]!='.') {
            a[i].push_back(m+j);
            a[m+j].push_back(i);
            if (lake[i][j]=='o') c[i][m+j] = c[m+j][i] = 1;
            else c[i][m+j] = c[m+j][i] = inf;
        }
        if (lake[i][j]=='S')
            s = i;
        if (lake[i][j]=='T')
            t = m+j;
    }
    while (findPath(s, t))
        incFlow();
    int res = 0;
    REP(i, a[s].sz()) {
        res += f[s][a[s][i]];
    }
    if (res>=inf) printf("-1");
    else printf("%d", res);
}



Measured memory_bytes: 768
program not_k_perm_counting
  implicit none
  integer(8), parameter :: md = 924844033_8
  integer :: n, k, i, j, l, m, p
  integer(8) :: ans = 0_8, t = 1_8, g(0:4000,0:1) = 0_8
  integer(8), dimension(0:4000) :: f = 0_8, a = 0_8
  f(0) = 1_8
  g(0,0) = 1_8
  read(*,*) n, k
  do i = 1, n
    f(i) = mod(f(i-1)*int(i,8),md)
  end do
  do i = 1, k
    m = (n-i)/k
    do p = 1, 2
      do j = 1, m
        do l = n, 1, -1
          g(l,0) = mod(g(l,0)+g(l,1),md)
          g(l,1) = g(l-1,0)
        end do
        g(0,0) = mod(g(0,0)+g(0,1),md)
      end do
      do j = 0, n
        g(j,0) = mod(g(j,0)+g(j,1),md)
        g(j,1) = 0_8
      end do
    end do
  end do
  do i = 0, n
    ans = modulo(ans+t*mod(g(i,0)*f(n-i),md),md)
    t = -t
  end do
  write(*,'(i0)') ans
end program not_k_perm_counting

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
  for (double a, b, c, d, e, f;
       cin >> a >> b >> c >> d >> e >> f;
       ) {
    double x = (c*e - f*b) / (a*e - d*b);
    double y = (c - a*x) / b;
    if (abs(x) < 1e-10) x = 0;
    if (abs(y) < 1e-10) y = 0;
    printf("%.3f %.3f\n", x, y);
  }
  return 0;
}

Measured memory_bytes: 1228
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = [[set(), set()] for _ in range(N)]
    for i in range(N):
        m = int(input())
        for j in range(m):
            x, y = map(int, input().split())
            A[i][y].add(x)

    ans = 0
    for i in range(1 << N):
        h, u = set(), set()
        for j in range(N):
            if (i >> j) & 1:
                h.add(j+1)
                h |= A[j][1]
                u |= A[j][0]
            else:
                u.add(j+1)
        if not (h & u):
            ans = max(ans, len(h))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <queue>
#include <stack>
using namespace std;

typedef long long ll;
#define pb push_back

#define rep(i, n) for (int i=0;i<(n);++i)
#define rep2(i, s, n) for (int i=s;i<(n);++i)
#define INF (1e9)

class Edge{
public:
    int u, v, cost;
    Edge(int u, int v, int cost):
        u(u), v(v), cost(cost) {}
    bool operator < (const Edge& e) const {
        return cost != e.cost ? cost > e.cost :
            u != e.u ? u < e.u : v < e.v;
    }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

/* Dijkstra Algorithm */
void dijkstra(Graph& G, vector<int>& d, vector<int>& p, int s)
{
    int V = G.size();
    priority_queue<Edge> Q;

    d[s] = 0;
    Q.push(Edge(-2,s,0)); // Edge.cost as d
    while(!Q.empty()) {
        Edge e = Q.top(); Q.pop();
        //if(p[e.v] != -1) continue;
        //p[e.v] = e.u;
        if(d[e.v] == INF) continue;
        for(auto& f:G[e.v]) if(d[f.v] > d[f.u] + f.cost) {
                d[f.v] = d[f.u] + f.cost;
                p[f.v] = f.u;
                Q.push(Edge(f.u, f.v, d[f.u] + f.cost));
            }
    }
}

int main()
{
    int V,E,s; cin>>V>>E>>s;
    Graph G(V);
    rep(i,E) {
        int u,v,c; cin>>u>>v>>c;
        G[u].pb(Edge(u,v,c));
    }

    vector<int> d(V,INF), p(V,-1);
    
    dijkstra(G,d,p,s);
    
    rep(i,V)
        if(d[i] == INF) cout << "INF" << endl;
        else cout << d[i] << endl;
}

Measured memory_bytes: 16392
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n],b[n],c[n-1];
  for(int i=0;i<n;i++)
    cin>>a[i];
  for(int i=0;i<n;i++)
    cin>>b[i];
  for(int i=0;i<n-1;i++)
    cin>>c[i];
  int sum=b[a[0]-1];
  for(int i=1;i<n;i++)
  {
    sum+=b[a[i]-1];
    if(a[i-1]==a[i]-1)
      sum+=c[a[i-1]-1];
  }
  cout<<sum;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define INF 1000000000
using namespace std;

int n, a, b, c, l[8];
long dfs(int cur, int p, int q, int r)
{
	if(cur == n){
		if(min(min(p, q), r) > 0)
			return abs(p - a) + abs(q - b) + abs(r - c) - 30;
		else
			return INF;
	}

	long ret[4];
	ret[0] = dfs(cur + 1, p, q, r);
	ret[1] = dfs(cur + 1, p + l[cur], q, r) + 10;
	ret[2] = dfs(cur + 1, p, q + l[cur], r) + 10;
	ret[3] = dfs(cur + 1, p, q, r + l[cur]) + 10;
	return min(min(min(ret[0], ret[1]), ret[2]), ret[3]);
}
int main(void)
{
	cin >> n >> a >> b >> c;
	for(int i = 0; i != n; i++) cin >> l[i];
	cout << dfs(0, 0, 0, 0) << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        struct Station
        {
            public int C { get; }
            public int S { get; }
            public int F { get; }

            public Station(int c, int s, int f)
            {
                C = c;
                S = s;
                F = f;
            }
        }

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Station[] S = Enumerable.Repeat(0, n - 1).Select(_ =>
            {
                var array = Console.ReadLine().Split().Select(int.Parse).ToArray();
                return new Station(array[0], array[1], array[2]);
            }).ToArray();

            for (int start = 0; start < n - 1; start++)
            {
                int time = 0;

                for (int current = start; current < n - 1; current++)
                {
                    if (time < S[current].S)
                    {
                        time = S[current].S;
                    }
                    else if (time % S[current].F != 0)
                    {
                        time += S[current].F - time % S[current].F;
                    }

                    time += S[current].C;
                }

                Console.WriteLine(time);
            }

            Console.WriteLine(0);
        }
    }
}

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

int main()
{
  int n;
  cin>>n;
  
  int x = n%10;
  
  if(x == 3)
    cout<<"bon"<<endl;
  else if(x == 0 || x==1 || x==6 || x==8)
    cout<<"pon";
  else
    cout<<"hon";
}

Measured memory_bytes: 3568
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    N, T = map(int, input().split())
    MAX_ANS = 10000
    ans = MAX_ANS
    for _ in range(N):
        c, t = map(int, input().split())
        if c < ans and t <= T:
            ans = c
    if ans == MAX_ANS:
        print('TLE')
    else:
        print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char ch[11];
    int cnt=0,maxi=0;
    scanf("%s",&ch);
    int len = strlen(ch);
    for(int i=0; i<len; i++)
    {
        if(ch[i]=='A' || ch[i]=='C' || ch[i]=='G' || ch[i]=='T')++cnt;
        if((ch[i]!='A' && ch[i]!='C' && ch[i]!='G' && ch[i]!='T')||(i==len-1))
        {
            if(cnt>maxi)maxi=cnt;
            cnt=0;
        }
    }
    printf("%d\n",maxi);

}



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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

int main()
{
    int n, m, c;
    cin >> n >> m >> c;
    int b[m];
    int a[n][m];
    int okcount = 0;
    REP(i, m) { cin >> b[i]; }
    REP(i, n)
    {
        REP(j, m) { cin >> a[i][j]; }
    }
    lint absum = 0;
    REP(i, n)
    {
        absum = 0;
        REP(j, m)
        {
            absum += a[i][j] * b[j];
        }
        if (absum + c > 0)
        {
            okcount += 1;
        }
    }

    cout << okcount << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod=1000000007;
const int INF=1001001001;

vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  int N;
  cin>>N;
  int64_t ans=1;
  vector<int>d(N+1);
  d[0]=3;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    ans*=d[a];
    ans%=mod;
    d[a]--;d[a+1]++;
  }
  cout<<ans<<endl;
  return 0;  
}

Measured memory_bytes: 3736
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    public static void Main()
    {
        long N = NextInt();
        long M = NextInt();
        List<int> memo = new List<int>();
        int m = (int)Math.Sqrt(M);
        for (int i = 1; i <= m; i++) { if (M % i == 0) memo.Add(i); }
        long ans = 1;
        foreach (var i in memo)
        {
            //Console.WriteLine(i + " : " + (M/i));
            if (i * N <= M) ans = Math.Max(i, ans);
            if ((M / i) * N <= M) ans = Math.Max(M / i, ans);
            //Console.WriteLine(ans);
        }
        Console.WriteLine(ans);
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdfix.h>
 
using namespace std;
 
int main() {
    int N,D;
    cin >> N >> D;
    float X[N][D];
    for(int ni = 0; ni < N; ni++){
        for(int di = 0; di < D; di++){
            cin >> X[ni][di];
        }
    }
    int count = 0;
    for(int i = 0; i < N - 1; i++){
        for(int j = i + 1; j < N; j++){
            float distance = 0;
            for(int di = 0; di < D; di++){
                distance += (X[i][di] - X[j][di]) * (X[i][di] - X[j][di]);
            }
            distance = sqrt(distance);
            if(distance == floor(distance)){
                count++;
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    long a,b,c,d;
    cin >> a >> b >> c >> d;

    long ac = a*c;
    long ad = a*d;
	long bc = b*c;
    long bd = b*d;
	long ans = ac;
  	if(ans<ad){
      ans = ad;
    }
  	if(ans<bc){
    	ans = bc;
  	}	
  	if(ans<bd){
    	ans = bd;
  	}
    if(ans<0){
        if((a<0 && b>0) || (c<0 && d>0)){
            ans=0;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main()
{
	int n;
	cin >> n;
	while(n--)
	{
		int count = 0,out = 0;
		int home[4];
		memset(home,0,sizeof(home));
		while(out != 3)
		{
			string s;
			cin >> s;

			if(s == "OUT")
			{
				out++;
			}
			else if(s == "HIT")
			{
				if(home[2] == 1)
				{
					home[2]--;
					home[3]++;
				}
				if(home[1] == 1)
				{
					home[1]--;
					home[2]++;
				}
				if(home[0] == 1)
				{
					home[0]--;
					home[1]++;
				}

				home[0]++;
			}
			else if(s == "HOMERUN")
			{
				if(home[2] == 1)
				{
					home[2]--;
					home[3]++;
				}
				if(home[1] == 1)
				{
					home[1]--;
					home[3]++;
				}
				if(home[0] == 1)
				{
					home[0]--;
					home[3]++;
				}
				home[3]++;
			}
		}
		count = home[3];
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define be begin()
#define en end()
#define le length()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (__typeof(n) i = 0; i < n; i++)
#define repo(i, n) for (__typeof(n) i = 1; i <= n; i++)
#define fastIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define eps 1e-6
#define pi 3.141592653589793
#define c(a) cout << a << "\n";
#define ao(a)        \
    for (auto i : a) \
        cout << i << " ";
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MOD = 1e9 + 7;
const int INF = 1e9;
int main()
{
 ll l,r;
 cin>>l>>r;
 if(l>r) swap(l,r);
 if((l>0 )&& (r<10)) c(l*r)
 else c(-1)
    return 0;
}

Measured memory_bytes: 256
import java.io.*
import java.util.*

fun solve(A: Long, B: Long, C: Long, K: Long){
    val abc = listOf(A, B, C).sorted()
    println(abc[0] + abc[1] + abc[2]*Math.pow(2.toDouble(), K.toDouble()).toLong())
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val A = sc.next().toLong()
    val B = sc.next().toLong()
    val C = sc.next().toLong()
    val K = sc.next().toLong()
    solve(A, B, C, K)
}



Measured memory_bytes: 34084
program island_war
  implicit none
  integer :: n, m, r(100000,2), i, j, s, x
  r = 0
  read(*,*) n, m
  do i = 1, m
    read(*,*) r(i,:)
  end do
  call merge_sort(m,r(1:m,:),2)
  x = -1
  s = 0
  do i = 1, m
    if (x.lt.r(i,1)) then
      s = s + 1
      x = r(i,2) - 1
    end if
  end do
  write(*,'(i0)') s
  stop
contains
  subroutine merge_sort(n,c,idx)
    implicit none
    integer, intent(in)    :: n, idx
    integer, intent(inout) :: c(n,2)
    integer                :: number, length, i, ubnd
    number = n
    length = 1
    do while (number.gt.1)
      do i = 1, number/2
        ubnd = min(2*i*length,n)
        call merge(c(2*(i-1)*length+1:(2*i-1)*length,:),c((2*i-1)*length+1:ubnd,:),idx)
      end do
      length = 2*length
      number = (number+1)/2
    end do
    return
  end subroutine merge_sort
  subroutine merge(c1,c2,idx)
    implicit none
    integer, intent(inout) :: c1(:,:), c2(:,:)
    integer, intent(in)    :: idx
    integer                :: c(size(c1(:,1))+size(c2(:,1)),size(c1(1,:)))
    integer                :: i1, i2, n1, n2
    i1 = 1
    i2 = 1
    n1 = size(c1(:,1))
    n2 = size(c2(:,1))
    do while ((i1.le.n1).and.(i2.le.n2))
      if (c1(i1,idx).le.c2(i2,idx)) then
        c(i1+i2-1,:) = c1(i1,:)
        i1 = i1+1
      else
        c(i1+i2-1,:) = c2(i2,:)
        i2 = i2+1
      end if
    end do
    if (i1.le.n1) then
      c(i1+i2-1:n1+n2,:) = c1(i1:n1,:)
    else if (i2 .le. n2) then
      c(i1+i2-1:n1+n2,:) = c2(i2:n2,:)
    end if
    c1 = c(1:n1,:)
    c2 = c(n1+1:n1+n2,:)
    return
  end subroutine merge
end program island_war

Measured memory_bytes: 2808
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<int> vec;

void solve(){
	int n; cin >> n;
	if ((n / 10) == 9 || (n % 10) == 9) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(6);
	//init();
	solve();
	stop
		return 0;
}


Measured memory_bytes: 256
#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;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }
 
using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
 
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};
 
const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod


#include <bits/stdc++.h>
using namespace std;
signed main(){
    int N; cin>>N;
    vec A(N); REP(i,N) cin>>A[i];
    vec check(N,0);
    int c = A[0];
    int ans = -1;
    REP(i,N){
        check[c-1]++;
        c = A[c-1];
        if(check[1]==1){
            ans = i+1;
            break;
        }
    }
    Out(ans);
}


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

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i < (int)vec.size(); ++i) {
        os << vec[i] << (i + 1 == (int)vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
void dump_func() {
    cerr << "\n";
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail) {
    cerr << head;
    if (sizeof...(Tail) == 0) {
        cerr << " ";
    } else {
        cerr << ", ";
    }
    dump_func(std::move(tail)...);
}
#define dump(...) cerr << "[" << to_string(__LINE__) << "]"        \
                       << "    " << string(#__VA_ARGS__) << " = ", \
                  dump_func(__VA_ARGS__)

using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<double>;
using VVI = vector<VI>;
using VVL = vector<VL>;
using PI = pair<int, int>;
using PL = pair<ll, ll>;
using VPI = vector<PI>;
using VPL = vector<PL>;
using VS = vector<string>;

#define ln '\n'
#define REP(t, n) for (int t = 0; t < (n); ++t)
#define FOR(t, a, b) for (int t = (a); t <= (b); ++t)
#define FORR(t, a, b) for (int t = (a); t >= (b); --t)
#define ALL(c) (c).begin(), (c).end()
#define CAUTO const auto&

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

    int k, x;
    cin >> k >> x;
    for (int i = x - k + 1; i <= x + k - 1; i++) {
        if (i >= -1000000 && i <= 1000000) {
            cout << i << " ";
        }
    }
    cout << ln;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
	vector<int> v;
	int n;
	cin>>n;
	char a[n][50],temp[50];
	int b[n];
	for(int i=0;i<n;i++)
		cin>>a[i]>>b[i];
		
		for(int i=0;i<n;i++)
		v.push_back(b[i]);
	    for(int i=0;i<n;i++)
		{
			for(int j=i+1;j<n;j++)
			{
				if(strcmp(a[i],a[j])>0)
				{
					swap(b[j],b[i]);
					strcpy(temp,a[j]);
					strcpy(a[j],a[i]);
					strcpy(a[i],temp);
				}
				if(strcmp(a[j],a[i])==0 && b[i]<b[j])
				{
					swap(b[j],b[i]);
					strcpy(temp,a[j]);
					strcpy(a[j],a[i]);
					strcpy(a[i],temp);
				}
			}
		}
		
		for(int i=0;i<n;i++)
		{
			int ele=b[i];
			auto it=find(v.begin(),v.begin()+n,ele);
			int itr=distance(v.begin(),it);
			cout<<++itr<<endl;
		}
			return 0;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int x,a;
    cin>>x>>a;
    if(x<a) cout<<0<<endl;
    else cout<<10<<endl;

    return 0;
}

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

int main() {
	int cnt;
	string t;
	cin >> t;
	rep(i, t.size()) {
		if (t[i] == '?')
			cout << 'D';
		else cout << t[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
// long long mod=180143987779;
// vector<long long > t(4*100001);
// bool comp(tuple<int,int,int> a,tuple<int,int,int> b)
// {
//   if(get<0>(a)<get<0>(b))
//   {
//     return false;
//   }
//   else if(get<0>(a)==get<0>(b) && get<1>(b)<get<1>(a))
//   {
//     return true;
//   }
//   else
//   {
//     return true;
//   }
// }
// void buildseg(long long  x,long long  l,long long  r,vector<long long > &a,long long  modi)
// {
//   if(l==r)
//   {
//     t[x]=a[l]%modi;
//   }
//   else
//   {
//     long long  mid=(l+r)/2;
//     buildseg(2*x+1,l,mid,a,modi);
//     buildseg(2*x+2,mid+1,r,a,modi);
//     t[x]=(t[2*x+1]+t[2*x+2])%modi;
//   }
// }
// long long  sum(long long  x,long long  l1,long long  r1,long long  l,long long  r,long long  modi)
// {
//   if(l>r)
//   {
//     return 0;
//   }
//   else if(l1==l && r1==r)
//   {
//     return t[x];
//   }
//   else
//   {
//     long long  mid=(l1+r1)/2;
//     return (sum(2*x+1,l1,mid,l,min(r,mid),modi)+sum(2*x+2,mid+1,r1,max(l,mid+1),r,modi))%modi;
//   }
// }
// void update(long long  x,long long  l,long long  r,long long  value,long long  pos,long long  modi)
// {
//   if(l==r)
//   {
//     t[x]=value%modi;
//   }
//   else
//   {
//     long long  mid=(l+r)/2;
//     if(mid>=pos)
//     {
//       update(2*x+1,l,mid,value,pos,modi);
//     }
//     else
//     {
//         update(2*x+2,mid+1,r,value,pos,modi);
//     }
//     t[x]=(t[2*x+1]+t[2*x+2])%modi;
//   }
// }
// void prdoubleseg(long long  n)
// {
//   for(long long  i=0;i<4*n;i++)
//   {
//     cout<<t[i]<<" ";
//   }
//   cout<<endl;
// }
// void dfs(double x,  vector<vector<double> > &adj,vector<set<double> > &v,double &count,vector<double> &vis)
// {
//   v[x].insert(count);
//   vis[x]=1;
//   for(auto i : adj[x])
//   {
//     if(vis[i]==0)
//     {
//       vis[i]=1;
//       dfs(i,adj,v,count,vis);
//     }
//   }
// }
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
   T=1;
  while(T--)
  {
    int a,b,c;
    cin>>a>>b>>c;
    int k;
    cin>>k;
    if(k<=a)
    {
      cout<<k<<endl;
      continue;
    }
    else if(k<=(a+b))
    {
      cout<<a<<endl;
      continue;
    }
    else
    {
      cout<<a-(k-a-b)<<endl;
    }
  }


   return 0;
}


Measured memory_bytes: 3592
N = int(input())
A = list(map(int, input().split()))
cumsum = A.copy()
for i in range(N-1):
  cumsum[i+1] += cumsum[i]

ans = float('inf')
i = 0; j = 1; k = 2
P = cumsum[i]; Q = cumsum[j]-cumsum[i]
diff1 = abs(P - Q)
R = cumsum[k]-cumsum[j]; S = cumsum[-1] - cumsum[k]
diff2 = abs(R - S)
while j <= N - 3:
  while i < j - 1:
    if abs(P - Q + 2*A[i+1]) < diff1:
      i += 1
      P += A[i]
      Q -= A[i]
      diff1 = abs(P - Q)
    else:
      break
  while k <= N - 3:
    if abs(R - S + 2*A[k+1]) < diff2:
      k += 1
      R += A[k]
      S -= A[k]
      diff2 = abs(R - S)
    else:
      break
  ans = min(ans, max(P, Q, R, S)-min(P, Q, R, S))
  j += 1
  Q += A[j]
  R -= A[j]
  diff1 = abs(P - Q)
  diff2 = abs(R - S)

print(ans)

Measured memory_bytes: 25672
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();return 0;}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d>0?i<n:i>n;i+=d)
#define endl "\n"
#ifdef __LOCAL
#include "ostreams.h"
#endif
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

void solve(){
    ll n, m; cin >> n >> m;
    vector<ll> A(n);
    rep(i, n) cin >> A[i];

    unordered_map<ll, ll> counter{{0, 1}};
    ll res = 0;
    ll cumsum = 0;
    for(auto a : A){
        cumsum += a;
        cumsum %= m;
        res += counter[cumsum];
        counter[cumsum]++;
    }
    
    cout << res << endl;
}

Measured memory_bytes: 4492
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val n = nextFloat()
    val aa = listOfFloat()

    var tmp = 0f
    for (a in aa) {
        tmp += (1f / a)
    }

    println(1f / tmp)
}

fun next() = readLine()!!
fun nextFloat() = next().toFloat()
fun listOfString() = next().split(" ")
fun listOfFloat() = listOfString().map { it.toFloat() }

fun println(value : Any) {
    pw.println(value)
}

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

using namespace std;

int main(){
	int x, y, z; scanf("%d %d %d", &x, &y, &z);
	int res; x -= z;
	/*if(x % (y + z) == 0) res = (x / (y + z)) - 1;
	else */res = x / (y + z);
	printf("%d\n", res);
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
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 MOD7 1000000007
#define LL_INF 1LL << 60
#define LL_MINF -1LL << 60
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const long double PI = (acos(-1));


int main(){
    string w;
    cin >> w;
    vector<string> T;
    while(true){
        string s;
        cin >> s;
        if(s == "END_OF_TEXT") break;
        for(char &c : s){
            if('A' <= c and c <= 'Z') c = tolower(c);
        }
        T.push_back(s);
    }
    int count = 0;
    for(string s : T){
        if(s == w) count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 3148
#include<iostream>
#include<cmath>
using namespace std;
int a[1000000];
double b[1000000];
 
int main(){
	int x,y,n;
	cin>>n;
	cin>>x>>y;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		b[i]=fabs(y-(x-1.0*a[i]*0.006));
	
	}
	
	int f;
	double min=9999999999;
		for(int i=1;i<=n;i++)
		{
			if(b[i]<min)
			{
				min=b[i];
				f=i;
			}
		}
		cout<<f;
}

Measured memory_bytes: 2304
#include <iostream>
#include <cstring>
using namespace std;
const int maxn = 100002;
bool cmp(int a, int b){
    return a < b;
}
int main(){
    int n;
    cin >> n;
    int num[maxn], cnt[100001];
    memset(cnt, 0, sizeof(cnt));
    for (int i = 0 ; i < n ; i++){
        cin >> num[i];
        cnt[num[i]]++;
    }
    int MAX = -1;
    for (int i = 0 ; i < n ; i++){
        if (num[i] == 0)
            MAX = max(MAX, cnt[num[i]+1] + cnt[num[i]]);
        else if (num[i] == 99999)
            MAX = max(MAX,cnt[num[i]] + cnt[num[i]-1]);
        else
            MAX = max(MAX,cnt[num[i]+1] + cnt[num[i]] + cnt[num[i]-1]);
    }
    cout << MAX << '\n';

    return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    var ans = arrayOf(a, b, c).max()!!
    while (true) {
        val d1 = ans - a
        val d2 = ans - b
        val d3 = ans - c
        val d = d1 + d2 + d3
        if (d % 2 == 0) {
            println(d / 2)
            return
        }
        ans++
    }
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;


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

    int n = s.size();
    map<string, int> mp;
    for(int i = 0; i < n; i++){
        for(int j = 1; j <= 5; j++){
            string t = s.substr(i, j);
            mp[t]++;
        }
    }

    int c = 0;
    for(auto p : mp){
        c++;
        if(c == k){
            cout << p.first << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 4820
def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    ans = 0
    for a in range(A + 1):
        for b in range(B + 1):
            for c in range(C + 1):
                if a * 500 + b * 100 + c * 50 == X:
                    ans += 1
    print(ans)


main()


Measured memory_bytes: 2940
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef long long lint;
typedef double ld;

void a();void b();void c();void d();void e();void f();

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

	// a();
	// b();
	// c();
	d();
	// e();
	// f();
	return 0;
}

void a(){
	int n;
	cin >> n;
	n %= 10;
	if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9)puts("hon");
	else if(n == 3)puts("bon");
	else puts("pon");

}

void b(){
	int n;
	string  s;
	cin >> n >> s;
	if((int)s.size() > n){
		cout << s.substr(0, n) << "...";
	}else cout << s;
}

ld calcAngle(double h, double m)  
{  
    
    if (h == 12) h = 0;  
    if (m == 60) m = 0;  
    ld hour_angle = 0.5 * (h * 60 + m);  
    ld minute_angle = 6 * m;  
    ld angle = abs(hour_angle - minute_angle);  
    angle = min(360 - angle, angle);  
    return angle;  
} 
const ld pi = 2 * acos(0);
void c(){
	int a, b, h, m;
	cin >> a >> b >> h >> m;
	ld deg = calcAngle(h, m);
	deg *=  pi / 180.0;
	ld ans = a * a + b * b - 2 * a * b * cos(deg);
	ans = sqrt(ans);
	cout << fixed << setprecision(20) << ans;
	// deb(deg);
}
const int maxn = 1e5 + 100;
vi adj[maxn], par(maxn);
bool used[maxn];

void bfs(int s){
	used[s] = true;
	queue<int> q;
	q.push(s);
	par[s] = -1;
	while(!q.empty()){
		auto u = q.front();
		q.pop();
		for(auto v:adj[u]){
			if(!used[v]){
				used[v] = true;
				par[v] = u;
				q.push(v);
			}
		}
	}
}
void d(){
	int n, m;
	cin >> n >> m;
	forn(i, m){
		int x, y;
		cin >> x >> y;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	bfs(1);
	for1(i, n){
		if(!used[i]){
			cout << "No";
			return ;
		}
	}
	cout << "Yes\n";
	for(int i = 2; i <= n; i++)cout << par[i] << '\n';
}

void e(){

}

void f(){

}

Measured memory_bytes: 10388
import sys
input = sys.stdin.readline

N,M=map(int,input().split())
A=list(map(int,input().split()))

S=0
SUM=sum(A)
for a in A:
    if a*4*M>=SUM:
        S+=1

if S>=M:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
	int b = sc.nextInt();
	int k = sc.nextInt();
	for(int i = 0; i<k; i++) {
	    if(i%2==0) {
		if(a%2!=0) a--;
		a = a/2;
		b = b+a;
	    }else {
		if(b%2!=0) b--;
		b = b/2;
		a = b+a;
	    }

	}


	System.out.println(a + " " +b);
    }
}

Measured memory_bytes: 21972
n,*a=map(int,open(0).read().split())
def dp_table(MXi,MXj):
    return [[0]*MXi for _ in range(MXj)] 
MX=2005
dp=dp_table(MX,MX)
p=sorted([(a[i]*MX+i) for i in range(n)])[::-1]
# print(p)
for i in range(n):
    ai,pi=divmod(p[i],MX)
    for l in range(n):
        r=i-l
        if not 0<=r<=n:
            break
        dp[i+1][l+1]=max(dp[i+1][l+1],dp[i][l]+ai*(pi-l))
        dp[i+1][l+0]=max(dp[i+1][l+0],dp[i][l]+ai*((n-r-1)-pi)) #??座標

ans=0
for i in range(n+1):
    ans=max(ans,dp[n][i])
print(ans)

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    string S;
    cin >> S;
    int cnt = 0;
    REP(i, S.length()) {
        if(S[i] == 'o') { cnt++; }
    }
    int remain = 15 - S.length();
    if(remain + cnt >= 8) {
        printf("YES\n");
    }
    else {
        printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 256
/*
  A - AtCoder *** Contest
  <http://abc048.contest.atcoder.jp/tasks/abc048_a>
  [Tips]
  ・文字と文字列は違う<http://www.eonet.ne.jp/~nao2/c/c_char_string.html>
*/

#include <stdio.h>

int main(int argc, char const *argv[]) {

  char s[101];

  if( scanf("AtCoder %s Contest", s) == EOF ){
    printf(stderr, "scanf ERROR!\n");
  }
  printf("A%cC", s[0]);

  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long

const int N = 1e5+10;
int par[N]; //親
int depth[N]; //木の深さ

struct UF{

  void init(int n){
    for(int i = 0; i < n; i++){
      par[i] = i;
      depth[i] = 0;
    }
  }

  //木の根を求める
  int root(int x){
    if(par[x] == x){
      return x;
    }
    else {
      return par[x] = root(par[x]);
    }
  }

  //xとyの属する集合を併合
  void unite(int x,int y){
    x = root(x);
    y = root(y);
    if(x == y) return;

    if(depth[x] < depth[y]) par[x] = y;
    else {
      par[y] = x;
      if(depth[x] == depth[y]) depth[x]++;
    }
  }
}uf;

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

  int n,m; cin >> n >> m;
  uf.init(n+1);
  for(int i = 0; i < m; i++){
    int x,y; cin >> x >> y;
    uf.unite(x,y);
  }

  int q; cin >> q;
  for(int i = 0; i < q; i++){
    int x,y; cin >> x >> y;
    if(uf.root(x) == uf.root(y)){
      cout << "yes" << endl;
    }
    else {
      cout << "no" << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 4692
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int n, cnt = 0;
	string s1, s2;
	cin >> n >> s1 >> s2;
	vector<string> s3(n * 2 + 1);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 2; j++) {
			if (j % 2 == 0) {
				s3.at(cnt) = s1.substr(i, 1);
			} else {
				s3.at(cnt) = s2.substr(i, 1);
			}
			cnt++;
			if (cnt >= n * 2) {
				break;
			}
		}
		if (cnt >= n * 2) {
			break;
		}

	}
	for (int i = 0; i < n * 2; i++) {
		cout << s3.at(i);
	}

	return 0;
}



Measured memory_bytes: 256
nn = input()
n = int(nn[-1])

if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
    print("hon")
elif n == 0 or n == 1 or n == 6 or n == 8:
    print("pon")
else:
    print("bon")

Measured memory_bytes: 9172
#include<iostream>
#include<stdio.h>
#include<vector>
#include<utility>
#include<queue>
#include<math.h>
#include<string>
#include<typeinfo>
using namespace std;
typedef pair<int, int> P;
int main() {
	int tyo = 0, hisi = 0,a, b, c;
	char ch;
	string str;
	while (cin >> a >> ch >> b >> ch >> c) {
		 if (pow(c, 2) == pow(b, 2) + pow(a, 2))tyo++;
		 if (a == b)hisi++;
	}
	cout << tyo << endl << hisi << endl;

	return 0;
}


Measured memory_bytes: 2984