akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "YES" : "NO";
}

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

    cout << yn((n+1)/2 >= k) << endl;
}

Measured memory_bytes: 256
import itertools
N=int(input())
L=list(map(int,input().split(' ')))
l=0
T=[]
for u in list(itertools.combinations(L, 3)):
    i,j,k=u
    if 2*max(i,j,k)<i+j+k and i!=k and i!=j and j!=k:
        l=l+1
print(l)

Measured memory_bytes: 20496
# cook your dish here
import sys,math
try:sys.stdin,sys.stdout=open('input.txt','r'),open('out.txt','w')
except:pass
from sys import stdin,stdout;mod=int(1e9 + 7);from statistics import mode
from collections import *;from math import ceil,floor,inf,factorial,gcd,log2,sqrt,log
ii1=lambda:int(stdin.readline().strip())
is1=lambda:stdin.readline().strip()
iia=lambda:list(map(int,stdin.readline().strip().split()))
isa=lambda:stdin.readline().strip().split()
# print('{:.3f}'.format(1),round(1.123456789,4))
# sys.setrecursionlimit(500000)
def lcm(a,b): return (a*b)//gcd(a,b)
def setbits(n):return bin(n).count('1')
def resetbits(n):return bin(n).count('0')
def modinv(n,p):return pow(n,p-2,p)
def ncr(n,r):
    num,den=1,1;r=min(n,n-r)
    for i in range(r):num*=(n-i);den*=(i+1)
    return num//den
def ncr_p(n, r, p):
    num,den=1,1;r=min(r,n-r)
    for i in range(r):num = (num * (n - i)) % p ;den = (den * (i + 1)) % p
    return (num * modinv(den,p)) % p
def isPrime(num) :
    if num<=1:return False
    if num==2 or n==3:return True
    if (num % 2 == 0 or num % 3 == 0) :return False
    m = int(num**0.5)+1
    for i in range(5,m,6):
        if (num % i == 0 or num % (i + 2) == 0) :return False
    return True
def bin_search(s, low, high, val):
    while low <= high:
        mid = low + (high - low) // 2;
        if s[mid] == val:return mid
        elif s[mid] < val:low = mid + 1
        else:high = mid - 1
    return -1
def sumofdigit(num):
    count=0;
    while num : count+=num % 10;num //= 10;
    return count;
def inputmatrix():
    r,c=iia();mat=[0]*r;
    for i in range(r):mat[i]=iia();
    return r,c,mat;
def prefix_sum(n,s):
    for i in range(1,n):s[i]+=s[i-1]
    return s;
def binomial(n, k):
    if 0 <= k <= n:
        ntok = 1;ktok = 1
        for t in range(1, min(k, n - k) + 1):ntok *= n;ktok *= t;n -= 1
        return ntok // ktok
    else:return 0
def divisors(n):
    res = [];
    for i in range(1,ceil(sqrt(n))+1):
        if n%i == 0:
            if i==n//i:res.append(i)
            else:res.append(i);res.append(n//i)
    return res;
#code here
s=ii1()
dp=[0]*2001
dp[3]=dp[4]=dp[5]=1
for i in range(6,s+1):
    dp[i]=dp[i-1]+dp[i-3]
    dp[i]=dp[i]%mod 
print(dp[s])


Measured memory_bytes: 77508
n,m = map(int,input().split())
ab = [0]*n
cd = [0]*m
for i in range(n):
    ab[i] = list(map(int,input().split()))
for i in range(m):
    cd[i] = list(map(int,input().split())) + [i]
for a,b in ab:
    dis = [0]*m
    for c,d,i in cd:
        dis[i] = [abs(a-c) + abs(b-d)] + [i+1]
    dis.sort(key= lambda val : val[0])
    print(dis[0][1])


Measured memory_bytes: 3064
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, 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 1; } return 0; }
const int INF = 1000000000;

int main() {
    string s;
    cin >> s;
    int ans = 0;
    for (int i=0; i<3; i++){
        for (int j=0; i+j<4; j++){
            string rx;
            for (int k=0; k<j; k++)rx += "R";
            if (s.substr(i,j) == rx)chmax(ans, j);

        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);
		    
		    String a = scanner.next();
		    String b = scanner.next();
		    String c = scanner.next();
		    
		    System.out.println(a.substring( 0 , 1 ).toUpperCase() 
		    					+ b.substring( 0 , 1 ).toUpperCase()
		    					+ c.substring( 0 , 1 ).toUpperCase());
		    
		    scanner.close(); }
		  }

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

using namespace std;

#define cerr if(false)cerr
#define what(x) cerr<<#x<<" = "<<x<<endl
 
typedef long long ll;
typedef pair<ll, ll> ii;

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 322;

int main(){

	ios_base::sync_with_stdio(false); 
	cin.tie(0);
	cout.tie(0);

	int s, w;
	cin >> s >> w;

	cout << (w >= s ? "unsafe" : "safe") << endl;

	return 0;
}

Measured memory_bytes: 3660
fn main()
{
    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };
    let (a, b, c) =
    {
        let mut ws = s.split_whitespace();
        let a: i32 = ws.next().unwrap().parse().unwrap();
        let b: i32 = ws.next().unwrap().parse().unwrap();
        let c: i32 = ws.next().unwrap().parse().unwrap();
        (a, b, c)
    };
    if (a == b || b == c || a == c) && !(a == b && b == c && a == c)
    {
        println!("Yes");
    }
    else
    {
        println!("No");
    }
    
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll mod=INF;
 
void Add(int &a, int b) {
  a += b;
  while (a >= MOD) a -= MOD;
  while (a < 0) a += MOD;
}
 
void Mul(int &a, int b) {
  a = 1LL * a * b % MOD;
}
 
int Pow(int b, int e) {
  if (e < 0) e += MOD - 1;
  int ret = 1;
  while (e) {
    if (e & 1) ret = 1LL * ret * b % MOD;
    b = 1LL * b * b % MOD;
    e >>= 1;
  }
  return ret;
}
 
namespace Math {
  const int NMAX = (int)1e7;
  int pow2[1 + NMAX];
  int fact[1 + NMAX], tcaf[1 + NMAX];
  void Precalc() {
    fact[0] = pow2[0] = 1;
    for (int i = 1; i <= NMAX; ++i) {
      pow2[i] = pow2[i - 1];
      Add(pow2[i], pow2[i]);
 
      fact[i] = fact[i - 1];
      Mul(fact[i], i);
    }
    tcaf[NMAX] = Pow(fact[NMAX], -1);
    for (int i = NMAX - 1; i >= 0; --i) {
      tcaf[i] = tcaf[i + 1];
      Mul(tcaf[i], i + 1);
      assert(1LL * fact[i] * tcaf[i] % MOD == 1);
    }
  }
  int Choose(int n, int k) {
    if (k > n || n < 0) return 0;
    return 1LL * fact[n] * tcaf[n - k] % MOD * tcaf[k] % MOD;
  }
};

int main() {
    Math::Precalc();
    ll n,m,k;
    cin >> n >> m >> k;
    ll r=n-1,rr=m-1,ans=0;
    rep(i,k+1){
        ll o=m;
        o=(o*Pow(rr,r-i))%MOD;
        o=(o*Math::Choose(r,i))%MOD;
        ans=(ans+o)%MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 120808
n=gets.to_i
a=gets.split(' ').map(&:to_i)

smash=0
tugi = 1

for i in 0..n-1
  if a[i]==tugi
    tugi+=1
  else
    smash+=1
  end
end

if tugi==1
  puts -1
else
  puts smash
end


Measured memory_bytes: 15364
#include <iostream>

int main(void){
    int N;
    int yen = 1000;
    scanf("%d", &N);

    for (yen = 1000; yen <= 10000; yen += 1000){
        if ( N/yen == 0 ) break;
        if ( N/yen == 1 && (N - yen) == 0 ) break;
    }
    std::cout << yen - N  << std::endl;
    return 0;
}

Measured memory_bytes: 3740
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    ll l;
    cin >> n >> l;
    int trie[200005][2];
    for(int i = 0; i < 200005; i++) trie[i][0] = trie[i][1] = -1;
    ll b[100005]{0};
    int e = 0;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        int c = 0;
        bool f = false;
        for(ll j = 0; j < (int)s.size(); j++){
            if(trie[c][s[j] - '0'] == -1){
                e++;
                trie[c][s[j] - '0'] = e;
                if(!f){
                    b[j]++;
                    b[s.size()]++;
                    f = true;
                }
            }
            c = trie[c][s[j] - '0'];
        }
    }
    for(ll i = 1; i < 100002; i++) b[i] += b[i - 1];
    ll x = 0;
    for(ll i = 0; i < 100003; i++){
        if(b[i] % 2){
            x ^= ((l - i) & (i - l));
        }
    }
    if(x) cout << "Alice" << endl;
    else cout << "Bob" << endl;
}

Measured memory_bytes: 2816
#include<stdio.h>
int partition(int*,int,int);
int main(){

  int i,n,q;

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

  q=partition(A,0,n-1);
  for(i=0;i<n;i++){
    if(i==n-1){
      if(i==q) printf("[%d]\n",A[i]);
      else printf("%d\n",A[i]);
    }
    else{
      if(i==q) printf("[%d] ",A[i]);
      else printf("%d ",A[i]);
    }
  }
  return 0;
}
int partition(int *A,int p,int r){

  int i,j;
  int swap,x;

  i=p-1;
  x=A[r];

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



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

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  a = a - k;
  if (a < 0) {
    b = a + b;
    b = b < 0 ? 0 : b;
  }
  a = a < 0 ? 0 : a;
  cout << a << " " << b << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define P pair<ll,ll>
#define lvector vector<ll> 
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,k,ans=0,val=0;cin>>n>>k;
  lvector v(n,0);rep(i,n) {cin>>v[i];}
  val+=k;ans+=1;
  while(val<n) {
    val+=k-1;ans+=1;
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 1024
require 'pp'

def gets; ARGF.gets; end

class Solver

  def initialize
  end

  def main
    s = gets.chomp

    if s == "Sunny"
      puts "Cloudy"
    elsif s == "Cloudy"
      puts "Rainy"
    else
      puts "Sunny"
    end
  end
end

if __FILE__ == $0
  Solver.new.main
end


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

using namespace std;

int main()
{
    //system("chcp 65001");

    int N;
    cin >> N;

    if(N != 3 && N != 5 && N != 7)
    {
        cout << "NO";
    }
    else
    {
        cout << "YES";
    }

    //cout << N;

    return 0;
}

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

int main()
{
  string s;
  int count;
  cin >> s;
  if (s[0] == '1')
    count++;
  if (s[1] == '1')
    count++;
  if (s[2] == '1')
    count++;
  cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>      // std::setprecision
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor_ct.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/pending/disjoint_sets.hpp>
#include <boost/icl/interval_map.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/kruskal_min_spanning_tree.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/numeric/ublas/vector.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::math;
using namespace boost::numeric;
namespace bst = boost;
template<class T> void fill(T& v) { for (auto& i : v) cin >> i; }

int main() {
  int N, M;

  cin >> N >> M;
  
  map<int, long long> dp;
  
  dp[0] = 0;
  REP(i,M) {
    long long a;
    int b;
    
    cin >> a >> b;
    
    int bitm = 0;
    
    REP(j, b) {
      int c;
      
      cin >> c;
      
      bitm |= 1 << (c - 1);
    }
    
    map<int, long long> newdp;
    for (auto i : dp) {
      auto newbit = i.first | bitm;
      if (!dp.count(newbit) || i.second + a < dp[newbit])
        if (!newdp.count(newbit) || i.second + a < newdp[newbit])
        	newdp[newbit] = i.second + a;
    }
    for (auto i : newdp) {
      dp[i.first] = i.second;
    }
  }

  const int full = (1 << N) - 1;
  cout << (dp.count(full) ? dp[full] : -1LL) << endl;

  return 0;
}


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

typedef long long ll;
const ll M = 1000000007;

int main(){
  string s;
  cin >> s;
  ll dp[3] = {};
    dp[1] = dp[2] = 1;
    ll ret[3] = {};
  int cnt = 100002;
  for(int i = 0 ; i < s.size() ; i ++){
    if(s[i] == 'a')cnt ++;
    else cnt --;
      ret[cnt%3] += dp[cnt%3];
    for(int k = 0 ; k < 3 ; k ++){
        if(k == cnt%3)continue;
      dp[k] += dp[cnt%3];
      if(dp[k] >= M)dp[k] -= M;
    }
      dp[cnt%3] = 0;
  }
  for(int i = 0 ; i+1 < s.size() ; i ++){
    if(s[i] == s[i+1]){
      cout << ret[cnt%3]%M << endl;
      return 0;
    }
  }
  cout << 1 << endl;
  return 0;
}


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

#define ll long long int
#define N 1000001

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> v(n, k - q);
    for(int i = 0; i < q; i++) {
        int u;
        cin >> u;
        v[u - 1]++;
    }
    for(int i = 0; i < n; i++) {
        if(v[i] > 0)
            cout << "Yes";
        else
            cout << "No";
        cout << endl;    
    }
}

Measured memory_bytes: 1024
#![allow(clippy::needless_range_loop)]
#![allow(unused_macros)]
#![allow(dead_code)]

use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        a: [usize]
    }
    if a.iter().all(|x| x % 2 == 0) {
        println!("second");
    } else {
        println!("first");
    }
}


Measured memory_bytes: 3644
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;
typedef vector< int > vi;
typedef pair< int, int > ii;
typedef vector< ii > vii;
typedef vector< ll > vll;
// #define DEBUG_MODE
#ifdef DEBUG_MODE
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(x) fprintf(stderr, "[%s = %d]\n", #x, x)
#else
	#define errp(...)
	#define dbg(x) 
#endif

vi p, r;
int num_sets;
int find_set (int x) { return (x == p[x]) ? x : (p[x] = find_set(p[x])); }
bool same_set (int x, int y) { return (find_set(x) == find_set(y)); }
void union_set (int x, int y) {
	x = find_set(x); y = find_set(y);
	if (x == y) return;
	if (r[x] > r[y]) p[y] = x;
	else {
		p[x] = y;
		if (r[x] == r[y]) r[y]++;
	}
	num_sets--;
}

int main () { 
#ifdef DEBUG_MODE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n, m, x, y, z;
	scanf("%d%d", &n, &m);
	p.assign(n, 0);
	r.assign(n, 0);
	for (int i = 0; i < n; i++) p[i] = i;
	num_sets = n;
	
	for (int i = 0; i < m; i++) {
		scanf("%d%d%d", &x, &y, &z);
		x--; y--;
		union_set(x, y);
	}
	printf("%d\n", num_sets);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    vector<int64_t> A(N);
    rep(n,0,N) cin>>A.at(n);

    int64_t ans=0;
    rep(i,0,N){
        ans+=A.at(i)/2;
        if(A.at(i)%2){
            if(i+1<N && A.at(i+1)>0){
                ans++;
                A.at(i+1)--;
            }
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();

		int max = (int) (100d / 0.08d);

		for (int i = 1; i <= max; i++) {
			int xa = (int) (i * 0.08D);
			int xb = (int) (i * 0.1D);
			if (a == xa && b == xb) {
				System.out.println(i);
				return;
			}
		}
		System.out.println(-1);
	}
}


Measured memory_bytes: 23636
package main
 
import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)
 
type intQueue []int
 
func (queue *intQueue) enqueue(i int) {
	*queue = append(*queue, i)
}
 
func (queue *intQueue) dequeue() int {
	result := (*queue)[0]
	*queue = (*queue)[1:]
	return result
}
 
func createGroups(n int, links [][]int) []int {
	groups := make([]int, n)
	for i := 0; i < n; i++ {
		groups[i] = i
	}
	var queue intQueue = make([]int, 0)
	for i := 0; i < n; i++ {
		if groups[i] != i {
			continue
		}
		queue.enqueue(i)
		for len(queue) != 0 {
			j := queue.dequeue()
			for _, k := range links[j] {
				if groups[k] != i {
					groups[k] = i
					queue.enqueue(k)
				}
			}
		}
	}
	return groups
}
 
func readLinks(n, k int) [][]int {
	links := make([][]int, n)
	for i := 0; i < k; i++ {
		p := readInt()
		q := readInt()
		links[p-1] = append(links[p-1], q-1)
		links[q-1] = append(links[q-1], p-1)
	}
	return links
}
 
func main() {
	n := readInt()
	k := readInt()
	l := readInt()
 
	roadLinks := readLinks(n, k)
	railLinks := readLinks(n, l)
 
	roadGroups := createGroups(n, roadLinks)
	railGroups := createGroups(n, railLinks)
 
	d := map[int]int{}
	result := make([]int, n)
	for i := 0; i < n; i++ {
		t := 2000001*roadGroups[i] + railGroups[i]
		if _, ok := d[t]; ok {
			d[t] += 1
		} else {
			d[t] = 1
		}
	}
 
	for i := 0; i < n; i++ {
		result[i] = d[2000001*roadGroups[i]+railGroups[i]]
	}
 
	printIntln(result...)
}
 
const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)
 
var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()
 
func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}
 
func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}
 
func printIntln(v ...int) {
	b := make([]byte, 0, 4096)
	for i := 0; i < len(v)-1; i++ {
		b = append(b, strconv.Itoa(v[i])...)
		b = append(b, " "...)
	}
	b = append(b, strconv.Itoa(v[len(v)-1])...)
	fmt.Println(string(b))
}

Measured memory_bytes: 36864
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int input_a = scan.nextInt();
		int input_b = scan.nextInt();
		
		if(input_a > input_b){
			System.out.println("a > b");
		}else if(input_a < input_b){
			System.out.println("a < b");
		}else{
			System.out.println("a == b");
		}
		
	}

}

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

int main(){
    string str;
    cin >> str;
    set<char> S;
    for(char i : str)
        S.insert(i);

    int len = S.size();
    if(len == 26){
        cout << "None" << endl;
    }else{
        for(int i = 97; i <= 122; i++){
            S.insert(i);
            if((int)S.size() != len){
                cout << (char)i << endl;
                return 0;
            }
        }
    }
    
}


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

int n, m, a[10001];

int main(){
    cin >> n >> m;
    for (int i = 1; i <= m; ++i) {
        cin >> a[i];
        n -= a[i];
    }
    if (n >= 0) {
        cout << n;
    }
    else {
        cout << -1;
    }
    return 0;
}

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


int main() {

   	
   	int a,b;
   	cin >>a>>b;
   	cout<< (a^b);
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    return 0;
}


Measured memory_bytes: 256
//
// Created by yamunaku on 2019/12/09.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    // CFS;
    string s;
    cin >> s;
    int ans = 0;
    rep(i,s.size()/2){
        if(s[i]!=s[s.size()-1-i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

#define Pi acos(-1.)
#define pb push_back
#define all(x) (x).begin(), x.end()
#define mp make_pair
#define fi first
#define se second
#define pii pair<int, int>
#define FILE "474"
#define standart 1

using namespace std;

typedef long long ll;

const int INF = 1e9 + 322;
const ll LINF = 2e18 + 474;
const int MAXN  = 2e5 + 228;
const int MOD = 1e9 + 7;
const double eps = 1e-14;


void solve() {
    int n; cin >> n;
    set<int> st;
    for(int i = 0; i < n; i++) {
        int x; cin >> x;
        st.insert(x);
    }
    cout << (int)st.size() << endl;
}



int main() {
    if(!standart) {
        freopen(FILE".in", "r", stdin);
        freopen(FILE".out", "w", stdout);
    }
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int T = 1;
    while(T--)
        solve();

    return 0;
}


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

int main(){
    string a,b;
    cin >> a >> b;
    bool yes = false;
    for(int i=0; i<(int)(a.length() -b.length() +1); i++){
        bool ok = true;
        for(int j=0; j<(int)b.length(); j++){
            if(a[i+j] != b[j] && b[j] != '_'){
                ok = false;
                break;
            }
        }
        if(ok){
            yes = true;
            break;
        }
    }
    if(yes){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3244
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner scanner=new Scanner(System.in);
    long A=scanner.nextLong();
    long B=scanner.nextLong();
    long K=scanner.nextLong();
    
    
    if(A>=K){
      A=A-K;
      System.out.println(A);
      System.out.println(B);
    }else if(A<K&&A+B>K){
      long j=A+B-K;
      System.out.println(0);
      System.out.println(j);
    }else{
      System.out.println(0);
      System.out.println(0);
    }
                         }
                         }
                         
                        

Measured memory_bytes: 23124
N = int(input())
A = list(range(N+1))
S = sum(A)

n3 = N // 3
B = list(range(n3+1))
S3 = 3*sum(B)

n5 = N // 5
C = list(range(n5+1))
S5 = 5*sum(C)

n15 = N // 15
D = list(range(n15+1))
S15 = 15*sum(D)

print(S-S3-S5+S15)

Measured memory_bytes: 72228
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  if (n > 1) {
    vector<int> num(n, -1);
    rep(i, m) {
      int s, c;
      cin >> s >> c;
      --s;
      if (!s && !c || num[s] >= 0 && num[s] != c) {
        cout << -1 << endl;
        return 0;
      }
      num[s] = c;
    }
    rep(i, n) {
      if (num[i] >= 0)
        cout << num[i];
      else if (i)
        cout << 0;
      else
        cout << 1;
    }
    cout << endl;
  } else {
    int num = -1;
    rep(i, m) {
      int s, c;
      cin >> s >> c;
      if (num >= 0 && num != c) {
        cout << -1 << endl;
        return 0;
      }
      num = c;
    }
    if (num >= 0)
      cout << num << endl;
    else
      cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A,*B;

  int C[VMAX +1];
  int n,i,j;
  scanf("%d",&n);

  A = malloc(sizeof(short) *n +1);
  B = malloc(sizeof(short) *n +1);

  for(i = 0;i <= VMAX;i++)
    C[i] = 0;
  
  for(i = 0;i < n;i++){
    scanf("%hu",&A[i +1]);
    C[A[i +1]]++;
  }

  for(i = 1;i <= VMAX;i++)
    C[i] = C[i] + C[i -1];

  for(j = 1;j <=n;j++){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for(i = 1;i <= n;i++){
    if(i > 1)
      printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 9600
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;
typedef pair <int, array<ll, 9>> mat;

mat replace_mat (mat a, mat b) {
    auto [an, aar] = a;
    auto [bn, bar] = b;
    if (an != bn) return an > bn ? a : b;
    reprev (i, aar.size()) {
        if (int ax = aar[i], bx = bar[i]; ax != bx) {
            return ax > bx ? a : b;
        }
    }
    return a;
}

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m; cin >> n >> m;
    int cost[] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    map<int, int> k;
    rep (i, m) {
        int a; cin >> a;
        chmax(k[cost[a]], a);
    }
    // for (auto [i, j] : k) eprintf("(%d,%d)", i, j); eprintf("\n");

    vector<pair<bool, mat>> dp(n + 10);
    dp[0].first = true; dp[0].second.first = 0;
    rep (i, dp[0].second.second.size()) dp[0].second.second[i] = 0;
    for (auto [b, xar] : dp) {
        auto [x, ar] = xar;
        // rep (i, ar.size()) eprintf("%d%c", ar[i], " \n"[i == i_len - 1]);
    }
    for (auto [c, x] : k) {
        rep (i, n + 1) {
            if (!dp[i].first) continue;
            mat tmp = dp[i].second;
            tmp.first++; tmp.second[x - 1]++;
            dp[i + c] = {true, replace_mat(dp[i + c].second, tmp)};
        }
    }
    auto [x, ar] = dp[n].second;
    // eprintf("%d : ", x); rep (i, ar.size()) eprintf("%lld%c", ar[i], " \n"[i == i_len - 1]);
    reprev (i, ar.size()) {
        rep (_, ar[i]) cout << i + 1;
    }
    cout << "\n";
    return 0;
}

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

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);



int main(){
    FIN;
    string S;
    cin >> S;
    if(S == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;


    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int N;
  cin>>N;

  string s;
  cin>>s;

  Int i = 0;
  Int ans = 0;
  while(i < N){
    ans ++;
    while(i + 1 < N && s[i] == s[i+1]) i++;
    i++;
  }

  cout<<ans<<endl;



  return 0;
}


Measured memory_bytes: 512
A=int(input())
import collections
l=list(map(int,input().split()))
l=collections.Counter(l)
if A%2==1:
   if l[0]!=1:
      print(0)
      exit()
   for i in range(1,A//2+1):
      if l[i*2] != 2:
         print(0)
         exit()
   print(2 ** (A//2)%(10**9+7))
else:
   for i in range(1,A,2):
      if l[i] != 2:
         print(0)
         exit()
   print(2 ** (A//2)%(10**9+7))

Measured memory_bytes: 14820
// Aizu Vol-1 0197: Greatest Common Divisor: Euclidean Algor...
// 2017.8.2

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

char *gets(char *);
char buf[100], *p;

int getInt(void)
{
	int n = 0;
	while (isspace(*p)) p++;
	while (isdigit(*p)) n = 10 * n + (*p++ - '0');
	return n;
}

int main()
{
	int a, x, y, k;

	while (1) {
		gets(p = buf); x = getInt(), y = getInt();
		if (!x) break;
		if (x < y) a = x, x = y, y = a;
		k = 0;
		while (y) {
			x = x % y;
			a = x, x = y, y = a;
			k++;
		}
		printf("%d %d\n", x, k);
	}
	return 0;
}

Measured memory_bytes: 524
n = 0
m = 0
aa = []
bb = []


def match(y0, x0):
    global m, aa, bb
    for i, y in enumerate(range(y0, y0 + m)):
        if aa[y][x0:(x0 + m)] != bb[i]:
            return False
    return True


def main():
    global n, m, aa, bb
    n, m = map(int, input().split())
    aa = [input() for _ in range(n)]
    bb = [input() for _ in range(m)]
    for y0 in range(n - m + 1):
        for x0 in range(n - m + 1):
            if match(y0, x0):
                print('Yes')
                return
    print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
# python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def lprint(l): print(*l, sep='\n')
def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

H,W = imn()

D = [[INF for _ in range(10)] for _ in range(10)]
for i in range(10):
    c = iln()
    for j in range(10):
        D[i][j] = c[j]

for k in range(10):
    for i in range(10):
        for j in range(10):
            D[i][j] = min(D[i][j], D[i][k]+D[k][j])

A = [iln() for _ in range(H)]
ans = 0
for i in range(H):
    for j in range(W):
        if A[i][j] != -1:
            ans += D[A[i][j]][1]
print(ans)





Measured memory_bytes: 5676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

void INX(){}
template<typename Head, typename... Tail>
void INX(Head&& head, Tail&&... tail)
{
    cin >> head;
    INX(forward<Tail>(tail)...);
}
void OUTX(){}
template<typename Head, typename... Tail>
void OUTX(Head&& head, Tail&&... tail)
{
    cout << head << endl;
    OUTX(forward<Tail>(tail)...);
}

#define ADD emplace_back
#define MP make_pair
#define VVEC(type) vector<vector<type>>


int main()
{
    ll a, b, c, d;
    INX(a,b,c,d);

    ll result;
    result = max(a * c, a * d);
    result = max(result, b * c);
    result = max(result, b * d);
    OUTX(result);

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
//printf("%.12lf\n",mid);
//const long long sze = 2*(2^(long long)(ceil(log(100000)/log(2))));
/*
// get part of decimal
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
const long long mod = 1000000007;
const double eps = .0000000001;
inline void prep()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
};

int main(){
    prep();
    ofstream fout("poetry.out");
    ifstream fin("poetry.in");
    int n, k;
    cin >> n >> k;
    vector<pair<long long, int> > ones;
    long long typemax[n+1] = {0};
    for (int i=0; i<n; i++){
      int type, amt;
      cin >> type >> amt;
      ones.push_back({amt, type});
      
    }
    sort(ones.rbegin(), ones.rend());
    long long currsum = 0;
    bool already[n+1] = {false};
    int amt[n+1] = {0};
    long long types = 0;
    for (int i=0; i<k; i++){
      currsum += ones[i].first;
      if (!already[ones[i].second]){
        already[ones[i].second] = true;
        types++;
      }
      
      amt[ones[i].second]++;
    }
    for (int i=0; i<n; i++){
      if (ones[i].first > typemax[ones[i].second] && !already[ones[i].second]){
        typemax[ones[i].second] = ones[i].first;
      }
    }
    
    vector<long long> maxtypes;
    for (int i=1; i<=n; i++){
      if (typemax[i] == 0){
        continue;
      }
      maxtypes.push_back(typemax[i]);
    }
    sort(maxtypes.rbegin(), maxtypes.rend());
    // record maxes of each type
    // sort them

    long long currmult = types*types;
    int currlast = k-1;
    int curr = 0;
    long long maxx = currmult+currsum;
    for (int i=k-1; i>=1; i--){
      if (amt[ones[i].second] == 1){
        continue;
      }
      if (curr >= maxtypes.size()){
        break;
      }
      amt[ones[i].second]--;
      long long currval = maxtypes[curr];
      currsum -= ones[i].first;
      currsum += currval;
      //cout << currval << endl;
      types++;
      //cout << currsum << endl;
      if (currsum+types*types > maxx){
        maxx = currsum+types*types;
      }
      curr++;
    }
    cout << maxx;
    return 0;
}      



Measured memory_bytes: 4080
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,k,ma=0;
  cin>>k>>n;
  vector<int> a(n);
  for(int i=0;i<n;++i){
    cin>>a[i];
  }
  for(int i=0;i<n-1;++i){
    ma=max(ma,a[i+1]-a[i]);
    //cout<<ma<<' ';
  }
  ma=max(ma,k-a[n-1]+a[0]);
  cout<<k-ma<<endl;
}

Measured memory_bytes: 4060
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut simple_edges = vec![Vec::new(); n];
    let mut pairs = vec![];
    for _ in 1..n {
        let v = read_vec::<usize>();
        let (a, b) = (v[0] - 1, v[1] - 1);
        simple_edges[a].push(b);
        simple_edges[b].push(a);
        pairs.push((a, b));
    }
    let mut c = read_vec::<u64>();
    c.sort();

    let root = 0usize;
    let mut tree: Vec<Vec<usize>> = vec![Vec::new(); n];
    let mut parent_dict: HashMap<usize, usize> = HashMap::new();
    make_tree(root, n, &simple_edges, &mut tree, &mut parent_dict);
    let mut topological_sorted_indexes = vec![root];
    topological_dfs(root, &tree, &mut topological_sorted_indexes);

    let mut scores = vec![0; n];
    for (i, &ti) in topological_sorted_indexes.iter().rev().enumerate() {
        scores[ti] = c[i];
    }
    let mut sum_score = 0;
    for &pair in pairs.iter() {
        sum_score += min(scores[pair.0], scores[pair.1]);
    }
    println!("{:?}", sum_score);
    print_array(&scores);
}

fn print_array<T: std::string::ToString>(array: &Vec<T>) {
    println!(
        "{}",
        array
            .iter()
            .map(|ref x| x.to_string())
            .collect::<Vec<_>>()
            .join(" ")
    );
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
fn make_tree(
    cur_idx: usize,
    parent_idx: usize,
    edges: &Vec<Vec<usize>>,
    tree: &mut Vec<Vec<usize>>,
    parent_dict: &mut HashMap<usize, usize>,
) {
    for child_idx in edges[cur_idx].iter() {
        if *child_idx == parent_idx {
            continue;
        }
        tree[cur_idx].push(*child_idx);
        parent_dict.insert(*child_idx, cur_idx);
        make_tree(*child_idx, cur_idx, edges, tree, parent_dict);
    }
}

fn topological_dfs(cur_idx: usize, tree: &Vec<Vec<usize>>, result: &mut Vec<usize>) {
    for child_idx in tree[cur_idx].iter() {
        result.push(*child_idx);
        topological_dfs(*child_idx, tree, result);
    }
}


Measured memory_bytes: 10364
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<string>
#include<set>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)
typedef long long ll;

int main(){
    int x;
    cin>>x;
    int c=int((x-600)/200)+1;
    if(x<600) c=0;
    cout<<8-c<<endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF 1LL<<60
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;
const int mod = 1e9 + 7;


int main(){
    ll n,m,l; cin >> n >> m >> l;
    vvl G(n, vl(n,LINF));
    rep(i,m){
        ll a,b,c; cin >> a >> b >> c;
        a--; b--;
        if(c <= l){
            G[a][b] = c;
            G[b][a] = c;
        }
    }
    rep(i,n) rep(j,n) if(i==j) G[i][j] = 0;
    rep(k,n){
        rep(i,n){
            rep(j,n) G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
        }
    }
    rep(i,n){
        rep(j,n){
            if(i==j) continue;
            if(G[i][j] <= l) G[i][j] = 1;
        }
    }
    rep(k,n){
        rep(i,n){
            rep(j,n){
                G[i][j] = min(G[i][j],G[i][k]+G[k][j]);
            }
        }
    }
    ll q; cin >> q;
    while(q--){
        ll s,t; cin >> s >> t;
        s--; t--;
        if(G[s][t] != LINF) cout << G[s][t]-1 << endl;
        else puts("-1");
    }
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

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

  int res = h/a;
  if(h%a) res++;

  cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

long long lcm(long long a, long long b){
    return (a / gcd(a, b)) * b;
}

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

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

    if (a % 2 == 0 || b % 2 == 0) {
        cout << "Even" << endl;
    } else {
        cout << "Odd" << endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>

int main()
{
	int	a, b;
	char op;
	int answer;

	
	while(1){
		scanf("%d %c %d", &a, &op, &b);
		if(op == '?')break;
		
		if(op == '+'){
			answer = a + b;
		}else if(op == '-'){
			answer = a - b;
		}else if(op == '*'){
			answer = a * b;
		}else if(op == '/'){
			answer = a / b;
		}
		printf("%d\n", answer);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

void solve()
{
    ll n;
    cin>>n;
    ll a[n];
    ll i;
    mll m;
    for(i=0;i<n;i++)
    {
         cin>>a[i];
         m[a[i]]++;
    }
    ll res=0;
    
    for(auto it:m)
    {
        ll no=it.second;
        no=(no*(no-1))/2;
        res+=no;
    }

    for(i=0;i<n;i++)
    {
        ll no=a[i];
        ll tans=res-(m[no]-1);
        cout<<tans<<"\n";
    }
    


}


int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

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

int h[6], w[6];
int main() {
	map<int, int>t;
	rep(i, 6) {
		cin >> h[i] >> w[i];
		t[h[i]]++;
		if (h[i] != w[i])t[w[i]]++;
	}
	if (t.size() > 3) {
		puts("no"); return 0;
	}
	if (t.size() == 1)puts("yes");
	if (t.size() == 2) {
		auto p1 = *t.begin(), p2 = *t.rbegin();
		if ((p1.second == 6 && p2.second == 4) || (p1.second == 4 && p2.second == 6))puts("yes");
		else puts("no");
	}
	if (t.size() == 3) {
		auto p1 = *t.begin(), p2 = *++t.begin(), p3 = *t.rbegin();
		if (p1.second == 4 && p2.second == 4 && p3.second == 4)puts("yes");
		else puts("no");
	}
}

Measured memory_bytes: 3084
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {        
    int a, b, x;
    cin >> a >> b >> x;
    if (x >= a && x <= a + b) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 3628