akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	static long ans = 0;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		sc.close();

		long ans = x / 11 * 2;
		long m = x % 11;
		if (m > 6) {
			System.out.println(ans + 2);
		} else if (m > 0) {
			System.out.println(ans + 1);
		} else {
			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 21332
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let n = nextInt()
    let alpha = "abcdefghijklmnopqrstuvwxyz"
    let arr = new Array(26).fill(-1)
    while(hasNext()){
        let str = next()
        let cnt = new Array(26).fill(0)
        for(let el of str){
            let idx = alpha.indexOf(el)
            cnt[idx]++
        }
        for(let i = 0; i<arr.length; i++){
            if(cnt[i] == 0) arr[i] = 0
            else if (arr[i] == -1 && cnt[i] !== 0) arr[i] = cnt[i]
            else if (arr[i] !== 0 && cnt[i] !== 0) arr[i] = Math.min(arr[i], cnt[i])
        }
    }
    let ans = []
    for(let i = 0; i<arr.length; i++){
        if(arr[i] == 0) continue
        while(arr[i]>0){
            ans.push(alpha[i])
            arr[i]--
        }
    }
    ans.sort()
    console.log(ans.join(""))
}
Main()



Measured memory_bytes: 30608
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>

using namespace std;

typedef long long ll;
typedef long double ld;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mis map<int,string>
#define msi map<string,int>
#define mll map<ll,ll>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep1(i,n) for(int i=1; i<=(int)(n); i++)
#define all(c) c.begin(),c.end()
#define srta(a) sort(all(a))
#define srtd(a) sort(all(a),greater<型>())
#define rvs(s) reverse(all(s))
#define psb push_back
#define ppb pop_back
#define isu isupper
#define isl islower
#define lb(a,k) lower_bound(all(a),k)
#define ub(a,k) upper_bound(all(a),k)
#define bs(a,k) binary_search(all(a),k)

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

const int I_INF = 1001001001;
const ll LL_INF = 1001001001001001001;
const ld EPS = 0.001;

int main() {
    ll L, R, d;
    cin >> L >> R >> d;

    int n = R/d;
    int cnt = 0;
    rep (i, n) {
        int b = (i+1)*d;
        if (b >= L) cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3516
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;

int main()
{
    int N;
    cin >> N;
    string s1[N];
    string s2[N];
    int p1[N];
    int p2[N];
    for (int i = 0; i < N; i++)
    {
        cin >> s1[i] >> p1[i];
    }
    for (int i = 0; i < N; i++)
    {
        s2[i] = s1[i];
    }
    for (int i = 0; i < N; i++)
    {
        p2[i] = p1[i];
    }
    for (int i = 0; i < N; i++)
    {
        for (int k = i + 1; k < N; k++)
        {
            if(s1[i].compare(s1[k]) > 0)
            {
                string l;
                l = s1[i];
                s1[i] = s1[k];
                s1[k] = l;

                int v;
                v = p1[i];
                p1[i] = p1[k];
                p1[k] = v;
            }
        }
    }
    for (int i = 0; i < N; i++)
    {
        for (int k = i + 1; k < N; k++)
        {
            if(p1[i] < p1[k] && s1[i] == s1[k])
            {
                string l;
                l = s1[i];
                s1[i] = s1[k];
                s1[k] = l;

                int v;
                v = p1[i];
                p1[i] = p1[k];
                p1[k] = v;
            }
        }
    }
    //あとは、もとの数列、配列と当てはめて、該当する番号を出力するのみ。
    for (int i = 0; i < N; i++)
    {
        for (int k = 0; k < N; k++)
        {
            if(p1[i] == p2[k] && s1[i] == s2[k])
            {
                cout << k+1 << endl;
            }
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#include<stack>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;
//set<int>::iterator it;



int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int a,b,c,i,d[3];
	cin>>a>>b>>c;
	if(a%2!=0||b%2!=0||c%2!=0){
		cout<<0<<endl;
		return 0;
	}
	
	for(i=0;i<10000000;i++){
		d[0]=a/2;d[1]=b/2;d[2]=c/2;
		a=d[1]+d[2];
		b=d[0]+d[2];
		c=d[0]+d[1];
		if(a%2!=0||b%2!=0||c%2!=0){
			cout<<i+1<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;
import java.util.*;

public class Main {
	int w, h, cnt, k;
	char[][] map;
	Point2D.Double[][] p;
	boolean check;
	boolean[] f;
	
	
	
	Point2D.Double dfs(int n){
		f[n] = true;
		boolean flag;
		LinkedList<Point2D.Double> list = new LinkedList<Point2D.Double>();
		
		double minx = Integer.MAX_VALUE;
		double maxx = 0;
		
		if(n==0){
			for(int i=0;i<4;i++){
				if(p[n][i].y==0){
					minx = Math.min(minx, p[n][i].x);
					maxx = Math.max(maxx, p[n][i].x);
				}
			}
		}else{
			for(int i=0;i<4;i++){
				for(int s=0;s<cnt;s++){
					if(s!=n){
						for(int t=0;t<4;t++){
							if(p[n][i].x==p[s][t].x && p[n][i].y-1==p[s][t].y){
								minx = Math.min(minx, p[n][i].x);
								maxx = Math.max(maxx, p[n][i].x);
							}
						}
					}
				}
			}
		}
	
		
		for(int i=0;i<4;i++){
			flag = false;
			for(int j=0;j<4;j++) if(p[n][i].x==p[n][j].x && p[n][i].y+1==p[n][j].y) flag=true;
			if(flag==false){
				for(int s=0;s<cnt;s++){
					for(int t=0;t<4;t++){
						if(f[s]==false && p[n][i].x==p[s][t].x && p[n][i].y+1==p[s][t].y){
							list.add(dfs(s));
							s = cnt;
							t = 4;
						}
					}
				}
			}
		}
		
		double sumw = 4;
		double sumx = 0;
		for(int i=0;i<list.size();i++){
			sumx += list.get(i).x * list.get(i).y;
			sumw += list.get(i).y;
		}
		for(int i=0;i<4;i++) sumx += p[n][i].x;
		
		sumx/=sumw;
		//System.out.println(sumx + " " + (minx-0.5) + " " + (maxx+0.5));
		if(minx-0.5>=sumx || maxx+0.5<=sumx){
			check = false;
		}
		
		//System.out.println(sumx/sumw + " " + sumw);
		return new Point2D.Double(sumx,sumw);
	}
	
	
	
	
	void search(int y, int x, char c){
		k++;
		p[cnt][k] = new Point2D.Double(x,y);
		map[y][x] = '.';
		if(y!=h-1 && map[y+1][x]==c) search(y+1,x,c);
		if(x!=w-1 && map[y][x+1]==c) search(y,x+1,c);
		if(x!=0 && map[y][x-1]==c) search(y,x-1,c);
	}
	
	void setP(){
		cnt = 0;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(map[i][j]!='.'){
					k = -1;
					search(i,j,map[i][j]);
					cnt++;
				}
			}
		}
	}
	
	void solve(){
		Scanner sc = new Scanner(System.in);
		
		while(true){
			w = sc.nextInt();
			h = sc.nextInt();
			if(w==0 && h==0) break;
			
			map = new char[h][w];
			p = new Point2D.Double[(w*h)/4][4];
			for(int i=h-1;i>=0;i--) map[i] = sc.next().toCharArray();
			setP();
			check = true;
			f = new boolean[cnt];
			dfs(0);
			if(check==true) System.out.println("STABLE");
			else System.out.println("UNSTABLE");
		}	
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}	
}

Measured memory_bytes: 27032
io = STDIN
a,b,c=io.gets.chomp.split.map(&:to_i)
p [(a*b*(c/2)-a*b*(c-(c/2))).abs,
  (c*b*(a/2)-c*b*(a-(a/2))).abs,
  (a*c*(b/2)-a*c*(b-(b/2))).abs].min

Measured memory_bytes: 1788
package main

import "fmt"

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	if N == 1 {
		if M == 1 {
			fmt.Println(1)
		} else {
			fmt.Println(M - 2)
		}
		return
	}
	if N == 2 {
		fmt.Println(0)
		return
	}
	if M == 1 {
		fmt.Println(N - 2)
	} else {
		fmt.Println((N - 2) * (M - 2))
	}

}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <limits>
#include <bitset>
#include <functional>
#include <type_traits>
#include <queue>
#include <stack>
#include <array>
#include <random>
#include <utility>
#include <cstdlib>
#include <ctime>

using namespace std;

#define rep(i, n) for (int i=0; i < (int)n; i++)
#define rep2(i, begin_i, end_i) for (int i = (int)begin_i; i < (int)end_i; i++)

int main()
{
    int N;
    cin >> N;
    int a[N],odd_count=0,even_count=0;
    bool check=true;

    rep(i,N){
        cin>>a[i];
        if(a[i]%2==0){
            even_count++;
        }
        else{
            odd_count++;
        }
    }

    if(odd_count%2==1){
        check=false;
    }
    else{
        odd_count/=2;
        even_count+=odd_count;
    }

    if(check)
        cout<<"YES"<<endl;
    else
    {
        cout<<"NO"<<endl;
    }
    return 0;
}


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

int main()
{
	int n, m;
	double a[100];
	double total = 0; //number of votes total

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

	sort(a, a + n); //put in order

	double threshold = total / (4 * m);
	if (a[n - m] >= threshold) //mth works, so we have at least m that work
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	/*int ok = 0; //num ok
	float compare = total / (4 * m);
	for (int j = 0; j < n; j++)
	{
		if (a[j] >= compare)
		{
			ok++;
		}
	}

	if (ok >= m)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}*/
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

template <class T>
class SegTree {
    int n;
    vector<T> data;
    T def;
    function<T(T, T)> operation;
    function<T(T, T)> update;

    T _query(int a, int b, int k, int l, int r) {
        if (r <= a or b <= l) return def;
        if (a <= l and r <= b) return data[k];
        else {
            T c1 = _query(a, b, 2*k+1, l, (l+r)/2);
            T c2 = _query(a, b, 2*k+2, (l+r)/2, r);
            return operation(c1, c2);
        }
    }

    public:
    SegTree(size_t _n, T _def, function<T(T, T)> _operation, function<T(T, T)> _update) : def(_def), operation(_operation), update(_update) {
        n = 1;
        while (n <= _n) {
            n *= 2;
        }
        data = vector<T>(2*n-1, def);
    }

    void change(int i, T x) {
        i += n-1;
        data[i] = update(data[i], x);
        while (i > 0) {
            i = (i-1) / 2;
            data[i] = operation(data[i*2+1], data[i*2+2]);
        }
    }

    T query(int a, int b) {
        return _query(a, b, 0, 0, n);
    }

    T operator[] (int i) {
        return data[i+n-1];
    }
};

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

    ll N, K;
    cin >> N >> K;

    SegTree<ll> st(N, 0, [](ll a, ll b){return a+b;}, [](ll a, ll b) {return b;});

    vec a(N);

    Rep (i, N) {
        cin >> a[i];
        st.change(i, max<ll>(0, a[i]));
    }

    ll ans = 0;
    ll tmp = 0;
    Rep (i, K) {
        tmp += a[i];
    }

    ans = max<ll>(0, tmp) + st.query(K, N);

    Rep (i, N-K) {
        tmp -= a[i];
        tmp += a[i+K];
        chmax(ans, max<ll>(0, tmp) + st.query(0, i+1) + st.query(i+K+1, N));
    }

    cout << ans << endl;
}

Measured memory_bytes: 3072
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] input = scanner.nextLine().trim().split(" ");
        int a = Integer.parseInt(input[0]);
        int b = Integer.parseInt(input[1]);
        System.out.println((a + b) % 24);
    }
}


Measured memory_bytes: 21844
package main

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

type key struct {
	a, c int
}

func solve() {
	n, m := getInt(), getInt()
	keys := make([]key, m)
	for i := range keys {
		a, b := getInt(), getInt()
		keys[i].a = a
		for j := 0; j < b; j++ {
			c := uint(getInt())
			keys[i].c += (1 << (c - 1))
		}
	}

	dp := make([][]int, m+1)
	for i := range dp {
		dp[i] = make([]int, 1<<uint(n))
		for j := range dp[i] {
			dp[i][j] = inf
		}
	}
	dp[0][0] = 0

	for i := 1; i <= m; i++ {
		k := keys[i-1]
		for j := range dp[i] {
			dp[i][j] = min(dp[i][j], dp[i-1][j])
			dp[i][j|k.c] = min(dp[i][j|k.c], dp[i-1][j]+k.a)
		}
	}

	ans := dp[m][1<<uint(n)-1]
	if ans == inf {
		ans = -1
	}
	fmt.Fprintln(wr, ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 33792
#include <iostream>
using namespace std;
bool pd(int a,string s){
    if(s[a]!='1'){
        return false;
    }
    else{
        return true;
    }
}
int main(){
    int a,k,l=0;
    string s;
    cin>>s>>k;
    k--;
    for(a=0;a<s.size();a++){
        if(pd(a,s)==false){
            if(a<=k){
                cout<<s[a];
                return 0;
            }
        }
    }
    cout<<1;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }


struct P
{
	double x, y;
};

bool operator > (P x, P y)
{ return x.x > y.x || (x.x == y.x && x.y > y.x); }

int main()
{
	vector<P> p(4);

	int n;
	cin >> n;
	
	rep(i, n)
	{
		rep(i, 4)
			cin >> p[i].x >> p[i].y;

		if(p[0] > p[1]) swap(p[0], p[1]);
		if(p[2] > p[3]) swap(p[2], p[3]);
	
		if((p[0].x - p[1].x) * (p[2].y - p[3].y) == (p[0].y - p[1].y) * (p[2].x - p[3].x))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int n;
	double a, b, c;
	vector<double>l;
	cin >> n >> a >> b >> c;
	for (double i = 0; i < n; i++){
		double k;
		cin >> k;
		l.push_back(k);
	}
	sort(l.begin(), l.end());
	double maxc, nc, nd;
	nc = c;
	nd = a;
	maxc = c / a;
	for (int i = 1; i < n + 1; i++){
		nc += l[n - i];
		nd += b;
		maxc = max(nc / nd, maxc);
	}
	cout << (int)maxc << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  string s; cin >> s;
  int len = s.length();
  map<int, int> num; num[0] = 1;
  int now = 0;
  rep(i,len) {
    now ^= (1<<(s[i]-'a'));
    if (!num[now]) num[now] = INF;
    rep(j,26) {
      if (num[now^(1<<j)]) {
        num[now] = min(num[now], num[now^(1<<j)]+1);
      }
    }
    // cout << now << ":" << num[now] << endl;
  }
  int result = now ? num[now]-1 : num[now];
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 204292
import java.util.Arrays;
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
	
		int X = keyboard.nextInt();
		int A = keyboard.nextInt();
		
		if(X < A) {
			System.out.println(0);
		}else {
			System.out.println(10);
		}
		keyboard.close();	
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;


int main()
{
    int a,b,c,k,sum=0;
    cin>>a>>b>>c>>k;
    pair<int,int>arr[3]={{a,1},{b,0},{c,-1}};
    for(int i=0;i<3;i++)
    {
        if(k<=0)break;
        sum+=arr[i].second*min(arr[i].first,k);
        k-=arr[i].first;
    }
    cout<<sum;
}


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

int main(){
  int n;
  cin >> n;
  
  int *h;
  h = new int[n];
  for(int i=0; i<n; i++){
    cin >> h[i];  
  }
  
  int ct = 0;
  int ctmax = -1;
  
  for(int i=1; i<n; i++){
    if(h[i-1]>=h[i]){
      ct++;
    }
    else{
//      cout << i+1 << ", " << ct << endl;
      if(ct>=ctmax){
        ctmax = ct; 
      }
      ct = 0;
    }
  } 

  if(ct>=ctmax){
    ctmax = ct; 
  }
  
  cout << ctmax << endl;
  return 0;
}

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

int main()
{
    int N;
  long long int ans = 0;
  
  	cin>>N;
 
for(int i = 1; i <= N; i++){
    if(i%3 == 0 || i%5 == 0)
        continue;
    else
        ans += i;
}
    cout<<ans<<endl;
    return 0;
}

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

#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
#define MP make_pair
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

signed main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> count(n+1,0);
    rep(i,n){
        count[a[i]]++;
    }
    vector<int> choose(n+1,0);
    int sum=0;
    for(int i=1; i<=n; i++){
        sum+=(count[i])*(count[i]-1)/2;
    }
   
    
    for(int i=0; i<n; i++){
        cout<<sum-count[a[i]]+1<<endl;
    }

}

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



int main(){
   int n,k; cin>>n>>k;
   vector<int> a(n);
   rep(i,n) cin>>a[i];
   sort(a.begin(),a.end());
   int cnt=0;
   rep(i,n){
       if(a[i]==a[0]) cnt++;
       else break;
   }
   int num=n-cnt;
   int ans;
   if(num%(k-cnt)==0){
       ans=num/(k-cnt);
   }
   else ans=num/(k-cnt)+1;
   cout<<ans<<endl;
   return 0;
}

   


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <map>
#include <string.h>
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>
#include <stdio.h>

using namespace std;
#define set_precision cout << fixed << setprecision(10)
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repb(i, a, b) for (int i = a; i >= b; i--)
#define replb(i, a, b) for (ll i = a; i >= b; i--)
#define repl(i, a, b) for (ll i = a; i < b; i++)
#define repit(arr) for (auto it = arr.begin(); it != arr.end(); it++)
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vl vector<long long int>
#define Vi vector<vector<int>>
#define vpi vector<pair<int,int>>
#define seti set<int>
#define setl set<ll>
#define dseti set<int, greater<int>>
#define dsetl set<ll, greater<ll>>
#define mseti multiset<int>
#define msetl multiset<ll>
#define dmseti multiset<int, greater<int>>
#define dmsetl multiset<ll, greater<ll>>
#define sortA(arr) sort(arr.begin(), arr.end())
#define dsortA(arr) sort(arr.begin(), arr.end(), greater<int>())
#define ssort(arr) stable_sort(arr.begin(), arr.end())
#define search(arr, c) binary_search(arr.begin(), arr.end(), c)
#define pb push_back
#define ll long long
#define cl_bf cin.ignore(numeric_limits<streamsize>::max(), '\n');
#define castl static_cast<ll>
int fact(int n) 
{ 
    int res = 1; 
    for (int i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
}
int nCr(int n, int r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
}
int cel(int a,int b){return((a-1)/b+1);} 
int gcd(int a, int b)
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}
int lcm(int a,int b){
    return (a*b)/gcd(a,b);
}
int stp(int n){
    int ans=1;
    while(n>0){
    n%=__builtin_popcount(n);ans++;
    }
    return ans;
} 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t, n,c,r,ans,ans1;string s;
    cin>>n>>s;c=0;ans=0;ans1=0;vi v(n+1,0),h(n+1,0),v1(n+1,0),h1(n+1,0);
    rep(i,0,n){
        if(s[i]=='1'){c++;}
    }
    v[0]=1%(c+1);h[0]=1%(c+1);v1[0]=1%(max(1,(c-1)));h1[0]=1%(max(1,(c-1)));
    rep(i,1,n){
        h[i]=(v[i-1]+1)%(c+1);
        v[i]=(v[i-1]+(v[i-1]+1))%(c+1);
        h1[i]=(v1[i-1]+1)%max(1,c-1);
        v1[i]=(v1[i-1]+(v1[i-1]+1))%max(1,c-1);
    }
    /*rep(i,0,n){
        cout<<h1[i]<<" ";
    }
    cout<<"\n";*/
    rep(i,0,n){
        if(s[n-i-1]=='1'){
            ans=(ans+h[i])%(c+1);
            ans1=(ans1+h1[i])%max(1,c-1);
        }
    }
    //cout<<"ans: "<<ans<<" ans1: "<<ans1<<"\n";
    rep(i,0,n){
        if(s[i]=='0'){
            r=(ans+h[n-i-1]%(c+1))%(c+1);
            cout<<stp(r)<<"\n";
        }
        else if(s[i]=='1'){
            r=(ans1-h1[n-i-1])%max(1,c-1);
            if(r<0)r=(r+(c-1))%max(1,c-1);
            if(c-1==0)cout<<0<<"\n";
            else cout<<stp(r)<<"\n";
        }
        //cout<<r<<" ";
    }
    return 0;
}

Measured memory_bytes: 6684
#include <stdio.h>

void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

int q[100005];
int q_size = 0;
void push(int value)
{
    q_size++;
    q[q_size] = value;
    int i2 = q_size;
    while (1) {
        if (i2 == 1) {
            break;
        }
        int i1 = i2 / 2;
        if (q[i1] >= q[i2]) {
            break;
        }
        swap(&q[i1], &q[i2]);
        i2 = i1;
    }
}
int pop()
{
    if (q_size == 0) {
        return -1;
    }
    int ret = q[1];
    q[1] = q[q_size];
    q_size--;
    int i1 = 1;
    while (1) {
        int i2 = i1 * 2;
        int i3 = i2 + 1;
        if (i2 > q_size) {
            break;
        }
        else if (i2 == q_size) {
            if (q[i1] > q[i2]) {
                break;
            }
            swap(&q[i1], &q[i2]);
            i1 = i2;
        }
        else {
            if (q[i2] > q[i3]) {
                if (q[i1] > q[i2]) {
                    break;
                }
                swap(&q[i1], &q[i2]);
                i1 = i2;
            }
            else {
                if (q[i1] > q[i3]) {
                    break;
                }
                swap(&q[i1], &q[i3]);
                i1 = i3;
            }
        }
    }
    return ret;
}

int main(void)
{
    int n, m;
    int a;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a);
        push(a);
    }
    for (int i = 0; i < m; ++i) {
        a = pop();
        a /= 2;
        push(a);
    }
    long long ans = 0;
    for (int i = 0; i < n; ++i) {
        a = pop();
        ans += (long long)a;
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define RG register
#define maxn 500005
#define maxm 205
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
inline ll read(){
    ll x = 0, f = 1;
    char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x *10 + ch -'0';ch = getchar();}
    return x * f;
}
 
int n, k, ans;
int a[10005], tp;
bitset<5005> f, w;
int main(){
	int i, j, x, l, r, mid;
	n = read(), k = read();
	for(i = 1;i <= n;i++){
		 a[++tp] = read();
		 if(a[tp] >= k) tp--;
	}
	sort(a + 1, a + tp + 1);
	l = 1, r = tp; 
	for(i = tp + 1;i <= 2 * tp;i++) a[i] = a[i - tp];
	while(l <= r){
		f = w, f[0] = 1;
		mid = l + r >> 1;
		for(j = mid + 1;j <= mid + tp - 1;j++) 
			f |= f << a[j];
		bool flag = 0;
		for(j = k - a[mid];j < k;j++) if(f[j]) {flag = 1;break;}
		if(!flag) ans = mid, l = mid + 1; 
		else r = mid - 1;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 3740
n = int(input())
a = list(map(int, input().split()))
dict_ = {}
for i in range(n):
    if a[i] in dict_:
        dict_[a[i]] += 1
    else:
        dict_[a[i]] = 1
ways = 0
for key, value in dict_.items():
    if value >= 2:
        ways += value * (value - 1) // 2
for i in range(n):
    print(ways - dict_[a[i]] + 1)


Measured memory_bytes: 24748
#include <algorithm>
#include <map>
#include <iostream>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iterator>
#include <array>
typedef long long int ll;
using namespace std;
#define maxN 200007

int n;

void solve() {
	int temp[maxN]={};
	for(int i=0;i<n-1;i++){
		int a;
		cin>>a;
		temp[a]++;
	}
	for(int i=1;i<=n;i++){
		cout<<temp[i]<<endl;
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin>>n;
	solve();
	
}

Measured memory_bytes: 4440
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define INF 1145141919
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
int ny, nx;
typedef long long int ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
////////////////////////////////////////////////////////////////////
int main()
{
    int N,K; cin >> N >> K;
    string S; cin >> S;

    if(S[K-1]=='A') S[K-1]='a';
    else if(S[K-1]=='B') S[K-1]='b';
    else S[K-1]='c';

    cout << S << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,i=0; scanf("%d",&n);
  char s[10000]; scanf("%s",s);
  while(s[i]!='\0'){
    if(s[i]+n>'Z') printf("%c",s[i]+n-26);
    else printf("%c",s[i]+n); i++;
  }
  return 0;
}

Measured memory_bytes: 128
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007
ll fac[1000000];
ll finv[1000000];
ll inv[1000000];

void comb_init(){
  fac[0] = 1;
  fac[1] = 1;
  for(int i=2;i<1000000;i++){
    fac[i] = i*fac[i-1];
    fac[i] %= MOD;
  }
  inv[1] = 1;
  for(int i=2;i<1000000;i++){
    inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
  }
  finv[0] = 1;
  finv[1] = 1;
  for(int i=2;i<1000000;i++){
    finv[i] = inv[i]*finv[i-1];
    finv[i] %= MOD;
  }
}

ll comb(ll n,ll k){
  ll c;
  c = fac[n];
  c *= finv[k];
  c %= MOD;
  c *= finv[n-k];
  c %= MOD;
  return c;
}

int main(){
  ll x,y;
  cin >> x >> y;
  if((x+y)%3 != 0){
    cout << 0 << endl;
    return 0;
  }
  ll m,n,l,r;
  l = (x+y)/3+x-y;
  r = (x+y)/3-x+y;
  if(l%2 != 0){
    cout << 0 << endl;
    return 0;
  }
  if(r%2 != 0){
    cout << 0 << endl;
    return 0;
  }
  m = l/2;
  n = r/2;
  if(m < 0){
    cout << 0 << endl;
    return 0;
  }
  if(n < 0){
    cout << 0 << endl;
    return 0;
  }
  comb_init();
  ll ans = comb(n+m,n);
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 23680
#include <iostream>

using namespace std;

int a, b, c, x, y, z;

int main(){

	cin >> a >> b >> c;

	if (a > b){
		
		x = a;
		z = b;
	}
	else{

		x = b;
		z = a;
	}

	if (c > x){

		y = x;
		x = c;
	}
	else if (c > z){

		y = c;
	}
	else{
		y = z;
		z = c;

	}



	cout << z << " " << y << " " << x << endl;

}





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

long long dp[2][503][503] , A[503][503] , N;
void chkmin(long long &p , long long q){p = p < q ? p : q;}

int main(){
	cin >> N;
	for(int i = 1 ; i <= N ; ++i) for(int j = 1 ; j <= N ; ++j) if(i != j) cin >> A[i][j];
	for(int i = 1 ; i <= N ; ++i) for(int j = 1 ; j < i ; ++j) A[i][j] += A[i][j - 1];
	for(int j = 1 ; j <= N ; ++j) for(int i = 1 ; i < j ; ++i) A[i][j] += A[i - 1][j];
	memset(dp , 0x3f , sizeof(dp)); dp[0][1][1] = 0; int pos = 0;
	for(int i = 2 ; i <= N ; ++i){
		memset(dp[pos ^ 1] , 0x3f , sizeof(dp[pos]));
		for(int j = 1 ; j < i ; ++j)
			for(int k = j ; k < i ; ++k)
				if(dp[pos][j][k] < 1e18){
					chkmin(dp[pos ^ 1][j][k] , dp[pos][j][k] + A[i - 1][i] - A[k - 1][i] + A[i][j - 1]);
					chkmin(dp[pos ^ 1][k][i] , dp[pos][j][k] + A[i][k - 1]);
				}
		pos ^= 1;
	}
	long long mn = 1e18;
	for(int i = 1 ; i <= N ; ++i) for(int j = i ; j <= N ; ++j) mn = min(mn , dp[pos][i][j]);
	cout << mn; return 0;
}


Measured memory_bytes: 6272
#pragma GCC optimize("Ofast")
#include <iostream>
#include <cmath>
#include <bits/stdc++.h>
#include <set>
#include <string>
#include <cstring>
#include <string>
#define FIXED_FLOAT(x)  std::fixed <<std::setprecision(7)<<(x)
#define MAX 100
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INF 1e9
#define ll long long
#define vi vector<int>
#define all(a) a.begin(), a.end()
#define pb push_back
#define ull unsigned long long


using namespace  std;

void sol() {

    string s, a;
    cin >> s >> a;
    for(int i=0;i < s.size();i++) {
        if(s[i]!=a[i]) {
            cout << "No";
            return;
        }
    }
    cout << "Yes";

}
int main() {
    fast;
    sol();


}




Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#include <cstring>

#define MX 200001
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;
typedef pair<int, int> P;
int a[MX];
ll b[MX];
int main()
{
	int n;
	
	memset(b, 0, sizeof(b));
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		b[--a[i]]++;
	}
	ll bas = 0;
	rep(i, n) bas += (ll)(b[i] * (b[i] - 1) / 2);
	rep(k, n) {
		ll ans = 0;
		ans = bas -(ll)b[a[k]] + 1;
		
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<numeric>
#include<iomanip>
#include<utility>
#include<cstdlib>
#include<typeinfo>
typedef long long int lint;

using namespace std;
#define INF 1000000005
int main()
{
lint n,y;
std::cin >> n >> y;
std::vector<lint> check(3,0);
lint temps = y/1000;
check[2] = temps;
while(temps > n){
    if(check[2] >= 5 && temps >= n + 4){
        check[1]++;
        check[2] -= 5;
        temps -= 4;
    } else if(check[1] >= 2 && temps >= n + 1){
        check[0]++;
        check[1] -= 2;
        temps -= 1;
    } else {
        break;
    }
}
if(temps != n){
    std::cout << -1 << " " << -1 << " " << -1 << std::endl;
} else {
    std::cout << check[0] << " " << check[1] << " " << check[2] << std::endl;
}


return 0;
}

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

int main() {
    int h, w, m;
    cin >> h >> w >> m;
    vector<pair<int, int>> bombs;
    vector<pair<int, int>> l, r;
    for (int i = 0; i < h; i++) l.emplace_back(0, i);
    for (int i = 0; i < w; i++) r.emplace_back(0, i);
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        l[x].first++, r[y].first++;
        bombs.emplace_back(x, y);
    }
    sort(l.begin(), l.end(), greater<pair<int, int>>());
    sort(r.begin(), r.end(), greater<pair<int, int>>());
    set<int> lmax, rmax;
    for (int i = 0; i < h; i++) {
        if (l[i].first < l[0].first) break;
        lmax.insert(l[i].second);
    }
    for (int i = 0; i < w; i++) {
        if (r[i].first < r[0].first) break;
        rmax.insert(r[i].second);
    }
    // cout << endl;
    // for (auto a: lmax) cout << a << ' ';
    // cout << endl;
    // for (auto a: rmax) cout << a << ' ';
    // cout << endl;

    int max_bombs = 0;
    for (auto b: bombs) {
        if (lmax.count(b.first) == 0) continue;
        if (rmax.count(b.second) == 0) continue;            
        // cout << b.first << ' ' << b.second << endl;
        max_bombs++;
    }
    int ans = l[0].first + r[0].first - 1;
    if (max_bombs < lmax.size() * rmax.size()) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 38424
/* C - Skill Up */

#include <stdio.h>

int main(void){
  int N, M, X, ans = 1e9;
  scanf("%d %d %d", &N, &M, &X);
  int C[N], A[N][M];
  for(int i = 0; i < N; i++){
    scanf("%d", &C[i]);
    for(int j = 0; j < M; j++){
      scanf("%d", &A[i][j]);
    }
  }
  /* bit全探索 */
  for(int bit = 0; bit < (1 << N); bit++){
    int money = 0, totalA[M]; // 可変長配列は = {} で初期化できない
    // 以下のように配列を初期化
    for(int j = 0; j < M; j++){
      totalA[j] = 0;
    }
    for(int i = 0; i < N; i++){
      if(bit & (1 << i)){
        money += C[i];
        for(int j = 0; j < M; j++){
          totalA[j] += A[i][j];
        }
      }
    }
    int judge = 1;
    for(int j = 0; j < M; j++){
      if(totalA[j] < X){
        judge = 0;
        break;
      }
    }
    if(judge == 1 && money < ans){
      ans = money;
    }
  }
  if(ans == 1e9){
    puts("-1");
  }else{
    printf("%d\n", ans);
  }
  return 0;
}


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

int main() {
    ll N, t;
    cin >> N;
    vector<ll> a;
    REP(i,N){
        cin >> t;
        a.push_back(t);
    }
    ll S = 0;
    for(auto& it: a){
        S += it;
    }
    ll ans = 2000000007;
    t = 0;
    REP(i,N-1){
        t += a[i];
        ans = min(ans,abs(S-t*2));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2420
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "PP.hpp"
#define deb(x...) cerr << "[" << #x << "] = " << x << "\n";
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef pair<lint, lint> plint;
typedef double ld;

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

int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a, b;
	cin >> a >> b;
	cout << fixed << setprecision(10) << a / (ld)b << '\n';
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
char map[50][50];
int main(void) {
  int h, w;
  char x;
  cin>>h>>w;
  scanf("%c", &x);
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      scanf("%c", &map[i][j]);
    }
    scanf("%c", &x);
  }

  int dx[8]={-1, -1, 0, 1, 1, 1, 0, -1};
  int dy[8]={0, -1, -1, -1, 0, 1, 1, 1};

  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      if(map[i][j]=='.') {
	int d=0;
	for(int k=0; k<8; k++) {
	  if(i+dy[k]>=0 and i+dy[k]<h and j+dx[k]>=0 and j+dx[k]<w)
	    if(map[i+dy[k]][j+dx[k]]=='#')
	      d++;
	}
	map[i][j]='0'+d;
      }
    }
  }

  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      printf("%c", map[i][j]);
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str,strArray[];


		while(!(str=br.readLine()).equals("0 0 0")){
			strArray=str.split(" ");
			int n = Integer.parseInt(br.readLine());
			boolean judge[] = new boolean[n];

			double a = Double.parseDouble(strArray[0]);
			double b = Double.parseDouble(strArray[1]);
			double c = Double.parseDouble(strArray[2]);

			double ab = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
			double bc = Math.sqrt(Math.pow(b, 2) + Math.pow(c, 2));
			double ca = Math.sqrt(Math.pow(c, 2) + Math.pow(a, 2));

			for(int i=0; i<n; i++){
				double r = 2*Double.parseDouble(br.readLine());
				if(r > ab || r > bc || r > ca){
					judge[i] = true;
				}
			}

			for(int i=0; i<n; i++){
				System.out.println(judge[i] ? "OK" : "NA");
			}
		}

	}
}

Measured memory_bytes: 16928
#include<iostream>
using namespace std;
#include<stdio.h>
#include<cstdio>

int main(){
    
    char ch;
    int counter[26] = {};
    int num;
    int x;
    while ( cin >> ch){
        if ( 97 <= ch && ch <= 122 ){
            num = ch - 'a';
            counter[num] += 1;
        }
        if ( 65 <= ch && ch <= 90 ){
            num = ch - 'A';
            counter[num] += 1;
        }
    }
    for ( int i = 0; i<26; i++){
        x = 97 + i;
        printf ( "%c : %d\n",x,counter[i]);
    }
    return 0;
}



Measured memory_bytes: 3192
#include <cstdio>


int main()
{
    const int N_MAX = 100000;

    int N = 1;
    // int t[N_MAX], x[N_MAX], y[N_MAX] = {0};
    int t, x, y = 0;
    bool possible = true;

    // Input number of stop
    scanf("%d", &N);
    for (int i = 0; i < N; ++i) {
        // Input each time and stop
        scanf("%d%d%d", &t, &x ,&y);

        // Judge
        // Max distance
        possible = x + y <= t;
        // Count
        if (possible) {
            possible = (x + y + t) % 2 == 0;
        }
        if (!possible) {
            break;
        }
    }

    // Output
    if (possible)
        puts("Yes");
    else
        puts("No");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    string s,t;
    cin>>s>>t;
    vector<int> a(26,-1);
    vector<int> b(26,-1);
    for(int i=0;i<s.size();i++){
        int p=s[i]-'a';
        int q=t[i]-'a';
        if(a[p]==-1 && b[q]==-1){
            a[p]=q;
            b[q]=p;
        }
        else if((a[p]!=-1 && a[p]!=q) || (b[q]!=-1 && b[q]!=p)){
            cout<<"No"<<endl;;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 776
s = input()
n = len(s)

lr = []
tmp = 0
for i in range(1, n):
    if s[i] == s[i-1]:
        tmp += 1
    else:
        lr.append(tmp + 1)
        tmp = 0
lr.append(tmp + 1)

ans = [0] * n
idx = 0
for i, item in enumerate(lr):
    # Rに関して
    if i % 2 == 0:
        idx += item
        ans[idx-1] += (item + 1) // 2
        ans[idx] += item // 2
    # Lに関して
    else:
        ans[idx-1] += item // 2
        ans[idx] += (item + 1) // 2
        idx += item

print(*ans)


Measured memory_bytes: 48220
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int d=a+b,e=a+c,f=b+c;
    int ans=min(d,min(e,f));
    printf("%d\n",ans);
}


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

using namespace std;

string s;
int fre[200];

int main(){
    cin >> s;
    for(int i = 0; i <= int(s.length()) - 1; ++i){
        fre[s[i] - 'a']++;
    }
    for(int i = 0; i <= 25; ++i){
        if(fre[i] == 0) { cout << char(i + 'a'); return 0;}
    }
    cout << "None";
}


Measured memory_bytes: 512
package main

import "fmt"

func main() {
	var o, e string
	fmt.Scan(&o, &e)
	s := ""
	for i := 0; i < len(o); i++ {
		s += string(o[i])
		if i < len(e) {
			s += string(e[i])
		}
	}
	fmt.Println(s)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,A=0,M;
    cin>>N;
    M=N;
    
    while(N>0){
        A+=N%10;
        N=N/10;
    }
    
    if(M%A==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	double arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	sort(arr,arr+n);
	double ans=arr[0]+0.0;
	for(int i=0;i<n-1;i++)
	{
		ans = (ans+arr[i+1])/2.0;
	}
	cout<<ans;
}

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

typedef long long ll;
const ll N=2e5 + 5;
const ll mod=1e9 + 7;
#define debug(x) cerr<<#x<<" is "<<x<<endl;

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

    ll n;
    cin>>n;

    for(ll i=1;i<=9;i++){
        for(ll j=1;j<=9;j++){
            if(i*j==n)
                return cout<<"Yes" , 0;
        }
    }
    cout<<"No";

}


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

#define rep(i,z) for(int i = 0; i<(int)(z); i++)
#define rep1(i,z) for(int i = 1; i<=(int)(z); i++)
 
using namespace std;

typedef long long ll;
const ll MOD=1e9+7;
using pear = pair<int,int>;


int main(){
 int n,k; cin>>n>>k;
 vector<int> h(n);
 rep(i,n) cin>>h[i];
 sort(h.begin(),h.end(),greater<int>());
 ll ans = 0;
 if(k<n) for(int i = k;i<n;i++) ans +=h[i];
 cout<<ans<<endl;

}


Measured memory_bytes: 1024
import sys,collections,math,copy;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n = I()
b = Is()
out = []
def dfs(a,ans):
    if a == []:
        global out
        out = ans
    cand = []
    for i,e in enumerate(a):
        if e - i > 1:
            return
        elif e - i == 1:
            cand.append(i)
    if cand == []:
        return
    else:
        for i in cand:
            t = copy.deepcopy(a)
            del t[i]
            dfs(t,ans+[i+1])
dfs(b,[])
if out == []:
    print(-1)
else:
    out = out[::-1]
    print(*out)

Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int a, b, c;
	cin >> a >> b >> c;
	cout << (a*b)/2 << endl; 
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
	int a,b,i,x;
	char s[10],t[10];
	scanf("%s %s",s,t);
	for(i=0;i<3;i++){
		s[i]; t[i];
		if(s[i]==t[i]) x++;
	}
	printf("%d\n",x);
	return 0;
}
	

Measured memory_bytes: 128
# https://atcoder.jp/contests/abc050/tasks/abc050_b
import copy

n = int(input())
t = list(map(int, input().split()))
m = int(input())
times = []
for i in range(m):
    p, x = map(int, input().split())
    _t = copy.copy(t)
    _t[p - 1] = x
    times.append(sum(_t))

for time in times:
    print(time)


Measured memory_bytes: 3444
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
int main() {
	int A, B;
	cin >> A >> B;
	string S;
	cin >> S;
	if (S.size() != A + B + 1) {
		cout << "No" << endl;
		return 0;
	}
	for (int i = 0; i < S.size(); i++) {
		if ((i != A && !isdigit(S[i])) || (i == A&&S[i] != '-')) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

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

int main() {
  string s;
  cin >> s;
  
  string ans = "Yes";
  for(int i = 0; i < s.size(); i++){
    if(i % 2 == 0){
      if(s.at(i) == 'L') ans = "No";
    }
    else{
      if(s.at(i) == 'R') ans = "No";
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int l,i,j;
int main()
{
    getline(cin,s);
    l=s.size();
    if(l%2){
        puts("No");
        return 0;
    }
    for(i=0,j=l-1;i<j;i++,j--){
        if(s[i]=='p'&&s[j]!='q'){
            puts("No");
            return 0;
        }
        else{
            if(s[i]=='q'&&s[j]!='p'){
                puts("No");
                return 0;
            }
            else{
                if(s[i]=='b'&&s[j]!='d'){
                    puts("No");
                    return 0;
                }
                else{
                    if(s[i]=='d'&&s[j]!='b'){
                        puts("No"); 
                        return 0;
                    }
                }
            }
        }
    }
    puts("Yes");
    return 0;
}

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

int main()
{
int a[101][101];
int b[101];
int n,m;
scanf("%d %d",&n,&m);
for(int i=0;i<n;i++){
	for(int j=0;j<m;j++){
		scanf("%d",&a[i][j]);
	}
}
for(int i=0;i<m;i++){
	scanf("%d",&b[i]);
}
for(int i=0;i<n;i++){
	int ans=0;
	for(int j=0;j<m;j++){
		ans+=a[i][j]*b[j];
	}
	printf("%d\n",ans);
}
}


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


int main() {
  int N;
  cin>>N;
  if(N%10==3)cout<<"bon"<<endl;
  else if(N%10==0||N%10==1||N%10==6||N%10==8)cout<<"pon"<<endl;
  else cout<<"hon"<<endl;
}


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

using namespace std;
typedef long long ll;

// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

int main() {
    string s;
    cin >> s;
    int ans = 0;
    for (int i =(int)s.size()- 1; i>0; i--) {
        string S = s.substr(0, i);
        string a = S.substr(0, (int)S. size() / 2);
        string b = S.substr((int)S.size() / 2, a.size());
        if (a == b && (int)S.size()%2==0) {
            ans = (int)S.size();
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3520