akhauriyash/Code-Regression huggingface dataset:
/********************************************************************
* @file queue.cpp
* @brief queueライブラリを使用したサンプルソース
* @date 2020/06/09
* @version 1.0
* @note 入力されたプロセスをランドロビンスケジューリングにより処理する
* @par サンプルソース作成
*********************************************************************/

#include <bits/stdc++.h> //全てのヘッダファイルをインクルード
using namespace std;

int main(){

    list<int> L;
    list<int>::iterator itr;
    int n , value;
    string s;

    cin >> n;

    for(int i=0; i<n; i++){
        cin >> s;
        if(s=="insert"){
            cin >> value;
            L.push_front(value);
        }
        else if(s=="delete"){
            cin >> value;
            for(itr=L.begin(); itr!=L.end(); itr++){
                if(*itr == value){
                    L.erase(itr);
                    break;
                }
            }
        }
        else if(s=="deleteFirst"){
            L.pop_front();
        }
        else if(s=="deleteLast"){
            L.pop_back();
        }
    }

    int count = 0;
    for(itr=L.begin(); itr!=L.end(); itr++){
        if(count!=0){
            cout << " ";
        }
        cout << *itr;
        count++;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 34256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;

void solve(){
    int a,b,t;
    cin >> a >> b >> t;
    cout << (t/a)*b;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 3660
// A. 

#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <cstring>

using namespace std;

typedef long long LL;

int main(int argc, char *argv[])
{
	int N, a[300000];
	cin >> N;
	for (int i = 0; i < N * 3; ++i) {
		cin >> a[i];
	}
	sort(a, a + N * 3);
	LL ans = 0;
	for (int i = 0; i < N; ++i) {
		ans += a[N + i * 2];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1408
# encoding:utf-8
import copy
import numpy as np
import random

N = int(input())
MOD = 10**9+7
memo = [{} for i in range(N+1)]

def check(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i-1],t[i] = t[i],t[i-1]

        if "".join(t).count("AGC") >= 1:
            return False

    return True

def dfs(cur,last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == N:
        return 1
    ret = 0
    for c in "AGCT":
        if check(last3+c):
            ret = (ret + dfs(cur+1,last3[1:]+c))%MOD
    memo[cur][last3] = ret
    return ret

print(dfs(0,"TTT"))


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

using namespace std;
const int mod = 1e9+7;
const int N = 2000005;
long long fact[N],inv[N],factinv[N];
void init(){
    fact[0]=inv[1]=factinv[0]=inv[0]=fact[1]=factinv[1]=1;
    for(int i=2;i<=N-1;i++){
        fact[i]=(fact[i-1]%mod*i%mod)%mod;
        inv[i]=(mod-mod/i)*inv[mod%i]%mod;
        factinv[i]=factinv[i-1]*inv[i]%mod;
    }
}
int main(){
	init();
	long long x,y;
	cin>>x>>y;
	if((x+y)%3){
		cout<<0<<endl;	
		return 0;	
	}
	long long k=(x+y)/3;
	long long ans=0;
	for(long long l=0;l<=k;l++){
		if(l+(k-l)*2==x&&l*2+(k-l)==y){
			long long now=((fact[k]*factinv[l])%mod*factinv[k-l])%mod;
			ans+=now;
			ans%=mod;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 47232
#include <bits/stdc++.h>
using namespace std;
using ll = long long;


void solve(long long n, std::vector<long long> a)
{
    auto it = max_element(begin(a), end(a));
    auto max_a = *it;
    a.erase(it);
    auto it_mid = min_element(begin(a), end(a), [mid = max_a / 2](ll a, ll b) { return abs(a - mid) < abs(b - mid); });
    cout << max_a << " " << *it_mid << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
// clang-format off
int main(){
    long long n;
    scanf("%lld",&n);
    std::vector<long long> a(n);
    for(int i = 0 ; i < n ; i++){
        scanf("%lld",&a[i]);
    }
    cin.tie(nullptr);
    cout.tie(nullptr);
	ios_base::sync_with_stdio(false);
    solve(n, std::move(a));
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
#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 per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define all(c) c.begin(),c.end()
#define si(x) int(x.size())
#define pb emplace_back
#define fs first
#define sc second
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<class T,class U> void chmax(T& x, U y){if(x<y) x=y;}
template<class T,class U> void chmin(T& x, U y){if(y<x) x=y;}
template<class T> void mkuni(V<T>& v){sort(all(v));v.erase(unique(all(v)),v.end());}
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
void dmpr(ostream& os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ~ ";
	dmpr(os,args...);
}
#define shows(...) cerr << "LINE" << __LINE__ << " : ";dmpr(cerr,##__VA_ARGS__)
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) void(0)
#define dump(x) void(0)
#define shows(...) void(0)
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);

	int N; cin >> N;
	V<int> c(26,100);
	while(N--){
		string s; cin >> s;
		V<int> a(26);
		for(char c: s) a[c-'a']++;
		rep(i,26) chmin(c[i],a[i]);
	}
	rep(i,26) cout << string(c[i],'a'+i);
	cout << endl;
}


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

int main() {
	
	int n,m,i,j;
	cin>>n>>m;
	char mat[n][m];
	int row[n],col[m];
	memset(row,0,sizeof(row));
	memset(col,0,sizeof(col));
	
	for(i=0;i<n;i++)
	  {
	  	 for(j=0;j<m;j++)
	  	   {
	  	   	cin>>mat[i][j];
	  	   	if(mat[i][j]=='#')
	  	   	  {++row[i];col[j]++;}
	  	   }
	  }
	  //cout<<row[0]<<" "<<col[0]<<"\n";
	for(i=0;i<n;i++)
	  {    int c=0;
	  	for(j=0;j<m;j++)
	  	  {
	  	  	if(row[i]!=0 && col[j]!=0){c=1;
	  			cout<<mat[i][j];
	  	  		
	  	  	}	
	  	  }
	     if(c==1)	  
	  	cout<<'\n';  
	  }
	// your code goes here
	return 0;
}

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

const ll logx=30;
const ll N=4e5+5;
const ll M=3e5+5;
const ll mod=1e9+7;
const ll INF=1e18+5;
const double PI = 3.14159265358979323846;

#define ints(n) scanf("%d",&n)
#define intp(n) printf("%d\n",n)
#define longs(n) scanf("%intd",&n)
#define longp(n) printf("%intd\n",n)

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }

#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define ms(dp,val) memset(dp,val,sizeof(dp))
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1ll;x=(x*x)%m;}return ans%m;}

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

ll n,v[N],c[N],dp[21][1001][1001];

ll F(ll idx,ll addx,ll subx)
{
  ll maxi=-INF;
  if(idx==n){return addx-subx;}
  if(dp[idx][addx][subx]!=-1){return dp[idx][addx][subx];}
  maxi=max(maxi,F(idx+1,addx+v[idx],subx+c[idx]));
  maxi=max(maxi,F(idx+1,addx,subx));
  return dp[idx][addx][subx]=maxi;
}

int main()
{
  cin>>n;
  ms(dp,-1);
  for(ll i=0;i<n;i++){cin>>v[i];}
  for(ll i=0;i<n;i++){cin>>c[i];}
  cout<<F(0,0,0)<<endl;
}


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

typedef unsigned long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;

#define INF (int)(1e9)

#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,start,end) for(int i=(start);i<=(end);i++)
#define all(n) begin(n),end(n)

#define DEBUG

int main()
{
	ll a, b;
	cin >> a >> b;

	ll x = a * b;
	if(a < b) swap(a,b);
	ll r = a % b;
	while (r != 0)
	{
		a = b;
		b = r;
		r = a % b;
	}

	cout << x / b << endl;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  int min=1;
  
  for(int j=0;j<N;j++){
    int x;
    cin >> x;
    int count=0;
    int tmp;
    for(int i=x;(i%2)!=1;i/=2){
      count++;
      x/=2;
      //cout << x << endl;
    }
    if(j==0) min = count;
    if(min >= count) min = count;
  }
  cout << min << endl;
  
}

Measured memory_bytes: 256
s=int(input())

dd={s:1}
ans=-1
m=1
while True:
  m+=1
  if s%2>0: s=3*s+1
  else: s=s//2
  #print(s," ",end="",sep="")
  ans=dd.get(s)
  if ans==None: dd[s]=m
  else: ans=m; break

#print()
print(ans)    


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  int x,y;
  cin>>x>>y;

  if(x%y==0){
    cout<<-1<<endl;
    return 0;
  }
  ll v=1;
  while(v<=1e18){
    v*=x;
    if(v%y) break;
  }
  cout<<v<<endl;
	return 0;
}

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

using namespace std;

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

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

void Calculate_Depth(vector<vector<int>>&edge, vector<int>&depth, int stnode) {
	depth[stnode] = 0;
	queue<int>Q;
	Q.push(stnode);
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		for (auto i : edge[cn]) {
			if (depth[i] > depth[cn] + 1) {
				depth[i] = depth[cn] + 1;
				Q.push(i);
			}
		}
	}
	return;
}

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

	cin >> N;
	vector<vector<int>>edge(N);
	for (int i = 1; i < N; i++) {
		cin >> L >> R;
		L--;
		R--;
		edge[L].push_back(R);
		edge[R].push_back(L);
	}
	vector<int>depth(N, MOD);
	Calculate_Depth(edge, depth, 0);
	int index = 0;
	for (int i = 1; i < N; i++)if (depth[i] > depth[index])index = i;
	for (auto &i : depth)i = MOD;
	Calculate_Depth(edge, depth, index);
	int num = *max_element(depth.begin(), depth.end());
	vector<int>dp(N + 1);
	dp[0] = 1;
	for (int i = 2; i <= N; i++) {
		dp[i] = 1;
		if (dp[i - 2] && dp[i - 1])dp[i] = 0;
	}
	if (dp[num])cout << "First\n";
	else cout << "Second\n";
	return 0;
}

Measured memory_bytes: 13556
using System;

class Cards
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        int[] S = new int[13];
        int[] H = new int[13];
        int[] C = new int[13];
        int[] D = new int[13];

        for(int i = 0; i < 13; i++)
        {
            S[i] = 0;
            H[i] = 0;
            C[i] = 0;
            D[i] = 0;
        }

        for (int i=0;i< n; i++)
        {
            string[] s = Console.ReadLine().Split();

            string mark = s[0];
            int number = int.Parse(s[1]);

            if(mark == "S")
            {
                S[number-1] = number;
            }else if (mark == "H")
            {
                H[number-1] = number;
            }else if (mark == "C")
            {
                C[number-1] = number;
            }else if(mark == "D")
            {
                D[number-1] = number;
            }
        }

        for(int i = 0; i < 13; i++)
        {
            if (S[i] != i+1)
            {
                Console.WriteLine("S {0}",i+1);
            }
        }
        for (int i = 0; i < 13; i++)
        {
            if (H[i] != i + 1)
            {
                Console.WriteLine("H {0}", i + 1);
            }
        }
        for (int i = 0; i < 13; i++)
        {
            if (C[i] != i + 1)
            {
                Console.WriteLine("C {0}", i + 1);
            }
        }
        for (int i = 0; i < 13; i++)
        {
            if (D[i] != i + 1)
            {
                Console.WriteLine("D {0}", i + 1);
            }
        }
    }
}


Measured memory_bytes: 9164
#include<stdio.h>
int main(){
  int n,i,a[10000],max,min;
  long long int sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&a[i]);
    }
  max=a[0];
  min=a[0];
  for(i=0;i<n;i++)
    {
      if(min>a[i])
	{
	  min=a[i];
	}
      if(max<a[i])
	{
	  max=a[i];
	}
      sum+=a[i];
    }
  printf("%d %d %lld\n",min,max,sum);
  
  return 0;
}

Measured memory_bytes: 640
a,b,c=gets.split.map &:to_i
r=0
while true do
  if ((a-1)*(b-1)*(c-1)).even?
    break
  end
  if a==b && b==c
    r=-1
    break
  else
    ta=a
    tb=b
    a=b/2+c/2
    b=ta/2+c/2
    c=ta/2+tb/2
    r+=1
  end
end
p r

Measured memory_bytes: 1788
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
	Scanner scan=new Scanner(System.in);
    String s=scan.next();
    if(s.charAt(2)==s.charAt(3)&&s.charAt(4)==s.charAt(5)){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}
  


Measured memory_bytes: 23764
import sys
from collections import Counter
from collections import deque
import math
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))


n=int(input())
p=lmp()
m=p[0]
ans=1
for i in range(1,n):
    if m>=p[i]:
        m=p[i]
        ans+=1
print(ans)

Measured memory_bytes: 25120
import sys
import numpy as np

def main(inp):
    N,M=map(int,next(inp).split())
    X=np.array(list(map(int,next(inp).split())))
    X=np.sort(X)
        
#     N=inp[0]
#     M=inp[1]    
#     X=np.array(inp[2])
    X=np.sort(X)    
#    print("N",N)
#    print("M",M)
#    print("X",X)
    
    if(N>M): return 0
    if(N==1):
        ans=X[len(X)-1]-X[0]
        return ans
    
    delta=np.empty([M-1],dtype=int)
    
    for i in range(M-1):
        delta[i]=X[i+1]-X[i]
    
#    print(X)
#    print("delta",delta)
    
    
    #delta=np.split(delta,[1,2])
    #print(delta)
    
    splpoint=np.argpartition(np.array(delta),-N+1)[-N+1:]
#     splpoint=np.sort(splpoint)
    
    delta=np.delete(delta,splpoint)
#    print(splpoint)
#    print(delta)    
    
    ans=sum(delta)
        
    return ans

print(main(sys.stdin))

Measured memory_bytes: 23064
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim a As Integer = NextInt()
        Dim b As Integer = NextInt()

        Dim c As Integer = b - a

        Dim ans As Integer = -1 * a
        For i As Integer = 1 To c - 1
            ans += i
        Next

        WriteLine(ans)
    End Sub

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


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

typedef long long int ll;
typedef pair<ll,ll> pll;

#define FOR(i,n,m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i,n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

vector<int> primeList;
bool isPrime[1000005];
void calcPrime()
{
    isPrime[0]=isPrime[1]=false;
    for(int i=2;i<1000005;i+=1)
    {
        if(isPrime[i])
        {
            continue;
        }
        primeList.push_back(i);
        for(int j=i;j<1000005;j+=i)
        {
            isPrime[j]=true;
        }
    }
}

ll pn[1000005];

int main()
{
    ll N,P;
    cin>>N>>P;
    calcPrime();
    int i=0;
    while(i<primeList.size())
    {
        ll p=primeList[i];
        if(P%p==0)
        {
            P/=p;
            pn[p]++;
            continue;
        }
        i++;
        if(P==1)
        {
            break;
        }
    }
    ll sum=1;
    if(N==1)sum=P;
    REP(j,1000005)
    {
        ll n =pn[j]/N;
        sum*=pow(j,n);
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 5368
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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; }


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;

    vector<int> box(n+1,1);
    vector<bool> red(n+1,0);
    box[0]=0;
    red[1]=true;

    REP(i,m){
        int x,y;
        cin>>x>>y;
        if(red[x]) red[y]=true;
        box[x]--,box[y]++;
        if(box[x]==0) red[x]=false;
    }
    int ans=0;
    REP(i,n+1) if(red[i]) ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<iostream>
using namespace  std;
int rail[10];
int it = -1;
int main()
{
	int n;
	while (cin >> n)
	{
		if (n == 0)
		{
			cout << rail[it] << endl;
			it--;
		}
		else
		{
			it++;
			rail[it] = n;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
using namespace std;
typedef pair<int,int> P;//Pでpair<-,->を表す。
typedef long long LL; 
LL MOD=1000000007;

int main()
{ 
    LL a,b,c;
    cin>>a>>b>>c;
    if(c-a-b<0){cout<<"No"<<endl;return 0;}
    else{
        if(a*b>250000000000000000){cout<<"No"<<endl;return 0;}
        else{
            LL x=4*a*b;
            LL y=(c-a-b)*(c-a-b);
            if(x<y){cout<<"Yes"<<endl;}
            else{cout<<"No"<<endl;}
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	getline(cin,s);
	for (int i=0;i<s.size();i++)
	{
		if (s[i]=='C')
		{
			for (int j=i+1;j<s.size();j++)
			   if (s[j]=='F')
			   {
			   	   cout<<"Yes\n";
			   	   return 0;
			   }
			cout<<"No\n"; 
			return 0;
		}
	}
	cout<<"No\n";
	return 0;
}

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


int main() {
	char sn[20];
	int i = 0;

	scanf("%s", sn);

	if (!strcmp(sn ,"Sunny")) {
		printf("Cloudy\n");
	}
	else if (!strcmp(sn,"Cloudy")){
		printf("Rainy\n");
	}
	else if (!strcmp(sn,"Rainy")) {
		printf("Sunny\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, n, a) for(int i = a; i < n; ++i)
 
int main(void) {
  int n, i, j, st = 0;
  scanf("%d", &n);
  char a[n][5], b[n][5], s[n][5];
  rep(i, n) {
    scanf("%s", a[i]);
    rep(j, 5) b[i][j] = a[i][j], s[i][j] = a[i][j];
  }
  /*bubblesort*/
  int flag = 1;
  rep(i, n) {
    flag = 0;
    for(j = n - 1; j > i; --j) {
      if(b[j][1] < b[j - 1][1]) {
        char t;
        t = b[j][0], b[j][0] = b[j - 1][0], b[j - 1][0] = t;
        t = b[j][1], b[j][1] = b[j - 1][1], b[j - 1][1] = t;
       }
    }
  }
  /*selectionsort*/
  rep(i, n) {
    int minj = i;
    char t;
    repi(j, n, i) if(s[j][1] < s[minj][1]) minj = j;
    t = s[i][0], s[i][0] = s[minj][0], s[minj][0] = t;
    t = s[i][1], s[i][1] = s[minj][1], s[minj][1] = t;
  }
  rep(i, n) {
    if(i) printf(" %s", b[i]);
    else printf("%s", b[i]);
  }
  printf("\nStable\n");
  rep(i, n) {
    if(s[i][0] != b[i][0]) st = 1;
    if(i) printf(" %s", s[i]);
    else printf("%s", s[i]);
  }
  if(st) printf("\nNot stable\n");
  else printf("\nStable\n");
  return 0;
}


Measured memory_bytes: 2748
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<string>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<stack>
#include<cmath>
#include<map>
#include<vector>
#define ll long long
#define inf 0x3f3f3f3f
#define bug1 cout<<"bug1"<<endl;
#define bug2 cout<<"bug2"<<endl;
#define bug3 cout<<"bug3"<<endl;
using namespace std;
long long  sum[33005];
int main(){
    long long x;
    cin>>x;
    ll l=0,r=1e9;
    while((l+1)<r){
        ll mid=(l+r)>>1;
        ll tmp=(mid+1)*mid/2+(mid+1)*mid%2;
        if(tmp>=x){
            r=mid;

        }
        else {
            l=mid;
        }
    }
    cout<<r<<'\n';

}

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

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

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

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

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

    DESC(A);
    ll sum = 0;
    REP(i,0,N) sum += A[i] * (i % 2 == 0 ? 1 : -1);
    PR(sum);

    return 0;
}

/*



*/

Measured memory_bytes: 3600
using System;
using System.Linq;

public class Test
{
	public static void Main()
	{
		// your code goes here
		
		int n = int.Parse(Console.ReadLine());
		var v = Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray();
		Array.Sort(v);
		double ans = ( v[0] + v[1] )/2;
		
		for(int i=2; i!=n; i++){
			ans = ( v[i] + ans )/2;
		}
		
		Console.WriteLine(ans);
		
	}
}

Measured memory_bytes: 13396
import sys

INF = 10**9+7

stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def nal(): return list(map(int, stdin.readline().split()))
def ns(): return stdin.readline().strip()
def nsl(): return list(stdin.readline().strip())
def ni(): return int(stdin.readline())


n = ni()
a = nal()

m = max(a)
a.sort()

c = 0
tmp = 0
for i in range(n-1):
    tmp = a[i] + tmp
    if(tmp*2 < a[i+1]):
        c = i+1


print(n - c)

Measured memory_bytes: 14400
import sys


def arabic(s):
    if s == "I":
        return 1
    elif s == "V":
        return 5
    elif s == "X":
        return 10
    elif s == "L":
        return 50
    elif s == "C":
        return 100
    elif s == "D":
        return 500
    elif s == "M":
        return 1000
    else:
        return -1


for i in sys.stdin:
    S = 0
    for j in range(len(i)):
        if arabic(i[j]) == -1:
            continue
            # print("ver1")
        elif j != 0 and arabic(i[j-1]) < arabic(i[j]):
                S = S - arabic(i[j-1]) * 2 + arabic(i[j])
                # print("ver2")
        else:
            S += arabic(i[j])
            # print("ver3")
        # print(str(S) + "!")
    print(S)

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

int main() {
  int H, W;
  cin >> H >> W;
  string numbers = "012345678";
  string preS = "";
  string S;
  cin >> S;
  string nextS = "";
  rep(i, H) {
    if ( i < H-1 ) {
      cin >> nextS;
    }
    rep(j, W) {
      char c = S.at(j);
      if ( c != '#' ) {
        int count = 0;
        if ( i > 0 ) {
          if ( j > 0 && (preS.at(j-1) == '#') ) {
            count++;
          }
          if ( preS.at(j) == '#' ) {
            count++;
          }
          if ( j < W-1 && (preS.at(j+1) == '#') ) {
            count++;
          }
        }
        if ( j > 0 && (S.at(j-1) == '#') ) {
          count++;
        }
        if ( j < W-1 && (S.at(j+1) == '#') ) {
          count++;
        }
        if ( i < H-1 ) {
          if ( j > 0 && (nextS.at(j-1) == '#') ) {
            count++;
          }
          if ( nextS.at(j) == '#' ) {
            count++;
          }
          if ( j < W-1 && (nextS.at(j+1) == '#') ) {
            count++;
          }
        }
        S.at(j) = numbers.at(count);
      }
    }
    cout << S << endl;
    preS = S;
    S = nextS;
  }
}

Measured memory_bytes: 256
/*
** 二叉堆
*/

# include <cstdio>

const int MAX = 250 + 5;

int n, a[MAX];

void solve() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
    int p, l, r;
    for (int i = 1; i <= n; i++) {
        printf("node %d: ", i);
        printf("key = %d, ", a[i]);
        p = i / 2;
        if (p != 0) {
            printf("parent key = %d, ", a[p]);
        }
        l = 2 * i;
        r = 2 * i + 1;
        if (l <= n) {
            printf("left key = %d, ", a[l]);
        }
        if (r <= n) {
            printf("right key = %d, ", a[r]);
        }
        printf("\n");
    }
}

int main() {
    // freopen("infile", "r", stdin);
    // freopen("outfile", "w", stdout);
    solve();
    return 0;
}


Measured memory_bytes: 2736
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int A,B;
  cin >> A >> B;
  string S;
  cin >> S;
  int N = S.size();
  bool ans = true;
  rep(i,N)
  {
    if(S[i]=='-'&&i!=A)
    {
      ans = false;
    }
  }
  if(ans == true&&S[A]=='-')
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
const ll MOD = 1e9+7; int INF=INT_MAX; ll LLINF = 1LL << 60;
const vector<int> d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vector<int> d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vector<int> d4x = {1, 0, -1, 0}; vector<int> d4y = {0, 1, 0, -1};

//
int main(){
    int a,b; cin>>a>>b;
    if(a>=13) cout<<b<<endl;
    else if(a>=6&&12>=a)cout<<b/2<<endl;
    else cout<<0<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <map>
#define for1(x,y) for(long long x = 1; x<ll(y); x++)
#define forn(x,y,z) for(long long x = y; x< ll(z); x++)
#define for0(x,y,z) for(long long x = y; x< ll(z); x++)
# define PII pair<int,int>
# define FF first
# define SS second
# define PB push_back

#define forn(x,y,z) for(long long x = y; x< ll(z); x++)
#define for0(x,y,z) for(long long x = y; x< ll(z); x++)
using namespace std;
typedef long long ll;
typedef long double ld;	

#define maxn 1000015
const double EPS = (1e-7), EPSm= (1e7);
const ll linf = (ll)1e17 + 5;
long double PI = 3.14159265359;
int dir[8][2]={{1,0},{-1,0},{0,1},{0,-1},{-1,-1},{1,1},{-1,1},{1,-1}};
	
const int MAXN = 1e5 + 10;
const int NINF = -1e5;
const int INF = 2000000000;

void solve()
{
	int n;
	ll d,cnt=0;
	cin>>n>>d;
	forn(i,0,n){
		ll x,y;
		cin>>x>>y;
		if(x*x+y*y<=d*d)cnt++;
	}
	cout<<cnt<<endl;
	return;
}


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	setprecision(20);
	int test;
	//cin >> test;
	//while(test--)
		solve();
	return 0;
}


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

int main(){

    int a,b;
    char op;

    while(1){
    scanf("%d %c %d",&a,&op,&b);
        if(op == '+'){
            printf("%d\n",a+b);
        }else if(op == '-'){
            printf("%d\n",a-b);
        }else if(op == '*'){
            printf("%d\n",a*b);
        }else if(op == '/'){
            printf("%d\n",a/b);
        }else if(op == '?'){
            break;
        }
    }

    return 0;
}



Measured memory_bytes: 2680
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;





int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    
    int ans = 0;
    int t = 0;
    for (int i = 1; i < n; i++) {
        if (a[i - 1] >= a[i]) {
            t++;
            ans = max(ans, t);
        }
        
        else t = 0;
    }
    
    cout << ans;


}


Measured memory_bytes: 640
import java.util.*;
import static java.lang.System.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	void run() {
		int n;
		while (true) {
			n = sc.nextInt();
			if (n == 0) break;
			int ans = 0, b;
			I:for (int i = 1; i <= n/2; i++) {
				b = i;
				for (int j = i+1; j <= n/2+1; j++) {
					b += j;
					if (b == n) {
						ans++;
						continue I;
					} else if (b > n) {
						continue I;
					}
				}
			}
			out.println(ans);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 19932
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> ac_list(n, 0),wa_list(n,0);
    int num, ac_count=0, wa_count=0;
    string result;
    REP(i, m){
        cin >> num >> result;
        if(result == "WA"){
            wa_list[num]++;
        } else {
            if(ac_list[num]==0){
                ac_list[num]++;
                ac_count++;
                wa_count += wa_list[num];
            }
        }
    }
    cout << ac_count << " " << wa_count;
    return 0;
}


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

int a, b, c;

int main() {
    scanf("%d%d%d", &a, &b, &c);
    if (a+b==c || a+c==b || b+c==a) printf("Yes\n");
    else printf("No\n");
    return 0;
}


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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
#define ALL(x) x.begin(),x.end()
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int N;
vector<int> edge [150001];
double dp [150001];
double dp2 [150001];

double dfs(int curr,int prev)
{
	int num = 0;
	for(const auto& it : edge [curr]) if(it != prev){
		dp [curr] += dfs(it,curr) + 1.0;
		num++;
	}
	if(num){
		dp [curr] /= num;
	}
	return dp [curr];
}

void dfs2(int curr,int prev,double par)
{
	dp2 [curr] = par;
	for(const auto& it : edge [curr]) if(it != prev){
		int num = edge [curr].size();
		if(curr == 1){
			if(num > 1){
				dfs2(it,curr,(dp [curr] * num - (dp [it] + 1.0)) / (num - 1) + 1.0);
			}
			else{
				dfs2(it,curr,1.0);
			}
		}
		else{
			if(num > 1){
				dfs2(it,curr,(dp [curr] * (num - 1) + dp2 [curr] - (dp [it] + 1.0)) / (num - 1) + 1.0);
			}
			else{
				dfs2(it,curr,1.0);
			}
		}
	}
}

int main()
{
	scanf("%d",&N);
	FOR(i,0,N - 1){
		int u,v;
		scanf("%d%d",&u,&v);
		edge [u].push_back(v);
		edge [v].push_back(u);
	}

	dfs(1,-1);
	dfs2(1,-1,0);
	FOR(i,1,N + 1){
		int num = edge [i].size();
		if(i == 1){
			printf("%.10f\n",dp [i]);
		}
		else{
			printf("%.10f\n",(dp [i] * (num - 1) + dp2 [i]) / num);
		}
	}

	return 0;
}


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

int main(){
  int N,M; cin >> N >> M;
  vector<pair<int,int>> A;
  for(int i=0; i<N; i++){
    int a; cin >> a;
    A.push_back(make_pair(a,1));
  }
  for(int i=0; i<M; i++){
    int b,c; cin >> b >> c;
    A.push_back(make_pair(c,b));
  }
  sort(A.begin(),A.end(),greater<pair<int,int>>());
  
  int i=0;
  long long sum=0;
  while(N){
    long long num=A[i].first,times=A[i].second;
    if(N>times){
      sum+=num*times;
      N-=times;
    }else{
      sum+=num*N;
      N=0;
    }
    i++;
  }
  cout << sum << endl;
}

Measured memory_bytes: 2420
def dfs(i, a, b, c, plus):
    global ans

    if i == n:
        if a and b and c:
            mp = abs(a - A) + abs(b - B) + abs(c - C) + (plus - 3) * 10
            ans = min(ans, mp)

    else:
        dfs(i + 1, a, b, c, plus)
        dfs(i + 1, a + l[i], b, c, plus + 1)
        dfs(i + 1, a, b + l[i], c, plus + 1)
        dfs(i + 1, a, b, c + l[i], plus + 1)


n, A, B, C = map(int, input().split())
l = [int(input()) for i in range(n)]

ans = float("inf")

dfs(0, 0, 0, 0, 0)

print(ans)

Measured memory_bytes: 3064
import java.util.*;

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

        if (a+b<10){
            System.out.println(a+b);
        }
        else {
            System.out.println("error");
        }
        // System.out.println("Yes");
        sc.close();
    }
}

Measured memory_bytes: 35564
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
#define LL long long
#define NUM 1000000007

using namespace std;

int main() {
    int n;
    vector<pair<int, int>> ans;
    cin >> n;
    for (size_t i = 1; i <= n; i++)
    {
        int tmp = i, count = 0;
        while (true)
        {
            if (tmp % 2 == 0)
            {
                tmp /= 2;
                count++;
            }
            else
            {
                ans.emplace_back(make_pair(count, i));
                break;
            }
        }
    }
    cout << max_element(ans.begin(), ans.end())->second << endl;
}

Measured memory_bytes: 256
//kid_kb//

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define ull unsigned long long int
#define lower(str) transform(str.begin(),str.end(),str.begin(),::tolower);
#define upper(str) transform(str.begin(),str.end(),str.begin(),::toupper);
#define mod 1000000007
#define SORT(vec) sort(vec.begin(),vec.end());
#define pb push_back
#define csb __builtin_popcount
#define msb(n) (ll)(log2(n))
#define DIG(n) floor(log10(n))+1
#define kb ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ptr(arr) for(auto i:arr)cout<<i<<" ";
#define ptr2(vec) for(auto i:vec){for(auto j: i){cout<<j<<" ";}cout<<endl;}
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mem(a,val) memset(a,val,sizeof(a))
//cout<<fixed<<setprecision(8)<<endl;
 
int main()
{
    kb
    //                                            Let's Fight !!!!!!!
    ll t;
    t=1;
    // cin>>t;
    while(t--){
        ll h,w,m;
        cin>>h>>w>>m;
        int row[h],col[w];
        mem(row,0);
        mem(col,0);
        
        int a,b;
        //vector<<vector<int>>row2(h);
        vector<vector<int>>row2(h);
        int row3[h];
        mem(row3,0);
        vector<pair<int,int>>v;
        rep(i,0,m){
            cin>>a>>b;
            a--;
            b--;
            row[a]++;
            col[b]++;
            v.pb({a,b});
           
            
        }
        int c1=0,c2=0;
        int r=*max_element(row,row+h);
        int c=*max_element(col,col+w);
        vector<int>temp;
        rep(i,0,h){
            if(row[i]==r)temp.pb(i);
        }
        int sum=0;
         rep(i,0,w){
            if(col[i]==c){c2++;sum+=i;}
        }
        for(auto i:v){
            if(col[i.second]==c){
                 row2[i.first].pb(i.second);
                row3[i.first]+=i.second;
            }
        }
        int f=1;
     for(auto i:temp){
         if(row2[i].size()== c2 and row3[i]==sum)continue;
         else {
             f=0;
             break;
         }
     }
        cout<<r+c-f<<endl;
    }

    return 0;
}

Measured memory_bytes: 26648
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-
import itertools


def main():
    N = int(input())
    XY = [list(map(int, input().split())) for _ in range(N)]
    roots = list(itertools.permutations(XY))

    cnt, result = len(roots), 0
    
    for root in roots:
        for i in range(len(root) - 1):
            result += ((root[i][0] - root[i + 1][0])**2 +
                       (root[i][1] - root[i + 1][1])**2)**0.5
    print(result / cnt)


if __name__ == "__main__":
    main()


Measured memory_bytes: 8052
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int a[] = {0,0,1,1,2,2};
int b[] = {1,2,0,2,0,1};
int c[] = {2,1,2,0,1,0};
char T[] = {'a','b','c'};
int main(){
  string S;
  cin >> S;
  bool flag = false;
  for(int i = 0; i < 6; i++){
    if(S[0]==T[a[i]]&&S[1]==T[b[i]]&&S[2]==T[c[i]]) flag = true;
  }
  if(flag) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    ll n;
	cin>>n;
	ll a[n],b[n];
	vector<pair<ll, ll> > ab(n);
	for(ll i=0;i<n;i++)cin>>a[i]>>b[i];
	for(int i=0;i<n;i++){
		ab[i] = make_pair(b[i],a[i]);
	}
	sort(ab.begin(),ab.end());
	int mi=101;
	for(int i=0;i<n;i++){
	    if(ab[i].first==ab[n-1].first){
	        if(mi>ab[i].second)mi=ab[i].second;
	    }
	}
	cout<<mi<<" "<<ab[n-1].first<<endl;
}



Measured memory_bytes: 3120
#include <stdio.h>

int main() {
	long long int N, A[200000], t[200000] = {0};
	scanf("%lld", &N);
	for (int i = 0; i < N; i++) scanf("%lld", &A[i]);
	for (int i = 0; i < N; i++) t[A[i]]++;
	long long int an = 0;
	for (int i = 1; i <= N; i++) an += t[i] * (t[i] - 1) / 2;
	for (int i = 0; i < N; i++)A[i] = an - t[A[i]] + 1;
	for (int i = 0; i < N; i++) printf("%lld\n",A[i]);
	return 0;
}

Measured memory_bytes: 5632
// AOJ 1238 True Liars
// 2018.3.20 bal4u

#include <stdio.h>
#include <string.h>

#define MAX 603

// [library]

#define gch() getchar_unlocked()
//#define gch() getchar()

int in()			// get a non-negative integer from stdin
{
	int n = 0, c = gch();
	do n = 10*n + (c & 0xf), c = gch(); while (c >= '0');
	return n;
}

/* UNION-FIND */
int id[2*MAX], size[2*MAX];
void init(int n) { int i; for (i = 0; i < n; i++) id[i] = i, size[i] = 1; }
int root(int i) { while (i != id[i]) id[i] = id[id[i]], i = id[i]; return i; }
int connected(int p, int q) { return root(p) == root(q); }
void unite(int p, int q)
{
    int i = root(p), j = root(q); if (i == j) return;
    if (size[i] < size[j]) id[i] = j, size[j] += size[i]; else id[j] = i, size[i] += size[j];
}

// [\library]

int   sz;
short f[MAX][MAX], sf[MAX];
short g[MAX][MAX], sg[MAX];
short belong[MAX];

short dp[MAX][MAX];
short which[MAX][MAX];
char  divine[MAX];

int main()
{
	int n, p1, p2, p, i, j, k, x, xx, y, yy, r;

	while (1) {
		n = in(), p1 = in(), p2 = in(), p = p1+p2;
		if ((n|p1|p2) == 0) break;
		if (n == 0) {
			if (p1 == 0) puts("end");
			else if (p2 == 0) { for (i = 1; i <= p; i++) printf("%d\n", i); puts("end"); } 
			else puts("no");
			continue;
		}

		init(p << 1);

		while (n--) {
			x = in()-1, xx = x<<1, y = in()-1, yy = y<<1, r = gch();
			if (r == 'y') {
				unite(xx, yy), unite(xx+1, yy+1); gch(), gch(), gch();
			} else {
				unite(xx, yy+1), unite(xx+1, yy); gch(), gch();
			}
		}

		sz = 1, memset(belong, 0, p<<1);
		memset(sf, 0, p<<1), memset(sg, 0, p<<1);
		for (x = 0; x < p; x++) {
			xx = x<<1, i = root(xx);
			if (i == xx) i = root(++xx);

			j = belong[i>>1];
			if (j == 0) j = belong[i>>1] = sz++;
			if ((xx & 1) == (i & 1)) {
				if   (j > 0) f[j][sf[j]++] = x, belong[x] = j;
				else j = -j, g[j][sg[j]++] = x, belong[x] = -j;
			} else {
				if   (j > 0) g[j][sg[j]++] = x, belong[x] = -j;
				else j = -j, f[j][sf[j]++] = x, belong[x] = j;
			}
		}

		memset(dp, 0, sizeof(dp)); dp[0][0] = 1;
		memset(which, 0, sizeof(which));
		for (k = 1; k < sz; k++) {
			for (i = 0; i <= p; i++) {
				if (dp[k-1][i] == 0) continue;
				j = i + sf[k], dp[k][j] += dp[k-1][i];
				if (dp[k][j] > 2) dp[k][j] = 2;
				which[k][j] = k;
				j = i + sg[k], dp[k][j] += dp[k-1][i];
				if (dp[k][j] > 2) dp[k][j] = 2;
				which[k][j] = -k;
			}
		}
		if (dp[sz-1][p1] == 2) { puts("no"); continue; }

		memset(divine, 0, p); k = p1;
		for (i = sz-1; i >= 1; i--) {
			if (which[i][k] > 0) {
				for (j = 0; j < sf[i]; j++) divine[f[i][j]] = 1;
				k -= sf[i];
			} else {
				for (j = 0; j < sg[i]; j++) divine[g[i][j]] = 1;
				k -= sg[i];
			}
		}

		for (i = 0; i < p; i++) if (divine[i]) printf("%d\n", i+1);
		puts("end");
	}
	return 0;
}



Measured memory_bytes: 3276
#include<iostream>
#include<cstdio>
#include<cstring> 
#include<string>
#include<map>
#include<vector>
#include<cmath>
using namespace std;
int main()
{
	string a,b;
	cin>>a;
	cin>>b;
	cout<<b<<a<<endl;
	return 0	;
}

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

namespace ABC126_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var NK = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = NK[0];
                var K = NK[1];
            var S = Console.ReadLine();
            var ans = "";
            for (int i = 0; i < N; i++)
            {
                if (i == K-1)
                {
                    if (S[i] == 'A') ans += 'a';
                    if (S[i] == 'B') ans += 'b';
                    if (S[i] == 'C') ans += 'c';

                }
                else ans += S[i];
            }
            Console.WriteLine(ans);
        }
    }
}


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

int main(){
  int X,tmp,fx=0;
  cin >> X;
  tmp = X;
  while((tmp/10)>=1||(tmp>=1&&tmp<=9)){
    fx += tmp%10;
    tmp /= 10;
  }
  if(X%fx == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
  


Measured memory_bytes: 256
N = gets.to_i
S = gets.chomp

def same(a, b)
    c = 0
    for i in 'a'..'z'
        if a.include?(i) && b.include?(i)
            c += 1
        end
    end
    return c
end

m = 0
for i in 1..N-1 do
    c = same(S[0, i], S[i, N])
    if m < c
        m = c
    end
end

p m

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

int main() {
    int K; cin >> K;
    vector<ll> A(K);
    REP(i,K) cin >> A[i];
    ll ans1, ans2;
    ll low = 0;
    ll high = 1e18;
    ll mid;
    while(high-low>1) {
        mid = (high+low) / 2;
        ll tmp = mid;
        REP(i,K) tmp = tmp/A[i]*A[i];
        if(tmp<2) low = mid;
        else high = mid;
    }
    ans1 = low;
    low = 0;
    high = 1e18;
    while(high-low>1) {
        mid = (high+low) / 2;
        ll tmp = mid;
        REP(i,K) tmp = tmp/A[i]*A[i];
        if(tmp<=2) low = mid;
        else high = mid;
    }
    ans2 = low;
    if(ans2-ans1) cout << ans1+1 << ' ' << ans2 << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12); // debuged
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  int x, y;
  cin >> x >> y;
  rep(i, x + 1) {
    if (2 * i + 4 * (x - i) == y) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3616