akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  //#ifndef ONLINE_JUDGE
  //freopen("date.in", "r", stdin);
  //freopen("date.out", "w", stdout);
  //#endif //ONLINE_JUDGE

  int c[10][10], a[205][205];

  int h, w;


  cin >> h >> w;
  for(int i = 0; i <= 9; ++i)
    for(int j = 0; j <= 9; ++j)
        cin >> c[i][j];

  for(int i = 1; i <= h; ++i)
    for(int j = 1; j <= w; ++j)
        cin >> a[i][j];

  for(int k = 0; k <= 9; ++k)
    for(int i = 0; i <= 9; ++i)
        for(int j = 0; j <= 9; ++j)
            if(i != j and c[i][k] + c[k][j] < c[i][j])
                c[i][j] = c[i][k] + c[k][j];

  int minim = 0;

  for(int i = 1; i <= h; ++i)
    for(int j = 1; j <= w; ++j)
        if(a[i][j] != -1 and a[i][j] != 1)
            minim += c[a[i][j]][1];

  cout << minim;

}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a[200000],N;
	cin>>N;
	for(int i=0;i<N;i++)cin>>a[i];
	sort(a,a+N);
	for(int i=0;i<N-1;i++){
		if(a[i]==a[i+1]){cout<<"NO";return 0;}
	}
	cout<<"YES";
	return 0;
}

Measured memory_bytes: 1024
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    w, h, x, y = MI()
    s = h*w*0.5
    flag = int(x == 0.5*w and y == 0.5*h)
    print("{} {}".format(s, flag))
if __name__ == '__main__':
    main()

Measured memory_bytes: 9036
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define all(a) (a).begin(), (a).end()


int main(){
    vector<int> A(5);
    for(int i = 0; i < 5; i++) cin >> A[i];
    for(int i = 0; i < 5; i++){
        if(A[i] == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3568
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author JustLive
 */

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

typedef long long ll;
typedef unsigned long long ull;

const int mod = 1000000007;
const int inf = 1000000000;
const ll infll = (ll)inf * (ll)inf;

class TaskC {
public:
    void solve(istream& in, ostream& out) {
        int n, y;
        in >> n >> y;
        y /= 1000;
        for (int a = 0; a <= n; a++) {
            int c = 5 * (n + a) - y;
            if (c % 4 == 0 and c >= 0) {
                c /= 4;
                int b = n - a - c;
                if (b >= 0) {
                    if (10 * a + 5 * b + c == y) {
                        out << a << " " << b << " " << c;
                        return;
                    }
                }
            }
        }
        out << "-1 -1 -1";
    }
};


int main() {
    TaskC solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
K, A, B = map(int, input().split())

cnt = A + 2
max_num = max(cnt, B)

tmp = K - A + 1
ans1 = K + 1
if tmp % 2 == 0:
    print(max(ans1, A + tmp // 2 * (B - A)))
else:
    print(max(ans1, A + tmp // 2 * (B - A) + 1))



Measured memory_bytes: 2940
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    N = int(readline())
    L = [0]*N; D = [0]*N
    for i in range(N):
        l, d = readline().split()
        L[i] = +(l == 'y')
        D[i] = int(d)
    ans = 0
    *I, = range(N)
    I.sort(key = D.__getitem__)
    U = [0]*N
    for i in I:
        if not L[i] or U[i]:
            continue
        d = D[i]
        U[i] = 1
        ans += 1
        k = i-1
        while k >= 0 and (L[k] or D[k] < d):
            if L[k]:
                U[k] = 1
            k -= 1
        k = i+1
        while k < N and (L[k] or D[k] < d):
            if L[k]:
                U[k] = 1
            k += 1
    write("%d\n" % ans)
solve()


Measured memory_bytes: 5652
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,n;
    cin>>a>>b>>n;
    ll x = min(n,b-1);
    cout<<((a*x)/b)-(a*(x/b))<<endl;
    return 0;
}


Measured memory_bytes: 3648
#import random
import numpy as np
d=int(input())
c=np.array(list(map(int,input().split())))
s=[None]*d
#r=[None]*d
cm=np.array([0]*26)
cd=np.array([0]*26)
for i in range(d):
  s[i]=list(map(int,input().split()))
s=np.array(s)
for j in range(d):  
  #rand = np.random.randint(26, size = 10) 
  #print(np.argmax(s[j])+1)
  r_i=np.argmax(s[j])
  cd=c*cm
  if np.max(cd>s[i][r_i]):
    r_i=np.argmax(cd)
  #r[i]=r_i
  for k in range(26):
    cm[k]+=1
  cm[r_i]=0
  r_i+=1
  print(r_i)

  
    



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

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

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

void add(ll& a, ll b){a = (a+b) % MOD;}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    s.insert(4," ");
    cout<<s<<endl;
}

Measured memory_bytes: 256
#include <iostream>

#include <math.h>
using namespace std;

int main()
{
    int k ,n;
    cin >> n >> k;
    int j;
    int a;
    for(int i = 0;i<n;i++){
       cin >> a;
       if(a==1){
           j = i+1;
           break;
       }
    }
    

    
    int q = (j-1)/(k-1)+(n-j)/(k-1);
    if((n-j)%(k-1)+(j-1)%(k-1)!=0){
        if((n-j)%(k-1)+(j-1)%(k-1)<k){
            q+=1;
        }
        else{
            q+=2;
        }

    }
    
    cout << q;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n, m, h[200010], ma[200010];
  cin >> n >> m;
  for(int i=1; i<=n; i++) {
    ll takasa;
    cin >> takasa;
    h[i] = takasa;
    ma[i] = 0;
  }
  for (int i=0; i<m; i++) {
    int a, b;
    cin >>a>>b;
    ma[a] = max(ma[a],h[b]);
    ma[b] = max(ma[b],h[a]);
  }
  int ans =0;
  for (int i=1; i<=n; i++) {
    if (h[i] > ma[i]) {
      ans++;
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 4320
r,c=list(map(int,input().split()))
a=[]
A1=[[0 for col in range(c+1)] for row in range(r+1)]
sum_col=0
sum_row=0
for row in range(r):
    A = list(map(int,input().split()))
    a.append(A)
for row in range(r):
    for col in range(c):
        A1[row][col]=a[row][col]
for row in range(r+1):
    for col in range(c+1):
        sum_col+=A1[row][col]
    A1[row][c]=sum_col
    sum_col=0
for col in range(c+1):
    for row in range(r+1):
        sum_row+=A1[row][col]
    A1[r][col]=sum_row
    sum_row=0
for row in range(r+1):
    print("%d"%(A1[row][0]),end="")
    for col in range(1,c+1):
        print(" %d"%(A1[row][col]),end="")
    print()



Measured memory_bytes: 6276
#include<iostream>
#include<string>
#include<sstream>
#include<stdlib.h>
#include<math.h>
#include<vector>
#define EPS (1e-10)
using namespace std;
double s2d(string str){
  stringstream ss(str);
  double x;ss>>x;
  return x;
}
struct Point{
  double x,y;
  Point(){}
  Point(double x,double y) :x(x),y(y){}
  Point operator + (Point &p) {return Point(x+p.x,y+p.y);}
  Point operator - (Point &p) {return Point(x-p.x,y-p.y);}
  Point operator * (double k) {return Point(x*k,y*k);}
  Point operator / (double k) {return Point(x/k,y/k);}
};
typedef Point Vector;
typedef vector<Point> Polygon;
double norm(Vector a){
  return a.x*a.x+a.y*a.y;
}
double abs(Vector a){
  return sqrt(norm(a));
}
double dot(Vector a,Vector b){
  return a.x*b.x+a.y*b.y;
}
double cross(Vector a,Vector b){
  return a.x*b.y-a.y*b.x;
}
int contains(Polygon g,Point p){
  int n=g.size();
  bool x=false;
  for(int i=0;i<n;i++){
    Point a=g[i]-p,b=g[(i+1)%n]-p;
    if(fabs(cross(a,b)) < EPS && dot(a,b) < EPS) return 1;
    if(a.y>b.y) swap(a,b);
    if(a.y < EPS && EPS < b.y && cross(a,b) > EPS ) x = !x;
  }
  return (x?2:0);
}
int main(){
  string str;
  while(cin >> str){
    Point p[4];
    int i,j,k;
    for(i=0;i<str.size();i++)if(str[i]==',') str[i]=' ';
    stringstream ss(str);
    for(i=0;i<4;i++){
      ss>>str;p[i].x=s2d(str);
      ss>>str;p[i].y=s2d(str);
      //cout << p[i].x <<":" << p[i].y << endl;
    }
    bool f=false;
    for(i=0;i<4;i++){
      Polygon g;
      g.clear();
      for(j=0;j<4;j++){
	if(i!=j) g.push_back(p[j]);
      }
      //cout << contains(g,p[i]) << endl;
      if(contains(g,p[i])==2) f=true;
    }
    if(!f) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

Measured memory_bytes: 1240
import sys
from collections import Counter, defaultdict

n = int(sys.stdin.buffer.readline())
aaa = list(map(int, sys.stdin.buffer.readline().split()))
q = int(sys.stdin.buffer.readline())
bc = map(int, sys.stdin.buffer.read().split())

cnt = defaultdict(int, Counter(aaa))
ans = sum(a * c for a, c in cnt.items())
buf = []

for b, c in zip(bc, bc):
    if b not in cnt:
        buf.append(ans)
        continue
    ans += cnt[b] * (c - b)
    cnt[c] += cnt[b]
    del cnt[b]
    buf.append(ans)

print('\n'.join(map(str, buf)))


Measured memory_bytes: 32920
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;

typedef pair<int, int> pii;
#define mp make_pair

const int N = 510;
int a[N * N];
int n;
pii b[N];
int c[N];

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		int x;
		scanf("%d", &x);
		x--;
		b[i - 1] = mp(x, i);
	}
	sort(b, b + n);
	for (int pos = 0; pos < n * n; pos++)
	{
		int x = -1;
		for (int i = 0; x == -1 && i < n; i++)
		{
			if (b[i].first < pos) continue;
			int y = b[i].second;
			if (b[i].first == pos)
			{
				if (c[y] + 1 != y)
				{
					printf("No\n");
					return 0;
				}
				x = y;
				break;
			}
			if (c[y] + 1 < y)
			{
				x = y;
				break;
			}
		}
		if (x != -1)
		{
			a[pos] = x;
			c[x]++;
			continue;
		}
		for (int i = 0; i < n && b[i].first < pos; i++)
		{
			int y = b[i].second;
			if (c[y] < n)
			{
				x = y;
				break;
			}
		}
		if (x != -1)
		{
			a[pos] = x;
			c[x]++;
			continue;
		}
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	for (int i = 0; i < n * n; i++)
		printf("%d ", a[i]);
	printf("\n");

	return 0;
}

Measured memory_bytes: 2176
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<tuple>
#include<stdio.h>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Q;
ll longinf=1ll<<60;
int inf=1<<29;
//mleしなければぜんぶllでかく。

int main(){
      int a,b,c;
      cin>>a>>b>>c;
      cout<<min(b/a,c)<<endl;
      return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import           Control.Monad
import           Data.Array.ST
import           Data.Array.Unboxed    (UArray)
import qualified Data.Array.Unboxed    as U
import           Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as BS

main :: IO ()
main = do
  !sa <- BS.getLine
  !ta <- BS.getLine
  let !n = BS.length sa
      !m = BS.length ta
      !result = solve (n,sa) (m,ta)
  putStrLn $ restore sa result n m

solve :: (Int, ByteString) -> (Int, ByteString) -> UArray (Int,Int) Int
solve (!n',!sa) (!m',!ta) = runSTUArray $ do
  !dp <- newArray ((0,0),(n',m')) 0
  forM_ [(n_,m_) | !n_ <- [1..n'], !m_ <- [1..m']] $ \(!n,!m) -> do
    !a <- readArray dp (n-1,m-1)
    !b <- readArray dp (n,m-1)
    !c <- readArray dp (n-1,m)
    if sa `BS.index` (n-1) == ta `BS.index` (m-1)
      then writeArray dp (n,m) $ maximum [a+1,b,c]
      else writeArray dp (n,m) $ maximum [b,c]
  return dp

restore :: ByteString -> UArray (Int,Int) Int -> Int -> Int -> String
restore !st !ary !n !m = go n m ""
  where go 0 _ !ss = ss
        go _ 0 !ss = ss
        go !i !j !ss
          | ary U.! (i,j) == ary U.! (i-1,j) = go (i-1) j ss
          | ary U.! (i,j) == ary U.! (i,j-1) = go i (j-1) ss
          | otherwise                        = go (i-1) (j-1) ((st `BS.index` (i-1)):ss)


Measured memory_bytes: 71932
a = input() + 'A'
b = input() + 'B'
c = input() + 'C'

x = a[0]

while x == 'a' or x == 'b' or x == 'c':
    if x == 'a':
        x = a[0]
        a = a[1:]
    elif x == 'b':
        x = b[0]
        b = b[1:]
    else:
        x = c[0]
        c = c[1:]

print(x)


Measured memory_bytes: 3060
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define maxn 1000005
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;

int s[maxn],t[maxn];

int cho[maxn];

int n;

int q[maxn],head,tail;

int ans;

bool check255(){
	int wz=1;
	fo(i,1,n) {
		if (s[wz]==t[i]) continue;
		while (wz<=n && s[wz]!=t[i]) wz++;
		if (wz>i) return 1;
		if (s[wz]!=t[i]) return 1;
	}
	return 0;
}

bool check0(){
	fo(i,1,n) if (s[i]!=t[i]) return 0;
	return 1;
}

int main(){
	//freopen("game.in","r",stdin);
	//freopen("game.out","w",stdout);
	scanf("%d",&n);
	fo(i,1,n) {
		char c=getchar();
		while (c<'a' || c>'z') c=getchar();
		s[i]=c-'a'+1;
	}
	fo(i,1,n) {
		char c=getchar();
		while (c<'a' || c>'z') c=getchar();
		t[i]=c-'a'+1;
	}
	if (check255()) {
		puts("-1");
		return 0;
	}
	if (check0()) {
		puts("0");
		return 0;
	}
	int wz=n;
	head=1;
	tail=0;
	fd(i,n,1) {
		if (t[i]==t[i-1]) continue;
		if (wz>i) wz=i;
		while (s[wz]!=t[i]) wz--;
		while (head<=tail && q[head]-(tail-head+1)>=i) 
			head++;
		q[++tail]=wz;
		if (wz!=i) ans=max(ans,tail-head+1);
	}
	cout<<ans+1;
	return 0;
}

Measured memory_bytes: 13824
// Package main provides
//
// File:  b.go
// Author: ymiyamoto
//
// Created on Thu Jan 10 09:45:26 2019
//
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var s string
	fmt.Scan(&s)
	fmt.Println(string(s[0]) + strconv.Itoa(len(s)-2) + string(s[len(s)-1]))
}


Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>

using namespace std;

void solve();
static int N, wsum;
static vector<int> W;

void solve() {
  int left = 0;
  int ans = wsum;

  for (uint i = 0; i < N - 1; i++) {
    left += W[i];
    wsum -= W[i];
    ans = min({ans, abs(wsum - left)});
  }
  cout << ans << endl;
}

int main() {
  cin >> N;
  int w;
  wsum = 0;
  for (int i = 0; i < N; i++) {
    cin >> w;
    wsum += w;
    W.emplace_back(w);
  }

  solve();
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, k;
int a[5010];

bool ok[5010];

bool check(int m) {
    memset(ok, false, sizeof(ok));
    ok[0] = true;
    for (int i = n-1; i >= 0; i--) {
        if (i == m) continue;
        for (int j = k-1; j >= 0; j--) {
            if (ok[j] && j+a[i] < k)
                ok[j+a[i]] = true;
        }
    }

    for (int i = k-1; i >= 0; i--) {
        if (ok[i]) {
            return i+a[m] >= k;
        }
    }
    return false;
}

int solve() {
    sort(a, a+n);
    int lb = -1, ub = n;
    while (ub - lb > 1) {
        int mid = (lb + ub) / 2;
        if (check(mid)) {
            ub = mid;
        } else {
            lb = mid;
        }
    }
    return lb + 1;
}

void input() {
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> a[i];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}


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

const int mod = 1e5;
const long long INF = 1LL<<60;
//using ll = long long;
//using P = pair<int,int>;
 
int main(){
    int n;
    
    while(cin >> n){
        if (n == 0) break;
        
        vector<long long> imos(101010);
        
        rep(i,n){
            string s1, s2;
            cin >> s1 >> s2;
            
            int start_h1 = ((s1[0] - '0') * 10 + (s1[1] - '0')) * 3600; 
            int start_m1 =  ((s1[3] - '0') * 10 + (s1[4] - '0')) * 60;
            int start_s1 = (s1[6] - '0') * 10 + s1[7] - '0';
            int start_time =  start_h1 + start_m1 + start_s1;
            
            int arrival_h2 = ((s2[0] - '0') * 10 + (s2[1] - '0')) * 3600; 
            int arrival_m2 =  ((s2[3] - '0') * 10 + (s2[4] - '0')) * 60;
            int arrival_s2 = (s2[6] - '0') * 10 + s2[7] - '0';
            int arrival_time =  arrival_h2 + arrival_m2 + arrival_s2;
            
            for (int j = start_time; j < arrival_time; j++) imos[j]++;
        }

        long long ans = 0;
        
        for (int i = 0; i <86400; i++) ans = max(ans, imos[i]);
        cout << ans << endl;
        
    }
}


Measured memory_bytes: 3932
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  input! {
    h: i64, n: i64,
    a: [i64; n]
  }
  
  let sum: i64 = a.iter().sum();
  println!("{}",
    if sum >= h { "Yes" }
    else { "No" }
  );
}

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

Measured memory_bytes: 2592
let N = stdin.ReadLine() |> int

let D =
    [ for i in [ 0..N - 1 ] do
        yield (stdin.ReadLine().Split() |> Array.map int) ]

let rec solver n i =
    if i = N then "No"
    elif D.[i].[0] = D.[i].[1] then
        if n + 1 = 3 then "Yes"
        else solver (n + 1) (i + 1)
    else solver 0 (i + 1)

solver 0 0 |> stdout.WriteLine


Measured memory_bytes: 28488
/*Points to be noted :
1)Don't be afraid to fail.
2)Never give up easily,keep trying.
3)Don't care about other ppl's progress.
4)Spend much time on each problem & keep trying. I WILL DO IT!💯*/

// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//


#include<bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define int long long int
#define ld long double
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define r0 return 0;
#define tc int t;cin>>t;while(t--)
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define vi vector<int>
#define vii vector<long long int>
#define SORT(v) sort(v.begin(),v.end());
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define md 998244353
#define inf 1000000000000000 //1e15
#define gcd __gcd
#define lcm(a,b) ((a)*(b))/gcd(a,b)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define crap ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
int min(int a,int b){
    return (a<b)?a:b;
}
int max(int a,int b){
    return (a>b)?a:b;
}
int fp(int a,int b){
    if(b==0) return 1;
    int x=fp(a,b/2);
    x=(x*x)%mod;
    if(b&1) x=(x*a)%mod;
    return x;
}
int factorial(int n)
{
    int fact=1;
    for(int i=2;i<=n;i++)
    fact=fact*i;
    
    return fact;
}
int ncr(int n,int r)
{
    return factorial(n)/(factorial(r)*factorial(n-r));
}
void c_p_c()
{
    crap;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
signed main()
{
    c_p_c();
    int n;
    cin>>n;
    int a[n+1],sum=0;
    unordered_map<int,int> m;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        m[a[i]]++;
        sum+=a[i];
    }
   // int sum=accumulate(a+1,a+1+n,0);
   // cout<<sum<<endl;
    int q;
    cin>>q;
    while(q--)
    {
        int b,c;
        cin>>b>>c;
        int freq=m[b];
        sum=sum-(freq*b)+(freq*c);
        m[c]+=m[b];
        m[b]=0;
        cout<<sum<<endl;

    }
}


Measured memory_bytes: 7852
from itertools import combinations as comb
from collections import deque as dq

def inpl(): return list(map(int, input().split()))


def dijkstra(a):
    node = dq()
    node.append(a)
    ncost = [1<<20 for _ in range(N+1)]
    first = a
    ncost[a] = 0
    path = {}
    while len(node) != N:
        for nb in edge[first]:
            if nb in node:
                continue
            if ncost[nb] > ncost[first] + cost[(first, nb)]:
                # print(nb, ncost[nb])
                path[nb] = first
                ncost[nb] = ncost[first] + cost[(first, nb)]
                # print(nb, ncost[nb])

        nf = 0
        # print(path)
        for t in range(N+1):
            if t in node:
                continue
            # print(nf, t)
            if ncost[nf] > ncost[t]:
                nf = t
        node.append(nf)
        first = nf
        # print(node)
    # print(path)
    # print(ncost)
    ret = set()
    for k, v in path.items():
        ret.add((k, v))
        ret.add((v, k))
    return ret


N, M = inpl()
cost = {}
edge = [dq() for _ in range(N+1)]
for _ in range(M):
    a, b, c = inpl()
    cost[(a, b)] = c
    cost[(b, a)] = c
    edge[a].append(b)
    edge[b].append(a)

ans = set()
for a in range(1, N+1):
    # print(a, b, "check")
    # print(dijkstra(a, b))
    ans = ans | dijkstra(a)
# print(ans)
print(M-len(ans)//2)

Measured memory_bytes: 3820
def main():
    import sys
    input = sys.stdin.buffer.readline
    N, M = (int(i) for i in input().split())
    ABC = []
    c_all_or = 0
    where_open = lambda s: sum(2**j for j in s)
    for i in range(M):
        a, b = (int(j) for j in input().split())
        c = {int(j)-1 for j in input().split()}
        wc = where_open(c)
        c_all_or |= wc
        ABC.append((a,b,wc))
    if c_all_or != ((1<<N) - 1):
        print(-1)
        return 0
    r = [10**9] * (1<<N)
    r[0] = 0
    for bit in range(1,1<<N):
        q = r[bit]
        for i in range(M):
            cur = ABC[i][2]
            less = (bit ^ cur) & bit
            q = min(q,r[less] + ABC[i][0])
        r[bit] = q
    
    print(r[(1<<N) - 1])
if __name__ == '__main__':
    main()

Measured memory_bytes: 41328
from math import gcd

from math import factorial as f

from math import ceil, floor, sqrt
import math

import bisect
import re
import heapq

from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

yes = "Yes"
no = "No"


def main():
    x, k, d = mi()
    x = abs(x)
    if k % 2 == 1:
        x -= d
        x = abs(x)
        k -= 1
    d2 = 2 * d
    kaisuu = x // d2
    k //= 2
    if kaisuu <= k:
        k -= kaisuu
        x -= kaisuu * d2
    else:
        x -= d2 * k
        print(x)
        exit()
    if abs(x - d2) < x and k > 0:
        print(abs(x - d2))
    else:
        print(x)


main()


Measured memory_bytes: 10020
import scala.io.StdIn._
object Main{
  def main(args: Array[String]): Unit ={
    val s = readLine
    val b = s.matches("A.[^C]*C[^C]*.")
    val b2 = s.count(_.isUpper) == 2
    if(b&&b2)
      println("AC")
    else
      println("WA")
  }
}


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

int main()
{
    int a, b, c, d;
    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    scanf("%d", &d);

    if (abs(a - c) <= d)
    {
        printf("Yes");
    }
    else
    {
        if (abs(a - b) <= d && abs(b - c) <= d)
        {
            printf("Yes");
        }
        else
        {
            printf("No");
        }
    }
    return 0;
}

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

int main() {
	// your code goes here
	int x1,y1,x2,y2,x3,y3,x4,y4;
	cin>>x1>>y1>>x2>>y2;
	int a=y2-y1;
	int b=x2-x1;
	x3=x2-a;
	x4=x1-a;
	y3=y2+b;
	y4=y1+b;
	cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<ctype.h>

int plus(int i){
  if(i < 2){
    return 0;
  }
  else return i - 1;
}

int main(){
  int i, maxlength = 10, S[10], length, start, use;
  long  number, sum = 0, s = 1;
  i = scanf("%ld", &s);

  long keta = 1;
  for(i = 1; i < 10; i ++){
    keta *= 10;
    if(s < keta){
      maxlength = i;
      break;
    }
  }

  for(i = 0; i < maxlength; i ++){
    keta = pow(10, maxlength - i - 1);
    S[i] = s / keta;
    s %= keta;
  }


  
  //  for(i = 0; i < maxlength; i ++){
  //printf("S[%d] = %d\n", i, S[i]);
  //}

  // length + 1 桁
  //start: 最初の数字

  for(length = 0; length < maxlength; length ++){
    for(start = 0; start < maxlength - length; start ++){
      number = 0;
      for(i = 0; i <= length; i ++){
	number +=  S[start + i] * pow(10, length - i);
      }

      use = pow(2, plus(start) + plus(maxlength - 1 - length - start));
      sum += number * use;
    }
  }
  printf("%ld\n", sum);
  return 0;
}


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

int main() {
  int n;
  cin>>n;
  vector<int>a(n),b(n);
  rep(i,n){
    cin>>a.at(i);
  }
  rep(i,n){
    cin>>b.at(i);
  }
  int ans=0;
  rep(i,n){
    if(a.at(i)>b.at(i)){
      ans+=a.at(i)-b.at(i);
    }
  }
  
  cout<<ans<<endl;
}
            

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


// 100以下の素数一覧
const int prime[25] = {
        2, 3, 5, 7, 11,
        13, 17, 19, 23, 29,
        31, 37, 41, 43, 47,
        53, 59, 61, 67, 71,
        73, 79, 83, 89, 97};

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

    int cnt[25];
    fill(cnt, cnt + 25, 0);
    // cnt[i] = N!を素因数分解したときのprime[i]の指数

    for (int n = 1; n <= N; ++n) {
        int m = n;

        // mを素因数分解する
        for (int i = 0; i < 25; ++i) {
            while (m % prime[i] == 0) {
                ++cnt[i];
                m /= prime[i];
            }
        }
    }

    int ans = 0;

    // p^74の形
    for (int p = 0; p < 25; ++p) {
        if (cnt[p] >= 74) ++ans;
    }

    // p^2 q^24とp^4 q^14の形
    for (int p = 0; p < 25; ++p) {
        for (int q = 0; q < 25; ++q) {
            if (p == q) continue;
            if (cnt[p] >= 4 && cnt[q] >= 14) ++ans;
            if (cnt[p] >= 2 && cnt[q] >= 24) ++ans;
        }
    }

    // p^2 q^4 r^4の形
    for (int p = 0; p < 25; ++p) {
        for (int q = 0; q < 25; ++q) {
            // 重複カウントを防ぐためにq < rにしている
            for (int r = q + 1; r < 25; ++r) {
                if (p == q || r == p) continue;
                if (cnt[p] >= 2 && cnt[q] >= 4 && cnt[r] >= 4) ++ans;
            }
        }
    }

    cout << ans << endl;
    return 0;
}

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

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

    int T, A;
    std::cin >> T >> A;

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

    std::vector<double> absDiffs;
    absDiffs.reserve(N);
    std::transform(
        v.cbegin(), v.cend(),
        std::back_inserter(absDiffs),
        [&](int x) { return std::fabs(T - x*0.006 - A); }
    );

    const auto min_element = std::min_element(absDiffs.cbegin(), absDiffs.cend());
    const int ret = static_cast<int>(min_element - absDiffs.cbegin()) + 1;

    std::cout << ret << std::endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define V vector
#define L long
#define W V<L>
L E=70,M=2e17,n,a,b;W S(V<W>p){if(!E){return{1,0};}V<V<W>>T(2);for(W x:p){T[x[1]&1].push_back({x[0]/2,x[1]/2});if(x[0]&1){T[(x[1]+1)&1].push_back({x[0]/2,(x[1]+1)/2});}}for(L i;i<2;i++){L c=0;for(W x:T[!i]){L Q=(2*x[0]+x[1])%3;c^=Q+1;}if(!c){E--;W A=S(T[i]);A[0]*=2;A[1]*=2;A[1]+=i;return A;}}for(W&v:p){v[0]++;}W A=S(p);A[0]--;return A;}int main(){cin>>n;V<W>p(n);while(n--){cin>>a>>b;p[n]={a+M,b+M};}W x=S(p);cout<<x[0]-M<<" "<<x[1]-M;}

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

using namespace std;

using ll = long long;

constexpr ll mod = 1e9 + 7;

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

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

  vector<ll> dp(k + 1);
  dp[k] = 1;
  for (int i = 0; i < n; ++i) {
    ll a;
    cin >> a;
    vector<ll> new_dp(k + 1);
    ll pref = 0;
    for (int j = k; j >= 0; --j) {
      pref = (pref + dp[j]) % mod;
      new_dp[j] = pref;
      if (j + a <= k) {
        pref = (pref - dp[j + a] + mod) % mod;
      }
    }
    swap(dp, new_dp);
  }

  cout << dp[0] << '\n';

  return 0;
}


Measured memory_bytes: 1792
fun main(args: Array<String>){
	//Hello_World()
	//X_Cubic()
	//Rectangle()
	//Watch()
	Small_Large_or_Equal()
}

fun Small_Large_or_Equal(){
	val ab = readLine()!!.split(" ").map(String::toInt)
	val a = ab[0]
	val b = ab[1]
	when{
		a<b ->{
			println("a < b")
		}
		a>b ->{
			println("a > b")
		}
		else ->{
			println("a == b")
		}
	}
}


Measured memory_bytes: 31988
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll a,b,sm=0,mx;
    cin>>a>>b;
    ll ar[a+1];

    for(int i=0; i<a; i++)
    {
        cin>>ar[i];
        sm+=ar[i];
    }

    double y=4.0*b;

    double x=sm/y;

    //cout<<x<<endl;

    int c=0;

    for(int i=0; i<a; i++)
    {
        if(ar[i]>=x)
        {
            c++;
        }
    }

    if(c>=b)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }





    return 0;
}


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

int main(void)
{
	long long pos[200],count=1;
	for(int i=0;i<200;i++)
	{
		pos[i]=pow(i,5);
		
		//cout<<pos[count]<<endl;
	}
	int X;
	cin>>X;
	for(int i=0;i<200;i++)
	{
		for(int j=0;j<200;j++)
		{
			//cout<<pos[i]<<" "<<pos[j]<<endl;
			//cout<<pos[i]<<" "<<-pos[j]<<endl;
			if(X==pos[i]-pos[j])
			{
				cout<<i<<" "<<j<<endl;
				exit(0);
			}
			else if(X==pos[i]+pos[j])
			{
				cout<<i<<" "<<-j<<endl;
				exit(0);
			}
			
		}
	}
	
}


Measured memory_bytes: 4028
h = 1
w = 1
while not(h == 0 and w == 0):
    z = input()
    h,w = [ int(a) for a in z.split()]
    pre = h
    while pre > 0:
        print ("#" * w)
        pre = pre - 1
    if not(h == 0 and w == 0):
        print ()


Measured memory_bytes: 5616
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

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

    def calc(self,n,k):#nCk
        if n < 0 or k < 0 or n < k:
            return 0
        elif n == 0 or k == 0 or n == k:
            return 1
        return self.fac[n]*self.invmod[k]%mod *self.invmod[n-k] %mod

N,K = inpl()
a = K
b = N-K
Com = Combination(2010)

for i in range(1,K+1):
    ans = 0
    an = i
    # A, ABA, ABABA,,,
    bn = i-1
    if bn == 0 and b==0:
        ans += 1
    else:
        ans += Com.calc(a-1,(an-1)) * Com.calc(b-1,(bn-1))
    #print(a,an,b,bn)
    #print(Com.calc(a-1,(an-1)) * Com.calc(b-1,(bn-1)))

    # AB(BA)
    bn = i
    ans += Com.calc(a-1,(an-1)) * Com.calc(b-1,(bn-1))*2
    #print(a,an,b,bn)
    #print(Com.calc(a-1,(an-1)) * Com.calc(b-1,(bn-1))*2)

    # BAB
    bn = i+1
    ans += Com.calc(a-1,(an-1)) * Com.calc(b-1,(bn-1))
    #print(a,an,b,bn)
    #print(Com.calc(a-1,(an-1)) * Com.calc(b-1,(bn-1)))

    print(ans%mod)
    #print()


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

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}
struct UnionFind {
    int n, cc, *u;
    UnionFind() : n(0), cc(0), u(NULL) {}
    UnionFind(int n_) : n(n_), cc(n_) {
	u = new int[n_];
	memset(u, -1, sizeof (int) * n);
    }
    UnionFind(const UnionFind &y) : n(y.n), cc(y.cc) {
	u = new int[y.n];
	memcpy(u, y.u, sizeof (int) * n);
    }
    ~UnionFind() {
	delete[] u; u = NULL;
	n = cc = 0;
    }
    friend void swap(UnionFind &x, UnionFind &y) {
	swap(x.n, y.n); swap(x.cc, y.cc); swap(x.u, y.u);
    }
    UnionFind& operator=(UnionFind y) { 
	swap(*this, y);
	return *this;
    }
    int root(int x) {
	int y = x, t;
	while (u[y] >= 0) y = u[y];
	while (x != y) { t = u[x]; u[x] = y; x = t; }
	return y;
    }
    bool link(int x, int y) {
	x = root(x); y = root(y);
	if (x == y) return false;
	if (u[y] < u[x]) swap(x, y);
	u[x] += u[y]; u[y] = x; cc--;
	return true;
    }
    bool same(int x, int y) { return root(x) == root(y); }
    int size(int x) { return -u[root(x)]; }
    int count() { return cc; }
};

int N;
const int SIZE = 411;
int in[SIZE], out[SIZE];
VI G[SIZE];
int deg[SIZE];

void MAIN() {
    scanf("%d%*d", &N);
    UnionFind U(SIZE);
    REP (i, N) {
	int a, b, c, d;
	scanf("%d%d%d%d", &a, &b, &c, &d);

	int u, v;
	if (c == 0) {
	    u = a*2;
	} else {
	    u = c*2+1;
	}
	if (d == 0) {
	    v = b*2+1;
	} else {
	    v = d*2;
	}
	out[u]++;
	in[v]++;
	U.link(u, v);

	//eprintf("%d %d\n", u, v);
	//REP (j, 4) {
	//    if (4-a-c <= j && j < 4-c) putchar('#');
	//    else putchar(' ');
	//    putchar('#');
	//    if (4-b-d <= j && j < 4-d) putchar('#');
	//    else putchar(' ');
	//    putchar('\n');
	//}
	//putchar('\n');
    }

    bool yes = true;

    REP (i, SIZE) if (in[i] || out[i]) G[U.root(i)].push_back(i);

    REP (r, SIZE) if (G[r].size()) {
	int start = 0, stop = 0;
	EACH (e, G[r]) {
	    int i = *e;

	    if (in[i] < out[i]) {
		if (i % 2) yes = false;
		start += out[i] - in[i];
	    }
	    if (in[i] > out[i]) {
		if (i % 2 == 0) yes = false;
		stop += in[i] - out[i];
	    }
	}
	if (start != stop) {
	    yes = false;
	}
	if (start == 0 || stop == 0) {
	    yes = false;
	}
    }

    puts(yes? "YES": "NO");
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    from collections import Counter
    c = Counter(A)
    ans = 0
    for v in c.values():
        ans += v*(v-1)//2

    for k in range(N):
        v = c[A[k]]
        diff = -v*(v-1)//2 + (v-1)*(v-2)//2
        print(ans + (diff if v != 1 else 0))


if __name__ == '__main__':
    main()


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

int main() {
  int n, a, b, c, d;
  cin >> n;
  a = n/1000;
  n -= a*1000;
  b = n/100;
  n -= b*100;
  c = n/10;
  n -= c*10;
  d = n;
  if ((a == b && a == c) || (b == c && b == d)) {
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

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

    ll n, k;
    cin >> n >> k;
    ll mod = 1e9 + 7;
    ll ans = 0;
    ll t = (k - 1) * k / 2LL % mod;
    vector<ll> a(n), b(n), c(n);
    rep(i, 0, n) cin >> a[i];
    rep(i, 0, n) {
        rep(j, 0, n) {
            if (a[i] > a[j]) {
                c[i]++;
                if (i < j)
                    b[i]++;
            }
        }
    }
    rep(i, 0, n) {
        ans += k * b[i] % mod + c[i] * t % mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


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

void main_()
{
    ll n;
    cin >> n;

    array<unordered_map<ll, ll>, 2> vs; // array:奇数、偶数 map:数値、出現数
    for (ll i = 0; i < n; ++i) {
        ll v;
        cin >> v;
        vs[i % 2][v]++;
    }

    // 奇数グループ、偶数グループから出現数上位2つを取得
    vector<vector<pair<ll, ll>>> top2(2, vector<pair<ll, ll>>(2));
    for (ll i = 0; i < 2; ++i) {
        partial_sort_copy(begin(vs[i]), end(vs[i]), begin(top2[i]), end(top2[i]),
            [](auto&& a, auto&& b) { return a.second > b.second; });
    }

    ll same_num;
    if (top2[0][0].first == top2[1][0].first) {
        // 奇数グループ偶数グループで最大の数値の数が同じ場合、奇数1位+偶数2位、奇数2位+偶数1位で数が多い方を採用
        same_num = max(top2[0][0].second + top2[1][1].second, top2[1][0].second + top2[0][1].second);
    } else {
        same_num = top2[0][0].second + top2[1][0].second;
    }

    cout << n - same_num << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 4376
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int n;
vector<int> a;

int bi_search2(int k){
    int lb = -1, ub = n;
    while( ub - lb > 1){
        int mid = (lb + ub)/2;
        if(a[mid] <= k){
            ub = mid;
        }else{
            lb = mid;
        }
    }
    return ub;
}

int main(){
    cin >> n;
    a.resize(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end(),greater<int>() );
    
    int p1,p2;
    int ans = 0;
    rep(i,n-2){
        reps(j,i+1,n-1){
            p2 = bi_search2(abs(a[i] - a[j]));
            if(p2 > j+1) ans += (p2-(j+1));
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n, y = map(int, input().split())
count = 5000*n
work = [0, n, 0]
for i in range(n):
    if y > count:
        count += 5000
        work[0] += 1
        work[1] -= 1
    elif y < count:
        work[2] += 1
        work[1] -= 1
        count -= 4000
    else:
        break
if y == count:
    print(" ".join(map(str, work)))
else:
    print("-1 -1 -1")


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

#define ll long long
#define mod 1000000007
#define pll pair<long long,long long>
#define pdd pair<long double,long double>
#define vll vector<ll>
#define rep(i,j,n) for(int i=j;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define inf 1e17
#define N 100010
priority_queue<pll,vector<pll>,greater<pll> >pq;
priority_queue<ll,vector<ll>,greater<ll> >pq1;

ll result(ll a, ll b, ll p){
    ll ans=1;
    if(b==(-1))
        b=p-2;
    while(b){
        if(b&1){
            ans=(ans*a)%p;
        }
        a=(a*a)%p;
        b>>=1;
    }
    return ans;
}

ll T,n,m;

int main(){
    if(fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    cin >> n;
    map<ll,ll>m;
    for(int i=0;i<n-1;i++){
    	ll a;
    	cin >> a;
    	m[a]++;
    }
    for(int i=1;i<=n;i++)
    	cout << m[i] << "\n";
 
    return 0;
}


Measured memory_bytes: 16152
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

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

    ll ans = 1e18;
    c *= 2;

    for(int i = 0; i <= 100000; i++) {
        ll now = 0;
        now += c * i;
        now += max(0, x-i) * a;
        now += max(0, y-i) * b;
        ans = min(ans, now);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3608
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.Comparator;

public class Main {
    static void dijkstra(ArrayList<Node> nodes, int start){
        Comparator<Node> comparator = new NodeCostComparator();
        PriorityQueue<Node> pq      = new PriorityQueue<Node>(100000, comparator);
        nodes.get(start).cost = 0;
        pq.add(nodes.get(start));
        
        while (!pq.isEmpty()){
        	Node done_node = pq.poll();
        	for (int i = 0; i < done_node.edge_to.size(); i++){
        		int to 	 	 = done_node.edge_to.get(i);
        		int cost 	 = done_node.edge_cost.get(i);
        		int new_cost = done_node.cost + cost;
        		int to_cost  = nodes.get(to).cost;
        		if (to_cost < 0 || new_cost < to_cost){
        			nodes.get(to).cost = new_cost;
        			if (!pq.contains(nodes.get(to))){
        				pq.add(nodes.get(to));
        			}
        		}
        	}
        }
    }
    static void print_results(ArrayList<Node> nodes){    
        for (int i = 0; i < nodes.size(); i++){
            int cst = nodes.get(i).cost;
            if (cst == -1){
                System.out.println("INF");
            }else{
                System.out.println(cst);
            }
        }
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ");
        int V = Integer.parseInt(line[0]);
        int E = Integer.parseInt(line[1]);
        int r = Integer.parseInt(line[2]);
        ArrayList<Node> nodes = new ArrayList<Node>();
        for (int i = 0; i < V; i++){
            ArrayList<Integer> edge_to   = new ArrayList<Integer>();
            ArrayList<Integer> edge_cost = new ArrayList<Integer>();
            Node node = new Node(-1, edge_to, edge_cost);
            nodes.add(node);
        }
        
        for (int i = 0; i < E; i++){
            String[] line2 = br.readLine().split(" ");
            int s = Integer.parseInt(line2[0]);
            int t = Integer.parseInt(line2[1]);
            int d = Integer.parseInt(line2[2]);
            nodes.get(s).edge_to.add(t);
            nodes.get(s).edge_cost.add(d);
        }
        dijkstra(nodes, r);
        print_results(nodes);
    }
}
class NodeCostComparator implements Comparator<Node>{
    @Override
    public int compare(Node x, Node y){
        int value = x.cost - y.cost;
        if (value < 0){
            return -1;
        }
        if (value > 0){
            return 1;
        }
        return 0;
    }
}

class Node{
    int cost = -1;
    ArrayList<Integer> edge_to   = new ArrayList<Integer>();
    ArrayList<Integer> edge_cost = new ArrayList<Integer>();
    
    Node(int cost, ArrayList<Integer> edge_to, ArrayList<Integer> edge_cost){
        this.cost       = cost;
        this.edge_to    = edge_to;
        this.edge_cost  = edge_cost;
    }
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	int a[n], m = (int)1e9, count = 0;
	long long sum = 0;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
		m = min(m, abs(a[i]));
		if(a[i] < 0) count++;
		sum += abs(a[i]);
	}
	if(count%2)
		sum -= 2*m;
	cout << sum << "\n";
	return 0;
}




Measured memory_bytes: 640
#include <iostream>

int main(int argc, char const *argv[])
{
    int a, b;

    std::cin >> a >> b;

    if (a < b)
    {
        std::cout << "a < b" << std::endl;
    }
    else if (a > b)
    {
        std::cout << "a > b" << std::endl;
    }
    else
    {
        std::cout << "a == b" << std::endl;
    }

    return 0;
}



Measured memory_bytes: 3076