akhauriyash/Code-Regression huggingface dataset:
//Rooted Trees
#include <iostream>

using namespace std;

struct Node {
    int p = -1, l = -1, r = -1, d = 0;
};

void setDepth(Node N[], int u, int d) {
    N[u].d = d;
    if(N[u].r != -1) setDepth(N, N[u].r, d);
    if(N[u].l != -1) setDepth(N, N[u].l, d + 1);
}

int main() {
    int n;
    cin >> n;
    Node N[n];
    for(int i=0; i<n; i++) {
        int id, k;
        cin >> id >> k;
        if(k > 0) {
            int c[k];
            for(int j=0; j<k; j++) cin >> c[j];
            N[id].l = c[0];
            for(int j=0; j<k; j++) {
                N[c[j]].p = id;
                if(k - j > 1) N[c[j]].r = c[j + 1];
            }
        }
    }

    for(int i=0; i<n; i++) {
        if(N[i].p == -1) {
            setDepth(N, i, 0);
            break;
        }
    }

    for(int i=0; i<n; i++) {
        cout << "node " << i << ": parent = " << N[i].p << ", depth = " << N[i].d << ", ";
        if(N[i].p == -1) cout <<"root, ";
        else if(N[i].l == -1) cout << "leaf, ";
        else cout << "internal node, ";
        int n = N[i].l;
        cout << "[";
        while(n != -1) {
            cout << n;
            n = N[n].r;
            if(n != -1) cout << ", ";
        }
        cout << "]" << endl;
    }
}


Measured memory_bytes: 7672
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define PI            (acos(-1.0))
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0),cout<<fixed<<setprecision(20);
#define rep(i,n)    for(int i=0;i<n;i++)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define w(t)          int t;cin>>t;while(t--)
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = 2e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
    double a,b,c,d,ans=0;
    cin>>a>>b>>c>>d;
    ans=(60*c)+d;
    ans/=720;
    ans*=2*PI;
    ans=abs(ans-((d/60)*2*PI));
    ans=sqrt((a*a)+(b*b)-(2*a*b*cos(ans)));
    cout<<ans<<nl;
    return 0;
}


Measured memory_bytes: 4208
package main

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

func main() {
	N := readInt()

	if N == 2 {
		// K = 2
		fmt.Println(1)
		return
	}

	r := int(math.Sqrt(float64(N)))
	// K = N - 1, N
	result := 2
	for K := 2; K <= r; K++ {
		t := N
		for t >= K && t%K == 0 {
			t /= K
		}
		if t%K == 1 {
			result++
		}

		k := 0
		if N%K == 0 {
			k = N / K
		} else if (N-1)%K == 0 {
			k = (N - 1) / K
		}
		if k != 0 && k != K {
			t = N
			for t >= k && t%k == 0 {
				t /= k
			}
			if t%k == 1 {
				result++
			}

		}
	}
	fmt.Println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}

func readInts(n int) []int {
	result := make([]int, n)
	for i := 0; i < n; i++ {
		result[i] = readInt()
	}
	return result
}


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

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

	for (int i = 0; i < s.length(); i++)
	{
		if (i % 2 == 0)
		{
			if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D')
				;
			else
			{
				cout << "No" << endl;
				return 0;
			}
		}
		else
		{
			if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D')
				;
			else
			{
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <cmath>

#include <limits.h>

using namespace std;

typedef long long ll;

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;
}

int main(void) {
    int N;
    double T, A;
    cin >> N >> T >> A;

    vector<double> hs(N, 0.0);
    for (int i = 0; i < N; i++) {
        cin >> hs[i];
    }

    double cand = double(1e9);
    int idx = -1;
    for (int i = 0; i < N; i++) {
        double v = (T - hs[i] * 0.006) - A;
        v = abs(v);
        if (v < cand) {
            idx = i;
            cand = v;
        }
    }
    cout << idx + 1 << endl;

    return 0;
}


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

int main()
{
    long long int l,r;
    cin >> l >> r;
    r = min(r, l+4038);
    int ans = 2018;
    for (long long int i = l; i <= r; i++) {
        for (long long int j = i+1; j <= r; j++) {
            int x = i * j % 2019;
            ans = min(ans, x);
        }
    }

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

Measured memory_bytes: 3572
// OBïÄh2011 Day4 B : ¨ÙqÌ

#include <iostream>
#include <string>

using namespace std;

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

int main(){
	string board[8];
	while(cin >> board[0]){
		for(int i=1;i<8;i++) cin >> board[i];
		// I¹»èÌÀªÊ|ÈÌÅ300^[­ç¢ñµÄ¨­
		for(int c=0;c<300;c++){
			// ©ªÌèî
			char m = c%2 ? 'x' : 'o';
			// èÌèî
			char o = c%2 ? 'o' : 'x';
			int cx = 0, cy = 0, cnt = 0, dir = 0;
			for(int ix=0;ix<8;ix++){
				for(int iy=0;iy<8;iy++){
					// Ì^[Èç¸ðt]
					int x = c%2 ? 7-ix : ix;
					int y = c%2 ? 7-iy : iy;
					if(board[x][y]!='.') continue;
					int cur = 0, rev = 0;
					for(int d=0;d<8;d++){
						int nx = x+dx[d], ny = y+dy[d];
						int tmp = 0;
						while(0<=nx&&nx<8&&0<=ny&&ny<8&&board[nx][ny]==o){
							tmp++;
							nx += dx[d];
							ny += dy[d];
						}
						if(0<=nx&&nx<8&&0<=ny&&ny<8&&board[nx][ny]==m){
							cur += tmp;
							rev |= (1<<d);
						}
					}
					if(cnt < cur) cx = x, cy = y, cnt = cur, dir = rev;
				}
			}
			// u«·¦çêéNbL[ªÈ¯êÎpX
			if(cnt == 0) continue;
			// NbL[ðu«·¦é
			board[cx][cy] = m;
			for(int i=0;i<8;i++){
				if(!(dir&(1<<i))) continue;
				int nx = cx+dx[i], ny = cy+dy[i];
				while(board[nx][ny]==o){
					board[nx][ny] = m;
					nx += dx[i];
					ny += dy[i];
				}
			}
		}
		for(int i=0;i<8;i++) cout << board[i] << endl;
	}
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

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

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  int n;
  cin >> n;

  vector<int> a(n+1);
  reps(i, 1, n) {
    cin >> a[i];
  }

  if (n == 1) {
    cout << a[1] << "\n";
    return 0;
  }

  vector<int> first;
  vector<int> second;

  if (n % 2 != 0) {
    reps(i, 1, n) {
      if (i % 2 != 0) first.push_back(a[i]);
      else second.push_back(a[i]);
    }
  }

  else {
    reps(i, 1, n) {
      if (i % 2 == 0) first.push_back(a[i]);
      else second.push_back(a[i]);
    }
  }

  reverse(all(first));

  for (int i = 0; i < first.size(); ++i) {
    cout << first[i] << ' ';
  }

  for (int i = 0; i < second.size(); ++i) {
    cout << second[i] << " \n"[i==second.size()-1];
  }

  return 0;
}

Measured memory_bytes: 3956
class Store(val a : Long, val b : Long)

fun main(args: Array<String>){
    var(n, m) = readLine()!!.split(" ").map(String::toLong)
    val l = mutableListOf<Pair<Long, Long>>()
    for(i in 1..n){
        val (a, b) = readLine()!!.split(" ").map(String::toLong)
        l.add(Pair(a, b))
    }
    l.sortBy { it.first }
    var sum = 0L
    l.forEach{
        sum += it.first * listOf(it.second, m).min()!!
        m = listOf(0, m - it.second).max()!!
    }
    println(sum)
}

Measured memory_bytes: 84428
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
// const ll INF = 1000000000000000000LL;

int main() {
	string s;
	cin >> s;
	int cnt=0;
	rep(i,s.size()){
		if(s[i]=='x') cnt++;
	}
	if(cnt<=7)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;\
	return 0;
}



Measured memory_bytes: 256
#include "algorithm"
#include "functional"
#include "iostream"
#include "numeric"
#include "queue"
#include "set"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

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

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

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

  ll X, Y;
  cin >> X >> Y;

  ll sums[] = {300000, 200000, 100000};

  ll res = 0;
  if (X <= 3) res += sums[X - 1];
  if (Y <= 3) res += sums[Y - 1];
  if (X == 1 && Y == 1) res += 400000;

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int f;
  cin >> f;
  int s = f % 100;
  f /= 100;
  bool fbl = (1 <= f && 12 >= f), sbl = (1 <= s && 12 >= s);
  if(fbl && sbl) cout << "AMBIGUOUS";
  else if(fbl) cout << "MMYY";
  else if(sbl) cout << "YYMM";
  else cout << "NA";
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;




public class Main{
	static class MyScanner {
	    BufferedReader br;
	    StringTokenizer st;

	    public MyScanner() {
	       br = new BufferedReader(new InputStreamReader(System.in));
	    }

	    String next() {
	        while (st == null || !st.hasMoreElements()) {
	            try {
	                st = new StringTokenizer(br.readLine());
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	        }
	        return st.nextToken();
	    } 

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

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

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

	    String nextLine(){
	        String str = "";
		  try {
		     str = br.readLine();
		  } catch (IOException e) {
		     e.printStackTrace();
		  }
		  return str;
	    }
	}
		
	
		 public static void main(String[] args) throws IOException {
			 	PrintWriter out = new PrintWriter(System.out);
			    MyScanner sc = new MyScanner();
			 	Main solver = new Main();
				solver.solve(out, sc);
				out.flush();
				out.close();
			
		 }
	
		
		 
		 
		
 		void solve(PrintWriter out, MyScanner sc) throws IOException{	
 			
 			int n = sc.nextInt();
 			List<Integer> p = new ArrayList<>();
 			
 			for(int i = 2; n > 0 ; ++i) {
 				if(isPrime(i) && i % 5 == 1) {
 					p.add(i);
 					--n;
 				}
 			}
 			for(int k : p) out.print(k + " ");
 			
 			
 				
 			
 			
 			
 		
 		}
 		
 		boolean isPrime(int n) {
 			for(int i = 2 ; i * i <= n ; ++i) {
 				if(n % i == 0) return false;
 			}
 			return true;
 		}
 		
 		

 	
		
	
			
		
		
		
		
		
		
		
		
	
	
}



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

int main() {
	int A, B, K,cnt=0,ans=0;
	cin >> A >> B >> K;
	for (int i = min(A, B); i>=1; i--) {
		if (A % i == 0 && B % i == 0)cnt++;
		if (cnt == K) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{	int data[30],i,w,n,a,b,c;
	cin >> w >> n;
	for(i=0;i<w;i++){
		data[i]=i+1;
	}

	for(i=0;i<n;i++){
		scanf("%d,%d",&a,&b);
		c=data[a-1];
		data[a-1]=data[b-1];
		data[b-1]=c;
	}
	for(i=0;i<w;i++){
		printf("%d\n",data[i]);
	}
	return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
int a[500100];
int b[500100];
int main(){
	int n,ans=0;
	cin>>n;
	n/=2;
	for (int i=1;i<=n;++i) cin>>a[i]>>b[i];
	sort(a+1,a+1+n);
	sort(b+1,b+1+n);
	a[0]=b[0]=a[n+1]=b[n+1]=-1;
	int num=0,t1=0,t2=0,k1=-1;
	for (int i=1;i<=n+1;++i){
		if (a[i]!=a[i-1]){
			if (i!=1){
				if (t1<num) t2=t1,t1=num,k1=a[i-1];
				else if (t2<num) t2=num;
			}
			num=1;
		}else ++num;
	}
	num=0;
	int t3=0,t4=0,k3=-1;
	for (int i=1;i<=n+1;++i){
		if (b[i]!=b[i-1]){
			if (i!=1){
				if (t3<num) t4=t3,t3=num,k3=b[i-1];
				else if (t4<num) t4=num;
			}
			num=1;
		}else ++num;
	}
	if (k3!=k1) ans=n*2-t1-t3;
	else ans=min(n*2-t1-t4,n*2-t2-t3);
	cout<<ans<<'\n';
	return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);

  int n, m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i, n) { cin >> a[i]; }
  vector<pair<size_t, ll>> b_c(m);
  vector<ll> c(m);
  rep(i, m) {
    cin >> b_c[i].first >> b_c[i].second;
  }
  sort(b_c.begin(), b_c.end(), [](auto& left, auto& right) {
    return left.second > right.second;  
  });
  sort(a.begin(), a.end());
  int add_size = 0;
  for (int i = 0; i < m && b_c[i].second > a[0]; ++i) {
    int plus = min(b_c[i].first, 2*n - a.size());
    rep(j, plus) { a.push_back(b_c[i].second); }
  }
  sort(a.begin(), a.end(), greater<ll>());
  cout << accumulate(a.begin(), a.begin() + n, (ll)0) << endl; 
  return 0;
}


Measured memory_bytes: 4224
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <stdlib.h>
#include <functional>
#define ll long long
#define llu unsigned long long
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
using namespace std;
const int N = 1e4 + 10;
int n, m;

int main() {
	
	string s1, s2;

	cin >> n;
	cout << "0\n";
	fflush(stdout);
	cin >> s1;
	if (s1 == "Vacant") return 0;
	int start = 0;
	int end = n - 1;
	while (start < end) {
		int mid = (start + end) / 2;
		cout << mid << '\n';
		fflush(stdout);
		cin >> s2;
		if (s2 == "Vacant") return 0;

		if (mid & 1) {
			// even number of elements at front
			if (s1 == s2) {
				end = mid - 1;
			}
			else {
				start = mid + 1;
			}
		}
		else {
			if (s1 == s2) {
				start = mid + 1;
			}
			else {
				end = mid - 1;
			}
		}
	}

	cout << start << '\n';
	fflush(stdout);
	cin >> s2;
	return 0;
}


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

std::vector<int> f(int n)
{
    std::vector<int> r;
    r.push_back(n);
    if (n == 1)
        return r;
    for (int i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            r.push_back(i);
            if (i != 1 && i * i != n)
            {
                r.push_back(n / i);
            }
        }
    }
    return r;
}

int main()
{
    int a, b, k, ct = 0;
    cin >> a >> b >> k;
    vector<int> da = f(a), db = f(b);
    sort(da.begin(), da.end(), greater<int>());
    sort(db.begin(), db.end(), greater<int>());
    for (auto x : da)
    {
        ct += count(db.begin(), db.end(), x);
        if (ct == k)
        {
            cout << x << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
# coding: utf-8


def is_unique(seq):
    return len(seq) == len(set(seq))


def func_f(n):
    if n % 2 == 0:
        return n / 2
    else:
        return 3 * n + 1


def main():
    s = int(input())
    li = [s]

    while (len(li) <= 1000000):
        li.append(func_f(s))
        s = li[-1]
        if not is_unique(li):
            print(len(li))
            break


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
def my_dot(lhs, rhs):
    return [sum(a[i][j] * b[j][0] for j in range(len(rhs))) for i in range(len(lhs))]


if __name__ == '__main__':
    from sys import stdin

    n, m = (int(n) for n in stdin.readline().rstrip().split())

    a = []
    for cnt in range(n):
        a.append([int(n) for n in stdin.readline().rstrip().split()])

    b = []
    for cnt in range(m):
        b.append([int(n) for n in stdin.readline().rstrip().split()])

    c = my_dot(a, b)

    for cn in c:
        print(int(cn))



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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int N;
	cin >> N;
	vector <int> b(N, 0);
	for (int ii = 0; ii < N; ++ii){
		cin >> b[ii];
		b[ii]--;
	}

	vector <int> ans(N, 0);
	int cnt = 0;
	while(b.size() > 0) {
		bool OK = false;
		for (int ii = b.size() - 1; ii >= 0; --ii){
			if (b[ii] == ii){
				OK = true;
				ans[N - cnt - 1] = ii+1;
				b.erase(b.begin() + ii);
				break;
			}
		}
		if (!OK){
			cout << -1 << endl;
			return 0;
		}
		cnt++;
	}

	for (int ii = 0; ii < N; ++ii){
		cout << ans[ii] << " ";	
	}
	cout << "\n";	

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

ll N,X;
ll L[51],P[51];

ll dfs(ll n,ll x){
    if(n==0) return P[0];
    if(x==1) return 0;
    if(x<=1+L[n-1]) return dfs(n-1,x-1);
    if(x==1+L[n-1]+1) return P[n-1]+1;
    if(x<=1+L[n-1]+1+L[n-1]) return P[n-1]+1+dfs(n-1,x-(1+L[n-1]+1));
    if(x==1+L[n-1]+1+L[n-1]+1) return P[n];
}

int main(){
    L[0]=1,P[0]=1;
    cin>>N>>X;

    repn(i,N){
        L[i]=2*L[i-1]+3;
        P[i]=2*P[i-1]+1;
    }

    ll ans=dfs(N,X);
    cout<<ans<<endl;
}

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

int main()
{
   int n;
   cin >> n;
   if(n % 2 == 0){
       cout << n <<endl;
   }else if(n % 2 != 0){
       cout << 2*n  << endl;
   }
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;
using ll = long long;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((int)(x).size())
#define MSG(a) cout << #a << " " << a << endl;

int main()
{
    int n;
    int x[10], y[10];
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> x[i] >> y[i];
    }

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

    double sum = 0.0;
    do {
        for (int i = 0; i < n-1; i++) {
            int now = v[i];
            int next = v[i+1];
            double dx = x[now] - x[next];
            double dy = y[now] - y[next];
            sum += sqrt(dx * dx + dy * dy);
        }
    } while (next_permutation(ALL(v)));
    int factorial = 1;
    for (int i = 2; i <= n; i++) factorial *= i;
    cout << fixed << setprecision(10) << sum / factorial << endl;

    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

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

int main() {
    ios::sync_with_stdio(false);
    int k, n;
    cin >> k >> n;
    int first, a, prev;
    int dist = 0;

    cin >> a;
    first = a;
    prev = a;
    for (int i = 1; i < n; i++) {
        cin >> a;
        dist = max<int>(dist, a - prev);
        prev = a;
    }
    dist = max<int>(dist, k - a + first);

    cout << k - dist << endl;

    return 0;
}


Measured memory_bytes: 256
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <complex>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;

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

  static int A[200002];
  int hi = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    hi = max(hi, A[i]);
  }

  int lo = 1;

  while (true) {
    if (lo == hi) {
      break;
    }

    int med = (lo + hi) / 2;
    ll sum = 0;
    for (int i = 0; i < N; i++) {
      sum += (ll)(A[i] - 1) / med;
    }

    if (sum > K) {
      lo = med + 1;
    } else {
      hi = med;
    }
  }
  cout << lo << endl;
}


Measured memory_bytes: 4408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  vector<int> A(s.size());
  vector<char> moji(s.size());

  for(int i=0;i<s.size();i++){
    A.at(i) = s.at(i);
  }
  
  for(int i=0;i<s.size();i++){
    A.at(i) += N;
  }
  
  for(int i=0;i<s.size();i++){
    if(A.at(i)>90) A.at(i) = A.at(i)-26;
  }
  
  for(int i=0;i<s.size();i++){
  moji.at(i) =  A.at(i);
  }

  for(int i=0;i<s.size();i++){
  cout << moji.at(i);
  }
cout << endl;  
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<map>
#include<queue>
using namespace std;
int main() {
	long long n, k;
	pair<long long, long long>a[100010];
	cin >> n >> k;
	for (long long i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
	}
	sort(a, a + n);
	long long sum = 0;
	for (long long i = 0; i < n; i++) {
		sum += a[i].second;
		if (sum >= k) {
			cout << a[i].first << endl;
			break;
		}
	}
	return 0;
}

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

int main(void){
    string s, t, save;
    cin >> s;
    reverse(s.begin(), s.end());
    for(char &c : s){
        save += c;
        if(save=="maerd"||save=="remaerd"||save=="esare"||save=="resare"){
            t += save;
            save = "";
        }
    }
    if(s == t) cout << "YES\n";
    else cout << "NO\n";
    return 0;
}

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

int main() {
	long long x;
	cin >> x;
	if (x % 11 == 0) {
		cout << x / 11 * 2 << endl;
	}
	else {
		if (x % 11 <= 6) {
			cout << x / 11 * 2 + 1 << endl;
		}
		else
		{
			cout << x / 11 * 2 + 2 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int t = 0;

		int count = 0;

		for(int i = 0; i < N ;i++){

			t = sc.nextInt();

			if(A <= t && t <B){
			}else{
				count++;
			}

		}



		System.out.println(count);

		sc.close();
	}
}


Measured memory_bytes: 10188
/*
 * src.cpp
 *
 *  Created on: 2016/08/04
 *      Author: joi
 */

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

int N;

int cnt[10];

int main(){
	do{
		cin>>N;
		if (N){
			fill(cnt,cnt+10,0);
			REP(i,N){
				int a;
				cin>>a;
				cnt[a]++;
			}
			REP(i,10){
				if (cnt[i]==0){
					cout<<'-'<<endl;
				}else{
					REP(j,cnt[i]){
						cout<<'*';
					}
					cout<<endl;
				}
			}
		}
	}while (N);
	return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        int ans = 0;
        long tmp = 100;
        do {
            tmp = (long)Math.floor(tmp * 1.01);
            ans++;
        } while(tmp < x);
        System.out.println(ans);
    }
}


Measured memory_bytes: 35832
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    bool key =false;
    for(int i=1;i<10;i++){
        if(n%i == 0&&n/i <10){
            key=true;
        }
    }
    if(key){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){

  int i, j, a, b;

  while(1){
    scanf("%d%d",&a,&b);
    if(a==0 && b==0)break;
    for ( i = 0; i < a; i++ ){
      for ( j = 0; j < b; j++ ){
	if((i+j)%2==1){
	  printf(".");
	} else {
	  printf("#");
	}
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 572
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String[] k = new String[]{"A","B","C","D","E"};
		while(true) {
			int number = 0;
			int max = 0;
			for(int i = 0; i < 5; i++) {
				int tmp = stdIn.nextInt();
				tmp += stdIn.nextInt();
				if(tmp == 0) {
					return;
				}
				
				if(tmp > max) {
					max = tmp;
					number = i;
				}
			}
			
			System.out.println(k[number] + " " + max);
		}
	}
}

Measured memory_bytes: 21116
K = int(input())
X, Y = [int(_) for _ in input().split()]
x, signx = abs(X), -1 if X < 0 else 1
y, signy = abs(Y), -1 if Y < 0 else 1
ans = [(x, y)]


def calcxy(x, y):
    dx = min(K, x)
    dy = K - dx
    x -= dx
    if y > dy:
        y -= dy
    else:
        y += dy
    return x, y


def calczw(x, y):
    #z+w=abs(z-x)+abs(w-y)=K
    if x > y:
        #z+w=x-z+w-y=K and z<=x and w>=y
        z = (x - y) // 2
        w = K - z
    else:
        #z+w=z-x+y-w=K and z>=x and w<=y
        w = (y - x) // 2
        z = K - w
    return (z, w)


if x + y != K:
    while (x + y) > 2 * K:
        x, y = calcxy(x, y)
        ans += [(x, y)]
    z, w = calczw(x, y)
    if abs(z - x) + abs(w - y) != K:
        x, y = calcxy(x, y)
        ans += [(x, y)]
        z, w = calczw(x, y)
    if abs(z - x) + abs(w - y) != K:
        print(-1)
        exit()
    ans += [(z, w)]
print(len(ans))
for x, y in ans[::-1]:
    print(x * signx, y * signy)


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

int main() {
  int a, b, h, m;
  cin >> a >> b >> h >> m;

  double h_angle = 2 * M_PI * (h + m / 60.0) / 12.0;
  double m_angle = 2 * M_PI * m / 60;

  // complex<double> p1 = (double)a * (cos(h_angle) + 1i * sin(h_angle));
  // complex<double> p2 = (double)b * (cos(m_angle) + 1i * sin(m_angle));
  // double ret = min(sqrt(norm(p1 - p2)), sqrt(norm(p2 - p1)));

  double x1 = a * cos(h_angle);
  double y1 = a * sin(h_angle);
  double x2 = b * cos(m_angle);
  double y2 = b * sin(m_angle);

  double x = x2 - x1;
  double y = y2 - y1;

  double ret = sqrt(x * x + y * y);

  // cout << ret << endl;
  printf("%20.20lf\n", ret);
  return 0;
}


Measured memory_bytes: 4120
#include "bits/stdc++.h"

using namespace std;


int main() {
	int N;
	cin >>N; 
	for (int n = 0;n < 3; ++n) {
		if (7 == N%10) {
			cout << "Yes" << endl;
			return 0;
		}
		N /= 10;
	}
	cout << "No"<<endl;
	return 0;
}

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

using namespace std;

int main()
{

	int N, j;

	cin >> N;

	for (int i = 1; i <= 10; i++)
	{
		if (i * 1000 >= N)
		{
			j = i;
			break;
		}
	}

	cout << j * 1000 - N << endl;
}


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

typedef long long int ll;
typedef pair<ll, ll> P;

const ll mod = 1e9+7;
const ll INF = 2e9;
const double PI = 3.1415926535;

ll fac[2001];
ll inv[2001];
ll facinv[2001];
void C_init(){
    fac[0] = 1;
    for(int i = 1;i < 2001;i++)fac[i] = (fac[i-1] * i)%mod;
    inv[1] = 1;
    for(int i = 2;i < 2001;i++)inv[i] = ((-(mod/i)*inv[mod%i])%mod+mod)%mod;
    facinv[0] = 1;
    for(int i = 1;i < 2001;i++)facinv[i] = (facinv[i-1] * inv[i])%mod;
    return;
}
ll nCr(ll n, ll r){
    return ((fac[n] * facinv[n-r])%mod * facinv[r])%mod;
}
int main(void){
    ll n, k; cin >> n >> k;
    C_init();
    if(n == k){
        printf("1\n");
        for(int i = 2;i <= k;i++)printf("0\n");
        return 0;
    }
    for(int i = 1;i <= k;i++){
        if(i > n - k + 1)printf("0\n");
        else{
            ll a0 = 0;
            if(i > 1)a0 += (nCr(k-1, i-1) * nCr(n-k-1, i-2))%mod;
            if(i <= n - k)a0 += (nCr(k-1, i-1) * nCr(n-k-1, i-1) * 2)%mod;
            if(i < n - k)a0 += (nCr(k-1, i-1) * nCr(n-k-1, i));
            a0 %= mod;
            printf("%lld\n", a0);
        }
    }
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ch = sc.nextLine().toCharArray();
		for(int i=0;i+4<ch.length;i++){
			if(ch[i]=='a'&&ch[i+1]=='p'&&ch[i+2]=='p'&&ch[i+3]=='l'&&ch[i+4]=='e'){
				ch[i] = 'p';
				ch[i+1] = 'e';
				ch[i+2] = 'a';
				ch[i+3] = 'c';
				ch[i+4] = 'h';
			}
			else if(ch[i]=='p'&&ch[i+1]=='e'&&ch[i+2]=='a'&&ch[i+3]=='c'&&ch[i+4]=='h'){
				ch[i] = 'a';
				ch[i+1] = 'p';
				ch[i+2] = 'p';
				ch[i+3] = 'l';
				ch[i+4] = 'e';
			}
		}
		System.out.println(ch);
	}
}

Measured memory_bytes: 0
<?php

$N = trim(fgets(STDIN));
$a = explode(" ",trim(fgets(STDIN)));

$ans = 0;

$n = 0;
while($n < $N){
    if($a[$a[$n] - 1] == $n + 1){
    ++$ans;
    }
    ++$n;
}

echo $ans / 2 . PHP_EOL;
?>

Measured memory_bytes: 21556
S = list(input())
K = int(input())
N = len(S)
dp = [[[0] * 2 for i in range(4)] for i in range(105)]
#print(dp)
dp[0][0][0] = 1
for i in range(N):
    nd = int(S[i])
    for j in range(4):
        for k in range(2):
            for d in range(10):
                ni = i+1
                nj = j
                nk = k
                if d != 0:
                    nj += 1
                if nj > K:
                    continue
                if k == 0:
                    if d > nd:
                        continue
                    if d < nd:
                        nk = 1
                dp[ni][nj][nk] += dp[i][j][k]
#print(dp)
print(dp[N][K][0] + dp[N][K][1])


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

#define pb push_back
#define F first
#define S second
#define y1 dasdasfasfas
#define x1 wqdadfasfasfas
#define All(c) c.begin(), c.end()
#define SZ(A) (int((A).size()))
#define umap unordered_map
#define __ fflush(stdout)
#define FILENAME ""

typedef long long ll;
typedef long double ld;    

using namespace std;

void FREOPEN() {
	#ifdef LOCAL
		freopen(".in", "r", stdin);
		freopen("1.out", "w", stdout);
	#else
		//freopen(FILENAME".in", "r", stdin);
		//freopen(FILENAME".out", "w", stdout);
	#endif
}

inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }             

const int N = 3333, inf = 1e9 * 2;

const ll MOD = 1e9 + 7ll, INF = 1e18;

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

int dp[N][N];

pair<int, int> pr[N][N];

string get_string() {
	string ret = "";
	char c;
	while ((c = getchar()) != EOF && c != '\n') {
		ret += c;
	}
	return ret;
}

int main() {
	FREOPEN();
	string a = get_string();
	string b = get_string();
	a = '$' + a;
	b = '$' + b;
	for (int i = 1; i < SZ(a); i++) {
		for (int j = 1; j < SZ(b); j++) {
			if (dp[i][j - 1] > dp[i - 1][j]) pr[i][j] = {0, -1};
			else pr[i][j] = {-1, 0};
			dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			if (a[i] == b[j] && dp[i][j] < dp[i - 1][j - 1] + 1) {
				dp[i][j] = dp[i - 1][j - 1] + 1;
				pr[i][j] = {-1, -1};
			}
		}
	}
	int i = SZ(a) - 1, j = SZ(b) - 1;
	string ans = "";
	while (i && j) {
		if (pr[i][j] == make_pair(-1, -1)) ans += a[i];
		int ni = i + pr[i][j].F;
		int nj = j + pr[i][j].S;
		i = ni, j = nj;
	} 
	reverse(All(ans));
	for (auto i : ans) putchar(i);
	return 0;
}


Measured memory_bytes: 121088
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int x = Integer.parseInt(sc.next(), 16);
		int y = Integer.parseInt(sc.next(), 16);

		if (x > y) {
			System.out.println(">");
		} else if (y > x) {
			System.out.println("<");
		} else {
			System.out.println("=");
		}

		sc.close();
	}
}

Measured memory_bytes: 21844
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v, string s = "\n") { cout << v << s; }
template <typename T> void in(T &v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

const int MAX = 55555;

int main() {
  int n; in(n);
  int m = 55555;
  vector<int> P(MAX, true);
  P[0] = P[1] = false;
  for (int i=2; i<=m; i++) {
    if (!P[i]) continue;
    for (int j=i*2; j<=m; j += i) {
      P[j] = false;
    }
  }
  
  vector<int> A;
  loop(i,0,55556) if (P[i] and i%10 == 9) A.push_back(i);
  
  loop(i,0,n) {
    if (i!=0) print(" ", "");
    print(A[i], "");
  }
  print("");
  return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
//#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }



int main() {
	/*int mod = 998244353;

	int n, m, k;
	cin >> n >> m >> k;*/

	int n;
	cin >> n;
	vector<string> sv;
	rep(i, n) {
		string s;
		cin >> s;
		/*vector<int> nu(s.size());
		rep(i, nu.size() - 1) {

		}*/
		int index = 0;
		while (1) {
			if (s[index] == '(' && s[index + 1] == ')') {
				s.erase(s.begin() + index);
				s.erase(s.begin() + index);
				index--;
				if (index < 0)index = 0;
			}
			else {
				index++;
				if (s.size() <= index) {
					break;
				}
			}
		}
		sv.push_back(s);
	}

	//vector<vector<int>> z(1000000);
	vector<P> p1, p2, p3, p4;
	rep(i, sv.size()) {
		string s = sv[i];
		int a = 0;
		int b = 0;
		rep(j, s.size()) {
			if (s[j] == ')') {
				a++;
			}
			else {
				b++;
			}
		}
		if (a == 0) {
			p1.push_back(mp(a, b));
		}
		else if (b == 0) {
			p4.push_back(mp(a, b));
		}
		else if (a <= b) {
			p2.push_back(mp(a, b));
		}
		else {
			p3.push_back(mp(a, b));
		}
	}
	SORT(p2);
	SORT(p3); REVERSE(p3);

	int x = 0;
	int as = 0;
	int bx = 0;
	rep(i, p1.size()) {
		x += p1[i].second;
	}
	rep(i, p2.size()) {
		x -= p2[i].first;
		if (x < 0) {
			cout << "No" << endl;
			return 0;
		}
		x += p2[i].second;
	}

	rep(i, p3.size()) {
		x -= p3[i].first;
		if (x < 0) {
			cout << "No" << endl;
			return 0;
		}
		x += p3[i].second;
	}
	rep(i, p4.size()) {
		x -= p4[i].first;
		if (x < 0) {
			cout << "No" << endl;
			return 0;
		}
	}

	if (x == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}




Measured memory_bytes: 47908
#include<bits/stdc++.h>
using namespace std;
int main(){
  bool flag=true;
  int n;cin>>n;
  for(int i=0;i<n;i++){
    int a;cin>>a;
    if(a%2)flag=false;
  }
  if(flag)
    cout<<"second"<<endl;
  else
    cout<<"first"<<endl;
}

Measured memory_bytes: 256
import itertools
N = int(input())
S = input()
#Rc1,Gc1,Bc1
out = S.count('R') * S.count('G') * S.count('B')

RGBs = list(itertools.permutations(['R', 'G', 'B'], 3))

for i in range(1, N):
  for j in range(N-i*2):
    #三つ連続であり、RGBで構成されている
    if (S[j], S[j+i], S[j+i*2]) in RGBs:
      out -= 1
print(out)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
typedef bool boool;
typedef long long ll;
#define vl vector<ll>
#define vb vector<boool>
#define vs vector<string>
#define vp vector<pair<ll, ll>>
#define vvl vector<vector<ll>>
#define vvp vector<vector<pair<ll, ll>>>
#define mod 1000000007
#define all(x) x.begin(), x.end()
#define rep1(i, n) for (long long i=0; i<(long long)(n); i++)
#define rep2(i, s, e) for (long long i=(s); i<(long long)(e); i++)
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

int main(){
  string str;
  cin >> str;
  ll sum = 0;
  rep(i, str.length()){
    sum += str[i]-'0';
  }
  if(sum % 9 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}
    
    
    

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

using namespace std;
 
//#define int long long
using ll = long long;
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define reps(i,n) for(ll i=0;i<=n;i++)

ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
 
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(){
    ios_base::sync_with_stdio(false);
    ll a,b,ans=0;
    cin >> a >> b;

    if(a==b){
        cout << a << endl;
        return 0;
    }

    if(b == a+1){
        ans = a^(a+1);
        cout << ans << endl;
        return 0;
    }

    if(a%2==0){
        if((b-a)%2==1){
            if((((b-a)/2))%2==0){
                cout << 1 << endl;
            }else{
                cout << 0 << endl;
            }
        }else{
            if((((b-a)/2))%2==0){
                cout << b << endl;
                }else{
                    ans = 1^b;
                    cout << ans << endl;
                    }
                    }
                    }else{ //aが奇数のとき
                    if(((b-a)/2)%2==0){
                        ans = 0;
                        }else{
                            ans = 1;
                            }
                            if((b-a)%2==0){
                                ans ^= a;
                                }else{
                                    ans = ans ^ a ^ b;
                                }
                                cout << ans << endl;
                                }
    return 0;
}


Measured memory_bytes: 3608
//
//  second.cpp
//  CoderTest
//
//  Created by yuya on 2019/07/25.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); i++)
#define rep1(i,n) for(int (i) = 1; (i) <= (int)(n); i++)
#define INF 1000000
#define MOD 998244353



int main()
{
    ll a,b,c;
    cin >> a >> b >> c;
    
    if (c-a-b > 0 && (c-a-b)*(c-a-b) - 4 * a * b > 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    

    
    return 0;
}



Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        an: [usize; n - 1],
    }

    let mut counter: Vec<usize> = vec![0; n + 1];
    for a in an.iter() {
        counter[*a] += 1;
    }

    for c in counter.iter().skip(1) {
        println!("{}", c);
    }
}


Measured memory_bytes: 6272
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use smallvec::alloc::collections::VecDeque;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let mut sc = Scanner::new();
    let n = sc.next_usize();
    let m = sc.next_usize();
    let mut vertex = vec![vec![]; n];
    for _ in 0..m {
        let x = sc.next_usize() - 1;
        let y = sc.next_usize() - 1;
        vertex[x].push(y);
        vertex[y].push(x);
    }
    
    let mut is_ok = vec![false; n];
    is_ok[0] = true;
    let mut queue = VecDeque::new();
    queue.push_back((0, 0));
    while let Some((now, acc)) = queue.pop_front() {
        for &v in &vertex[now] {
            is_ok[v] = true;
            if acc == 0 {
                queue.push_back((v, acc + 1));
            }
        }
    }
    
    println!("{}", if is_ok[n - 1] { "POSSIBLE" } else { "IMPOSSIBLE" });
}

pub struct Scanner {
    buf: std::collections::VecDeque<String>,
}

impl Scanner {
    pub fn new() -> Self {
        Self {
            buf: std::collections::VecDeque::new(),
        }
    }
    
    fn scan_line(&mut self) {
        let mut flag = 0;
        while self.buf.is_empty() {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            let mut iter = s.split_whitespace().peekable();
            if iter.peek().is_none() {
                if flag >= 5 {
                    panic!("There is no input!");
                }
                flag += 1;
                continue;
            }
            
            for si in iter {
                self.buf.push_back(si.to_string());
            }
        }
    }
    
    pub fn next<T: std::str::FromStr>(&mut self) -> T {
        self.scan_line();
        self.buf
            .pop_front()
            .unwrap()
            .parse()
            .unwrap_or_else(|_| panic!("Couldn't parse!"))
    }
    
    pub fn next_usize(&mut self) -> usize {
        self.next()
    }
    
    pub fn next_isize(&mut self) -> isize {
        self.next()
    }
    
    pub fn next_chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect()
    }
    
    pub fn next_string(&mut self) -> String {
        self.next()
    }
    
    pub fn next_char(&mut self) -> char {
        self.next()
    }
    
    pub fn next_float(&mut self) -> f64 {
        self.next()
    }
}


Measured memory_bytes: 16380
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;

struct Node {
  int key;
  Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k) {
  Node *y=NIL;
  Node *x=root;
  Node *z;

  z=(Node*)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while (x != NIL) {
    y = x;
    if( z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  z->parent = y;
  if( y == NIL ){
    root = z;
  } else {
      if( z->key < y->key ){
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void inorder(Node *u){
  if( u == NIL ) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node *u){
  if( u== NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n, i, x;
  string com;

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    cin >> com;
    if( com == "insert"){
      scanf("%d",&x);
      insert(x);
    } else if( com == "print" ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  
  return 0;
}



Measured memory_bytes: 26776
#include <iostream>
#include <vector>

using namespace std;

vector<int> inv(const vector<int>& p){
    vector<int> res(p.size());
    for(int i=0;i<p.size();i++) res[p[i]] = i;
    return res;
}

vector<int> mul(const vector<int>& p, const vector<int>& q){
    vector<int> res(p.size());
    for(int i=0;i<p.size();i++) res[i] = p[q[i]];
    return res;
}

vector<int> pow(const vector<int>& p, int K){
    const int N = p.size();
    if(K == 0){
        vector<int> res(N);
        for(int i=0;i<N;i++) res[i] = i;
        return res;
    }
    auto res = pow(p, K/2);
    res = mul(res, res);
    if(K%2 == 1) res = mul(res, p);
    return res;
}

int main(){
    int N, K; cin >> N >> K;
    vector<int> p(N), q(N);
    for(auto& t : p){ cin >> t; --t; }
    for(auto& t : q){ cin >> t; --t; }
    auto pInv = inv(p);
    auto qInv = inv(q);
    auto r = mul(mul(mul(q, pInv), qInv), p);
    r = pow(r, (K-1)/6);
    auto rInv = inv(r);
    auto cur = mul(mul(r, p), rInv);
    auto next = mul(mul(r, q), rInv);
    int k = (K-1)/6*6+1;
    while(k < K){
        auto tmp = next;
        next = mul(next, inv(cur));
        cur = tmp;
        ++k;
    }
    for(auto& t : cur) cout << t+1 << " ";
    cout << endl;
}

Measured memory_bytes: 5096
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()


if t[: (len(t) - 1)] == s:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 72740
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import math
from functools import lru_cache

#############
# Constants #
#############

MOD = 10**9 +7
INF = float('inf')

#############
# Functions #
#############

kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#############
# Main Code #
#############

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

found = 0
for i in range(1,10000):
  if math.floor(i*0.08)==A and math.floor(i*0.1)==B:
    print(i)
    found = 1
    break
    
if not found:
  print(-1)


Measured memory_bytes: 38640
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,i,b,j;
cin>>a;
for(i=1;i<=5000000;i++)
{
  if((int)(i*1.08)==a)
  {
    cout<<i<<endl;
    return 0;
  }
}
  cout<<":("<<endl;
  return 0;
}


Measured memory_bytes: 3588