akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void){
    // Your code here!
    int i,j,kakeru;
    for(i=1;i<10;i++){
        for(j=1;j<10;j++){
            kakeru=i*j;
            printf("%dx%d=%d\n",i,j,kakeru);
        }
    }
    return 0;
}



Measured memory_bytes: 2112
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long int ll;
const ll INF = 1000000000000000000;


int main() {

	string s;
	cin >> s;

	bool alphabet[26];
	for (int i = 0; i < 26; ++i) alphabet[i] = false;
	for (int i = 0; i < s.size(); ++i) {
		alphabet[s[i] - 97] = true;
	}

	if (s.size() < 26) {
		for (int i = 0; i < 27; ++i) {
			if (alphabet[i] != true) {
				cout << s << char(97 + i) << endl;
				break;
			}
		}
	}
	else {
		if (s == "zyxwvutsrqponmlkjihgfedcba") cout << -1 << endl;
		else {
			for (int i = 25; 1 <= i; --i) {
				alphabet[s[i] - 97] = false;
				if (s[i] > s[i - 1]) {
					for (int j = s[i - 1] - 96; j < 26; ++j) {
						if (alphabet[j] != true) {
							s[i - 1] = char(97 + j);
							break;
						}
					}
					cout << s.substr(0, i - 1) << s[i - 1] << endl;
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>

using namespace std;

#define PI 3.14159265358979323846
#define INF 1e+9
#define DIV_NUM (1000000007)



int main() {

	string S, T;
	cin >> S >> T;
	int A, B;
	cin >> A >> B;
	string U;
	cin >> U;
	if (U == S) A--;
	if (U == T) B--;


	long long int N = 1000000000;
	vector<long long> ans;
	for (long long i = 0; i < N; i++) {
		if (i % 2 == 0) ans.push_back(i);
		else ans.pop_back();
	}

	A = A - ans.size();

	cout << A << " " << B << endl;

	return 0;
}


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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

typedef struct node{
	int self,left,right;
	node(){};
	node(int s, int l, int r):self(s),left(l),right(r){};
}node;

void printVector(vector<int> a){
	rep(i,a.size()) cout<<a[i]+1<<(i==a.size()-1?"":" ");
	cout<<endl;
}

vector<int> preorder, inorder, postorder;
vector<node> g;

void dfs(node x){
	// preorder.push_back(x.self);
	if(x.left>=0)dfs(g[x.left]);
	// inorder.push_back(x.self);
	if(x.right>=0)dfs(g[x.right]);
	postorder.push_back(x.self);
	return;
}

void solve(vector<int> pre, vector<int> in){
	int parent=pre[0];
	int pos=-1;
	rep(i,in.size())if(in[i]==parent)pos=i;
	vector<int> pre_left, pre_right, in_left, in_right;
	repi(i,1,pos+1)pre_left.push_back(pre[i]);
	repi(i,pos+1,pre.size())pre_right.push_back(pre[i]);
	repi(i,0,pos)in_left.push_back(in[i]);
	repi(i,pos+1,in.size())in_right.push_back(in[i]);

	g[parent]=node(parent,(pre_left.size()>0?pre_left[0]:-1),(pre_right.size()>0?pre_right[0]:-1));

	if(pre_left.size()>0) solve(pre_left, in_left);
	if(pre_right.size()>0) solve(pre_right,in_right);
}

int main()
{
	int n;
	cin>>n;
	g.resize(n);
	preorder.resize(n);
	inorder.resize(n);
	rep(i,n)cin>>preorder[i],preorder[i]--;;
	rep(i,n)cin>>inorder[i],inorder[i]--;

	solve(preorder,inorder);

	dfs(g[preorder[0]]);

	printVector(postorder);

	
	return 0;
}


Measured memory_bytes: 3168
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

typedef long long ll;

int N, K;
ll A[1000];
ll ruisekiwa[1001];
vector<ll> candidate;
vector<ll> tmp;

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++)cin >> A[i], ruisekiwa[i + 1] = ruisekiwa[i] + A[i];
	for (int i = 0; i < N; i++) {
		for (int j = i; j < N; j++)candidate.push_back(ruisekiwa[j + 1] - ruisekiwa[i]);
	}

	ll ans = 0;
	int cnt = 0;
	ll MSB = 0;
	ll M = (*max_element(candidate.begin(), candidate.end()));
	while ((1LL << MSB) <= M)MSB++;
	MSB--;

	for (; MSB >= 0; MSB--) {
		for (int i = 0; i < candidate.size(); i++) {
			if (candidate[i] & (1LL << MSB)) {
				cnt++;
				tmp.push_back(candidate[i]);
			}
		}
		if (cnt >= K) {
			ans += (1LL << MSB);
			candidate = tmp;
		}
		tmp.clear();
		cnt = 0;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6512
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 200000;

int n, tab[N], i;
LL sum, sum2, sum3, res;

int main() {
scanf("%d", &n);
sum = 0;
for (i=0;i<n;i++) {
	scanf("%d", &tab[i]);
	sum += tab[i];
}
sum2 = 0;
res = sum;
for (i=0;i<n;i++) {
	sum2 += tab[i];
	sum3 = sum - sum2;
	res = min(res, abs(sum2 - sum3));
}
printf("%lld\n", res);
return 0;
}

Measured memory_bytes: 1024
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()

    println(abc157a(n))
}

private fun abc157a(n: Int): Int {
    var ans = n / 2
    if (n % 2 != 0) ans++
    return ans
}

Measured memory_bytes: 29468
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		double a=sc.nextDouble();
		double b=sc.nextDouble();
		int h=sc.nextInt();
		int m=sc.nextInt();
		double ang=Math.abs(30*h-5.5*m);
		ang=ang*(Math.PI/180);
		System.out.println(Math.sqrt(a*a+b*b-2*a*b*Math.cos(ang)));
	}
}


Measured memory_bytes: 37492
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
template<typename T> inline void chkmin(T &a, const T &b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T &a, const T &b) { a = a > b ? a : b; }

const int MAXN = 1000005;
deque<int> que;
int f[MAXN], n;
char S[MAXN], T[MAXN];

int main() {
	scanf("%d%s%s", &n, S + 1, T + 1);
	if (S[1] != T[1]) return puts("-1"), 0;
	f[n + 1] = n + 1;
	int ans = 0, add = 0, pos = n + 1;
	for (int i = n; i > 0; i--) {
		if (T[i] == T[i + 1] && i >= f[i + 1]) { f[i] = f[i + 1]; continue; }
		for (--pos; pos > 0 && S[pos] != T[i];) --pos;
		if (!pos) return puts("-1"), 0;
		f[i] = pos;
		if (i >= f[i + 1]) {
			que.push_front(f[i + 1] - (--add) - 1);
			while (que.back() + add >= i) que.pop_back();
			que.push_back(i - add);
		} else {
			que.clear();
			if (pos < i) que.push_back(i - add);
		}
		chkmax(ans, (int)que.size());
	}
	printf("%d\n", ans);
	return 0;
}

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

int main(){ 
  int a, b;
  cin >> a >> b;
  if (b < a) swap(a,b);
  if (a == 1 && b == 2) cout << "3" << endl;
  else if (a == 2 && b == 3) cout << "1" << endl;
  else if (a == 1 && b == 3) cout << "2" << endl;
  return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	
	int A,B,C,D,E,F;
	cin>>A>>B>>C>>D>>E>>F;
	A=A*100;
	B=B*100;
	ll mz=A;
	ll so=0;
	FOR(i,1,F/A+2){
		FDS(j,F/B+1){
			FDS(k,F/C+1){
				FDS(m,F/D+1){
				    ll mizu=A*i+B*j;
					ll sio=C*k+D*m;
					if((mizu+sio)<=F){
						if((100+E)*sio<=E*(mizu+sio)){
							if(so*(mizu+sio)<=sio*(mz+so)){
							    mz=mizu;
							    so=sio;
							}
						}
					}
				}
			}
		}
	}
	FDS(i,F/A+1){
		FOR(j,1,F/B+2){
			FDS(k,F/C+1){
				FDS(m,F/D+1){
				    ll mizu=A*i+B*j;
					ll sio=C*k+D*m;
					if((mizu+sio)<=F){
						if((100+E)*sio<=E*(mizu+sio)){
							if(so*(mizu+sio)<=sio*(mz+so)){
							    mz=mizu;
							    so=sio;
							}
						}
					}
				}
			}
		}
	}
	cout<<mz+so<<' '<<so<<endl;
}


Measured memory_bytes: 256
h,w = map(int,input().split())
cost = []
for _ in range(10):
    c = list(map(int,input().split()))
    cost.append(c)
A = []
for _ in range(h):
    a = list(map(int,input().split()))
    A.append(a)
for k in range(10):
    for i in range(10):
        for j in range(10):
            cost[i][j] = min(cost[i][j],cost[i][k] + cost[k][j])
ans = 0
for a in A:
    for i in a:
        if i != -1:
            ans += cost[i][1]
print(ans)

Measured memory_bytes: 40284
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

#define MOD 1000000007

#define MAXN 1010
long long inv[MAXN + 1];//MODを法とする乗法の逆元
long long fact[MAXN + 1];//階乗
long long ifact[MAXN + 1];//階乗の逆元
void init() {
	inv[1] = 1;
	for (int i = 2; i <= MAXN; i++) inv[i] = inv[MOD%i] * (MOD - MOD / i) % MOD;
	fact[0] = ifact[0] = 1;
	for (int i = 1; i <= MAXN; i++) {
		fact[i] = i * fact[i - 1] % MOD;
		ifact[i] = ifact[i - 1] * inv[i] % MOD;
	}
}

long long calc(int n, int k){
	return fact[n + k - 1] * ifact[k] % MOD * ifact[n - 1] % MOD;
}


pair<int,int> f(int r, int y1,int y2) {
	if (y1 == y2) {
		return make_pair(1, 0);
	}
	else if (y1 < y2) {
		int c1 = y2 - y1;
		int c2 = (r - y2);
		if (c1 == c2) {
			return make_pair(2, c1);
		}
		else {
			return make_pair(1, min(c1, c2));
		}
	}
	else {
		int c1 = y1 - y2;
		int c2 = y2 + 1;
		if (c1 == c2) {
			return make_pair(2, c1);
		}
		else {
			return make_pair(1, min(c1, c2));
		}
	}
}

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

	int r, c, ai, aj, bi, bj;
	cin >> r >> c >> ai >> aj >> bi >> bj;

	auto p = f(r, ai, bi);
	auto q = f(c, aj, bj);

	init();
	int pattern = calc(p.second + 1, q.second) * p.first*q.first %MOD;
	cout << p.second + q.second << ' ' << pattern << endl;


	return 0;
}


Measured memory_bytes: 3232
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		 Scanner sc = new Scanner(System.in);
		 int N = sc.nextInt();
		 int count = 0;
		 for(int i=1; i<=N; i++) {
			 if((String.valueOf(i).length()) %2 == 1) {
				 count++;
			 }
		 }
		 System.out.println(count);
	}
}

Measured memory_bytes: 41592
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  print(n%1000 ? 1000-(n%1000) : 0);
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl

using namespace std;

template<typename S,typename T>auto&operator<<(auto&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(auto&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(auto&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(auto&o,map<K,T>&m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(auto&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){cout<<endl;}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<" ";ashow(a...);}
template<typename S,typename T,typename U>
struct TRI{S fi;T se;U th;TRI(){}TRI(S f,T s,U t):fi(f),se(s),th(t){}};
template<typename S,typename T,typename U>
auto& operator<<(auto& o,TRI<S,T,U>& t){return o<<"{"<<t.fi<<","<<t.se<<","<<t.th<<"}";}

typedef pair<int, int> P;
typedef pair<ll, ll> pll;
typedef TRI<int, int, int> tri;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<string> vs;

const int MAX_N = 100005;

int dp[MAX_N];
vector<int> G[MAX_N];

int dfs(int u, int p)
{
    int ch = 0, cri = 0;
    int res = 0;
    if(len(G[u]) == 1) return false;
    each(v, G[u]){
        if(v != p){
            ch++;
            cmx(res, dfs(v, u));
            if(dp[v]) dp[u] += dp[v], cri++;
        }
    }
    if(ch == 2 && cri == 1){
        if(res >= 1){
            return 2;
        }else{
            return 1;
        }
    }
    if(ch-1-cri >= 0){
        dp[u] += ch-1-cri;
        return 1;
    }else{
        return 0;
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,n-1){
        int a,b;
        cin >> a >> b;
        G[a].pb(b), G[b].pb(a);
    }
    if(n == 2){
        cout << "1\n";
        return 0;
    }
    rep(i,n){
        if(len(G[i]) > 1){
            int res = dfs(i, -1);
            cout << dp[i]+max(res-1,0) << "\n";
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 13824
#include<bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define MEM(x,a) memset((x),a,sizeof((x)))
#define F first
#define S second
#define imx INT_MAX
const long long MOD = (long long)(1e9+7);
const long long MMX = (long long)(1e18);
typedef long long LL;
typedef pair<int,int> pii;
int n,ls[30],mx1,mx2,x[370][30],c[30],ans[370],a,la,val;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=26;i++)scanf("%d",&c[i]),ls[i]=0;
    for(int i=1;i<=n;i++)
    {
        mx1=0,mx2=1;
        for(int j=1;j<=26;j++)
        {
            scanf("%d",&x[i][j]);
            int k=((i-ls[j])*c[j])+x[i][j];
            if(mx1<k)mx1=k,mx2=j;
            else if(mx1==k)if(ls[j]<ls[mx2])mx2=j;
        }
        //printf("[%d]",mx1);
        ls[mx2]=i;
        ans[i]=mx2;
    }
    for(int i=1;i<=n;i++)printf("%d\n",ans[i]);
}


Measured memory_bytes: 3816
import java.util.Scanner;

public class Main {

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

        String a = in.nextLine();

        if ("AAA".equals(a) || "BBB".equals(a)) {

            System.out.println("No");


        } else {
            System.out.println("Yes");
        }

    }
}

Measured memory_bytes: 21844
#!/usr/bin/env python3
# スペース区切りの整数の入力

from itertools import combinations_with_replacement as comb_rplc

# スペース区切りの整数の入力
N, M, Q = map(int, input().split())
#配列の入力
data = [list(map(int, input().split())) for _ in range(Q)]

ans = -1

for seq in comb_rplc(range(1, M+1), N):
    score = 0
    for a, b, c, d in data:
        if seq[b-1] - seq[a-1] == c:
            score += d
    
    ans = max(ans, score)

print(ans)


Measured memory_bytes: 9192
#include<iostream>
#include<cmath>

using namespace std;

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

    int da = abs(a - x), db = abs(b - x);

    if(da < db){
        cout << "A";
    }
    else{
        cout << "B";
    }
    cout << '\n';
}

Measured memory_bytes: 256
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [a, b] <- getIntList
    let ps = [n |n <- [(10*b)..(10*b+9)],  zei8 n == a]
    print $ if null ps then (-1) else head ps
    
zei8 n = (n * 8) `div` 100

Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int k,a,b,c=0;
  cin>>k;
  cin>>a>>b;
  for(int i=a;i<=b;i++)
  {if(i%k==0)
        c++;
   }
if(c>0)
    cout<<"OK"<<endl;
else
    cout<<"NG"<<endl;
}


Measured memory_bytes: 3580
// #pragma GCC optimize(2)
// #pragma G++ optimize(2)
// #pragma comment(linker,"/STACK:102400000,102400000")

#include <bits/stdc++.h>
using namespace std;

typedef long long int64;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef float fl;
typedef double dl;
typedef pair<int,int> pii;
#if (WIN32) || (WIN64) || (__WIN32) || (__WIN64) || (_WIN32) || (_WIN64) || (WINDOWS)
#define lld "%I64d"
#define llu "%I64u"
#else
#define lld "%lld"
#define llu "%llu"
#endif
#define uint(n) ((unsigned int)(n))
#define int64(n) ((long long)(n))
#define ull(n) ((unsigned long long)(n))
#define fl(n) ((float)(n))
#define dl(n) ((double)(n))
#define char(n) ((char)(n))
#define Bool(n) ((bool)(n))
#define fixpoint(n) fixed<<setprecision(n)

const int INF=1061109567;
const int NINF=-1044266559;
const int64 LINF=4557430888798830399;
const dl eps=1e-15;
#define MOD (1000000007)
#define PI (3.1415926535897932384626433832795028841971)

#define MP make_pair
#define MT make_tuple
#define All(a) (a).begin(),(a).end()
#define pall(a) (a).rbegin(),(a).rend()
#define Log(x,y) log(x)/log(y)
#define SZ(a) ((int)(a).size())
#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 repd(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define repd1(i,n) for(int i=((int)(n));i>=1;i--)
#define repv(itr,v) for(__typeof((v).begin()) itr=(v).begin();itr!=(v).end();itr++)
#define repV(i,v) for(auto i:v)
#define repE(i,v) for(auto &i:v)
#define MS(x,y) memset(x,y,sizeof(x))
#define MC(x) MS(x,0)
#define MINF(x) MS(x,63)
#define MCP(x,y) memcpy(x,y,sizeof(y))
#define UN(v) sort(All(v)),v.erase(unique(All(v)),v.end())
#define filein(x) freopen(x,"r",stdin)
#define fileout(x) freopen(x,"w",stdout)
#define fileio(x)\
	freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout)
#define filein2(filename,name) ifstream name(filename,ios::in)
#define fileout2(filename,name) ofstream name(filename,ios::out)
#define fileio2(filename,name) fstream name(filename,ios::in|ios::out)
#define sqr(x) ((x)*(x))
#define Pause system("pause")
#define Cls system("cls")
#define fs first
#define sc second
#define SF scanf
#define PF printf

const int maxn=INF;

int64 a,b,c,d,v[1000];

int main()
{
	cin>>a>>b>>c>>d;
	v[0]=a*c;
	v[1]=a*d;
	v[2]=b*c;
	v[3]=b*d;
	cout<<*max_element(v,v+4);

	return 0;
}

Measured memory_bytes: 3640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        if (C >= A && C <= B) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){ cin >> a[i];}
  int pre = -999;
  for(int i=0;i<n;i++){
    if (pre <= a[i]-1) {
      pre = a[i]-1;
    } else if (pre <= a[i]) {
      pre = a[i];
    } else {
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 640
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define  mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n,m;cin>>n>>m;
    vector<int>a(n),b(n);
    for(int i=0;i<n;i++)cin>>a[i]>>b[i];
    vector<int>c(m),d(m);
    for(int i=0;i<m;i++)cin>>c[i]>>d[i];
    for(int i=0;i<n;i++){
        int ax;
        int mimi=IINF;
        for(int j=0;j<m;j++){
            int sn=abs(c[j]-a[i])+abs(d[j]-b[i]);
            if(sn<mimi){
                mimi=sn;
                ax=j;
            }
        }
        cout<<ax+1<<endl;
    }
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------





Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

vvi E(222222);

template< typename G >
class DoublingLowestCommonAncestor {
public:
  const G &g;
  vector< int > depth;//depth[v]=根からvまでの距離
  const int LOG;
  vector< vector< int > > table;
 
  DoublingLowestCommonAncestor(const G &g) : g(g), depth(g.size()), LOG(32 - __builtin_clz(g.size())) {
    table.assign(LOG, vector< int >(g.size(), -1));
  }
 
  void dfs(int idx, int par, int d) {
    table[0][idx] = par;
    depth[idx] = d;
    for(auto &to : g[idx]) {
      if(to != par) dfs(to, idx, d + 1);
    }
  }
 
  void build(int v) {
    dfs(v, -1, 0);
    for(int k = 0; k + 1 < LOG; k++) {
      for(int i = 0,tablesize = table[k].size(); i < tablesize; i++) {
	if(table[k][i] == -1) table[k + 1][i] = -1;
	else table[k + 1][i] = table[k][table[k][i]];
      }
    }
  }
 
  int query(int u, int v) {
    if(depth[u] > depth[v]) swap(u, v);
    for(int i = LOG - 1; i >= 0; i--) {
      if(((depth[v] - depth[u]) >> i) & 1) v = table[i][v];
    }
    if(u == v) return u;
    for(int i = LOG - 1; i >= 0; i--) {
      if(table[i][u] != table[i][v]) {
	u = table[i][u];
	v = table[i][v];
      }
    }
    return table[0][u];
  }
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  for(int i=0;i<n;i++){
    ll p;cin>>p;
    for(int j=0;j<p;j++){
      ll a;cin>>a;
      E[a].pb(i);
      E[i].pb(a);
    }
  }
  DoublingLowestCommonAncestor<vvi> lca(E);
  lca.build(0);
  ll q;cin>>q;
  for(int i=0;i<q;i++){
    ll u,v;cin>>u>>v;
    cout<<lca.query(u,v)<<endl;
  }
  return 0;
}



Measured memory_bytes: 31212
<?php

function input() {
    return trim(fgets(STDIN));
}
function input_array() {
    return explode(' ', input());
}

$S = input();
switch (strlen($S)) {
    case 2:
        echo $S . "\n";
        break;
    case 3:
        echo strrev($S) . "\n";
        break;
    default:
        throw new Exception('Invalid String Length');
}

Measured memory_bytes: 4856
N = int(input())
A = list(map(int, input().split()))
A.append(0)
A =[0] + A
N += 2
S = 0
for i in range(N-1):
  S += abs(A[i+1] - A[i]) 

for i in range(1,N-1):
    ans = S - (abs(A[i-1] - A[i]) + abs(A[i] - A[i+1])) + abs(A[i-1] - A[i+1])
    print(ans)

Measured memory_bytes: 14040
// Starting with the name of Allah

#include <bits/stdc++.h>
#define ll long long
#define nl endl
#define Nayon ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b
#define v_sum(a)         accumulate(a.begin(),a.end(),0)
#define v_max(a)         *max_element(a.begin(),a.end())
#define v_min(a)         *min_element(a.begin(),a.end())
#define v_uni(a)         a.erase(unique(a.begin(),a.end()),a.end())

using namespace std;




int main()
{
	Nayon;
	ll n,x=0,sum=0,i,j;
	cin>>n;
	ll a[n+1];
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	x=a[0];
	for(i=1;i<n;i++){
		if(a[i]<x){
			sum=sum+(x-a[i]);
		}
		else{
			x=a[i];
		}
	}
	cout<<sum<<nl;
}

//Happy Coding.........

Measured memory_bytes: 5208
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  std::vector<int> v(3);
  for(int i=0;i<3;i++)cin>>v[i];
  sort(v.begin(),v.end());
  if(v[0]==5&&v[1]==5&&v[2]==7)cout<<"YES";
  else cout<<"NO";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)

#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pi pair<ll,ll>
#define all(X) X.begin(),X.end()

// for pair comparison function(ascending order) use return (i1.ff < i2.ff);

/* string operations :
   str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
   str.substr (x) : returns a substring str[x],... end of string
   str.find(qtr) : returns the first occurenece of qtr in str */

const int M = (1<<20)+5;
const int md = 1e9+7;

ll pwr(ll a,ll n,ll m)
{
	ll p=1;
	while(n>0)
	{
		if(n%2==1)
			p=(p*a)%m;
		a=(a*a)%m;
		n=n/2;
	}
	return p;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll sm = 0,n,i;
	cin >> n;
	for(i=1;i<=n;++i)
	{
		if((i%3 != 0) && (i%5 != 0))
			sm += i;
	}

	cout << sm << "\n";
}

Measured memory_bytes: 3652
n,m,x,y = gets.split.map(&:to_i)
x_arr = gets.split.map(&:to_i)
y_arr = gets.split.map(&:to_i)

x_max = x_arr.max
y_min = y_arr.min

((x+1)..y).to_a.each do |v|
  if (x_max < v) && (v <= y_min)
    puts "No War"
    exit
  elsif (v==y) #&& !( (x_max < v) && (v <= y_min))
    puts "War"
  end
end


Measured memory_bytes: 1788
#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;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    ll ans = std::min(N, M / 2);
    N -= ans;
    M -= ans * 2;
    ans += M / 4;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <math.h>
#include <malloc.h>
#include <string.h>
#include<bits/stdc++.h>
#include <iostream>
#include<algorithm>
#include<list>
#include <functional>
#include <map>
#include <deque>
using namespace std;

#define pt(...) prllf(__VA_ARGS__)
#define sf(...) scanf(__VA_ARGS__)
#define fui(p,n,d) for(ll i = p;i <= n; i += d)
#define fut(p,n,d) for(ll t = p;t <= n; t += d)
#define fuj(p,n,d) for(ll j = p;j <= n; j += d)
#define fdi(n,p,d) for(ll i = n;i >= p; i -= d)
#define fdt(n,p,d) for(ll t = n;t >= p; t -= d)
#define fdj(n,p,d) for(ll j = n;j >= p; j -= d)
#define Conn(x,y) x##y
#define ToString(x) #x
#define ll long long
#define MOD 1000000007
#define p(a,b) pow((double)a, b)
#define me(a,b) memset(a,b,sizeof(a))
bool compare(ll a, ll b){return a>b;}

string s;

int main(){
    cin>>s;
    int a[2];
    me(a,0);
    fui(0,2,1){
        if(s[i] == 'A') a[0]++;
        else a[1]++;
    }
    if(a[0] == 2 || a[1] == 2) cout<<"Yes";
    else cout<<"No";

    return 0;
}



Measured memory_bytes: 256
from collections import deque
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))
A = -(1e9 + 5)
for i in range(N):
    x = i
    S = deque()
    s = 0
    while True:
        x = P[x] - 1
        S.append(C[x])
        s += C[x]
        if x == i:
            break
    l = len(S)
    a = 0
    for i in range(l):
        a += S[i]
        if i + 1 > K:
            break
        An = a
        if s > 0:
            An += s * ((K - i - 1) // l)
        A = max(A, An)
print(A)

Measured memory_bytes: 83004
import numpy as np
import collections

n, m = map(int,input().split())
a = np.array([0] + list(map(int, input().split())))
s = np.cumsum(a) % m
v = np.array(list(collections.Counter(s.tolist()).values()))
print(np.sum(v * (v-1) // 2))





Measured memory_bytes: 23636
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;



int main(){
    int64_t a,b,n ;
    cin >> a >> b >> n ;
    int64_t ans = 0 ;
    if (n < b)
    {
        ans = (a*n)/b ;
    }else
    {
        ans = (a*(b-1))/b ;
    }
    cout << ans << endl ;
    
}

Measured memory_bytes: 3592
//****************************//
/**********  main *************/
//****************************//
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i, n) for(i = 0; i < n; i++)
#define FOR(i, a, b) for(i = a; i < b; i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())

double pi = 3.141592653589793;

int gcd(int a, int b) {
    if(a % b == 0) {
        return (b);
    } else {
        return (gcd(b, a % b));
    }
}

int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n;
    ll tmp;
    ll sum;
    cin >> n;

    vector<ll> a(n);

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

    sum = 0;
    for(ll i = 1; i < n; i++) {
        if(a[i - 1] > a[i]) {
            sum = sum + (a[i - 1] - a[i]);
            a[i] = a[i - 1];
        }
    }

    std::cout << sum << endl;

    return 0;
}


Measured memory_bytes: 4780
# https://atcoder.jp/contests/dwacon6th-prelims/submissions/9426910


def solve():
    MOD = 10**9 + 7

    N = int(input())
    xs = list(map(int, input().split()))

    ds = []
    for i in range(N-1):
        d = xs[i+1] - xs[i]
        ds.append(d)

    nums = [1, 1]
    num = 1
    for i in range(2, N-1):
        num *= i
        num %= MOD
        nums.append(num)

    ms = [N-1]
    m = N-1
    for i in reversed(range(2, N-1)):
        m *= i
        m %= MOD
        ms.append(m)
    ms.reverse()
    ms.append(1)

    ks = []
    k = 0
    for num, m in zip(nums, ms):
        k += num*m % MOD
        k %= MOD
        ks.append(k)

    ans = 0
    for d, k in zip(ds, ks):
        ans += d*k % MOD
        ans %= MOD

    print(ans)

solve()


Measured memory_bytes: 23108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define endl "\n"
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
int main(){
   string s1,s[2]={};
   cin>>s1;
   ll n;
   cin>>n;bool b=0;
   rep(i,n){
       ll a;cin>>a;
       if(a==1)b=!b;
       else{
           ll f;cin>>f;string ss;cin>>ss;
           if(b){
               s[!(f-1)]+=ss;
           }else{
               s[(f-1)]+=ss;
           }
       }
   }
   if(!b){
       reverse(s[0].begin(), s[0].end());
       cout<<s[0]<<s1<<s[1]<<endl;
   }else{
       reverse(s[1].begin(), s[1].end());
       reverse(s1.begin(), s1.end());
       cout<<s[1]<<s1<<s[0]<<endl;
   }

}


Measured memory_bytes: 1088
from collections import defaultdict

mod = 10**9 + 7

n = int(input())
a = list(map(int, input().split()))

cnt = defaultdict(int)
for i in range(n):
    cnt[a[i]//2] += 1

ans = 1
for i, v in cnt.items():
    if v % 2 == 1 and i != 0:
        print(0)
        exit()
    else:
        ans *= v % mod

print(ans % mod)


Measured memory_bytes: 15076
from fractions import gcd

def lcm(m, n):
    return (m * n) // gcd(m, n)

def lcm_list(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x


N = int(input())
T = [int(input()) for _ in range(N)]
print(lcm_list(T))

Measured memory_bytes: 5048
n = int(input())
r = 1.08
num = int(n/r)
#print(num)
small = int(num*r)
large = int((num + 1) *r)
#print(small,large)

if(n == small):
  print(num)
elif(n == large):
  print(num + 1)
else:
  print(":(")

Measured memory_bytes: 38480
n,m,x=map(int,input().split())
a=list(map(int,input().split()))

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

tmpa,tmpb=0,0

for i in range(x):
    tmpa+=tmp[i]
for i in range(x,n+1):
    tmpb+=tmp[i]
print(min(tmpa,tmpb))


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

int main(){
  int A,B;
  string op;
  
  cin >> A >> op >> B;
  
  if(op == "+"){
    cout << A + B <<endl;
  }
  else if (op == "-"){
    cout << A - B << endl;
  }
}

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

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]);
            int m = int.Parse(str[1]);
            long[,] hako = new long[n,3];
            for(int i=0;i< n; i++)
            {
                str = Console.ReadLine().Split(' ');
                hako[i,0] = long.Parse(str[0]);
                hako[i, 1] = long.Parse(str[1]);
                hako[i, 2] = long.Parse(str[2]);
            }
            long[] cake = new long[n];
            long answer = 0;
            for(int i = 0; i < 8; i++)
            {
                for(int j=0;j< n; j++)
                {
                    int a = ((i & (1 << 0)) != 0)? 1 : -1;
                    int b = ((i & (1 << 1)) != 0) ? 1 : -1;
                    int c = ((i & (1 << 2)) != 0) ? 1 : -1;
                    cake[j] = a*hako[j, 0] + b*hako[j, 1] + c*hako[j, 2];
                }
                Array.Sort(cake);
                long answerhako = 0;
                for(int j=0;j< m; j++)
                {
                    answerhako += cake[n - j - 1];
                }
                answer = Math.Max(answer, answerhako);
            }
            Console.WriteLine(answer);        }
    }
}

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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  ans = (n/k)*(n/k)*(n/k);
  if(k%2==0){
    if(n%k>=k/2) ans += (n/k+1)*(n/k+1)*(n/k+1);
    else ans += (n/k)*(n/k)*(n/k);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.Map.Entry;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.nextInt();
            int[] A = in.nextIntArray(N);
            Map<Integer, Integer> map = new HashMap<>();
            Map<Integer, Long> a1 = new HashMap<>();
            Map<Integer, Long> a2 = new HashMap<>();
            for (int i = 0; i < N; i++) {
                map.put(A[i], map.getOrDefault(A[i], 0) + 1);
            }
            long sum = 0;
            for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
                int n = entry.getKey();
                long c = entry.getValue();
                long comb = c * (c - 1) / 2;
                a1.put(n, comb);
                sum += comb;
                a2.put(n, c > 1 ? (c - 1) * (c - 2) / 2 : 0);
            }
            for (int i = 0; i < N; i++) {
                out.println(sum - a1.get(A[i]) + a2.get(A[i]));
            }
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

    }
}



Measured memory_bytes: 93268
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
A = list(map(lambda x: int(x)-1, input().split()))
cities = [0]
c = 0
used = [False] * N
used[0] = True
while not used[A[c]]:
    used[A[c]] = True
    cities.append(A[c])
    c = A[c]
x = cities.index(A[c])
if K < x:
    print(cities[K] + 1)
else:
    K -= x
    K %= len(cities) - x
    print(cities[x + K] + 1)

Measured memory_bytes: 97448
// AOJ 2931 Parentheses Number
// 2018.3.13 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in() { // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void outs(char *s) { while (*s) pc(*s++); pc('\n'); }

int n;
int a[100005];
int q[100005], top;
char s[200010]; int sz;

int main()
{
	int i, p, id;

	n = in();
	for (i = 1; i <= n; i++) {
		p = in();
		if (a[p] > 0) goto NG;
		a[p] = i;
	}
	id = i = 1; while (top >= 0) {
		if (q[top] == id) top--, s[sz++] = ')', id++;
		else {
			if (i > n) break;
			s[sz++] = '(', q[++top] = a[i++];
		}
	}
	if (top == 0 && id == n+1) s[sz] = 0, outs(s);
	else {
NG:		outs(":(");
	}
	return 0;
}


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


using namespace std;


int main(void) {
    int H, W, K;

    cin >> H >> W >> K;

    vector<vector<char>> grid(H, vector<char>(W));
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            cin >> grid[i][j];
        }
    }

    int num_black = 0;
    for (auto row : grid) {
        for (auto ch : row) {
            num_black += ch == '#' ? 1 : 0;
        }
    }

    long long ans = 0;
    for (int bits_y = 0; bits_y < (1 << H); ++bits_y) {
        for (int bits_x = 0; bits_x < (1 << W); ++bits_x) {
            int black_left = num_black;
            for (int y = 0; y < H; y++) {
                for (int x = 0; x < W; x++) {
                    if ((bits_y >> y & 1) || (bits_x >> x & 1)){
                        if (grid[y][x] == '#') {
                            black_left--;
                        }
                    }
                }
            }
            if (black_left == K) {
                ++ans;
            }
        }
    }
    cout << ans << endl;
}


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

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ans = 0;
    rep(i,n){
        if((i + 1) % 2 == 1 && a[i] % 2 == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
s = input()
end = "ABC"
while True:
  if s == end:
    print("Yes")
    break
  s = s.replace("ABC", "X")
  if ("X" not in s) or ("A" in s) + ("B" in s) + ("C" in s) != 2:
    print("No")
    break

  for c in "ABC":
    if c not in s:
      s = s.replace("X", c)
      break


Measured memory_bytes: 5564
#include<bits/stdc++.h>
using namespace std;
typedef signed long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
//vvi(n, vector<int>(m, -1))
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(a) (a).begin(), (a).end()
#define out(x) cout << (x) << endl;

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	cin >> n;
  vi a(n), b(n);
  int avg;
  rep(i, n) {
    cin >> a[i];
  }
  b = a;
  sort(all(a));
  rep(i, n){
    if(b[i] < a[n/2]){
      out(a[n/2]);
    }
    else out(a[n/2-1]);
  }
  
}

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

using namespace std;

const int N = 100007;
int Deg[N], Q[N], head, tail, n, m, D[N];
vector<int> E[N];

int main() {
  int u, v, i;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    E[u].push_back(v);
    Deg[v]++;
  }
  for (i = 1; i <= n; i++) {
    if (!Deg[i]) {
      Q[++tail] = i;
    }
  }
  int r = 0;
  int x;
  while (head < tail) {
    x = Q[++head];
    r = max(r, D[x]);
    for (auto v : E[x]) {
      D[v] = max(D[v], 1 + D[x]);
      Deg[v]--;
      if (!Deg[v]) {
        Q[++tail] = v;
      }
    }
  }
  printf("%d\n", r);
  return 0;
}

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

int main()
{
  ll N; cin >> N;
  ll K; cin >> K;
  vector<ll> H(N);
  for (int i=0; i<N; i++){
    cin >> H[i];
  }
  sort(H.rbegin(),H.rend());

  ll ans = 0;
  for (int i=K; i<N; i++) {
    ans += H[i];
  }
  cout << ans << endl;

  return 0;
}


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

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

  int ans = 0;
  rep(i,n) {
    int a; cin >> a;
    if(a >= k) ans++;
  }
  cout << ans << '\n';
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<math.h>
int nDiv_Prime(int prime, long int N){
	int nDiv = 0;
	while(N % prime == 0){
		N /= prime;
		nDiv++;
	}
	return nDiv;
}
int main(){
	long int N;
	scanf("%ld", &N);
	long int Naux = N;
	int ans = 0, isPrime[1000001] = {};
	for(long int i = 2; i * i <= N; i++){
		if(isPrime[i] == 0){
			int nDiv = nDiv_Prime(i, N);
			ans += (int) (sqrt(2 * nDiv + 1.0 / 4) - 1.0 / 2);
			Naux /= powl(i, nDiv);
			for(int j = 1; i * j <= 1000000; j++)
				isPrime[i * j] = 1;
		}
	}
	ans += Naux > 1 ? 1 : 0;
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 6108
#include<stdio.h>

int max1(int a, int b) { return a > b ? a : b; }

int main(){
    int a,b,k,counter=0;
    int ans[1000]={0};
    scanf("%d %d %d",&a,&b,&k);
    for(int i=1;i<=max1(a,b);i++){
        if(a%i==0&&b%i==0){
            ans[counter++] = i;
        }
    }
    printf("%d\n",ans[counter-k]);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b == c || b + c == a || a + c == b) {
  	cout << "Yes" << "\n";
  }else {
  	cout << "No" << "\n";
  }
}

Measured memory_bytes: 256