akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
using namespace std;

const int N = 2e6;

int main() {
	clog << "Ready\n";
	
	int n;
	cin >> n;
	cout << (n >= 1000 ? "ABD" : "ABC");
	
	cerr << '\n';

	return 0;
}


Measured memory_bytes: 256
// https://ynucpc.github.io/blog/2018/04/15/cp_vscode/
// http://www.atmarkit.co.jp/ait/articles/1509/08/news019.html

#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rep3(i,n,m) for(ll i=(n);i<(ll)(m);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
// #define max(a, b) ((a) > (b) ? (a) : (b))
// #define min(a, b) ((a) < (b) ? (a) : (b)) 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
int _stoi(string s, int tmp=10){
	istringstream stm(s);
	int res;
	stm >> res;
	return res;
}
double _stod(string s, int tmp=10){
	istringstream stm(s);
	double res;
	stm >> res;
	return res;
}
template<typename T>string to_string(const T& n){
	std::ostringstream stm;
	stm << n;
	return stm.str();
}

// 降順ソート: sort(A, A+N, greater<>());
// min: *min_element(A, A+N)
// argmin: min_element(A, A+N)-A

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


int main(){	
	// ll A; cin >> A;
	// cout << "hello" << _stoi("14") << max({1,3}) << endl;
	
	ll N, K;
	cin >> N >> K;
	string S;
	cin >> S;
	V<ll> v;

	ll n=0;
	ll p='1';
	ll zeros;
	rep(i, N){
		if (S[i]==p){
			n++;
		}else{
			v.push_back(n);
			n=1;
		}
		p = S[i];
	}
	v.push_back(n);
	if (p=='0') v.push_back(0);
	zeros = v.size()/2;
	if (zeros <= K){
		cout << N << endl;
		return 0;
	}

	ll ans = 0;
	ll a = 0;
	rep(i, K*2+1){
		ans += v[i];
	}
	a = ans;
	for (ll i=K*2+2; i<v.size(); i+=2){
		a += v[i];
		a += v[i-1];
		a -= v[i-2*K-1];
		a -= v[i-2*K-2];
		chmax(ans, a);
	}
	cout << ans << endl;
	

}








Measured memory_bytes: 1528
import scala.collection.mutable.ArrayBuffer

object Scanner {
  private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0
  @inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
  @inline private def hasNextByte(): Boolean =
    if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else { true }
  @inline private def hasNext(): Boolean = {
    while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
    hasNextByte()
  }
  @inline private def readByte(): Byte =
    if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else { -1 }
  def next(): String = {
    if(!hasNext()) ???
    val sb = new StringBuilder; var b = readByte()
    while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
    sb.toString
  }
  def nextInt(): Int = {
    val n = nextLong()
    if (n < Int.MinValue || Int.MaxValue < n) ???
    n.toInt
  }
  def nextLong(): Long = {
    if(!hasNext()) ???
    var minus = false; var b = readByte()
    if (b == '-') { minus = true; b = readByte() }
    def go (b: Byte, n: Long = 0): Long =
      if ('0' <= b && b <= '9') { go(readByte(), n * 10 + b - '0') }
      else if (minus) { -n } else { n }
    go(b)
  }
  def nextDouble(): Double = next.toDouble
}

object Main extends App {
  val n = Scanner.nextInt
  val k = Scanner.nextInt
  val s = Scanner.next
  val sArray = s.toCharArray

  var turningPoints = new ArrayBuffer[Int]

  sArray.zipWithIndex.foreach(a=>{
    if (a._2 == 0) {
      turningPoints += a._2
    } else {
      if (a._1 != sArray(a._2-1)){
        turningPoints += a._2
      }
    }
  })

  val result = turningPoints.zipWithIndex.map(t=>{
    if (sArray(t._1) == '0') {
      if ((t._2+2*k)>=turningPoints.length){
        n-t._1
      } else {
        turningPoints(t._2+2*k)-t._1
      }
    } else{
      if ((t._2+2*k+1)>=turningPoints.length){
        n-t._1
      } else {
        turningPoints(t._2+2*k+1)-t._1
      }
    }
  }).max

  println(result)
}

Measured memory_bytes: 41348
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
 
const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long
const double pi = acos(-1.0);

const LL mod = 998244353;

LL ans;
map<LL, LL> mp;
int n, m;

int main() {
#ifdef LOCAL
  auto start_clock = clock();
  freopen("in", "r", stdin);
#endif

  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    LL w;
    cin >> w;
    mp[w] += 1;
    ans += w;
  }

  scanf("%d", &m);
  while (m--) {
    LL x, y;
    cin >> x >> y;
    LL c = 0;
    if (mp.find(x) != mp.end()) {
      c = mp[x];
      mp.erase(x);
    }
    ans -= x * c;
    ans += y * c;
    mp[y] += c;
    cout << ans << endl;
  }
  

#ifdef LOCAL
 auto end_clock = clock();
 cout << "Time:" << (end_clock - start_clock) / CLOCKS_PER_SEC << endl;
#endif
  return 0;
}

Measured memory_bytes: 7616
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  string s; cin >> s;
  int ans = 0;
  for(char c: s) {
    ans+= (c=='+' ? 1 : -1);
  }
  COUT(ans);
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.StringTokenizer;

public class Main {
	static class DepthFirstSearch {
		public void dfs (InputReader ir) {
			
			// 頂点の数
			int n = ir.nextInt();
			Graph[] graph  = new Graph[n + 1];
			
			// 入力
			for (int i = 1; i <= n; i++) {
				graph[i] = new Graph (ir.nextInt());
				int m = ir.nextInt();
				for (int j = 0; j < m; j++) {
					graph[i].u.add(ir.nextInt());
				}
			}
			
			int k = 1;
			int count = 1;
			graph[1].d = count;
			
		Outer:		
			while (true) {
				
				while (!graph[k].u.isEmpty()) {
					int x = graph[k].u.poll();
					if (graph[x].d == null) {
						graph[x].d = ++count;
						graph[x].pre = k;
						k = x;
						continue Outer;
					}
				}
				
				graph[k].f = ++count; 
				if (graph[k].pre == null) {
					for (int i = 1; i < graph.length; i++) {
						if (graph[i].d == null) {
							k = i;
							graph[i].d = ++count;
							continue Outer;
						}
					}
					break Outer;
				}
				k = graph[k].pre;
			}
			
			StringBuilder sb = new StringBuilder ();
			
			for (int i = 1; i <= n; i++) {
				sb.append(i).append(" ")
				.append(graph[i].d).append(" ")
				.append(graph[i].f).append("\n");
			}
			
			System.out.print(sb);
		
		}
	}
	
	static class Graph {
		int id;
		Queue<Integer> u = new PriorityQueue<> ();
		Integer d;
		Integer f;
		Integer pre;
		Graph (int i) {
			id = i;
			d = null;
			f = null;
			pre = null;
		}
	}
	
	static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	}
	
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		DepthFirstSearch obj = new DepthFirstSearch ();
		obj.dfs (in);
	}
	
}



Measured memory_bytes: 24688
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = onem()

po = set()

for i in range(n):
    x = input()[:-1]
    po.add(x)
print(len(po))

Measured memory_bytes: 85984
#include <cstdio>
#define ll long long
using namespace std;

const ll md = 1e9 + 7;

ll q(ll a, int b)
{
	ll ans = 1, x = a;
	while (b)
	{
		if (b & 1)
			ans = (ans * x) % md;
		x = (x * x) % md;
		b >>= 1;
	}
	
	return ans;
}

int main()
{
	int n;
	scanf("%d", &n);
	printf("%lld\n", ((q(10ll, n) + q(8ll, n)) % md - (q(9ll, n) << 1) % md + md) % md);
	
	return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> jobs[M];
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        if (a > M) continue;
        jobs[a - 1].push_back(b);
    }

    priority_queue<int> que;
    long long res = 0;
    for (int i = 0; i < M; i++) {
        for (int j = 0; j < jobs[i].size(); j++) {
            int t = jobs[i][j];
            que.push(t);
        }
        if (!que.empty()) {
            res += que.top();
            que.pop();
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5504
#include <stdio.h>

struct dice {
	int up;
	int front;
	int right;
	int left;
	int back;
	int down;
};

void mov_order(struct dice *d, char order)
{
	int wk;
	
	switch(order){
		case 'N':
			wk       = d->up;
			d->up    = d->front;
			d->front = d->down;
			d->down  = d->back;
			d->back  = wk;
			break;
		case 'E':
			wk       = d->left;
			d->left  = d->down;
			d->down  = d->right;
			d->right = d->up;
			d->up    = wk;
			break;
		case 'W':
			wk       = d->right;
			d->right = d->down;
			d->down  = d->left;
			d->left  = d->up;
			d->up    = wk;
			break;
		case 'S':
			wk       = d->back;
			d->back  = d->down;
			d->down  = d->front;
			d->front = d->up;
			d->up    = wk;
			break;
	}
}

void set_up(struct dice *d1, struct dice *d2, char *order)
{
	d2->up    = d1->up;
	d2->front = d1->front;
	d2->right = d1->right;
	d2->left  = d1->left;
	d2->back  = d1->back;
	d2->down  = d1->down;
	
	while(*order != 0x00){
		mov_order(d2, *order);
		order++;
	}
}

int main(void)
{
	int i, j, wk, flg = 0;
	struct dice d1, d2, d3;
	
	scanf("%d%d%d%d%d%d", &d1.up, &d1.front, &d1.right, &d1.left, &d1.back, &d1.down);
	scanf("%d%d%d%d%d%d", &d2.up, &d2.front, &d2.right, &d2.left, &d2.back, &d2.down);
	
	for(i = 0; i < 6; i++){
		j = 4;
		switch(i){
			case 0: if(d1.up == d2.up)   {set_up(&d2, &d3, "");  j = 0; break;}
			case 1: if(d1.up == d2.front){set_up(&d2, &d3, "N"); j = 0; break;}
			case 2: if(d1.up == d2.right){set_up(&d2, &d3, "W"); j = 0; break;}
			case 3: if(d1.up == d2.left) {set_up(&d2, &d3, "E"); j = 0; break;}
			case 4: if(d1.up == d2.back) {set_up(&d2, &d3, "S"); j = 0; break;}
			case 5: if(d1.up == d2.down) {set_up(&d2, &d3, "NN");j = 0; break;}
		}
		
		for(; j < 4 && d1.front != d3.front; j++){
			wk       = d3.front;
			d3.front = d3.right;
			d3.right = d3.back;
			d3.back  = d3.left;
			d3.left  = wk;
		}
		if((j < 4) &&
		   (d1.right == d3.right) &&
		   (d1.left  == d3.left) &&
		   (d1.back  == d3.back) &&
		   (d1.down  == d3.down)){
			flg = 1;
			break;
		}
	}
	if(flg == 1) printf("Yes\n");
	else         printf("No\n");
	
	return(0);
}



Measured memory_bytes: 2076
n = int(input())
a = list(map(int,input().split()))
x = 1000
m = a[0]
f = False
for i in range(1,n):
    if a[i]<a[i-1]:
        if f:
            c = x//m
            x %= m
            x += c*a[i-1]
            f = False
            m = a[i]
        else:
            m = a[i]
    else:
        f = True
if f:
    c = x//m
    x %= m
    x += c*a[-1]
    f = False
print(x)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-10;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)


//ここから編集

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int N; cin >> N;
  map<string, int> mp;
  REP(i,N){
    string s; cin >> s;
    mp[s]++;
  }

  cout << "AC x " << mp["AC"] << endl;
  cout << "WA x " << mp["WA"] << endl; 
  cout << "TLE x " << mp["TLE"] << endl; 
  cout << "RE x " << mp["RE"] << endl; 
  

  return 0;
}

Measured memory_bytes: 3668
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException{
		Daydream solver = new Daydream();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}

	static class Daydream {
		private String s;

		private Scanner scanner;
		private String output;

		public Daydream() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			s = scanner.next();
		}

		public void solve() {
			String regex = "(dream(er)?|eraser?)+";
			output = s.matches(regex) ?"YES":"NO";

		}

		public void writeOutput() {
			System.out.println(output);
		}
	}


}


Measured memory_bytes: 37836
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		int[] h=Enumerable.Range(s[1]-s[0]+1,s[0]*2-1).ToArray();
		Console.WriteLine("{0}",String.Join(" ",h));
	}
}


public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

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

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

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
    string S;
  cin >> S;
  ll sum = 0;
  for(auto c : S) {
    sum += (ll)(c - '0');
  }
    if(sum % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3692
#include "iostream"
#include <algorithm>

using namespace std;

int partition(int A[],int p,int r){
  int x = A[r];
  int i = p - 1;
  for(int j = p ; j < r ; j++){
    if(A[j] <= x){
      i=i +1;
      swap(A[i],A[j]);
    }
  }
  swap(A[i+1],A[r]);
  return i + 1;
}

int main(){
  int n,m;
  int A[1000000];
  cin >> n;
  for(int i = 0; i<n;i++) cin >> A[i];
  m = partition(A,0,n-1);
  for(int i = 0 ; i < n; i++){
    if(i) cout << " ";
    if(i == m) cout << "[";
    cout << A[i];
      if(i == m) cout << "]";
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 3516
#include<iostream>
using namespace std;
#include<map>
#include<unordered_map>
#include<vector>
#include<set>
#include<algorithm>
#define int long long int
#define mod 1000000007
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	set<int> st;
	int j;
	for(j=1;j*j<=n;j++)
	{
		if(n%j==0)
		{
			int p=j;
			int q=n/j;
			int m=q-1;
			if(m!=0&&n%m==p)
			{
				st.insert(m);
			}
			p=n/j;
			q=j;
			m=p-1;
			if(m!=0&&n%m==q)
			{
				st.insert(m);
			}
		}
	}
	int answer=0;
	for(int x:st)
	  answer+=x;
    cout<<answer<<endl;
}


Measured memory_bytes: 3792
'use strict';
(function(stdin) {
  var inputs  = stdin.toString().split('\n')[0].split(' ').map(Number);
  	var a = inputs[0];
  	var b = inputs[1];

    var d = Math.floor(a / b);
    var r = a % b;
    var f = Number((a / b).toFixed(5));

console.log(d,r,f);

  // ???????????????????????? 
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15896
#include <iostream>
#include <cstring>
using namespace std;
const int M = 2010;
typedef long long ll;
int a[M] , b[M] , c[M];
ll ans[M];
int main() {
    int n , m;
    cin >> n >> m;
    for(int i = 0 ; i < m ; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }
    for(int i = 1 ; i <= n ; i++) {
        ans[i] = -10000000000000;
    }
    ans[1] = 0;
    for(int i = 1 ; i <= 10 * n ; i++) {
        for(int j = 0 ; j < m ; j++) {
            int u = a[j] , v = b[j];
            ans[v] = max(ans[v] , ans[u] + c[j]);
        }
    }
    ll pre = ans[n];
    for(int i = 1 ; i <= n ; i++) {
        for(int j = 0 ; j < m ; j++) {
            int u = a[j] , v = b[j];
            ans[v] = max(ans[v] , ans[u] + c[j]);
        }
    }
    if(pre != ans[n]) cout << "inf" << endl;
    else cout << ans[n] << endl;
    return 0;
}

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

#define mfor(i,a,b) for(int i=(a);i<=(b);i++)

void solve() {
    int N, M; cin >> N >> M;

    int S = 0;
    mfor(i, 0, M - 1) {
        int A; cin >> A;
        S += A;
    }

    cout << ((S <= N) ? N - S : -1) << '\n';
}

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

    solve();
    return 0;
}

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

int main()
{
	int N, M, X, Y;

	cin >> N >> M >> X >> Y;

	for ( int i = 0; i < N; i++ ) {
		int A;
		cin >> A;
		X = max(X, A);
	}
	for ( int i = 0; i < M; i++ ) {
		int A;
		cin >> A;
		Y = min(Y, A);
	}

	if ( X < Y ) {
		cout << "No War" << endl;
	} else {
		cout << "War" << endl;
	}

	return ( 0 );
}


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

int main(){

  while(true){
    int wrongTime = 0;
    string str_in;
    string str_ans;
    vector <string> sub_in;
    vector <string> sub_ans;
    //input--------------------
    cin >> str_in;
    if( str_in == ".") break;
    cin>> str_ans;
    //split---------------------
    int start = 0;
    for(int i=0; i < str_in.size() ; i++){
      if(str_in[i] == '\"') {
        sub_in.push_back(str_in.substr(start,i-start));
        start = i+1;
      }
    }
    sub_in.push_back(str_in.substr(start,str_in.size()-start));
    start = 0;
    for(int i=0; i < str_ans.size() ; i++){
      if(str_ans[i] == '\"') {
        sub_ans.push_back(str_ans.substr(start,i-start));
        start = i+1;
      }
    }
    sub_ans.push_back(str_ans.substr(start,str_ans.size()-start));
    //split check
      // for(int i = 0; i < sub_in.size(); i++) cout << sub_in[i] << endl;
      // for(int i = 0; i < sub_ans.size(); i++) cout << sub_ans[i] << endl;

    //conpare
    if(sub_in.size() != sub_ans.size()){
      wrongTime = 2;
    }else{
      wrongTime = 0;
      for(int i = 0; i < sub_in.size(); i++){
        if(i%2 == 1){
          if(sub_in[i] != sub_ans[i]) wrongTime ++;
        }else{
          if(sub_in[i] != sub_ans[i]) wrongTime += 2;
        }
      }
    }
    if(wrongTime == 0) cout << "IDENTICAL" << endl;
    else if(wrongTime <= 1) cout << "CLOSE" << endl;
    else cout << "DIFFERENT" << endl;
    sub_in.clear();
    sub_ans.clear();
  }

  return 0;
}



Measured memory_bytes: 3188
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static void ABC157E();

#if 1
int main()
{
	ABC157E();
	fflush(stdout);
	return 0;
}
#endif

static void ABC157E()
{
	int N, Q;
	std::string orgs;

	getint(N);
	std::cin >> orgs;
	getint(Q);
	
	std::vector<std::set<int>> csets('z' - 'a' + 1);
	for (int i = 0; i < N; i++) {
		csets[orgs[i] - 'a'].insert(i + 1);
	}
	
	for (int q = 0; q < Q; q++) {
		char cq;
		int type, iq, lq, rq;
		getint(type);
		switch (type) {
		case 1:
			getint(iq); 
			std::cin >> cq;
			
			for (int i = 0; i < 26; i++) {
				auto it = csets[i].find(iq);
				if (it != csets[i].end()) {
					csets[i].erase(it);
				}
				if (i == (cq - 'a')) {
					csets[i].insert(iq);
				}
			}

			break;
		case 2:
		{
			getint(lq, rq);

			int kind = 0;
			for (int i = 0; i < 26; i++) {
				auto pos = csets[i].lower_bound(lq);
				if((pos != csets[i].end()) && (*pos <= rq)) {
					kind++;
				}
			}
			printf("%d\n", kind);
			break;
		}
		default:
			break;
		}
	}
}


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

int main() {
  int D;
  
  
  cin>>D;
  
 if(D==25){
   
  cout<<"Christmas"<<endl;
 }
  if(D==24){
   
  cout<<"Christmas Eve"<<endl;
 }
  if(D==23){
   
  cout<<"Christmas Eve Eve"<<endl;
 }
  
   if(D==22){
   
  cout<<"Christmas Eve Eve Eve"<<endl;
 }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int main(){
  int n,m;
  cin >> n >> m;
  vector<ll> h(n+1);
  for(int i=1;i<=n;i++) cin >> h[i];

  vector<vector<int>> g(n+1);
  for(int i=0;i<m;i++){
    int a,b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  int cnt = 0;
  for(int i=1;i<=n;i++){
    if(g[i].size() == 0){
      cnt++;
    }else{
      for(int j=0;j<g[i].size();j++){
        if(h[i] <= h[g[i][j]]){
          break;
        }
        if(j == g[i].size()-1){
          cnt++;
        }
      }
    }
  }

  cout << cnt << endl;
}


Measured memory_bytes: 9068
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    int a = 1;
    if(N == 1) {
        cout << 1 << endl;
        return 0;
    }
    while(1) {
        a *= 2;
        if(a * 2 > N)
            break;
    }
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

string solve(string s){
    const char key_char[5] = {'K', 'I', 'H', 'B', 'R'};
    bool isA = true;
    int key = 0;
    const int length = s.length();
    string ret = "YES";
    for (int i=0; i<length; ++i){
        if(isA){
            if(key < 5 && s[i] == key_char[key]){
                key++;
            }
            else if((key == 0 || key == 3 || key == 4 || key == 5) && s[i] == 'A'){
                isA = false;
            }
            else {
                ret = "NO";
            }
        }
        else {
            if(key < 5 && s[i] == key_char[key]){
                key++;
                isA = true;
            }
            else {
                ret = "NO";
            }
        }
    }
    if(key != 5){
        ret = "NO";
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string s;
    cin >> s;
    cout << solve(s) << endl;
    return 0;
}

Measured memory_bytes: 504
#define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

int main() {

	double r; cin >> r;

	cout << fixed << setprecision(6);
	cout << r * r * M_PI << " " << 2 * M_PI * r << endl;

	return 0;
}


Measured memory_bytes: 3248
// 20151005



#include<stdio.h>




int main() {
  int N;       // ????????????????????°
  int a, b, c; // ??\???
  int san;     // ?????????
  int i;




  /* ????????????????????°??\??? */
  scanf("%d", &N);
  for (i = 0; i < N; i ++) {
    /** 3 ?????????????????\??? **/
    scanf("%d %d %d", &a, &b, &c);
    /*** ??¶?´??????? ***/
    if (a > 1000 || b > 1000 || c > 1000) {
      break;
    }
    /**** 3 ?????????????????????????????????****/
    san = 0;
    if (a * a == b * b + c * c) {
      san = 1;
      /* printf("%d %d %d\n", a, b, c); */
      /* printf("%d %d\n", a * a, b * b + c * c); */
    }
    if (b * b == c * c + a * a) {
      san = 1;
      /* printf("%d %d %d\n", b, c, a); */
      /* printf("%d %d\n", b * b, a * a + c * c); */
    }
    if (c * c == a * a + b * b) {
      san = 1;
      /* printf("%d %d %d\n", c, a, b); */
      /* printf("%d %d\n", c * c, a * a + b * b); */
    }
    /***** ??¨??? *****/
    if (san == 1) {
      printf("YES\n");
    }
    else {
      printf("NO\n");
    }
  }




  /* ?????? */
  return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <limits>
using namespace std;
int main()
{
  long l, r;
  cin >> l >> r;
  long ans = numeric_limits<long>::max();
  if(r - l >= 2019){
    ans = 0;
  } else{
    for(long i = l; i < r; i++){
      for(long j = i+1; j <= r; j++){
        ans = min(ans, (i*j)%2019);
      }
    }
  }
  cout << ans;
  return 0;
}

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<ll> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;


int main() {
    int n, k;
    cin >> n >> k;
    int t = (n - 1) * (n - 2) / 2;
    if (k > t) {
        cout << -1 << endl;
        ret();
    }

    vector<P> v, u;

    for (int i = 2; i <= n; i++) {
        v.push_back({1, i});
    }

    for (int i = 2; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            u.push_back({i, j});
        }
    }

    rep(_, t - k) {
        v.push_back(u.back());
        u.pop_back();
    }

    cout << v.size() << endl;
    for (P p : v) printf("%lld %lld\n", p.first, p.second);

}

Measured memory_bytes: 3864
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
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 P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

vector<ll> enum_div(ll n){
    vector<ll> ret;
    for(ll i = 1 ; i*i <= n ; ++i){
        if(n%i == 0){
            ret.push_back(i);
            if(i != 1 && i*i != n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}

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

    int n,k;
    cin>>n>>k;
    vi a(n);
    ll sum=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    Sort(a);
    vector<ll> yakusu=enum_div(sum);
    yakusu.push_back(sum);
    ll ans=1;
    for(int i=0;i<yakusu.size();i++){
        ll need;
        
        vll r(n);
        rep(j,n)r[j]=a[j]%yakusu[i];
        Sort(r);
        ll B=0;
        rep(j,n)B+=yakusu[i]-r[j];
        ll A=0;
        need=LLINF;
        rep(j,n){
            A+=r[j];
            B-=yakusu[i]-r[j];
            need=min(need,max(A,B));
        }
        if(need<=k)ans=max(ans,yakusu[i]);
    }
    cout<<ans<<endl;


//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL unsigned long long 
using namespace std;

const int maxx=1e6+10;
const int mod=998244353;
LL num[maxx],n,x,la;
LL ans=1;

LL qp(LL a,LL b){
	LL res=1;
	a=a%mod;
	while(b){
		if(b&1) res=(res*a)%mod;
		b>>=1;
		a=(a*a)%mod;
	}
	return res;
}

int main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&x);
		if(i==1&&x){printf("0"); return 0;}
		if(i!=1&&x==0){printf("0");return 0;} 
		la=max(la,x);num[x]++;
	} 
	for(int i=1;i<=la;i++){
		ans*=qp(num[i],num[i+1]);
		ans%=mod;
	}
	ans%=mod;
	printf("%lld",ans);
	return 0;
}
 

Measured memory_bytes: 896
#include <stdio.h>
#include <stdbool.h>

int main()
{
    int a[5],k;

    for (int i = 0;i < 5;i++){
        scanf("%d",&a[i]);
    }
    scanf("%d",&k);

    bool TF = true;

    for (int i = 0; i < 5; i++)
    {
        for (int j = i + 1; j < 5; j++)
        {
            if (a[j] - a[i] > k){
                TF = false;
            }
        }
    }

    if  (TF == false){
        printf(":(");
    }else{
        printf("Yay!");
    }
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

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

    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int h = ty - sy;
    int w = tx - sx;

    for(int i = 0; i < h; ++i) cout << 'U';
    for(int i = 0; i < w; ++i) cout << 'R';
    for(int i = 0; i < h; ++i) cout << 'D';
    for(int i = 0; i < w; ++i) cout << 'L';

    cout << 'L';

    for(int i = 0; i < h+1; ++i) cout << 'U';
    for(int i = 0; i < w+1; ++i) cout << 'R';

    cout << 'D' << 'R';

    for(int i = 0; i < h+1; ++i) cout << 'D';
    for(int i = 0; i < w+1; ++i) cout << 'L';

    cout << 'U' << endl;

    return 0;
}

Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            long result = 0;
            for(int j = 0; j < N; j++)
            {
                long[] lr = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
                result +=lr[1] - lr[0] + 1;
            }
            Console.WriteLine(result);
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

//Console.WriteLine(ans);

Measured memory_bytes: 28436
#include <bits/stdc++.h>
#define int long long

using namespace std;

const int maxn = 2e5+1;

int a[maxn];

signed main() {
    int n; cin >> n;
    for (int i = 0; i < 2 * n; i++)
        cin >> a[i];
    sort(a, a + 2 * n);
    int ans = 0;
    for (int i = 0; i < 2 * n; i += 2)
        ans += a[i];
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val S = readLine()!!.reversed()

    val prefixes = arrayOf("dream", "dreamer", "erase", "eraser").map { it.reversed() }

    // println(S.substring(2))
    var idx = 0
    while (idx < S.length) {
        var yes = false
        for(p in prefixes) {
            if (S.substring(idx).startsWith(p)) {
                idx += p.length
                yes = true
                break
            }
        }
        if (!yes) break
    }
    if (idx == S.length) println("YES") else println("NO")
}

Measured memory_bytes: 116504
import java.util.*;

import java.io.*;

public class Main {
	static PrintWriter out;
	static StringBuilder sb;
	static long mod = 1000000007;
	static int inf = (int) 1e15;
	static ArrayList<Integer>[] ad;
	static int n;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		int[][] g = new int[3][3];
		boolean[][] vis = new boolean[3][3];
		for (int i = 0; i < 3; i++)
			for (int j = 0; j < 3; j++)
				g[i][j] = sc.nextInt();
		n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			for (int k = 0; k < 3; k++)
				for (int j = 0; j < 3; j++)
					if (g[k][j] == x)
						vis[k][j] = true;

		}
		boolean f = false;
		for (int i = 0; i < 3; i++) {
			int c = 0;
			int cc = 0;
			for (int j = 0; j < 3; j++) {
				if (vis[i][j])
					c++;
				if (vis[j][i])
					cc++;
			}
			if (c == 3 || cc == 3)
				f = true;
		}
		int c=0;
		int cc=0;
		for (int i = 0; i < 3; i++) {
                if(vis[i][i])
                	c++;
                if(vis[i][2-i])
                	cc++;
		}
		if (c == 3 || cc == 3)
			f = true;
		if (f)
			out.println("Yes");
		else
			out.println("No");
		out.flush();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 21456
#include<stdio.h>
int main(){
  int a,b,c,d,e,f,i;
  scanf("%d %d %d",&a,&b,&c);
  for(i=0;i<100010;i++){
    if(a%2+b%2+c%2)break;
    d=b/2+c/2;
    e=a/2+c/2;
    f=a/2+b/2;
    a=d;
    b=e;
    c=f;
  }
  printf("%d\n",i>100000?-1:i);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
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 rep(i,n) for(int (i)=0;(i)<(n);(i)++)

const int INF = 1001001001;

int main(){
    ll a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    if (a1 + a2 + a3 >=22) cout << "bust" << endl;
    else cout << "win" << endl;

}


Measured memory_bytes: 764
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

const inf = 1001001001001001

func main() {
	sc.Split(bufio.ScanWords)
	N, M := getInt(), getInt()
	node := make([][]int, N)
	for i := 0; i < M; i++ {
		f, t := getInt()-1, getInt()-1
		node[f] = append(node[f], t)
		node[t] = append(node[t], f)
	}

	ans := make([]int, N)
	cnt := make([]int, N)
	used := make([]bool, N)
	for i := 0; i < N; i++ {
		cnt[i] = inf
	}
	s := make([]int, 0)
	s = append(s, 0)
	cnt[0] = 0
	used[0] = true
	for len(s) > 0 {
		x := s[0]
		s = s[1:]
		for _, v := range node[x] {
			if cnt[v] > cnt[x]+1 {
				cnt[v] = cnt[x] + 1
				ans[v] = x
			}
			if used[v] == true {
				continue
			}
			used[v] = true
			s = append(s, v)
		}
	}

	out("Yes")
	for i := 1; i < N; i++ {
		out(ans[i] + 1)
	}
}


Measured memory_bytes: 18496
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define REP(i, n) for(int i = 0;i < n;i++)
const long long INF = 1LL << 60;

int MOD = 1000000007;

map<int, int> map_compare(map<int, int> a, map<int, int> b){

    int a_size = 0;
    for(int i=9; i>=1; --i){
        a_size+=a[i];
    }

    int b_size = 0;
    for(int i=9; i>=1; --i){
        b_size+=b[i];
    }

    if(a_size > b_size){
        return a;
    } else if (b_size > a_size){
        return b;
    } else {
        for(int i=9; i>=1; --i){
            if(b[i] > a[i]) return b;
            else if (a[i] > b[i]) return a;
        }
    }

    return a;
}

string s(map<int, int> d){
    string str = "";

    for(int i=9; i>=1; --i){
        for(int j=0; j<d[i]; j++){
            str += to_string(i);
        }
    }

    return str;
}


int main(){
    std::ios_base::sync_with_stdio(false);

    int n,m; cin >> n >> m;
    std::vector<int> a(m); REP(i,m) cin >> a[i];
    sort(a.begin(), a.end()); reverse(a.begin(), a.end());
    std::vector<int> cost;

    cost.push_back(0);
    cost.push_back(2);
    cost.push_back(5);
    cost.push_back(5);
    cost.push_back(4);
    cost.push_back(5);
    cost.push_back(6);
    cost.push_back(3);
    cost.push_back(7);
    cost.push_back(6);

    int dp[10001];
    REP(i, 10001) dp[i] = -1;
    dp[n] = 0;


    for(int i=n; i>0; --i){
        REP(j, m){
            if(i-cost[a[j]] >= 0 && dp[i] != -1){
                int c = cost[a[j]];
                dp[i-c] = max(dp[i-c], dp[i]+1);
            }
        }
    }

    //cout << dp[0] << endl;

    string ans = "";

    int i = 0;

    while(i < n){
        REP(j, m){
            if(i+cost[a[j]] <= n && dp[i+cost[a[j]]] == dp[i]-1){
                ans+=to_string(a[j]);
                i += cost[a[j]];
                break;
            }
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>                
using namespace std;
#define REP(i,n) for(auto i = 0; i < (n); ++i)
#define REP1(i,n) for(auto i = 0; i <= (n); ++i)
#define REPO(i,o,n) for(auto i = (o); i < (n); ++i)
#define REPR(i,n) for(auto i = (n)-1; i >= 0; --i)
#define REPI(itr,v) for(auto itr=v.begin(); itr != v.end(); ++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin(); itr != v.rend(); ++itr)
#define ALL(v) v.begin(), v.end()
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}
#define push_back pb;
#define push_front pf; 
#define make_pair mp;
#define first fi;
#define second se;
typedef long long ll;

int A, B;
int main(void){
	cin >> A >> B;
	if(A+B > 9)cout << "error" << endl;
	else cout << A+B << endl;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        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)*}
    };
}

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! 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")
    };
}

fn main() {
    input![n: u8];
    let odd = n % 2;
    println!("{}", (n / 2) + odd);
}


Measured memory_bytes: 4352
#include <string>
#include <iostream> 
 
using namespace std;
 
int main() {
  string s = "";
  cin >> s;
  bool p = s[0] == 'R';
  bool q = s[1] == 'R';
  bool r = s[2] == 'R';
  if (p && q && r) {
    cout << 3 << endl;
  } else if (p && q || q && r) {
    cout << 2 <<endl;
  } else {
    if (p || q || r) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
  
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define inf 1e16
#define M 1000000007
#define allv v.begin(),v.end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define mx 1000010

int main(){
	IOS;
	char c;cin>>c;
	if(c=='A')cout<<"T";
	if(c=='T')cout<<"A";
	if(c=='C')cout<<"G";
	if(c=='G')cout<<"C";
	return 0;
}



Measured memory_bytes: 256
N, M, X = map(int, input().split())

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


for i in range(M):
    if A[0] >= X:
        ans = 0
        break
    elif A[M-1] <= X:
        ans = 0
        break
    else:
        if A[i-1] < X and X < A[i]:
            ans = min(i,M-i)

print(ans)

Measured memory_bytes: 3064
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)] #student
cd=[list(map(int,input().split())) for _ in range(m)] #check point
for i in range(n):
    l=[]
    for j in range(m):
        l.append(abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]))
    k=l.index(min(l))+1
    print(k)

Measured memory_bytes: 3064