akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef pair<int, int>P;

int c[6], cost[110][1 << 6], m, n, k, d;
struct st {
	int a, b, c;
};
int num(string s) {
	if (s == "H")return m + n;
	if (s == "D")return m + n + 1;
	if (s[0] == 'C')return s[1] - '1';
	return stoi(s.substr(1)) - 1 + m;
}
int main() {
	while (scanf("%d%d%d%d", &m, &n, &k, &d), m) {
		rep(i, m)scanf("%d", &c[i]);
		vector<st>v;
		rep(i, d) {
			string s, t; int e; cin >> s >> t >> e; e *= k;
			v.push_back({ num(s),num(t),e });
			v.push_back({ num(t),num(s),e });
		}
		memset(cost, 0x3f, sizeof(cost));
		cost[m + n][0] = 0;
		bool update = true;
		while (update) {
			update = false;
			for (st e : v) {
				rep(i, 1 << m) {
					if (cost[e.a][i] == INF)continue;
					if (e.b < m) {
						if (!(i >> e.b & 1) && cost[e.b][i | 1 << e.b] > cost[e.a][i] + e.c - c[e.b])
							cost[e.b][i | 1 << e.b] = cost[e.a][i] + e.c - c[e.b], update = true;
					}
					else if (cost[e.b][i] > cost[e.a][i] + e.c)
						cost[e.b][i] = cost[e.a][i] + e.c, update = true;
				}
			}
		}
		int Min = INF;
		rep(i, 1 << m)Min = min(Min, cost[m + n + 1][i]);
		printf("%d\n", Min);
	}
}

Measured memory_bytes: 3228
solve [a,b,c] = [s,l,h]
	where 
		c' = c*pi/180
		s = a * b * sin c' / 2
		l = a + b + sqrt (a^2 + b^2 - 2*a*b*cos c')
		h = b * sin c'

main = getLine >>= mapM_ print . solve . map read . words

Measured memory_bytes: 4060
n, q = [int(i) for i in input().split()]
s = input()
l = []
r = []
for _ in range(q):
    i, k = [int(i) for i in input().split()]
    l.append(i)
    r.append(k)

cum_sum = [0]
for i in range(n-1):
    if s[i:i+2] == 'AC':
        cum_sum.append(cum_sum[-1]+1)
    else:
        cum_sum.append(cum_sum[-1])
else:
    cum_sum.append(cum_sum[-1])

for i, k in zip(l, r):
    print(cum_sum[k-1] - cum_sum[i-1])


Measured memory_bytes: 14212
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define all(x) x.begin(),x.end()
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
 
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

//
int main(void) {
    string s;
    cin >> s;
    if(s.size()==3){
        string tmp = "abc";
        tmp[0] = s[0];
        s[0] = s[2];
        s[2] = tmp[0];
    }
    cout << s << endl;
    return 0;
}

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

using namespace std;

int main(int argc, char *argv[]) {
  int n;
  cin >> n;
  int c1 = 0, c2 = 0, c3 = 0;
  for (int i = 0; i < n; i++) {
    int t, cnt = 0;
    cin >> t;
    while (t % 2 == 0) {
      t /= 2;
      cnt++;
    }
    if (cnt == 0) {
      c1++;
    } else if (cnt == 1) {
      c2++;
    } else {
      c3++;
    }
  }
  if (c2) c1++;
  cout << (c3 + 1 >= c1 ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		n = sc.nextInt();

		if(n == 1) {
			System.out.println("Hello World");
		} else {
			a = sc.nextInt();
			b = sc.nextInt();
			System.out.println(a + b);
		}
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << '\n';}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
const constexpr ll mod = 1000000007;
template<typename C, typename T>
ll modpow(C a, T b) {
	ll res = 1;
	while (b) {
		if (b & 1) (res *= a) %= mod;
		(a *= a) %= mod;
		b >>= 1;
	}
	return res;
}
template<typename C, typename T>
ll modcomb(C a, T b) {
	if (a < 0 || b < 0 || a < b) return 0;
	chmin(b, a - b);
	ll ansMul = 1, ansDiv = 1;
	rep(i, 0, b) {
		(ansMul *= (a - i)) %= mod;
		(ansDiv *= (i + 1)) %= mod;
	}
	return ansMul * modpow(ansDiv, mod - 2) % mod;
}
void solve() {
	var(int, n, m);
	ll ans = 1;
	for (int i = 2; i * i <= m; ++i) {
		if (m % i == 0) {
			int cnt = 0;
			while(m % i == 0) {
				m /= i;
				++cnt;
			}
			(ans *= modcomb(n + cnt - 1, n - 1)) %= mod;
		}
	}
	if (m != 1) {
		(ans *= n) %= mod;
	}
	print(ans);
}
int main() {
	solve();
	return 0;
}


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

void Main()
{
    int h, a;
    cin >> h >> a;
    cout << (h+a-1)/a << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 3560
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstring>
#include<string>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a%b)cout<<a/b+1;
	else cout<<a/b; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST_INPUT ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long

using namespace std;

const int mxn = 1e5 + 100;
int n, m;
vector<int> adj[mxn];
int inDegree[mxn];
int dist[mxn];
bool visited[mxn];


void dfs(int v) {
	visited[v] = true;
	for (int u: adj[v]) {
		dist[u] = max(dist[u], dist[v] + 1);
		inDegree[u]--;
		if (inDegree[u] == 0) {
			dfs(u);
		}
	}
}

void solve() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int x, y; cin >> x >> y;
		x--; y--;
		adj[x].push_back(y);
		inDegree[y]++;	
	}

	for (int i = 0; i < n; i++) {
		if (!visited[i] && inDegree[i] == 0) {
			dfs(i);
		}
	}

	int res = -1;
	for (int d: dist) {
		res = max(res, d);
	}


	cout << res << endl;
}

int main() {
    FAST_INPUT;
 	solve();
    return 0;
}


Measured memory_bytes: 9728
#![allow(dead_code)]
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 read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main() {
    let n: usize = read();
    let a: Vec<u32> = read_vec();
    let x = a.iter().fold(0, |s, x| s ^ *x);
    for i in 0..n {
        print!("{}{}", a[i] ^ x, if i == n - 1 {"\n"} else {" "});
    }
}


Measured memory_bytes: 6300
#include <stdio.h>
#define N 8
#define F -1
#define NF 1

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
char ban[N][N];

void check();
void putQueen(int);
void initialize();

int main(){
  int n,p,q,i,j;

for(i=0;i<N;i++){
  for(j=0;j<N;j++){
    ban[i][j]='.';
  }
}

initialize();

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d%d",&p,&q);
    ban[p][q]='Q';
  }

  putQueen(0);

  

return 0;
}


void initialize(){
  int i;
  for(i=0;i<N;i++){
    row[i]=F;
    col[i]=F;
  }
  for(i=0;i<2*N-1;i++){
    dpos[i]=F;
    dneg[i]=F;
  }
}

void check(){
  int i,j;

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(ban[i][j]=='Q'){
        if(row[i]!=j)
        return;
      }
    }
  }

for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j){
        ban[i][j]='Q';
      }
    }
  }

for(i=0;i<N;i++){
  for(j=0;j<N;j++){
    printf("%c",ban[i][j]);
  }
  printf("\n");
}

}

void putQueen(int x){
   int i,j;

   if(x==N){
     check();
       return;
   }

    for(i=0;i<N;i++){
       if(col[i]==NF||dpos[x+i]==NF||dneg[x-i+N-1]==NF) {
         continue;
       }
       
       row[x]=i;
       col[i]=NF;
       dpos[x+i]=NF;
       dneg[x-i+N-1]=NF;
       
       putQueen(x+1);
       
       row[x]=F;
       col[i]=F;
       dpos[x+i]=F;
       dneg[x-i+N-1]=F;

       
    }
 
}



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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  ll n, m;
  cin >> n >> m;

  Graph sw(m);
  vll p(m);

  REP(i, m) {
    ll num;
    cin >> num;
    REP(j, num) {
      ll s_in;
      cin >> s_in;
      sw[i].push_back(s_in - 1);
    }
  }
  REP(i, m) {
    cin >> p[i];
  }

  ll count = 0;
  REP(i, pow(2, n)) {
    REP(j, m) { //条件
      ll buf = 0;
      REP(k, sw[j].size()) {
        buf += (i & (1 << sw[j][k])) >> sw[j][k];
      }
      if (buf % 2 != p[j]) {
        break;
      }
      if (j == m - 1) {
        count++;
      }
    }
  }

  COUT(count);
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}

/*
5 2
3 1 2 5
2 2 3
1 0
*/


Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
int main(){
  int v,e;
  cin>>v>>e;
  vector<vector<int> > adj(v+1);
  vector<bool> vis(v+1);
  vector<int> ans(v+1,-1);
  int a,b;
  for(int i=0;i<e;i++){
    cin>>a>>b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  queue<int> q;
  q.push(1);
  vis[1]=1;
  while(!q.empty()){
    int u=q.front();q.pop();
    for (auto j:adj[u]){
      if(!vis[j]){
        ans[j]=u;
        vis[j]=1;
        q.push(j);
      }
    }
  }
  int k=1;
  for(int i=2;i<=v;i++){
    if(ans[i]==-1) k=0;
  }
  if(k==0){
    cout<<"No"<<endl;
    return 0;
  }
  else{
    cout<<"Yes\n";
    for(int i=2;i<=v;i++)
      cout<<ans[i]<<endl;
  }
}
    
      
    

Measured memory_bytes: 10256
#include<stdio.h>
int main(){
  int x,y,i,j,n;
  scanf("%d %d",&x,&y);
  if(y>x){
    j=y;
    y=x;
    x=j;
  }
  n=x%y;
  while(n!=0){
    x = y;
    y = n;
    n = x % y;
  }
      printf("%d\n",y);
  return 0;
}



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

int main() {
	
	long long n, i;
	cin >> n ;
	long long h[n];
	for(i=0;i<n;i++) {
		cin >> h[i];
	}
	long long  men[n], h1, h2;
	
	for(i = 0; i < n; i++) men[i] = 1000000000;
	
	men[0] = 0;
	men[1]=h[0]-h[1];
	
	if(men[1]<0) men[1]*=-1;
	
	for(i=2;i<n;i++) {
		
		h1=h[i]-h[i-1];
		if(h1<0) h1*=-1;
		h2=h[i]-h[i-2];
		if(h2<0) h2*=-1;
		
		men[i]=min( (men[i-1]+h1), (men[i-2]+h2) );
		
	}
	cout << men[n-1];
	
	return 0;
	
}

Measured memory_bytes: 1792
extern crate core;

use std::io::{self, Read};

#[macro_export]
macro_rules! input {
  ($s:expr=>$($t:tt)*) => {
    let mut lines=$s.split("\n");
    $(
        line_parse!(lines,$t);
    )*
  };
}

macro_rules! line_parse {
  ($lines:expr,($($name:ident:$t:tt)*)) => {
    let mut line=$lines.next().unwrap().split_whitespace();
    $(value_def!(line,$name,$t);)*
  };

  //複数行
  ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
    values_def!($lines,$n,$name,$t);
  };
}

macro_rules! value_def {
    ($line:expr, $name:ident, $t:tt) => {
        let $name = value!($line, $t);
    };
}

macro_rules! values_def {
    ($lines:expr, $n:expr, $name:ident, $t:tt) => {
        let $name = {
            let mut vec = Vec::new();
            for i in 0..$n {
                let mut next = $lines.next().unwrap().split_whitespace();
                vec.push(value!(next, $t));
            }
            vec
        };
    };
}

macro_rules! value {
  //配列
  ($line:expr,[$t:tt]) => {
    $line.map(|x|{
      let mut iter=::std::iter::once(x);
      value!(iter,$t)
    }).collect::<Vec<_>>()
  };
  //タプル
  ($line:expr,($($t:tt),*)) => {
    ($(value!($line,$t),)*)
  };
  //文字列
  ($line:expr,#) => {
    $line.next().unwrap()
  };
  //インデックス(-1)
  ($line:expr,@) => {
    $line.next().unwrap().parse::<usize>().unwrap()-1
  };
  //単一値
  ($line:expr,$t:ty) => {
    $line.next().unwrap().parse::<$t>().unwrap()
  };
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(a:i64 b:i64 c:i64 d:i64));
    let x = std::cmp::min(b, d) - std::cmp::max(a, c);
    if x < 0 { 0 } else { x }.to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}
tests! {
    test1: "0 75 25 100" => "50",
    test2: "0 33 66 99" => "0",
    test3: "10 90 20 80" => "60",
}


Measured memory_bytes: 4352
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn= new Scanner(System.in);
		int n =scn.nextInt();
		int k =scn.nextInt();
		  HashSet<Integer> hs =new HashSet<>();
		  for(int i=0;i<k;i++){
			  int d =scn.nextInt();
			  for(int  j=0;j<d;j++){
				  hs.add(scn.nextInt());
			  }
		  }
		
                   System.out.println(n-hs.size());
	}

}

Measured memory_bytes: 46184
# Problem D - I hate Factorization

# input
X = int(input())

# initialization
ans_list = [0, 0]

# count
for a in range(-500, 501):
    for b in range(-500, 501):
        if a**5-b**5==X:
            ans_list[0] = a
            ans_list[1] = b
            break

# output
print(" ".join(map(str, ans_list)))


Measured memory_bytes: 9092
#include <bits/stdc++.h>
using namespace std;
int main(){
  int D,N,a=1;
  cin>>D>>N;
  if(N<100) a*=N;
  else a*=N+1;
  if(D==1) a*=100;
  else if(D==2) a*=10000;
  cout<<a<<endl;
}

Measured memory_bytes: 256
//専用ライブラリ
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e6
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int cmp(P a,P b){
        if(a.fi!=b.fi)
        return a.fi>b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define N 100005

int n,M[101][101];

void dijkstra(){
    int minv;
    int d[101],color[101];
    
    for(int i=0;i<n;i++){
        d[i]=INF;
        color[i]=WHITE;
    }
    d[0]=0;
    color[0]=GRAY;
    while(1){
        minv=INF;
        int u=-1;
        for(int i=0;i<n;i++){
            if(minv>d[i]&&color[i]!=BLACK){
                u=i;
                minv=d[i];
            }
        }
        if(u==-1)//没有点了
            break;
        color[u]=BLACK;
        for(int v=0;v<n;v++){
            if(color[v]!=BLACK&&M[u][v]!=INF){
                if(d[v]>d[u]+M[u][v]){
                    d[v]=d[u]+M[u][v];
                    color[v]=GRAY;
                }
            }
        }
    }
    for(int i=0;i<n;i++){
        cout<<i<<" "<<(d[i]==INF ? -1 : d[i])<<endl;
    }
}
//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    cin>>n;
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++){
            M[i][j]=INF;
        }
    int k,c,u,v;
    for(int i=0;i<n;i++){
        cin>>u>>k;
        for(int j=0;j<k;j++){
            cin>>v>>c;
            M[u][v]=c;
        }
    }
    dijkstra();
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------



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

/*
 * ref. https://qiita.com/drken/items/97e37dd6143e33a64c8c
 */

using namespace std;

bool cond(const vector<int> &xs, int ind, int val) {
    return xs[ind] >= val;
}

/*
 * Return the minimum index which satisfies the condition if exists, otherwise -1.
 */
int binary_search(const vector<int> &xs, int val) {
    int left = -1, right = (int) xs.size(), mid;
    while (right - left > 1) {
        mid = (left + right) / 2;
        if (cond(xs, mid, val)) right = mid;
        else left = mid;
    }

    if (right == (int) xs.size()) {
        return -1;
    } else if (xs[right] != val) {
        return -1;
    } else {
        return right;
    }
}

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

    vector<int> xs;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        xs.push_back(x);
    }

    int q;
    cin >> q;

    int count = 0;
    for (int i = 0; i < q; i++) {
        int y;
        cin >> y;

        if (binary_search(xs, y) >= 0) {
            count++;
        }
    }

    cout << count << endl;

    return 0;
}



Measured memory_bytes: 3536
#include<stdio.h>

int main(void)
{
	int a ,i;
	long long int sum = 0 ,min ,max ,n; 
	scanf("%d" ,&a);
	for(i = 0; i < a; i++){
		scanf("%lld" ,&n);
	if(i == 0){
		min = n;
		max = n;
	}
	if(min > n){
		min = n;
	}
	if(max < n){
		max = n;
	}
	sum += n;
	}
	printf("%lld %lld %lld\n",min, max, sum);
 
  return 0;
   
}


Measured memory_bytes: 2108
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return


ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////

int main(){
    ll n,m;
    cin >> n >> m;
    ll a = 0;
    rep(i,0,m){
	ll aa;
	cin >> aa;
	a += aa;
    }

    if(n < a)P(-1);
    else P(n - a);
    
    return  0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = INT_MAX;
const ll LLINF = INT64_MAX;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (true)
    {
        ll n, m;
        cin >> n >> m;
        if (n == 0 && m == 0)
        {
            break;
        }
        vector<ll> p(n + 1, 0);
        for (ll i = 1; i < n + 1; i++)
        {
            cin >> p[i];
        }
        vector<ll> kouho;
        for (ll i = 0; i < n + 1; i++)
        {
            for (ll j = 0; j < n + 1; j++)
            {
                kouho.push_back(p[i] + p[j]);
            }
        }
        sort(ALL(kouho));
        ll sz = kouho.size();
        ll ans = 0;
        for (ll i = 0; i < sz; i++)
        {
            ll v = m - kouho[i];
            if (v < 0)
            {
                continue;
            }
            auto itr = upper_bound(ALL(kouho), v);
            if (itr == kouho.begin())
            {
                continue;
            }
            itr--;
            chmax(ans, kouho[i] + *itr);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 19060
// チーズ
//
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int H,W,N;
    cin >> H >>W >> N;
    char maze[H][W];
    for(int i=0;i<H;i++){
        cin >> maze[i];
    }

    vector<pair<int, int> > target(N+1);// スタートとチーズの位置情報の読取、スタートの位置をpair target[0]に、1番目のチーズをpairでtarget[1]に・・・
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            int temp=maze[i][j]-0x30;// char型から0x30を引くと、char型の0がintの0に
            if(0<temp && temp<10){target[temp] = make_pair(i,j);}
            else if(maze[i][j]=='S'){target[0] = make_pair(i,j);}
        }
    }
    
    int totalstep=0;
    for(int k=0;k<N;k++){
        int step[H][W];//歩数の記録用データ
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                step[i][j]=-1;//マップ上の歩数データをすべて-1で初期化する
            }
        }
        step[target[k].first][target[k].second]=0;//スタート地点の歩数を 0 に設定
        queue<pair<int, int> >q;// キュー q を定義
        q.push(target[k]);//スタート地点をqにプッシュ
        int answer=0;
        while(q.empty()==false){
            pair<int, int> cursor=q.front(); //　現在地をcursorに読み込む
            q.pop();
            int gyo=cursor.first;
            int retsu=cursor.second;
            if(gyo==target[k+1].first && retsu==target[k+1].second){answer=step[gyo][retsu];break;}//ゴール地点ならその地点に記録した歩数をanswerに代入
            //今の地点の四方を見て、Xでなく、なおかつまだ歩数が設定されていないなら、今の地点＋１の歩数を代入する
            if(gyo>0 && maze[gyo-1][retsu]!='X' && step[gyo-1][retsu]==-1){step[gyo-1][retsu]=step[gyo][retsu]+1;q.push(make_pair(gyo-1,retsu));}
            if(gyo<H-1 && maze[gyo+1][retsu]!='X' && step[gyo+1][retsu]==-1){step[gyo+1][retsu]=step[gyo][retsu]+1;q.push(make_pair(gyo+1,retsu));}
            if(retsu>0 && maze[gyo][retsu-1]!='X' && step[gyo][retsu-1]==-1){step[gyo][retsu-1]=step[gyo][retsu]+1;q.push(make_pair(gyo,retsu-1));}
            if(retsu<W-1 && maze[gyo][retsu+1]!='X' && step[gyo][retsu+1]==-1){step[gyo][retsu+1]=step[gyo][retsu]+1;q.push(make_pair(gyo,retsu+1));}
        }
        totalstep+=answer;
    }
    cout << totalstep << endl;
    return 0;
}


Measured memory_bytes: 8024
inpl = lambda: list(map(int,input().split()))
N = int(input())
S = input()

character_pos = [ set() for _ in range(26) ]
for i in range(N):
    character_pos[ord(S[i])-ord('a')].add(i)

ans = 0
continue_list = dict()
for i in range(N):
    s = S[i]
    new_continue_list = dict()
    for p in character_pos[ord(s)-ord('a')]:
        if p < i:
            new_continue_list[p] = 1
    for k, v in continue_list.items():
        if s == S[k+1]  and v + 1 <= i - k - 1:
            new_continue_list[k+1] = v+1
        elif v > ans:
            ans = v
    continue_list = new_continue_list

if len(continue_list.values()) > 0:
    ans = max(ans, max(continue_list.values()))
print(ans)

Measured memory_bytes: 92508
#include <iostream>
#include <cstdio>

using namespace std;

void solve(int a, int b, int c, int d, int e, int f) {
	double x = (f - (double)e*c/b) / (d - (double)e*a/b);
	double y = (c - a*x) / b;
	if (x == 0) x = 0.000;
	if (y == 0) y = 0.000;
	printf("%4.3f %4.3f\n", x, y);
}

int main() {
	int a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		solve(a,b,c,d,e,f);
	}
	return 0;
}

Measured memory_bytes: 1192
#include <cstdio> 
#include <cstdlib> 
#include <cmath> 
#include <cstring> 
#include <climits> 
#include <cfloat> 
#include <map> 
#include <utility> 
#include <set> 
#include <iostream> 
#include <memory> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <functional> 
#include <sstream> 
#include <complex> 
#include <stack> 
#include <queue> 
#include <numeric>
#include <cassert>

#define FOR(i, min, max) for (int i = (min); i < (max); ++i) 
#define FORE(i, min, max) for (int i = (min); i <= (max); ++i) 
#define REP(i, n) for (int i = 0; i < (n); ++i) 
#define REPV(vec, i) for (int i = 0; i < (int)(vec.size()); ++i) 
#define FOR_EACH(vec, it) for (typeof((vec).begin()) it = (vec).begin(); it != (vec).end(); ++it)

using namespace std; 
static const double EPS = 1e-12; 
typedef long long ll; 

int main(void)
{
    ll X;
    cin >> X;
    ll n = 100;
    int year = 0;
    while(n < X) {
        n += (n / 100LL);
        year++;
    }
    cout << year << endl;
    return 0;
}


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

#define ten(n) ((int)1e##n)
// dump macro{{{
// http://www.creativ.xyz/dump-cpp-652
#define DUMPOUT cerr // 変数ダンプ先。coutかcerr

#ifdef PCM
// 引数はいくつでもどんな型でも可（ストリーム出力演算子があればOK）
#define dump(...) DUMPOUT<<"  "; \
  DUMPOUT<<#__VA_ARGS__; \
  DUMPOUT<<":=> "; \
  dump_func(__VA_ARGS__); DUMPOUT<<"in ["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl;
#define dump_1d(x,n) DUMPOUT <<"  " \
  <<#x<<"["<<#n<<"]"<<":=> {"; \
  rep(i,n){ DUMPOUT << x[i] << (((i)==(n-1))?"}":", "); } DUMPOUT <<" in [" << __LINE__ << "]" << endl;

#define dump_2d(x,n,m) DUMPOUT <<"  " \
    <<#x<<"["<<#n<<"]"<<"["<<#m<<"]"<<":=> \n"; \
    rep(i,n)rep(j,m){ DUMPOUT << ((j==0)?"     |":" ") << x[i][j] << (((j)==(m-1))?"|\n":" "); } \
    DUMPOUT <<"  in [" << __LINE__ << "]" << endl;
#else
#define dump(...) 42
#define dump_1d(...) 42
#define dump_2d(...) 42
#endif

// デバッグ用変数ダンプ関数
void dump_func() {
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail)
{
    DUMPOUT << head;
    if (sizeof...(Tail) == 0) {
        DUMPOUT << " ";
    }
    else {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i<vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}/*}}}*/

#define rep(i, x) for(int i = 0; i < (int)(x); i++)/*{{{*/
#define reps(i,x) for(int i = 1; i <= (int)(x); i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define foreach(x,a) for(auto& (x) : (a) )
#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define INF 2147483647
#define INFLL 1000000000000000000LL
#define MOD 1000000007/*}}}*/

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;/*{{{*/
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<pii,vii,greater<pii> > spq;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*}}}*/


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

  int x[n], y[n];
  rep(i,n){
    cin>>x[i];
    y[i]=x[i];
  }
  sort(x,x+n);

  int l = x[n/2-1];
  int r = x[n/2];

  rep(i,n){
    if(y[i]<=l){
      cout << r << endl;
    }
    else if(y[i]>=r){
      cout << l << endl;
    }
  }


  return 0;
}


Measured memory_bytes: 3712
a, b, c = map(int, input().split())

A = [list(map(int, input().split())) for _ in range(a)]
B = [list(map(int, input().split())) for _ in range(b)]

for i in range(a):
    for j in range(c):
        tmp = 0
        for k in range(b):
            tmp += A[i][k] * B[k][j]

        print(tmp, end="")

        if j != c-1:
            print(" ", end="")
    print()


Measured memory_bytes: 6564
N,M,X=map(int,input().split())
CA=[list(map(int,input().split())) for i in range(N)]

ans=13*pow(10,5)

for i in range(pow(2,N)):
    judge=str(bin(i))[2:].rjust(N,"0")
    #print(judge)
    cost=0
    li=[0]*M
    for j,s in enumerate(judge):
        if s=="1":
            cost+=CA[j][0]
            for k,a in enumerate(CA[j][1:]):
                li[k]+=a
    #print(li)
    if min(li)>=X:
        ans=min(ans,cost)
if ans==13*pow(10,5):
    ans=-1
print(ans)

Measured memory_bytes: 9228
w,h,n = map(int, input().split())
bl = [0,0]
br = [w,0]
ul = [0,h]
ur = [w,h]
for _ in range(n):
    x,y,a = map(int, input().split())
    if a == 1:
        bl[0],ul[0] = max(x,bl[0]),max(x,ul[0])
    elif a == 2:
        br[0],ur[0] = min(x,br[0]),min(x,ur[0])
    elif a == 3:
        bl[1],br[1] = max(y,bl[1]),max(y,br[1])
    else:
        ul[1],ur[1] = min(y,ul[1]),min(y,ur[1])
print(max(br[0]-bl[0],0)*max(ul[1]-bl[1],0))

Measured memory_bytes: 3064
#include<stdio.h>

int main(void){
    long A,B,C,K;
    scanf("%ld %ld %ld %ld",&A,&B,&C,&K);

    if(K<=A){
        printf("%d",K);
    }
    else if(K<=A+B && K>A){
        printf("%d",A);
    }
    else
    {
        printf("%d",A-(K-A-B));
    }
    return 0;
}

Measured memory_bytes: 1732
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            ll n,m;
            cin>>n>>m;
            ll ans=n*(n-1)/2+m*(m-1)/2;
            cout<<ans<<endl;
        }
        return 0;
    }


Measured memory_bytes: 256
#include<stdio.h>

int main(){

	int m,n,count,result,i,j;
	int a;


		result=0;
		scanf("%d %d",&m,&n);
		/*if(m==0&&n==0){
			break;
		}*/
		for(i=0;i<m;i++){
			count=0;
			for(j=0;j<n;j++){
				scanf("%d",&a);
				count += a;
			}
			if(count>result){
				result=count;
			}
		}
		printf("%d\n",result);


	return(0);
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
struct node{
    int l, r;
};
const int N = 1e6 + 7;
string s[N];
int n;

vector<node>a;
vector<node>b;

bool cmp(node x, node y){
    return x.r < y.r;
}

bool cmp1(node x, node y){
    return x.l < y.l;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout .tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> s[i];
        int len = s[i].length();
        int l =0, r = 0;
        for(int j = 0; j < len; j++){
            if(s[i][j] == '(') l++;
            else if(l) l--;
            else r++;
        }
        if(l >= r) a.push_back({l, r});
        else b.push_back({l, r});
    }
    sort(a.begin(), a.end(), cmp);
    sort(b.begin(), b.end(), cmp1);
    int sum = 0, ok = 0;
    for(int i = 0; i < a.size(); i++){
        sum -= a[i].r;
        if(sum < 0){
            ok = 1;
            break;
        }
        sum += a[i].l;
    }
    int sum1 = 0;
    for(int i = 0; i < b.size(); i++){
        sum1 -= b[i].l;
        if(sum1 < 0){
            ok = 1;
            break;
        }
        sum1 += b[i].r;
    }
    if(ok){
       //cout << "No\n";
       //puts("No");
       printf("No\n");
    }else{
        if(sum == sum1){
            //cout << "Yes\n";
            //puts("Yes");
            printf("Yes\n");
        }else{
            //cout << "No\n";
           // puts("Yes");
           printf("No\n");
        }
    }

}

Measured memory_bytes: 42508
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
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; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18, MAX_N = 200000;

lint N, L, arr[100000];
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N >> L;
	lint st = -1;
	cin >> arr[0];
	REP(i, N - 1) {
		cin >> arr[i + 1];
		if (arr[i + 1] + arr[i] >= L) st = i;
	}
	if (st == -1) cout << "Impossible" << endl;
	else {
		cout << "Possible" << endl;
		vector<lint> ans;
		lint curr = st;
		if (st == N - 1) {
			while (curr != -1) {
				ans.push_back(curr);
				curr--;
			}
		}
		else {
			while (curr != N - 1) {
				ans.push_back(curr);
				curr++;
			}
			curr = st - 1;
			while (curr != -1) {
				ans.push_back(curr);
				curr--;
			}
		}
		reverse(ans.begin(), ans.end());
		REP(i, N - 1) {
			cout << ans[i] + 1 << endl;
		}
	}
}


Measured memory_bytes: 2548
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{   
    
    public void Slove()
    {
        var plans = Console.ReadLine().Distinct().ToArray();
        bool judge = 
            plans.Contains('N') == plans.Contains('S') &&
            plans.Contains('W') == plans.Contains('E');
        System.Console.WriteLine(judge ? "Yes" : "No");
    }
    
    static void Main(string[] args)
    {
        new Program().Slove();
    }
}


Measured memory_bytes: 13268
#define _For(idx, from, to, inc, cmp) \
	for(auto idx=(from) ; idx cmp (to) ; inc idx)
#define ForLE(idx, from, to) \
	_For(idx, from, to, ++, <=)
#define ForGE(idx, from, to) \
	_For(idx, from, to, --, >=)
#define ForLT(idx, from, to) \
	_For(idx, from, to, ++, <)
#define ForGT(idx, from, to) \
	_For(idx, from, to, --, >)
#define For(idx, from, to) \
	_For(idx, from, to, ++, <)
#include <iostream>

void DisableIOSync() {
	std::cin.tie(0);
	std::cout.tie(0);
	std::ios::sync_with_stdio(false);
}
#include <vector>
#include <algorithm>
int main() {
	DisableIOSync();
	int N;
	std::cin >> N;
	std::vector<uint32_t> ar(N);
	auto* dst = ar.data();
	For(i, 0, N) {
		uint32_t num;
		std::cin >> num;
		*dst++ = num;
	}
	std::sort(ar.begin(), ar.end());
	int cl = 0;
	int res = 0;
	while(cl < N) {
		bool flag = true;
		const auto base = ar[cl];
		int cr = cl+1;
		while(cr < N) {
			if(ar[cr] != base)
				break;
			flag ^= 1;
			++cr;
		}
		if(flag)
			++res;
		cl = cr;
	}
	std::cout << res << std::endl;
	return 0;
}


Measured memory_bytes: 1272
def wa(n):
    count=0
    for i in range(10):
        for j in range(10):
            for k in range(10):
                for l in range(10):
                    if n==i+j+k+l:
                        count +=1
                    elif n<i+j+k+l:
                        break
    return count
while True:
    try:
        n=int(input())
        print(wa(n))
    except:break       



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

int main()
{

    char s[5];
    cin>>s;
    bool t=false;
    for(int i=0;i<4;i++)
    {
        if(s[i]==s[i+1])
        {
            t=true;
        }
    }
    if(t)
    {
        cout<<"Bad"<<endl;
    }
    else
    {
        cout<<"Good"<<endl;
    }



    return 0;
}


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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;

using value_type = i64;


signed main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> edges(n);
    for(int i = 0; i < m; ++i){
        int a, b;
        cin >> a >> b;
        edges[--a].emplace_back(--b);
        edges[b].emplace_back(a);
    }
    unordered_set<int> s;
    deque<int> que;
    int a = 0, b = edges[0][0];
    s.insert(a);
    s.insert(b);
    que.push_front(a);
    que.push_back(b);
    while(1){
        bool fl = false;
        for(auto x : edges[a]){
            if(s.find(x) == s.end()){
                que.push_front(a = x);
                s.insert(a);
                fl = 1;
                break;
            }
        }
        for(auto x : edges[b]){
            if(s.find(x) == s.end()){
                que.push_back(b = x);
                s.insert(b);
                fl = 1;
                break;
            }
        }
        if(!fl)
            break;
    }
    cout << que.size() << endl;
    while(!que.empty()){
        cout << que.front() + 1 << " \n"[que.size() == 1];
        que.pop_front();
    }

}


Measured memory_bytes: 10788
h = int(input())
w=  int(input())
n = int(input())


sum = 0
if h > w:
    for i in range(h):
        sum = sum + h
        if n <= sum:
            print(int(sum/h))
            break
else:
    for i in range(w):
        sum = sum + w
        if n <= sum:
            print(int(sum/w))
            break



Measured memory_bytes: 2940
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define each(i,c) for(__typeof(c.begin()) i=c.begin();i!=c.end();i++)
#define pb push_back
#define mp make_pair
#define all(c) c.begin(),c.end()
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef long long ll;
const int inf=(int)1e9;
const double EPS=1e-9, INF=1e12;

int n, m;
bool v[100][3];
vector<vector<pi> > e;

int main(){
	while(cin >> n >> m, n){
		e.clear(); e.resize(n);
		rep(i, m){
			int a, b, c;
			cin >> a >> b >> c;
			a--; b--;
			e[a].pb(mp(b, c));
			e[b].pb(mp(a, c));
		}
		memset(v, 0, sizeof(v));
		priority_queue<pair<int, pi> > q;
		q.push(mp(0, mp(0, 0)));
		
		while(!q.empty()){
			int cost = q.top().first;
			int c = q.top().second.first, f = q.top().second.second;
			q.pop();
			
			if(v[c][f]) continue;
			v[c][f] = 1;
			
			if(c == n - 1 && f != 1){
				cout << -cost << endl;
				break;
			}
			
			if(f <= 1){
				rep(i, e[c].size()) if(!v[e[c][i].first][f + 1]) {
					q.push(mp(cost, mp(e[c][i].first, f + 1)));
				}
			}
			if(f != 1){
				rep(i, e[c].size()) if(!v[e[c][i].first][f]) {
					q.push(mp(cost - e[c][i].second, mp(e[c][i].first, f)));
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1216
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PI 3.1415926535897932384626433832795
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
long long MOD = 1e9+7;
pair<int,int> dx[4] = {{1,0},{-1,0},{0,1},{0,-1}};
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct chash {
    int operator()(int x) const { return x ^ RANDOM; }
};
string toString(long long x)
{
stringstream ss;
ss << x;
string str = ss.str();
return str;
}
long long fastpow(long long x,long long k)
{
    if(!k)
        return 1;
    if(k & 1)
        return ((x * fastpow(x,k-1) % MOD) % MOD) % MOD;
    long long ans = fastpow(x,k/2);
    ans %= MOD;
    ans *= ans;
    ans %= MOD;
    return ans;
}
long long sumF(long long x)
{
    int s = 0;
    while(x)
        s += x%10,x /= 10;
    return s;
}
int freq[26];
long long dp[26];
long long solve(int idx)
{
    if(idx == 26)
        return 1;
    if(dp[idx] != -1)
        return dp[idx];
    long long C1 = freq[idx] * solve(idx + 1);
    long long C2 = solve(idx + 1);
    return dp[idx] = ((C1 % MOD) + (C2 % MOD)) % MOD;
}
int main()
{
    memset(dp,-1,sizeof dp);
    IO;
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i = 0;i < s.length();i++)
        freq[s[i] - 'a']++;
    cout << (((solve(0) - 1) % MOD) + MOD) % MOD;
    return 0;
}


Measured memory_bytes: 512
x = int(input())

if x<=599:
    print(8)
elif x<=799:
    print(7)
elif x<=999:
    print(6)
elif x<=1199:
    print(5)
elif x<=1399:
    print(4)
elif x<=1599:
    print(3)
elif x<= 1799:
    print(2)
else:
    print(1)

Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, t = 0;
	cin >> n;
	pair<ld, ld> a[n];
	ld ts = 0;
	for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
	int o[n];
	for (int i = 0; i < n; i++) o[i] = i;
	do {
		ld s = 0;
		for (int i = 1; i < n; i++) s += sqrt(abs(a[o[i - 1]].first - a[o[i]].first) * abs(a[o[i - 1]].first - a[o[i]].first) + abs(a[o[i - 1]].second - a[o[i]].second) * abs(a[o[i - 1]].second - a[o[i]].second));
		ts += s;
		t++;
	} while (next_permutation(o, o + n));
	cout << fixed << setprecision(10) << ts / t << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <cstdlib>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}





int main() {
	ll A, B, C;
	cin >> A >> B >> C;
	if (Max(A, B, C) % 2 == (A + B + C) % 2) {
		cout << (3 * Max(A, B, C) - A - B - C)/2 << endl;
	}
	else {
		cout << (3 *( Max(A, B, C)+1) - A - B - C)/2 << endl;
	}

}

Measured memory_bytes: 256