akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
using P = pair<ll,ll>;
const ll mod = 998244353;
const int INF = 1e9;

template <typename T, typename F>
class SegTree{
  int n; T uni; F f;
  vector<T> dat;
public:
  SegTree(int _n, F f, T uni) : f(f), uni(uni) {
    n = 1;
    while(n < _n) n *= 2;
    dat = vector<T>(2*n,uni);
  }
  void set(int k, const T x) {
    dat[k+n] = x;
  }
  void build() {
    for(int i = n-1; i >= 0; i--) {
      dat[i] = f(dat[2*i],dat[2*i+1]);
    }
  }
  void update(int k, T x) {
    k += n;
    dat[k] = x;
    while(k >>= 1){
      dat[k] = f(dat[2*k],dat[2*k+1]);
    }
  }
  T query(int a, int b) {
    T l = uni, r = uni;
    for(a += n, b += n; a < b; a >>= 1, b >>= 1) {
      if(a & 1) l = f(l,dat[a++]);
      if(b & 1) r = f(dat[--b],r);
    }
    return f(l,r);
  }
};

int main(){
  int n;
  cin >> n;
  P p[n];
  rep(i,n) cin >> p[i].first >> p[i].second;
  sort(p,p+n);
  vector<ll> x(n);
  rep(i,n) x[i] = p[i].first;
  auto f = [](ll a, ll b){return max(a,b);};
  SegTree<ll,decltype(f)> st(n,f,-1);
  vector<int> c(n);
  c[n-1] = n-1;
  st.update(n-1,c[n-1]);
  for(int i = n-2; i >= 0; i--) {
    st.update(i,i);
    int b = lower_bound(x.begin(),x.end(),x[i]+p[i].second) - x.begin();
    c[i] = st.query(i,b);
    st.update(i,c[i]);
  }
  vector<ll> dp(n,0);
  dp[n-1] = 2;
  for(int i = n-2; i >= 0; i--) {
    if(c[i] == n-1) dp[i] = (dp[i+1] + 1) % mod;
    else dp[i] = (dp[i+1] + dp[c[i]+1]) % mod;
  }
  cout << dp[0] << endl;
  return 0;
}


Measured memory_bytes: 11392
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import fractions
import copy
from itertools import permutations
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

from itertools import permutations
from math import factorial, hypot

# 結局最後には0の塊か1の塊が残る
S = list(map(int, list(input())))
zerocounter = 0
onecounter = 0
for st in S:
    if st == 0:
        zerocounter += 1
    else:
        onecounter += 1
print(min(zerocounter, onecounter) * 2)

Measured memory_bytes: 74988
import java.util.*;
public class Main {
     static int getTheNumberOfCoin(int C[],int n,int m){
         int T[] = new int[n + 1];
         for(int i = 1;i < n + 1;i++){
             T[i] = T[i - 1] + C[0];
         }
         for(int i = 0;i < m;i++){
             for(int j = C[i];j < n + 1;j++){
                 if(T[j] < T[j - C[i]] + 1){
                     T[j] = T[j];
                 }else{
                     T[j] = T[j - C[i]] + 1;
                 }
             }
         }
         return T[n];
     }
     public static void main(String[] args) {
         Scanner in = new Scanner(System.in);
         int n = in.nextInt();
         int m = in.nextInt();
         int C[] = new int [m]; 
         for(int i = 0;i < m;i++){
             C[i] = in.nextInt();
         }
         int min = getTheNumberOfCoin(C,n,m);
         System.out.println(min);
     }
}

Measured memory_bytes: 26892
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }


int main() {
    int a,n;
    cin >> a >> n;
    VL s(n);
    FOR(i,0,n) cin >> s.at(i);

    int sum = 0;
    FOR(i,0,n) sum += s.at(i);
    bool ans = false;

    if(a <= sum){
        ans = true;
    }
    
    if(ans == true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
  

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)



template<int um> class UF { // from kmjp
public:
	vector<int> par;
	UF() { par = vector<int>(um, 0); rep(i, 0, um) par[i] = i; }
	int operator[](int x) { return par[x] == x ? x : par[x] = operator[](par[x]); }
	void operator()(int x, int y)
	{
		x = operator[](x); y = operator[](y);
		if (x != y) par[x] = y;
	}
};
//-----------------------------------------------------------------
int N, K, L;
UF<201010> uf1, uf2, uf3;
int cnt[201010];
int p[101010], q[101010];
int r[101010], s[101010];
map<pair<int, int>, int> ans;
//-----------------------------------------------------------------
int main() {
	cin >> N >> K >> L;

	rep(i, 0, K) {
		int a, b;
		scanf("%d %d", &a, &b);
		a--; b--;
		p[i] = a; q[i] = b;

		uf1(a, b);
	}

	rep(i, 0, L) {
		int a, b;
		scanf("%d %d", &a, &b);
		a--; b--;
		r[i] = a; s[i] = b;

		uf2(a, b);
	}

	rep(i, 0, N) cnt[i] = 1;

	rep(i, 0, N) ans[make_pair(uf1[i], uf2[i])]++;

	rep(i, 0, N) printf("%d ", ans[make_pair(uf1[i], uf2[i])]);
	cout << endl;
}

Measured memory_bytes: 16768
"use strict";
class QElement{constructor(element,priority){this.element=element;this.priority=priority}}class PriorityQueue{constructor(){this.items=[]}enqueue(element,priority){var qElement=new QElement(element,priority);var contain=false;for(var n=0;n<this.items.length;n++){if(this.items[n].priority<qElement.priority){this.items.splice(n,0,qElement);contain=true;break}}if(!contain){this.items.push(qElement)}}dequeue(){if(this.isEmpty())return"Underflow";return this.items.shift()}front(){if(this.isEmpty())return"No elements in Queue";return this.items[0]}rear(){if(this.isEmpty())return"No elements in Queue";return this.items[this.items.length-1]}isEmpty(){return this.items.length==0}printPQueue(){var str="";for(var n=0;n<this.items.length;n++)str+=this.items[n].element+" ";return str}}
function Main(input) {
    let lines = input.split("\n");
    let xyzk = lines.shift().split(/\s/).map((v) => v - 0);
    let X = xyzk[0], Y = xyzk[1], Z = xyzk[2], K = xyzk[3];
    let A = lines.shift().split(/\s/).map((v) => v - 0).sort((a, b) => b - a);
    let B = lines.shift().split(/\s/).map((v) => v - 0).sort((a, b) => b - a);
    let C = lines.shift().split(/\s/).map((v) => v - 0).sort((a, b) => b - a);
    A.push(-1e12);
    B.push(-1e12);
    C.push(-1e12);
    const d4 = (n) => ('0000' + n).slice(-4);
    const hashed = (a, b, c) => d4(a) + d4(b) + d4(c);

    let pq = new PriorityQueue();
    let s = new Set();
    pq.enqueue([0, 0, 0], A[0] + B[0] + C[0]);
    s.add(hashed(0, 0, 0));
    let ans = [];
    while (ans.length < K) {
        let v = pq.dequeue();
        ans.push(v.priority);
        for (let n = 0; n < 3; n++) {
            let a = v.element[0]; if (n == 0) a++;
            let b = v.element[1]; if (n == 1) b++;
            let c = v.element[2]; if (n == 2) c++;
            let hash = hashed(a, b, c);
            if (!s.has(hash)) {
                s.add(hash);
                pq.enqueue([a, b, c], A[a] + B[b] + C[c]);
            }
        }
    }
    for (let n = 0; n < K; n++) {
        console.log(ans[n]);
    }
}
if (typeof window === 'undefined') Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 16892
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long N;
  cin>>N;
  long long sum=0;
  for(int i=1;i<N+1;i++){
    if(i%3==0 or i%5==0){
    }
    else{
      sum=sum+i;
    }
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 3636
import java.util.*;
import java.io.*;

class Counter<T> extends HashMap<T,Integer>{
    public Counter(){
        super();
    }
    public Integer get(Object elm){
        return getOrDefault(elm,0);
    }
    public void add(T elm){
        put(elm, get(elm)+1);
    }
}

public class Main {
static final int MOD = 1_000_000_007;
    public static long addMod(long a, long b){
    	long tmp = (a+b)%MOD;
    	return tmp>=0 ? tmp : tmp+MOD;
    }
    public static long subMod(long a, long b){
    	return addMod(a,-b);
    }
    public static long multMod(long a, long b){
    	long tmp = (a*b)%MOD;
    	return tmp>=0 ? tmp : tmp+MOD;
    }
    public static long powerMod(long a, long x){ //calculate a^x
        if(x<0)return 0;
        if(x==0)return 1;
        if(x%2==0) {
        	long half = powerMod(a,x/2);
        	return multMod(half,half);
        }
        return (a*powerMod(a,x-1)) % MOD;
    }
    public static long inverseMod(long a){
        return powerMod(a,MOD-2);
    }
    public static long divMod(long a, long b){
    	return multMod(a, inverseMod(b));
    }
    public static long[] makeFactorialArray(int size){
        long[] array = new long[size];
        array[0]=1;
        for(int i=1;i<size;i++){
        	array[i]=multMod(array[i-1],i);
        }
        return array;
    }
    public static long[] makeInversedArray(long[] original){
        long[] array = new long[original.length];
        for(int i=0;i<original.length;i++){
        	array[i] = inverseMod(original[i]);
        }
        return array;
    }
    public static long combination(int n, int r, long[] fact, long[] factInv){
        return multMod(fact[n], multMod(factInv[r],factInv[n-r]));
    }
    public static long solve(int N, long M, long[] fact, long[] factInv){
        Counter<Integer> primes = new Counter<>();
        for(int i=2;i<=M;i++){
        	while(M%i==0){
        	    M = M/i;
        	    primes.add(i);
        	}
        }
        //System.out.println(primes);
        
        long ans = 1;
        for(int p:primes.keySet()){
        	int x = primes.get(p);
        	ans = multMod(ans, combination(N-1+x,x, fact,factInv));
        }
        return ans;
    }
    
    public static void main(String[] args) {
        long[] fact = makeFactorialArray(200001);
        long[] factInv = makeInversedArray(fact);
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long M = sc.nextLong();
        
        //System.out.println(divisors);
        System.out.println(solve(N,M,fact,factInv));
        
        
    }
}


Measured memory_bytes: 27988
#include <bits/stdc++.h>
using namespace std;
int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    return f*x;
}
int a[2][105];
int vis[2][105];
int sum1[105];int sum2[105];
int main(){
	ios::sync_with_stdio(false);
	int n;cin>>n;
	for(int i=1;i<=2;i++){
		for(int j=1;j<=n;j++){
			cin>>a[i][j];
		}
	}
	sum1[0]=0;
	for(int i=1;i<=n;i++) sum1[i]=sum1[i-1]+a[1][i];
	sum2[0]=0;
	for(int i=1;i<=n;i++) sum2[i]=sum2[i-1]+a[2][i];
	int ans=-1;
	for(int i=1;i<=n;i++){
		ans=max(ans,sum1[i]+sum2[n]-sum2[i-1]);
	}
	cout<<ans<<endl;
	return 0;
}


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

int main()
{
   int n;
   cin>>n;
   string s,t;
   cin>>s>>t;
   int cnt=0;
   for(int i=1;i<=n;i++){
        if(s.substr(n-i)==t.substr(0,i))cnt=i;
   }
   cout<<2*n-cnt;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
typedef pair<int,int> pii;
typedef pair <long long,long long> pll;
typedef long long ll; 
typedef long double ld; 
const ll mod = 1e9+7;
void solve( vector <int> &dp, vector <int> &v, int x)
{
	for(int i = 1; i <= x ; i++)
	{	for(int move: v)
		{
			if(move > i)	continue;
			if(dp[i-move] == 0)
				dp[i] = 1;
		}
	}
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); 
    int n,k ; cin >> n >> k;
    vector < int > v(n);
    vector < int > dp(k+1,0);
    for(int i = 0; i < n ; i++)
		cin >>v[i];
	solve(dp, v, k );
	if(dp[k])
		cout<<"First";
	else
		cout<<"Second";
	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)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<ll> a(n);
    ll t = 0;
    rep(i, n) {
        cin >> a[i];
        t += a[i];
    }

    ll x = 0, ans = LLONG_MAX;
    rep(i, n - 1) {
        x += a[i];
        ans = min(ans, llabs(2*x - t));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
n = gets.to_i
s = gets.chomp.chars
sc = s.count
res = []
(n-1).times do |i|
  val = 0
  s[0..i].uniq.each do |j|
    val += 1 if s[i+1..sc].include?(j)
  end
  res << val
end
puts res.max

Measured memory_bytes: 3836
N = int(input())





d=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]





print(d[N-1])


Measured memory_bytes: 2940
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main{
	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-12;

	String query;
	ArrayList<String> ss;

	void run(){
		query=sc.nextLine();
		ss=new ArrayList<String>();
		for(; sc.hasNextLine();){
			ss.add(sc.nextLine());
		}
		solve();
	}

	void solve(){
		Node root=new Node("", "", -1, null);
		Node node=root;
		for(String line : ss){
			int depth=line.length();
			line=line.replaceAll("^ *", "");
			depth-=line.length();
			for(; depth<=node.depth; node=node.parent);
			// debug(line, node.key);
			if(line.charAt(line.length()-1)==':'){
				Node child=new Node(line.substring(0, line.length()-1), null,
						depth, node);
				node.children.put(child.key, child);
				node=child;
			}else{
				String key=line.split(": ")[0];
				String value=line.split(": ")[1];
				Node child=new Node(key, value, depth, node);
				node.children.put(child.key, child);
				// node=child;
			}
		}
		if(true){
			LinkedList<Node> stack=new LinkedList<Node>();
			stack.push(root);
			for(; !stack.isEmpty();){
				node=stack.pop();
				String s="";
				for(int i=0; i<node.depth; i++){
					s+=" ";
				}
				s+=node.key+":"+node.value;
				// debug(s, node.parent==null?"":node.parent.key);
				// debug(s);
				for(Node child : node.children.values()){
					stack.push(child);
				}
			}
		}
		String ans;
		node=root;
		for(String s : query.substring(1).split("\\.")){
			if(node.children.containsKey(s)){
				node=node.children.get(s);
			}else{
				node=null;
				break;
			}
			// debug(node.depth, node.key, node.value);
		}
		if(node==null){
			ans="no such property";
		}else if(node.children.size()>0){
			ans="object";
		}else{
			ans="string \""+node.value+"\"";
		}
		println(ans);
	}

	class Node{
		String key, value;
		int depth;
		Node parent;
		HashMap<String, Node> children;

		Node(String key, String value, int depth, Node parent){
			this.key=key;
			this.value=value;
			this.depth=depth;
			this.parent=parent;
			children=new HashMap<String, Node>();
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 13000
n,k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
mod = 10**9 + 7

ans = 0
for i in range(n):
    for j in range(n):
        if a[i] > a[j] and i>j:
            ans += (k-1) * k//2
        if a[i] >a[j] and i<j:
            ans += k * (k+1) // 2
    ans = ans % mod
print(ans)

Measured memory_bytes: 3316
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a = inp()
b = inp()
c = inp()
x = inp()
res = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i + 100*j + 50*k == x:
                res += 1
                break
print(res)

Measured memory_bytes: 39792
use std::cmp;

fn main(){
  loop {
    let n: usize = read();
    
    if n == 0 { break; }

    let mut cv: Vec<u32> = vec![4];

    for _ in 0 .. n {
      cv.push(read())
    }

    cv.push(5);

    let mut mxn: usize = 0;

    for i in 1 .. n + 1 {
      mxn = cmp::max(mxn,
        cmp::max(chain(&cv, i, 1),
          cmp::max(chain(&cv, i, 2),
            chain(&cv, i, 3)
          )
        )
      );
    }

    println!("{}", n - mxn);
  }
}

fn read<T>() -> T
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.trim().parse().unwrap()
}

fn chain(v: &Vec<u32>, i: usize, c: u32) -> usize {
  let mut p: usize = i - 1;
  let mut q: usize = i + 1;
  let mut n: usize;
  
  while v[p] == c { p -= 1; }
  while v[q] == c { q += 1; }

  if q - p - 1 >= 4 {
    n = q - p - 1;
    
    loop {
      if v[p] == v[q] {
        let tc = v[p];
        while v[p] == tc { p -= 1; }
        while v[q] == tc { q += 1; }
        if q - p - 1 - n >= 4 {
          n = q - p - 1;
        } else {
          break;
        }
      } else {
        break;
      }
    }
  } else {
    n = 0;
  }
  
  n
}



Measured memory_bytes: 5052
///-----Bismillahir Rahmanir Rahim-----///

#include<bits/stdc++.h>
using namespace std;

///---FAST I/O---///
#define Boost() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

///---DATA TYPE---///
typedef long long ll;
typedef long long int lli;
///vector
typedef vector<int> vi;
typedef vector<ll> vl;
///pair
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;

///---LOOP---///
#define rep0(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)

///---I/O---///
#define sf scanf
#define pf printf

///---OTHERS---///
#define pb push_back
#define all(c)		c.begin(),c.end()
#define MK make_pair
#define F first
#define S second
#define endl '\n'


///---INITIALIZATION---//
#define mem(a,b) memset(a, b, sizeof(a) )

///---CALCULATE---///
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

///---BIT OPERATION---///
inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

///---CONSTANT---///
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

int main()
{
    Boost();

    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        ll x,k=1;
        cin>>x;
        while(k*x%360!=0) k++;
        cout<<k<<endl;
    }
    return 0;
}


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

int main() {
  int N, X;
  cin >> N >> X;
  int S = 0;
  int a = 1000;
  for(int i = 0; i < N; i++) {
    int m;
    cin >> m;
    S += m;
    a = min(a, m);
  }
  cout << N + (X-S) / a << endl;
}  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll b[4][4];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	ll sum = 0;
	for (auto x : s)
	{
		ll cif = (int)(x - '0');
		sum += cif;
	}
	if (sum % 9 == 0)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){

    int N;
    cin >> N;

    double size;
    size = sqrt(N*2);
    int element = int(floor(size));

    if (element * (element + 1) / 2 != N) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
        cout << element + 1 << endl;

        int S[450][450] = {0};
        int count = 1;
        for (int i=0; i<element+1; i++) {
            for (int j=i; j<element; j++) {
                S[i][j] = count;
                S[j+1][i] = count;
                count++;
            }
        }
        for (int i=0; i<element+1; i++) {
            cout << element << " ";
            for (int j=0; j<element; j++) {
                cout << S[i][j] << " ";
            }
            cout << endl;
        }
    }

    return 0;
}


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

int main() {
    int n, k;
    cin >> n >> k;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        int h;
        cin >> h;
        if (k <= h) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <vector>
/* 変数i を n回繰り返すマクロ */
#define rep(i,n) for (int i = 0;i < (n);i++)
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
/* map_for : mapでfor文を回す */
/* gcd_lcm : 最大公倍数 & 最小公約数 */
int main()
{
    cout << fixed << setprecision(10);//小数点以下10桁出力
    int n;
    cin >> n;
    map<string,int> m;
    int cnt = 0;
    rep(i,n){
        string s;
        cin >> s;
        if(m.find(s) == m.end()){
            cnt++;
            m.insert(make_pair(s,1));
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 19204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

int main() {
    int a[3];
    for(int i = 0; i < 3;++i)
        cin >> a[i];
    sort(a, a + 3, greater<int>());
    cout << a[0] * 10 + a[1] + a[2] << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define bg begin()
#define end end()
#define sz size()
#define vi vector<int>
#define vl vector<long long int>
int main(){
	fast;
	int a,b,c;
	cin>>a>>b>>c;
	if(!((a*100+b*10+c)%4))
		cout<<"YES";
	else
		cout<<"NO";
	
	return 0;
}



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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

//-----------------------------------------------------------------------------

int n,k;
ll a[100000],imos[100001],pls[100001];
ll ans=0;
ll sum;

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

	cin>>n>>k;
	REP(i,n) {
		cin>>a[i];
		imos[i+1]=imos[i]+a[i];
		pls[i+1]=pls[i]+(a[i]>0?a[i]:0);
	}
	REP(i,n-k+1) {
		ll now=imos[i+k]-imos[i];
		ans=max(ans,pls[n]-pls[i+k]+pls[i]+now);
		ans=max(ans,pls[n]-pls[i+k]+pls[i]);
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
int main(){
  int h,w,K,ans=1e9;cin>>h>>w>>K;
  vector<string> s(h);
  REP(i,h)cin>>s[i];
  REP(bit,1<<(h-1)){
    vector<int> v;
    REP(i,h-1)if((bit>>i)&1)v.push_back(i);
    int res=v.size(),n=v.size()+1;
    vector<int> cnt(n,0),tmp(n,0);
    REP(x,w){
      int now=0;
      REP(y,h){
        tmp[now]+=s[y][x]=='1';
        if(now<v.size()&&v[now]==y)now++;
      }
      REP(j,n)if(tmp[j]>K)x=res=1e9;
      bool f=true;
      REP(j,n)if(cnt[j]+tmp[j]>K)f=false;
      REP(j,n)cnt[j]=cnt[j]*f+tmp[j],tmp[j]=0;
      res+=!f;
    }
    if(ans>res)ans=res;
  }
  cout<<ans<<endl;
}

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

using namespace std;

#define int long long

int n;

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

	cin >> n;
	if (n%2 == 1)
		cout << 0;
	else
	{
		n/=2;
		int res = 0;
		for (int i=5;i<=n;i*=5)
			res += n/i;
		cout << res;	
	}	
}

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

using namespace std;

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

node *root, *NIL;

void insert(int n) {
	node *y = NIL;						//今の親；とりあえずNIL
	node *x = root;						//今の位置,とりあえずroot
	node *z;							//挿入される節

//	z = (node *)malloc(sizeof(node));	//挿入節の領域確保
	z = new node;						//これでもいいじゃん

	z->key = n;							//keyは入力値
	z->left = NIL;						//left,rightは葉なので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 find(int n) {
	node *x = root;
	if (x == NIL) { cout << "no" << endl; return; }
	while (x != NIL) {
		if (x->key == n) { cout << "yes" << endl; return; }
		else if (x->key > n) { x = x->left; }
		else { x = x->right; }
	}
	cout << "no" << endl;
}

void inorder(node *x) {
	if (x==NIL) {
		return;
	}

	inorder(x->left);
	cout << " " << x->key;
	inorder(x->right);

}

void preorder(node *x) {
	if (x == NIL) {
		return;
	}

	cout << " " << x->key;

	preorder(x->left);
	preorder(x->right);

}

void pr() {
	inorder(root);
	cout << endl;
	preorder(root);
	cout << endl;

}

int main() {

	int m;
	cin >> m;
	string str;
	int n;
	for (int i = 0; i < m; i++) {
		cin >> str;
		if (str == "insert") {
			cin >> n;
			insert(n);
		}
		else if (str == "find") {
			cin >> n;
			find(n);
		}
		else if(str=="print"){
			pr();
		}
	}
}


Measured memory_bytes: 21892
#include <iostream>
#include <map>
#include <cmath>
#include <vector>
#include <algorithm>

#define M 1000000007

using namespace std;

int calc(vector<int> &a, int p){
  if(p == a.size()){
    int sum = 1;
    for(int i = 0;i < a.size();i++){
      //cout << a[i] << " ";
      sum *= a[i];
    }
    //cout << endl;
    if(sum%2 == 0){
      return 1;
    }else{
      return 0;
    }
  }

  int ret = 0;
  a[p] += 1;
  ret += calc(a, p+1);
  a[p] -= 1;
  ret += calc(a, p+1);
  a[p] -= 1;
  ret += calc(a, p+1);
  a[p] += 1;

  return ret;
}

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

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

  cout << calc(a, 0) << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int n,x,ans=0;
  cin >> n;
  int d[101]={};
  for(int j=0;j<n;j++){cin >>x; d[x]++;}
  for(int i=0;i<102;i++){if(d[i]!=0){ans++;}}
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

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

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

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return "\n".join("{}: {}".format(r, self.members(r)) for r in self.roots())


n, m = map(int, input().split())
uf = UnionFind(n)
for _ in range(m):
    a, b = map(int, input().split())
    uf.union(a - 1, b - 1)

ans = 0
for i in range(n):
    ans = max(ans, uf.size(i))
print(ans)


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

namespace template
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // ここに処理を書く
            long a = cin.ReadLong;
            long b = cin.ReadLong;
            long k = cin.ReadLong;

            long ar;
            long br;
            if (a < k)
            {
                ar = 0;
                long tmp = k - a;
                br = Math.Max(0, b - tmp);
            }
            else
            {
                ar = a - k;
                br = b;
            }

            Console.WriteLine(ar + " " + br);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) 
                {
                    return inputStream.Dequeue();
                }

                string[] tmp = _stream.ReadLine().Split(_separator);
                
                for (int i = 0; i < tmp.Length; ++i)
                {
                    inputStream.Enqueue(tmp[i]);
                }
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(lint i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

int main(){
    int n;
    cin >> n;
    double t, a;
    cin >> t >> a;
    vector<double> h(n);
    int ans;
    double tmp = 1e9;
    rep(i, n){
        cin >> h[i];
        if(abs(a - (t - h[i] * 0.006)) < tmp){
            ans = i;
            tmp = abs(a - (t - h[i] * 0.006));
        }
    }
    ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
int main(int argc, char const* argv[])
{
	const char downcase = 'a' - 'A';
	const char upcase = -downcase;
	std::string str;

	std::getline(std::cin,str);
	for (int i = 0; i < str.length(); i++) {
		char letter = str[i];
		if (letter >= 'A' && letter <= 'Z') {
			letter += downcase;
		} else if (letter >= 'a' && letter <= 'z') {
			letter += upcase;
		}
		str[i] = letter;
	}
	std::cout << str << std::endl;
	return 0;
}

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

int main() {
 cin.tie(0);
 ios::sync_with_stdio(false);
 vector<string> vec(200002);
 int n;
 cin>>n;
 for (int i = 0; i < n; ++i){
	cin >> vec[i];
 }
 sort(vec.begin(), vec.end());
 vec.erase(unique(vec.begin(), vec.end()), vec.end());
 cout<<vec.size()-1;
}   

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

int main() {
  int n, q;
  cin >> n >> q;
  vector<stack<int>> vs(n);
  for (int i = 0; i < q; i++) {
    int a;
    cin >> a;
    if (a == 0) {
      int t, x;
      cin >> t >> x;
      vs.at(t).push(x);
    }
    if (a == 1) {
      int t;
      cin >> t;
      if (!vs.at(t).empty())
      cout << vs.at(t).top() << endl;
    }
    if (a == 2) {
      int t;
      cin >> t;
      if (!vs.at(t).empty())
      vs.at(t).pop();
    }
  }
}


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

AB = []

for _ in range(M):
    A_i, B_i = map(int, input().split())
    AB.append([A_i, B_i])

class UnionFind():
    def __init__(self, n):
        self.parent = [-1 for _ in range(n)] # 親なら -1 * サイズ
        
    def root(self, x):
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.root(self.parent[x])
            return self.parent[x]
    def size(self, x):
        x = self.root(x)
        return -1 * self.parent[x]
    
    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        x_size = self.size(x)
        y_size = self.size(y)
        if x_size < y_size:
            x, y = y, x
        self.parent[x] += self.parent[y]
        self.parent[y] = x
        return True
        
max_inconvenience = N * (N - 1) // 2 
ans = [max_inconvenience]
uf = UnionFind(N)
for bridge in reversed(AB):
    x = uf.root(bridge[0] - 1)
    y = uf.root(bridge[1] - 1)

    if x != y:
        x_size = uf.size(x)
        y_size = uf.size(y)
        ans_tmp = max_inconvenience - x_size * y_size
        max_inconvenience = ans_tmp
        uf.union(x, y)
    else:
        ans_tmp = max_inconvenience
    ans.append(ans_tmp)
    
for a in reversed(ans[:-1]):
    print(a)

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

int main()
{
    int k,n;
    cin>>k>>n;
    int A[n];
     for(int i=0;i<n;i++)
     {
        cin>>A[i];
     }
     int sum=0;
     int right = A[1]-A[0];
     int rightcnt =0;
   
     int left = k-A[n-1]+A[0];
     int leftcnt =n;
     int x =0;
     for(int i=0;i<n-1;i++)
     {
        if(right<=left)
        {
            rightcnt++;
            sum += right;
             
            right = A[rightcnt+1]-A[rightcnt];  
        }  
       
        else
        {
             leftcnt--;
             sum += left;
             
             left = A[leftcnt]-A[leftcnt-1];
        
        }
          
     }

    cout<<sum<<endl;

     return 0;
}


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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			int n = cin.Int();
			string s = cin.Next();
			long ans = 1;
			char prev = s[0];
			for (int i = 1; i < n; i++) {
				if (prev != s[i]) {
					++ans;
				}

				prev = s[i];
			}

			Console.WriteLine(ans);
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;

		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 11744
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;
typedef std::vector<long long> vl;
typedef std::vector<std::vector<long long>> vvl;
#define out(x) cout<<x<<"\n";
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}

ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;
template<typename T>
struct edge{
  int to;
  T cost;
  edge(int to,T cost):to(to),cost(cost){}
};

vector<int>pre;

template<typename T>
vector<T> dijkstra(vector<vector<edge<T>>> &g,int s){//sは始点
  const auto INFTY=numeric_limits<T>::max();//2回以上使うときはオーバーフローに気をつける(INFTYのときはif文で弾くなど)
  vector<T>dist(g.size(),INFTY);
  pre.resize(g.size(),-1);
  using P=pair<T,int>;//firstは最短距離,secondは頂点の番号
  priority_queue<P,vector<P>,greater<P>>pq;
  dist[s]=0;
  pq.emplace(dist[s],s);

  while(!pq.empty()){
    auto x=pq.top();pq.pop();
    int v=x.second;
    if(dist[v]<x.first)continue;//最短距離でなければ飛ばす
    for(auto e:g[v]){
      if(dist[e.to]>dist[v]+e.cost){
        pre[e.to]=v;
        dist[e.to]=dist[v]+e.cost;
        pq.emplace(dist[e.to],e.to);
      }
    }
  }
  return dist;
}

template<typename T>
vector<T>get_path(int t){//頂点tへの最短経路
    vector<T>path;
    for(;t!=-1;t=pre[t]){
      path.push_back(t);
    }
    reverse(path.begin(),path.end());
    return path;
}

void solve(){
    int n,x,y;
    cin>>n>>x>>y;
    vector<vector<edge<int>>>g(n);
    rep(i,n-1){
        g[i].emplace_back(i+1,1);
        g[i+1].eb(i,1);
    }
    x--;y--;
    vector<int>d(n+5);
    g[x].eb(y,1);
    g[y].eb(x,1);
    rep(i,n-1){
        auto dist=dijkstra(g,i);
        REP(j,i+1,n){
            d[dist[j]]++;
        }
    }
    rep(i,n-1){
        cout<<d[i+1]<<endl;
    }
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
int main() {
	int a, b, c, d, p,A,B;
	std::cin >> a >> b >> c >> d >> p;

	A = a*p;

	if (p <= c) {
		B = b;
	}
	else {
		B = b + ((p - c)*d);
	}

	std::cout << std::min(A, B) << std::endl;

	return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define pb push_back
#define inf 10e9
using namespace std;
int solve(vector<int> arr)
{
    int n=arr.size();
    int dp[n]={};
    dp[0]=0;
    dp[1]=abs(arr[1]-arr[0]);
    for(int i=2;i<n;i++)
    {
        int op1=abs(arr[i]-arr[i-1])+dp[i-1];
        int op2=abs(arr[i]-arr[i-2])+dp[i-2];

        dp[i]=min(op1,op2);
    }
    return dp[n-1];
}
int main() {
    int n;
    cin>>n;
    vector<int> arr;
    for(int i=0;i<n;i++)
    {
        int tmp;
        cin>>tmp;
        arr.pb(tmp);
    }
    cout<<solve(arr);
}


Measured memory_bytes: 4500
n, m = map(int, input().split())
s = list(str(input()))
s = list(reversed(s))
#print(s)

ds = []
d = 1
for i in range(1, n+1):
    if s[i] == '0':
        ds.append(d)
        d = 1
    else:
        d += 1
#print(ds)

temp0 = 0
ans = []
for i in range(len(ds)):
    if ds[i] > m:
        print(-1)
        exit()
    temp1 = temp0 + ds[i]
    #print(temp1)
    if temp1 > m:
        ans.append(temp0)
        temp0 = ds[i]
    elif temp1 == m:
        ans.append(temp1)
        temp0 = 0
    else:
        temp0 = temp1
else:
    if temp0 != 0:
        ans.append(temp0)
ans = list(reversed(ans))
print(*ans)

Measured memory_bytes: 54024
#include<bits/stdc++.h>
using namespace std;
#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const int MX=200000+5;
const int inf=1e9;
typedef long long ll;

vector<int>g[MX];
map<pair<int, int>, int>mp;
vector<pair<int, int> >v;
int mx=0;

void dfs(int x, int p, int c)
{
    mp[{x, p}]=mp[{p, x}]=c;
    mx=max(mx, c);
    int cl=1;
    for(auto u:g[x])
    {
        if(u==p) continue;
        if(cl==c) cl++;
        dfs(u, x, cl);
        cl++;
    }
}
int main()
{
    FasterIO;
    int n, k, m;
    cin>>n;
    for(int i=1; i<n; i++)
    {
        int x, y;
        cin>>x>>y;
        g[x].push_back(y);
        g[y].push_back(x);
        v.push_back({x, y});
    }
    dfs(1, 0, 0);

    cout<<mx<<endl;
    for(auto pr:v)
    {
        int x=pr.first; int y=pr.second;
        cout<<mp[{x,y}]<<endl;
    }
    return 0;
}


Measured memory_bytes: 22780
#include<stdio.h>
#include<string.h>


int main(void) {
	
	char S[27];
	scanf("%s", S);
	int X[200] = { 0 };
	int a;
	for (int i = 0; i < strlen(S); i++) {
		a = S[i];
		X[a] += 1;
	}
	int flag=0;

	for (int i = 97; i <= 122; i++) {
		if (X[i] == 2) {
			flag = 1;
			printf("no");
			break;
		}
	}
	if (flag == 0) {
		printf("yes");
	}


		return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int main()
{
    char a[10],b[10],c[10];
    int len1,len2;
    scanf("%s %s %s",&a,&b,&c);
    len1=strlen(a);
    len2=strlen(b);
    if(a[len1-1]==b[0] && b[len2-1]==c[0])
    {
        printf("YES\n");
    }


    else
        printf("NO\n");

    return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
   ll n;cin >>n;
   vector<pair<string,P>>p(n);
    for (int i = 0; i < n; ++i) {
        string s;cin >>s;
        ll d;cin >>d;
        p[i]={s,{d,i+1}};
    }
    sort(all(p),[](pair<string,P> a,pair<string,P> b){
       if(a.first<b.first)return true;
       else if(a.first==b.first){
           if(a.second.first>b.second.first)return true;
       }
       return false;
    });
    for (int i = 0; i < n; ++i) {
        cout <<p[i].second.second<<endl;
    }
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    int n,x,minx,maxv;
    cin >> n >> minx;
    for(int i=0;i<n-1;i++){
        if(i==0){
            cin >> x;maxv=x-minx;
            minx=min(minx,x);continue;
        }
        cin >> x;
        maxv=max(maxv,x-minx);minx=min(minx,x);
    }
    cout << maxv << endl;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
constexpr int INF = 0x3f3f3f3f;
constexpr ll INFL = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

signed main() {
  ll N;
  cin >> N;
  vector<ll> A;
  vector<P> kukan;
  rep(i, N + 1) {
    ll a;
    cin >> a;
    A.pb(a);
    kukan.pb({0, 0});
  }

  P beforeChoten = {0, 0};
  repr(i, A.size() - 1) {
    if (i == (ll)A.size() - 1) {
      kukan[i].first = A[i];
      kukan[i].second = A[i];
      beforeChoten = {A[i], A[i]};
      continue;
    }

    kukan[i].first = (beforeChoten.first + 1) / 2 + A[i];
    kukan[i].second = beforeChoten.second + A[i];
    beforeChoten = kukan[i];
  }
  // repr(i, A.size() - 1) {
  //   debug(kukan[i].first);
  //   debug(kukan[i].second);
  //   ENDL;
  // }

  if (kukan[0].first != 1) {
    COUT("-1");
    return 0;
  }

  ll ans = 1;
  ll before = 1;
  // debug(ans);
  // debug(before);
  // ENDL;
  rep(i, A.size()) {
    if (i == 0) {
      continue;
    }
    ll choten = min(before * 2, kukan[i].second);
    ans += choten;
    before = choten - A[i];

    // debug(choten);
    // debug(ans);
    // ENDL;
  }
  COUT(ans);

  return 0;
}

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

using namespace std;

using int64 = long long;
const int INF = 1 << 30;

int main() {
  int N, A[100000];

  int gcd = 0;
  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
    gcd = __gcd(gcd, A[i]);
  }
  cout << gcd << endl;

}





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

int main(){
  string s;
  cin >> s;
  int sum = 0;
  if(s.size() % 2 == 0){
    for(int i = 0; i < s.size()/2; i++){
      if(s[i] != s[s.size()-1-i]){
        sum++;
      }
    }
  }else{
    for(int i = 0; i <= s.size()/2; i++){
      if(s[i] != s[s.size()-1-i]){
        sum++;
      }
    }
  }
  cout << sum;
}

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

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  if (A <= C & C <= B) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
W, H, N = map(int, input().split())
x = [0] * N
y = [0] * N
a = [0] * N
for i in range(N):
    x[i], y[i], a[i] = map(int, input().split())

x_min = 0
x_max = W
y_min = 0
y_max = H
for i in range(len(a)):
    if a[i] == 1:
        if x_min < x[i]:
            x_min = x[i]
    elif a[i] == 2:
        if x_max > x[i]:
            x_max = x[i]
    elif a[i] == 3:
        if y_min < y[i]:
            y_min = y[i]
    else:
        if y_max > y[i]:
            y_max = y[i]
        
x_len = x_max-x_min
y_len = y_max-y_min
result = x_len*y_len
if (x_len<0)|(y_len<0):
    result = 0

print(result)

Measured memory_bytes: 3064
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

class Magatro
{
    static int A, B;
    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        A = int.Parse(s[0]);
        B = int.Parse(s[2]);
        if (s[1] == "+")
        {
            Console.WriteLine(A + B);
        }
        else
        {
            Console.WriteLine(A - B);
        }
    }
}


Measured memory_bytes: 2648
import heapq

N, M = map(int, input().split())
A = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(A)

# 以下を割引券の枚数分繰り返す
# 最も高い品物に割引券を1枚使う
for _ in range(M):
	min = heapq.heappop(A)
	heapq.heappush(A, (-1) * (-min // 2))

print(-sum(A))

Measured memory_bytes: 14180
<?php
fscanf(STDIN, "%d", $x);

while (true) {
  $check_num = floor(sqrt($x));
  for ($i=$check_num; $i>=2; $i--) {
	if ($x % $i == 0) {
      $x++;
      continue 2;
    }
  }
  echo $x; exit;
}

Measured memory_bytes: 4604