akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(int argc, char **argv)
{
    string S;
    cin >> S;
    int l = S.length();
    REP(i, l) {
        if (i % 2 == 0) {
            if (S[i] == 'L') {
                cout << "No" << endl;
                return 0;
            }
        }
        else {
            if (S[i] == 'R') {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;

  rep(i, S.size()) {
    S[i] = (S[i] -'A' + N) % 26 + 'A';
  }

  cout << S << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        sc.close();
        String judge = "No";
        while(true){
            c = c - b;
            if (c <= 0) {
                judge = "Yes";
                break;
            }
            a = a - d;
            if (a <= 0) {
                break;
            }
        }
        System.out.println(judge);
    }
}


Measured memory_bytes: 35492
s = input()
n = len(s) - 1

op_list = []

for i in range(2**3):
  op = ["-"] * n
  for j in range(n):
    if (i >> j) & 1:
      op[j] = "+"

  op_list.append(op)

f_list = []

for op in op_list:
  f = s[0]
  for i in range(n):
    f += op[i]
    f += s[i+1]
  f_list.append(f)

for f in f_list:
  if eval(f) == 7:
    print(f+"=7")
    exit()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(150) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define Lower(v,X) lower_bound(v.begin(),v.end(),X)-v.begin();
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N >> S;
  UE(S);
  Out(S.size());
}


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

int n;
int x[10];
int y[10];
int ch[10];
double summ;
int ff;
int hohoho = 1;

void f(int l, double go, int lx, int ly)
{
	if(l == n)
	{
		summ += go;
		return;
	}
	
	else
	{
		for(int i = 0 ; i < n ; i++)
		{
			if(ch[i] == 1)
				continue;
			ch[i] = 1;
			if(lx == -1 && ly == -1)
				f(l + 1, go, x[i], y[i]);
			else
			{
				int ll = (x[i] - lx) * (x[i] - lx);
				int rr = (y[i] - ly) * (y[i] - ly);
				double gogogo = sqrt(ll + rr);
				f(l + 1, go + gogogo, x[i], y[i]);
			}
			ch[i] = 0;
		}
	}
}

int main(void)
{
	scanf("%d", &n);
	
	for(int i = 0 ; i < n ; i++)
	{
		scanf("%d %d", &x[i], &y[i]);
	}
	
	f(0, 0, -1, -1);
	
	for(int i = 1 ; i <= n ; i++)
	{
		hohoho *= i;
	}
	
	printf("%.10lf", summ / (double)hohoho);
	return 0;
}

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

#define int long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define all(c) (c).begin(),(c).end()
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;
const ld PI = acos(-1.0);
const int N = 1e5 + 5;
int id[N];
int sz[N];

void pre(){
	
	for(int i= 0 ; i<N ; i++) id[i] = i , sz[i] = 1;
}

int root(int i){
	
	while(i != id[i])	id[i] = id[id[i]] , i = id[i];
	return i;
}

void uni(int a, int b){
	int ra = root(a);
	int rb = root(b);
	if(ra == rb)	return;
	if(sz[ra] < sz[rb]) swap(ra,rb);
	id[rb] = ra , sz[ra] += sz[rb];
}
int32_t main(){
	fast;
    pre();
    
    int n,m;
    cin >> n >> m;
    
    int a[n+1];
    f(i,1,n+1)  cin >> a[i];
    f(i,0,m)
    {
        int x,y;
        cin >> x >> y;
        uni(x,y);
    }
    

    map<int , set<int>> v ;
    for(int i=1 ; i<=n ; i++)
    {
        v[root(i)].insert(i);
    }
    
    int ans = 0;
    for(int i=1 ; i<=n ; i++)
    {
        if(v[root(i)].find(a[i]) != v[root(i)].end())
            ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;


int main(){
    fast_io

    string s;
    cin>>s;

    if(s=="ABC"){
        cout<<"ARC"<<endl;
    }else{
        cout<<"ABC"<<endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 3612
<?php
fscanf(STDIN, '%s', $s);

$a = str_split($s);

if ($a[0] === $a[1] || $a[1] === $a[2]||$a[2] === $a[3]) {
    echo 'Bad';
} else {
    echo 'Good';
}

echo PHP_EOL;


Measured memory_bytes: 16116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
ll inf = LLONG_MAX;
long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

//二分探索
ll binary_search(vll &l, ll i, ll j, ll min, ll max) {
  if (min == max) {
    return max;
  }
  if (min + 1 == max) {
    if (l[max] < l[i] + l[j]) return max;
    if (l[min] < l[i] + l[j]) return min;
  }
  ll n = (min + max) / 2;
  if (l[n] < l[i] + l[j]) {
    return binary_search(l, i, j, n, max);
  }
  else {
    return binary_search(l, i, j, min, n);
  }
}

int main() {
  ll n;
  cin >> n;
  vll l(n);
  for (ll i = 0; i < n; i++) cin >> l[i];
  sort(all(l));
  ll cnt = 0;
  for (ll i = 0; i < n - 2; i++) {
    for (ll j = i + 1; j < n - 1; j++) {
      ll min = j + 1, max = n - 1;
      if (l[min] >= l[i] + l[j]) continue;
      cnt += binary_search(l, i, j, min, max) - min + 1;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
            System.out.println("Possible");
        } else {
            System.out.println("Impossible");
        }
    }
}


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

int main(){
  int N;
  cin >> N;
  
  vector<int> data(N);
  for (int i = 0; i < N; i++){
    cin >> data.at(i);
  }
  
  sort(data.begin(), data.end());
  reverse(data.begin(), data.end());
  
  int a = 0, b = 0;
  for(int i = 0; 2*i < N; i++){
    if(2*i + 1 < N){
      a += data.at(2*i);
      b += data.at(2*i + 1);
    }
    else{
      a += data.at(2*i);
      break;
    }
  }
  
  cout << a - b << endl;
}
        
  


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */
// quoted from beet-aizu
template <typename T, typename E, typename F, typename G>
struct SegmentTree{
    // using F = function<T(T, T)>
    // using G = function<T(T, E)>
    int n;
    F f;
    G g;
    T ti;
    vector<T> dat;
    SegmentTree(){};
    SegmentTree(F f,G g,T ti):f(f),g(g),ti(ti){}
    void init(int n_){    
        n=1;
        while(n<n_) n<<=1;
        dat.assign(n<<1,ti);
    }
    void build(const vector<T> &v){
        int n_=v.size();
        init(n_);
        for(int i=0;i<n_;i++) dat[n+i]=v[i];
        for(int i=n-1;i;i--)
            dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
    }
    void update(int k,const E &x){
        k += n;
        dat[k] = g(dat[k], x);
        while(k>>=1)
            dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);    
    }
    T operator [](int k) const { return dat[k+n]; }
    T query(int a,int b) const {
        T vl=ti,vr=ti;
        for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
            if(l&1) vl=f(vl,dat[l++]);
            if(r&1) vr=f(dat[--r],vr);
        }
        return f(vl,vr);
    }

    /* TODO わからない 聞く 
    template<typename C>
    int find(int a,int b,C &check,int k,int l,int r){
        if(!check(dat[k])||r<=a||b<=l) return -1;
        if(k>=n) return k-n;
        int m=(l+r)>>1;
        int vl=find(a,b,check,(k<<1)|0,l,m);
        if(~vl) return vl;
        return find(a,b,check,(k<<1)|1,m,r);
    }
    template<typename C>
    int find(int a,int b,C &check){
        return find(a,b,check,1,0,n);
    }*/
    
};


int main(){
  using T = lint; // type T
  using E = lint; // type E
  auto f = [](T a, T b){ // return type T value
    return a + b;
  };
  auto g = [](T a, E b){ // return type T value
    return a + b;  // return b;
  };
  T ti = 0; // identity element
  SegmentTree<T, E, decltype(f), decltype(g)> sg(f, g, ti);  // don't change
  int n, q; cin >> n >> q;
  vector<lint> dat(n);
  for (int i = 0; i < n; i++) {
    cin >> dat[i];
  }
  sg.build(dat);
  for (int i = 0; i < q; i++) {
    int o; cin >> o;
    if (o == 0) {
      int p, x; cin >> p >> x;
      sg.update(p, x);
    } else {
      int l, r; cin >> l >> r;
      cout << sg.query(l, r) << endl;
    }
  }
}


Measured memory_bytes: 16432
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define FASTIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define inf 1e18
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define mod 1000000007
#define pb push_back
#define all(s) s.begin(),s.end()
#define pie 3.14159265358979323846
#define fr(i,a,b)  for(ll i=a;i<b;i++)
#define frr(i,a,b) for(ll i=b-1;i>=a;i--)
#define gcd __gcd
#define con continue
#define pii pair<ll,ll>
const ll N=100;
signed main(){
    FASTIO;
    ll tt=1;
    //cin>>tt;
    while(tt--){
       ll n;cin>>n;
       if(n%1000==0)cout<<"0\n";
       else cout<<(n/1000+1)*1000-n<<"\n";
    }
}


Measured memory_bytes: 3540
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String inputWord = "";
        inputWord = sc.next().toLowerCase();
        
        String inputWriting = "";
        int count = 0;
        while(!((inputWriting = sc.next()).equals("END_OF_TEXT"))){
            if(inputWriting.toLowerCase().equals(inputWord)){
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 26136
#include <iostream>
#include <vector>
#include <map>
using namespace std;
typedef pair<string, int> P;
vector<P> log;
int main() {
    string s; cin >> s;
    string bef="";
    int i=0;
    if (s[0]=='e') {
        bef="egg";
        i+=3;
    } else {
        bef="chicken";
        i+=7;
    }
    if (i==s.length()) {
        cout<<bef<<endl;
        return 0;
    }
    int cnt=1;
    for (;i<s.length(); i++) {
        if (s[i]=='e'&&bef=="egg") {
            log.push_back(P(bef,cnt));
            cnt=1;
            i+=2;
        } else if (s[i]=='c'&&bef=="chicken") {
            log.push_back(P(bef,cnt));
            cnt=1;
            i+=6;
        } else {
            if (s[i]=='e') {
                bef="egg";
                i+=2;
            } else if (s[i]=='c') {
                bef="chicken";
                i+=6;
            }
            cnt++;
        }
    }
    log.push_back(P(bef,cnt));
    string res;
    int rc=0;
    for (int i=0; i<log.size(); i++) {
        if (log[i].second>rc) {
            res=log[i].first;
            rc=log[i].second;
        }
        // cout<<log[i].first<<" "<<log[i].second<<endl;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 0
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cmath>
#include <limits>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define mod 1000000007
#define fst first
#define pb push_back
// ABC146B first AC
int main()
{
    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;
    int sum = A1+A2+A3;
    if(sum >= 22){
        cout << "bust" << endl;
    }else if(sum <= 21){
        cout << "win" << endl;
    }
}

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

using namespace std;

int main() {
    int H, W;
    cin >> H >> W;

    int N;
    cin >> N;

    vector<int> color;
    for(int i = 1; i <= N; i++) {
        int a;
        cin >> a;
        vector<int> tmp(a, i);
        color.insert(color.end(), tmp.begin(), tmp.end());
    }

    for(int h = 0; h <H; h++) {
        for(int w = 0; w<W; w++) {
            int tmp = w;
            if(h%2 != 0) tmp = (W-1) - tmp;
            cout << color[W*h + tmp] << " " ;
        }
        cout << endl;
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;

struct S {
    int zero, one;
    ll inverse;
};

S op(S a, S b) {
    return S{a.zero+b.zero, a.one+b.one, a.inverse+b.inverse+(ll)a.one*b.zero};
}

S e() {
    return S{0, 0, 0};
}

using F = bool;

S mapping(F f, S s) {
    if (!f) return s;
    return S{s.one, s.zero, (ll)s.one*s.zero-s.inverse};
}

F composition(F a, F b) {
    return a^b;
    //return (a && !b) || (!a && b);
}

F id() {
    return false;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    int n, q;
    cin >> n >> q;
    vector<S> a(n);
    rep(i, n) {
        int x;
        cin >> x;
        if (x==0) {
            a[i] = S{1, 0, 0};
        }
        else {
            a[i] = S{0, 1, 0};
        }
    }
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(a);
    rep(qi, q) {
        int t;
        cin >> t;
        if (t==1) {
            int l, r;
            cin >> l >> r;
            l--;
            seg.apply(l, r, true);
        }
        if (t==2) {
            int l, r;
            cin >> l >> r;
            l--;
            S ans = seg.prod(l, r);
            pr(ans.inverse);
        }
    }
    return 0;
}


Measured memory_bytes: 14520
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const ll MOD = 1000000007;
const double EPS = 1e-9;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


int main(void){

    // string s,t;
    // cin>>s>>t;
    // cout<<t<<s<<endl;
    ll a,b,k;
    cin>>a>>b>>k;
    a-=k;
    k=max(-a,0LL);
    a=max(a,0LL);
    b=max(0LL,b-k);
    cout<<a<<" "<<b<<endl;

}


Measured memory_bytes: 256
using namespace std;

//#define fileio

#ifndef fileio
#include <iostream>
#endif
#include <fstream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <assert.h>
#include <functional>
#include <math.h>
#include <string>
#include <ctime>

typedef long long ll;

#ifdef fileio
ifstream cin;
ofstream cout;
#endif





int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #ifdef fileio
    cin.open("Text.txt");
    cout.open("Output.txt");
    #endif

    int n;
    cin >> n;
    vector<ll> v;
    for (int i = 0; i < n; i++) {
        ll x;
        cin >> x;
        v.push_back(x);
    }
    ll tot = 0;
    ll mx = v[0];
    for (int i = 0; i < n; i++) {
        if (v[i] < mx) tot += (mx - v[i]);
        mx = max(mx, v[i]);
    }
    cout << tot << endl;

}

Measured memory_bytes: 5320
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ar array
 
int main() {
  int k,a,b;
  cin>>k>>a>>b;
  if(k==1){
    cout<<"OK";
  }else if(a%k==0 || b%k==0){
    cout<<"OK";
  } else if(k*(a/k)+k>=a && k*(a/k)+k<=b){
    cout<<"OK";
  }else{cout<<"NG";}
}

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

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> v(n);
  int a, b;
  rep(i, m){
    cin >> a >> b;
    v[a - 1]++;
    v[b - 1]++;
  }
  rep(i, n){
    cout << v[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define met(s) memset(s, 0, sizeof(s))
const int mod = 100000007;
const int maxn = 100000;
const int inf = 0x3f3f3f3f;
int book[maxn];
int ans[maxn];
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &book[i]);
    ll now = 0;
    int x = 0;
    for (int i = n - 1; i >= 0; i--)
    {
        x++;
        if (x & 1)
            now += 2 * book[i];
        else
            now -= 2 * book[i];
    }
    ans[0] = now / 2;
    for (int i = 1; i < n; i++)
    {
        ans[i] = book[i - 1] * 2 - ans[i - 1];
    }
    for (int i = 0; i < n; i++)
        printf("%d ", ans[i]);
    return 0;
}

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

int main(void){
	int n, i, j, minj, temp, count=0;
	int *a;
	scanf("%d", &n);
	a = malloc(n*sizeof(int));
	for(i=0;i<n;i++){
		scanf("%d", &a[i]);
	}
	for(i=0;i<n;i++){
		minj=i;
		for(j=i;j<n;j++){
			if(a[j]<a[minj]){
				minj=j;
			}
		}
		if(a[i]!=a[minj]){
			temp=a[i];
			a[i]=a[minj];
			a[minj]=temp;
			count++;
		}
	}
	printf("%d", a[0]);
	for(i=1;i<n;i++){
		printf(" %d", a[i]);
	}
	printf("\n");
	printf("%d\n", count);
}

Measured memory_bytes: 1832
#include <stdio.h>
int max(int a, int b){
  if(a>b)return a;
  else return b;
}
int a[50][4];
int n,m,q;
int ans=0;
int dfs(int res[], int pt, int max_res){
  if(max_res>m)return 0;
  if(pt==n){
    int tmp=0;
    /*
    for(int i=0;i<n;i++){
      printf("%d ", res[i]);
    }
    printf("\n");*/
    for(int j = 0; j<q; j++){
      if(res[a[j][1]-1]-res[a[j][0]-1]==a[j][2]){
        tmp+=a[j][3];
      }

    }
    //printf("tmp:%d\n", tmp);

    ans = max(ans, tmp);
    return ans;
  }
  //ptより大きい数字を選んで再起、選ばず再起の二通り
  int k = pt+1;
  for(int i=max_res; i<11; i++){
    res[pt]=i;
    dfs(res, k, i);
  }
  return ans;
}
int main(){
  int i;
  int res[10];
  int used[10];
  for(i=0;i<10;i++)res[i]=used[i]=0;
  res[0]=used[0]=1;
  scanf("%d %d %d", &n, &m, &q);
  for(i=0;i<q;i++){
    scanf("%d %d %d %d", &a[i][0], &a[i][1], &a[i][2], &a[i][3]);
  }
  int pt=1;
  printf("%d\n", dfs(res, pt, 1));
  //長さnの整数列を作ってその整数列に対して得点を見ていく漢字の全探索

  return 0;
}


Measured memory_bytes: 1732
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
ll ans;
ll N;
string S[200005];
vector<ll> A;




int main(){
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> S[i];
    }
    sort(S,S+N);
    int cnt=1;
    int cntm=0;
    string a = S[0];
    for(int i=1;i<N;i++){
        if(S[i]==a){
            cnt += 1;
        } else {
            if(cnt>cntm){
                A = {i-1};
                cntm = cnt;
            } else if(cnt == cntm){
                A.push_back(i-1);
            }
            a = S[i];
            cnt = 1;
        }
    }
    if(cnt>cntm){
        A = {N-1};
        cntm = cnt;
    } else if(cnt == cntm){
        A.push_back(N-1);
    }
    
    int M = A.size();
    for (int i=0;i<M;i++){
        cout << S[A[i]]<<endl;
    }

}



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

using namespace std;
using std::vector;

#define ll long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD int(1e9) + 7
#define PAI  3.1415926535
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b != 0) gcd(b, a%b);
  return b;
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a / gcd(a , b)) * b;
}

int main(){
 
  int a, b; cin >> a >> b;
  if(b % a) pr(b - a);
  else pr(b + a);

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef complex<double> Point;
typedef long long ll;
const int INF = 114514810;
const int MOD = 1000000007;
const double EPS = 1e-10;
const double PI = acos(-1.0);
struct edge
{
	int from, to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///

int solve(int x, int y)
{
	int res;
	if (x*y >= 0)
	{
		res = abs(x - y) + min(abs(x),abs(y));
	}
	else res = abs(x) + abs(y);
	return res;
}

int main()
{
	int w, h, n;
	cin >> w >> h >> n;
	int x, y;
	cin >> x >> y;
	n--;
	int cnt = 0;
	while (n--)
	{
		int nx, ny;
		cin >> nx >> ny;
		int tx = nx - x; int ty = ny - y;
		cnt += solve(tx, ty);
		x = nx; y = ny;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

int main() {
	ios_base::sync_with_stdio( false );

	int N;
	cin >> N;

	vector<int> A( N ), B( N );
	for( int i = 0; i < N; ++i ) {
		cin >> A[i] >> B[i];
	}

	long ans = 0;
	for( int i = N-1; i >= 0; --i ) {
		ans += (B[i] - (ans + A[i]) % B[i]) % B[i];
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
#![macro_use]

use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::mem::*;
use std::num::*;
use std::slice::*;

fn main() {
    let (r, w, e) = (stdin(), stdout(), stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    // =============================================== //
    let n: i64 = io.read();
    io.writeln((n * (n - 1)) / 2);
}

// IO
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug ) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
}


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

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

  vector<string> A(N);

  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }

  map<string,int> hin;

  for (auto x : A) {
      hin[x];
  }
  cout << hin.size() << endl;
}

Measured memory_bytes: 25080
#include "bits/stdc++.h"
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define FILL(c, v) fill((c).begin(),(c).end(), v)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;

const int INTINF = 1e9;
const LL LLINF = 1e18;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int H[101][101];

void solve()
{
    int N; cin >> N;
    REP1(i, N) 
    {
        int h; cin >> h;
        REP0(j, h) H[i][j]++;
    }

    int ans = 0;

    REP0(h, 100)
    {
        int delta = 0;
        REP1(i, N)
        {
            // 下から順に水平に舐めて、新たな山を発見したとき
            if (H[i-1][h] == 0 and H[i][h] == 1) delta++;
        }
        ans += delta;
    }
    cout << ans << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
    solve();
    return 0;
}

Measured memory_bytes: 256
import math


x = int(input())

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


while True:
    ans = is_prime(x)
    if ans == True:
        print(x)
        break
    else:
        x += 1

Measured memory_bytes: 3060
// skip until line 65
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

#define BR "\n"
#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a, b) ((((a) % (b) ) + (b)) % (b))
#define MO(a) AS_MOD(a,mod)
#define FEACH(it, cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it, cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)
#define MIN(V, T) V=min(V,T)

#define DumpArray(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;

/*
 * ***_bound(6)
 * 5 6 6 6 6 6 7 7 7
 *   ^lower    ^upper
 * void reverse(c.begin(), c.end())
 *
 * graph
 * seg tree
 * dp
 * brute force
 */
struct Comparator{
    int operator()(int l, int r) const {
        return r<l;
    }
};
struct Vec;
//set<int, Comparator> S;

// solution below
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
ll N,K;
ll mod=1000*1000*1000+7ll;
ll h[100000*2];
ll pow(ll X) {
    ll t=X;
    ll ret=1;
    for(int i=0;(N>>i)>0;++i) {
        if ((N>>i)&1) ret*=t;
        t*=t;
        ret=MO(ret);
        t=MO(t);
    }
    return ret;
}
vector<ll> num(100000+10,0);
void factoring_add(ll i,ll v) {
    for(int j=1;j*j<=i;++j) {
        if (i%j==0) {
            num[i/j]+=v;
            num[i/j]=MO(num[i/j]);
            if (j*j!=i) {
                num[j] += v;
                num[j] = MO(num[j]);
            }
        }
    }
}
int main() {
    cout.precision(10);
    cout << fixed;
    cin >> N >>K;
    ll ans=0;
    for(ll i=K;i>=1;--i) {
        num[i]=MO(pow(K/i)-num[i]);
        ans+=MO(num[i]*i);
        ans=MO(ans);
        factoring_add(i,num[i]);
    }
    cout << ans<<endl;

}


Measured memory_bytes: 3932
#include <iostream>
#include <stdint.h>

using namespace std;

int main()
{
  int D, N;

  cin >> D >> N;

  uint64_t X=1;

  for (int d=0; d<D; ++d)
    X *= 100;

  if (N==100)
    N = 101;
  
  cout << X*N << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if(x < r || (x + r) > W) printf("No\n");
    else if(y < r || (y + r) > H) printf("No\n");
    else printf("Yes\n");
}


Measured memory_bytes: 2684
import java.io._
import scala.io.StdIn.{readInt, readLine}

object Main {
  val out:BufferedWriter =
    new BufferedWriter(new OutputStreamWriter(new FileOutputStream(FileDescriptor.out), "ASCII"), 512)
  var count = 0

  def printstr(str:String) = {
    out.write(str)
    if(count<500) count += 1
    else { out.flush; count = 0 }
  }

  class Node(var key:Int, var left:Node = null, var right:Node = null) { }

        def getNodeToInsert(node:Node,keyNode:Node):Node =
                if(node.key > keyNode.key) {
                        if(node.left == null) node
                        else getNodeToInsert(node.left,keyNode)
                } else {
                        if(node.right == null) node
                        else getNodeToInsert(node.right,keyNode)
                }

  def insert(tree:Node, keyNode:Node) = {
    val target = getNodeToInsert(tree,keyNode)
    if(keyNode.key < target.key) target.left = keyNode
    else target.right = keyNode
  }

  def inOrder(tree:Node):Unit =
    if(tree == null) return
    else {
      inOrder(tree.left)
      printstr(" ")
      printstr(tree.key.toString)
      inOrder(tree.right)
    }

  def preOrder(tree:Node):Unit =
    if(tree == null) return
    else {
      printstr(" ")
      printstr(tree.key.toString)
      preOrder(tree.left)
      preOrder(tree.right)
    }

  def find(tree:Node, key:Int) {
          def loop(node:Node):Unit = {
      if(node == null) {
        printstr("no\n")
      } else if(node.key > key) {
        loop(node.left)
      } else if(node.key < key) {
        loop(node.right)
      } else {
        printstr("yes\n")
      }
    }
    loop(tree)
  }

  def main(args:Array[String]) = {
    val n = readInt
    val tree = new Node(-1)

    for(i<-0 until n) {
      val s = readLine.split(" ")
      s(0) match {
        case "insert" =>
          if(tree.key == -1) tree.key = s(1).toInt
          else insert(tree, new Node(s(1).toInt))
        case "find" => find(tree, s(1).toInt)
        case _ => {
          inOrder(tree)
          printstr("\n")
          preOrder(tree)
          printstr("\n")
        }
      }
    }
    out.flush
    out.close
  }
}

Measured memory_bytes: 278076
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
//#include <unordered_set>
//#include <unordered_map>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
using namespace std;
#define MS0(I) memset(I, 0, sizeof(I));
#define MS1(I) memset(I, -1, sizeof(I));
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, s, n) for(int i = (s); i < (n); ++i)
#define per1(i, a, b) for(int i = a; i >= b; --i)
#define DRI(A) int A; scanf("%d", &A);
#define DRII(A, B) int A, B; scanf("%d %d", &A, &B);
#define DRIII(A, B, C) int A, B, C; scanf("%d %d %d", &A, &B, &C);
#define SZ(X) ((int)X.size() )
#define MP make_pair 
#define pb push_back
#define F first
#define S second
#define ALL(I) (I).begin(), (I).end()
typedef const void CV;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;
typedef long double LDB;
typedef pair<int, int> PII; 
const double eps = 1e-9;
const double PI = acos(-1);
const LL INFF = 1e18;
const int INF = 1e9;
const int mod = 1e9+7;
const int MAX = 1e5+7;
int main(void){
	LDB n, m, d; scanf("%Lf %Lf %Lf", &n, &m, &d);
	LDB ans = (n-d)*(m-1)/n/n;
	if(d != 0) ans*=2;
	printf("%.13Lf\n", ans);
	return 0;
}


Measured memory_bytes: 256
import itertools
n = int(input())
s = list(input())
a = ['0','1','2','3','4','5','6','7','8','9']
cnt=0
for i in list(itertools.product(a, repeat=3)):
  d =0
  e =0
  while d < n:
    if s[d] == i[e]:
      e+=1
    d+=1
    if e==3:
      cnt+=1
      break
print(cnt)

Measured memory_bytes: 68964
#include <iostream>
#define ll long long
using namespace std;

ll N;
ll wget(ll h, int n) {
  if ((4 * h * n - (h + n) * N) == 0) return 0;
  ll w = h * n * N / (4 * h * n - (h + n) * N);
  if (w <= 0) return 0;
  return w;
}

bool check(ll h, ll n, ll w) {
  return 4 * h * n * w == (n * w + h * w + h * n) * N;
}

int main() {
  cin >> N;
  for (ll h = 1; h <= 3500; h++) {
    for (ll n = 1; n <= 3500; n++) {
      ll w = wget(h, n);
      if (check(h, n, w)) {
        cout << h << ' ' << n << ' ' << w << endl;
        return 0;
      }
    }
  }
}


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

int main()
{
    int64_t N, M;
    cin >> N >> M;

    vector<int64_t> H;
    vector<bool> seen;

    H.resize(N);
    for (int n = 0; n < N; ++n)
        cin >> H[n];

    seen.assign(N, true);

    for (int m = 0; m < M; ++m)
    {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        if(H[a]==H[b])
            seen[a] = seen[b] = false;
        else if (H[a] < H[b])
            seen[a] = false;
        else
            seen[b] = false;
    }
    int count = 0;
    for (int n = 0; n < N; ++n)
        if(seen[n])
            ++count;

    cout << count << endl;
}

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

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    int sum=0;
     int ans=0;
    sort(a,a+n);
    for(int i=1;i<n;i++)
    ans+=a[i]-a[i-1];
    cout<<ans<<endl;
}

Measured memory_bytes: 3644
lst = [list(map(int,input().split())) for i in range(3)]

if (lst[1][0] - lst[0][0] == lst[1][1] - lst[0][1] == lst[1][2] - lst[0][2] and\
    lst[2][0] - lst[0][0] == lst[2][1] - lst[0][1] == lst[2][2] - lst[0][2]):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
        var result = 0;

        for (int i = 1; i < input[0] + 1; i++)
        {
            var str = i.ToString();
            var sum = 0;
            for (int j = 0; j < str.Length; j++)
            {
                sum += int.Parse(str.Substring(j, 1));
            }

            if (sum >= input[1] && sum <= input[2])
            {
                result += i;
            }
        }

        Console.WriteLine(result);
    }
}

Measured memory_bytes: 11348
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main(){

	string x;
	cin >> x;

	int cnt = 0;
	int ans = 0;
	for(int i=0; i<x.size(); i++){

		if( cnt <= 0 && x[i] == 'T' ){
			ans++;
		}else if( cnt > 0 && x[i] == 'T' ){
			cnt--;
		}

		if( x[i] == 'S' ){
			cnt++;
		}

	}

	cout << ans*2 << endl;


	return 0;
}

Measured memory_bytes: 640
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

#print(Counter(A).keys())
#print(Counter(A).values())
#print(Counter(A).items())

lis = [0]*(N+1)
ans = 0
for key, value in Counter(A).items():
	lis[key] = value
	ans += value*(value-1)//2

#print(lis)

for i in range(N):
	print(ans-lis[A[i]]+1)


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

int t1,t2,r1,r2;

int main(){
    cin>>t1>>t2>>r1>>r2;
    if(r1==-1 || r2==-1){
        if(t1<t2){
            cout<<"Alice"<<endl;
        }
        else if(t1>t2){
            cout<<"Bob"<<endl;
        }else{
            cout<<"Draw"<<endl;
        }
    }
    else{
        if(r1>r2){
            cout<<"Alice"<<endl;
        }
        else if(r1<r2){
            cout<<"Bob"<<endl;
        }else{
            cout<<"Draw"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3120
#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair
#include <cmath>
#include <random>

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

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

template <class InputIterator, class T>
bool contains_itr(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class T>
bool contains_set(set<T> st, const T &value)
{
    if (st.find(value) == st.end())
    {
        return false;
    }
    else
    {
        return true;
    }
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// endは排他的(exclusive)なので注意
vector<ll> range(ll begin, ll end)
{
    vector<ll> result;
    for (ll i = begin; i < end; ++i)
    {
        result.push_back(i);
    }
    return result;
}

random_device seed_gen;
mt19937 engine(seed_gen());
// 0, 1, 2 のどれかが得られる一様分布
// uniform_int_distribution<> dist(0, 2);
// cout << dist(engine) << endl;
// みたいに、先に確率分布を宣言して、そこにengineを与えて使う。

// =========ここまでテンプレ============

int main()
{
    ll n, d;
    cin >> n >> d;
    vector<ll> x(n);
    vector<ll> y(n);
    rep(i, n) cin >> x[i] >> y[i];
    ll count = 0;
    rep(i, n)
    {
        if (x[i] * x[i] + y[i] * y[i] <= d * d)
        {
            ++count;
        }
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 5992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	double l;
	cin>>l;
	double ans=l*l*l/27.0;
	cout<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstdlib>

using namespace std;

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

  vector<int> v(N);
  for(int i=0; i<N; i++)
    cin >> v[i];

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

  double ave = v[0];
  for(int i=1; i<N; i++)
    {
      ave = (ave+v[i])*0.5; 
    }

  cout << ave << endl;


  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <iterator>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvll;
typedef vector<vector<double>> vvd;
typedef vector<vector<bool>> vvb;

#define repr(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define PI M_PI



int main()
{
	int N, K;
	cin >> N >> K;
	vi x(N, 0);
	rep(i, N)cin >> x[i];
	int ans = 0;

	rep(i, N) {
		ans += min(x[i], K - x[i]);
	}

	cout << ans * 2 << endl;

    return 0;
}



Measured memory_bytes: 256