akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll x; cin >> x;
	ll n = 0;
	ll ans = 0;
	ll i = 1;
	ans += (x / 55) * 10;
	x %= 55;
	for (i;;i++) {
		if (n >= x) break;
		if (i % 2 == 0)n += 5;
		else n += 6;
		ans++;
	}
	cout << ans << endl;
}


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

int main(){
  int a[13],x,y;
  a[1]=1;
  a[2]=2;
  a[3]=1;
  a[4]=3;
  a[5]=1;
  a[6]=3;
  a[7]=1;
  a[8]=1;
  a[9]=3;
  a[10]=1;
  a[11]=3;
  a[12]=1;
  cin>>x>>y;
  if(a[x]==a[y]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))
from decimal import Decimal
'''
N = ii()
A = li()
ans = 1
for num in A:
    ans *= num
    if ans > 10**18:
        if 0 in A:
            print(0)
        else:
            print(-1)
        exit()

print(ans)
'''

N = ii()
A = li()
ans = 1
inf = Decimal('1000000000000000000')

for num in A:
    if ans <= inf / Decimal(str(num)):
        ans *= num
    else:
        if 0 in A:
            print(0)
        else:
            print(-1)
        exit()

print(ans)

Measured memory_bytes: 23392
#include<bits/stdc++.h>
typedef long long ll;
#define M 1000000007
using namespace std;
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;
    int h[n];
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    int dp[n];
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(int i=2;i<n;i++)
    {
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int, int>;
#include<queue>
static const int N = 100;
static const int INFTY = (1<<21);

int n, M[N][N];
int d[N]; // 距離で訪問状態（color）を管理する

void bfs(int s) {
    queue<int> q; // 標準ライブラリの queue を使用
    q.push(s);
    for (int i = 0; i < n; ++i) d[i] = INFTY;
    d[s] = 0;
    int u; 
    while ( !q.empty()) {
        u = q.front(); q.pop();
        for (int v = 0; v < n; v++) {
            if (M[u][v] == 0) continue;
            if (d[v] != INFTY) continue;
            d[v] = d[u] + 1;
            q.push(v);
        }
    }

    for (int i = 0; i < n; i++) {
        cout << i + 1 << " " << ((d[i] == INFTY) ? (-1) : d[i] ) << endl;
    }
}

int main() {
    int u ,k, v;
    cin >> n;
    
    for (int i = 0; i < n;  i++) {
        for (int j = 0; j < n; j++)  M[i][j] = 0;
    }

    for (int i = 0; i < n; i++) {
        cin >> u >> k;
        u--;
        for (int j = 0; j < k; j++) {
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    bfs(0);

    return 0;
}


Measured memory_bytes: 3104
#include <stdio.h>
#include <stdint.h>

#define MIN(x,y) (((x)<(y))?(x):(y))
#define MAX(x,y) (((x)>(y))?(x):(y))

uint64_t ma_mi_diff(const uint64_t Sa, const uint64_t Sb, const uint64_t Sc) {
    const uint64_t mi = MIN(MIN(Sa, Sb), Sc);
    const uint64_t ma = MAX(MAX(Sa, Sb), Sc);
    return ma-mi;
}

uint64_t check(const uint64_t H, const uint64_t W) {
    uint64_t diff = UINT64_MAX;
    {
        uint64_t a = H/3;
        if (H - 3*a) {
            diff = MIN(diff, W);
        } else {
            diff = MIN(diff, 0);
        }
    }
    {
        uint64_t a = W/3;
        if (W - 3*a) {
            diff = MIN(diff, H);
        } else {
            diff = MIN(diff, 0);
        }
    }
    if (H>=2) {
        uint64_t a,b,c;
        uint64_t Sa, Sb, Sc;
        uint64_t d = UINT64_MAX, pd;
        a=(H+1)/2;
        b=W/2;
        c=W-b;
        do {
            // printf("a=%lu, b=%lu, c=%lu\n", a,b,c);
            Sa=a*W;
            Sb=(H-a)*b;
            Sc=(H-a)*c;
            if (pd != UINT64_MAX) {
                pd=d;
            }
            d=ma_mi_diff(Sa, Sb, Sc);
            diff=MIN(diff,d);
            a--;
        } while (a>0&&pd>d);
    }
    if (W>=2) {
        uint64_t a,b,c;
        uint64_t Sa, Sb, Sc;
        uint64_t d = UINT64_MAX, pd;
        a=(W+1)/2;
        b=H/2;
        c=H-b;
        do {
            Sa=a*H;
            Sb=(W-a)*b;
            Sc=(W-a)*c;
            if (pd != UINT64_MAX) {
                pd=d;
            }
            d=ma_mi_diff(Sa, Sb, Sc);
            diff=MIN(diff,d);
            a--;
        } while (a>0&&pd>d);
    }
    return diff;
}

int main(void) {
    uint64_t H, W;
    scanf("%lu %lu", &H, &W);
    printf("%lu\n", check(H, W));
    return 0;
}



Measured memory_bytes: 128
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int[] B = new int[N-1];
		long sum = 0;
		B[0] = stdIn.nextInt();
		sum += B[0];
		
		for(int i = 1; i < N-1; i++) {
			B[i] = stdIn.nextInt();
			if(B[i-1] >= B[i]) sum += B[i];
			else sum += B[i-1];
		}
		sum += B[N-2];
		
		System.out.println(sum);

	}

}

Measured memory_bytes: 23252
#include <iostream>
#include <sstream>

int main() {

	long long l1 = 2, l2 = 1, l3;
	int n, i;
	std::cin >> n;

	for (i = 0; i < n - 1; i++)
	{
		l3 = l1 + l2;
		l1 = l2;
		l2 = l3;
	}
	if (n > 1 && n < 87) { std::cout << l3 ; }
	if (n == 1) { std::cout << 1 ; }

	return 0;
}


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

typedef long long int llint;

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

  int d[101];
  for(int i = 0; i < n; i++) cin>> d[i];

  sort(d, d + n);

  int cnt = 1;
  for(int i = 0; i < n - 1; i++) if(d[i] != d[i + 1]) cnt++;

  cout<< cnt <<endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>

using namespace std;
typedef long long ll;

int main(){
  int a,b; cin>>a>>b;
  int ans;
  ans = a+b;
  if(ans<a-b){ans=a-b;}
  if(ans<a*b){ans=a*b;}
  cout<<ans<<endl;
}

Measured memory_bytes: 256
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Split(bufio.ScanLines)
	n := readInt()
	readInt()
	likeMap := make(map[int]int, 0)
	for i := 0; i < n; i++ {
		k := readInt()
		for j := 0; j < k; j++ {
			likeMap[readInt()]++
		}
	}
	var count int
	for _, val := range likeMap {
		if val == n {
			count++
		}
	}
	fmt.Println(count)
}

//便利関数群
var sc = bufio.NewScanner(os.Stdin)

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

func readInt() int {
	i, _ := strconv.Atoi(read())
	return i
}

func max(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func min(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

func abs(x, y int) int {
	if x-y > 0 {
		return x - y
	}
	return -(x - y)
}

type XY struct {
	x, y int
}

type Points []XY

func (p Points) Len() int {
	return len(p)
}
func (p Points) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}
func (p Points) Less(i, j int) bool {
	return p[i].x < p[j].x
}
func (p Points) remove(i int) Points {
	if i >= len(p) {
		return p
	}
	return append(p[:i], p[i+1:]...)
}


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

using namespace std;

int main(){
	long long n;
	cin >> n;
	string s;
	while(n){
		--n;
		s.push_back(n%26 + 'a');
		n /= 26;
	}
	reverse(s.begin(),s.end());
	cout << s << "\n";
	return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;



int main(){
    int n,m;cin >> n >> m;
    vector<int> cnt(n);
    rep(i,m){
        int a,b; cin >> a >> b;
        --a;--b;
        cnt[a] = 1-cnt[a];
        cnt[b] = 1-cnt[b];
    }

    rep(i,n) {
        if(cnt[i]%2){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    
}

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

using namespace std;
typedef pair<int, int> ii;

struct node {
	int counter = 0;
	vector<int> neighbors;
	bool visited = false;
};

void dfs(vector<node>& nodes, int subroot){
	auto parent = nodes[subroot];
	for(int neighbor : parent.neighbors){
		auto & n = nodes[neighbor];
		if (!n.visited){
			n.visited = true;
			n.counter += parent.counter;
			dfs(nodes, neighbor);
		}
	}
}

int main()
{
	// input
	int n, q;
	cin >> n >> q;
	vector<node> nodes(n+1);

	// n-1 edges >> adj_list
	for (int i = 0; i < n - 1; ++i) {
		int node1, node2;
		cin >> node1 >> node2;
		nodes[node1].neighbors.push_back(node2);
		nodes[node2].neighbors.push_back(node1);
	}
	
	// q operations
	for (int i = 0; i < q; ++i){
		int node, counter;
		cin >> node >> counter;
		nodes[node].counter += counter;
	}

	// dfs and add every subroot's counter to its children
	nodes[1].visited = true;
	dfs(nodes, 1);

	// output
	for (int i = 1; i < n + 1; ++i){
		cout << nodes[i].counter << " ";
	}
}

Measured memory_bytes: 32128
#include <iostream>
using namespace std;
int main(){
    long long int a[10001];
    int n;
    int count = 0;
    int test;
    cin >> n;
    for(int i=0;i<n;i++) cin >> a[i];
    for(int i=0;i<n;i++){
        test = a[i];
        while(test%2 == 0){
            test = test / 2;
            //cout << test << endl;
            count++;
        }
    }
    cout << count << endl;
    return 0;

}

Measured memory_bytes: 384
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
using namespace std;

int main()
{
    int a,b,t;
    cin >> a >> b >> t;
    cout << t/a*b;
    
    return 0;
}

Measured memory_bytes: 888
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn solve(mut v: Vec<(usize, i64)>) -> i64 {
    v.sort();
    let mut q = std::collections::BinaryHeap::new();
    let mut res = 0;
    for i in (1..=v.len()).rev() {
        while matches!(v.last(), Some(x) if x.0 >= i) {
            q.push(v.pop().unwrap().1);
        }
        if let Some(x) = q.pop() {
            res += x;
        }
    }
    res
}

fn main() {
    input! {
        t: usize,
    }

    for _ in 0..t {
        input! {
            n: usize,
            klr: [(usize, i64, i64); n],
        }
        let mut res = 0;
        let mut left = vec![];
        let mut right = vec![];
        for (k, l, r) in klr {
            res += std::cmp::min(l, r);
            if l >= r {
                left.push((k, l - r));
            } else {
                right.push((n - k, r - l));
            }
        }
        let l = solve(left);
        let r = solve(right);
        res += l + r;

        println!("{}", res);
    }
}

// 2 93 78 15
// 1 71 59 12
// 3 57 96 29


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

// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


int main()
{
    int n;
    cin >> n;
    vi v;
    rep(i, n) {
        int a;
        cin >> a;
        v.push_back(a);
    }

    int c = 0;
    rep(i,n) {
        if (i+1==v[v[i]-1]) c++;

    }

    P(c/2);
    return 0;
}



Measured memory_bytes: 1020
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int N;
    string S;
    cin >> N>>S;
    int ans = 0;
    for(int i = 1;i< N -1;i++){

        char X[100],Y[100];
        for(int j = 0;j < N;j++){
            if(j < i) X[j] = S[j];
            else      Y[j-i] = S[j];
        }
        int sum = 0;
        vector<int> X7(26,0);
        vector<int> Y7(26,0);
        for(int j = 0;j < 26;j++){
            for(int k = 0;k < i;k++){
                if(X[k] == 'a'+j){
                    X7[j] = 1;
                    break;
                }
            }
            for(int k = 0;k < N-i;k++){
                if(Y[k] == 'a'+j){
                Y7[j] = 1;
                break;
                }
            }
        }
        for(int l = 0;l < 26;l++){
            if(X7[l]*Y7[l] == 1) sum++;
        }
        ans = max(sum,ans);
    }
    cout << ans << endl;
}   


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

int main() {
	ll X, Y;
	cin >> X >> Y;

	ll a = X;
	int res = 0;
	while (a <= Y) {
		++res;
		a *= 2;
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	
	static int[][] memory;
	
    public static void main(String[] args) {


        Scanner sc = new Scanner(System.in);
        
        int H = sc.nextInt();
        int W = sc.nextInt();
        int D = sc.nextInt();
   
        int[][] number =new int[H*W+1][2];
        int[] distance =new int[H*W+1];
        
        
        for(int i = 0;i<H;i++){
        	
        	for(int j=0;j<W;j++){
        		
        		int current_number = sc.nextInt();
        		number[current_number][0]= i;
        		number[current_number][1]= j;
        		
        	}
        	
        	
        }
        
        for(int i=D;i<H*W+1;i++){
        	distance[i] = distance[i-D]+Math.abs(number[i][0]-number[i-D][0])+Math.abs(number[i][1]-number[i-D][1]);
        }
        
        int Q = sc.nextInt();
        int[] ans = new int[Q];
        
        for(int i=0;i<Q;i++){
        	
        	int L = sc.nextInt();
        	int R = sc.nextInt();
        	
        	ans[i]=distance[R]-distance[L];

        	
        	
        }
        
        for(int i=0;i<Q;i++)System.out.println(ans[i]);
        		
	}

		

    
}

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

using namespace std;

char shift(char x, int n) {
	x += n;
	if (x > 'Z') x -= 26;
	return x;
}

int main() {
	int n;
	string s;
	cin >> n >> s;
	for (char &x : s)
		x = shift(x, n);
	cout << s << endl;
}

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

main(){
  int i,j,n,b1,b2,b3,run,score,out;
  string str;
  cin >> n;

  for(i=0;i<n;i++){
    b1 = b2 = b3 = score = out = run = 0;

    while(out < 3){
      cin >> str;
      if(str == "OUT") out++;
      else if(str == "HIT"){
	if(b1 == 0){
	  b1 = 1;
	  run++;
	}
	else if(b2 == 0){
	  b2 = 1;
	  run++;
	}
	else if(b3 == 0){
	  b3 = 1;
	  run++;
	}
	else score++;
      }
      else if(str == "HOMERUN"){
	score += run + 1;
	b1 = b2 = b3 = run = 0;
      }
    }

    cout << score << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MOD 1000000007
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}

signed main(){
    FASTER;
    int n;cin>>n;
    vi v(n),dp(n);cin>>v;
    dp[0]=0;
    dp[1]=abs(v[1]-v[0]);
    for(int i=2;i<n;i++)
        dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
    cout<<dp[n-1];
}


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

int nlist[100010];
bool isRed[100010];

int main(){
  int N,M;
  cin>>N>>M;
  isRed[0] = true;
  for(int i=0;i<N;i++) nlist[i] = 1;
  for(int i=0;i<M;i++){
    int x,y;
    cin>>x>>y;
    x--;y--;
    nlist[x]--;
    nlist[y]++;
    if(isRed[x]){
      isRed[y] = true;
      if(nlist[x] == 0) isRed[x] = false;
    }
  }
  int sum = 0;
  for(int i=0;i<N;i++) sum += isRed[i];
  cout<<sum<<endl;
  return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 1000000007

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;

int main(){
  char C;
  cin >> C;
  printf("%c\n", C + 1);
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import Counter

n, m = map(int, input().split())
ab_list = sorted([list(input().split()) for i in range(m)])
ans_list = []

for i in range(len(ab_list)):
    ans_list.append(ab_list[i][0])
    ans_list.append(ab_list[i][1])

ans_cnt = Counter(ans_list)

for i in range(1, n+1):
    try:
        print(ans_cnt[str(i)])
    except IndexError:
        print(0)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define irp(i,s,e) for(int i=(s);i>(e);--i)
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)
using DBL = double;
using VD = vector<DBL>;
using VVD = vector<VD>;

int N;
DBL ans = 0.0;

vi visited(8, false);
void dfs(int p, int depth, vvi &XY, DBL dist){
	// rpz(i,depth)printf(">");//
	// ote(p);//
	// printf("p %d depth %d dist %6.2f\n",p,depth,dist);//
	if(depth>=N-1){
		ans += dist;
		return;
	}
	rp(c,0,N){
		if(c==p) continue;
		if(visited[c]) continue;
		int dx = XY[p][0]-XY[c][0];
		int dy = XY[p][1]-XY[c][1];
		DBL d = sqrt(dx*dx + dy*dy);
		// printf("(%d -> %d) d %6.2f\n",p,c,d);//

		visited[c] = true;
		dfs(c, depth+1, XY, dist+d);
		visited[c] = false;
	}
}

int main(){
	cin>>N;
	vvi XY(N, vi(2));//[i]<x,y>
	rpz(i,N) cin>>XY[i][0]>>XY[i][1];

	// for(auto v:XY)cout<<v[0]<<" "<<v[1]<<"\n";puts("--");//


	int n = 1; irp(i,N,0) n *= i;
	// printf("N %d n %d\n",N,n);

	rpz(r, N){
		visited[r] = true;
		dfs(r, 0, XY, 0.0);
		visited[r] = false;
	}

	// puts("--");///
	// ote(ans);//

	printf("%.10f\n",ans/n);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5+5;
const ll MOD = 998244353;

ll k[maxn],a[maxn];

inline ll qpow(ll a,ll b){
	ll res = 1;
	while(b){
		if(b & 1) res = (res*a) % MOD;
		a = (a*a) % MOD;
		b >>= 1;
	}
	return res % MOD;
}

int main()
{
	ll x,n,maxs = -2e18;
	scanf("%lld",&n);
	for(int i = 1;i <= n;++i){
		scanf("%lld",&a[i]);
		k[a[i]]++;
		maxs = max(maxs,a[i]);
	}
	
	ll ans = 1;
	for(int i = 0;i < maxs;++i){
		if(!k[i]){
			ans = 0;
			break;
		}
		ll t = qpow(k[i],k[i+1]) % MOD;
		ans = (ans*t) % MOD;
	}
	
	if(k[0] != 1 || a[1] != 0) ans = 0;
	printf("%lld\n",(ans+MOD)%MOD);
	return 0;
}

Measured memory_bytes: 1792
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Palace
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const double DINF = 1e60;

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int n;
  double t, a;
  scanf("%d%lf%lf", &n, &t, &a);

  double mind = DINF;
  int mini = -1;
  for (int i = 0; i < n; i++) {
    int hi;
    scanf("%d", &hi);
    double ti = t - 0.006 * hi;
    double d = abs(ti - a);
    if (mind > d) mind = d, mini = i;
  }

  printf("%d\n", mini + 1);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repin(a, n)  \
    vector<ll> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repins(a, n)     \
    vector<string> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repind(a, n)     \
    vector<double> a(n); \
    rep(i, n) { cin >> a[i]; }
#define in(a) \
    ll a;     \
    cin >> a;
#define ins(a) \
    string a;  \
    cin >> a;
#define ind(a) \
    double a;  \
    cin >> a;
template <class T>
inline void out(T a) {
    cout << a << endl;
}
inline void out(double a) { printf("%.10f\n", a); }
#define all(x)        (x).begin(), (x).end()
#define rep2(i, a, b) for (ll i = (a); i < (b); ++i)
#define yes           out("Yes");
#define no            out("No");

int main() {
    in(n);
    repin(a, n);
    ll ans = a[0];

    rep2(i, 1, n) {
        ans ^= a[i];
    }

    rep(i, n) {
        out(ans ^ a[i]);
    }
}

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

void func() {
  string S;
  cin >>S;
  int N =S.size();
  vector<char>bun(N);
  for (int i = 0; i < N; i++) {
    bun.at(i) = S.at(i);
}
  for (int i = 0; i < N; i++) {
  if(bun.at(i)==bun.at(N-1-i)){continue;}
    else {cout<<"No"<<endl;
      return;}
  }
     for (int i = 0; i < (N-1)/2; i++) {
    if(bun.at(i)==bun.at((N-3)/2-i)){continue;}
       else{cout<<"No"<<endl;
      return;}
       if(bun.at((N+3)/2+i)==bun.at(N-1-i)){
         continue;}
          else{cout<<"No"<<endl;
      return;}
          }
          cout<<"Yes"<<endl;
          }
int main() {
  func();
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

template<typename T>
vector<T> gen_v(size_t a) { return vector<T>(a); }
template<typename T, typename ...Ts>
auto gen_v(size_t a, Ts... ts) { return vector<decltype(gen_v<T>(ts...))>(a, gen_v<T>(ts...)); }
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, k; cin >> a >> b >> k;
	int t = min(a, k);
	a -= t;
	k -= t;
	int t2 = min(b, k);
	b -= t2;
	cout << a << " " << b << endl;
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli n,k,ans=0;
    cin>>n>>k;
    if(k==0) ans=n*n;
    else{
    for(lli i=k+1;i<=n;i++){
        lli num=n/i;
        ans+=num*(i-k);
        num=n%i;
        (num>k-1?ans+=num-k+1:ans+=0);
    }
    }
    out(ans);
}

Measured memory_bytes: 256
H, W = map(int, input().split())
S = [input() for _ in range(H)]

ans = []
for y in range(H):
    tmp=[]
    for x in range(W):
        if S[y][x]=='.':
            cnt=0
            if y-1>=0:
                if S[y-1][x]=='#':cnt+=1
            if y-1>=0 and x+1<W:
                if S[y-1][x+1]=='#':cnt+=1
            if x+1<W:
                if S[y][x+1]=='#':cnt+=1
            if y+1<H and x+1<W:
                if S[y+1][x+1]=='#':cnt+=1
            if y+1<H:
                if S[y+1][x]=='#':cnt+=1
            if y+1<H and x-1>=0:
                if S[y+1][x-1]=='#':cnt+=1
            if x-1>=0:
                if S[y][x-1]=='#':cnt+=1
            if y-1>=0 and x-1>=0:
                if S[y-1][x-1]=='#':cnt+=1
            tmp.append(cnt)
#             print(cnt)
        else:
            tmp.append('#')
#             print('#')
    ans.append(tmp)
for row in ans:
    print(''.join(map(str, row)))

Measured memory_bytes: 3064
a = input()
b = input()
if len(a)<len(b):
    print('LESS')
elif len(a)>len(b):
    print('GREATER')
else:
    for aa, bb in zip(a, b):
        if aa<bb:
            print('LESS')
            break
        elif aa>bb:
            print('GREATER')
            break
    else:
        print('EQUAL')

Measured memory_bytes: 3060
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

const int INF=5e8;
int n,K;
vector<int> g[2005];

int dp[2005][2005],sz[2005];

int tmp[2005];
void merg(int* a,int* b,int n,int m){
  REP(i,2005) tmp[i]=INF;
  REP(i,n+1) REPN(j,m+1,1) if(i+j<=K){
    chmin(tmp[max(i,j+1)],a[i]+b[j]);
  }
  REP(i,n+1) if(i<=K) chmin(tmp[i],a[i]+m);
  REP(i,2005) a[i]=tmp[i];
}
void rec(int v,int p){
  dp[v][0]=1;
  dp[v][1]=0;
  sz[v]=1;
  for(auto to:g[v]){
    if(to==p) continue;
    rec(to,v);
    merg(dp[v],dp[to],sz[v],sz[to]);
    sz[v]+=sz[to];
  }
}
int main(){
  cin>>n>>K;++K;
  REP(i,n-1){
    int a,b;cin>>a>>b;--a;--b;
    g[a].pb(b);
    g[b].pb(a);
  }
  rec(0,-1);
  int res=INF;

  REP(i,n) REP(j,n+1) chmin(res,dp[i][j]+n-sz[i]);
  cout<<res<<endl;
  return 0;
}




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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int Alice = 0, Bob = 0;
  for(int i = 0; i < n; i++){
    if(i % 2 == 0){
      Alice += a[i];
    }
    else{
      Bob += a[i];
    }
  }
  cout << abs(Alice - Bob) << endl;
  return 0;
}

Measured memory_bytes: 3568
#include<iostream>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
using namespace std;
typedef long long llong;

llong N, A[200050];


int main()
{
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
		A[i] -= (i + 1);
	}
	sort(A, A + N);

	llong tmp = 0;
	llong ans;
	for (int i = 0; i < N; i++)
	{
		tmp += A[i] - A[0];
	}
	ans = tmp;

	for (int i = 1; i < N; i++)
	{
		tmp -= (A[i] - A[i - 1]) * (N - 1 - i);
		tmp += (A[i] - A[i - 1]) * (i - 1);

		if (tmp < ans)
			ans = tmp;
	}

	cout << ans;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <utility>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	for (int n; (n = in());) {
		int i = 0, d = 0;
		while (n--) {
			int ti = in(), td = in() + in();
			if (td > d)
				i = ti, d = td;
		}
		outl(i, ' ', d);
	}
}


Measured memory_bytes: 2408
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    cout << ((a+b)%2?(a+b)/2+1:(a+b)/2) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n, m, k;
	scanf("%d %d %d", &n, &m, &k);
	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= m; j++){
			int black = j * (n - i) + i * (m - j);
			if(black == k){
				printf("Yes\n");
				return 0;
			}
		}
	}
	printf("No\n");
	return 0;
}


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

struct Edge {
	int to;
	int c;
};

void solve(long long table[], vector<Edge> tree[], int node, long long cost) {
	table[node] = cost;
	for (int i = 0; i < tree[node].size(); i++) {
		if (table[tree[node][i].to] != -1)continue;
		solve(table,tree, tree[node][i].to, cost + tree[node][i].c);
	}
}

const int MAX = 100001;

int main() {
	int N, Q, K;
	vector<Edge> tree[MAX];
	long long table[MAX];

	cin >> N;
	for (int i = 0; i < N + 1; i++)table[i] = -1;
	for (int i = 0; i < N - 1; i++) {
		int a, b, c;
		Edge e1, e2;

		cin >> a >> b >> c;

		e1.c = e2.c = c;
		e1.to = b;
		e2.to = a;

		tree[a].push_back(e1);
		tree[b].push_back(e2);
	}

	cin >> Q >> K;
	solve(table, tree, K, 0);
	for (int i = 0; i < Q; i++) {
		int x, y;
		cin >> x >> y;
		cout << table[x] + table[y] << endl;	
	}

	return 0;
}

Measured memory_bytes: 12800
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0011
{
	class Program
	{
		static void Main(string[] args)
		{
			var		w	= int.Parse( Console.ReadLine() );
			int[]	v	= new int[ w + 1 ];
			for( int i = 1; i <= w; i++ ) {
				v[ i ]	= i;
			}

			var	n	= int.Parse( Console.ReadLine() );
			for( int i = 0; i < n; i++ ) {
				var	a	= Array.ConvertAll( Console.ReadLine().Split( ',' ), b => int.Parse( b ) );
				var	tmp		= v[ a[ 0 ] ];
				v[ a[ 0 ] ]	= v[ a[ 1 ] ];
				v[ a[ 1 ] ]	= tmp;
			}

			for( int i = 1; i <= w; i++ ) {
				Console.WriteLine( v[ i ] );
			}
		}
	}
}

Measured memory_bytes: 5620
N = int(input())
P = list(map(int,input().split()))
P_min = [2*(10**5)]
for i in range(N-1):
    P_min.append(min(P_min[i],P[i]))
ans = 0
for i in range(N):
    if P_min[i] >= P[i]:
        ans += 1
print(ans)


Measured memory_bytes: 24744
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

const int mod = 1000000007;
const int Maxn = 3005;

int n, m;
string S;
int ones[Maxn];
int mx[Maxn];
int dp[Maxn][Maxn];

int main()
{
	scanf("%d %d", &n, &m);
	cin >> S;
	for (int i = 0; i < n; i++) {
		ones[i] = (i? ones[i - 1]: 0) + (S[i] == '1');
		mx[i] = i;
	}
	while (m--) {
		int l, r; scanf("%d %d", &l, &r); l--; r--;
		for (int i = l; i <= r; i++)
			mx[i] = max(mx[i], r);
	}
	dp[0][0] = 1;
	for (int i = 0; i < n; i++)
		for (int j = 0; j <= i; j++) if (dp[i][j] > 0) {
			int lones = ones[mx[i]] - j;
			int lzeros = mx[i] - i + 1 - lones;
			if (lones > 0) dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % mod;
			if (lzeros > 0) dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % mod;
		}
	printf("%d\n", dp[n][ones[n - 1]]);
	return 0;
}

Measured memory_bytes: 12544
n,a=map(int,input().split())
l=list(map(int,input().split()))
dp=[0]*5300
dp[l[0]-a]=1

for x in l[1:]:
  b=x-a
  if b>=0:
    for i in range(2500,-2501,-1):
      dp[i+b]+=dp[i]
  else:
    for i in range(-2500,2501):
      dp[i+b]+=dp[i]
  dp[b]+=1
print(dp[0])

Measured memory_bytes: 3188
N = int(input())
tmp = list(map(int, input().split(' ')))
cards = {}
for c in tmp:
    if c in cards.keys():
        cards[c] += 1
    else:
        cards[c] = 1
lost = 0
for k, v in cards.items():
    if v > 1 and v % 2 == 0:
        if lost == 0:
            lost += 1
        else:
            lost -= 1

print(len(cards.keys()) - lost)


Measured memory_bytes: 18272
import java.util.*;
public class Main {
	public static void main(String[] args) {
		A();
	}
	
	public static void A() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		int ret  = 0;
		for(int i=0;i<s.length();i++) {
			ret += Character.getNumericValue(s.charAt(i));
		}
		System.out.println(ret);
	}
	
	//0...M   2^M > 最小の要素 の範囲で 2^kで全て割り切れるかで２分探索 O(Nloglogminval)
	// 0...Mまで順に確かめると、O(Nlogminval)
	public static void B() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i=0;i<N;i++) {
			A[i] = sc.nextInt();
  		}
		int maxdo = -1;
		boolean cansep = true;
		while(cansep) {
			maxdo++;
			for(int j=0;j<A.length;j++) {
				int sep = (int) Math.pow(2, maxdo);
				if(A[j]%sep != 0) {
					cansep = false;
					break;  
				}
			}
		}
		System.out.println(maxdo-1);
	}
}

Measured memory_bytes: 23764
#include <cassert>
#include <functional>
#include <utility>
#include <vector>

template <typename T, class Container = std::vector<T>,
	class Compare = std::less<typename Container::value_type>>
	class IntervalHeap {

	public:
		using container_type = Container;
		using value_compare = Compare;
		using value_type = typename container_type::value_type;
		using reference = typename container_type::reference;
		using const_reference = typename container_type::const_reference;
		using size_type = typename container_type::size_type;

	protected:
		container_type c;
		value_compare comp;

	private:
		static constexpr size_type z = ~static_cast<size_type>(1);
		bool normalize(const size_type x, const size_type y) {
			if (!comp(c[y], c[x]))
				return false;
			std::swap(c[x], c[y]);
			return true;
		}
		void build() {
			const size_type s = size() + 1;
			if (s & 1) {
				normalize(s & z, s);
				buildmin(s >> 1);
				buildmax(s >> 1);
				return;
			}
			if (s == 2)
				return;
			if (normalize(s, s >> 1 | 1))
				buildmax(s >> 2);
			buildmin(s >> 1);
		}
		void buildmin(size_type i) {
			while (i > 1 && normalize(i & z, i << 1))
				i >>= 1;
		}
		void buildmax(size_type i) {
			while (i > 1 && normalize(i << 1 | 1, i | 1))
				i >>= 1;
		}

	public:
		explicit IntervalHeap(const value_compare &x = Compare()) : c(2), comp(x) {}
		bool empty() const { return c.size() == 2; }
		size_type size() const { return c.size() - 2; }
		const_reference min() const {
			assert(!empty());
			return c[2];
		}
		const_reference max() const {
			assert(!empty());
			return size() == 1 ? c[2] : c[3];
		}
		void push(const value_type &x) {
			c.push_back(x);
			build();
		}
		void push(value_type &&x) {
			c.push_back(std::move(x));
			build();
		}
		template <class... Args> void emplace(Args &&... args) {
			c.emplace_back(std::forward<Args>(args)...);
			build();
		}
		void pop_min() {
			assert(!empty());
			const size_type s = size() + 1;
			std::swap(c[2], c[s]);
			c.pop_back();
			size_type i = 4;
			while (i < s) {
				if ((i | 2) < s && !comp(c[i], c[i | 2]))
					i |= 2;
				if (!normalize(i >> 1 & z, i))
					break;
				if ((i | 1) < s)
					normalize(i, i | 1);
				i <<= 1;
			}
		}
		void pop_max() {
			assert(!empty());
			const size_type s = size() + 1;
			if (s == 2)
				return pop_min();
			std::swap(c[3], c[s]);
			c.pop_back();
			size_type i = 5;
			while (i < s) {
				if ((i | 2) < s && !comp(c[i | 2], c[i]))
					i |= 2;
				if (!normalize(i, i >> 1 | 1))
					break;
				normalize(i & z, i);
				i = (i & z) << 1 | 1;
			}
		}
};


#include<iostream>
#include<string>
#include<vector>

int main() {
	IntervalHeap<int,std::vector<int>,std::greater<int>> Q;
	std::string s;
	int k;
	std::cin >> s;
	while (s[2] != 'd') {
		if (s[0] == 'i') {
			std::cin >> k;
			Q.emplace(k);
		}
		else {
			std::cout << Q.min() << std::endl;
			Q.pop_min();
		}
		std::cin >> s;
	}
	return 0;
}


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

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

    bool flag = false;
    int n = s.size();
    if (s == t) {
        flag = true;
    }
    for (int i = 0; i < n; i++){
        s = s.at(n-1) + s.substr(0, n-1);
        if (s == t) {
            flag = true;
        }
    }
    if (flag == false) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}

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

#define ll long long

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

  ll X, y = 100;
  cin >> X;
  //100*(1.01)^y>X
  int i;
  for (i = 0; y < X; ++i) {
    y += y / 100;
  }
  cout << i << "\n";

  return 0;
}


Measured memory_bytes: 3620
// R I S E
/* Dedication has no limitation 
                   - Ulisses Jr.
*/
// 28 APRIL  2019
#include <bits/stdc++.h>
using namespace std;

int main()
{
   int a,b,t;
   cin >> a >> b >> t;
   int step = 0;
   // Biscuits produced at a,2a, 3a,.... seconds
   // in our case,let a = 3: 3,6,9,.... seconds lo each b biscuits. 
   //here t = 7 seconds . till 7 seconds , we havve t = 6  which is less than 7. and b is 5 biscuits.
// for loop seems to be correct
   for(int i=1; i<25; i++){
    if(a*i <= t){
      step++;
    }
    else{
      break;
    }
   }

cout << b*step << endl;
}




 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
using ll =long long;

int main (void) {
  int N,K;
  cin >> N >> K;
  int ans=1;
  for (int i=0; i<N; i++) {
    ans=min(ans*2,ans+K);
  }
  cout << ans;
}

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

int main(){
	int N; cin >> N;
	
	vector<int> A(N);
	vector<int> B(N - 1);
	for(int i = 0; i < N - 1; i++){
		cin >> B[i];
	}

	long long ans = 0;
	for(int i = 0; i < N - 1; i++){
		if(i == 0){
			A[i] = B[i];
			A[i + 1] = B[i];
		}
		else{
			A[i + 1] = B[i];
			if(B[i - 1] > B[i]){
				A[i] = B[i];
			}
		}
	}

	for(int i = 0; i < N; i++){
		ans += A[i];
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(const T a, const T b){return a>=0 ? a/b : (a+1)/b-1;}
template<class T> T div_ceil(const T a, const T b){return a>=0 ? (a-1)/b+1 : a/b;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 100000010;

int main(){
    int d, n;
    scanf("%d%d", &d, &n);
    int cnt = 0;
    For(i, 1, MAX){
        int tmp = 0, t = i;
        while(t % 100 == 0){
            t /= 100;
            ++tmp;
        }
        if(tmp == d) ++cnt;
        if(cnt == n){
            printf("%d\n", i);
            return 0;
        }
    }
}

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

int main(void){
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), [](char a, char b){ return a > b; });
  if(s < t){
    cout << "Yes" << endl;
  } else{
    cout << "No" << endl;
  }
  return 0;
}


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

int n, m;
int G[10][10];
int ans;
bool used[10];

void dfs(int v, int cnt) {
    if (cnt == n) {
        ans++;
        return;
    }
    used[v] = true;
    for (int i = 0; i < n; i++) {
        if (!used[i] && G[v][i])
            dfs(i, cnt + 1);
    }
    used[v] = false;
}

int main() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a][b] = G[b][a] = 1;
    }
    dfs(0, 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new C().doIt();
	}
	
	class C{
		boolean[][] stick_table;
		boolean[][] broken_table;
		void doIt(){
			stick_table = new boolean[10][8];
			broken_table = new boolean[14][8];
			initTable();
			for(int i=0;i<14;i++)for(int s=0;s<7;s++)broken_table[i][s] = true;
			int n = in.nextInt();
			int k = in.nextInt();
			long result = 0;
			for(int i=0;i<k;i++){
				int a = in.nextInt();
				int b = in.nextInt();
				broken_table[a][b] = false;
			}
			int[] timeCount = new int[100];
			for(int h=0;h<24;h++)for(int m=0;m<60;m++)for(int s=0;s<60;s++){
				int[] num = {h/10,h%10,m/10,m%10,s/10,s%10};
				int sum = 0;
				for(int i=0;i<6;i++){
					sum += countNum(num[i], i+8);
				}
				timeCount[sum]++;
			}
			
//			System.out.println(Arrays.toString(timeCount));
//			if(true)return ;
			for(int year=0;year<10000;year++)for(int month = 1;month < 13; month ++){
				int limitDay = days(year, month);
				for(int day=1;day<=limitDay;day++){
					int num[] = {year/1000,(year/100)%10,(year/10)%10,year%10,month/10,month%10,day/10,day%10};
					int sum = 0;
					for(int i=0;i<8;i++){
						int sticks = countNum(num[i], i);
						sum += sticks;
					}
					int index = n-sum;
					if(index < 0 || index >= 100)continue;
//					if(timeCount[index] > 0)System.out.println(Arrays.toString(num));
					result += timeCount[index];
				}
			}
			System.out.println(result);
		}
		
		int days(int year,int month){
			if(isPrimeYear(year) && month == 2)return 29;
			int[] day = {31,28,31,30,31,30,31,31,30,31,30,31};
			return day[month-1];
		}
		
		boolean isPrimeYear(int year){
			if(year%400 == 0)return true;
			if(year%100 == 0)return false;
			if(year%4 == 0)return true;
			return false;
		}
		
		int countNum(int target,int id){
			int cnt = 0;
			for(int i=0;i<7;i++)if(broken_table[id][i] && stick_table[target][i])cnt++;
			return cnt;
		}
		
		void initTable(){
			boolean[][] a = {{true,true,true,false,true,true,true},
							{false,false,true,false,false,true,false},
							{true,false,true,true,true,false,true},
							{true,false,true,true,false,true,true},
							{false,true,true,true,false,true,false},
							{true,true,false,true,false,true,true},
							{true,true,false,true,true,true,true},
							{true,false,true,false,false,true,false},
							{true,true,true,true,true,true,true},
							{true,true,true,true,false,true,true}};
			for(int i=0;i<10;i++)for(int s=0;s<7;s++)stick_table[i][s] = a[i][s];
		}
		
	}
	
}

Measured memory_bytes: 87764