akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>

#define A 0
#define B 1
#define C 2

using namespace std;

int main(void) {
	int turn;
	char c_tmp;
	string SA, SB, SC;
	vector<string> S;
	// get input ---------------------------
	cin >> SA >> SB >> SC;
	S.push_back(SA);
	S.push_back(SB);
	S.push_back(SC);
	// init turn ---------------------------
	turn = A;
	// game --------------------------------
	while (true) {
		// throw away card
		c_tmp = S[turn][0];
		S[turn].erase(S[turn].begin());
		// next turn
		if (c_tmp == 'a') {
			turn = A;
		}
		else if (c_tmp == 'b') {
			turn = B;
		}
		else {
			turn = C;
		}
		// check
		if (S[turn].empty()) {
			break;
		}
	}
	// disp answer -------------------------
	if (turn == A) {
		cout << 'A' << endl;
	}
	else if (turn == B) {
		cout << 'B' << endl;
	}
	else {
		cout << 'C' << endl;
	}
	return 0;
}



Measured memory_bytes: 256
// ConsoleApplication3.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

//#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
	int x;
	cin >> x;
	cout << x*x*x << endl;
    return 0;
}




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

int main() {
	int A[101][101], B[101][101];
	int n, m, l;
	cin >> n >> m >> l;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> A[i][j];
		}
	}

	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			cin >> B[i][j];
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			long long total = 0;
			for (int k = 0; k < m; k++){
				total += A[i][k] * B[k][j];
			}
			if(j == l - 1) {
				cout << total << endl;
			} else {
				cout <<  total << " ";
			}
			
		}
	}

	return 0;
}


Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const ll mod = 1e+9 + 7;
const int INF = 1001001001;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n, k;
    cin >> n >> k;
    vector<double> p(n);
    for(int i = 0; i < n; ++i){
        int x;
        cin >> x;
        int foo = x * (x + 1) / 2;
        double bar = 1.0 / x;
        p[i] = bar * foo;
    }
    double sum = 0;
    for(int i = 0; i < k; ++i)  sum += p[i];
    double res = sum;
    int pos = 0;
    while(pos + k < n){
        sum -= p[pos];
        sum += p[pos + k];
        chmax(res, sum);
        ++pos;
    }
    cout << fixed << setprecision(12);
    cout << res << endl;
}

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

int main() {
    string S, T;
    cin >> S >> T;
    bool ans = false;
    for(int i = 0; i < S.size(); i++) {
        if(S == T) {
            ans = true;
            break;
        }
        S = S.back() + S.substr(0, S.size()-1);
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

long long modinv(long long dividend, long long divisor, long long modnum);

int mod = 1e+9 + 7;

int main(){
    int X, Y;
    std::cin >> X >> Y;
    int n = X + Y;
    if( n % 3 != 0 ){
        std::cout << 0 << std::endl;
        return 0;
    }
    if( X > Y * 2 || X * 2 < Y ){
        std::cout << 0 << std::endl;
        return 0;
    }
    int move_num = n / 3;
    int min = X > Y ? Y : X;
    int r = min - move_num;
    long long ans = 1;
    for(int i=1; i<=r; i++){
        ans = (ans * (move_num - i + 1) ) % mod;
        ans = modinv(ans, i, mod);
    }
    
    std::cout << ans << std::endl;
    return 0;
}

long long modinv(long long dividend, long long divisor, long long modnum){
    long long b = mod, u = 1, v = 0;
    while (b) {
        long long t = divisor / b;
        divisor -= t * b; std::swap(divisor, b);
        u -= t * v; std::swap(u, v);
    }
    u %= mod; 
    if (u < 0) u += mod;
    long long ans = dividend * u % mod;
    return ans;
}


Measured memory_bytes: 256
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

     static Scanner scanner;

     public static void main(String[] args) {
         scanner = new Scanner(System.in);

         int K=gi();
         long N=0;
         while(K>0) {
        	 N=f(N);
        	 K--;
         }
    	 
         System.out.println(N);
     }
     
  // s進数で表した時の文字列
 	public static long f(long n) {
 		if(n<10) return n+1;
 		
 		long one=n%10;
 		long ten=(n/10)%10;
 		if((one==ten && one!=9) || ten-1==one) return n+1;
 		
 		long ret=f(n/10);
 		long a=ret%10;
 		ret=ret*10+a;
        if(a!=0)ret--;
 		return ret;

 	}

     // 文字列として入力を取得
     public static String gs() {
          return scanner.next();
     }

     // intとして入力を取得
     public static int gi() {
          return Integer.parseInt(scanner.next());
     }

     // longとして入力を取得
     public static long gl() {
          return Long.parseLong(scanner.next());
     }

     // doubleとして入力を取得
     public static double gd() {
          return Double.parseDouble(scanner.next());
     }
}

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

#define lld long long
#define pp pair<int,int>
#define pb push_back
#define MOD 10007
#define left lleft
#define right rright
#define INF 2000000000
#define Linf 1000000000000000000LL
#define next nnext
#define minus mminus

using namespace std;

int N;
int cnt[30];

int main(){
	scanf("%d",&N);
	for(int i=1; i<=26; i++) cnt[i] = INF;
	for(int i=1; i<=N; i++){
		char s[100];
		scanf("%s",s);
		int M = strlen(s);
		int tmp[30] = {0,};
		for(int j=0; j<M; j++) tmp[s[j]-'a'+1]++;
		for(int j=1; j<=26; j++) cnt[j] = min(cnt[j],tmp[j]);
	}
	for(int i=1; i<=26; i++){
		for(int j=1; j<=cnt[i]; j++) printf("%c",'a'+i-1);
	}
	puts("");

	return 0;
}


Measured memory_bytes: 256
package main

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

const NIL = -1

var sc = bufio.NewScanner(os.Stdin)

var dummy = &Node{}

type Node struct {
	key    int
	parent *Node
	left   *Node
	right  *Node
}

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

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

func init() {
	sc.Split(bufio.ScanWords)
	dummy.parent = dummy
	dummy.left = dummy
	dummy.right = dummy
}

func insert(v int) {
	node := &Node{key: v, left: dummy, right: dummy}

	parent := dummy
	leaf := dummy.left
	for leaf != dummy {
		parent = leaf
		if node.key < leaf.key {
			leaf = leaf.left
		} else {
			leaf = leaf.right
		}
	}

	node.parent = parent
	if parent == dummy {
		dummy.left = node
		dummy.right = node
	} else if node.key < parent.key {
		parent.left = node
	} else {
		parent.right = node
	}
}

func preOrder(node *Node, w io.Writer) {
	if node == dummy {
		return
	}

	fmt.Fprint(w, " ", node.key)
	preOrder(node.left, w)
	preOrder(node.right, w)
}

func inOrder(node *Node, w io.Writer) {
	if node == dummy {
		return
	}

	inOrder(node.left, w)
	fmt.Fprint(w, " ", node.key)
	inOrder(node.right, w)
}

func orderPrint(root *Node, w io.Writer) {
	inOrder(root, w)
	fmt.Fprintln(w)
	preOrder(root, w)
	fmt.Fprintln(w)
}

func find(key int) *Node {
	node := dummy.left
	for node != dummy {
		if key == node.key {
			return node
		}
		if key < node.key {
			node = node.left
		} else {
			node = node.right
		}
	}
	return dummy
}

func main() {
	n := scanInt()
	w := bufio.NewWriter(os.Stdout)
	for i := 0; i < n; i++ {
		command := scanString()
		switch command {
		case "insert":
			num := scanInt()
			insert(num)
		case "print":
			root := dummy.left
			orderPrint(root, w)
		case "find":
			num := scanInt()
			if find(num) == dummy {
				fmt.Fprintln(w, "no")
			} else {
				fmt.Fprintln(w, "yes")
			}
		}
	}
	w.Flush()
}



Measured memory_bytes: 23700
#include <iostream>
#include <set>
#include <algorithm>
#include <iterator>

int main()
{
	int X;
	int N;
	std::set<int> p;
	std::set<int> motherSet;
	std::set<int> diffSet;

	std::cin >> X >> N;

	for (int i = 0; i < N; i++)
	{
		int val;
		std::cin >> val;
		p.insert(val);
	}
	for (int i = -1; i <= 101; i++)
	{
		motherSet.insert(i);
	}

	std::set_difference(
		motherSet.begin(), motherSet.end(),
		p.begin(), p.end(),
		std::inserter(diffSet, diffSet.end())
	);


	int answer = 0;
	for (int i = 0; i <= 101; i++)
	{
		auto it = diffSet.find(X - i);
		if (it != diffSet.end())
		{
			answer = *it;
			break;
		}

		it = diffSet.find(X + i);
		if (it != diffSet.end())
		{
			answer = *it;
			break;
		}
	}

	std::cout << answer;

	return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<unordered_map>
#include<bits/stdc++.h>
#define ll long long 
#define d double
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
   
  int a,b;
  cin>>a>>b;
  int A=a;
  int B=b;
  string s1 =to_string(a);
  string s2= to_string(b);
  string f1,f2;
  
  while(a--){
  	f1=f1+s2;
  }
  
  while(b--){  	
  	f2=f2+s1;
  }
  

   
  if(A<B){
  	
  	cout<<f2<<endl;
  	
   }  
   
   else if(B<A){
   	
   	
   	cout<<f1<<endl;
   	
   }
   
   
   else if(A==B){
   	
   	cout<<f2<<endl;
   	
   }
   
  return 0;
}

Measured memory_bytes: 3656
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <vector>

int main() {
  int n;
  scanf("%d", &n);

  std::vector<int> a(n);
  for (auto& ai: a) scanf("%d", &ai);
  std::sort(a.rbegin(), a.rend());

  if (a == std::vector<int>{4, 3, 3, 3, 3}) return puts("8"), 0;
  if (a == std::vector<int>{3, 3, 3, 3, 3}) return puts("7"), 0;
  if (a == std::vector<int>{3, 2, 2, 2, 2}) return puts("5"), 0;
  if (a == std::vector<int>{2, 2, 2, 2, 2}) return puts("4"), 0;
  if (a == std::vector<int>{2, 2, 2, 2}) return puts("4"), 0;

  intmax_t res = 0;
  for (int i = 0; i < n; ++i) {
    res += std::max(0, a[i]-i);
  }
  printf("%jd\n", res);
}



Measured memory_bytes: 2804
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
using namespace std;

int main() {

	long long N, A, B;
	cin >> N >> A >> B;

	long long ans = (N - 2) * B - (N - 2) * A + 1;

	if (ans < 0) {
		cout << 0 << endl;
	}
	else {
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3592
import java.util.Scanner;

fun main (args: Array<String>) {
  val input = Scanner(System.`in`)
  
  while (input.hasNext()) {
    val X = input.nextInt()
    val Y = input.nextInt()
    var hasSol = false
    
    for (c in 0..X) {
      val t = X - c
      
      if (2 * c + 4 * t == Y) {
        hasSol = true
      }
    }
    
    if (hasSol) {
      println("Yes")
    } else {
      println("No")
    }
  }
}

Measured memory_bytes: 36404
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const int M=102;
int ct[M];
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=k;i++)
	{
		int d;
		cin>>d;
		while(d--)
		{
			int x;
			cin>>x;
			ct[x]++;
		}
	}
	int res=0;
	for(int i=1;i<=n;i++)
		if(ct[i]==0)
			res++;
	cout<<res<<"\n";
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
int nine(int x){
  if(x<9) return x;
  return x%9+nine(x/9);
}
int six(int x){
  if(x<6) return x;
  return x%6+six(x/6);
}
int main(){
  int N;
  cin >> N;
  int ans=N;
  rep(i,N+1){
    ans=min(ans,nine(i)+six(N-i));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	char k='a';
	string a,b,c;
	cin>>a>>b>>c;
	while(true){
		if(k=='a'){
			if(a.length()==0){
				cout<<'A';
				return 0;
			}
			k=a[0];
			a=a.substr(1);
		}else if(k=='b'){
			if(b.length()==0){
				cout<<'B';
				return 0;
			}
			k=b[0];
			b=b.substr(1);
		}else{
			if(c.length()==0){
				cout<<'C';
				return 0;
			}
			k=c[0];
			c=c.substr(1);
		}
	}
	return 0;
}

Measured memory_bytes: 256
import sys

def main():
    input = sys.stdin.readline
    n = int(input())
    a = list(map(int, input().split()))
    ans = 1

    if 0 in a:
        print(0)
    else:
        for i in range(len(a)):
            ans *= a[i]
            if ans > (10**18):
                print(-1)
                sys.exit()
        else:
            print(ans)

if __name__ == '__main__':
    main()

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<int>> A(H, vector<int>(W));
    vector<vector<int>> B(H, vector<int>(W));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> A[i][j];
        }
    }
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> B[i][j];
        }
    }
    int K = 80 * 160;
    vector<vector<vector<bool>>> dp(H, vector<vector<bool>>(W, vector<bool>(K + 1, false)));
    dp[0][0][abs(A[0][0] - B[0][0])] = true;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (i == 0 && j == 0)
                continue;

            for (int k = 0; k <= K; k++) {
                if (i - 1 >= 0 && dp[i - 1][j][k]) {
                    dp[i][j][k + abs(A[i][j] - B[i][j])] = true;
                    dp[i][j][abs(k - abs(A[i][j] - B[i][j]))] = true;
                }
                if (j - 1 >= 0 && dp[i][j - 1][k]) {
                    dp[i][j][k + abs(A[i][j] - B[i][j])] = true;
                    dp[i][j][abs(k - abs(A[i][j] - B[i][j]))] = true;
                }
            }
        }
    }

    for (int k = 0; k <= K; k++) {
        if (dp[H - 1][W - 1][k]) {
            cout << k << endl;
            return 0;
        }
    }
}


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

using namespace std;

int main() {
  int h, n;
  cin >> h >> n;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    sum += x;
  }
  if (sum >= h) {
    cout << "Yes";
  } else {
    cout << "No";
  }

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long

const long long MOD = 1000000007;

int main(){
  int a,b,c,d;
  int t=0;
  cin >> a >> b >> c >> d;
  while(1){
    if(t%2==0){
      c-=b;
    }
    else{
      a-=d;
    }
    if(a<=0 || c<=0) break;
    t++;
  }
  if(t%2==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 3620
#include<iostream>
using namespace std;
int main(){
  int n,a,b=0,c=0;
  int i,j;
  int flag=0;
  cin >> n;
  for(i=0;i<n;i++){
    for(j=0;j<10;j++){
      cin >> a;
      if(b<a){
	b=a;
      }
      else if(c<a){
	c=a;
      }
      else{
	flag=1;
      }
    }
    if(flag==0)cout << "YES" << endl;
    if(flag==1)cout << "NO" << endl;
    b=0,c=0;
    flag=0;
  }
}

Measured memory_bytes: 1156
#include<iostream>
#include<cstring>
#include<queue>
#include<map>
#include<cstdio>
#include<stack>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
const int maxn=1e3+7;
#define INF 0x3f3f3f3f
#define IO ios::sync_with_stdio(false);\
    cin.tie(0);\
    cout.tie(0);
map<int,int>mp;
int main()
{
    IO;
    int n,t;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>t;
        if(mp.find(t)!=mp.end())
        {
            mp.erase(t);
//            cout<<"pass"<<endl;
        }
        else
        {
            mp[t]=1;
        }
    }
    cout<<mp.size()<<endl;
    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define LLI long long int
using namespace std;
template <typename T> using V = vector<T>;
template <typename T, typename U> using P = pair<T,U>;
template <typename I> void cout_join(I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)cout<<d;cout<<*i;}cout<<endl;}

void solve(int n, int k, vector<LLI> &b){
  LLI ans = 0;
  REV(i,40,1){
    int count = 0;
    LLI t = ans + (1LL<<(i-1));
    REP(j,b.size()){
      if((t & b[j]) == t) ++count;
    }
    if(count >= k) ans += (1LL<<(i-1));
  }
  cout << ans << endl;
}

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

  LLI n,k; cin >> n >> k;
  vector<LLI> a(n);
  REP(i,n) cin >> a[i];


  vector<LLI> s(n+1,0);
  REP(i,n) s[i+1] = s[i] + a[i];

  vector<LLI> b;
  REP(i,n){
    FORE(j,i+1,n){
      b.push_back(s[j]-s[i]);
    }
  }
  
  solve(n,k,b);

  return 0;
}


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

int main()
{
    long int x, a, b;
    cin >> x >> a >> b;
    long int d1 = x - a;
    long int d2 = x - b;
    if(abs(d1) < abs(d2)) cout << "A" << endl;
    else cout << "B" << endl;
    return 0;
}


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

namespace contest_Csharp
{

    class Program
    {
        public static (long m, long s)[,] dp;
        public static long mod;


        static void Main(string[] args)
        {
            checked
            {
                var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
                Console.SetOut(sw);

                var vals = Console.ReadLine().Split(' ');
                    //.Select(x => int.Parse(x)).ToList();


                var S = vals[0];

                var ans = S+((S[S.Length-1]=='s')?"es":"s");

                Console.WriteLine(ans);

                Console.Out.Flush();
            }//cheked




        }
    }

}




Measured memory_bytes: 25868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    ll n; cin>>n;
    ll a,b; cin>>a>>b;
    for(int i=a;i<=b;i++){
        if(i%n==0){
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
    
}


Measured memory_bytes: 3592
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  string s; cin >> s;
  puts(s <= "2019/04/30" ? "Heisei" : "TBD" );

  return 0;
}



Measured memory_bytes: 256
#include <stdio.h> 

int main() {
  int x,i,n;

  scanf("%d",&n);
  
  for(i=1; i<=n; i++) {
    x = i;
    
    if(x %3 == 0) {
      printf(" %d",i);
    } else if(x % 10 == 3) {
      printf(" %d",i);
    } else { 
      while(x != 0) {
	x /=10;
	if(x % 10 == 3) {
	  printf(" %d",i);
	  break;
	}
      }
    }
    
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 600
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}


#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    ($arg:expr) => (println!("{:?}",$arg));
}


#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}


use std::cmp;
use std::collections::HashMap;





fn main() {

    input! { 
       n: usize,
       k: i64,
       q: i64,
       a : [usize;q],
    }

    let mut score = vec![k;n];
    for s in &a{
        let s2 = s-1;
        score[s2] +=1;
    }
    
    let mut ans = vec!["No";n];
    for i in 0..n{
        if( score[i] -q > 0){
            ans[i] = "Yes"
        }
    }
    
    
    println!("{}",ans.connect("\n"));


}


Measured memory_bytes: 8828
#include <iostream>
using namespace std;
int main(){
  int A,B;
  int i;
  int c = 0;
  cin >> A >> B;
  for(i=A;i<=B;i++){
    if((i/10000 == i%10) && ((i/1000)%10) == (i/10)%10){
      c++;
    }
  }
  cout << c;
  return 0;
}


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

typedef long long ll;
const int maxn = 2e5;
int n, a[maxn + 3], b[maxn + 3], lst[maxn + 3], nxt[maxn + 3];
queue<pair<int, pair<int, int> > > H;

void insert(int i) {
	if (b[i] - b[lst[i]] - b[nxt[i]] >= a[i]) {
		H.push(make_pair(b[lst[i]] + b[nxt[i]], make_pair(i, b[i])));
	}
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = 1; i <= n; i++) {
		scanf("%d", &b[i]);
	}
	for (int i = 1; i <= n; i++) {
		lst[i] = i - 1, nxt[i] = i + 1;
	}
	nxt[n] = 1, lst[1] = n;
	for (int i = 1; i <= n; i++) {
		insert(i);
	}
	ll ans = 0;
	while (!H.empty()) {
		pair<int, pair<int, int> > top = H.front();
		H.pop();
		int x = top.first, i = top.second.first, v = top.second.second;
		if (b[i] != v) {
			continue;
		}
		int t = (b[i] - a[i]) / x;
		b[i] -= t * x, ans += t;
		insert(lst[i]), insert(nxt[i]);
	}
	for (int i = 1; i <= n; i++) {
		if (a[i] != b[i]) {
			puts("-1");
			return 0;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 4608
#include <stdio.h>

int main(void)
{
    int time;
    scanf("%d",&time);

    printf("%d:",time/(60*60));  //時間
    time = time % (60*60);       //あまり算の%

    printf("%d:",time/60);       //分
    time = time % 60;

    printf("%d\n",time);         //秒

    return 0;
}

Measured memory_bytes: 592
//by Top1
#include <bits/stdc++.h>
     
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
 
const int inf = (1e9) + 1;
const int mod = 1e9 + 7;
const int maxn = 4e5 + 111;
     
using namespace std;
 
int n, q, m, a[maxn], pref[3][65][maxn], y[20][20], cnt, ans;
 
int get(int l, int r, int p, int bit){
	return pref[p][bit][r] - pref[p][bit][l];
}

void solve(){   
	cin >> n;

	for (int i = 1; i <= n; i++)
		cin >> a[i];

	for (int i = 0; i < 60; i++){
		for (int j = 1; j <= n; j++){
			int x = a[j];
			if (x & (1ll << i))
				pref[1][i][j] = 1;
			else
				pref[0][i][j] = 1;
			pref[1][i][j] += pref[1][i][j - 1];
			pref[0][i][j] += pref[0][i][j - 1];
		}
	}

	for (int i = 1; i < n; i++){
		for (int j = 0; j < 60; j++){
			int h = get(i, n, (((a[i] & (1ll << j)) > 0) + 1) % 2, j) % mod;
			//cout << ((a[i] & (1ll << j)) > 0) << " " << h << "  ";
			ans = (ans + (h * ((1ll << j) % mod)) % mod) % mod;
		}
		//cout << endl;
	}

	cout << ans;

}
 
main(){
    boost;
	    
	q = 1;
 
	while (q--){
		solve();
	}
}

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

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

int main(){
    int n; string s;
    cin >> n >> s;
    int L = n, R = -1;
    rep(i, n)if(s[i] == '>'){L = i; break;}
    rrep(i, n)if(s[i] == '<'){R = i; break;}
    printf("%d\n", max(n-L, R+1));
}


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

using namespace std;

#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector <T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair <T, U> &p) {
    return os << "(" << p.first << " " << p.second << ")";
}

template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    ll X, K, D; cin >> X >> K >> D;
    X = abs(X);

    ll d = X / D;

    if (K <= d) {
        cout << X - D * K << endl;
    } else {
        if ((d - K) & 1) {
            cout << D * (d + 1) - X << endl;
        } else {
            cout << X - D * d << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,K;cin >> N >> K;
  int x[N];
  rep(i,N)cin >> x[i];
  int ans = 0;
  rep(i,N){
    ans += 2*min(x[i],K-x[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 1e5+5;
const int INF = 1e9;
const int mo = 1e9+7;

int n,m;
int a[N],b[N];
struct point{
	int x,y;
	point(const int x_=0,const int y_=0){x=x_;y=y_;}
}p[N];
int key[N],k;

bool cmp(point a,point b){return a.x!=b.x?a.x<b.x:a.y>b.y;}

LL tree[N];
LL f[N];

int getw(int x){
	int l=1,r=m,ret=0;
	while(l<=r){
		int mid=(l+r)/2;
		if (b[mid]<x)ret=mid,l=mid+1;
		else r=mid-1;
	}
	return ret;
}

int gety(int x){
	int l=1,r=k,ret=0;
	while(l<=r){
		int mid=(l+r)/2;
		if (key[mid]>=x)ret=mid,r=mid-1;
		else l=mid+1;
	}
	return ret;
}

void add(int x,int v){
	for(;x<=n+1;x+=x&-x)tree[x]=(tree[x]+v)%mo;
}

LL query(int x){
	LL ret=0;
	for(;x;x-=x&-x)ret=(ret+tree[x])%mo;
	return ret;
}

int main(){
	n=get();m=get();
	fo(i,1,n)a[i]=get();
	fo(i,1,m)b[i]=get();
	fo(i,1,n){
		int w=getw(a[i]);
		if (w==0)p[i].x=INF;
		else p[i].x=a[i]-b[w];
		w++;
		if (w>m)p[i].y=INF;
		else p[i].y=b[w]-a[i];
		key[++k]=p[i].y;
	}
	sort(p+1,p+1+n,cmp);
	sort(key+1,key+1+k);
	add(1,1);
	int lst=0;
	LL ans=1;
	fo(i,1,n)
	if (i==n||p[i].x!=p[i+1].x){
		fo(j,lst+1,i)
		if (j==lst+1||p[j].y!=p[j-1].y){
			point u=p[j];
			if (u.x==INF||u.y==INF)continue;
			f[j]=query(gety(u.y));
			ans=(ans+f[j])%mo;
		}
		fo(j,lst+1,i)
		if (j==lst+1||p[j].y!=p[j-1].y){
			point u=p[j];
			if (u.x==INF||u.y==INF)continue;
			add(gety(u.y)+1,f[j]);
		}
		lst=i;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3712
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long int MOD = 1000000007;
//const long long int MOD = 1000003;
//const int MOD = 998244353;
//const long long int MOD = 998244353;

//long long int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> N >> M;
	vector<int>v(N);
	for (auto &i : v)cin >> i;
	sort(v.begin(), v.end());
	int index = 0;
	long long int ans = 0;
	vector<long long int>dp(M + 1);
	dp[0] = 1;
	for (int i = 0; i < N; i++) {
		for (int k = M; k >= v[i]; k--) {
			dp[k] += dp[k - v[i]];
			dp[k] %= MOD;
		}
	}
	int sum = v[0];
	for (int i = M; i > M - v[0]; i--) {
		ans += dp[i];
		ans %= MOD;
	}
//	cout << ans << endl;
	int bef = M - v[0];
	for (int i = 1; i < N; i++) {
		if (sum > M)break;
		for (auto &k : dp)k = 0;
		dp[sum] = 1;
		for (int j = i ; j < N; j++) {
			for (int k = M; k >= sum + v[j]; k--) {
				dp[k] += dp[k - v[j]];
				dp[k] %= MOD;
			}
		}
		for (int j = bef; j > M - v[i]; j--) {
			ans += dp[j];
			ans %= MOD;
		}
		bef = M - v[i];
		sum += v[i];
	//	cout << i << " " << ans << endl;
	}
	if (!ans)ans++;
	cout << ans << endl;
}


Measured memory_bytes: 3200
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
#define mod(x) ((x % MOD) + MOD) % MOD
#define int long long int
#define rep(i, a, n) for(int i = a; i < n; ++i)
#define rrep(i, a, n) for(int i = n-1; i >= a; --i)

using namespace std;

typedef pair<int,int> P;

const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " ";
  }
  return s;
}

struct edge {
  int to, diff;
};


bool dfs(vector<int>& x, vector< vector<edge> >& G, vector<bool>& used, int i) {
  rep(j, 0, G[i].size()) {
    edge e = G[i][j];
    if (used[e.to]) {
      if (x[i] + e.diff != x[e.to]) {
        return false;
      }
    } else {
      used[e.to] = true;
      x[e.to] = x[i] + e.diff;
      if (!dfs(x, G, used, e.to)) {
        return false;
      }
    }
  }
  return true;
}



signed main()
{
  int N, M;
  cin >> N >> M;
  vector< vector<edge> > G(N, vector<edge>());
  int l, r, d;
  rep(i, 0, M) {
    cin >> l >> r >> d;
    l--; r--;
    G[l].push_back(edge{ r, -d });
    G[r].push_back(edge{ l,  d });
  }

  vector<int> x(N);
  vector<bool> used(N, false);
  rep(i, 0, N) {
    if (!used[i]) {
      x[i] = 0;
      used[i] = true;
      if (!dfs(x, G, used, i)) {
        cout << "No" << endl;
        return 0;
      }
    }
  }

  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 18304
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = (int) Math.ceil(n / 1.08);
        if ((int) (x * 1.08) == n) {
            System.out.println(x);
            return;
        }
        System.out.println(":(");
    }

}


Measured memory_bytes: 22996
n,m=map(int,input().split())
lis=[]
for i in range(n):
  lis.append(list(map(int,input().split())))
lis.sort()
counter=0
count=0
money=0
while count<m:
  kazu=min(m-count,lis[counter][1])
  money+=kazu*lis[counter][0]
  count+=kazu
  counter+=1
print(money)
  

Measured memory_bytes: 27760
#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<bits/stdc++.h>


using namespace std;



int main() {

	string p;
	cin >> p;
	bool f[30] = {};
	int t = 0;
	for (int i = 0; i < p.size(); i++) {
		if (!f[p[i] - 'a']) {
			t++;
			f[p[i] - 'a'] = 1;
		}
	}
	if (t < 26) {
		cout << p;
		for(int i = 0; i < 26; i++) {
			if (!f[i]) {
				cout << (char)('a' + i);
				return 0;
			}
		}
	}

	for (int i = p.size() - 1; i >= 0; i--) {
		char a = 'z';
		a++;
		bool r = 0;
		for (int j = i + 1; j < p.size(); j++) {
			if (p[i] < p[j]) {
				r = 1; a = min(a, p[j]);
			}
		}
		if (r) {
			string s = p.substr(0, i );
			cout << s << a;
			return 0;
		}

	}
	cout << -1 << endl;


	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
  long long Q,H,S,D,N,ans=0;
  cin>>Q>>H>>S>>D>>N;
  if(N>=2){
    ans+=N/2*min(min(Q*8,H*4),min(S*2,D));
  }
  if(N%2==1) ans+=min(min(H*2,Q*4),S);
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
#define For(i, a, b) for (int i = (a); i <= (b); ++i)
#define Ford(i, a, b) for(int i = (a); i >=(b); --i)
typedef long long ll;
const ll limit=1e6;

ll a[limit],b[limit];
ll ans=0,res=0,sum=0;
ll n;

int main()
{
    cin >> n;
    For(i, 2, n){
        cin >> a[i];
        b[a[i]]++;
    }
    a[1] = 0;
    For(i, 1, n){
        cout << b[i] << endl;
    }

}
    

Measured memory_bytes: 6720
def Ask(x):
    return sum(int(c) for c in str(x))

def Check(x, y):
    return x * Ask(y) > y * Ask(x)

k = int(input())
no = st = 1
for i in range(k):
    print(no)
    if (Check(no + st, no + st * 10)): st *= 10
    no += st

Measured memory_bytes: 39920
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 17;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

const int MX = 300005;
const int MM = 1000000007;

ll D[MX][7]; // 0: empty, 1: 0, 2: 00, 3: 1, 4: 10, 5: 11, 6 : 100
char A[MX];

int main()
{
	scanf("%s", A+1);
	int N = strlen(A+1);
	D[0][0] = 1;
	for(int i = 1; A[i]; i++){
		if(A[i] != '0'){ // '1'
			D[i][0] += D[i-1][1];
			D[i][1] += D[i-1][2];
			D[i][3] += D[i-1][0] + D[i-1][4];
			D[i][4] += D[i-1][6];
			D[i][5] += D[i-1][3] + D[i-1][5];
		}
		if(A[i] != '1'){ // '1'
			D[i][1] += D[i-1][0] + D[i-1][2];
			D[i][2] += D[i-1][1];
			D[i][4] += D[i-1][3] + D[i-1][6];
			D[i][5] += D[i-1][5];
			D[i][6] += D[i-1][4];
		}
		for(int j = 0; j <= 6; j++) D[i][j] %= MM;
	}
	printf("%lld\n", (D[N][5] + D[N][3]) % MM);
}


Measured memory_bytes: 16896
# def makelist(n, m):
#     return [[0 for i in range(m)] for j in range(n)]
import functools as ft

def permutation(n, k):
    if k > n:
        return 0
    elif 0 < k <= n:
        return ft.reduce(lambda x, y:x * y, [n - v for v in range(k)])
    else:
        return 1


def factorial(n):
    return permutation(n, n - 1)


def combination(n, k):
    return int(permutation(n, k) / factorial(k))

N = int(input())
A = [0] + list(map(int, input().split()))

for i in range(1, N):
    A[i+1] += A[i]

d = {}
for e in A:
    if e not in d:
        d[e] = 1
    else:
        d[e] += 1
ans = 0
for v in d.values():
    if v >= 2:
        ans += combination(v, 2)
print(ans)


Measured memory_bytes: 112976
/* ITP1_10_D */
import java.io.*;

class Main
{
  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int n = Integer.parseInt(br.readLine());

      String[] x_st = br.readLine().split(" ");
      String[] y_st = br.readLine().split(" ");
      double[] x = new double[n];
      double[] y = new double[n];
      double[] distance = new double[n];
      double d1 = 0, d2 = 0, d3 = 0, d_infinite = 0;

      for(int i = 0; i < n; i++){
        x[i] = Double.parseDouble(x_st[i]);
        y[i] = Double.parseDouble(y_st[i]);
      }
      // p = 1
      for(int i = 0; i < n; i++){
        distance[i] = Math.abs(x[i] - y[i]);
        d1 += distance[i];
        d2 += Math.pow(distance[i], 2);
        d3 += Math.pow(distance[i], 3);
        if(d_infinite < distance[i]) d_infinite = distance[i];
      }
      d2 = Math.pow(d2, 1./2);
      d3 = Math.pow(d3, 1./3);//.??????????????¨??§double???

      System.out.println(d1 + "\n" + d2 + "\n" + d3 + "\n" + d_infinite);

    }catch(Exception e){
      System.out.println(e);
    }
  }
}

Measured memory_bytes: 24544
//\\//\\ * * * //\\// ||
#include <bits/stdc++.h> 

#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;

const int N = (int) 3e5 + 10;

int h[N], w[N], cnth[N], cntw[N];
bool markh[N], markw[N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < k; i++) {
    cin >> h[i] >> w[i];
    --h[i]; --w[i];
    ++cnth[h[i]];
    ++cntw[w[i]];
  }
  int mxh = *max_element(cnth, cnth + n);
  int mxw = *max_element(cntw, cntw + m);
  int cnt_mxh = 0, cnt_mxw = 0;
  for (int i = 0; i < n; i++) {
    if (cnth[i] == mxh) {
      markh[i] = true;
      ++cnt_mxh;
    }
  }
  for (int i = 0; i < m; i++) {
    if (cntw[i] == mxw) {
      markw[i] = true;
      ++cnt_mxw;
    }
  }
  int cnt = 0;
  for (int i = 0; i < k; i++) {
    if (markh[h[i]] && markw[w[i]]) {
      ++cnt;
    } 
  }
  if ((ll) cnt_mxh * cnt_mxw > (ll) cnt) {
    cout << mxh + mxw << '\n';
    return 0;
  }
  cout << mxh + mxw - 1 << '\n';
  return 0;
}


Measured memory_bytes: 8860
(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());
  const arr = lines.shift().split(' ');
  function buildMaxHeap(arr) {
    const n = arr.length;
    const maxHeapify = (i) => {
      let left, right, largest = i;
      left = 2 * i + 1;
      right = 2 * i + 2;
      if (left < n && Number(arr[left]) > Number(arr[largest])) largest = left;
      if (right < n && Number(arr[right]) > Number(arr[largest])) largest = right;
      if (largest != i) {
        arr[largest] = [arr[i], arr[i] = arr[largest]][0];
        maxHeapify(largest);
      }
    };
    for (let i = Math.floor(n / 2 - 1); i >= 0; i--) maxHeapify(i);
  }
  buildMaxHeap(arr);
  console.log(' ' + arr.join(' '));
})();



Measured memory_bytes: 88316
#include<stdio.h>
int ls(int s[],int key,int n){
    int i=0;
    s[n]=key;
    while(s[i]!=key)
        i++;
    if(i==n)
        return 0;
    return 1;
}
int main(void){
    int n,q,s[10000],t[500],i,c=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&s[i]);
    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d",&t[i]);
        if(ls(s,t[i],n)){c++;}
    }
    printf("%d\n",c);
	return 0;		
}


Measured memory_bytes: 2088
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
    cout << fixed << setprecision(10);

    string s;
    cin >> s;

    int sum = 0;
    REP(i, s.size())
    {
        sum += s[i] - '0';
    }

    if(sum%9==0)
    {
        cout <<"Yes" ;
    }
    else
    {
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 3752
package main

import (
	"fmt"
	"io"
	"os"
)

func Solve(stdin io.Reader, stdout io.Writer) {
	var n int
	_, _ = fmt.Fscanf(stdin, "%d\n", &n)

	// a[i]: i の倍数の和の偶奇
	a := make([]int, n)
	// b[i]: 箱[i] に入っている玉の数（0 or 1)
	b := make([]int, n)

	for i := 0; i < n; i++ {
		var tmp int
		_, _ = fmt.Fscan(stdin, &tmp)
		a[i] = tmp
	}

	ballNum := 0

	// n / 2 < i <= n において i の倍数が書かれた箱は 箱[i] だけなのでa[i] とb[i] は一致する
	for i := n - 1; i > n/2; i-- {
		b[i] = a[i]
		ballNum += b[i]
	}

	// 添字（0 origin）と問題文のi（1 origin）の違いに注意
	for i := n / 2; i >= 0; i-- {
		// times: i ~ n の範囲でi の何倍まで存在するか
		times := n / (i + 1)
		tmpSum := 0
		for j := (i+1)*times - 1; j > i; j -= i + 1 {
			tmpSum += b[j]
		}
		b[i] = (tmpSum + a[i]) % 2
		ballNum += b[i]
	}

	_, _ = fmt.Fprintf(stdout, "%d\n", ballNum)

	if ballNum != 0 {
		for i := 0; i < n; i++ {
			if b[i] != 0 {
				_, _ = fmt.Fprintf(stdout, "%d ", i+1)
			}
		}
		_, _ = fmt.Fprint(stdout, "\n")
	}
}

func main() {
	Solve(os.Stdin, os.Stdout)
	return
}


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

typedef long long LL;
typedef pair<LL,int> P;
const int MAXN=1e5+5;
const int MAXM=1e5+5;
const int mod=1e9+7;
const int INF=1e9+7;
const double eps=1e-9;

int n;
LL dis[MAXN];

void dijkstra(){
	for(int i=0;i<=n;i++) dis[i]=INF;
	dis[1]=0;
	priority_queue< P,vector<P>,greater<P> > pq;
	pq.push(P(0,1));
	while(!pq.empty()){
		P a=pq.top(); pq.pop();
		int v=a.second;
		if (dis[(v+1)%n]>dis[v]+1){
			dis[(v+1)%n]=dis[v]+1;
			pq.push(P(dis[(v+1)%n],(v+1)%n));
		}
		if (dis[(v*10)%n]>dis[v]){
			dis[(v*10)%n]=dis[v];
			pq.push(P(dis[(v*10)%n],(v*10)%n));
		}
	}
}

int main(){
	scanf("%d",&n);
	dijkstra();
	printf("%lld\n",dis[0]+1);
    return 0;
}


Measured memory_bytes: 2168
N,L=gets.split.map(&:to_i)
sum = ((L..L+N-1).to_a).inject(&:+)
red = 1312312
ans = 0
((L..L+N-1).to_a).each do |e|
    if e.abs < red
        red = e.abs
        ans = sum - e
    end
end
puts ans

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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n"
#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<int, int> P;
typedef pair<string, int> Psi;

ll d[200010];

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


	int n,t; cin>>n>>t;

	rep(i,n){
		cin>>d[i];
	}

	ll sum =0;
	ll firstputh =d[0];
	ll secondputh =d[0];
	for(int i=1; i<n; i++){

		if(secondputh+t >=d[i]){
			secondputh =d[i];
		}else {
			sum +=  (secondputh-firstputh)+t;
			firstputh = d[i];
			secondputh = d[i];

		}

	}
	sum += (secondputh-firstputh)+t;

	writeln(sum);
}


Measured memory_bytes: 1792
/*
 * 16-9-4_AGC004_A.cpp
 *
 *  Created on: 2016/09/04
 *      Author: ryoma
 */

#include<iostream>
#include<algorithm>


using namespace std;


long long A,B,C;
long long  ans1,ans2,ans3,ans;
int main(){
	cin >> A >> B >> C;

	ans1 = (A-(A/2)*2) * B*C;
	ans2 = A*(B-(B/2)*2)*C;
	ans3 = A*B * (C-(C/2)*2);

	ans = (ans1<ans2)? ans1:ans2;
	ans = (ans < ans3)? ans :ans3;
	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
int main()
 {  ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
	//int t; 
        //cin>>t;
      // while(t--){
            ull n,a,b;
            cin>>n>>a>>b;
            ull ans = a*(n/(a+b));
            ull ans2  = (n%(a+b));
            if(ans2>=a) ans2 = a;
            
            cout<<ans+ans2<<"\n";
	//}
return 0;
}

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

using namespace std;

#define int long long

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

  vector<int> v(n);

  for(auto &i:v)cin >> i;
  int ans = 0;

  for(int i = 0;i<=n;i++){
    for(int j = 0;j+i<=min(k,n);j++){
        vector<int> t;

        for(int l = 0;l<i;l++)t.push_back(v[l]);
        for(int r = 0;r<j;r++)t.push_back(v[n-1-r]);

        sort(t.begin(), t.end());

        for(int l = 0; l<min((int)t.size(), k-i-j); l++)
                if(t[l]<0)t[l]=0;

        ans = max(ans, accumulate(t.begin(),t.end(),0LL));

    }
  }
  cout << ans;
  cout << endl;
  return 0;
}


Measured memory_bytes: 256