akhauriyash/Code-Regression huggingface dataset:
N=int(input())
alist=list(map(int,input().split()))
#print(alist)

dic_a={}
for a in alist:
  if not a in dic_a:
    dic_a[a]=1
  else:
    dic_a[a]+=1
    
all_pair=0
for val in dic_a.values():
  all_pair+=val*(val-1)//2

#print(dic_a,all_pair)
for a in alist:
  answer=all_pair-dic_a[a]+1
  print(answer)

Measured memory_bytes: 25004
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

int main() {
	ll A,B;
	cin>>A>>B;
	if((A + B) % 2 == 1){
		cout<<"IMPOSSIBLE"<<endl;
		return 0;
	}
	ll ans = (A+B)/2;
	cout<<ans<<endl;
}

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

using namespace std;

void a()
{
    string s;
    cin >> s;
    int count = 0;
    for(auto e : s)
    {
        if(e == '1')
        {
            count++;
        }
    }
    cout << count << endl;
}

void b()
{

}

void c()
{

}

void d()
{

}

int main() {
    a();
    return 0;
}


Measured memory_bytes: 256
#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>;
#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())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
const ld EPS = 1e-12L;
const ld PI = 3.1415926535897932385L;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class S, class T>inline bool chmax(S &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class S, class T>inline bool chmin(S &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
template<typename T> inline void print(const T &x){ cout << x << endl; }
template<typename T> inline void print(const vector<T> &x){ rep(i, SZ(x)){ cout << x[i] << " \n"[i+1==SZ(x)]; } cout << flush; }
template<typename T> inline void print(const vector<T> &x, ll s, ll n){ repr(i, s, n){ cout << x[i] << " \n"[i+1==n]; } cout << flush; }
template<typename T> inline void printv(const vector<T> &x){ rep(i, SZ(x)){ cout << x[i] << "\n"; } cout << flush; }
template<typename T> inline void printv(const vector<T> &x, ll s, ll n){ repr(i, s, n){ cout << x[i] << "\n"; } cout << flush; }
template<typename T> inline void print(const vector<vector<T>> &x){ rep(i, SZ(x)){ rep(j, SZ(x[i])){ cout << x[i][j] << " \n"[j+1==SZ(x[i])]; } } cout << flush; }
template<typename T> inline void print(const vector<vector<T>> &x, ll s1, ll n1, ll s2, ll n2){ repr(i, s1, n1){ repr(j, s2, n2){ cout << x[i][j] << " \n"[j+1==n2]; } } cout << flush; }
template<typename T, size_t S> inline void print(const T (&x)[S], ll s = 0, ll n = S){ repr(i, s, n){ cout << x[i] << " \n"[i+1==n]; } cout << flush; }
inline void print(const char* x){ cout << x << endl; }
template<typename T, size_t S> inline void printv(const T (&x)[S], ll s = 0, ll n = S){ repr(i, s, n){ cout << x[i] << "\n"; } cout << flush; }
template<typename T, size_t S1, size_t S2> inline void print(const T (&x)[S1][S2], ll s1 = 0, ll n1 = S1, ll s2 = 0, ll n2 = S2){ repr(i, s1, n1){ repr(j, s2, n2){ cout << x[i][j] << " \n"[j+1==n2]; } } cout << flush; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
#pragma endregion

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll a, b, c;
    cin >> a >> b >> c;
    cout << (a+b+c>=22 ? "bust" : "win") << endl;
    return 0;
}


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


int main(){
    unsigned long long int n,a,b,ans=0;
    cin >> n >> a >> b;
    ans=b-a;
    if(ans%2==0){
        ans=(b-a)/2;
        }
    else{
        ans=min(b-1,n-a);
        ans=ans-(b-a-1)/2;
    }
    cout << ans << endl;

}

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

int main(){
  int N,M,X;
  cin>>N>>M>>X;
  
  vector<int> A(M);
  
  for(int i=0;i<M;i++){
    cin>>A.at(i);
  }
  
  int up=0;
  int down=0;
  
  for(int i=0;i<M;i++){
    if(A.at(i)>X){
      up++;
    }
    else{
      down++;
    }
  }
  
  cout<<min(up,down)<<endl;
}

      
    
    
    
  
  
    

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int A, B, C,X,i,j,k;
    int cnt = 0;

    scanf("%d %d %d %d", &A, &B, &C,&X);

    for (i = 0; i <= A;i++){
        for (j = 0; j <= B;j++){
            for (k = 0; k <= C;k++){
                if(500*i+100*j+50*k==X){
                    cnt++;
                }
            }
        }
    }
    printf("%d", cnt);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdio>
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  int A[n][m], b[m], out[n] = {};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      out[i] += A[i][j] * b[j];
    }
  }
  for (int i = 0; i < n; i++) {
    cout << out[i] << endl;
  }
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

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

	int N; cin >> N;
	vector<ll> A(N,0LL), B(N,0LL);
	rep (i, N){
		cin >> A[i] >> B[i];
	} // end rep

	ll res = 0LL;
	for (int i = N - 1; i >= 0; --i){
		ll curr = (B[i] - ((A[i] + res) % B[i])) % B[i];
		res += curr;
	} // end for

	cout << res << endl;

	return 0;
}

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

vector<int> par ; 

int root(int x) { //入力xの根を調べる
  if(par[x] ==x) return x ; 
  return par[x] = root(par[x]) ; 
}

void unite(int x , int y ) {//連結クエリの場合、xとyを連結
  int rx = root(x) ; 
  int ry = root(y) ; 
  
  if(rx == ry) return ; //もうすでに連結されてるよ〜？
  par[rx] = ry ;//まだ繋がってなかったよ！
}

bool same(int x , int y ){//入力x、yの根は同じかな？
  int rx = root(x) ; 
  int ry = root(y) ; 
  return rx == ry ; //同じならtrue
}

int main(){
  int N , M ; 
  cin >> N >> M ; 
  par.resize(N+1) ; 
  
  for(int i = 1 ; i <= N ; i++) par[i] = i ; //初期状態として頂点は全て自分自身が根
  
  for(int i = 0 ; i < M ; i++){
    int A , B ; 
    cin >> A >> B ; 
    unite(A,B) ; //連結クエリ
  }
  vector<int> cnt(N+1) ; 
  for(int i = 1 ; i <= N ; i++){
    cnt.at(root(i))++;
  }
  
  sort(cnt.begin(),cnt.end());
  reverse(cnt.begin(),cnt.end());
  
  cout << cnt.at(0)<< endl ; 
  
  return 0 ; 
}

Measured memory_bytes: 7928
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

int W[101];
int sum[101];

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

	int N; cin >> N;
	for (int i = 1; i <= N; i++) cin >> W[i];
	sum[0] = 0;
	for (int i = 1; i <= N; i++) sum[i] = sum[i - 1] + W[i];

	int ans = INF;
	for (int i = 1; i < N; i++) {
		int s1 = sum[i];
		int s2 = sum[N] - sum[i];
		ans = min(ans, abs(s1 - s2));
	}

	cout << ans << endl;

	return 0;
}

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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[][] d = new int[N][2];
        for (int i = 0; i < N; i++) {
            d[i][0] = sc.nextInt();
            d[i][1] = sc.nextInt();
        }
        Arrays.sort(d, (x, y) -> x[0] - y[0]);
        long ans = 0;
        for (int i = 0; i < N; i++) {
            if(d[i][1] <= M){
                M -= d[i][1];
                ans += (long)d[i][0] * d[i][1];
            }else {
                ans += (long)d[i][0] * M;
                M = 0;
            }
        }

        System.out.println(ans);
        sc.close();
    }

}


Measured memory_bytes: 92004
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H, W, K; cin >> H >> W >> K;
  vector<string> C(H);
  REP(i, H){
    cin >> C[i];
  }
  int ans = 0;
  REP(i, 1<<H){
    REP(j, 1<<W){
      vector<bool> h(H, true);
      vector<bool> w(W, true);
      int res = 0;
      REP(ii, H){
        if((i >> ii)&1) h[ii] = false;
      }
      REP(jj, W){
        if((j >> jj)&1) w[jj] = false;
      }
      REP(k, H){
        REP(l, W){
          if(C[k][l] == '#'){
            if(h[k] && w[l]) res++;
          }
        }
      }
      if(res == K) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3656
/**
 * Author RDP
 * 
**/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <bitset>
#include <iomanip>
#define endl '\n'
#define bp(x) __builtin_popcount(x)
#define zf(x) __builtin_clz(x)
#define zl(x) __builtin_ctz(x)
#define par(x) __bultin_parity(x)
#define FAST_IO ios::sync_with_stdio(0); std::cin.tie(0);
typedef long long ll;
using namespace std;

void test_case()
{
    FAST_IO
    int s, w;
    cin >> s >> w;
    if(w >= s)
    {
        cout << "unsafe" <<endl;
    }
    else 
    cout << "safe" <<endl;
    return ;
}
int main()
{
    FAST_IO
    test_case();
    return 0;
}

Measured memory_bytes: 3648
package main

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

var sc = bufio.NewScanner(os.Stdin)

func gets() string {
	sc.Scan()
	return sc.Text()
}

func toInt(value string) int {
	num, _ := strconv.Atoi(value)
	return num
}

func splitWithInt(value string) []int {
	vals := strings.Split(value, " ")
	nums := make([]int, len(vals))
	for index, elem := range vals {
		nums[index] = toInt(elem)
	}
	return nums
}

// C
func main() {
  var line []int
  var a, b int
  line = splitWithInt(gets())
  N, M := line[0], line[1]
  route := make([]int8, N)

  for i := 0; i < M; i++ {
    line = splitWithInt(gets())
    a, b = line[0], line[1]
    if a == 1 {
      route[b - 1] += 1
    } else if b == N {
      route[a - 1] += 1
    }
  }

  possible := false
  for _, r := range route {
    if r == 2 {
      possible = true
      break
    }
  }

  if possible {
    fmt.Println("POSSIBLE")
  } else {
    fmt.Println("IMPOSSIBLE")
  }
}


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

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

int n,m,sx,sy,gx,gy,cnt,idx[maxn*maxn],val[maxn*maxn];
bool vis[maxn*maxn];
vector<int> con[maxn*maxn]; 
string s[maxn];

void dfs(int x,int y)
{
	if(x<0 || y<0 || x >= n || y >= m || s[x][y] != '.' || idx[x*maxn+y])
		return;
	con[cnt].push_back(x*maxn+y);
	idx[x*maxn+y]=cnt;
	for(int i=0;i<4;i++)
		dfs(x+dx[i],y+dy[i]);
} 

inline void bfs()
{
	queue<int> q;
	memset(val,-1,sizeof(val));
	vis[idx[sx*maxn+sy]]=true;
	for(auto v : con[idx[sx*maxn+sy]])
	{
		val[v]=0;
		q.push(v);	
	}
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		if(u == gx*maxn+gy)
			return;
		for(int i=-2;i <= 2;i++)
			for(int j=-2;j <= 2;j++)
			{
				int x=u/maxn+i,y=u%maxn+j;
				if(x >= 0 && y >=0 && x<n && y<m && s[x][y] == '.' && !vis[idx[x*maxn+y]])
				{
					vis[idx[x*maxn+y]]=true;
					for(auto v : con[idx[x*maxn+y]])
					{
						val[v]=val[u]+1;
						q.push(v);
					}
				}
			}
	}
}

int main()
{ 
	scanf("%d%d%d%d%d%d",&n,&m,&sx,&sy,&gx,&gy);
	sx--,sy--,gx--,gy--;
	for(int i=0;i<n;i++)
		cin >> s[i];
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			if(!idx[i*maxn+j] && s[i][j] == '.')
			{
				cnt++;
				dfs(i,j);
			} 
	bfs();
	printf("%d\n",val[gx*maxn+gy]);
	return 0;
}  


Measured memory_bytes: 44532
N = int(input())

# N円で買える金額
X_low = 1
# N円で買えない金額
X_high = 50001


def can_buy(price):
    return int(price * 1.08) <= N


while X_high - X_low > 1:
    x = int(X_high + X_low) // 2
    if can_buy(x):
        X_low = x
    else:
        X_high = x

if int(X_low * 1.08) == N:
    print(X_low)
else:
    print(":(")


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

main(){
  int n;
  cin >> n;
  string in;
  int data[38][38];
  string kang[38];
  for(int i=0;i<26;i++){
    string tmp = "a";
    kang[i] = tmp[0] + i;
  }
  kang[26] = "ld";
  kang[27] = "mb";
  kang[28] = "mp";
  kang[29] = "nc";
  kang[30] = "nd";
  kang[31] = "ng";
  kang[32] = "nt";
  kang[33] = "nw";
  kang[34] = "ps";
  kang[35] = "qu";
  kang[36] = "cw";
  kang[37] = "ts";
  fill(data[0], data[38], 0);
  while(cin >> in){
    int a = -1;
    int p = 0;
    for(;;){
      int b = -1;
      for(int i=37;i>=0;i--){
        if((int)in.size()-p >= kang[i].size()){
          if(kang[i] == in.substr(p, kang[i].size())){
            b = i;
            p += kang[i].size();
            break;
          }
        }
      }
      if(b == -1) break;
      
      if(a != -1) data[a][b]++;
      a = b;
    }
  }
  for(int i=0;i<38;i++){
    cout << kang[i];
    int valM = -1;
    int idx;
    for(int j=0;j<38;j++){
      if(valM < data[i][j]){
        valM = data[i][j];
        idx = j;
      }
    }
    cout << ' ' << kang[idx] << ' ' << valM << endl;
  }
}

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

typedef vector<int> vec;
typedef vector<string> word;

class Union_find
{
    public :
        vector<int> par;
        vector<int> rank;
        vector<int> cost;

        Union_find (int n) {
            par.resize(n);
            rank.resize(n);
            cost.resize(n);

            for (int i = 0; i < n; i++) {
                par[i] = i;
                rank[i] = 0;
                cost[i] = 0;
            }
        }

        int find (int);
        void unite (int, int);
        bool same (int, int);
};

int Union_find::find (int x) {
    if (par[x] == x) {
        return x;
    } else {
        return par[x] = find(par[x]);
    }
}

void Union_find::unite (int x, int y) {
    x = find(x);
    y = find(y);
    cost[y] = cost[x] = min(cost[x], cost[y]);

    if (rank[x] < rank[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (rank[x] == rank[y]) rank[x]++;
    }
}

bool Union_find::same (int x, int y) {
    return find(x) == find(y);
}

int main() {
    int N, M;
    cin >> N;
    map<string,int> item_to_num;
    Union_find item(N);
    for(int i = 0; i < N; i++) {
        string str;
        int cost_;
        cin >> str >> cost_;
        item_to_num[str] = i;
        item.cost[i] = cost_;
    }
    cin >> M;
    for(int i = 0; i < M; i++) {
        string s, t;
        cin >> s >> t;
        item.unite(item_to_num[s], item_to_num[t]);
    }
    int sum = 0;
    for(int i = 0; i < N; i++) {
        sum += item.cost[item.find(i)];
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 1848
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  long[] a = new long[5];
  Arrays.fill(a,0);
  for(int i = 0;i < N;i++){
    String s = sc.next();
    if(s.charAt(0) == 'M')a[0]++;
    if(s.charAt(0) == 'A')a[1]++;
    if(s.charAt(0) == 'R')a[2]++;
    if(s.charAt(0) == 'C')a[3]++;
    if(s.charAt(0) == 'H')a[4]++;
  }
  System.out.println(a[0]*a[1]*a[2]+a[1]*a[2]*a[3]+a[2]*a[3]*a[4]+a[3]*a[4]*a[0]+a[4]*a[0]*a[1]+a[0]*a[1]*a[3]+a[1]*a[2]*a[4]+a[2]*a[3]*a[0]+a[3]*a[4]*a[1]+a[4]*a[0]*a[2]);
}}


Measured memory_bytes: 46284
#include<stdio.h>
#include<string.h>
const int N = 1300;
const int M = 256;
int main()
{
	char str1[N], str2[N];
	int ary [M] = {0};
	while(fgets(str1, 1300, stdin))
	{
		int s1 = strlen(str1)-1, go = 0;
		for(int i = s1, j = 0; i < s1*2; i++,j++)
		{
			str1[i] = str1[j];
		}
		fgets(str2, 1300, stdin);
		for(int i = 0; i < strlen(str1);i++)
		{
			int k = 0;
			for(int j = 0; j < strlen(str2)-1; j++)
			{
				if(str1[i+j] == str2[j])
				{
					k++;
				}
				else
				{
					break;
				}
			}
			if(k == strlen(str2)-1)
			{
				go = 1;
				break;
			}
		}
		if(go)
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
	}
	return 0;
}


Measured memory_bytes: 2624
N = int(input())

if N%10==2 or N%10==4 or N%10==5 or N%10==7 or N%10==9:
    print('hon')
elif N%10==0 or N%10==1 or N%10==6 or N%10==8:
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9180
#include <stdio.h>
int main(){
  long n,total=0;
  scanf("%ld",&n);
  for(int i=1;i<(n+1);i++){
    if((i%3!=0)&&(i%5!=0)){
      total+=i;
    }
  }
  printf("%ld",total);
  return 0;
}
    

Measured memory_bytes: 1708
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
ll num;
ll read()
{
    ll s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
int main()
{
    string s;cin>>s;
    ll ans=0;
    int p=0;
    s='0'+s;
    for(int i=s.size()-1;i>=0;i--)
    {
        int num=s[i]-'0';
        //ans+=min(s[i]-'0',9-(s[i]-'0')+1);
        if(num+p<10-num-p||(num+p==10-num-p&&s[i-1]<'5'))
        {
            ans+=num+p;
            p=0;
        }
        else
        {
            ans+=10-num-p;
            p=1;
        }
    }
    cout<<ans+p<<endl;
    return 0;
}


Measured memory_bytes: 2308
n=int(input())
a=list(map(int,input().split()))
x={}
edge=[0]*2
for i in a:
  if i in x:
    x[i]+=1
    if x[i]==2:
      edge.append(i)
      x[i]=0
  else:
    x[i]=1
edge.sort(reverse=True)
print(edge[0]*edge[1])

Measured memory_bytes: 17960
import java.util.Scanner;

public class Main{
  public static void main(String ars[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    for(int i = b - a + 1;i <= b + a - 1;i++){
      System.out.print(i + " ");
    }
  }
}

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

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;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#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 yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

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

//topological
const ll MAX_N=1e5;
vector<bool> visited(MAX_N,false);
queue<ll> que;

ll cnt=0;
vvll to(MAX_N),from(MAX_N);
void dfs(ll v){
  if(visited[v])
    return;

  visited[v]=true;
  for(auto t:to[v])
    dfs(t);

  que.push(v);
  return;
}


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

  ll n,m;
  cin>>n>>m;
  vll a(n+m-1),b(n+m-1);
  REP(i,n-1+m){
    cin>>a[i]>>b[i];
    a[i]--;
    b[i]--;
    to[a[i]].push_back(b[i]);
    from[b[i]].push_back(a[i]);
  }

  ll rt;
  REP(i,n){
    if(from[i].size()==0)
      rt=i;
  }

  dfs(rt);
  vll tp(n);
  ll num=n;
  while(!que.empty()){
    ll t=que.front();
    que.pop();
    tp[t]=num;
    num--;
  }


  REP(i,n){
    ll m=0;
    ll par=0;
    for(auto f:from[i]){
      if(m<tp[f]){
        m=tp[f];
        par=f+1;
      }
    }
    cout<<par<<endl;
  }
}



Measured memory_bytes: 19712
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 998244353

int main() {

	ll n, k;
	cin >> n >> k;

	vector<ll> A(n, 0);
	ll sum = 0;

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

	vector<ll> fact;

	for (ll i = 1; i <= sqrt(sum); i++) {
		if (i*i == sum)
			fact.push_back(i);
		else if (sum%i == 0) {
			fact.push_back(i);
			fact.push_back(sum / i);
		}
	}

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

	vector<pair<ll, ll> > diff(n);
	bool flag = 0;
	ll res = 1;
	for (ll i = fact.size() - 1; i >= 0; i--) 
	{
		ll f = fact[i];
		for (ll j = 0; j < n; j++) {
			ll a = A[j] % f;
			diff[j] = { a,f - a };
		}
		sort(diff.begin(), diff.end());
		vector<ll> left(n, 0);
		for (ll j = 0; j < n; j++) {
			left[j] = (j - 1 >= 0 ? left[j - 1] : 0) + diff[j].first;
		}
		vector<ll> right(n, 0);
		for (ll j = n - 1; j >= 0; j--) {
			right[j] = (j + 1 < n ? right[j + 1] : 0) + diff[j].second;
		}
		for (ll j = 0; j < n - 1; j++) {
			if (left[j] == right[j + 1]) {
				if (left[j] <= k) {
					res = f;
					flag = 1;

					cout << f << endl;
					return 0;

					break;
				}
			}
		}
		if (flag) break;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#define ll long long
using namespace std;

int main() 
{
    ll a, b, c, d;
    bool ans;
    cin >> a >> b >> c >> d;
    while(1) {
        c -= b;
        if(c <= 0) {
            ans = true; break;
        }

        a -= d;
        if(a <= 0) {
            ans = false; break;
        }

    }

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

Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  ll n, s; cin >> n >> s;

  for (ll i=2; i*i<=n; i++) {
    ll tmp = 0, tmp_n = n;
    while(tmp_n!=0) { tmp+=tmp_n%i; tmp_n/=i; }
    if (tmp==s) {cout << i << endl; return 0;}
  }

  for (ll i=sqrt(n-s); i>=1; i--) {
    if ((n-s)%i==0&&i<=s&&s-i<=(n-s)/i) {cout << (n-s)/i+1 << endl; return 0;}
  }

  if (n==s) {cout << n+1 << endl; return 0;}

  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
// 20
/****************************************************
https://searleser97.gitlab.io/algorithms/template.cpp
****************************************************/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define forr(_, x, n) for (int _ = x; _ > n; _--)
#define fos(_, x, n, s) for (int _ = x; _ < n; _ += s)
#define forn(_, x, n) fos(_, x, n, 1)
#define rep(_, n) forn(_, 0, n)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define cerr(s) cerr << "\033[48;5;196m\033[38;5;15m" << s << "\033[0m"
// typedef __int128_t lli;
typedef long long int li;
typedef long double ld;
// 12
void _main(int tc) {
  string s;
  cin >> s;
  map<char, int> m;
  for (auto& c : s) {
    m[c]++;
  }

  for (auto& c : m) {
    if (c.second & 1) {
      cout << "No" << endl;
      return;
    }
  }
  cout << "Yes" << endl;

}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0); return 0;
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

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

using namespace std;

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

  int sz = s.size();
  int a = -1, b = -1;
  for (int i = 1; i < sz; i++) {
    if (s[i] == s[i - 1]) {
      a = i, b = i + 1;
    } else if (i + 1 < sz && s[i - 1] == s[i + 1]) {
      a = i, b = i + 2;
    }
  }

  cout << a << " " << b << endl;

  return 0;
}

Measured memory_bytes: 512
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
count = 0
for i in range(n):
    point = 0
    for j in range(m):
        point += b[j] * a[i][j]
    if point + c > 0:
        count += 1
print(count)
    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll      long long
#define ld      long double
#define pb      push_back
#define mp      make_pair
#define all(x)  x.begin(),x.end()
#define ff      first
#define ss      second
#define pi      acos(-1.0)
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	ll a,b;
	cin >> a >> b;
	cout << a-b+1 << endl;

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <functional>
#include <set>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(){
	int n, m, tmp;
	std::set<int> s;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

#if INPUT_FROM_FILE
	ifs >> n;
#else
	std::cin >> n;
#endif
	
	for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
		ifs >> tmp;
#else
		std::cin >> tmp;
#endif
		s.insert(tmp);
	}

#if INPUT_FROM_FILE
	ifs >> m;
#else
	std::cin >> m;
#endif
	
	for(int i = 0; i < m; i++){
#if INPUT_FROM_FILE
		ifs >> tmp;
#else
		std::cin >> tmp;
#endif
		s.insert(tmp);
	}

	for(std::set<int>::iterator it = s.begin(); it != s.end(); it++){
		std::cout << *it << std::endl;
	}
	return 0;
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

const ll INF = 1e15;
int n;
ll dp[5001][5001];
vi h, p;

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	REP(i, 5001)REP(j, 5001) dp[i][j] = INF;
	cin >> n;
	vector<tuple<int, int, int>> v;
	REP(i, n)
	{
		int a, b; cin >> a >> b;
		v.emplace_back(a + b, a, b);
	}
	sort(ALL(v));
	h.resize(n);
	p.resize(n);
	REP(i, n)
	{
		h[i] = get<1>(v[i]);
		p[i] = get<2>(v[i]);
	}
	dp[0][0] = 0;
	REP(i, n)REP(j, n)
	{
		chmin(dp[i + 1][j], dp[i][j]);
		if (h[i] >= dp[i][j]) chmin(dp[i + 1][j + 1], dp[i][j] + p[i]);
	}
	ll ans = 0;
	REP(i, 5001) if (dp[n][i] < INF) chmax(ans, ll(i));
	cout << ans << endl;

	return 0;
}

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

int main(){
  int ans = 0;
  string s;cin>>s;
  for (int i = 1; i < s.size(); i++) {
    if(s.at(i) != s.at(i-1))ans++;
  }
  cout << ans<< endl;
}

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

using namespace std;

int main(){
  unsigned long long H, W;
  cin >> H >> W;
  if(H==1){
    printf("1\n");
  }else if(W==1){
    printf("1\n");
  }else{
    printf("%llu\n", ((H * W) + 1) / 2);
  }
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ===============ワーシャルフロイド法==============
// warshall_floyd(隣接行列,INF(intでもllでも))
// i-jと,i-k-jルートを比較して短い方を採用していく
// 隣接行列が穴埋めされます
void warshall_floyd(vector<vector<ll>> &g, ll INF) {
  for (int k = 0; k < g.size(); k++) {
    for (int i = 0; i < g.size(); i++) {
      for (int j = 0; j < g.size(); j++) {
        if (g[i][k] == INF || g[k][j] == INF) continue;
        g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
      }
    }
  }
}

// ====================================================================

int main() {
  ll n, m, l;
  cin >> n >> m >> l;
  vector<vector<ll>> g(n, vector<ll>(n, INFL));
  for (int i = 0; i < m; i++) {
    int s, t, c;
    cin >> s >> t >> c;
    s--, t--;
    g[s][t] = g[t][s] = c;
  }

  warshall_floyd(g, INFL);

  vector<vector<ll>> g2(n, vector<ll>(n, INFL));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (g[i][j] <= l) g2[i][j] = 1;

  warshall_floyd(g2, INFL);

  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int s, t;
    cin >> s >> t;
    s--, t--;
    cout << ((g2[s][t] == INFL) ? -1ll : g2[s][t] - 1) << endl;
  }
}


Measured memory_bytes: 1920
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N = get_int
A = get_ints

max = A.map { |a| a - 1 }.sum
puts max


Measured memory_bytes: 14516
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
ll n;
int ans=0;
ll STOL(string s){
    ll ret=0;
    rep(i,0,s.size()){
        ret+=(s[s.size()-i-1]-'0')*pow(10,i);
    }
    return ret;
}

void dfs(string s,bool a,bool b,bool c){
    if(s.size()>9 || STOL(s)>n)return;
    if(STOL(s)<=n&&a&&b&&c)ans++;
    dfs(s+"3",1,b,c);
    dfs(s+"5",a,1,c);
    dfs(s+"7",a,b,1);
    return;
}
int main (){ 
    cin>>n;
    dfs("",0,0,0);
    cout<<ans<<endl;
    
}


/*
abcde


*/


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {	
		Scanner in = new Scanner(System.in);
		int x = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();
		System.out.println(Math.abs(x-a)<Math.abs(x-b)?"A":"B");
	}
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N;
  for(int i = 0; i < 47000; i++) {
    M = i * 1.08;
    if(M == N) {
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
}

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

int main(){
    int d,n;
    cin >> d >> n;
    if(d==0){
        if(n==100){
            cout << 101 << endl;
        }else{
            cout << n << endl;
        }
    }else if(d==1){
        if(n==100){
            cout << 10100 << endl;
        }else{
            cout << 100*n << endl;
        }
    }else{
        if(n==100){
            cout << 1010000 << endl;
        }else{
            cout << 10000*n << endl;
        }
    }
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"

using namespace std;

typedef long int li;
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pt;

#define fi first
#define se second
#define dump(x) cout << #x << " = " << x << endl
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

ll a, b, L, R, mid;

int main () {
    fastIO;
    cin >> a >> b;
    (((a+b)%2==1) ? cout << "IMPOSSIBLE" : cout << (a+b)/2);
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		String S = scanner.next();
		int K = scanner.nextInt();
		// N == S.length();
		char c_replace = S.charAt(K - 1);
		char[] ans = new char[N];
		for (int i = 0; i < N; i++) {
			if(S.charAt(i) == c_replace) {
				ans[i] = c_replace;
			}else {
				ans[i] = '*';
			}
		}
		for(char c: ans) {
			System.out.print(c);
		}
		scanner.close();
	}
}


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

#define int long long
#define vi vector <int>
#define endl "\n"
#define vvi vector <vector<int> >
#define vii vector <pair<int,int> >
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>=b;i--)
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define init(i,k) memset(i,k,sizeof i)
#define pb push_back
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
const int N=1e2+5 , MOD=1e9+7;

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


void solve()
{
    int n,w;
    cin >> n >> w;
    vi wei(n+1), v(n+1);
    int sumv=0;
    rep(i,1,n+1)
    {
    	cin >> wei[i] >> v[i];
    	sumv += v[i];
    }

    vvi dp(n+1,vi(sumv+1,-1));

    rep(i,0,n+1)
    dp[i][0] = 0;

    rep(i,1,n+1)
    {
    	rep(j,1,sumv+1)
    	{
    		if(j-v[i]>=0)
    		{
    			if(dp[i-1][j-v[i]]!=-1 && dp[i-1][j] !=-1)
    				dp[i][j] = min(dp[i-1][j], dp[i-1][j-v[i]]+wei[i]);
    			else if(dp[i-1][j-v[i]]==-1)
    				dp[i][j] = dp[i-1][j];
    			else if(dp[i-1][j]==-1 && dp[i-1][j-v[i]]!=-1)
    				dp[i][j] = dp[i-1][j-v[i]]+wei[i];
    		}
    		else
    			dp[i][j] = dp[i-1][j];
    	}
    }

    int ans=0;
    rep(j,0,sumv+1)
   	{
   		if(dp[n][j]>0 && dp[n][j]<=w)
   			ans = j;
   	}
   	cout << ans << endl;
}

signed main()
{
    speed;
    
 //    int t; cin >> t;
 //    rep(tt,1,t+1)
 //    {
	// cout <<"Case #"<<tt<<": ";
	solve();
 //    }
    return 0;
}

Measured memory_bytes: 80256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
)

var (
	rb     rdBuffer
	reader *bufio.Reader
	writer *bufio.Writer
)

func solve() {
	_, t := rb.nextInt(), rb.nextInt()
	a := rb.nextInts()

	x := t
	for i := 0; i < len(a)-1; i++ {
		x += _min(t, a[i+1]-a[i])
	}

	ans := strconv.Itoa(x)
	writer.WriteString(ans + "\n")
}

/* template functions */

func main() {
	solve()
	writer.Flush()
}

func init() {
	rb = rdBuffer{
		buf: make([]string, 0, 64),
		cur: 0,
	}
	reader = bufio.NewReader(os.Stdin)
	writer = bufio.NewWriter(os.Stdout)
}

type rdBuffer struct {
	buf []string
	cur int
}

func (r *rdBuffer) readln() {
	line, err := reader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	drop := 1
	if len(line) > 1 && line[len(line)-2] == '\r' {
		drop = 2
	}
	line = line[:len(line)-drop]

	r.cur = 0
	r.buf = strings.Split(line, " ")
}

func (r *rdBuffer) isFull() bool {
	if r.cur == len(r.buf) {
		return true
	}
	return false
}

func (r *rdBuffer) resetCur() {
	r.cur = 0
}

func (r *rdBuffer) next() string {
	if r.cur == 0 {
		r.readln()
	}
	res := r.buf[r.cur]
	r.cur++
	if r.isFull() {
		r.resetCur()
	}
	return res
}

func (r *rdBuffer) nexts() []string {
	r.readln()
	r.resetCur()
	return r.buf
}

func (r *rdBuffer) nextByte() byte {
	if r.cur == 0 {
		r.readln()
	}
	res := r.buf[r.cur][0]
	r.cur++
	if r.isFull() {
		r.resetCur()
	}
	return res
}

func (r *rdBuffer) nextInt() int {
	if r.cur == 0 {
		r.readln()
	}
	res, _ := strconv.Atoi(r.buf[r.cur])
	r.cur++
	if r.isFull() {
		r.resetCur()
	}
	return res
}

func (r *rdBuffer) nextInts() []int {
	r.readln()
	res := make([]int, len(r.buf))
	for i, _ := range r.buf {
		res[i], _ = strconv.Atoi(r.buf[i])
	}
	r.resetCur()
	return res
}

func (r *rdBuffer) nextFloat() float64 {
	if r.cur == 0 {
		r.readln()
	}
	res, _ := strconv.ParseFloat(r.buf[r.cur], 64)
	r.cur++
	if r.isFull() {
		r.resetCur()
	}
	return res
}

func (r *rdBuffer) nextFloats() []float64 {
	r.readln()
	res := make([]float64, len(r.buf))
	for i, _ := range r.buf {
		res[i], _ = strconv.ParseFloat(r.buf[i], 64)
	}
	r.resetCur()
	return res
}

func _max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

func _min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func _abs(x int) int {
	return int(math.Abs(float64(x)))
}

// Searchable
// idx := lower_bound([]int{-199, -1, 0, 2, 4, 67, 100, 8435}, 60)
// => idx = 5
//
// No present
// idx := lower_bound([]int{-199, -1, 0, 2, 4, 67, 100, 8435}, 10000)
// => idx = 8
func lower_bound(a []int, x int) int {
	return sort.SearchInts(a, x)
}

func dump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}

func Yes() {
	writer.WriteString("Yes\n")
}

func yes() {
	writer.WriteString("yes\n")
}

func No() {
	writer.WriteString("No\n")
}

func no() {
	writer.WriteString("no\n")
}


Measured memory_bytes: 11648
#include<iostream>
using namespace std;
int main() {
    int n=1;
    int j=0;
    if(n=1&&n<=200) {
        cin>>n;
    }
    int arr[n];
    for(int i=1; i<=n; i++) {
        if(i%2==1) {
            j++;
            arr[j]=i;
        }
    }
    int m=0;
    if(n=1&&n<=200) {
        for(int i=1; i<=j; i++) {
            int c=0;
            for(int k=1; k<=i; k++) {
                if(arr[i]%arr[k]==0) {
                    c++;
                }
            }
            if(c==8) {
                m++;
            }

        }

        cout<<m;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

    char[] S = scanner.next().toCharArray();
    int N = S.length;
    int[] ss = new int[N + 1];
    for (int i = 0; i < N; i++) ss[i] = S[i] - 'a';
    ss[N] = -1;
    int[] remaining = new int[N + 1];
    remaining[0] = (1 << 26) - 1;
    for (int i = 1; i < N + 1; i++) {
      remaining[i] = remaining[i - 1];
      remaining[i] ^= (1 << ss[i - 1]);
    }
    int j = N;
    int next = -1;
    while (j >= 0 && (next = lsb(remaining[j], ss[j])) < 0) j--;
    if (next < 0) {
      System.out.println(-1);
      return;
    }
    for (int i = 0; i < j; i++) System.out.print(S[i]);
    System.out.println((char) (next + 'a'));
  }

  private static int lsb(int n, int s) {
    s++;
    n >>= s;
    while (n > 0) {
      if (n % 2 != 0) return s;
      s++;
      n /= 2;
    }
    return -1;
  }
}


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

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

template <typename T>
inline void chkmax(T &x, T y) { if (x < y) x = y; }

template <typename T>
inline void chkmin(T &x, T y) { if (x > y) x = y; }

inline int read() {
  #define nc getchar()
  int x = 0;
  char c = nc;
  while (c < 48) c = nc;
  while (c > 47) x = (x << 3) + (x << 1) + (c ^ 48), c = nc;
  return x;
  #undef nc
}

typedef long long ll;
const int maxn = 3e5 + 10;
int n, a[maxn], cnt[maxn];

int main() {
  cin >> n;
  rep(i,1, n) a[i] = read(), cnt[a[i]]++;
  ll sum = 0;
  rep(i,1,n)sum+=1ll*cnt[i]*(cnt[i]-1)/2;
  rep(i,1,n){
    printf("%lld\n", sum-cnt[a[i]]+1);
  }
  return 0;
}

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

int main(){
    int d,n,t=1,ans=0;
    cin >> d >> n;
    for(int i=0;i<d;i++) t*=100;
    for(int i=0;i<n;i++){
        if((ans+t)%(t*100)==0) ans+=t+t;
        else ans+=t;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
	int H, R; cin >> H >> R;
	if (H + R > 0) { cout << 1 << endl; }
	else if (H + R == 0) { cout << 0 << endl; }
	else cout << -1 << endl;
	return 0;
}



Measured memory_bytes: 3112
// ALDS1_10_A: Fibonacci Number

use std::str::FromStr;

fn scan<T: FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let n = scan::<usize>();
    let mut f = vec![-1; 50];
    f[0] = 1;
    f[1] = 1;
    for i in 2..(n + 1) {
        f[i] = f[i - 1] + f[i - 2];
    }
    println!("{}", f[n]);
}


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

r1 = 0
r2 = 0
for i in range(m):
    if a[i] == x: continue
    if a[i] < x : r1 += 1
    if a[i] > x : r2 += 1

print(min(r1, r2))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string S;
    int K;
    cin >> S;
    cin >> K;
    int n = S.size();
    for (int i = 0; i < n; i++)
    {
        if (S[i] == 'a')
            continue;
        int x = 26 - (S[i] - 'a');
        if (K >= x)
        {
            S[i] = 'a';
            K -= x;
        }
    }
    S[n - 1] = (S[n - 1] - 'a' + K) % 26 + 'a';
    cout << S << endl;
}

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

int main(void)
{
	int S=0, a=0, b=0, c=0;
  	cin >> S;
    a = S/100;
	b = (S-a*100)/10;
	c = (S-a*100-b*10)/1;
  	cout << a+b+c << endl;
}

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

inline long long read(){
	long long s = 0, w = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9'){
		if (ch == '-') w = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9'){
		s = s * 10 + ch - '0';
		ch = getchar();
	}
	return s * w;
}

int main(){
	int a = read(), b = read(), c = read();
	int sum = a + b + c;
	if (sum < 22){
		cout << "win" << endl;
	}
	else{
		cout << "bust" << endl;
	}
	return 0;
}


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

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define pb push_back
#define ll long long
#define mp make_pair
#define F first
#define S second

int main(){
	string s;
	cin>>s;
	bool arr[26]={false};
	if(s.length()<26){
		for(int i=0; i<s.length(); i++){
			arr[s[i]-'a']=true;
		}
		for(int i=0; i<26; i++){
			if(!arr[i]){
				cout<<s+char(97+i)<<endl;
				break;
			}
		}
	}
	else{
		int alast=-1;
		int dlast=-1;
		for(int i=0; i<25; i++){
			if(s[i+1]>s[i]){
				alast=i;
			}
		}
		if(alast>=0){
			for(int i=0; i<alast; i++){
				cout<<s[i];
			}
			for(int i=25; i>alast; i--){
				if(s[i]>s[alast]){
					cout<<s[i]<<endl;
					break;
				}
			}
		}
		else{
			cout<<"-1"<<endl;
		}
	}
	return 0;
}

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

using namespace std;

using ull = unsigned long long;

int main() {
	int n,q,a, b,c;
	ull s = 0;
	cin >> n;
	map<int,int> m;
	for (int i = 0; i < n; ++i){
		cin >> a;
		auto it = m.find(a);
		if (it == m.end()) {
			m[a] = 1;
		} else {
			m[a]++;
		}
		s += a;
	}
	cin >> q;
	while (q--) {
		cin >> b >> c;
		s += (c-b)*m[b];
		m[c] += m[b];
		m[b] = 0;
		cout << s << endl;
	}
	return 0;
}


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

long long f(long long r){
    long long cnt = 0;
    while (r){
        long long bit_count = 0, rr = r;
        while (rr){
            if (rr & 1)
                bit_count += 1;
            rr >>= 1;
        }

        r = r % bit_count;
        cnt += 1;
    }

    return cnt;
}

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

    string s;
    cin >> s;

    long long popcount = 0;
    for (int i = 0; i < n; i++){
        if (s[i] == '1')
            popcount += 1;
    }

    long long div1 = popcount + 1;
    long long div2 = popcount - 1;
    auto binary_mod = [&](int div){
        if (div == 0)
            return 0;

        int val = 0;
        for (auto i: s){
            val = (val * 2 + (i - '0')) % div;
        }

        return val;
    };


    auto pow = [](long long b, long long n, long long mod){
        long long res = 1;
        while (n){
            if (n & 1){
                res *= b;
                res %= mod;
            }

            n >>= 1;
            b = (b * b) % mod;
        }
        
        return res;
    };

    long long rem1 = binary_mod(div1);
    long long rem2 = binary_mod(div2);
    for (int i = 0; i < n; i++){
        if (s[i] == '0'){
            long long r = (rem1 + pow(2, n - i - 1, div1)) % div1;
            cout << f(r) + 1 << '\n';
        }
        else{
            if (div2 == 0)
                cout << 0 << '\n';
            else{
                long long r = (rem2 - pow(2, n - i - 1, div2) + div2) % div2;
                cout << f(r) + 1 << '\n';
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
int main(){
    int x, n;
    cin >> x;
    if(10<=x) n=x%10;
    else n=x;
    if(n==3) cout << "bon" <<endl;
    else if(n==0 || n==1 || n==6 || n==8) cout << "pon" <<endl;
    else cout << "hon" <<endl;
    return 0;
}


Measured memory_bytes: 3620