akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
ifstream in("file.in");
ofstream out("file.out");
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005
 
long long n,a,b,c,t,x,y,z;
 
int main() {
    cin >> a >> n >> b >> b >> c;
    if(!(a%2)){
        n+=a;
        n+=2*(b/2);
        n+=2*(c/2);
        if(b%2 && c%2 && a) n++;
        cout << n;
    }
    else{
        if(!(c%2) && !(b%2)){
            n+=2*(a/2)+c+b;
        }
        else if(!c || !b){
            n+=2*(a/2)+2*(b/2)+2*(c/2);
        }
        else{
            n+=a+2+2*((b-1)/2)+2*((c-1)/2);
        }
        cout << n;
    }
 
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

N,M=map(int,input().split())
E=[[] for i in range(N)]
E_INV=[[] for i in range(N)]

for i in range(M):
    x,y=map(int,input().split())
    E[x].append(y)
    E_INV[y].append(x)

QUE = list(range(N))
check=[0]*N
TOP_SORT=[]

def dfs(x):
    if check[x]==1:
        return
    check[x]=1
    
    for to in E[x]:
        if check[to]==0:
            dfs(to)

    TOP_SORT.append(x) # 全ての点からDFSを行い, 帰りがけに点を答えに入れる
    check[x]=1

while QUE:
    x=QUE.pop()
    dfs(x)

USE=[0]*N
SCC=[]

def dfs2(x):
    Q=[x]
    USE[x]=1
    ANS=[]

    while Q:
        x=Q.pop()
        ANS.append(x)
        for to in E_INV[x]:
            if USE[to]==0:
                USE[to]=1
                Q.append(to)
    return ANS

for x in TOP_SORT[::-1]:
    if USE[x]==0:
        SCC.append(dfs2(x))

print(len(SCC))
for x in SCC:
    print(len(x),*x)
        
    


Measured memory_bytes: 271864
abc = [int(i) for i in input().split()]
abc_sort = sorted(abc)
check = abc_sort[2] - abc_sort[1]
ans = 0

abc_sort[1] += check
abc_sort[0] += check 
ans += check

check_2 = abc_sort[1] - abc_sort[0]
if check_2 % 2 == 0:
    ans += check_2 // 2
else:
    ans += check_2 // 2 + 2
print(int(ans))

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pf(n) printf("%d\n",n)
#define pff(a,b) printf("%d  %d\n",a,b);
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1001001001;
const double PI = acos(-1);

int main() {
	int n, x, t;
	cin >> n >> x >> t;

	cout << (n + x - 1) / x * t << endl;

	return 0;
}

Measured memory_bytes: 3616
#include <algorithm>
#include<iostream>
using namespace std;
int main(){
  
 	int n[5];
  	cin >> n[0] >> n[1] >> n[2] >> n[3] >> n[4];
  	int min = 650;
  	int mn = 0;
  	int sum;
  
  	for(int i=0; i<5; ++i){
      
      if(n[i]%10 < min && n[i]&10 != 0){
    	min = n[i]%10;
        mn = i;
      }
    }
  
  	for(int i=0; i<5; ++i){
     
      if(i != mn && n[i]%10 != 0){
       sum += n[i] + (10 - n[i]%10); 
      }else{
       sum += n[i]; 
      }
    }
  
  	
  
  	
  	
  
  
  	cout << sum << endl;
}

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


int main()
{
	int W,H,x,y,r;
	
	cin >>W;
	cin >>H;
	cin >>x;
	cin >>y;
	cin >>r;

	if(H>=y+r && y-r>=0 && W>=x+r && x-r>=0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(int, N);
    CIN(int, K);
    CINS(int, D, K);

    int ans;
    for (int i = N; i < 1e5; i++) {
        int n = i;
        bool ok = true;
        for (int d = 0; d < 5; d++) {
            if ( !ok ) break;
            if ( n == 0 ) break;

            for (int k = 0; k < K; k++) {
                if ( !ok ) break;
                if ( n % 10 == D[k] ) {
                    ok = false;
                }
            }
            n /= 10;
        }
        if (ok) {ans = i;break;}
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

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

	if (K > ((n - 1) * (n - 2) / 2)) cout << -1 << endl;
	else{
		vector<vector<bool>> g(n + 1,vector<bool> (n + 1,false));
		int m = 0;//頂点数
		for(int i = 2; i <= n; i++) {//1からの辺を張る
			g[1][i] = true;
			m++;
		}
		for(int i = 2; i <= n; i++) {
			for(int j = i + 1; j <= n; j++) {
				g[i][j] = true;
				m++;
			}
		}
		for(int i = 0; i < K; i++) {
			bool flag = true;
			for(int j = 2; j <= n; j++) {
				for(int k = j + 1; k <= n; k++) {
					if (g[j][k] && flag){
						g[j][k] = false;
						flag = false;
						m--;
					}
				}
			}
		}
		cout << m << endl;
		for(int i = 1; i <= n; i++) {
			for(int j = 1; j <= n; j++) {
				if (g[i][j])cout << i << " " << j << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    s = input()
    if s == 'ABC':
        print('ARC')
    elif s == 'ARC':
        print('ABC')


if __name__ == '__main__':
    solve()


Measured memory_bytes: 9040
from collections import defaultdict
N = int(input())
S = [input() for _ in range(N)]
d = defaultdict(int)
maxn = 0

for i in range(N):
    d[S[i]] += 1
    maxn = max(maxn, d[S[i]])

ans = []
for k, v in d.items():
    if v == maxn:
        ans.append(k)
ans.sort()
for s in ans:
    print(s)


Measured memory_bytes: 35572
/* ---------- STL Libraries ---------- */

// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>


/* ---------- Namespace ---------- */

using namespace std;


/* ---------- Type Abbreviation ---------- */

template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

using ll = long long;
using PL = P<ll, ll>;
using PS = P<string, ll>;

using VI = V<int>;
using VVI = V<VI>;
using VL = V<ll>;
using VVL = V<VL>;
using VS = V<string>;
using VB = V<bool>;
using VVB = V<VB>;
using VPL = V<PL>;
using VPS = V<PS>;

#define fst first
#define snd second


/* ---------- conversion ---------- */

#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)
#define DOUBLE(n) static_cast<double>(n)


/* ---------- container ---------- */

#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define GSORT(c) sort(ALL(c), greater<decltype((c).front())>())
#define SZ(x) (LL((x).size()))


/* ---------- repetition ---------- */

#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)

#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// Usual REP runs from 0 to n-1 (R: n to 0)
// Natural REP runs from 1 to n (R: n to 1)


/* ---------- Constants ---------- */

// const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
const ll INF = 1LL << 50;
// const double PI = 3.14159265358979;
// const ll dx[4] = {0, -1, 1, 0};
// const ll dy[4] = {-1, 0, 0, 1};
// const ll dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const ll dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};


/* ---------- Short Functions ---------- */

template <typename T>
T square(T a) {
    return a * a;
}


/* ---------- Debug ---------- */
#define GET_VAR_NAME(variable) #variable

#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;
#define testP(p) cout << GET_VAR_NAME(p) << " = (" << (p).fst << ", " << (p).snd << ")" << endl;


/* ^^^^^^^^^^^^^^^ Settting Part ^^^^^^^^^^^^^^^ */

/* ---------- Variances ---------- */


/* ---------- Functions ---------- */

ll ope(int x, int y) {
    if (x <= y) {
        return y - x;
    } else {
        return INF;
    }
}

/* ---------- Main Function ---------- */

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

    ll x, y;
    cin >> x >> y;

    ll ans = INF;

    ans = min(ope(x, y), ans);
    ans = min(ope(-x, y) + 1, ans);
    ans = min(ope(x, -y) + 1, ans);
    ans = min(ope(-x, -y) + 2, ans);

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

Measured memory_bytes: 256
H,N = list(map(int,input().split()))
dp = [float("inf")] * (H+1)

for i in range(N):
  a,b = list(map(int,input().split()))

  for h in range(1, H+1):
    if h - a <= 0:
      dp[h] = min(dp[h], b)
    else:
      dp[h] = min(dp[h], b + dp[h - a])

print(dp[-1])


Measured memory_bytes: 50652
N = int(input())
b = list(map(int, input().split()))

a = []
i = len(b) - 1
while(i >= 0):
    if(i + 1 == b[i]):
        pick = b[i]
        b.remove(pick)
        a = [pick] + a
        i = len(b)
    i -= 1

if(len(b) > 0):
    print("-1")
    exit()

for i in a:
    print(str(i))


Measured memory_bytes: 3064
#include <stdio.h>

#define MAX 200000



int max(int a,int b) { return a>b ? a: b;}
int min(int a,int b) { return a<b ? a: b;}


int main(void) {

    int R[MAX], i, n;
    
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&R[i]);
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for(int i=1; i<n; i++) {

        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);

    }

    
    printf("%d\n",maxv);

    return 0;

}


Measured memory_bytes: 2640
_, A = input(), map(int, input().split())

flag = False
count = 0
while True:
    tmp = []
    for a in A:
        if a % 2 != 0:
            flag = True
            break
        else:
            tmp.append(a / 2)

    if flag:
        break

    A = tmp
    count += 1

print(count)


Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
#define M 100

int main()
{
  int i = 0,x[M];
  char stack[M];
  int state;
  while (1) {
    if (scanf("%s", &stack[i]) == EOF)break;
    if(stack[i]=='+'){
      x[i-2] = x[i-2]+x[i-1];
      i-=2;
    }
    else if (stack[i] == '-') {
      x[i-2]=x[i-2]-x[i-1];
      i-=2;
    }
    else if (stack[i] == '*') {
      x[i-2]=x[i-2]*x[i-1];
      i-=2;
    }
		
    else {
      x[i] = atoi(&stack[i]);
    }
    i++;
  }
  printf("%d\n",x[0]);
  return 0;
}



Measured memory_bytes: 2104
use strict;
use warnings;
use feature qw( say );

sub solve {
  my ($N, $V, $C) = @_;
  my ($total, $p) = (0, 0);
  for (my $i = 0; $i < $N; $i++) {
    $p = $V->[$i] - $C->[$i];
    $total += ($p > 0) ? $p : 0;
  }
  return $total;
}

sub main {
  my $line;
  chomp ($line = <STDIN>);
  my ($N) = $line =~ /\A(\d+)\Z/;
  chomp ($line = <STDIN>);
  my @V = split(/ /, $line);
  chomp ($line = <STDIN>);
  my @C = split(/ /, $line);
  say solve($N, \@V, \@C);
}

main() unless (caller);


Measured memory_bytes: 768
#include <iostream>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if (a==1) a=14;
    if (b==1) b=14;
    if (a==b) cout<<"Draw";
    if (a>b) cout<<"Alice";
    if (a<b) cout<<"Bob";
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
count=[0]*m
ans=0
for i in range(n):
    ka=list(map(int,input().split()))
    for j in range(1,ka[0]+1):
        count[ka[j]-1]+=1

for k in range(m):
    if count[k]==n:
        ans+=1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, n) for (int i = 1; i < (int)(n); ++i)
using namespace std;
using lint = int64_t;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    
    cout << 2 * (N - 1) << "\n";
    vector<pair<int, int>> S(N);
    rep(i, N) S[i] = pair<int, int>{abs(a[i]), i};
    sort(S.rbegin(), S.rend());
    rep(i, N) {
        if (i == S[0].second) continue;
        cout << S[0].second + 1 << " " << i + 1 << "\n";
    }
    if (a[S[0].second] > 0) {
        rep(i, N - 1) cout << i + 1 << " " << i + 2 << "\n";
    } else {
        for (int i = N - 1; i >= 1; --i) cout << i + 1 << " " << i << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
from collections import deque
import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
table = [[] for i in range(N)]
for i in range(N-1):
  a,b = map(int, input().split())
  a -= 1
  b -= 1
  table[a].append(b)
  table[b].append(a)
task = [0]*N
point = [-1]*N
point[0] = 0
for i in range(Q):
  p,x = map(int, input().split())
  p -= 1
  task[p] += x
H = deque()
H.append(0)
 
while H:
  p = H.popleft()
  point[p] += task[p]
  for np in table[p]:
    if point[np] == -1:
      H.append(np)
      point[np] = point[p]
 
print(" ".join(map(str, point)))

Measured memory_bytes: 73040
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		int count = 0;
		for (int i = a; i <= b; i++) {

			if (c % i == 0) {
				count++;
			}

		}

		System.out.println(count);

		sc.close();

	}

}


Measured memory_bytes: 26248
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


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

        # 親への重みを管理
        self.weights = [0] * n_nodes

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

    # xからyへの重みがw
    def unite(self, x, y, w):
        w += self.weights[x]
        w -= self.weights[y]
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x
            w *= -1

        self.parents[x] += self.parents[y]
        self.parents[y] = x
        self.weights[y] = w
        return

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        return -self.parents[self.find(x)]

    def get_weight(self, x, y):
        return self.weights[y] - self.weights[x]


def main():
    N, M = map(int, input().split())
    tree = WeightedUnionFind(N)
    for _ in range(M):
        L, R, D = map(int, input().split())
        L -= 1
        R -= 1

        if tree.is_same(L, R):
            if tree.get_weight(L, R) == D:
                continue
            else:
                print("No")
                return
        else:
            tree.unite(L, R, D)

    print("Yes")
    return


if __name__ == "__main__":
    main()


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

int main()
{
  int N;
  cin >> N;
  vector<int> ai(N);
  for(int i = 0; i < N; i++)
    cin >> ai.at(i);
  int count = 0;
  int a = 1;
  while(count < N)
  {
    count++;
    a = ai.at(a-1);
    if(a == 2)
      break;
  }
  if(count < N)
    cout << count << endl;
  else
    cout << -1 << endl;
}


Measured memory_bytes: 640
import java.util.Scanner;


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

		while(true){
			String str =sc.next();

			if(str.equals("END_OF_TEXT")) {
				break;
			}
			String small = str.toLowerCase();
			if(small.matches(W)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 26260
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int a,b;
	cin >> a >>b;
	cout << max(a+b,max(a-b,a*b)) << endl;

	return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"

using namespace std;

constexpr long long int MOD = 1000000007;
//const int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;

//const double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

void Calculate_Depth(vector<vector<int>>&edge, vector<int>&depth, int stnode) {
	depth[stnode] = 0;
	queue<int>Q;
	Q.push(stnode);
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		for (auto i : edge[cn]) {
			if (depth[i] > depth[cn] + 1) {
				depth[i] = depth[cn] + 1;
				Q.push(i);
			}
		}
	}
	return;
}

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

	cin >> N >> M >> K;
	vector<pair<int, int>>edge(M);
	vector<vector<int>>dis_edge(N);
	for (auto &i : edge) {
		cin >> i.first >> i.second;
		i.first--, i.second--;
		dis_edge[i.first].push_back(i.second);
		dis_edge[i.second].push_back(i.first);
	}
	vector<int>depth(N,MOD);
	Calculate_Depth(dis_edge, depth, 0);
	vector<int>ans;
	vector<int>v(K);
	for (auto &i : v) {
		cin >> i;
		i--;
	}
	vector<vector<int>>w(M);
	vector<int>dir(N);
	for (auto i : edge) {
		if (depth[i.first] > depth[i.second])dir[i.first]++;
		else if (depth[i.second] > depth[i.first])dir[i.second]++;
	}
	int add = 0;
	vector<int>box;
	set<pair<int, int>>st;
	for (auto i : v) {
		if (depth[edge[i].first] == depth[edge[i].second]) {
			ans.push_back(add);
			continue;
		}
		if (depth[edge[i].first] < depth[edge[i].second])swap(edge[i].first, edge[i].second);
		if (st.find({ edge[i].second,edge[i].first }) != st.end()) {
			ans.push_back(add);
			continue;
		}
		dir[edge[i].first]--;
		st.insert({ edge[i].second,edge[i].first });
		assert(dir[edge[i].first] >= 0);
		queue<int>Q;
		if (dir[edge[i].first] == 0) {
			Q.push(edge[i].first);
			add++;
		}
		while (!Q.empty()) {
			int cn = Q.front();
			box.push_back(cn);
			Q.pop();
			for (auto j:dis_edge[cn]) {
				if (depth[j] > depth[cn]) {
					if (st.find({ cn, j }) != st.end())continue;
					dir[j]--;
					st.insert({ cn,j });
					assert(dir[j] >= 0);
					if (dir[j] == 0) {
						add++;
						Q.push(j);
					}
				}
			}
		}
		ans.push_back(add);
	}
	for (auto i : ans)cout << i << endl;
}


Measured memory_bytes: 26444
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ar array
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k ;
  cin >> n >> k;
  vector<ll> v(n);
  for(ll& x : v)
    cin >> x;
  sort(begin(v), end(v));
  ll ans =0;
  for(int i=0; i<k; i++)
  ans+=v[i];
  cout << ans ;
  return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#define PI 3.141592653589

int main(int argc, char const *argv[]) {
  double r=0;
  double area=0,length=0;

  std::cin >> r;
  area = r*r*PI;
  length = 2.0 * PI * r;
  std::cout << std::fixed << std::setprecision(6) << area << " " << std::fixed << std::setprecision(6) << length << std::endl;

  return 0;
}

Measured memory_bytes: 3268
#include "bits/stdc++.h"
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 

#define PI 3.14159265

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)5e5 + 7;
const int inf = (int)1e9 + 7;
//const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
 
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};

const int mod = 998244353;

struct dsu{
	int parent[N];
	int cont;
	void make_set(int n){
		for(int i = 1; i <= n; i++)
			parent[i] = i;
		cont = n;
	}
	
	int find_set(int v){
		if(v == parent[v])
			return v;
		return find_set(parent[v]);
	}
	
	void union_sets(int a, int b){
		a = find_set(a);
		b = find_set(b);
		if(a != b){
			parent[b] = a;
			cont--;
		}
	}
};



ll v[200007];
int main(){
	int n; cin>> n;
	ll tot = 0, acc = 0;
	for(int i =0; i < n; i++){
		cin>>v[i];
		tot += v[i];
	}
	ll d = linf;
	for(int i = 0; i < n; i++){
		acc += v[i];
		d = min(d, abs(acc -  (tot - acc)));
	}
	
	cout<<d;
	return 0;
}


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

int main(void) {

	int a, b, c, d, ans = 0;

	cin >> a >> b >> c >> d;

	if (a > b) ans += b;
	else ans += a;
	if (c > d) ans += d;
	else ans += c;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }



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

  ll n, x;
  cin >> n >> x;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  vector<ll> dp(n, INF);
  ll ans = INF;
  rep(i, n) {
    ll res = i * x;
    rep(j, n) {
      chmin(dp[(i + j) % n], a[j]);
      res += dp[(i + j) % n];
    }
    chmin(ans, res);
  }
  cout << ans << '\n';

  




  
  return 0;
}

Measured memory_bytes: 256
n = int(input())
v_0 = int(input())
minv = v_0
v_1 = int(input())
if v_1 < v_0:
	minv = v_1
maxv = v_1 - v_0

for _ in range(2,n):
	value = int(input())
	maxv = max(maxv, value - minv)
	minv = min(minv, value)

print(maxv)


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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

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

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

    sort(v.begin(), v.end(), greater<int>());

    int sum = 0;
    for (int i = 0; i < k; i++) {
        sum += v[i];
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int k,x=0;
  vector<int> da(2);
  cin >> da[0] >> da[1] >> k;
  for(int i=0;i<k;i++){
    if(da[x]%2==1)
      da[x]--;
    da[1-x]+=da[x]/2;
    da[x]-=da[x]/2;
    x=1-x;
  }
  cout << da[0] << ' ' << da[1] << endl;
}


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

typedef pair<int, int> p;
p shapes[7][3] = 
{
	{ p(1, 0), p(0, 1), p(1, 1)		},
	{ p(0, 1), p(0, 2), p(0, 3)		},
	{ p(1, 0), p(2, 0), p(3, 0)		},
	{ p(0, 1), p(-1, 1), p(-1, 2)	},
	{ p(1, 0), p(1, 1), p(2, 1)		},
	{ p(0, 1), p(1, 1), p(1, 2)		},
	{ p(1, 0), p(0, 1), p(-1, 1)	}
};
string table[8];

int main()
{
	while (true)
	{
		for (int i = 0; i < 8; i++)
		{
			if (!(cin >> table[i])) return 0;
		}

		p upperLeft;
		for (int y = 0; y < 8; y++)
		{
			for (int x = 0; x < 8; x++)
			{
				if (table[y][x] == '1')
				{
					upperLeft = p(x, y);
					goto Break;
				}
			}
		}
		Break:

		for (int i = 0; i < 7; i++)
		{
			for (int j = 0; j < 3; j++)
			{
				int X = upperLeft.first + shapes[i][j].first;
				int Y = upperLeft.second + shapes[i][j].second;
				if (!(0 <= X && X < 8 && 0 <= Y && Y < 8)) break;
				if (table[Y][X] == '0') break;
				if (j == 2) cout << char('A' + i) << endl;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define fi first
#define se second
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
#define bit(x) (1ll<<(x))

vector<ll> sieve(ll n){
	vector<ll> res;
	vector<bool> is_prime(n+1, true);
	is_prime[0] = is_prime[1] = false;
	
	for(int i = 2; i <= n; i++){
		if(is_prime[i]){
			res.push_back(i);
			for(int j = 2*i; j <= n; j += i){
				is_prime[j] = false;
			}
		}
	}
	
	return res;
}

void mainsolve(){
	
	ll n;
	cin >> n;

	vector<ll> aaa = sieve(n*10);

	cout << *lower_bound(aaa.begin(), aaa.end(), n) << endl;

}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 1528
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)

li = [[a[0],1]]

for i in range(1,n):
  if a[i] != a[i-1]:
    li.append([a[i],1])
  else:
    li[len(li)-1][1]+=1
ans = 0
for i in range(len(li)):
  ans_tmp =li[i][1]
  if 0<=i-1:
    if li[i-1][0]+1  == li[i][0]:
      ans_tmp = ans_tmp +li[i-1][1]
  if i+1<len(li):
    if li[i+1][0]-1  == li[i][0]:
      ans_tmp = ans_tmp +li[i+1][1]
  ans = max(ans,ans_tmp)
print(ans)

Measured memory_bytes: 14008
#include<bits/stdc++.h>
using namespace std;
#define ff              first
#define ss              second
#define rep(i,n)        for(int i=0;i<n;i++)
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define Sort(v)         sort(v.begin(), v.end(), sortbysec)
#define setbits(x)      __builtin_popcountll(x)
#define rightmostbit(x) __builtin_ffsll(x)
#define leftzeros(x)    __builtin_clzll(x)
#define rightzeros(x)   __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         cout << fixed; cout << setprecision(x); cout << y;
#define pi              3.141592653589793238
#define mk(a,n)         int n;cin>>n;vi a(n);for(int i=0;i<n;i++) cin>>a[i]
#define w(x)            int x; cin>>x; while(x--)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{	return (a.second < b.second);
	// sorted by 2nd element in ascending order
}
void g_b()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
}
int32_t main()
{

	int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
	w(t) {
		string s; cin >> s;
		if (s == "AC")c1++;
		if (s == "WA")c2++;
		if (s == "TLE")c3++;
		if (s == "RE")c4++;
	}
	cout << "AC" << " " << "x" << " " << c1 << '\n';
	cout << "WA" << " " << "x" << " " << c2 << '\n';
	cout << "TLE" << " " << "x" << " " << c3 << '\n';
	cout << "RE" << " " << "x" << " " << c4 << '\n';

	return 0;

}

Measured memory_bytes: 3620
import math
a, b, n = map(int, input().split())

x = 0
ans = 0
if n < b:
    x = n
    ans = math.floor(a*x/b) - a * math.floor(x/b)
else:
    x = b - 1
    ans = math.floor(a*x/b) - a * math.floor(x/b)
print(ans)

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

using namespace std;

#define min3(a, b, c)           min((a), min((b), (c)))
#define max3(a, b, c)           max((a), max((b), (c)))
#define lcm(a,b)                (a / __gcd(a,b) ) *b
#define gcd(a,b)                __gcd(a,b)
#define dist(x1,y1,x2,y2)       sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
#define distl(x1,y1,x2,y2)      sqrtl((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
#define sqr(a)                  ((a)*(a))
#define FOR(a, b)               for(int i=a; i<b; i++)
#define fRead(x)                freopen(x,"r",stdin)
#define fWrite(x)               freopen (x,"w",stdout)
#define pb                      push_back
#define mk                      make_pair
#define ff                      first
#define ss                      second
#define lb                      lower_bound
#define ub                      upper_bound
#define all(a)                  a.begin(),a.end()
#define FASTIO                  ios_base::sync_with_stdio(0);cin.tie(NULL);

int main()
{
    FASTIO

    int  n, m;
    cin >> n >> m;

    bool AC[100050];
    memset(AC, false, sizeof AC);

    map<int, int> WA;

    FOR (0, m)
    {
        int submission;
        string verdict;

        cin >> submission;
        cin >> verdict;

        if (verdict == "AC")
            AC[submission] = true;
        if (verdict == "WA")
        {
            if (!AC[submission])
                WA[submission]++;
        }
    }

    int ACCOUNT=0, WACOUNT =0;

    for (auto it: WA)
    {
        if (AC[it.first])
        {
            ACCOUNT++;
            WACOUNT += it.second;
            AC[it.first] = false;
        }
    }

    for (int i=0; i<=n; i++)
        if (AC[i])
            ACCOUNT++;
    cout << ACCOUNT << " " << WACOUNT;

}



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

using namespace std;

int main()
{
    long long n,sum=0;
    vector<long long>vec;
    cin>>n;
    for(int i=0;i<3*n;++i)
    {
        long long q;
        cin>>q;
        vec.push_back(q);
    }
    sort(vec.begin(),vec.end(),greater<long long>());
    for(int i=0;i<n;++i)
    sum+=vec[2*i+1];
    cout<<sum;
}

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

const int INF = 1e9 + 5;

int main()
{
  int n;
  cin >> n;
  vector<int> h(n);
  for(int i=0; i < n; i++)
	cin >> h[i];
  vector <int> dp(n, INF);
  dp[0] = 0;
  for(int i=0; i < n; i++)
      {
        for(int j = i + 1; j <= i + 2; j++)
        {
          if(j < n)
          	dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
        }
      }
   cout << dp[n-1];
  return 0;
}

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

#define ll long long
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a;
    char c[4];
    cin >> a >> c[0] >> c[1] >> c[2] >> c[3];
    string b{c[0], c[2], c[3]};
    ll base = stoll(b);
    cout << base * a / 100 << endl;
    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector> 
#include <cstring>
#include <queue>
#include <ctime>
#include <set>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const ll INF = 10e16;
const int maxN = 200010;
const int maxD = 15;
const int maxH = 100; 
const int MOD = 1000000007;


vector<string> ans;
int n;
string tmp;
void dfs(int k,int x)
{
	if(k == n)
	{
		ans.push_back(tmp);
		return;
	}
	for(int i=1;i<=x;i++)
	{
		tmp.push_back('a'+i-1);
		dfs(k+1,x);
		tmp.pop_back();
	}
	tmp.push_back('a'+x);
	dfs(k+1,x+1);
	tmp.pop_back();
}
int main()
{
	cin>>n;
	tmp = "a";
	dfs(1,1);
	for(auto e:ans)
	{
		cout<<e<<endl;
	}
	return 0;
}

Measured memory_bytes: 9588
m, k = [int(x) for x in input().split()]
if m == 1:
    if k == 0:
        print(0, 0, 1, 1)
    else:
        print(-1)
else:
    if k < 1 << m:
        a = [str(i) for i in range(1 << m) if i != k]
        print(' '.join(a), k, ' '.join(reversed(a)), k)
    else:
        print(-1)

Measured memory_bytes: 16020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;cin >> n >> m;
	cout << (n-1)*(m-1) << endl;
}

Measured memory_bytes: 256
fun ac105(args: Array<String>) {
    val (N, K) = args[0].split(" ").map { it.toInt() }
    val numList = args[1].split(" ").map { it.toInt() }
    var ans = Int.MAX_VALUE
    (0 until N + 1 - K).forEach { start ->
        val first = numList[start]
        val last = numList[start + K - 1]
        ans = Math.min(ans, when {
            last <= 0 -> Math.abs(first)
            first >= 0 -> Math.abs(last)
            else -> Math.abs(last - first) + Math.min(Math.abs(last), Math.abs(first))
        })
    }
    println(ans)
}

fun main(args: Array<String>) {
    ac105(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

Measured memory_bytes: 51712
#include <stdio.h>
#include <string.h>
#include "math.h"


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

  int i, j;
  int n;
  int m, l, k;
  double aved = 0.0;

  scanf("%d", &n);

  int x[n];
  int y[n];

  m = n * (n-1) / 2;
  double d[m];

  for(i=0; i<=n-1; i++){
    scanf("%d %d ", &x[i], &y[i]);
  }

  l = 0;
  for(i=0; i<=n-1; i++){
    for(j=i+1; j<=n-1; j++){
      d[l] = sqrt(( x[i] - x[j] )*( x[i] - x[j] ) + ( y[i] - y[j] )*( y[i] - y[j] ));
      l++;
    }
  }

  for(i=0; i<=m-1; i++){
    aved += d[i] * 2 / n;
  }

  printf("%f\n", aved);

  return 0;
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

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

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    String s = sc.next();
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < s.length(); i++) sb.append("x");
    System.out.println(sb.toString());
  }
}

Measured memory_bytes: 23124
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <bitset>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
typedef unsigned long long ull;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int INF = 1 << 27;
const int MAX_V = 101;
//////////////////////////////
// ????°??????¨???
struct edge { int to, cap, cost, rev; };

int V;
vector<edge> G[MAX_V]; //??°???????????£??\???????????¨???
int h[MAX_V]; //??????????????£???
int dist[MAX_V]; //???????????¢
int prevv[MAX_V], preve[MAX_V]; // ??´??????????????¨???

void add_edge(int from, int to, int cap, int cost){
  G[from].push_back((edge){to, cap, cost, (int)G[to].size()});
  G[to].push_back((edge){from, 0, -cost, (int)(G[from].size()) - 1});
}
// s??????t????????????f???????°??????¨???
// ??????????????´??????-1?????????
int min_cost_flow(int s, int t, int f){
  int res = 0;
  fill(h, h + V, 0);
  while(f > 0){
    priority_queue<pi, vector<pi>, greater<pi> > que;
    fill(dist, dist + V, INF);
    dist[s] = 0;
    que.push(pi(0, s));
    while(!que.empty()){
      pi p = que.top(); que.pop();
      int v = p.second;
      if(dist[v] < p.first) continue;
      REP(i, G[v].size()){
        edge &e = G[v][i];
        if(e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]){
          dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
          prevv[e.to] = v;
          preve[e.to] = i;
          que.push(pi(dist[e.to], e.to));
        }
      }
    }
    if(dist[t] == INF) return -1;
    REP(v, V) h[v] += dist[v];
    int d = f;
    for(int v = t; v != s; v = prevv[v]) d = min(d, G[prevv[v]][preve[v]].cap);
    f -= d;
    res += d * h[t];
    for(int v = t; v != s; v = prevv[v]){
      edge &e = G[prevv[v]][preve[v]];
      e.cap -= d;
      G[v][e.rev].cap += d;
    }
  }
  return res;
}

int main() {
  int E, F; cin >>V >>E >>F;
  REP(i, E){
    int a,b,c,d; cin >> a >> b >> c >> d;
		add_edge(a,b,c,d);
  }
  cout << min_cost_flow(0, V-1, F)  <<endl;
  return 0;
}

Measured memory_bytes: 3208
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back

typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

const int mod = (int)1e9 + 7;
const int mod2 = 998244353;

ll exp(ll taban, ll us, ll md) {
    ll carpan = taban % md;
	if(carpan == 0) return 0;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % md;
        temp /= 2;
        carpan = (carpan*carpan) % md;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}
ll mul(ll a, ll b, ll md){
	return a*b % md;
}
const int N = 1e5 + 5;
vector<ll> fact;
vector<ll> inv_fact;
void fact_init(int n){
	fact.resize(n+5);
	inv_fact.resize(n+5);
	fact[0] = inv_fact[0] = 1;
	for(int i = 1; i <= n; i++){
		fact[i] = (fact[i-1] * i) % mod;
		inv_fact[i] = exp(fact[i], mod-2, mod);
	}
}
ll komb(ll a, ll b){
	return fact[a] * (inv_fact[a-b] * inv_fact[b] % mod) % mod;
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n, m; cin>>n>>m;
	vector<vector<int>> vec(n+1);
	for(int i = 0; i < m; i++){
		int a, b; cin>>a>>b;
		vec[a].pb(b);
		vec[b].pb(a);
	}
	priority_queue<pii, vector<pii>, greater<pii>> q;
	q.push({0, 1});
	vector<int> dst(n+5, 1e9);
	dst[1] = 0;
	int res[n+5] = {};
	while(!q.empty()){
		int cur = q.top().second, dist = q.top().first;
		q.pop();
		if(dst[cur] < dist) continue;
		for(auto x: vec[cur]){
			if(dst[x] > dist + 1){
				dst[x] = dist + 1;
				res[x] = cur;
				q.push({dist + 1, x});
			}
		}
	}
	bool check = true;
	for(int i = 2; i <= n; i++){
		if(res[i] == 0){
			check = false;
			break;
		}
	}
	if(!check) cout<<"No";
	else{
		cout<<"Yes\n";
		for(int i = 2; i <= n; i++){
			cout<<res[i]<<"\n";
		}
	}
}

Measured memory_bytes: 11228
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;

string s;

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

  cin >> s;

  for(int i=0;i<s.size();i++){
    if(s[i] == '1'){
      s[i] = '9';
    } else if(s[i] == '9'){
      s[i] = '1'; 
    }
  }

  cout << s << endl;

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctype.h>
using namespace std;

//isupperは大文字の時に真。<ctype.h>を加える
int main(){
  string s;
  cin>>s;
  bool a=false;
  int count=0;
  if(s.at(0)=='A'){
    for(int i=2;i<s.size()-1;i++){
      if(s.at(i)=='C'){
        count++;
      }
    }
    if(count==1){
      sort(s.begin(),s.end());
      if(isupper(s.at(2))){
      }
      else{
        a=true;
      }
    }
  }
  if(a){
    cout<<"AC"<<endl;
  }
  else{
    cout<<"WA"<<endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <vector>

using namespace std;

int main()
{
    int n;
    vector<int> v;

    cin >> n;
    for (int i = 0; i < n; ++i) {
        int s;
        cin >> s;
        v.push_back(s);
    }

    auto merge = [&v](int left, int mid, int right) {
        int count = 0;
        int n1 = mid - left;
        int n2 = right - mid;
        vector<int> l(n1 + 1);
        vector<int> r(n2 + 1);
        for (int i = 0; i < n1; ++i) {
            l[i] = v[left + i];
        }
        for (int i = 0; i < n2; ++i) {
            r[i] = v[mid + i];
        }
        l[n1] = numeric_limits<int>::max();
        r[n2] = numeric_limits<int>::max();

        int i = 0;
        int j = 0;
        for (int k = left; k < right; ++k) {
            count += 1;
            if (l[i] <= r[j]) {
                v[k] = l[i];
                i += 1;
            }
            else {
                v[k] = r[j];
                j += 1;
            }
        }
        return count;
    };

    function<int(int, int)> mergeSort = [&merge, &mergeSort](int left,
                                                             int right) {
        int count = 0;
        if (left + 1 < right) {
            int mid = (left + right) / 2;
            count += mergeSort(left, mid);
            count += mergeSort(mid, right);
            count += merge(left, mid, right);
        }
        return count;
    };

    auto r = mergeSort(0, n);
    for (int i = 0; i < n; ++i) {
        if (i != 0) {
            cout << ' ';
        }
        cout << v[i];
    }
    cout << endl;
    cout << r << endl;
}

Measured memory_bytes: 6688
// 2020-08-31 16:12:48
// clang-format off
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

// clang-format on
const int V = 200020;
vector<int> G[2][V];
int C[2][V];
void initG() {
  vector<int> j(2);
  cin >> j[0] >> j[1];
  rep(i, 2) {
    rep(_, j[i]) {
      int a, b;
      cin >> a >> b;
      a--;
      b--;
      G[i][a].push_back(b);
      G[i][b].push_back(a);
    }
  }
}
void dfs(int k, int u, int c) {
  if (C[k][u] >= 0) return;
  C[k][u] = c;
  for (int v : G[k][u]) dfs(k, v, c);
}
void answer() {
  int n;
  cin >> n;
  initG();
  memset(C, -1, sizeof C);
  rep(k, 2) {
    rep(i, n) { dfs(k, i, i); }
  }
  map<P, int> mp;
  rep(i, n) mp[P(C[0][i], C[1][i])]++;
  rep(i, n) {
    if (i) cout << ' ';
    cout << mp[P(C[0][i], C[1][i])];
  }
  cout << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 30780
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;

int n,ans;
int t[N],a[18];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		t[x]^=z;
		t[y]^=z;
	}
	for(int i=0;i<n;i++)
		a[t[i]]++;
	for(int i=1;i<=15;i++)
		ans+=a[i]>>1,a[i]&=1;
	for(int i=1;i<=15;i++)
	for(int j=i+1;j<=15;j++)
		if(a[i^j] && a[i] && a[j]) a[i]=0,a[j]=0,a[i^j]=0,ans+=2;
	for(int i=1;i<=15;i++)
	for(int j=i+1;j<=15;j++)
	for(int k=j+1;k<=15;k++)
		if(a[i] && a[j] && a[k] && a[i^j^k]) a[i]=0,a[j]=0,a[k]=0,a[i^j^k]=0,ans+=3;
	for(int i=1;i<=15;i++)
		if(a[i]) a[16]++;
	if(a[16]>=5) ans+=a[16]-1;
	else ans+=a[16];
	printf("%d\n",ans);
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <forward_list>

using namespace std;

typedef long long ll;
typedef vector<long long> vi;
typedef pair<long long, long long> ii;
typedef vector<pair<long long, long long>> vii;
typedef stringstream ss;
ll mil() { return numeric_limits<long long>::min(); }
ll mal() { return numeric_limits<long long>::max(); }

#define R3(i, a, b) for (long long i = (a); i < (b); ++i)
#define R2(i, b) for (long long i = 0; i < (b); ++i)
#define R1(b) for (long long i = 0; i < (b); ++i)
#define RR(i, a, b) for (long long i = a; i > b; --i)
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

// build: ctrl + f9

// run: shift + f10
// sanitize: shift + f11
// debug: shift + f9

void A() {
}

void B() {
}

void C() {
    ll L;

    cin >> L;

    cout.precision(6);
    cout << fixed << ((double)L/3.)*((double)L/3.)*((double)L/3.) << endl;
}

void D() {
}

void E() {
}

int main()
{
    C();
}

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

long mypow(int x){
    long ret=1;
    for(int i=0;i<x;i++){
        ret *= 2;
    }
    return ret;
}

int main(){
    long long h;
    cin >> h;
    for(int i=0;i<64;i++){
        if(h>=mypow(i)&&h<mypow(i+1)){
            cout << mypow(i+1)-1 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256