akhauriyash/Code-Regression huggingface dataset:
Public Class Program
  Shared Sub Main()
    Dim n As Long = Cin.Lng()
    Dim a As Long() = Cin.LngArr()
    Dim ans As Long = 0
    Dim i As Long = 1
    For j As Long = 0 To n - 1
      If Not a(j) = i Then
        ans += 1
      Else
        i += 1
      End If
    Next
    If ans = n Then ans = -1
    Console.WriteLine(ans.ToString())
  End Sub
End Class

Public Class Cin
  Public Shared Function Str() As String
    Return Console.ReadLine().Trim()
  End Function
  Public Shared Function Int() As Integer
    Return Integer.Parse(Str())
  End Function
  Public Shared Function Lng() As Long
    Return Long.Parse(Str())
  End Function
  Public Shared Function Dbl() As Double
    Return Double.Parse(Str())
  End Function
  Public Shared Function StrArr(Optional separator As String = " ") As String()
    Return Str().Split(separator)
  End Function
  Public Shared Function IntArr(Optional separator As String = " ") As Integer()
    Return Array.ConvertAll(Of String, Integer)(StrArr(separator), AddressOf Integer.Parse)
  End Function
  Public Shared Function LngArr(Optional separator As String = " ") As Long()
    Return Array.ConvertAll(Of String, Long)(StrArr(separator), AddressOf Long.Parse)
  End Function
  Public Shared Function DblArr(Optional separator As String = " ") As Double()
    Return Array.ConvertAll(Of String, Double)(StrArr(separator), AddressOf Double.Parse)
  End Function
End Class

Measured memory_bytes: 32220
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)
const ll mod = 1000000007;
const double pi = 3.14159265358979;

int main() {
    str S;
    cin >> S;
    if(S.size() == 2) {
        cout << S << endl;
    }
    else {
        rep(i, 3) {
            cout << S[2-i];
        } 
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  while (cin >> n >> q) {
    int date[105];
    fill(date, date + 105, 0);
    if (n == 0 && q == 0)
      return 0;
    while (n--) {
      int m, x;
      cin >> m;
      while (m--) {
        cin >> x;
        date[x]++;
      }
    }
    int ans = 0, mx = 0;
    for (int i = 1; i <= 100; i++) {
      if (date[i] > mx)
        mx = date[i];
    }
    if (mx < q)
      cout << 0 << endl;
    else {
      for (int i = 1; i <= 100; i++) {
        if (date[i] == mx) {
          cout << i << endl;
          break;
        }
      }
    }
  }
}


Measured memory_bytes: 3024
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int n;
  cin >> n;
  string message = "Three";

  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    if (s == "Y") {
      message = "Four";
      break;
    }
  }
  
  cout << message << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.function.*;
import java.lang.*;
import java.math.*;
import java.io.*;

public class Main {
    static int div2Count(long n){
        int ans = 0;
        while(n%2 == 0){
            n /= 2;
            ans ++;
        }
        return ans;
    }
    static int div5Count(long n){
        int ans = 0;
        while(n%5 == 0){
            n /= 5;
            ans ++;
        }
        return ans;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        BigDecimal[] A = new BigDecimal[N];
        for(int n=0; n<N; n++){
            A[n] = new BigDecimal(sc.next());
        }
        long[] L = new long[N];
        for(int n=0; n<N; n++) L[n] = A[n].multiply(new BigDecimal(1000000000)).toBigInteger().longValue();
        
        long[][] d = new long[50][50];
        for(int n=0; n<N; n++){
            d[div2Count(L[n])][div5Count(L[n])]++;
        }

        long ans = 0;

        for(int i1=0; i1<50; i1++) for(int j1=0; j1<50; j1++){
            for(int i2=0; i2<50; i2++) for(int j2=0; j2<50; j2++){
                if((i1!=i2 || j1!=j2) && i1+i2>=18 && j1+j2>=18) {
                    ans += (d[i1][j1] * d[i2][j2]);
                }
            }
        }

        for(int i=0; i<50; i++) for(int j=0; j<50; j++){
            if(i+i>=18 && j+j>=18){
                ans += d[i][j] * (d[i][j]-1);
            }
        }

        ans /= 2;
        System.out.println(ans);
    }
}


Measured memory_bytes: 71316
// copied by Nurstan Duisengaliev
// skatal
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) (int)x.size()
 
using namespace std;
//using namespace __gnu_pbds;

//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;                         

const int N = (int)5e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
int n, a[N];
void solve () {
	cin >> n;
	n *= 2;
	for (int i = 1; i <= n; i ++) cin >> a[i];
	sort (a + 1, a + n + 1);
	ll sum = 0;
	for (int i = 1; i <= n; i += 2) sum += a[i];
	cout << sum;
}   	
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//    cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}

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

int main() {
  int a, b;
  cin >> a >> b;
  int r = 0;
  while (a <= b) {
    int s, t, u, v;
    s = a / 10000;
    t = a % 10;
    u = a / 1000 % 10;
    v = a / 10 % 10;
    //cout << s << t << endl;
    //cout << u << v << endl;
    if (s == t && u == v) {
      r++;
    }
    a++;
  }
  cout << r << endl;
}


Measured memory_bytes: 256
//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#include<assert.h>
#include<cstring>
#include<unordered_map>
#include<bitset>

//macros and consts
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define FORE(i,a) for(auto &i : a)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define accm accumulate
#define Fi first
#define Se second
#define INF 1e9
#define llINF (1LL<<60)
#define mINF -1e9
#define mllINF -(1LL<<60)
#define endl "\n"
#define CONT continue
#define BRK break
#define modulo(n, m) (((n)%(m)+(m))%m)

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int,int>;
using Mll = map<ll,ll>;
using UMi = unordered_map<int,int>;
using UMll = unordered_map<ll,ll>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int,vector<int>,greater<int>>;
using pqsi = priority_queue<int,vector<int>,less<int>>;
using pqgll = priority_queue<int,vector<int>,greater<int>>;
using pssll = priority_queue<int,vector<int>,less<int>>;
template<class T>
using vec = vector<T>;

//here begins your code
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  unsigned long T1,T2;
  unsigned long A1,A2,B1,B2;
  cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
  if(A1 * T1 + A2 * T2 == B1 * T1 + B2 * T2){
  	cout << "infinity" << endl;
  	return 0;
  }


  if(B1 * T1 + B2 * T2 > A1 * T1 + A2 * T2){
  	swap(A1,B1);
  	swap(A2,B2);
  	//A goes further in the end;
  }

  if(A1 * T1 > B1 * T1){
  	cout << 0 << endl;
  	return 0;
  }

  long diff_total = (A1 * T1 + A2 * T2) - (B1 * T1 + B2 * T2);
  long diff_erst = B1 * T1 - A1 * T1;
  if(diff_erst % diff_total == 0){
  	cout << diff_erst / diff_total * 2L << endl;
  }
  else{
  	cout << diff_erst / diff_total * 2L + 1L << endl;
  }

  return 0;
} 

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

#define REP(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define REPS(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define RREP(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define RREPS(i, n) for (int i = ((int)(n)); i > 0; i--)
#define IREP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define IREPS(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVISORT(v) sort(v.begin(), v.end(), greater<int>());
#define ALL(v) v.begin(), v.end()
#define MP(n, m) make_pair(n, m);

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using ll = long long;
using ul = unsigned long;

typedef long long ll;

template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

const int mod=1e9+7;

void printv(VI& v){
  REP(i,v.size()) cout << v[i] << " ";
  cout << endl;
}

int vtotal(VI& v){
  int total=0;
  REP(i,v.size()) total+=v[i];
  return total;
}

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

	int n;
	cin>>n;

  VI va;
  REP(i,n){
    int a;cin>>a;
    va.push_back(a);
  }

  int ans=0;
  // VI v(n,0);

  for(int i=n-1; i>=0; i--){
    int bairitu=2;
    for(int j=(i+1)*bairitu;j<=n;j=(i+1)*++bairitu){
      va[i]^=va[j-1];
    }
  }

  REP(i,n){
    ans+=va[i];
  }

  cout << ans << endl;
  REP(i,n){
    if(va[i]==1) cout << i+1 << " ";
  }
  cout << endl;

  // REP(i,n){
  //   int now=n-i-1;

  //   int total=0;
  //   int bairitu=2;
  //   for(int j=(now+1)*bairitu;j<=n;j*=(bairitu++)){
  //     // cout << j << endl;
  //     total+=v[j-1];
  //   }
  //   // cout << total << endl;
  //   // bool flg = (total%2)!=va[now];cout << flg <<endl;
  //   if((total%2)!=va[now]){
  //     v[now]++;
  //     ans++;
  //   }
  // }
  
  // cout << ans << endl;
  // REP(i,n){
  //   if(v[i]==1) cout << i+1 << " ";
  // }
  // cout << endl;
  return 0;
}

Measured memory_bytes: 1908
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
int a;
char s[1000];
int main() {
	//freopen("1.txt","r",stdin);
	read(a); scanf("%s",s+1);
	if (a>=3200) printf("%s\n",s+1);
	else printf("red\n");
	return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
ans = 0
cnt = 0
pre = h[0]
for hh in h[1:]:
	if pre >= hh:
		cnt += 1
	else:
		ans = max(ans, cnt)
		cnt = 0
	pre = hh
ans = max(ans, cnt)
print(ans)


Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define ll long long

using namespace std;
long mod = 1000000007;

signed main() {
	int n;
	string l1, l2;
	vector<bool> k;
	cin >> n;
	cin >> l1;
	cin >> l2;
	for (size_t i = 0; i < n; i++) {
			if (l1[i] == l2[i]) {
			k.push_back(true);
		} else {
			k.push_back(false);
			i += 1;
		}
	}
	long t = k.at(0) ? 3 : 6;
	for (size_t i = 0; i < k.size(); i++) {
		// cout << k.at(i);
	}
	for (size_t i = 0; i + 1 < k.size(); i++) {
		bool c1 = k.at(i);
		bool c2 = k.at(i + 1);
		// cout << (c1 ? "a" : "b") << ":" << (c2 ? "a" : "b") << endl;
		if (c1 && c2) {
			t = (t * 2) % mod;
		} else if (c1 && !c2) {
			t = (t * 2) % mod;
		} else if (!c1 && c2) {
			t = (t * 1) % mod;
		} else {
			t = (t * 3) % mod;
		}
	}
	cout << t << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
constexpr ll INF = 1ll << 55;

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

// multi-dimensional vector (require c++14)
template <typename T, typename U>
static inline vector<U> make_nd_vector(T &&n, U &&val) noexcept {
  static_assert(is_integral<T>::value,
                "[make_nd_vector] 1st argument must be an integer type");
  return vector<U>(forward<T>(n), forward<U>(val));
}
template <typename T, typename... Args>
static inline decltype(auto) make_nd_vector(T &&n, Args &&... args) noexcept {
  static_assert(is_integral<T>::value,
                "[make_nd_vector] 1st argument must be an integer type");
  return vector<decltype(make_nd_vector(forward<Args>(args)...))>(
      forward<T>(n), make_nd_vector(forward<Args>(args)...));
}
//
// Print from Iterator
template <typename ite>
void print_ite(ite start, ite end, char sp = ' ', char en = '\n') {
  for (auto i = start; i != end; i++)
    cout << *i << sp;
  cout << en;
}
//
inline void Yes(bool condition) { cout << (condition ? "Yes\n" : "No\n"); }

int main() {
  ll n;
  cin >> n;
  string ans;
  while (n > 0) {
    n--;
    ans.push_back(char('a' + n % 26));
    n /= 26;
  }
  reverse(all(ans));
  cout << ans << endl;
}


Measured memory_bytes: 3096
#include<iostream>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>

using namespace std;

string InputStr, StrNow;
map<string, int> DpResult;


bool isAllSame() {
	int size;

	size = StrNow.size();
	for (int i = 1; i < size; i++) {
		if (StrNow[0] != StrNow[i]) {
			return false;
		}
	}
	return true;
}

bool solve() {
	int size;
	string strPrev;
	queue<string> CurrentStr;

	DpResult[InputStr] = 0;
	CurrentStr.push(InputStr);

	while (!CurrentStr.empty()) {
		StrNow = strPrev = CurrentStr.front();
		CurrentStr.pop();

		//cout << "befor:" << strPrev << endl;
		size = StrNow.size() - 1;
		for (int i = 0; i < size; i++) {
			StrNow = strPrev;
			if ((StrNow[i] == 'r' && StrNow[i + 1] == 'g') || (StrNow[i] == 'g' && StrNow[i + 1] == 'r')) {
				StrNow[i] = StrNow[i + 1] = 'b';
			}
			else if ((StrNow[i] == 'r' && StrNow[i + 1] == 'b') || (StrNow[i] == 'b' && StrNow[i + 1] == 'r')) {
				StrNow[i] = StrNow[i + 1] = 'g';
			}
			else if ((StrNow[i] == 'g' && StrNow[i + 1] == 'b') || (StrNow[i] == 'b' && StrNow[i + 1] == 'g')) {
				StrNow[i] = StrNow[i + 1] = 'r';
			}

			//cout << "after:" << StrNow << endl;
			if (DpResult.find(StrNow) == DpResult.end()) {
				CurrentStr.push(StrNow);
				DpResult[StrNow] = DpResult[strPrev] + 1;
			}

			if (isAllSame()) {
				return true;
			}
		}
	}

	return false;
}

int main() {

	while (cin >> InputStr, InputStr[0] != '0') {
		//cout << InputStr << endl;
		DpResult.clear();		
		if (solve()) {
			cout << DpResult[StrNow] << endl;
		}
		else {
			cout << "NA" << endl;
		}
	}

	return 0;
}




Measured memory_bytes: 4632
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

def max(a,b)
  return a>b ? a : b
end
def min(a,b)
  return a>b ? b : a
end
class SD
  attr_accessor:data,:n,:n_sqrt,:lazy,:lazyF
  def initialize(n)
    @n_sqrt=(n**0.5).to_i
    @n=(n+@n_sqrt-1)/@n_sqrt
    @data=array(@n*@n_sqrt,1,2**31-1)
    @lazy=array(@n,1,0)
    @lazyF=array(@n,1,false) 
  end

  def lazy_eval(i)
    if @lazyF[i]
      @lazyF[i]=false
      @n_sqrt.times do|k|
        @data[i*@n_sqrt+k]=@lazy[i]
      end
    end
  end
  def update(s,t,x)
    @n.times do|i|
      l=i*@n_sqrt
      r=l+@n_sqrt
      next if r<=s or t<=l
      if s<=l and r<=t
        @lazy[i]=x
        @lazyF[i]=true
      else
        lazy_eval(i)
        for j in max(s,l)..min(t,r)-1
          @data[j]=x
        end
      end
    end
  end

  def find(i)
    lazy_eval(i/@n_sqrt)
    return @data[i] 
  end
end
n,q=get_i
sd=SD.new(n)
q.times do
  que=get_i
  case que[0]
  when 0 then
    s=que[1]
    t=que[2]
    x=que[3]
    sd.update(s,t+1,x)
  when 1 then
    puts sd.find(que[1])
  end
end


Measured memory_bytes: 7840
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<list>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {1, 1, 0, -1, -1, 0};
int dx[] = {1, 0, -1, -1, 0, 1};
#define ceil(a, b) a / b + !!(a % b)

void solve(int n) {
    int t[n][n + 1];
    rep(i, n) rep(j, n + 1) cin >> t[i][j];
    int dp[(1 << n)];
    rep(i, (1 << n)) dp[i] = inf;
    dp[0] = 0;
    rrep(i, 1, (1 << n)) {
        rep(next, n) {
            int now = i & ~(1 << next);
            int tmp = t[next][0];
            //0列は必ず使える
            //あとはnowのbit立ってるやつ(クリアしたの)
            rep(j, n) {
                if (now & (1 << j)) {
                    tmp = min(tmp, t[next][j + 1]); //careful for index!!
                }
            }
            dp[i] = min(dp[i], dp[now] + tmp);
        }
    }
    cout << dp[(1 << n) - 1] << endl;
    return;
}
int main() {
    int n;
    while (cin >> n && n) {
        solve(n);
    }
    return 0;
}



Measured memory_bytes: 3264
from collections import deque
import sys
input = sys.stdin.readline
N = int(input())
T = []
D = [0]*N
V = [[] for _ in range(N)]
argmax = 0
for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    D[a] += 1
    D[b] += 1
    if D[argmax] < D[a]:
        argmax = a
    if D[argmax] < D[b]:
        argmax = b
    T.append((a, b))
    V[a].append(b)
    V[b].append(a)

K = D[argmax]
Q = deque([])
C = dict()
for i, v in enumerate(V[argmax]):
    C[tuple(sorted([argmax, v]))] = i+1
    Q.append((v, i+1))

check = [0]*N
check[argmax] = 1
while Q:
    v, color = Q.popleft()
    check[v] = 1
    i = 0
    for u in V[v]:
        if check[u]:
            continue
        i += 1
        if i == color:
            i += 1
        C[tuple(sorted([u, v]))] = i
        Q.append((u, i))

print(K)
for i in range(N-1):
    print(C[T[i]])
        

Measured memory_bytes: 92960
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		List<String> sl = Arrays.asList(s.split(""));
		List<String> tl = Arrays.asList(t.split(""));
		Collections.sort(sl);
		Collections.sort(tl);
		Collections.reverse(tl);
		boolean able = false;
		for (int i = 0; i < ((sl.size() <= tl.size())? sl.size() : tl.size()); i++) {
			if (sl.get(i).compareTo(tl.get(i)) < 0) {
				able =true;
				break;
			}
			else if (sl.get(i).compareTo(tl.get(i)) > 0) {
				break;
			}
			else if (sl.size() < tl.size() && i == sl.size() - 1) {
				able = true;
			}
		}
		System.out.println((able)? "Yes" : "No");
	}
}

Measured memory_bytes: 21844
s = gets.chomp
a,z=0,0
s.each_char.with_index do |c, i|
  if c == 'A'
    a = i
    break
  end
end
s.reverse.each_char.with_index do |c, i|
  if c == 'Z'
    z = s.size - i
    break
  end
end
puts z - a


Measured memory_bytes: 2428
def main():
    
    kinds = list(map(int,input().split()))
    prices = list(map(int,input().split()))
    
    minPrice = 0
    
    for item in range(kinds[1]):
        minPrice += min(prices)
        prices.remove(min(prices))

    print(minPrice)         
    
  

if __name__ == "__main__":
    main()

Measured memory_bytes: 9100
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define umap unordered_map
#define all(v) v.begin(),v.end()
#define st first
#define nd second
#define ln '\n'
#define MAX 1000000009
#define MOD 1000000007
#define N 500005
using namespace std;
typedef long long ll;
typedef pair<ll ,ll> pii;
ll n, k, m;
int main(){
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    cin >> n >> k >> m;
    if(m < k + n){
        cout << "No";
        return 0; 
    }
    if((k * n * 4) < (m - k - n) * (m - k - n)) {
        cout << "Yes";
    }
    else cout << "No";
}

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

using namespace std;

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

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

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

struct Data {
    pll g;
    ll h;
};

Data D[105];

int main() {
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> D[i].g.first >> D[i].g.second >> D[i].h;
    }
    sort(D, D + N, [](Data a, Data b) { return a.h > b.h; });

    for (ll x = 0; x <= 100; ++x) {
        for (ll y = 0; y <= 100; ++y) {
            ll h = D[0].h + abs(D[0].g.first - x) + abs(D[0].g.second - y);
            if (h < 1)
                continue;
            bool exist = true;
            REP(i, N) {
                ll th = std::max(0LL, h - abs(D[i].g.first - x) - abs(D[i].g.second - y));
                if (D[i].h != th) {
                    exist = false;
                    break;
                }
            }
            if (exist) {
                cout << x << " " << y << " " << h << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
long long a[100000+10];
bool cmp(long long a,long long b)
{
	return a>b;
}
int main()
{
	long long n;
	cin>>n;
	long long s1=0,s2=0;
	bool flag=false;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n,cmp);
	for(int i=0;i<n;i++)
	{
		if(a[i]==a[i+1]&&!flag)
		{
			flag=true;
			s1=a[i];
			i++;
			continue;
		}
		if(a[i]==a[i+1]&&flag)
		{
			s2=a[i];
			break;
		}
	}
	long long ans=s1*s2;
	if(s1&&s2)
		cout<<ans;
	else
		cout<<0;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define N 2010
#define M 200010
#define pb push_back
vector<int> v[N];
int vis[N],c[N],X[M],Y[M],G1[N][N],G2[N][N];
inline int read() {
    int x=0;
    char ch=getchar();
    while (!isdigit(ch)) ch=getchar();
    while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
    return x;
}
inline void dfs1(int x,int st) {
    vis[x]=true,G1[st][x]=true;
    for (auto y:v[x]) if (!vis[y]) dfs1(y,st);
}
inline void dfs2(int x,int col,int k,int st) {
    if (k) G2[st][x]=(c[x]!=col); else c[x]=col;
    vis[x]=true; for (auto y:v[x]) if (!vis[y]) dfs2(y,col,k,st);
}
int main() {
    int n=read(),m=read();
    for (int i=1;i<=m;i++) {
        int x=read(),y=read();
        v[x].pb(y),X[i]=x,Y[i]=y;
    }
    for (int i=1;i<=n;i++) {
        memset(vis,0,sizeof(vis)),dfs1(i,i);
    }
    for (int i=1;i<=n;i++) {
        memset(vis,0,sizeof(vis)),vis[i]=true;
        memset(c,0,sizeof(c));
        for (int j=0;j<v[i].size();j++) 
            if (!vis[v[i][j]]) dfs2(v[i][j],j+1,0,i);
        memset(vis,0,sizeof(vis)),vis[i]=true;
        for (int j=v[i].size()-1;j>=0;j--)
            if (!vis[v[i][j]]) dfs2(v[i][j],j+1,1,i);
    }
    // for (int i=1;i<=n;i++,putchar('\n'))
        // for (int j=1;j<=n;j++) printf("%d ",G1[i][j]);
    for (int i=1;i<=m;i++) puts(G1[Y[i]][X[i]]^G2[X[i]][Y[i]]?"diff":"same");
    return 0;
}

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

#define ll long long

#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl

#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000000000000
#define PI 3.14159265358979323846L

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


    ll n,a,b;
    cin >> n >> a >> b;

    ll ans1 = min(a,b);

    ll ans2 = a+b-n;

    if(ans2<0)
    	ans2 = 0;

    cout << ans1 << " " << ans2 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#define rep(i,n) for(int i = 0;i < (n); ++i)
using namespace std;
using P = pair<int,int>;
using ll = long long;
int main() {
    int x,n;
    cin >> x >> n;
    vector<int> d(102);
    rep(i,n){
        int p;
        cin >> p;
        d[p] = 1;
    }
    P ans(99999,-1);
    for(int i=0;i<=101;++i){
        if(d[i] == 1){
            continue;
        }
        int dif = abs(x-i);
        ans = min(ans, P(dif,i));
    }
    cout << ans.second << endl;
    return 0;
}

Measured memory_bytes: 3604
A, B, C = map(int, input().split())
ans = 0

mn = min(A, C)
ans += mn
A -= mn
C -= mn

mn = min(B, C)
ans += 2 * mn
B -= mn
C -= mn
if C > 0:
    ans += 1
elif B > 0:
    ans += B
print(ans)


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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

/* template */
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) \
    sort(all(x));  \
    (x).erase(unique(all(x)), (x).end())
#define int long long

/* function */
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

/* const */
const int inf = 1e9 + 7;

/* main */
signed main(void)
{
    int n, m, c;
    cin >> n >> m >> c;
    int cnt = 0;
    vector<int> b(m);
    rep(i, m)
    {
        cin >> b[i];
    }
    int tmp;
    int a[n][m];
    rep(i, n)
    {
        tmp = 0;
        rep(j, m)
        {
            cin >> a[i][j];
            tmp += a[i][j] * b[j];
        }
        tmp += c;
        if (tmp > 0)
        {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

#define x first
#define y second
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

template <typename T> inline int Chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline int Chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }
template <typename T> T read ()
{
	T sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
	return sum * fl;
}

inline void proc_status()
{
	ifstream t ("/proc/self/status");
	cerr << string (istreambuf_iterator <char> (t), istreambuf_iterator <char> ()) <<endl;
}

const int Maxn = 3000 + 100, Maxm = 2e5 + 100, Mod = 1e9 + 7;

int H, W, N;
int Dp[Maxm], fac[Maxm], ifac[Maxm];
pii A[Maxn];

inline int Pow (int a, int b)
{
	int ans = 1;
	for (int i = b; i; i >>= 1, a = (LL)a * a % Mod) if (i & 1) ans = (LL)ans * a % Mod;
	return ans;
}

inline void Init (int maxn)
{
	fac[0] = 1;
	for (int i = 1; i <= maxn; ++i) fac[i] = (LL)fac[i - 1] * i % Mod;
	ifac[maxn] = Pow(fac[maxn], Mod - 2);
	for (int i = maxn - 1; i >= 0; --i) ifac[i] = (LL)ifac[i + 1] * (i + 1) % Mod;
}

inline int Binom (int n, int m)
{
	if (n < m) return 0;
	return (LL)fac[n] * ifac[m] % Mod * ifac[n - m] % Mod;
}

inline void Add (int &a, int b)
{
	a += b;
	if (a >= Mod) a -= Mod;
}

inline void Solve ()
{
	sort(A + 1, A + N + 1);
	for (int i = 1; i <= N; ++i)
	{
		Dp[i] = Binom(A[i].x + A[i].y - 2, A[i].x - 1);
		for (int j = 1; j < i; ++j)
		{
			if (A[i].y < A[j].y) continue ;
			int x = A[i].x - A[j].x, y = A[i].y - A[j].y;
			Add (Dp[i], Mod - (LL)Dp[j] * Binom (x + y, x) % Mod);
		}
	}
	cout<<Dp[N]<<endl;
}

inline void Input ()
{
	H = read<int>(), W = read<int>(), N = read<int>();
	for (int i = 1; i <= N; ++i) A[i].x = read<int>(), A[i].y = read<int>();
	A[++N].x = H, A[N].y = W;
}

int main()
{
#ifdef hk_cnyali
	freopen("Y.in", "r", stdin);
	freopen("Y.out", "w", stdout);
#endif
	Init(2e5);
	Input();
	Solve();
	return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string s;
  bool used[26]={};
  cin>>s;
  if(s.size()<26){
      for(int i=0;i<s.size();i++){
          used[s[i]-'a']=true;
      }
      for(int i=0;i<26;i++){
          if(!used[i]){
              cout<<s<<(char)('a'+i)<<endl;
              return 0;
          }
      }
  }
  else{
      for(int i=24;i>=0;i--){
          if(s[i]<s[i+1]){
              char c=s[i+1];
              for(int j=i+1;j<26;j++){
                  if(s[j]>s[i]) c=min(c,s[j]);
              }
              cout<<s.substr(0,i)<<c<<endl;
              return 0;
          }
      }
      cout<<-1<<endl;
  }
  
}

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

int main() 
{
    long long int a,b,x;
    cin >>a >>b >>x;
    long long int ans;
    if(a==0&&b%x==0)
    {
        ans=(b/x)+1;
        cout <<ans <<endl;
        return 0;
    }
    if(a==0)
    {
        ans=b/x+1;
        cout << ans <<endl;
        return 0;
    }
    else    
    {
        ans=(b/x+1)-(((a-1)/x)+1);
    }   
   cout << ans <<endl;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<vector<int>> data(N,vector<int>(2));
  for(int i=0;i<N;i++){
    cin >> data.at(i).at(0) >> data.at(i).at(1);
  }
  
  vector<int> order(N);
  for(int i=0;i<N;i++){
    order.at(i)=i;
  }
  
  long double sum=0.0;
  double c=0.0;
  
  do{
    for(int i=0;i<N-1;i++){
      int p1,p2;
      p1=order.at(i);
      p2=order.at(i+1);
      sum+=sqrt(pow(data.at(p1).at(0)-data.at(p2).at(0),2)+pow(data.at(p1).at(1)-data.at(p2).at(1),2));
    }
    c+=1.0;
  }while (next_permutation(order.begin(), order.end()));
  cout << fixed << setprecision(7);
  cout << sum/c;
}


Measured memory_bytes: 3740
#include<stdio.h>
#define N 20
#define Q 200

int a[N],s,n;

int solve(int i,int m){
  if(i<=n){
    if(m==0){
      s=1;
      return 1;
    }
    if(m<0)return 0;
    if(solve(i+1,m)==1)return 1;
    if(solve(i+1,m-a[i])==1)return 1;
  }
  return 0;
}

int main(){
  int i,q,m[Q];
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&a[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++)scanf("%d",&m[i]);
  
  for(i=0;i<q;i++){
    s=0;
    solve(s,m[i]);
    if(s==1) printf("yes\n");
    
    else printf("no\n");
    
  }
  return 0;
}

Measured memory_bytes: 580
/*Author
   SaJiB */

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


#define pb   push_back
#define fi   first
#define se   second
#define all(x)    x.begin(),x.end()

#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

typedef long long int ll;
typedef unsigned long long int ull;
const double pi = 2.0*acos(0.0);

#define IOS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)

char small[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'} ;

ll big_mod(ll BASE, ll POWER, ll MOD){

    if(POWER == 0) return 1;
    else if(POWER %2 ==0){
        ll RESULT = big_mod(BASE,POWER/2,MOD);
        return ((RESULT % MOD)*(RESULT % MOD))% MOD;
    }
    else return ((BASE % MOD)*(big_mod(BASE,POWER-1,MOD)% MOD))% MOD;

}

int main(){

double n,d;
cin>>n>>d;

int ans = 0 ;

while(n--){

    double a,b;

    cin>>a>>b;

    double p = sqrt(((a*a)+(b*b)));
    if(p<=d) ans++;

}
cout<<ans<<endl;
}



Measured memory_bytes: 3804
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int monsterNum = sc.nextInt();
		int ultimate = sc.nextInt();
		List<BigDecimal> monsterList = new ArrayList<>();
		for (int i = 0; i < monsterNum; i++) {
			monsterList.add(sc.nextBigDecimal());
		}

		monsterList.sort((x, y) -> y.compareTo(x));

		BigDecimal anser = monsterList.stream()
				.skip(ultimate)
				 .reduce((a, b) -> a.add(b)).orElse(new BigDecimal(0));
		System.out.println(anser.toString());

	}
}


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

using usize = ::std::size_t;
using u64 = ::std::uint_least64_t;

int main(int argc, char *argv[])
{
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    u64 N;
    cin >> N;
    
    cout << ceil((double) N / 1000) * 1000 - N << endl;
    
    
    return 0;
}


Measured memory_bytes: 3800
//arc068_c.cpp
//Sat Jun  9 11:51:22 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;

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

	ll ans = n/11;
	ll modans = n%11;
	if (modans > 6){
		ans = ans*2 + 2;
	}else if (modans > 0){
		ans = ans*2 + 1;
	}else {
		ans = ans*2;
	}


	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#define MAX_N 10000

using namespace std;

int N;
int k[MAX_N];
int main()
{
	while (cin>>N&&N) {
		int ans=N+1,t;
		bool check=true;
		for (int i=0; i<N; i++) {
			cin>>t;
			if (t==0) ans--;
			else if (t>1) check=false;
		}
		if (check) {
			cout<<"NA"<<endl;
		} else {
			cout<<ans<<endl;
		}
	}
}

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

int main() {
  // ここにプログラムを追記
  int a, b, c, d, l, r;
  cin >> a >> b >> c >> d;
  l = a + b;
  r = c + d;
  if(l > r){
    cout << "Left" << endl;
  }
  else if(l == r){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
inline ll read()
{
	ll x=0,w=0;char ch=getchar();
	while(!isdigit(ch))w|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w?-x:x;
}
ll a,b;
inline ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
int main()
{
    a=read(),b=read();a=gcd(a,b);
    reg ll i,ans=1;
    for(i=2;i*i<=a;++i)
    {
        if(a%i)continue;
        ans++;while(a%i==0)a/=i;
    }if(a>1)ans++;
    cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int a,b;
    cin >> a >> b;
    if(a > 8 || b > 8) cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}

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

int main()
{
	string s;
	cin>>s;
	
	int n = s.size();
	
	
		if(s[n-1]=='s')
	{
		cout<<s<<'e'<<'s'<<endl;
	}
	else
	{
		cout<<s<<'s'<<endl;
	}
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;
 /*temp*/
 
 
int main(){
	int a, b;
	cin >> a >> b;
	cout << "a ";
	if(a < b)
		cout << "<";
	else if(a == b)
		cout << "==";
	else if(a > b)
		cout << ">";
	cout << " b\n";
	return 0;
}

Measured memory_bytes: 3052
/*
AizuOnline A2407
Simple Othello
*/
#include <stdio.h>
#include <string.h>

char stones[51];



char hantei()
{
  int i;
  int cnt=0;
  for(i=0;i<strlen(stones)-1;i++)
    if(stones[i] != stones[i+1])
      cnt++;

  if((cnt & 1)==0)
    return(stones[0]);
  else
    return('o');
}

main()
{
  char res;

  scanf("%s",stones);
  res=hantei();
  printf("%c\n",res);
return(0);
}

Measured memory_bytes: 536
#include <iostream>
using namespace std;
int main() {
	
	int min = 1000001, max = -1000001, n, m;
	long sum = 0;
	cin >> n;
	
	for (int i = 1; i <= n; i++) {
		cin >> m;
		if (m > max) {
			max = m;
		}
		if (m < min) {
			min = m;
		}
		sum += m;
	}
	cout << min << " " << max << " " << sum << endl;
	
	return 0;
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;

using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};



int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n, res = 0;
  cin >> n;
  vector<ll> h(n);
  vector<ll> dp(n,0);
  REP(i,n) cin >> h[i];
  RREP(i,n-1){
    if(h[i]>=h[i+1]) dp[i]=dp[i+1]+1;
  }
  sort(ALL(dp),greater<ll>());
  cout<<dp[0];
  return 0;
}

Measured memory_bytes: 1792
n = int(input())
b = [int(i) for i in input().split()]
a = [0 for i in range(n)]

for i in range(len(b)+1):
    if i ==0:
        a[i] = b[i]
    elif i == len(b):
        a[i] = b[i-1]
    
    else:
        a[i] = min(b[i],b[i-1])
    
    
print(sum(a))  
    

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

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> costs(M);
  int sums=0;
  for(int i=0;i<M;i++){
    cin >> costs[i];
    sums += costs[i];
  }
  
  if(N-sums < 0){
    cout << -1 << endl;
  } else {
    cout << N - sums << endl;
  }
}


Measured memory_bytes: 3644
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  int ca=0,cb=0;
  cin>>s;
  int n= s.length();
  char b[2] = {'0', '1'};
  for(int i=0;i<n;i++){
    //cout<<s[i]<<": ";
    if(s[i]!=b[i%2]){
      ca++;
      //cout<<b[i%2];
    }
    if(s[i]!=b[(i+1)%2]){
      cb++;
      //cout<<b[(i+1)%2];
    }
    //cout<<endl;
  }
  cout<<(ca<cb?ca:cb);
  return 0;
}


Measured memory_bytes: 512
from collections import defaultdict
import itertools

N = int(input())

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

dic = defaultdict(int)

for num in L:
    dic[num] += 1

set_L = set(L)

comb = list(itertools.combinations(set_L, 3))

ans = 0
for a,b,c in comb:
    if a+b <= c or b+c<=a or c+a <= b: continue
    ans += dic[a] * dic[b] * dic[c]

print(ans)


Measured memory_bytes: 86376
import java.util.*;

class XCubic {
    public static void main(String...args) {
        final Scanner sc = new Scanner(System.in);
        final int x = sc.nextInt();
        System.out.println(x * x * x);
    }
}

public class Main {
    public static void main(String... args) {
        XCubic.main();
    }
}

Measured memory_bytes: 17324
#include<bits/stdc++.h>
#include<string.h>
#include<math.h>
#include<limits.h>
#include<stdlib.h>
#include<sstream>
#define FastRead                      \
                        ios_base::sync_with_stdio(false); \
                        cin.tie(0);
#define endl "\n"
using namespace std;
int main()

{
    FastRead
    char a;
    cin>>a;
    if(islower(a))
        cout<<"a";
    else
        cout<<"A";
    return 0;

}





Measured memory_bytes: 3644
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int N=1e6+5;
int F[N],inv[N];
int mod(ll x){
	while(x<0)
		x+=INF;
	return (x%INF);
}
int Fe(int x,int y){
	if(!y)
		return 1;
	int h=Fe(x,y/2);
	h=mod(h*1LL*h);
	if(y&1)
		h=mod(h*1LL*x);
	return h;	
}
int C(int x,int y){
	//~ printf("C(%d,%d) = %d\n"x,y,mod(F[x]*1LL*mod(inv[y]*1LL*inv[x-y])));
	return mod(F[x]*1LL*mod(inv[y]*1LL*inv[x-y]));
}
int main(){
    //~ freopen("file.in", "r", stdin);
    int n;
    scanf("%d",&n);
    if(n==2)
		return 0*puts("1");
	if(n==3)
		return 0*puts("4");
	inv[0]=F[0]=1;
	for(int i=1;i<N;i++)
		F[i]=mod(F[i-1]*1LL*i);
	inv[N-2]=Fe(F[N-2],INF-2);
	for(int i=N-3;i>=1;i--)
		inv[i]=mod(inv[i+1]*1LL*(i+1));
	int ans=F[n];
	for(int k=(n+1)/2;k<n;k++)
		ans=mod(ans-mod(C(k-1,n-1-k)*1LL*mod(F[k]*1LL*F[n-1-k])));
	printf("%d\n",ans);	
	return 0;
}


Measured memory_bytes: 8064
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000
vector<int>e[N];

int solve(int x) {
	if (e[x].size() == 0)return 0;
	vector<int>b;
	int y;
	f(i, e[x].size()) {
		y = solve(e[x][i]);
		b.push_back(y);
	}
	sort(b.begin(), b.end(), greater<int>());
	y = 0;
	f(i, b.size()) {
		y = max(b[i] + i + 1, y);
	}
	return y;
}


int main() {
	int a[N];
	f(i, N)a[i] = 0;
	int n, k;
	int x, y, z;
	int s, ans;
	bool v = true;
	ans = 0;
	scanf("%d", &n);
	f(i, n-1) {
		scanf("%d", &x);
		e[x - 1].push_back(i + 1);
	}
	ans = solve(0);

	printf("%d\n", ans);


	return 0;
}

Measured memory_bytes: 17408
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);}
#define printe(...) fprintf(stderr, __VA_ARGS__);
#define PrtExp(_Exp)  cerr<< #_Exp <<" = "<< (_Exp)
#define PrtExpN(_Exp)  cerr<< #_Exp <<" = "<< (_Exp) <<"\n"

#define SINT(n) scanf("%d",&n)
#define SINT2(n,m) scanf("%d %d",&n,&m)
#define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o)
#define SINT4(n,m,o,p) scanf("%d %d %d %d",&n,&m,&o,&p)
#define SINT5(n,m,o,p,q) scanf("%d %d %d %d %d",&n,&m,&o,&p,&q)
#define SLL(n) scanf("%lld",&n)
#define SLL2(n,m) scanf("%lld %lld",&n,&m)
#define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o)
#define SST(s) scanf("%s",s)
#define SCH(c) scanf("%c",&c)

#define GC() getchar()

#define PINT(n) printf("%d",(int)(n))
#define PINT2(n,m) printf("%d %d",(int)(n),(int)(m))
#define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l))
#define PLL(n) printf("%lld",(long long)(n))
#define PST(s) printf("%s",(s))
#define PCH(s) printf("%c",(s))

#define PINTN(n) printf("%d\n",(int)(n))
#define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m))
#define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l))
#define PLLN(n) printf("%lld\n",(long long)(n))
#define PSTN(s) printf("%s\n",(s))
#define PCHN(s) printf("%c\n",(s))

#define PSP() printf(" ")
#define PN() printf("\n")

#define PC(c) putchar(c)
#define CSP (' ')
#define SN ("\n")

#define rep(i,a) for(int i=0;i<a;i++)
#define reP(i,a) for(int i=0;i<=a;i++)
#define Rep(i,a) for(int i=a-1;i>=0;i--)
#define ReP(i,a) for(int i=a;i>=0;i--)

#define rEp(i,a) for(i=0;i<a;i++)
#define rEP(i,a) for(i=0;i<=a;i++)
#define REp(i,a) for(i=a-1;i>=0;i--)
#define REP(i,a) for(i=a;i>=0;i--)

#define repft(i,a,b) for(int i=a;i<b;i++)
#define repfT(i,a,b) for(int i=a;i<=b;i++)
#define Repft(i,a,b) for(int i=a-1;i>=b;i--)
#define RepfT(i,a,b) for(int i=a;i>=b;i--)

#define foreach(a,it) for(auto it = a.begin(); it != a.end(); ++it)

#define FILL(a,v) fill(begin(a),end(a), v)
#define FILL0(a) memset(a,0,sizeof(a))
#define FILL1(a) memset(a,-1,sizeof(a))

typedef long long ll;

typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll>   Pll;


const int INF = 0x2aaaaaaa; // 715,827,882
const ll INFLL = 0x1f1f1f1f1f1f1f1fLL;//2,242,545,357,980,376,863

template <class A, class B> inline ostream& operator<<(ostream& st, const pair<A, B>& P) { return st << "(" << P.first << "," << P.second << ")"; };
template <class A, class B> inline pair<A, B> operator+(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first + Q.first, P.second + Q.second); };
template <class A, class B> inline pair<A, B> operator-(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first - Q.first, P.second - Q.second); };

#define fs  first
#define sc  second




	
int main() {
	int a, b, c, d, e, k;
	int n, m, o, p, q, r;
	string s, t, u;


	cin >> n >> m >> k;

	reP(i, n)reP(j, m) {
		if (i*j+(n-i)*(m-j) ==k) {
			puts("Yes"); return 0;
		}
	}

	puts("No"); return 0;



	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define rep(i,x,n) for(int i=x;i<n;i++)
int main(){
  ll x,k,d;
  cin>>x>>k>>d;
  x=abs(x);
  if(k>(abs(x)/d)){
    k-=(abs(x)/d);
   
  x-=(abs(x)/d)*d;
    
   // cout<<(abs(x-d));
    if(k%2) cout<<min(abs(d-x),abs(x+d));
    else cout<<abs(x);
  //cout<<min(abs(x),abs(d-x));
  }
  else {
    cout<<x-k*d;
  }
  return 0;
}

Measured memory_bytes: 3608
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String n = scn.next();
		boolean feka = false;
		int nigger1=-1;
		int nigger2=-1;
		for(int i = 0;i<n.length()-2;i++) {
			if(n.charAt(i)==n.charAt(i+2)) {
				feka = true;
				nigger1=i+1;
				nigger2=i+3;
				break;
			}
			if(n.charAt(i)==n.charAt(i+1)) {
				feka = true;
				nigger1=i+1;
				nigger2=i+2;
				break;
			}
		}
		if(n.charAt(0)==n.charAt(1)) {System.out.println(1+" "+2);System.exit(0);;}
		if(feka) {
			System.out.println(nigger1+" "+nigger2);
		}else System.out.println(nigger1+" "+nigger2);
		scn.close();
	}
}

Measured memory_bytes: 24036
#include<bits/stdc++.h>
#define mid (l+r)/2
using namespace std;
const long long N=2e6+10,M=998244353;
long long n,k,ans;
long long sg[N],dp[N];
pair<long long,long long> a[N];
long long f[N];
string s;
void upd(long long node,long long s,long long e,long long i,long long val){
	 if(i < s || i > e)return;
	 if(s == e)sg[node]=val;
	 else {
	 	upd(node*2,s,(s+e)/2,i,val);
	 	
		upd(node*2+1,(s+e)/2+1,e,i,val);
		
		sg[node]=(sg[node*2]+sg[node*2+1])%M;	
     }
}
long long query(long long node,long long s,long long e,long long i,long long j){
	if(j < s || i > e)return 0;
	if(i <= s && j >= e)return sg[node];
	return (query(node*2,s,(s+e)/2,i,j)+query(node*2+1,(s+e)/2+1,e,i,j))%M;
}
void solve(){
    cin>>n>>k;
    for(long long i=1;i<=k;i++)cin>>a[i].first>>a[i].second;
    dp[1]=1;
    upd(1,1,n,1,1);
    for(long long i=2;i<=n;i++){
        for(long long j=1;j<=k;j++){
            if(i - a[j].second > 0){
                dp[i]=(dp[i]+query(1,1,n,i-a[j].second,i-a[j].first))%M;
            }
            else{
                dp[i]=(dp[i]+query(1,1,n,1,(i-a[j].first)))%M;
            }
        }
        upd(1,1,n,i,dp[i]);
    }
    cout<<dp[n]<<endl;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long t=1;
    //cin>>t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 9292