akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0065
{
    public class Program

    {
        public static void Main(string[] args)
        {

            Dictionary<int, int> lastMonth = new Dictionary<int, int>();
            while (true)
            {
                string line = Console.ReadLine();
                if (line == "") break;

                int[] items = Array.ConvertAll(line.Trim().Split(','), e => int.Parse(e));
                if (!lastMonth.ContainsKey(items[0])) lastMonth.Add(items[0], 0);
                lastMonth[items[0]]++;
            }

            Dictionary<int, int> thisMonth = new Dictionary<int, int>();
            while (true)
            {
                string line = Console.ReadLine();
                if (line == null) break;

                int[] items = Array.ConvertAll(line.Trim().Split(','), e => int.Parse(e));
                if (!thisMonth.ContainsKey(items[0])) thisMonth.Add(items[0], 0);
                thisMonth[items[0]]++;
            }

            foreach (var item in lastMonth)
            {
                if(thisMonth.ContainsKey(item.Key)) Console.WriteLine("{0} {1}",item.Key,item.Value + thisMonth[item.Key]);
            }
          
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 16032
import java.util.Scanner;

public class Main{
	static final int NIL = -1;
	static final int MAX = 100005;
	static Node[] T = new Node[MAX];
	static int n;
	static int D[] = new int[MAX];

	public static void main(String[] args) {
		int i, j, d, v, c, l = 0;
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();

		for(i = 0; i < n; i++) {
			T[i] = new Node(NIL, NIL, NIL);
		}
		for(i = 0; i < n; i++) {
			v = scan.nextInt();
			d = scan.nextInt();
			for(j = 0; j < d; j++) {
				c = scan.nextInt();
				if(j == 0) {
					T[v].setL(c);
				}else {
					T[l].setR(c);
				}
				l = c;
				T[c].setP(v);
			}
		}
		scan.close();

		for(i = 0; i < n; i++) {
			D[i] = getDepth(i);
		}


		for(i = 0; i < n; i++) {
			disp(i);
		}
	}
	// 深さを求める
	static int getDepth(int u) {
		int d = 0;
		while(T[u].getP() != NIL) {
			u = T[u].getP();
			d ++;
		}
		return d;
	}
	static void disp(int u) {
		int i, c;
		System.out.print("node " + u + ": ");
		System.out.print("parent = " + T[u].getP() + ", ");
		System.out.print("depth = " + D[u] + ", ");
		if(T[u].getP() == NIL) {
			System.out.print("root, ");
		}else if(T[u].getL() == NIL) {
			System.out.print("leaf, ");
		}else {
			System.out.print("internal node, ");
		}
		System.out.print("[");
		for(i = 0, c = T[u].getL(); c != NIL; i++, c = T[c].getR()) {
			if(i != 0) {
				System.out.print(", ");
			}
			System.out.print(c);
		}
		System.out.println("]");
	}
}

class Node {
	private int p, l ,r;
	public Node(int p, int l, int r) {
		this.p = p;
		this.l = l;
		this.r = r;
	}
	int getP() {
		return p;
	}
	int getL() {
		return l;
	}
	int getR() {
		return r;
	}
	void setR(int r) {
		this.r = r;
	}
	void setL(int l) {
		this.l = l;
	}
	void setP(int p) {
		this.p = p;
	}
}


Measured memory_bytes: 124044
;;; Utils (quoted from https://competitive12.blogspot.com/2020/03/common-lisp.html)


;; Read fixnum

(declaim (ftype (function * (values fixnum &optional)) read-fixnum))
(defun read-fixnum (&optional (in *standard-input*))
  (declare (inline read-byte)
           #-swank (sb-kernel:ansi-stream in))
  (macrolet ((%read-byte ()
               `(the (unsigned-byte 8)
                     #+swank (char-code (read-char in nil #\Nul))
                     #-swank (read-byte in nil 0))))
    (let* ((minus nil)
           (result (loop (let ((byte (%read-byte)))
                           (cond ((<= 48 byte 57)
                                  (return (- byte 48)))
                                 ((zerop byte) ; #\Nul
                                  (error "Read EOF or #\Nul."))
                                 ((= byte #.(char-code #\-))
                                  (setq minus t)))))))
      (declare ((integer 0 #.most-positive-fixnum) result))
      (loop
        (let* ((byte (%read-byte)))
          (if (<= 48 byte 57)
              (setq result (+ (- byte 48) (the (integer 0 #.(floor most-positive-fixnum 10)) (* result 10))))
              (return (if minus (- result) result))))))))

;; fast read-line

(defmacro buffered-read-line (&optional (buffer-size 30) (in '*standard-input*) (term-char #\Space))
  (let ((buffer (gensym))
        (character (gensym))
        (idx (gensym)))
    `(let* ((,buffer (load-time-value (make-string ,buffer-size :element-type 'base-char))))
       (declare (simple-base-string ,buffer)
                (inline read-byte))
       (loop for ,character of-type base-char =
             ,(if (member :swank *features*)
                  `(read-char ,in nil #\Newline) ; on SLIME
                `(code-char (read-byte ,in nil #.(char-code #\Newline))))
             for ,idx from 0
             until (char= ,character #\Newline)
             do (setf (schar ,buffer ,idx) ,character)
             finally (when (< ,idx ,buffer-size)
                       (setf (schar ,buffer ,idx) ,term-char))
             (return (values ,buffer ,idx))))))


;;; invoke child process

#-swank
(unless (member :child-sbcl *features*)
  (quit
    :unix-status
    (process-exit-code
      (run-program *runtime-pathname*
                   `("--control-stack-size" "128MB"
                     "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                     "--eval" "(push :child-sbcl *features*)"
                     "--script" ,(namestring *load-pathname*))
                                                                 :output t :error t :input t))))



;-------------------
; Write code here
;-------------------



(defun solve (str1 str2)
  (if (equal str1 (subseq str2 0 (1- (length str2))))
      "Yes"
      "No"))

(defun main ()
  (let ((str1 (read-line))
        (str2 (read-line)))
    (princ (solve str1 str2))
    (fresh-line)))

(main)


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

namespace ABC069A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c,d,e;
            var word = Console.ReadLine().Split(' ');
            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = a - 1;
            d = b - 1;
            e = c * d;
            Console.WriteLine(e);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
import java.util.*;
public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        Map<Integer,ArrayList<Integer>> Edge = new HashMap<>();
        Map<Integer,ArrayList<Integer>> Edge2 = new HashMap<>();
        int DP [] = new int[N+1];
        Arrays.fill(DP,0);
        ArrayList<Integer> S = new ArrayList<>();
        Queue<Integer> L = new ArrayDeque<>();
        for(int i=0;i<M;i++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            if(Edge.get(y)==null){
                ArrayList<Integer> E = new ArrayList<>();
                E.add(x);
                Edge.put(y,E);
            }
            else{
                Edge.get(y).add(x);
            }
            if(Edge2.get(x)==null){
                ArrayList<Integer> E = new ArrayList<>();
                E.add(y);
                Edge2.put(x,E);
            }
            else Edge2.get(x).add(y);
        }
        int max = 0;
        for(int i=1;i<N+1;i++) if(Edge.get(i)==null) L.add(i);
        while(L.size()!=0) {
            int source = L.poll();
            S.add(source);
            if(Edge2.get(source)!=null){
                for(int sink:Edge2.get(source)){
                    Edge.get(sink).remove(Edge.get(sink).indexOf(source));
                    DP[sink] = Math.max(DP[sink],DP[source]+1);
                    if(max<DP[sink])max =DP[sink];
                    if(Edge.get(sink).size()==0) L.add(sink);
                }
            }
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 116392
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(3e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}

ll mod_pow(ll a,ll b,ll p){ //(a^b)%p
	ll res=1;
	a%=p;

	while(b>0){
		if(b&1==1) res=((res%p)*(a%p))%p;
		a=(a%p*a%p)%p;
		b>>=1;
	}
	return res;
}

//mod_inv=mod_pow(denominator,MOD-2,MOD);
int fac[MAXSIZE+6];
int inv[MAXSIZE+6];

void pre(){
	fac[0] = 1;
	for(int i=1;i<=MAXSIZE;i++){
		fac[i] = fac[i-1] * (i);
		fac[i]%=mod;
	}
	inv[MAXSIZE] = mod_pow(fac[MAXSIZE],mod-2,mod);
	for(int i=MAXSIZE-1;i>=0;i--){
		inv[i] = (i+1) * inv[i+1];
		inv[i]%=mod;
	}
}

int nCr(int n, int r){
	if(r>n) return 0;
	int ans = fac[n];
	ans%=mod;
	ans = ans * inv[r];
	ans%=mod;
	ans = ans * inv[n-r];
	ans%=mod;
	return ans;
}


int32_t main(){
	fastio();
	pre();
	int a , b , c ,d;
	cin >> a >> b >> c >> d;
	int ans = nCr(c + d + 2, d + 1);
	ans %= mod;
	ans += nCr(a + b, a);
	ans %= mod;
	ans -= nCr(c + b + 1 , b);
	ans += mod;
	ans %= mod;
	ans -= nCr(d + a + 1, a);
	ans += mod;
	ans %= mod;
	cout << ans;
}

Measured memory_bytes: 50460
H, N = map(int, input().split())
da, cost = [0] * N, [0] * N
for i in range(N):
    da[i],cost[i]=map(int, input().split())

max_da=max(da) 
dp = [float("inf") for i in range(H+max_da)]
dp[0]=0

for i in range(H+max_da):
    for j in range(N):
        if i-da[j]>=0:
            dp[i]=min(dp[i],dp[i-da[j]]+cost[j])

print(min(dp[H:]))

Measured memory_bytes: 42844
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
#include<time.h>
typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;



int main()
{

    string p;
    cin >> p;

    //map<string, int>a;
   
    int t;
    if (p == "SUN")t = 7;
    if (p == "MON")t = 6;
    if (p == "TUE")t = 5;
    if (p == "WED")t = 4;
    if (p == "THU")t = 3;
    if (p == "FRI")t = 2;
    if (p == "SAT")t = 1;
    cout << t << endl;



    return 0;

}

Measured memory_bytes: 3596
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <utility>
#include <iomanip>
#define input(x) cin >> x
#define print(x) cout << x << endl
#define rep(n) for(int i = a; i < n; i++)
#define ll long long int
using namespace std;

int main(){
    string s;
    input(s);
    //s.at(3) = "8";
    s.replace(0,4,"2018");
    print(s);
    return 0;
}


Measured memory_bytes: 256
def prime_factorize(n):
    if 2 <= n < 4:
        return [n]
    res = []
    i = 2
    while i * i <= n:
        while n % i == 0:
            res.append(i)
            n //= i
        i += 1
    if n != 1:
        res.append(n)
    # res.sort()
    return res

from itertools import groupby
def resolve():
    N = int(input())
    P = prime_factorize(N)
    ans = 0
    grp_P = groupby(P)
    for v, g in grp_P:
        n = len(list(g))
        for i in range(1, 100000):
            n -= i
            if n >= 0:
                ans += 1
            else:
                break
    print(ans)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9212
inputLine = input()

tempStr = inputLine.split(' ')

tHealth = int(tempStr[0])
tAttack = int(tempStr[1])
aHealth = int(tempStr[2])
aAttack = int(tempStr[3])

roundStep = 0
while True :

	if tHealth <= 0 :
		print('No')
		break

	elif aHealth <= 0 :
		print('Yes')
		break


	if roundStep % 2 == 0 :
		aHealth -= tAttack

	else :
		tHealth -= aAttack

	roundStep = roundStep + 1


Measured memory_bytes: 9180
#include <stdio.h>
#include <stdlib.h>

int compare(const void *a, const void *b)
{
  return *(int*)a - *(int*)b;
}


int main(void)
{
  int k, n;
  int h[100000];

  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++)
    scanf("%d", &h[i]);
  
  qsort(h, n, sizeof(int), compare);

  int min = h[k - 1] - h[0];
  for (int i = 1; i < n - k + 1; i++) {
    if (h[k + i - 1] - h[i] < min)
      min = h[k + i - 1] - h[i];
  }

  printf("%d\n", min);

  return 0;
}


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

int main(){
    int n; cin >> n;
    string s; int p;
    vector<tuple<string, int, int>> book;
    rep(i,n){
        cin >> s >> p;
        book.emplace_back(s, 100-p, i+1);
    }
    
    sort(book.begin(), book.end());
    
    rep(i,n)cout << get<2>(book[i]) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
    // insert code here...
    int a, b;
    cin >> a >> b;
    int c = a / b;
    int d = a % b;
    double e = (double)a / (double)b;
    printf("%d %d %lf \n", c, d, e);
    
    return 0;
}



Measured memory_bytes: 3228
import java.util.*;

public class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Set<Integer> set = new HashSet<Integer>();
        for(int i=0;i<N;i++){
            set.add(i+1);
        }
        int K = sc.nextInt();
        int [] d = new int [K];
        for(int i=0;i<K;i++){
            d[i] = sc.nextInt();
            for(int j=0;j<d[i];j++){
                Integer[] A = new Integer[d[i]];
                A[j] = sc.nextInt();
                set.remove(A[j]);
            }
            }
            System.out.println(set.size());
        }
    }


Measured memory_bytes: 50052
N = int(input())
data = list(input())
app = [0,0]
for i in range(N):
    if data[i] == ")":
        app[0] += 1
        if app[1] > 0:
            app[0] -= 1
            app[1] -= 1
    elif data[i] == "(":
        app[1] += 1
print("("*app[0] + "".join(data) + ")"*app[1])


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


int main(){   
    ll n, a, b; cin >> n >> a >> b;
    ll c = a+b;
    ll ans = a * (n/c);
    ans += min(n%c ,a);
    cout << ans << endl;
}


Measured memory_bytes: 3604
import sys

h = {'I' : 1, 'V' : 5, 'X' : 10, 'L' : 50, 'C' : 100, 'D' : 500, 'M' : 1000, 'E' : 0}

for line in sys.stdin:
	line = line.rstrip()
	line += 'E'
	ans = 0
	i = 0
	while i < len(line) - 1:
		if h[line[i]] >= h[line[i+1]]:
			ans += h[line[i]]
		else:
			ans += h[line[i+1]] - h[line[i]]
			i += 1
		i += 1
	print(ans)

Measured memory_bytes: 7384
N, D = map(int, input().split())
P = [list(map(int, input().split())) for i in range(N)]

ans = 0
for i in range(N):
    for j in range(i+1, N):
        t = 0
        for k in range(D):
            t += (P[i][k]-P[j][k])**2
        t = t**(1/2)
        if t.is_integer():
            ans += 1
print(ans)


Measured memory_bytes: 3060
import java.util.*;


public class Main {
	public static void main (String[] args){
		Scanner sc =  new Scanner(System.in);
		float A = sc.nextFloat();
		float B = sc.nextFloat();
		int R = -1;
		float Rmemo = Math.min((float)(A/0.08), (float)(B/0.1));
		while(Rmemo*0.08 < A + 1) {
			int x = (int)Math.floor(Rmemo*0.08);
			int y = (int)Math.floor(Rmemo*0.1);
			if(x == A && y == B) {
				R = (int)Rmemo;
				break;
			}
			Rmemo++;
		}
		System.out.println(R);
	}
}

Measured memory_bytes: 24916
# abc145_b.py
# https://atcoder.jp/contests/abc145/tasks/abc145_b

# B - Echo /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# 正整数 N及び、長さ N の英小文字から成る文字列 Sが与えられます。
# この文字列が、ある文字列を二度繰り返したものであるかを判定してください。 
# 則ち、文字列 Tであって、 S=T+Tとなるものが存在するかを判定してください。

# 制約
#     1≤N≤100
#     Sは英小文字から成る|S|=N

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N
# S

# 出力
# Sが文字列を二度繰り返したものであるならば Yes と、そうでないならば No と出力せよ。

# 入力例 1
# 6
# abcabc

# 出力例 1
# Yes

# T=abc とおくと、 S=T+Tとなります。

# 入力例 2
# 6
# abcadc

# 出力例 2
# No

# 入力例 3
# 1
# z

# 出力例 3
# No


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    S = lines[1]
    N = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    if N % 2 != 0:
        result = 'No'
    else:
        n = int(N/2)
        log(f'S[:n]=[{S[:n]}], S[n:]=[{S[n:]}]')
        if S[:n] == S[n:]:
            result = 'Yes'
        else:
            result = 'No'

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['6', 'abcabc']
        lines_export = ['Yes']
    if pattern == 2:
        lines_input = ['1', 'abcadc']
        lines_export = ['No']
    if pattern == 3:
        lines_input = ['1', 'z']
        lines_export = ['No']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


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

int main(){
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    long long a[100010], b[100010], c[100010];
    for(int i=0; i<N; i++){
        cin >> a[i];
    }
    for(int i=0; i<N; i++){
        cin >> b[i];
    }
    for(int i=0; i<N; i++){
        cin >> c[i];
    }
    sort(a, a+N);
    sort(b, b+N);
    sort(c, c+N);
    long long ans = 0;
    for(int i=0; i<N; i++){
        auto idx1 = lower_bound(a, a+N, b[i]);
        long long x = idx1 - a;
        auto idx2 = upper_bound(c, c+N, b[i]);
        long long y = N-(idx2-c);
        ans += x*y;
    }
    cout << ans;
    return EXIT_SUCCESS;
}

Measured memory_bytes: 2688
N = int(input())
a = list(map(int, input().split()))
count = 0
k = 0
if not 1 in a:
    print(-1)
else:
  for i in range(1, N):
      for j in range(k, N):
          if a[j] != i:
              count += 1
          elif a[j] == i:
            k = j + 1
            break
      else:
          break
  print(count)

Measured memory_bytes: 24744
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define YESNO(i) puts((i)?"YES":"NO");
#define YesNo(i) puts((i)?"Yes":"No");
#define yesno(i) puts((i)?"yes":"no");
#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(0);
  string s;cin>>s;
  YesNo(s[0]=='7'||s[1]=='7'||s[2]=='7');
  return 0;
}

Measured memory_bytes: 3644
#include <iostream>

int main(void) {

	char a, b;
	std::cin >> a >> b;

	bool honest = (a == 'H');
	bool saying = (b == 'H');

	char result;
	if (honest) {
		result = saying ? 'H': 'D';
	} else {
		result = saying ? 'D': 'H';
	}

	std::cout << result << std::endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{
  int A,B,C;
  cin>>A>>B>>C;
  int MAX = max(A,max(B,C));
  int D = 3*MAX - A - B - C;
  int ANS = D/2;
  if(D%2 == 1)
  {
    cout<<ANS+2<<endl;
  }
  else
  {
    cout<<ANS<<endl;
  }
  
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 256
//
// Created by Hideaki Imamura on 2019-07-12.
//

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

int main() {
    int n, a, res=0;
    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> a;
        res += a;
    }
    res -= n;
    cout << res << endl;
    return 0;
}

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

const int INF = numeric_limits<int>::max();

struct Edge {
    int to, cost;
};

struct Graph {
    vector<vector<Edge>> edge; // 辺（隣接ノード番号, 重み）
    vector<int> d; // 最短距離
    vector<int> p; // 親ノード
    Graph(int v) {
        edge.assign(v, vector<Edge>());
        d.assign(v, INF);
        p.assign(v, -1);
    }
};

int main()
{
    int v, e;
    cin >> v >> e;
    Graph g(v);
    for (int i = 0; i < e; i++) {
        int s, t;
        cin >> s >> t;
        s--;
        t--;
        g.edge[s].push_back({t, 1});
        g.edge[t].push_back({s, 1});
    }

    g.d[0] = 0;
    g.p[0] = 0;
    priority_queue<P, vector<P>, greater<P>> pq;
    pq.push(P(0, 0));
    while (!pq.empty()) {
        P p = pq.top();
        pq.pop();
        int d = p.first;
        int u = p.second;
        if (d > g.d[u]) continue;
        for (auto e : g.edge[u]) {
            if (g.d[u] + e.cost < g.d[e.to]) {
                g.d[e.to] = g.d[u] + e.cost;
                g.p[e.to] = u;
                pq.push(P(g.d[e.to], e.to));
            }
        }
    }

    for (auto d : g.d) {
        if (d == INF) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i < v; i++) {
        cout << g.p[i] + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 13480
n = int(input())
s = input()

cntr = 0
for i in range(n-1, -1, -1):
    if s[i] == ')':
        cntr += 1
    elif cntr > 0:
        cntr -= 1
s = '(' * cntr + s
n = len(s)

cntl = 0
for i in range(n):
    if s[i] == '(':
        cntl += 1
    elif cntl > 0:
        cntl -= 1
s += ')' * cntl

print(s)

Measured memory_bytes: 9180
#include <stdio.h>

int main(void)
{
	int price;
	int w;
	int i;
	
	while(1){
		scanf("%d", &w);
		if(w == -1)  break;
		
		price = 4280;
		
		for(i = 11; i <= 20 && i <= w; i++)
			price -= 125;
		for(; i <= 30 && i <= w; i++)
			price -= 140;
		for(; i <= w; i++)
			price -= 160;
		
		printf("%d\n", price - 1150);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
using namespace std;
int main(void){
    
   int h1,h2,x=0,z=0;
   int k1,k2,y=0,w=0;
   int a,b,c,d;
   
   cin>>h1>>h2;
   cin>>k1>>k2;
   cin>>a>>b>>c>>d;
   x=h1*a+h1/10*c;
   z=h2*b+h2/20*d;
   y=k1*a+k1/10*c;
   w=k2*b+k2/20*d;
   
   if(x+z<y+w){
       cout<<"kenjiro"<<endl;
   }
   else if(x+z>y+w){
       cout<<"hiroshi"<<endl;
   }
   else{
       cout<<"even"<<endl;
   }
}



Measured memory_bytes: 3092
#include<stdio.h>

#define MAX 100000

 int CC[MAX];

 void init(){
             int i;
             for(i=0;i<MAX;i++)CC[i]=i;
             }

 int find(int a){
                 if(a==CC[a])return a;
                 return CC[a]=find(CC[a]);
                 }

 int isSame(int a,int b){
                         if(find(a)==find(b))return 1;
                         else return 0;
                         }

 void unite(int a,int b){
                         a=find(a);
                         b=find(b);

                         if(a==b)return;
                         CC[b]=a;
                         }

 int main(){
            int n,m,q,i,j,k;
            init();
            scanf("%d %d",&n,&m);
            for(i=0;i<m;++i){
                             scanf("%d%d",&j,&k);
                             unite(j,k);
                             }
            
            scanf("%d",&q);
            for(i=0;i<q;i++){
                             scanf("%d%d",&j,&k); 
                             if(isSame(j,k))printf("yes\n");
                             else printf("no\n");
                             }
            return 0;
            }




Measured memory_bytes: 2116
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#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; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin>>n;
  vector<vector<ll>>a(n,vector<ll>(n));
  rep(i,n)rep(j,n)
  {
    cin>>a[i][j];
  }
  vector<ll>weight(1<<n,0);
  rep(i,1<<n)
  {
    vector<ll>mem;
    rep(j,n)
    {
      if(i&(1<<j))
      {
        mem.push_back(j);
      }
    }
    rep(j,mem.size())
    {
      repi(k,j+1,mem.size())
      {
        weight[i]+=a[mem[j]][mem[k]];
      }
    }
  }
  vector<ll>dp(1<<n,0);
  rep(i,1<<n)
  {
    for(int cal=i;cal>0;cal=(cal-1)&i)
    {
      chmax(dp[i],dp[i-cal]+weight[cal]);
    }
  }
  cout<<dp[(1<<n)-1]<<endl;


  return 0;

}


Measured memory_bytes: 1280
def isCLKWISE(ph):
    return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:]:
        phU.append(p)
        while(True):
            if isCLKWISE(phU) : break
            else :
                del phU[-2]
                if len(phU) == 2 : break
    phL = [P[-1],P[-2]]
    for p in P[-3::-1]:
        phL.append(p)
        while(True):
            if isCLKWISE(phL) : break
            else :
                del phL[-2]
                if len(phL) == 2 : break
    ph = phU + phL[1:-1]
    return ph
  
n = range(int(input()))
P = []
for i in n:
    P.append([int(x) for x in input().split()])
      
Q = ConvexHullScan(P)
Q.reverse()
print(len(Q))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(Q)])[2]
R = Q[idx:] + Q[:idx]
for r in R : print(r[0],r[1])

Measured memory_bytes: 33856
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import defaultdict, deque
    n, u, v = map(int, readline().split())
    edge = defaultdict(list)

    for _ in range(n - 1):
        a, b = map(int, readline().split())
        edge[a].append(b)
        edge[b].append(a)

    dist_first = defaultdict(lambda: float("INF"))
    dist_second = defaultdict(lambda: float("INF"))
    dist_first[u] = 0
    dist_second[v] = 0
    leaf = set()

    que = deque()
    que.append((v, 0))
    while que:
        cur, cost = que.popleft()
        new_cost = cost + 1
        is_leaf = True
        for nx in edge[cur]:
            if dist_second[nx] == INF:
                que.append((nx, new_cost))
                dist_second[nx] = new_cost
        if len(edge[cur]) == 1:
            leaf.add(cur)

    que.append((u, 0))
    while que:
        cur, cost = que.popleft()
        if cost < dist_second[cur]:
            new_cost = cost + 1
            for nx in edge[cur]:
                if dist_first[nx] == INF:
                    que.append((nx, new_cost))
                    dist_first[nx] = new_cost

    ans = 0
    for i in range(1, n + 1):
        if i in leaf:
            first = dist_first[i]
            second = dist_second[i]
            if first == INF:
                continue
            ans = max(ans, second - 1)

    print(ans)


if __name__ == '__main__':
    main()


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

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		int h = p[0];
		int w = p[1];
		int[,] grid = new int[h,w];
		for(int i = 0; i < h; i++)
		{
			var s = Console.ReadLine();
			for(int j = 0; j < w; j++)
			{
				grid[i,j] = (s[j] == '.' ? 0 : 1);
			}
		}
		
		for(int i = 0; i < h; i++)
		{
			int k = 0;
			for(int j = 0; j < w; j++)
			{
				k += Math.Max(grid[i, j], 0);
			}
			if(k == 0)
			{
				for(int j = 0; j < w; j++)
				{
					grid[i, j] = -1;
				}
			}
		}
		
		for(int i = 0; i < w; i++)
		{
			int k = 0;
			for(int j = 0; j < h; j++)
			{
				k += Math.Max(grid[j, i], 0);
			}
			if(k == 0)
			{
				for(int j = 0; j < h; j++)
				{
					grid[j, i] = -1;
				}
			}
		}
		
		for(int i = 0; i < h; i++)
		{
			bool printed = false;
			for(int j = 0; j < w; j++)
			{
				if(grid[i,j] >= 0)
				{
					Console.Write(grid[i,j] == 0 ? '.' : '#');
					printed = true;
				}
			}
			if(printed)
				Console.WriteLine();
		}
		
		
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		int[] r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
	
}

Measured memory_bytes: 11172
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		String s = sc.next();
		
		// 計算
		int result = 0;
		for(int i = 0; i < s.length()-2; i++){
		    if("ABC".equals(s.substring(i, i+3))){
		        result++;
		        i += 2;
		    }
		}
		
		// 出力
		System.out.println(result);
	}
	
}




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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N;
    cin >> N;
    vec A(N);
    REP(i,0,N) cin >> A[i];

    vec D(N+1);
    ll sum = 0, x = 0;
    REP(i,0,N) {
        D[i] = A[i] - x;
        x = A[i];
        sum += abs(D[i]);
    }
    D[N] = -x;
    sum += abs(D[N]);

    REP(i,0,N) {
        if(D[i] * D[i+1] < 0) PR(sum-MIN(abs(D[i]),abs(D[i+1]))*2);
        else PR(sum);
    }


    return 0;
}

/*



*/

Measured memory_bytes: 4840
import sys
from copy import deepcopy
from collections import deque

inputs = sys.stdin.readlines()
h, w = map(int, inputs[0].split())
S = deque(deque(map(lambda x: int(x=='.'), x)) for x in inputs[1:])
S.appendleft(deque([0]*w))
S.append(deque([0]*w))
for row in S:
    row.appendleft(0)
    row.append(0)

max_dist = 0
for y in range(1, h+1):
    for x in range(1, w+1):
        if S[y][x]:
            maze = deepcopy(S)
            queue = deque([(x, y, 0)])
            while queue:
                x, y, d = queue.popleft()
                d += 1
                maze[y][x] = 0
                for dx, dy in zip([0, 1, 0, -1], [-1, 0, 1, 0]):
                    if maze[y+dy][x+dx]:
                        queue.append((x+dx, y+dy, d))
                        maze[y+dy][x+dx] = 0
                        max_dist = max(max_dist, d)
print(max_dist)

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

void ext_gcd(uint32_t a, uint32_t b, std::pair<int32_t, int32_t>& ans) {
  if (b == 0) {
    ans.first = 1;
    ans.second = 0;
    return;
  }
  ext_gcd(b, a % b, ans);

  int32_t temp = ans.first;
  ans.first = ans.second;
  ans.second = temp - (a / b) * ans.second;
  return;
}

int main() {
  uint32_t a = 0, b = 0;
  std::cin >> a >> b;

  std::pair<int32_t, int32_t> ans;
  ext_gcd(a, b, ans);

  std::cout << ans.first << " " << ans.second << std::endl;

  return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin);i>(end);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())

#define ll long long
#define f first
#define s second
using namespace std;

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;

int main()
{
	// 入力
	ll N, M;
	cin >> N >> M;

	vector<vector<ll>> s(M, vector<ll>(N));
	vec k(M);
	vec p(M);

	REP(i, M) {
		cin >> k[i];
		REP(j, k[i]) {
			cin >> s[i][j];
			s[i][j]--;
		}
	}
	REP(i, M) {
		cin >> p[i];
	}

	vec sw(N, 0);
	ll ans = 0;
	REP(i, pow(2, N)) {	//配位に関するループ
		// cout<<i<<endl;
		REP(j, N) {	//スイッチの配位決定
			ll temp=pow(2, j+1);
			ll temp2=pow(2,j);
			// cout<<temp<<endl;
			sw[j] = i / temp2 % temp;
			// cout<<sw[j]<<endl;
		}
		bool allon = true;
		REP(l, M) {	//すべての電球について調べる
			ll swsum = 0;
			REP(m, k[l]) {
				swsum += sw[s[l][m]];
				// cout<<sw[s[l][m]]<<endl;
			}
			// cout<<i<<"swsum"<<swsum<<endl;
			if (swsum % 2 == p[l]) continue;
			else {
				allon = false;
				break;
			}
		}
		if (allon) ans++;

	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
 string S;
  cin>>S;
  ll N=S.size();
  for(ll i=0;i<N;i++) {
cout<<'x';
  }
cout<<endl;
}
  


Measured memory_bytes: 3596
#include <stdio.h>

int main(void)
{
  int a, b, c, d, e, i;
  scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
  if (a == 0)
  {
    printf("1");
  }
  else
  {
    printf("");
  }
  if (b == 0)
  {
    printf("2");
  }
  else
  {
    printf("");
  }
  if (c == 0)
  {
    printf("3");
  }
  else
  {
    printf("");
  }
  if (d == 0)
  {
    printf("4");
  }
  else
  {
    printf("");
  }
  if (e == 0)
  {
    printf("5");
  }
  else
  {
    printf("");
  }
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

#define rep(i,N) for(int i=0; i < (int)N; i++)
#define all(v) (v).begin(),(v).end()

const int INF = 100000002;

ll total(ll n){
	ll total = (n*(n-1)*(n-2))/6;
	return total;
}

int main(){
	int n; cin >> n;
	vector<vi> num(10, vi());
	vector<char> s(n); 
	rep(i, n){
		cin >> s[i];
		int a = s[i] - '0';
		num[a].push_back(i);

	}
	rep(i,10) sort(num[i].begin(), num[i].end());
	int ans = 0;
	rep(i,10){
		if(num[i].empty()) continue;
		int t0 = num[i][0];
		rep(j,10){
			if(num[j].empty()) continue;
			int t1 = -1;
			int j_s = num[j].size();
			if(t0 < num[j][j_s-1]){
				for(auto x : num[j]){
					if(t0 < x){
						t1 = x;
						break;
					}
				}
			}
			if(t1 == -1) continue;
			rep(k,10){
				if(num[k].empty()) continue;
				int k_s = num[k].size();
				int t2 = num[k][k_s-1];
				if (t2 > t1){
					ans ++;
				 } 
			}	
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

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

		int[][] X = new int[N][D];
		for ( int n = 0 ; n < N ; n++ ) {
			for ( int d = 0 ; d < D ; d++ ) {
				X[n][d] = sc.nextInt();
			}
		}

		int cnt = 0;
		for ( int i = 0 ; i < N ; i++ ) {
			for ( int j = i + 1 ; j < N ; j++ ) {
				int sqSum = squareSum(X[i], X[j]);
				int sqrt = (int) Math.round(Math.sqrt(sqSum));
				if ( sqrt * sqrt == sqSum ) {
					cnt++;
				}
			}
		}

		System.out.println(cnt);
	}

	public static int squareSum(int[] a, int[] b) {
		int sum = 0;
		for ( int d = 0 ; d < a.length ; d++ ) {
			sum += (a[d] - b[d]) * (a[d] - b[d]);
		}
		return sum;
	}

}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
//#define LOCAL
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define forn(i,a,b) for(ll i=a;i<b;i++)
#define ft first
#define sd second
#define sz size()
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<double,double> pdd;
typedef pair<long long,long long> pll;
//cout << fixed << setprecision(12) <<x<<endl;

int main(){
fastIO;
#ifdef LOCAL
     freopen("in.txt", "r", stdin);
#endif

int n,x,ans=1;
cin>>n>>x;
int a[n];
cin>>a[0];
forn(i,1,n){
    cin>>a[i];
    a[i]=a[i-1]+a[i];
}
forn(i,0,n){
    if(a[i]<=x) ans++;
}
cout<<ans<<endl;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  
  for (int i = 0; i < n; i++){
    cin >> x[i];
  }
  sort(x.begin(), x.end());

  for (int i = 0; i < n - 1; i++){
    if (x[i] == x[i + 1]){
      x[i] = -1;
      x[i + 1] = -1;
    }
  }

  int ans = 0;
  for(int i=0; i<n; i++){
    if(x[i] >=1){
      ans++;
    }
  }
  cout << ans << "\n";
  return 0;
}

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

using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf("%.12lf\n",mid);
// __builtin_popcount(int) count 1's in binary
// get decimal pert of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
int mod = 998244353;

long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}

/*string sentence = "And I feel fine...";
    istringstream iss(sentence);
*/  

double eps = .000000001;

int main ()
{
  prep();
  string s, t;
  cin >> s >> t;
  int sets[26][s.size()];
  int cnts[26] = {0};
  for (int i=0; i<s.size(); i++){
      sets[s[i]-'a'][cnts[s[i]-'a']] = i;
      cnts[s[i]-'a']++;
  }
  long long many = 0;
  long long mult = 0;
  int last = 0;
  bool good = true;
  for (int i=0; i<t.size(); i++){
  
      int cntt = cnts[t[i]-'a'];
      if (cntt == 0){
          good = false;
          break;
      }
      int let = t[i]-'a';
      int it = lower_bound(sets[let], sets[let]+cntt, last)-sets[let];
      if (it == cntt){
          last = 0;
          mult++;
          int itt = lower_bound(sets[let], sets[let]+cntt, last)-sets[let];
          if (i == t.size()-1){
              many += sets[let][itt]+1;
          }
          last = sets[let][itt]+1;
      }else{
          if (i == t.size()-1){
              many += sets[let][it]+1;
          }
          last = sets[let][it]+1;
      }
  }
  if (!good){
      cout << -1;
      return 0;
  }
  cout << many+mult*s.size();
  return 0; 
}

Measured memory_bytes: 9168
int N,i;
#include <iostream>
long long L[87];
main()
{
	std::cin >> N;
	L[0] = 2,L[1] = 1;
	for (i = 2;i <= N;++ i)
		L[i] = L[i - 2] + L[i - 1];
	std::cout << L[N] << std::endl;
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{
	int N;
	string S;
	cin >> N >> S;
	if (N%2==1) {
		ce("No")
	}
	else {
		string a = S.substr(0, N/2);
		string b = S.substr(N / 2);
		if (a==b) {
			ce("Yes")
		}
		else {
			ce("No")
		}

	}
    return 0;
}



Measured memory_bytes: 256
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
	}
	
	mod& operator=(const ll & tx) {
		x = tx;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return (x + m2.x) % MOD;
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return (x - m2.x + MOD) % MOD;
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return (x * m2.x) % MOD;
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return mod(((*this).x * (*this).inv().x) % MOD);
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}

/* TEMPLATE ENDS HERE */

#define MAXN (1 << 20)

int a[MAXN];
int c[MAXN];

pair<pair<int, int>, pair<int, int> > cnt(vector<int> v) {
	memset(c, 0, sizeof(c));
	for (int i = 0; i < v.size(); i++) {
		c[v[i]]++;
	}
	vector<pair<int, int> > vv;
	for (int i = 0; i < MAXN; i++) {
		if (c[i]) {
			vv.push_back(make_pair(c[i], i));
		}
	}
	sort(vv.begin(), vv.end());
	reverse(vv.begin(), vv.end());
	if (vv.size() == 1) {
		return make_pair(vv[0], make_pair(0, 0));
	} else {
		return make_pair(vv[0], vv[1]);
	}
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<int> v1, v2;
	for (int i = 0; i < n; i += 2) {
		v1.push_back(a[i]);
	}
	for(int i = 1; i < n; i += 2) {
		v2.push_back(a[i]);
	}
	pair<pair<int, int>, pair<int, int> > p1 = cnt(v1);
	pair<pair<int, int>, pair<int, int> > p2 = cnt(v2);

	if (p1.first.second != p2.first.second) {
		cout << n - p1.first.first - p2.first.first << endl;
	} else {
		int best = max(p1.first.first + p2.second.first, p1.second.first + p2.first.first);
		cout << n - best << endl;
	}

	return 0;
}


Measured memory_bytes: 8740