akhauriyash/Code-Regression huggingface dataset:
// 参考: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

fn main() {
    input! {
        k: usize,
        s: String,
    };

    let s_len = s.len();

    if s_len > k {
        println!("{}...", &s[0..k]);
    } else {
        println!("{}", &s);
    }
}


Measured memory_bytes: 2164
n, q = map(int, input().split())
li_nq = [list(map(int, input().split())) for _ in range(n-1)]
li_px = [list(map(int, input().split())) for _ in range((q))]

graph = [[] for _ in range(n+1)]
for i, j in li_nq:
    graph[i].append(j)
    graph[j].append(i)

ans = [0 for _ in range(n+1)]
for i, j in li_px:
    ans[i] += j

check_list = [None] * (n+1)
stack = [1]

while stack:
    num = stack.pop()
    for i in graph[num]:
        if check_list[num] == i:
            continue
        stack.append(i)
        ans[i] += ans[num]
        check_list[i] = num

print(*ans[1:])

Measured memory_bytes: 115584
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

int main()
{
    if (fopen("Test.INP", "r"))
        freopen("Test.INP", "r", stdin);

    int n;
    cin >> n;

    int dp[3][n + 1];
    memset(dp, 0, sizeof(dp));

    for (int i = 1; i <= n; ++i)
    {
        int a[3];
        for (int j = 0; j < 3; ++j)
            cin >> a[j];

        dp[0][i] = max(dp[1][i - 1], dp[2][i - 1]) + a[0];
        dp[1][i] = max(dp[2][i - 1], dp[0][i - 1]) + a[1];
        dp[2][i] = max(dp[0][i - 1], dp[1][i - 1]) + a[2];

        //cout << i << " | " << a[0] << ' ' << a[1] << ' ' << a[2] << " | " << dp[0][i] << ' ' << dp[1][i] << ' ' << dp[2][i] << '\n';
    }

    cout << max(dp[0][n], max(dp[1][n], dp[2][n]));
    return 0;
}


Measured memory_bytes: 1408
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    long long solve(vector<long long>& A, long long m) {
        sort(A.begin(), A.end());

        int n = A.size();
      
        auto ok = [&](int X) {
            long long cnt = 0;
            for (int i = 0; i < n; ++i) {
                long long t = X - A[i];
                auto it = lower_bound(A.begin(), A.end(), t);
                int p = it - A.begin();
                cnt += n - p;
            }
            return cnt >= m;
        };

        int l = 0, r = A.back() + A.back() + 1;
        while (l < r) {
            auto mi = (l + r + 1) / 2;
            if (ok(mi)) {
                l = mi;
            } else {
                r = mi - 1;
            }
        }
        // cout << l << endl;
        vector<long long> prefixSums(n + 1, 0);
        for (int i = 0; i < n; ++i) {
            prefixSums[i + 1] = prefixSums[i] + A[i];
        }

        long long res = 0;
        for (int i = n - 1; i >= 0 && m > 0; --i) {
            auto it = lower_bound(A.begin(), A.end(), l + 1 - A[i]);
            long long p = it - A.begin();
            p = min(m, n - p);
            // cout << p << endl;
            res += A[i] * p;
            res += prefixSums[n] - prefixSums[n - p];
            m -= p;
            // cout << res << endl << endl;
        }
        res += m * l;

        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    long long m;
    cin >> n >> m;

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

    Solution sol;
    cout << sol.solve(A, m) << "\n";
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <map>
#include <limits>
#include <tuple>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pint;
typedef pair<double,int> pdi;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)

float inf = std::numeric_limits<float>::infinity();
ll mod = 1e9+7;
ld epsilon = 1e-10;


vector<ld> weight;
ll N,E;
ll start;
ll xx[1005],yy[1005],tt[1005],rr[1005];
priority_queue<pdi,vector<pdi>,greater<pdi>> q;
vector<vector<pair<ll,ld>>> lines;

int search(ld w_0, ll &s){
  ll t;
  ld w;
  for (size_t i = 0; i < lines[s].size(); i++) {
    tie(t, w) = lines[s][i];
    w += w_0;
    if (weight[t]==-1 || weight[t] > w){
      q.push({w,t});
      weight[t] = w;
    }
  }
  return 0;
}

int dijkstra(int s){
  weight.resize(N,-1);
  weight[s] = 0;

  /* 実行部分(queueを回す)*/
  ll nq;
  ld wq;
  q.push({0,s}); /*スタート地点*/
  while (!q.empty()){
    tie(wq,nq) = q.top();
    q.pop();
    search(wq,nq);
  }

  for(ll w : weight){
    if(w<0){
      cout << "INF" << endl;
    }else{
      cout << w << endl;
    }
  }

}


int main(void) {
  cin >> N >> E >> start;

  lines.resize(N);

  ll s,t,d;
  REP(i,E){
    cin >> s >> t >> d;
    lines[s].push_back({t,d});
  }

  dijkstra(start);

}



Measured memory_bytes: 30324
#include<bits/stdc++.h>
#define int long long
#define re(i,n) for(i=0;i<n;i++)
#define bre(i,n) for(i=n;i>0;i--)
#define rep(i,l,r) for(i=l;i<r;i++)
#define brep(i,l,r) for(i=r;i>l;i--)
const int inf=1145141919810893;
const int mod=1000000007;
using namespace std;
template<class T>bool chmin(T &a,const T &b){
	if(a>b){
		a=b;
		return true;
	}
	return false;
}
template<class T>bool chmax(T &a,const T &b){
	if(a<b){
		a=b;
		return true;
	}
	return false;
}
template<class T>void debug(T *a,int l,int r,const char *name){
	for(int i=l;i<r;i++)
		cout<<name<<"["<<i<<"]="<<a[i]<<endl;
}
template<int H,int W>int wa(int x1,int y1,int x2,int y2,int(&p)[H][W]){
	return p[y2][x2]-p[y2][x1]-p[y1][x2]+p[y1][x1];
}
struct Node{
	vector<pair<int,int>> e;
} node[1];
int A,B,C,D,N,M,K,S,T,H,W;
int p[114514],q[114514],r[114514];
signed main(){
	int i,j,k;
	cin>>N;
	int lse,rse,l,r;
	l=0,r=N;
	cout<<0<<endl;
	string s;
	cin>>s;
	if(s=="Vacant")
		return 0;
	else if(s=="Male")
		lse=0;
	else
		lse=1;
	rse=lse;
	while(true){
		int m=(l+r)/2;
		cout<<m<<endl;
		cin>>s;
		int mse;
		if(s=="Vacant")
			break;
		else if(s=="Male")
			mse=0;
		else
			mse=1;
		if((m-l)%2==(lse==mse)){
			r=m;
			rse=mse;
		}
		else{
			l=m+1;
			lse=1-mse;
		}
	}
	return 0;
}

Measured memory_bytes: 852
using System;

 class Program
 {
     static void Main(string[] args)
     {
         double data0, data1, data2;
         double[] result = new double[3];
         String nyuryoku;
         nyuryoku = Console.ReadLine();
         string[] data = nyuryoku.Split(' ');
         data0 = Double.Parse(data[0]);
         data1 = Double.Parse(data[1]);
         data2 = Double.Parse(data[2]);
         double count = 0;
         for (double i = data0; i <= data1; i++)
         {
             if((data2%i)==0)
                 count++;
         }
         Console.WriteLine(count);


      }
 }



Measured memory_bytes: 17976
n = gets.to_i

factoring = Array.new(n + 1, 0)

2.upto(n) do |i|
  2.upto(i) do |j|
    while i % j == 0
      factoring[j] += 1
      i /= j
    end
  end
end

cnt = 0

n.times do |i|
  next if factoring[i] < 4
  i.times do |j|
    next if factoring[j] < 4
    n.times do |k|
      cnt += 1 if k != i && k != j && factoring[k] > 1
    end
  end
end

n.times do |i|
  next if factoring[i] < 24
  n.times do |j|
    cnt += 1 if i != j && factoring[j] > 1
  end
end

n.times do |i|
  next if factoring[i] < 14
  n.times do |j|
    cnt += 1 if i != j && factoring[j] > 3
  end
end

n.times do |i|
  cnt += 1 if factoring[i] > 73
end

puts cnt


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

int main()
{
    int n;
    cin >> n;
    int h[100002];
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    int dp[100002];
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for(int i = 2; i <= n; i++){
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]));
    }
    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int dp[5005][5005]; // dp[i][j]:= iからとjから始めたときに一致する最大の長さ

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i=n-1;i>=0;i--)for(int j=n-1;j>=0;j--){
        if(s[i]==s[j]){
            dp[i][j] = max(dp[i][j],dp[i+1][j+1] + 1);
        }
    }
    int ans = 0;
    for(int i=0;i<n;i++)for(int j=i;j<n;j++){
        ans = max(ans,min(j-i,dp[i][j]));
    }
    cout << ans << endl;
}

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

int main() {
	while (1) {
		int a;
		cin >> a;
		if (a == 0)break;
		int s = 0;
		for (int b = 0; b < a; b++) {
			int c, d, e, f, g;
			cin >> c >> d >> e >> f;
			g = c + d + e;
			if (g > 160 || f > 25)s += 0;
			else 	if (g > 140 || f > 20)s += 1600;
			else if(g > 120 || f > 15)s += 1400;
			else if (g > 100 || f > 10)s += 1200;
			else if (g > 80 || f > 5)s += 1000;
			else if (g > 60 || f > 2)s += 800;
			else s += 600;
		}
		cout << s << endl;
	}
}

Measured memory_bytes: 3080
#include <stdio.h>
#include <math.h>

int main (void){
  int x , kari , max = 1;
  scanf("%d",&x);
  
  for(int i = 1;i <=x;i ++){
    for(int j = 2;j <=x;j ++){
      kari = pow(i,j);
      if(max<kari&&kari<=x){
        max = kari;
      }
    }
  }
  printf("%d",max);
  
  return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N;
	cin >> N;
	vector<ll> a(N), b(N);
	REP(i, N) cin >> a[i];
	REP(i, N) cin >> b[i];

	vector<ll> c(N);
	ll sumx = 0;
	ll sumy = 0;
	REP(i, N){
		if(a[i]>b[i])sumx += a[i]-b[i];
		if(a[i]<b[i])sumy += (b[i]-a[i])/2, 0ll;
	}
	cout << (sumx<=sumy?"Yes":"No") << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
char A[105], B[105], C[105];
int main(){
	int N; scanf("%d",&N);
	scanf("%s%s%s",A,B,C);
	int ans = 0;
	for(int i=0; i<N; ++i){
		if(A[i]==B[i] && B[i]==C[i]) continue;
		else if(A[i]==B[i] || B[i]==C[i] || C[i]==A[i]) ++ans;
		else ans += 2;
	}
	printf("%d\n",ans);
	return 0;
}

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

public class Main {

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

		int n = Integer.parseInt(br.readLine());
		String[] tmpArray = br.readLine().split(" ");

		double A = 0;
		for(int i = 0; i < n; i++){
			int tmp = Integer.parseInt(tmpArray[i]);

			A += 1.0/tmp;
		}

		System.out.printf("%.6f\n", 1.0/A);

	}

}


Measured memory_bytes: 22740
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
#include<list>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  int n,h[100010],i;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> h[i];
  }
  for(i=0;i<n-1;i++){
    if(h[i]>h[i+1]){
      if(h[i]-h[i+1]>1){
        printf("No\n");
        return 0;
      }
      else{
        h[i+1]++;
      }
    }
  }
  printf("Yes\n");
  return 0;
}

Measured memory_bytes: 3968
import sys, math
from collections import deque

readline = sys.stdin.readline

N = int(readline())
H = list(map(int, readline().split()))

H[0] -= 1
for i in range(1, N):
    if H[i] > H[i - 1]:
        H[i] -= 1
    if H[i] < H[i - 1]:
        print('No')
        exit(0)

print('Yes')

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

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

    string S;
    cin >> S;
    bool is_ok = true;
    bool is_h = true;
    int n = S.size();
    for (int i = 0; i < n; i++) {
        if (is_h) {
            if (S[i] != 'h') {
                is_ok = false;
                break;
            }
        }
        else {
            if (S[i] != 'i') {
                is_ok = false;
                break;
            }
        }
        is_h ^= true;
    }

    cout << ((is_ok && is_h) ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,i,a[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)	scanf("%d",&a[i]);
	printf("%d",a[n-1]);
	for(i=n-2;i>=0;i--)	printf(" %d",a[i]);
	printf("\n");
	return 0;
}


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

typedef long long ll;

int n;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    int a = n / 100;
    int b = n % 100;
    if (a <= 12 && a > 0) {
        if (b <= 12 && b > 0) {
            cout << "AMBIGUOUS" << endl;
        } else {
            cout << "MMYY" << endl;
        }
    } else {
        if (b <= 12 && b > 0) {
            cout << "YYMM" << endl;
        } else {
            cout << "NA" << endl;
        }
    }

    return 0;
}



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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,a,b;
bool memo[300001];
vector<int> v;

signed main() {
    cin >> n >> a >> b;
    if (n > a*b || n < a+b-1) {
        cout << -1 << endl;
        return 0;
    } else {
        int now=b,cnt=n;
        while(1) {
            rep(i,b) {
                if (i==b-1) a--;
                cnt--;
                cout << now-i << " ";
                memo[now-i] = true;
                if (a == cnt) {
                    rep1(k,n) if (!memo[k]) cout << k << " ";
                    cout << endl;
                    return 0;
                }
            }
            now = min(n,now+b);
        }
    }
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
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; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll n,k; cin>>n>>k;
	vl p(n),c(n);
	rep(i,0,n)cin>>p[i],p[i]--;
	rep(i,0,n)cin>>c[i];

	ll ans=-1e18;

	rep(i,0,n){
		ll x=i,tot=0;
		vl vec(0);
		while(1){
			vec.push_back(c[x]);
			tot += c[x];
			x=p[x];
			if(x==i)break;
		}
		ll l=vec.size();
		ll now=0;
		rep(i,0,l){
			if(k<=i)break;
			now+=vec[i];
			ll sco=0;
			if(tot>0)sco=((k-i-1)/l)*tot;
			chmax(ans,now+sco);
		}
	}
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 3768
#include<bits/stdc++.h>
using namespace std;
bool s_l(int l,int b[])
{
	for(int i=1;i<l;i++)
	{
		if(b[i]<b[i-1]) return false;
	}
	return true;
}
int give(int l,int a[],int b[])
{
	for(int i=0;i<l;i++)
	{
		b[i]=a[i];
	}
	return 0;
}
int main()
{
	int n;
	cin>>n;
	int a[n],b[n];
	for(int i=0;i<n;i++) cin>>a[i];
	int f=1;
	for(int i=1;i<n;i++)
	{
		if(!(a[i]>=a[i-1])) f=0;
	}
	if(f==1)
	{
		cout<<"YES"<<endl;
		return 0;
	}
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			give(n,a,b);
			swap(b[i],b[j]);
			if(s_l(n,b))
			{
				cout<<"YES"<<endl;
				return 0;
			}
		}
	}
	cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <iomanip>
#include <iostream>
#include <map>

using namespace std;

const int CMax = 100000005;

int main()
{
    int a, b;
    scanf("%d %d", &a, &b);

    for (int i = 0; i < max(a, b); i++) {
        printf("%d", min(a, b));
    }
}



Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = [A[i] - 1 - i for i in range(N)]
B.sort()
if N % 2 == 0:
    med = [B[int(N / 2) - 1], int((B[int(N / 2) - 1] + B[int(N / 2)]) / 2), B[int(N / 2)]]
else:
    med = [B[int((N + 1) / 2) - 1]]
ans = 10 ** 100
for b in med:
    S = 0
    for i in range(N):
        S += abs(B[i] - b)
    ans = min(ans, S)
print(ans)


Measured memory_bytes: 26180
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int N, count = 1;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    for (int i = 0; i < N - 1; i++) {
        if (A.at(i) >= A.at(i + 1)) {
            count++;
        }
    }
    cout << count << endl;
    cout << N << endl;
}



Measured memory_bytes: 3108
#include "bits/stdc++.h"
using namespace std;
#define fios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;
#ifdef LOCAL
mt19937 rng(unsigned(70));
#else
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#endif
#define rand rng
const int mxN = 1e5 + 1;
int n;
queue<int> q;
bool vis[mxN];

void bfs(vector<vector<int>>& adj, int u, vector<int>& sign) {
	// distance[u] = 0;
	vis[u] = true;
	q.push(u);
	while(!q.empty()) {
		int s = q.front();
		q.pop();

		for(auto v: adj[s]) {
			if(vis[v]) continue;
			sign[v] = s;
			vis[v] = true;
			// distance[v] = distance[s] + 1;
			q.push(v);
		}
	}
}

int main() {
	// fios;
	int  m;
	cin >> n >> m;
	vector<vector<int>> adj(n);
	int u, v;
	for(int i = 0; i < m; i++) {
		cin >> u >> v;
		--u, --v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	vector<int> sign(n, -1);
	bfs(adj, 0, sign);
	for(int i = 1; i < n; i++) {
		if(sign[i] == -1) {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	for(int i = 1; i < n; i++) cout << sign[i] + 1 << endl;

}

Measured memory_bytes: 10408
#pragma GCC positionimize(3,"Otrst","inline")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<vector>
#include<algorithm>
#include<tr1/unordered_map>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e6+10;
const int INF=0x3fffffff;
const double pi = 3.141592653;
const double E = 2.71828182846;
//const ll mod=9999991;
const int M=2e4+5;
const double eps=1e-8;
const ll MMod=1ll<<32;
#define ci(x) scanf("%d",&x)
#define co(x) printf("%d\n",x)

inline int read()
{
    int f=1,x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
        if(c=='-')
            f=-1;
        c=getchar();
    }
    while(c>='0' && c<='9')
    {
        x=x*10+c-'0';
        c=getchar();
    }
    return f*x;
}

ll fast_muttki(ll m, ll n,ll mod)//快速乘法
{
    ll cnt = 0;//注意初始化是0，不是1
    while (n)
    {
        if (n & 1)
        {
            cnt += m;
            cnt %= mod;
        }
        m = (m + m) % mod;//和快速幂一样，只不过这里是加
        n >>= 1;
    }
    return cnt;
}
ll fast_get(ll a, ll n,ll mod)//快速幂
{
    ll cnt = 1;
    while (n)
    {
        if (n & 1)
            cnt = fast_muttki(cnt,a,mod);//不能直接乘
        a = fast_muttki(a, a,mod);
        cnt %= mod;
        a %= mod;
        n >>= 1;
    }
    return cnt;
}

int ans;
int n;
int x;

int main()
{
    ci(n);
    ci(x);
    if(x==1||x==2*n-1)
    {
        printf("No\n");
        return 0;
    }printf("Yes\n");
    for(int i=1;i<=2*n-1;i++)
    {
        if(i>=n-1&&i<=n+1)
        {
            
            co(n-i+x);
        }
        else
        {
            ans++;
            if(ans==(x-1))
                ans=x+2;
            //printf("Yes\n");
            co(ans);
        }
    }
    return 0;
}
// 5 5 2 1 5 4  = 9
// 5 2 1 5 4 5  = 7
// 5 5 2 1 4 5  = 8


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

int main() {
  string s;
  cin >> s;
  int N = s.size();
  int K;
  cin >> K;

  vector<string> st;
  rep(start, N) {
    repp(end, start, min(N - 1, start + 4)) {
      st.pb(s.substr(start, end - start + 1));
    }
  }
  sort(all(st));
  int cnt = 0;
  string temp = "";

  rep(i, st.size()) {
    if (temp != st[i]) {
      cnt++;
      temp = st[i];
    }
    if (cnt == K) {
      cout << st[i] << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    if(s=="abc"||s=="acb"||s=="bca"||s=="bac"||s=="cab"||s=="cba")
    cout << "Yes" << endl;
    else 
    cout << "No" << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC147A
{
	class Program
	{
		static void Main(string[] args)
		{
			int a1, a2,a3;
			string s;
			var word = Console.ReadLine().Split(' ');
			a1 = int.Parse(word[0]);
			a2 = int.Parse(word[1]);
			a3 = int.Parse(word[2]);
			if (a1 + a2 + a3 <= 21)
			{
				Console.WriteLine("win");
			}
			else
			{
				Console.WriteLine("bust");
			}
			Console.ReadKey();
		}
	}
}


Measured memory_bytes: 13140
#[allow(dead_code)]
fn getline() -> String {
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}

#[allow(unused_macros)]
macro_rules! readl {
    ($t: ty) => {
        {
            let s = getline();
            s.trim().parse::<$t>().unwrap()
        }
    };
    ($( $t: ty),+ ) => {
        {
            let s = getline();
            let mut iter = s.trim().split(' ');
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
}

#[allow(unused_macros)]
macro_rules! readlvec {
    ($t:ty) => {{
        let s = getline();
        let iter = s.trim().split(' ');
        iter.map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
    }};
}

#[allow(unused_macros)]
macro_rules! debug {
    ($x:expr) => {
        println!("{}: {:?}", stringify!($x), $x)
    };
}
// macro_rules! debug { ($x: expr) => () }

#[allow(dead_code)]
fn show<T>(iter: T) -> String
where
    T: Iterator,
    T::Item: std::fmt::Display,
{
    let mut res = iter.fold(String::new(), |sum, e| sum + &format!("{} ", e));
    res.pop();
    res
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::btree_map::Entry::{Occupied, Vacant};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

fn main() {
    use std::io::Write;
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    macro_rules! printf { ($($arg:tt)*) => (write!(out, $($arg)*).unwrap()); }
    macro_rules! printfln { () => (writeln!(out).unwrap()); ($($arg:tt)*) => (writeln!(out, $($arg)*).unwrap()); }

    let (n, c) = readl!(usize, usize);
    let d: Vec<_> = (0..c).map(|_| readlvec!(i64)).collect();

    let cv: Vec<Vec<_>> = (0..n)
        .map(|_| readlvec!(i64).into_iter().map(|x| x - 1).collect())
        .collect();

    let mut cov = vec![vec![0; c]; 3];
    for (i, row) in cv.iter().enumerate() {
        for (j, &e) in row.iter().enumerate() {
            cov[(i + j) % 3][e as usize] += 1;
        }
    }
    let cov = cov;

    let inf = 1_000_000_000_000;
    let mut ans = inf;
    for c0 in 0..c {
        for c1 in 0..c {
            for c2 in 0..c {
                if c0 == c1 || c1 == c2 || c0 == c2 {
                    continue;
                }
                let ccv = [c0, c1, c2];
                let mut cost = 0;
                for (cr, &cce) in cov.iter().zip(ccv.iter()) {
                    for (&ce, dr) in cr.iter().zip(d.iter()) {
                        unsafe {
                            cost += ce * dr.get_unchecked(cce);
                        }
                    }
                }
                ans = min(ans, cost);
            }
        }
    }
    printfln!("{}", ans);
}


Measured memory_bytes: 6396
#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 
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};

class UnionFind{
public:
    vector<ll> par;
    vector<ll> siz;

    UnionFind(ll k):par(k), siz(k, 1LL){
        rep(i,k) par[i] = i;
    }

    ll root(ll x){
        if(par[x]==x) return x;
        else return par[x] = root(par[x]);
    }

    void unite(ll x, ll y){
        x = root(x);
        y = root(y);
        if(x==y) return;

        if(siz[x]<siz[y]) swap(x, y);
        par[y] = x;
        siz[x] += siz[y];
        return;
    }

    bool same(ll x, ll y){
        return root(x) == root(y);
    }

    ll size(ll x){
        return siz[root(x)];
    }
};

ll f(ll n){
	return n*(n-1)/2;
}

int main(){
	int n, m;
	cin >> n >> m;
	UnionFind uf(n);
	vector<P> bridge(m);
	rep(i,m) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		P p = make_pair(a, b);
		bridge[i] = p;
	}
	reverse(bridge.begin(), bridge.end());
	vector<ll> ans(m);
	rep(i,m) {
		int p = bridge[i].first;
		int q = bridge[i].second;
		ll s = f(uf.size(p));
		ll t = f(uf.size(q));
		if(!uf.same(p,q)){
			uf.unite(p,q);
			ll u = f(uf.size(p));
			ans[m-i-1] = u-s-t;
		}else{
			ans[m-1-i] = 0;
		}
	}
	ll now = 0;
	rep(i,m) {
		now += ans[i];
		cout << now << endl;
	}
}

Measured memory_bytes: 4480
#include<iostream>

int main(){
    
    int a, b;
    int ans = 0;

    std::cin >> a >> b;

    for(size_t i = 0; i < 2; i++){
        if(a >= b){
            ans += a;
            a--;
        }else{
            ans += b;
            b--;
        }
    }

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


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    int ans=0;
    if(m>=2)
        ans+=(m-1)*m/2;
    if(n>=2)
        ans+=(n-1)*n/2;
    cout<<ans;
    return 0;
}


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

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

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]A - November 30
            var line = ReadLine();
            int M1 = line[0];
            int D1 = line[1];

            var d = new DateTime(2019, M1, D1);
            var day = new TimeSpan(1, 0, 0, 0);
            var nextDay = d + day;

            line = ReadLine();
            int M2 = line[0];
            int D2 = line[1];

            if(new DateTime(2019, M2, D2) == nextDay)
            {
                if (M1 != M2)
                {
                    Console.WriteLine(1);
                }
                else
                {
                    Console.WriteLine(0);
                }
            }
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => int.Parse(x)).ToList();
        }
    }
}

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

vector<vector<int>> getAllPath(vector<int> available_town_list)
{
    if (available_town_list.size() == 2)
    {
        vector<vector<int>> pathList;
        vector<int> new_path_1 = {available_town_list.at(0), available_town_list.at(1)};
        pathList.push_back(new_path_1);
        vector<int> new_path_2 = {available_town_list.at(1), available_town_list.at(0)};
        pathList.push_back(new_path_2);
        return pathList;
    }
    else
    {
        vector<vector<int>> new_path_list;
        for (int i = 0; i < available_town_list.size(); ++i)
        {
            vector<int> new_list(available_town_list.size());
            copy(available_town_list.begin(), available_town_list.end(), new_list.begin());
            new_list.erase(new_list.begin() + i);
            vector<vector<int>> pathList = getAllPath(new_list);
            for (int j = 0; j < pathList.size(); ++j)
            {
                pathList.at(j).push_back(available_town_list.at(i));
                new_path_list.push_back(pathList.at(j));
            }
        }
        return new_path_list;
    }
}

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

    vector<vector<int>> townList;
    for (int i = 0; i < n; ++i)
    {
        int x, y;
        cin >> x >> y;
        vector<int> coordinate = {x, y};
        townList.push_back(coordinate);
    }

    vector<int> allTownList;
    for (int i = 0; i < n; ++i)
    {
        allTownList.push_back(i);
    }
    vector<vector<int>> pathList = getAllPath(allTownList);

    double lengthSum = 0;
    int rootNum = 0;
    for (int i = 0; i < pathList.size(); ++i)
    {
        ++rootNum;

        int prevTown = pathList.at(i).at(0);
        for (int n = 1; n < pathList.at(i).size(); ++n)
        {
            int newTown = pathList.at(i).at(n);
            int xDif = townList.at(prevTown).at(0) - townList.at(newTown).at(0);
            int yDif = townList.at(prevTown).at(1) - townList.at(newTown).at(1);
            double distance = sqrt(xDif * xDif + yDif * yDif);
            lengthSum += distance;
        }
    }
    cout << fixed << setprecision(10);
    cout << lengthSum / rootNum << endl;
}

Measured memory_bytes: 3904
#include<iostream>
#include<vector>
using namespace std;

int main(){
    bool nonPrime[1000001] = {};
    nonPrime[0] = nonPrime[1] = true;
    vector<int> prime;
    
    for(int i = 2; i <= 1000000; i++){
        if(!nonPrime[i]){
            prime.push_back(i);
            for(int j = i+i; j <= 1000000; j+=i){
                nonPrime[j] = true;
            }
        }
    }

    //for(int p : prime)  cout << p << endl;

    int n;
    while(1){
        cin >> n;
        if(n == 0)  break;

        int ans = 0;
        for(int p : prime){
            if(p > n)   break;
            if(!nonPrime[n-p])  ans++;
        }
        
        cout << (ans+1) /2<< endl;
    }

    return 0;
}


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

#define ll long long
#define mod 1000000007
#define pll pair<long long,long long>
#define pdd pair<long double,long double>
#define vll vector<ll>
#define rep(i,j,n) for(int i=j;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define inf 1e17
priority_queue<pll,vector<pll>,greater<pll> >pq;
priority_queue<ll,vector<ll>,greater<ll> >pq1;

ll dp[2*10000001];
ll n;
ll arr[25][25];

ll solve(ll i, ll mask){
	if(i==n){
		if(mask == ((1<<n)-1))
			return 1;
		else
			return 0;
	}
	if(dp[mask] != -1)
		return dp[mask];
	ll ans=0;
	for(int j=0;j<n;j++){
		if(mask & (1<<j)){

		}
		else{
			if(arr[i][j])
				ans = (ans + solve(i+1,(mask + (1<<j)))) % mod;
		}
	}
	return dp[mask] = ans;
}

int main(){
	if(fopen("input.txt", "r"))
	freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //ll n;
    cin>>n;
    for(int i=0;i<n;i++)
    	for(int j=0;j<n;j++)
    		cin>>arr[i][j];
    for(int j=0;j<2*10000001;j++)
    		dp[j] = -1;

    ll ans = solve(0,0);
    cout << ans << "\n";
    // for(int i=0;i<n;i++){
    // 	for(int j=0;j<n;j++)
    // 		cout << dp[j];
    // 	cout << "\n" ;
    // }
    return 0;
}


Measured memory_bytes: 156672
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    int n,sum;
    vector<int> a;
    Problem(LL n):n(n),a(n){};

    void solve(){
        for(int i=0; i<n; ++i){
            cin >> a[i];
        }
        sort(a.begin(),a.end());
        sum=accumulate(a.begin(),a.end(),0);
        if(sum%10!=0){
            cout << sum<<"\n";
        }else{
            for(int i=0; i<n; ++i){
                if((sum-a[i])%10!=0){
                    cout << sum-a[i] <<endl;
                    break;
                }
                if(i==n-1){
                    cout << 0 <<"\n";
                }
            }
        }
    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long n=0;
    cin >> n;
    Problem p(n);
    p.solve();
    return 0;
}



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

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for (auto& e : s) cin >> e;
    
    for (auto& e : s) {
        cout << e << endl << e << endl;
    }
    return 0;
}

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

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

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using namespace std;

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

int main(void){
	string s;
	cin >> s;
	int n=s.size();

	int a=-1,b=-1;
	rep(i,n){
		if(i+1<n && s[i]==s[i+1]) a=i+1,b=i+2;
		if(i+2<n && s[i]==s[i+2]) a=i+1,b=i+3;
	}

	cout << a << " " << b << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define all(A) A.begin(),A.end()
typedef long long ll;

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int maxA = *max_element(all(a));
  
  int ng = 0;
  int ok = maxA;
  
  while(abs(ok-ng) > 1){
    int mid = (ok + ng)/2;
    int tmp = 0;
    rep(i,n){
      tmp += (a[i]+mid-1)/mid - 1;
    }
    if(tmp <= k) ok = mid;
    else ng = mid;
  }
  cout << ok << endl;
}


Measured memory_bytes: 3924
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
const int N=1e9+7;
#define int long long
#define double long double
#define pb push_back
#define vi vector<int>
#define rep(i,n) for(int i=1;i<=n;i++)
int32_t main()
{
  #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
  #endif
 IOS;
 int t;
 cin>>t;
 while(t--)
 {
cout<<"ACL";
}
 	
 	
 	
 		
 	 
 	 	
 	 
 

 	



  
 




  
return 0;
}


Measured memory_bytes: 3576
def main():
    n, m = map(int, input().split())
    mod = pow(10, 9) + 7
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))

    prefix_x = [0]
    prefix_y = [0]
    for i in range(n):
        prefix_x.append(prefix_x[-1] + x[i])
    for i in range(m):
        prefix_y.append(prefix_y[-1] + y[i])

    # print(prefix_x)
    # print(prefix_y)
    ysum = 0
    for j in range(1, m):
        ysum += j*y[j] - prefix_y[j]
        ysum %= mod
    xsum = 0
    for j in range(1, n):
        xsum += j*x[j] - prefix_x[j]
        xsum %= mod

    # print(xsum)
    # print(ysum)
    return ysum * xsum % mod


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 20800
import java.util.Scanner;

class Solver {

    private final int[][] A;
    private final int N;

    Solver(Scanner in){
        N = in.nextInt();
        A = new int[2][N];
        for (int[] ints : A) {
            for (int i = 0; i < ints.length; i++) {
                ints[i] = in.nextInt();
            }
        }
    }

    void solve() {
        int a = A[0][0];
        int b = 0;
        int bsum = A[1][0];
        int max = a;
        for (int i = 1; i < N; i++) {
            a += A[0][i];
            b -= A[1][i-1];
            bsum += A[1][i];
            max = Math.max(a + b, max);
        }
        System.out.println(max + bsum);
    }
}

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

        new Solver(in).solve();

        in.close();
    }
}

Measured memory_bytes: 23764
#include<iostream>
using namespace std;
int main()
{
    int N,K,Q,A;
    cin >> N >>K >>Q;
    int Score[N];
    
    for (int i=0;i<N;i++){
      Score[i]=0;
    }
    
    for(int j=0;j<Q;j++){
      cin >>A;
      Score[A-1]=Score[A-1]+1;
    }
  
    for (int i=0;i<N;i++){
      if(Score[i]>Q-K)cout << "Yes"<<endl;
      else cout <<"No" <<endl;
    }
    return 0;
}

Measured memory_bytes: 1024
import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)

from fractions import gcd


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n, m = geta(int)
    a = tuple(geta(int))

    g = a[0] // 2

    def fn(i):
        ret = 0
        while i & 1 == 0:
            ret += 1
            i = i >> 1
        return ret

    t = fn(g)

    for ai in a[1:]:
        ai2 = ai // 2

        if t != fn(ai2):
            print(0)
            exit()

        g = (g * ai2) // gcd(g, ai2)

    print((m + g) // (g * 2))


if __name__ == "__main__":
    main()

Measured memory_bytes: 81004
#include <stdio.h>
int main()
{
   int a,b,c,min;
   scanf("%d %d %d",&a,&b,&c);
   if(a>=b)
   {
        if(a>=c)
       {
           min = b+c;
           printf("%d",min);
        }
        else
        {
            min = a+b;
            printf("%d",min);
        }
   }
   else
   {

     if(b<=c)

       {
           min = a+b;
       printf("%d",min);
       }

     else
      {
         min = a+c;
       printf("%d",min);
      }
   }
   return 0;
}


Measured memory_bytes: 128
n = int(input())
sub = dict()
ans = 0
for i in range(n):
  key = input()
  if key in sub:
    sub[key] = sub[key] + 1
    if ans < sub[key]:
      ans = sub[key]
  else:
    sub[key] = 1
    if ans < sub[key]:
      ans = sub[key]
      
sub = sorted(sub.items())

for i in range(len(sub)):
  if sub[i][1] == ans:
    print(sub[i][0])





Measured memory_bytes: 99352
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 int i,c,n;
 c=0;
 cin >> n;
 int a[n];
 for(i=0;i<n;i++)
 {
  cin >> a[i];
  if(i%2==0 && a[i]%2)
  c++;
 }
 cout << c;
 return 0;
}

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

const int maxn = 1e5+5;
int n,a[maxn];

int main() {
    scanf("%d",&n);
    for (int i = 0; i < n; i++) {
    	cin >> a[i];
    }
    sort(a, a + n);
    printf("%d\n", a[n / 2] - a[n / 2 - 1]);
    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main()
{
int a;
int b,sum=10000;
scanf("%d",&a);
for (int i=1;i<a;i++)
{
int c=a-i;
if(i%10+(int)(i/10)%10+(int)(i/100)%10+(int)(i/1000)%10+(int)(i/10000)%10+c%10+(int)(c/10)%10+(int)(c/100)%10+(int)(c/1000)%10+(int)(c/10000)%10<sum)
{
b=i;
sum=i%10+(int)(i/10)%10+(int)(i/100)%10+(int)(i/1000)%10+(int)(i/10000)%10+c%10+(int)(c/10)%10+(int)(c/100)%10+(int)(c/1000)%10+(int)(c/10000)%10;
}
}
printf("%d",sum);
}


Measured memory_bytes: 128
'use strict'

const count = arr => {
    let Obj = {}
    arr.forEach((v, i) => {
        if(Obj[v] === undefined){
            Obj[v] = []
        }
        Obj[v].push(i)
    })
    return Obj
}

const del = obj => {
    let arr = []
    for(let k in obj){
        if(obj[k].length === 1){
            delete obj[k]
        }else{
            arr.push(obj[k])
        }
    }
    return arr
}

const main = (input) => {
    const s = input.split('\n')[0].split('')
    const t = input.split('\n')[1].split('')

    const sObj = del(count(s))
    const tObj = del(count(t))

    if(JSON.stringify(sObj) === JSON.stringify(tObj)){
        console.log('Yes')
    }else{
        console.log('No')
    }

    // if(sObj.length !== tObj.length){
    //     console.log('No')
    //     return
    // }

    // for(let i = 0; i < sObj.length; i++){
    //     for(let j = 0; j < sObj[i].length; j++){
    //         if(sObj[i][j] !== tObj[i][j]){
    //             console.log('No')
    //             break
    //         }
    //     }
    // }

}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

Measured memory_bytes: 31304
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int N, M;
LL cost[15][15];
LL sum[1 << 15];
LL dp[1 << 15][15];

int main(void)
{
	cin >> N >> M;
	LL total = 0;
	for (int i = 0; i < M; ++i)
	{
		LL a, b, c;
		cin >> a >> b >> c;
		--a; --b;
		cost[a][b] = cost[b][a] = c;
		total += c;
	}
	for (int S = 0; S < (1 << N); ++S)
	{
		for (int i = 0; i < N; ++i)
		{
			for (int j = 0; j < N; ++j)
			{
				if ((S & (1 << i)) && (S & (1 << j)))
				{
					sum[S] += cost[i][j];
				}
			}
		}
		sum[S] /= 2;
	}
	memset(dp, 0xc0, sizeof(dp));
	dp[1][0] = 0;
	for (int S = 0; S < (1 << N); ++S)
	{
		for (int i = 0; i < N; ++i)
		{
			const auto& now = dp[S][i];
			//dp[S][i]を動かす
			//1: 新たな頂点jを付け加える
			for (int j = 0; j < N; ++j)
			{
				if (S & (1 << j))continue;//すでにある頂点はダメ
				if (!cost[i][j])continue;//i-j間に辺がなければダメ
				auto& next = dp[S | (1 << j)][j];
				next = max(next, now + cost[i][j]);
			}
			//2:iに頂点集合subを取り付ける
			int sup = S ^ ((1 << N) - 1);
			int sub = sup;
			do
			{
				//sub∪iのコストを足す
				LL plus = sum[sub | (1 << i)];
				auto& next = dp[S | sub][i];
				next = max(next, now + plus);
				//集合をずらす
				sub = (sub - 1) & sup;
			} while (sub != sup && sub != 0);
		}
	}
	//dp[{1..N}][?]
	LL ans = dp[(1 << N) - 1][N - 1];
	cout << (total - ans) << endl;
	return 0;
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC170B
{
    class Class1
    {
        static void Main(string[] arg)
        {
            string[] XY = Console.ReadLine().Split(' ');
            int X = int.Parse(XY[0]);
            int Y = int.Parse(XY[1]);
            bool hantei = false;
            for(int i = 0; i <= X; i++)
            {
                if ((2 * i) + (4 * (X - i)) == Y)
                {
                    hantei = true;
                }
            }
            if (hantei) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 27528
#include <iostream>

using namespace std;


int main(int argc, const char* argv[]){
    int retu[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int num = 0;
    cin >> num;
    cout << retu[num-1] << endl;
    return 0;
}

Measured memory_bytes: 256