akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

// Fenwick Tree
int n;
int bit[100000]; 

void add( int a, int x ){
	for( int i = a; i <= n; i += ( i & -i ) ) bit[i] += x;
}

int sum( int a ){
	int res = 0;
	for( int i = a; i > 0; i -= ( i & -i ) ) res += bit[i];
	return res;
}

struct abschnitt{
	int link;
	int recht;
	bool art; // query wenn true, zug wenn false
	int nummer;
};
	
int main(){
    // freopen("/Users/xuzijian/codeforces/522/in", "r", stdin);
	vector<abschnitt> v;
	map<int, int> karte;
	int m, q; cin >> n >> m >> q;
	
	for( int i = 0; i < m; ++i ){
		int l, r; cin >> l >> r;
		v.push_back( (abschnitt){ l, r, false, 0 } );
	}
	for( int i = 0; i < q; ++i ){
		int l, r; cin >> l >> r;
		v.push_back( (abschnitt){ l, r, true, i } );
	}

    // cout << "hoge" << endl;
	
	sort(
		v.begin(), v.end(),
		[]( const abschnitt& x, const abschnitt& y ){
			return ( x.recht == y.recht ) ? ( x.art == y.art && y.art ? false : y.art ) : ( x.recht < y.recht );
		}
	);

    // cout << "fuga" << endl;
	
	for( int i = 0; i < m+q; ++i ){
		// cout << v[i].link << " " << v[i].recht << " " << v[i].art <<  " " << v[i].nummer << endl;
		if( v[i].art ) karte.emplace( v[i].nummer, sum( v[i].recht ) - sum( v[i].link - 1 ) );
		else add( v[i].link, 1 );
	}
	
	for ( int i = 0; i < q; ++i ) cout << karte.at(i) << endl;
	return 0;
}


Measured memory_bytes: 12136
n,x = map(int,input().split())

t = list(map(int,input().split()))

if x < t[0]:
    count = t[0]-x
    t[0] = x
else:
    count = 0

for i in range(1,n):
    if x < t[i]+t[i-1]:
        count += -x+t[i-1]+t[i]
        t[i] = x-t[i-1]
print(count)

Measured memory_bytes: 63856
#include<stdio.h>

int main(){
  int i,N,cnt = 0;
  int a[100];

  scanf("%d",&N);

  for(i=0;i<N-1;i++)
    scanf("%d ",&a[i]);
  scanf("%d",&a[N-1]);

  for(i=0;i<N-1;i++){
    if(a[i] == a[i+1]){
      cnt++;
      i++;
    }
  }

  printf("%d",cnt);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <climits>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define si(x) int x = scanInt();
#define sll(x) LL x = scanLong();
#define sci(x) int x; scanf("%d", &x);
#define scll(x) LL x; scanf("%lld", &x);
#define pi(x) printf("%d ", x)
#define pll(x) printf("%lld ", x)
#define nl printf("\n")
#define clr(a) memset(a, 0, sizeof(a))
#define PB push_back
#define MP make_pair
using namespace std;
typedef unsigned int UI; // 32 bit integer
typedef long int LI; // 32 bit integer
typedef unsigned long int ULI; // 32 bit unsigned integer
typedef long long int LL; // 64 bit integer
typedef unsigned long long int  ULL; // 64 bit unsigned integer
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
const LL MOD = 1e9+7;

/* Fast I/O */
inline int scanInt() {
	int n = 0;
	char ch = getchar();
	int sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(int)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

inline LL scanLong() {
	LL n = 0;
	char ch = getchar();
	LL sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(LL)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

int main() {
	sll(A); sll(B);
	LL ans = max(max(2*A-1, 2*B-1), A+B);
	pll(ans); nl;
}


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

using namespace std;

#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
	IOS;
	int A,B;
	string a;
	while(cin>>A>>B>>a){
		int flag=0;
		for(int i=0;i<=A+B;i++){
			if(a[i]=='-'){
				flag++;
			}
		}
		if(a[A] == '-' and flag==1){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
	}
	return 0;
}

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

int main() {
    string s;
    cin >> s;

    int n = s.size();
    if (n == 2) {
        if (s[0] == s[1]) {
            cout << 1 << " " << 2 << endl;
            return 0;
        } else {
            cout << -1 << " " << -1 << endl;
            return 0;
        }

    } else {
        rep(i, n - 1) {
            if (s[i] == s[i + 1]) {
                cout << i + 1 << " " << i + 2 << endl;
                return 0;
            } else if (i < n - 2 && s[i] == s[i + 2]) {
                cout << i + 1 << " " << i + 3 << endl;
                return 0;
            }
        }
    }

    cout << -1 << " " << -1 << endl;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  string w;
  cin >> w;
  map<ll, ll> m;

  REP(i, w.size())
    m[w[i]-'a'] += 1;

  bool flag = true;
  REP(i, 26){
    if(m[i]%2 != 0){
      flag = false;
      break;
    }
  }

  if(flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

int main() {
	int r,D,x2000;
	cin >> r >> D >> x2000;

  int x = x2000;
  for(int i =1;i<=10;i++){
    cout << r*x - D << endl;
    x = r*x -D;
  }
}

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

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

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

  for(int i=K; i<N; i++){
    if(data.at(i) > data.at(i-K)){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl; 
    }
  }
}

Measured memory_bytes: 4044
/* おまじない　*/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD=pow(10,9)+7;
const ll INF=(1LL<<62);
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

vector< ll > manacher(const string &s) {
  vector< ll > radius(s.size());
  int i = 0, j = 0;
  while(i < s.size()) {
    while(i - j >= 0 && i + j < s.size() && s[i - j] == s[i + j]) {
      ++j;
    }
    radius[i] = j;
    int k = 1;
    while(i - k >= 0 && i + k < s.size() && k + radius[i - k] < j) {
      radius[i + k] = radius[i - k];
      ++k;
    }
    i += k;
    j -= k;
  }
  return radius;
}

vector<ll> countVector(string v,ll guard=1){
    ll size=v.size();
    //番兵を追加(初期値は-1)
    v.push_back(guard);
    vector<ll>ret;
    ll count=1;
    for(int i=0;i<size;i++){
        if(v[i]==v[i+1]){
            count++;
        }else{
            ret.push_back(count);
            count=1;
        }
    }
    return ret;
}

int main() {
    string s;
    cin>>s;
    //それぞれの文字の出現数を調べる
    vector<ll>num(27,0);
    for(int i=0;i<s.size();i++){
        num[(s[i]-'a')]++;
    }
    ll N=s.size();
    ll ans=N*(N-1)/2;
    for(int i=0;i<27;i++){
        ans-=(num[i]-1)*num[i]/2;
    }
    cout<<ans+1<<endl;
}


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

int main() {

    int k;
    cin >> k;
    
    if(k % 2 == 0) {
        cout << pow(k/2, 2) << endl;
    } else {
        cout << (k/2)*(k/2+1) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

fn input_int_tuple() -> (i32, i32) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<i32> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn main() {
    let (n, i) = input_int_tuple();
    println!("{}", n - i + 1);
}


Measured memory_bytes: 4352
#coding:utf-8
# x=int(raw_input())  # 1 # 一つの数字のみ
x,y=map(str,raw_input().split())  # 2 3  # 二つの数字
# x,z=raw_input()  # 文字列
# print x,y,z
# sum =/ x[0]+y[0]+y[1]
# s = z[0]
if x =="H":
    print y
elif x =="D":
    if y=="D":
        print "H"
    elif y=="H":
        print "D"
elif x =="D":
    if y =="D":
        print"D"
    elif y =="H":
        print"H"
# prin?t x,y


Measured memory_bytes: 2568
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


class Combination:
    def __init__(self, N):
        self.fac = [1] * (N + 1)
        for i in range(1, N + 1):
            self.fac[i] = (self.fac[i - 1] * i) % mod
        self.invmod = [1] * (N + 1)
        self.invmod[N] = pow(self.fac[N], mod - 2, mod)
        for i in range(N, 0, -1):
            self.invmod[i - 1] = (self.invmod[i] * i) % mod

    def calc(self, n, k):  # nCk
        return self.fac[n] * self.invmod[k] % mod * self.invmod[n - k] % mod


n, m, k = map(int, readline().split())
mod = 998244353
comb = Combination(n)
ans = 0
n -= 1
for i in range(k + 1):
    ans += comb.calc(n, n - i) * m * pow(m - 1, n - i, mod) % mod
    ans %= mod
print(ans)


Measured memory_bytes: 24644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++) 
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int gcd_euclid(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r; /* swap */
  }
  return u;
}

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    ll N,M;
    cin >> N >> M;
    string S,T;
    cin >> S >> T;
    ll lcm=N/gcd_euclid(N,M)*M;
    ll n=N/gcd_euclid(N,M);
    ll m=M/gcd_euclid(N,M);
    bool ans=true;
    rep(i,gcd_euclid(N,M)){
        if(S[n*i]!=T[m*i])ans=false;
    }
    if(ans)cout << lcm;
    else cout << -1;

}

/*



 */



Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;
  
using namespace std;
int k;
double r,l,t,e,miss_p,suc_p;
double ans = 0.0;
void solve(int tk,double tr,double tl,double tp){
    double h = (tr+tl)/2;
    double n_suc_p = tp*suc_p;
    double n_miss_p = tp*miss_p;
    tk--;
    if(tk == -1){
        if((tr+tl)/2 >= t-e && (tr+tl)/2 <= t+e)ans+=tp;
    }else if(t+e<tr&&t+e<tl||t-e>tr&&t-e>tl)return;
		else if(tl<=t+e&&t-e<=tr){
			ans+=tp;
			return;
    }else if(h < t){
        solve(tk,h,tl,n_suc_p);
        solve(tk,tr,h,n_miss_p);
    }else{
        solve(tk,h,tl,n_miss_p);
        solve(tk,tr,h,n_suc_p);
    }
} 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin>>k>>r>>l>>miss_p>>e>>t;
    suc_p = 1.0 - miss_p;
    double p = 1.0;
    solve(k,r,l,p);
    cout.precision(10);
    cout << fixed << ans << endl;
  return 0;
}

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

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

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n,a[50000],b,i,k;
	cin>>n>>k;
	for(i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
    ll sum=0;
    for(i=n-1;i>=n-k;i--)sum+=a[i];

    	cout<<sum<<endl;
}

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

int a,b;
char op;
int main() {
	while (true) {
		cin >> a >> op >> b;
		if (op == '?') {
			break;
		} else if (op == '+') {
			cout << a + b << endl;
		} else if (op == '-') {
			cout << a - b << endl;
		} else if (op == '*') {
			cout << a * b << endl;
		} else if (op == '/') {
			cout << a / b << endl;
		} 
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;

int main(){

   int n;
   long long int d, x, y;
   int ans = 0;

   cin >> n >> d;

   for(int i = 0; i < n; i++){
      cin >> x >> y;
      if(x * x + y * y <= d * d){
         ans++;
      }
   }

   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	ll n;
	cin >> n;
	if (n % 2 == 0) cout << n << endl;
	else cout << n * 2 << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using static System.Console;
using static System.Math;
class Simple
{
    int x;
    void Solve() {
        //input
        x = io.Int;
        //cal
        var ans = x < 1200 ? "ABC" : "ARC";
        //ret
        WriteLine(ans);
    }

    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Simple().Stream();
    private void Stream() {
        //var exStdIn = new System.IO.StreamReader("stdin.txt");
        //SetIn(exStdIn);
        Solve();
        io.Flush();
    }
}

class SimpleIO
{
    string[] _nextBuffer;
    int _bufferCnt;
    char[] cs = new char[] { ' ', '"', ',' };
    StreamWriter sw = new StreamWriter(OpenStandardOutput()) {
        AutoFlush = false
    };
    public SimpleIO() {
        _nextBuffer = new string[0];
        _bufferCnt = 0;
        SetOut(sw);
    }
    string Next() {
        if (_bufferCnt < _nextBuffer.Length)
            return _nextBuffer[_bufferCnt++];
        var st = ReadLine();
        while (st == "")
            st = ReadLine();
        if (st != null)
            _nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        else
            st = "";
        _bufferCnt = 0;
        return _nextBuffer[_bufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void Flush() => Out.Flush();
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int MAX_N=1e5;
int n,a[MAX_N];
int dis(int x,int y){
	if (y&1){
		return min(abs(y/2-x),abs(y/2+1-x));
	}else{
		return abs(y/2-x);
	}
}

int main(){
	cin>>n;
	REP(i,n){
		cin>>a[i];
	}
	sort(a,a+n);
	int ma=0;
	REP(i,n-2){
		if (dis(a[i+1],a[n-1])<dis(a[ma],a[n-1])){
			ma=i+1;
		}
	}
	cout<<a[n-1]<<" "<<a[ma]<<endl;
	return 0;
}

Measured memory_bytes: 640
n = int(input())
a = sorted(map(int, input().split()))
ct0 = 0
ct1 = 0
ans = 0
for i in range(n):
    if a[i] < 0:
        ct1 += 1
    elif a[i] == 0:
        ct0 += 1

for i in range(n):
    ans += abs(a[i])
        
if ct0 > 0 or ct1 % 2 == 0:
    print(ans)
elif ct1 == n:
    print(ans+2*a[ct1-1])
else:
    print(ans-2*min(-a[ct1-1], a[ct1]))


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

    #define ll long long
    #define ff first
    #define ss second
    #define pb push_back
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define MOD 1000000007
    #define pll pair<ll,ll>
constexpr ll INF = 1999999999999999997; 
    #define fastio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
    int main() {
        fastio;

        int n;
        cin>>n;
        ll a[n];
        ll pre[n];
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            if(i!=0)
                pre[i]=pre[i-1]+a[i];
            else
                pre[i]=a[i];
            
        }
        ll ans=0;
        for(int i=0;i<n-1;i++)
        { 
             ans=ans%MOD+((pre[n-1]-pre[i])%MOD*(a[i]%MOD))%MOD;
             ans%=MOD;
        } 
        cout<<ans<<endl;
    }

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

using namespace std;

const int MAX_N = 205;

int color [MAX_N];
int dist [MAX_N][MAX_N];
vector<int> adj [MAX_N];

void dfs (int u, int c, bool &fuck) {
  color[u] = c;
  for (int nxt : adj[u]) {
    if (color[nxt] == 0) {
      dfs(nxt, -c, fuck);
    } else if (color[nxt] == c) {
      fuck = true;
    }
  }
}

int main () {
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      char c;
      cin >> c;
      dist[i][j] = c - '0';
      if (i == j) {
        dist[i][j] = 0;
      } else if (dist[i][j] == 0) {
        dist[i][j] = MAX_N;
      } else {
        dist[i][j] = 1;
        adj[i].push_back(j);
        adj[j].push_back(i);
      }
    }
  }

  bool fuck = false;
  dfs(0, 1, fuck);
  if (fuck) {
    cout << -1 << endl;
    return 0;
  }
  
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      ans = max(ans, dist[i][j]);
    }
  }

  cout << ans + 1 << endl;
}


Measured memory_bytes: 896
import java.io.*;

class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	try {
            String line = br.readLine();
            String[] strAry = line.split(" ");
            int a = Integer.parseInt(strAry[0]);
            int b = Integer.parseInt(strAry[1]);
            if(a < b){
            	System.out.println("a < b");
            }else if(a > b){
            	System.out.println("a > b");
            }else if(a == b){
            	System.out.println("a == b");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 24140
def dfs(cur):
    visited[cur] = 1
    for nx in range(n):
        if G[cur][nx] == 0:
            continue
        if visited[nx]:
            continue
        dfs(nx)


n, m = map(int, input().split())
G = [[0]*n for _ in range(n)]
ab = []
for i in range(m):
    a, b = map(int, input().split())
    ab.append((a-1, b-1))
    G[a-1][b-1] = G[b-1][a-1] = 1
ans = 0
for a, b in ab:
    G[a][b] = G[b][a] = 0
    visited = [0]*n
    dfs(0)
    if not all(visited):
        ans += 1
    G[a][b] = G[b][a] = 1

print(ans)

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

using namespace std;

int main(void)
{
  char m1, m2;
  for(int i = 0; i < 5; i++){
    char temp;
    cin >> temp;
  }
  cin >> m1;
  cin >> m2;
  int temp;
  cin >> temp;
  if(m1 == '1'){
    cout << "TBD" << endl;
    return 0;
  }
  if(m2 == '1' || m2 == '2' || m2 == '3' || m2 == '4'){
    cout << "Heisei" << endl;
  }else{
    cout << "TBD" << endl;
  }
  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int p[100];
int c[100];

int main()
{
	int D, G, ans = 100000000;
	int FLAG = 0, DMAX;

	cin >> D >> G;
	rep(i, D) cin >> p[i] >> c[i];

	DMAX = (1 << D) - 1;

	while (FLAG <= DMAX) {
		bool sel[10] = { false, false, false, false, false, false, false, false, false, false };
		int cost = 0;
		int score = 0;
		int SHIFT = 0;
		int rem;
		rep(i, D) {
			if (((FLAG >> SHIFT) & 1) == 1) {
				sel[i] = true;
				cost += p[i];
				score += 100 * (i + 1) * p[i] + c[i];
			}
			SHIFT++;
		}

		rem = G - score;

		rrep(i, D) {
			int point;
			if (rem <= 0) break;
			if (sel[i]) continue;

			point = 100 * (i + 1);

			if ((rem + point - 1) / point > p[i]) cost = 100000000;
			else cost += (rem + point - 1) / point;

			break;
		}

		ans = min(ans, cost);

		FLAG++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
use std::io::{Read, stdin};
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let k: i64 = read();
    let mut v: Vec<[i64; 2]> = vec![[0; 2]; n];
    for i in 0..n {
        v[i][0] = read();
        v[i][1] = read();
    }
    v.sort();
    let mut cnt = 0;
    let mut idx = 0;
    for i in 0..n {
        cnt += v[i][1];
        if cnt >= k {
            idx = i;
            break;
        }
    }
    println!("{}", v[idx][0]);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

Measured memory_bytes: 6396
#include<stdio.h>
int main(void)
{
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }
    else if(a>b){
        printf("a > b\n");
    }
    else{
        printf("a == b\n");
    }
    return 0;
}

Measured memory_bytes: 580
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - Bugged
            int n = int.Parse(Console.ReadLine());
            var s = ReadLines(n);
            int sum = s.Sum();

            //得点の小さい順にソート
            s = s.OrderBy(x => x).ToList();

            if (sum % 10 != 0)
            {
                Console.WriteLine(sum);
            }
            else
            {
                foreach(var si in s)
                {
                    if (si % 10 != 0)
                    {
                        Console.WriteLine(sum - si);
                        return;
                    }
                }

                Console.WriteLine(0);
            }
        }

        static List<int> ReadLines(int count = 0)
        {
            //[summary]コンソールの値を読み込む
            var lines = new List<int>();
            string s;

            //読み込む行数が未指定のときは、1行目の値を"count"とみなす
            if (count == 0)
            {
                s = Console.ReadLine().TrimEnd();
                count = int.Parse(s);
            }

            for (int i = 0; i < count; i++)
            {
                s = Console.ReadLine().TrimEnd();
                lines.Add(int.Parse(s));
            }

            return lines;
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int mod = 1e9 + 7;
int main() {
    int N;
    int T[100005];
    int A[100005];
    ll ans = 1;
    cin >> N;
    for (int i = 0; i < N; i++) cin >> T[i];
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) {
        if (i == 0 || T[i] > T[i - 1]) {
            if (A[i] < T[i]) ans = 0;
            continue;
        }
        if (i == N - 1 || A[i] > A[i + 1]) {
            if (A[i] > T[i]) ans = 0;
            continue;
        }
        (ans *= min(A[i], T[i])) %= mod;
    }
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 1024
use proconio::input;

fn main() {
	input!(n: usize);
	input!(ta: [(usize, usize); n]);

//	let mut ta = ta;
	let mut num = (ta[0].0, ta[0].1);
	for i in 1..n {
		if num.0 > ta[i].0 || num.1 > ta[i].1 {
			let t1 = (num.0 - 1) / ta[i].0 + 1;
			let t2 = (num.1 - 1) / ta[i].1 + 1;
			if t1 < t2 {
				num.0 = ta[i].0 * t2;
				num.1 = ta[i].1 * t2;
			}
			else {
				num.0 = ta[i].0 * t1;
				num.1 = ta[i].1 * t1;
			}
		}
		else {
			num.0 = ta[i].0;
			num.1 = ta[i].1;
		}
	}
	println!("{}", num.0 + num.1);
}



Measured memory_bytes: 2168
a,b = map(int, input().split())

p = []
for i in range(10, 2000):
  if int(i*0.08) == a:
    if int(i*0.1) == b:
      p.append(i)

if len(p) == 0:
  print(-1)
else:
  print(p[0])

Measured memory_bytes: 3060
#!/usr/bin/env python3
n,s = map(int,input().split())
a = list(map(int,input().split()))
dp = [[0]*(3001) for _ in range(3001)]
# dp[i][j] は i 番目までを使った時に、どれだけの組み合わせがあり、かける必要があるか？
ans = 0
mod = 998244353
for i in range(n):
    dp[i][a[i]] = i+1
    if a[i] == s:
        ans += (i+1)*(n-i) %mod
for i in range(0,n):
    for j in range(s+1):
        if j > a[i]:
            dp[i][j] += dp[i-1][j] + dp[i-1][j-a[i]]
            dp[i][j] %= mod
            if j == s:
                ans += dp[i-1][j-a[i]] * (n-i)
                ans %= mod
                #print(ans,i,j)
        else:
            dp[i][j] += dp[i-1][j]
            dp[i][j] %= mod
print(ans%mod)




Measured memory_bytes: 114524
def main():
    s = input().rstrip()
    cnt = [0, 0, 0]
    for c in s:
        if c == "a":
            cnt[0] += 1
        if c == "b":
            cnt[1] += 1
        if c == "c":
            cnt[2] += 1
    cnt.sort()
    if cnt[2] - cnt[0] <= 1:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define forn(i,e)   for(int i=0;i<e;i++)
typedef long long int ll;
typedef vector<long long int> v64;
typedef pair<long long int,long long int> p64;
typedef long double ld;

int main()
{
    ll i,j,k,m,n;
    cin>>n;
    ld p[n+5];
    forn(i,n)
        cin>>p[i+1];
    ld dp[n+5][n+5];
    for(i=0;i<=n;i++)
        for(j=0;j<=n;j++)
            dp[i][j]=0.0;
    for(i=1;i<=n;i++)
    {
        for(j=0;j<=i;j++)
        {
            if(i==1)
            {
                if(j==0)
                    dp[i][j]=1.0-p[i];
                else
                    dp[i][j]=p[i];
            }
            else if(j==0)
            {
                dp[i][j]=dp[i-1][j]*(1.0-p[i]);
            }
            else
            {
                dp[i][j]=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1.0-p[i]);
            }
        }
    }
    ld res=0.0;
    for(i=(n/2)+1;i<=n;i++)
    {
        res=res+dp[n][i];
    }
    cout<<setprecision(10)<<res<<"\n";
    return 0;
}

Measured memory_bytes: 144660
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        string input = Console.ReadLine();
        double half = input.Length/2;
        half = Math.Ceiling(half);
        int ans = 0;
        for (int i = 0; i < half; i++)
        {
            if (input[i] != input[input.Length - i - 1])
            {
                ans++;
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep2(i,start,end) for(ll i = start; i < end; ++i)
#define dwn(i,n) for(int i = n; i >= 0; --i)
#define dwn2(i,start,end) for(ll i = start; i >= end; --i)
#define pll pair<ll,ll>
#define mk(x,y) make_pair(x,y)
#define pdl pair<double, ll>
const ll N = 4e5 + 200;
const ll INF = 0x3f3f3f;
const ll mod = 1e9 + 7;


int main(){
	int n,k;
	cin>>n>>k;
	ll sum = 0;
	rep(i,n){
		ll x;
		cin>>x;
		if(x >= k) sum++;
	}
	cout<<sum<<endl;

	return 0;
}








Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
string s[1005];
int d[1005][1005];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m, cx, cy, dx, dy;
    cin >> n >> m >> cx >> cy >> dx >> dy;
    cx--;
    cy--;
    dx--;
    dy--;
    for(int i = 0; i < n; i++) {
        cin >> s[i];
    }
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            d[i][j] = 1e9;
        }
    }
    d[cx][cy] = 0;
    auto cango = [&](pair<int,int> now) -> vector<pair<int,int>> {
        vector<pair<int,int>> ret;
        int x = now.first;
        int y = now.second;
        for(int i = -2; i <= 2; i++) {
            for(int j = -2; j <= 2; j++) {
                if(i == 0 && j == 0) continue;
                int gox = x + i, goy = y + j;
                if(gox < 0 || gox >= n || goy < 0 || goy >= m) continue;
                if(s[gox][goy] == '#') continue;
                ret.push_back(make_pair(gox, goy));
            }
        }
        return ret;
    };
    priority_queue<pair<int, pair<int,int>>> pq;
    pq.push(make_pair(0, make_pair(cx, cy)));
    while(!pq.empty()) {
        pair<int,int> now = pq.top().second;
        pq.pop();
        auto go = cango(now);
        for(auto v : go) {
            int ad = 1;
            if(abs(v.first - now.first) + abs(v.second - now.second) == 1) ad = 0;
            if(d[v.first][v.second] > d[now.first][now.second] + ad) {
                d[v.first][v.second] = d[now.first][now.second] + ad;
                pq.push(make_pair(-d[v.first][v.second], make_pair(v.first, v.second)));
            }
        }
    }
    if(d[dx][dy] == 1e9) cout << -1;
    else cout << d[dx][dy];
    return 0;
}

Measured memory_bytes: 8796
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		final int h = 40;
		final int w = 100;

		System.out.println(h + " " + w);

		@SuppressWarnings("resource")
		Scanner stdin = new Scanner(System.in);

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

		for (int x = 0; x < w; x++) {
			System.out.print("#");
		}
		System.out.println();
		int count = 1;
		for (int y = 1; y < (h / 2); y++) {
			System.out.print("#");
			for (int x = 1; x < (w - 1); x++) {
				if ((count < a) && ((x + y) % 3 == 0)) {
					System.out.print(".");
					count++;
				}
				else {
					System.out.print("#");
				}
			}
			System.out.println("#");
		}

		for (int x = 0; x < w; x++) {
			System.out.print(".");
		}
		System.out.println();
		count = 1;
		for (int y = 1; y < (h / 2); y++) {
			System.out.print(".");
			for (int x = 1; x < (w - 1); x++) {
				if ((count < b) && ((x + y) % 3 == 0)) {
					System.out.print("#");
					count++;
				}
				else {
					System.out.print(".");
				}
			}
			System.out.println(".");
		}
	}
}


Measured memory_bytes: 23248
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int A,B,C,K;
    ll sum = 0;
    cin >> A >> B >> C >> K;

    if(A >= B and A >= C){
        for(int i = 0;i < K;i++)
            A *= 2;
    }else if(B >= A and B >= C){
        for(int i = 0;i < K;i++)
            B *= 2;
    }else if(C >= A and C >= B){
        for(int i = 0;i < K;i++)
            C *= 2;
    }

    sum = A + B + C;

    cout << sum << endl;

    

}

Measured memory_bytes: 3532
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
typedef long long ll;

#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define MIN(x, y)	(((x) < (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define REPI(x,y)	for (i=(x);i<(y);i++)
#define REPJ(x,y)	for (j=(x);i<(y);i++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

using namespace std;

string s, t;

int main() {
	cin >> s >> t;

	sort(s.begin(), s.end(), less<char>());
	sort(t.begin(), t.end(), greater<char>());
	
	cout << (s < t ? "Yes" : "No") << endl;
	
	return 0;
}


Measured memory_bytes: 256
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    D = II()
    C = LMIIS()
    S = []
    for i in range(D):
        S.append(LMIIS())
    
    T = [0]*D
    for i in range(D):
        max_sat = -1
        max_type = -1
        L = S[i]
        for j in range(26):
            if max_sat < L[j]:
                max_sat = L[j]
                max_type = j
        T[i] = max_type
    
    for t in T:
        print(t+1)
    

    
main()

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

bool mark[100005];
int res[100005];

bool isGood(int x)
{
    if(!mark[x] && !mark[(x + 1) >> 1])
        return 1;
    return 0;
}

int main()
{
    for(int i = 2; i * i <= 100000; i++)
        if(!mark[i])
            for(int j = i * i; j <= 100000; j += i)
                mark[j] = 1;
    mark[1] = 1;

    int q, l, r;

    for(int i = 1; i <= 100000; i++)
    {
        res[i] = res[i - 1];
        if(isGood(i))
            res[i]++;
    }

    cin>>q;
    while(q--)
    {
        scanf("%d %d", &l, &r);
        printf("%d\n", res[r] - res[l - 1]);
    }
    return 0;
}


Measured memory_bytes: 1152
use proconio::input;

fn main() {
    input! {
        n:i32,
    };

    
    let ans = match n%10 {
        2|4|5|7|9 => "hon",
        3 => "bon",
        _ => "pon",
    };

    println!("{}",ans);
    
    
    
}


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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
typedef long long ll;
typedef pair<int, int> pii;

const int N = 1e7 + 2;
int cnt[N];

int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int n;
    cin >> n;
    for(int i = 1 ; i < N ; i++)
        for(int j = i ; j < N ; j += i)
           cnt[j]++;

    ll ans = 0;
    range(i,1,n)ans += 1LL * i * cnt[i];
    cout << ans << endl;

    return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // 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))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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

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

signed main() {
  int N; cin >> N;
  map<int,int> map;
  bool ok = true;
  rep(i, N) {
    int A;
    cin >> A;
    if(map[A] >= 1){
      ok = false;
    };
    map[A]++;
  }
  
  if(ok){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  int maxval = 0;
  for(auto v : map){
    chmax(maxval,v.second);
  }

}

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

typedef long long ll;

int main() {

	ll S; cin >> S;

	ll x1, y1, x2, y2, x3, y3;

	x1 = 0; y1 = 0; x2 = 1000000000; y2 = 1;

	x3 = (x2 - S % x2) % x2;
	y3 = (S + x3) / x2;

	cout << x1 << ' ' << y1 << endl;
	cout << x2 << ' ' << y2 << endl;
	cout << x3 << ' ' << y3 << endl;

	return 0;
}


Measured memory_bytes: 256
/*By Mohan Abhyas V*/
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>  
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 1e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())

ll mpow(ll a, ll b){
	if(b >= (MOD-1)) b %= (MOD-1);
	if(b==0) return 1;
	ll t1 = mpow(a,b/2);
	t1 *= t1;
	t1 %= MOD;
	if(b%2) t1 *= a;
	t1 %= MOD;
	return t1;
}

ll mpow(ll a, ll b, ll p){
	if(b==0) return 1;
	ll t1 = mpow(a,b/2,p);   t1 *= t1;
	t1 %= p;
	if(b%2) t1 *= a;
	t1 %= p;
	return t1;
}
ll modinverse(ll a, ll m){
	ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) return 0; 
    while (a > 1){
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    }
    if (x < 0) x += m0; 
    return x; 
}
ll range(ll l, ll r){
	return l + rand()%(r-l+1);
}

p64 hashFn(v64 vc)
{
    ll p1 = 31, p2 = 97;
    ll m1 = 1e9+9, m2 = 998244353;
    ll hsv1 = 0, hsv2 = 0, p_pow1 = 1, p_pow2 = 1;
    forn(i, vc.size())
    {
        hsv1 = ((hsv1 + vc[i] + 1) * p_pow1) % m1;
        p_pow1 = (p_pow1 * p1) % m1;

        hsv2 = ((hsv2 + vc[i] + 1) * p_pow2) % m2;
        p_pow2 = (p_pow2 * p2) % m2;
    }
    return mp(hsv1, hsv2);
}
     
void solve(){
    ll n;
    cin>>n;
    v64 ar(n);
    map<ll, ll> pm;
    forn(i, n)
    {
        cin>>ar[i];
        if(pm.count(ar[i]))
            pm[ar[i]]++;
        else
            pm[ar[i]] = 1;
    }
    ll ans = 0;
    for(it : pm)
    {
        ans += (it.se*(it.se-1))/2;
    }
    forn(i, n)
    {
        ll temp = ans;
        ll t = pm[ar[i]];
        temp -= (t*(t-1))/2;
        temp += ((t-1)*(t-2))/2;
        cout<<temp<<ln;
    }
}
 
int main()
{
	fast_cin();
    ll t=1;
    //cin>>t;
    forn(i,t) {
    	// cout << "Case #" << i+1 << ": ";
    	solve();
    }
    return 0;
}

/*
1) try dp
2) meet in the middle
3) correct complexity analysis
4) randomized algorithm
5) brute force

*/

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

using namespace std;

using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
ll gcd(ll x, ll y) {
    return x ? gcd(y % x, x) : y;
}

ll lcm(ll x, ll y) {
    return x * y / gcd(x, y);
}
int main() {
    ll n, m, i, j, k;
    ll a ,b;
    cin >> a>> b;
    cout << lcm(a,b) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
	int a,b,x;
	cin>>a>>b>>x;
	if(x>=a&&x<=a+b)cout<<"YES";
	else cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]

def resolve():
    int1 = lambda x: int(x) - 1
    readline=sys.stdin.readline

    n,m=map(int, readline().strip().split())

    uf = UnionFind(n)

    tb=[0]*n

    for i in range(m):
        a,b=map(int1, readline().strip().split())
        uf.Unite(a,b)

    for i in range(n):
        tb[uf.Find_Root(i)]+=1
    print(max(tb))
if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Measured memory_bytes: 23408
s=list(map(int,input().split()))
t=[list(map(int,input().split())) for i in range(s[1])]
a=0
b=100001
for i in range(s[1]):
  if a<t[i][0]:
    a=t[i][0]
  if b>t[i][1]:
    b=t[i][1]
if b-a>=0:
  print(b-a+1)
else:
  print(0)

Measured memory_bytes: 27336
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9+5;
const int mod = 998244353;

vector<int> fac(300001); //n!(mod M)
vector<int> ifac(300001); //k!^{M-2} (mod M)

long long fpow(long long a,long long n){
  long long ret=1;
  if(n==1) return a;
  if(n%2==0) {
      ret = fpow(a*a%mod, n/2) %mod ;
  }else {
      ret = (a%mod)*fpow(a*a%mod, n/2) %mod;
  }
  return ret %mod;
}
int comb(int a, int b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    int tmp = ifac[a-b]* ifac[b] % mod;
    return tmp * fac[a] % mod;
}

int dp[3002][3002];
signed main(){
    int n;
    cin >> n;
    int ans = n%10;
    if(ans == 2 ||ans == 4 ||ans == 5 ||ans == 7 ||ans == 9)    cout << "hon" << endl;
    if(ans == 0 ||ans == 1 ||ans == 6 ||ans == 8)    cout << "pon" << endl;
    if(ans == 3)    cout << "bon" << endl;

    return 0;
}



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

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

    vector<long long> A(N + 2);
    A[0] = 0;
    A[N + 1] = 0;
    for (int i = 1; i < N + 1; i++) {
        cin >> A[i];
    }

    long long sum = 0;
    for (int i = 1; i < N + 2; i++) {
        sum += abs(A[i] - A[i - 1]);
    }

    for (int i = 1; i < N + 1; i++) {
        long long res = sum;
        if ((A[i - 1] <= A[i] && A[i] <= A[i + 1]) || (A[i - 1] >= A[i] && A[i] >= A[i + 1])) {
            cout << res << endl;
        }
        else {
            cout << res - min(abs(A[i - 1] - A[i]), abs(A[i] - A[i + 1])) * 2 << endl;
        }
    }
}

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

int main() {
  int a,b ;
cin >> a >> b;
if ( (a + b) % 2 == 0 ) {
  cout << (a + b) / 2 << endl;
}
else {
  cout << ( (a + b) /2 ) + 1 << endl;
}


return 0;
}

Measured memory_bytes: 3600
// inputに入力データ全体が入る
function Main(input) {
	var line = input.split("\n");
	var N = Number(line[0]);
	var tmp = line[1].split(" ");
	var A = [];

	var originalPrice = 0;

	var dist = function(a,b){
		return Math.abs(a-b);
	}

	for(var i = 0; i < N; i++){
		A[i] = Number(tmp[i]);
		if(i === 0){
			originalPrice += dist(0,A[0]);
		} else{
			originalPrice += dist(A[i-1],A[i]);
		}
	}
	originalPrice += dist(A[N-1],0);

	var ans = [];

	for(var j = 0; j < N; j++){
		if(j === 0){
			ans[j] = originalPrice - dist(0,A[0]) - dist(A[0],A[1]) + dist(0,A[1]);
		} else if(j === N-1){
			ans[j] = originalPrice - dist(A[N-2],A[N-1]) - dist(A[N-1],0) + dist(A[N-2],0);
		} else{
			ans[j] = originalPrice - dist(A[j-1],A[j]) - dist(A[j],A[j+1]) + dist(A[j-1],A[j+1]);
		}
	}

	console.log(ans.join("\n"));

}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  if(a.at(a.size()-1)==b.at(0)&&b.at(b.size()-1)==c.at(0))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 256