akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

bool isPrime(ll x){
            ll i;
            if(x < 2)return 0;
            else if(x == 2) return 1;
            if(x%2 == 0) return 0;
            for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
            return 1;
        }

signed main(void) 
{
    string s;
    cin >> s;
    ll r = 0;
    ll n = s.size();
    rep (i, n/2) {
        if (s[i] != s[n-i-1]) {
            s[n-i-1] = s[i];
            r ++;
        }
    }
    cout <<r;
    
   
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
signed main(){
	string s;
	cin>>s;
	if(s=="Sunny")puts("Cloudy");
	else if(s=="Cloudy")puts("Rainy");
	else puts("Sunny");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  ll long long int
#define ld  long double
#define dd double
#define endl '\n'
#define mo 100005
#define to 1000000007 
#define  fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tt int t; cin>>t; while(t--)
#define ff(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define pb push_back
#define ld long double
#define li cout<<endl;
#define fr(a,e) for(int i=a;i<e;i++)

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n; cin>>n;
    int a[n];
    fr(0,n)cin>>a[i];
    int ans=0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            for(int k=j+1;k<n;k++){
                if(a[i]!=a[j] && a[j]!=a[k] && 
                   a[k]!=a[i]){
                       if(a[i]+a[j]>a[k] && a[i]+a[k]>a[j]&&
                          a[j]+a[k]>a[i])ans++;
                   }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  int N, i, j;

  scanf("%d", &N);
  for(i=1; i<=9; i++) {
    for(j=1; j<=9; j++) {
      if(i*j == N) {
        printf("%s", "Yes");
        return 0;
      }
    }
  }
  printf("%s", "No");
  return 0;
}


Measured memory_bytes: 256
gets
nums = gets.split(" ").map(&:to_i).sort

ans = 0
nums.each_slice(2) do |(n, m)|
  ans += if m.nil?
           n
         elsif n >= 0
           n + m
         elsif m >= 0
           [n + m, -(n + m)].max
         else
           -(n + m)
         end
end

puts ans


Measured memory_bytes: 11444
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

void solve(){
    ll N; cin >> N;
    vector<ll> A(N),B(N);
    for(int i = 0; i < N;i++) cin >> A[i] >> B[i];
    ll cnt = 0;
    int f = 0;
    for(int i = 0; i < N;i++){
        if(A[i] < B[i]){
            cnt += A[i];
        }else if(A[i] > B[i]){
            f++;
        }
    }
    if(f){
        for(int i = 0; i < N;i++){
            if(A[i] == B[i]) cnt += A[i];
        }
        
        ll sumA = 0;
        for(int i = 0; i < N;i++){
            if(A[i] > B[i]){
                sumA += A[i];
            }
        }
        
        ll tmp = cnt;
        for(int i = 0; i < N;i++){
            if(A[i] > B[i]){
                cnt = max(cnt,tmp+(sumA-A[i]+A[i]-B[i]));
            }
        }
    }
    
    cout << cnt << endl;
}

int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main() {
	vector<int> a{ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	int k;
	cin >> k;
	cout << a[k-1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n;

int main() {
	while (cin >> n&&n) {
		ll k = 50;
		vector<string> vs;
		REP(i, n) {
			string s;
			cin >> s;
			//k = min((ll)s.size(), k);
			vs.push_back(s);
		}
		int ans = -1;
		for (int i = k; i > 0; i--) {
			bool f = 1;
			set<string> ss;
			REP(K, n) {
				string t = "";
				REP(j, vs[K].size()) {
					if (j == 0)t += vs[K][j];
					else {
						if (vs[K][j - 1] == 'a' || vs[K][j - 1] == 'i' ||
							vs[K][j - 1] == 'u' || vs[K][j - 1] == 'e' || vs[K][j - 1] == 'o') {
							t += vs[K][j];
						}
					}
					if (t.size() == i)break;
				}
				if (ss.find(t) != ss.end()) {
					f = 0;
					break;
				}
				ss.insert(t);
			}
			if (f)ans = i;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3128
<?php
error_reporting(0);
list($A,$B,$C,$D,$E,$F) = explode(" ",trim(fgets(STDIN)));
//$N = trim(fgets(STDIN));
$max_total = $F / 100;
$a_count = floor($max_total / $A);
for($i=0;$i<=$a_count;$i++) {
  $j=0;
  while(1) {
    if ($i==0 && $j==0) $j++;
    if (($i*$A + $j*$B) <= $max_total) {
      $w[]=$i*$A+$j*$B;
    }
    else {
      break;
    }
    $j++;
  }
}
$c_count = floor($F / $C);
for($i=0;$i<=$c_count;$i++) {
  $j=0;
  while(1) {
    if (($i*$C + $j*$D)<$F) {
      $s[]=$i*$C+$j*$D;
    }
    else {
      break;
    }
    $j++;
  }
}
$res = new stdClass();
$res->p=0;
$res->w=0;
$res->s=0;
foreach($s as $ss) {
  foreach($w as $ww) {
    if (($ss / ($ww*100 + $ss) <= $E / (100 +$E)) && (100*$ww + $ss <= $F)) {
      if ($res->p <= ($ss / ($ww*100 + $ss))) {
        $res->w = $ww*100+$ss;
        $res->s = $ss;
        $res->p = $ss / ($ww*100+$ss);
      }
    }
  }
}
printf("%d %d\n",$res->w,$res->s);


Measured memory_bytes: 39412
#include <bits/stdc++.h>
#include <string>
 
using namespace std;
using namespace std::chrono; 
 
 
 
//c++ templte for help...........................................................
 
//#define deb(x) cout<<#x<<" "<<x<<endl;/* for debuging  printing variable with name*/
//#define debb(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;										
//#define debbb(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;			
 
typedef long long ll;
typedef unsigned long long ull;
	
 
//for loop
//#define fo(i,n) for(int i=0;i<(ll)n;i++)
//#define Fo(i,k,n) for(int i=k;i<n;i++)
 
 
//to print vector element 
//template<typename T>
//void printV(T vec){
	//fo(i,vec.size()) cout<<vec[i]<<" "<<flush;
	//cout<<endl;
	//}
	
 
//#define modulo 1000000007
//const int INF=1e9+5;
 
//iterate map
//template<typename T>
//void itR(T map){
	 //for(auto itr=map.begin();itr!=map.end();itr++){
				//debb(itr->first,itr->second)
			//}
	//cout<<endl;
//}
 
 
 
//c++ template for help........................................................



int main() {
	//stringstream ss;
	//ss<<"akhil";
	//cout<<ss.str()<<endl;
	cout<<setprecision(50);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	 // TESTCASE KO DEKH KA BHAUT SARA CONDITION GENERATE MAT KRO 
	 // PAPER PD CONFIRM HO JAO THORA JADA TIME HI KYU NA LGA
	 // greedy ma jadatr exceptional case check kr ke dekh lo
	 
	 // WHILE DOING THE QUESTION OF DYNAMIC PROGRAMMING GREEDY KA TRAH SOCHNA BAND KRO
	 // DP M DATA KA BHI USE KRNA PDTA HA BE BHULO MT 
	 // DP BHI WO LEETCODE WALE MATRIX KA QUESTION KI TARAH HA
	 // CONSTRAIN WILL BE THE DIMENSION OF DP
	 // DP MA STATE PTA KRO AUR PHIR FUNCTION GENERATE KRO
	 // OBJECT KO CHOOSE KIA YA NAE KIA AGAR KIA TO KYA HOGA AUR NAE KIA TO KYA HOGA
	 // KYA KYA CHEJ IMPORTANT HA WO STATE BN JYAGA AUR HUM LOG STATE KO CHANGE KR SKTA HA JYSA KNPSACK 2 WALE PROBLEM MA KIA THA
	 

	 
	//ll testCase;
	//cin>>testCase;
	//for(ll tt=0;tt<testCase;tt++){
		ll n,m,x;
		ll mincost=1e9+5;
		cin>>n>>m>>x;
		
		vector<vector<ll>> vec(n,vector<ll>(m+1));
		for(ll i=0;i<n;i++){
			for(ll j=0;j<m+1;j++){
				cin>>vec[i][j];
			}
		}
		
		for(ll mask=0;mask<(1<<n);mask++){
			ll cost=0;
			vector<ll> v(m,0);
			for(ll i=0;i<n;i++){
				if(mask&(1<<i)){
					cost+=vec[i][0];
					for(ll j=0;j<m;j++){
						v[j]+=vec[i][j+1];
					}
				}
			}
			ll k=0;
			while(v[k]>=x and k<(ll)v.size()){
				k++;
			}
			if(k==v.size()) mincost=min(mincost,cost);
		}
		
		if(mincost!=1e9+5)
			cout<<mincost<<endl;
		else cout<<-1<<endl;

	//}
	
	return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[3],i,count=0,j;
	for(i=0;i<3;i++)
	{
	   cin>>a[i];
	}
	for(i=0;i<3;i++)
	{
			for(j=i+1;j<3;++j)
			{
			if(a[i]==a[j])
			count++;
		   	}		
	}
	if(count==1)
		cout<<"Yes";
	 else
		cout<<"No";	
}

Measured memory_bytes: 256
import java.util.*;

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

    String s = sc.next();
    String t = sc.next();

    char[] sChar = s.toCharArray();
    Map<Character, Alphabet> map = new HashMap<>();

    // Map生成
    for (int i = 0; i < sChar.length ; i++) {
      Alphabet a = map.get(sChar[i]);
      if (a == null) {
        map.put(sChar[i], new Alphabet(sChar[i], i));
      } else {
        a.addIndex(i);
      }
    }

    char[] tChar = t.toCharArray();

    int position = -1;
    long count = 0;
    int sCharLength = sChar.length;

    for(int i = 0; i < tChar.length ; i++){
      // System.out.print("index: i " + i + ", Alphabet:" + tChar[i] + ", Count:" + count);
      Alphabet a = map.get(tChar[i]) ;
      if(a == null){
        count = -1;
        break;
      }
      // System.out.print(",position" + position);
      int nextIndex = a.nextIndex(position);
      // System.out.println(", nextIndex"+ nextIndex);
      if(nextIndex <= position){
        count += (sCharLength - position) + nextIndex;
      } else {
        count += nextIndex - position;
      }
      position = nextIndex;
    }

    System.out.println(count);
  }

  public static class Alphabet {
    char alphabet;
    TreeSet<Integer> a = new TreeSet<Integer>();
    public Alphabet (char c, int index){
      this.alphabet = c;
      a.add(index);
    }

    public void addIndex (int index){
      a.add(index);
    }

    public int nextIndex(int index){
      Integer nextIndex = a.higher(index);
      if(nextIndex == null){
        return a.first();
      } else  {
        return nextIndex;
      }
    }
  }
}


Measured memory_bytes: 33888
s = input()
n = len(s)
up = []
down = []
parity = 0
for i in range(1,n):
  if s[i] != s[i-1]:
    if parity == 0:
      down.append(i)
    else:
      up.append(i)
    parity = 1 - parity
ans = [0 for i in range(n)]
#print(up,down)
for i in range(n):
  if s[i] == 'R':
    diff = down[0] - i
    if diff % 2 == 1:
      ans[down[0]-1] += 1
    else:
      ans[down[0]] += 1
  else:
    diff = i - down[0]
    if diff % 2 == 1:
      ans[down[0]-1] += 1
    else:
      ans[down[0]] += 1
  if up != []:
    if i+1 == up[0]:
      del down[0]
      del up[0]
ANS = list(map(str,ans))
print(' '.join(ANS))

Measured memory_bytes: 11000
#include<stdio.h>
#define N 200000

int main(){
  int i;
  int n,R[N];
  int max=-1000000000,min;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&R[i]);
  }

  min=R[0];

  for(i=1;i<n;i++){
    if(max<R[i]-min){
      max=R[i]-min;
    }
    if(min>R[i]){
      min=R[i];
    }
  }

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

  return 0;
}

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

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

  for(int i = 0; i <= N; i++){
    for(int j = 0; j <= M; j++){
      num = (N-i) * j + (M-j) * i;
      if(num == K){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <deque>
#include <valarray>
#include <unordered_map>
#include <unordered_set>
#include <array>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef vector<vc> vvc;
typedef vector<vb> vvb;
using P = pair<ll,ll>;
#define REP(i, n) for (ll i = 0; i < (int)(n); i++)
#define RREP(i, n) for (ll i = (int)(n)-1; i > -1 ; i--)
#define IN(T, x) T x;cin >> x;
#define AIN(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}
#define A2IN(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) SORT(a);reverse(ALL(a))
#define pb push_back
#define mp make_pair
#define PF first
#define PS second
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;}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
#define OUT(x) cout << x << endl;
#define OUTD(x) cout << fixed << x << endl;
#define BOUT(b) if(b){OUT("Yes");}else{OUT("No");}
const ll MOD = 1000000007;
const ll INF = 10e9;
#define PI 3.14159265369;
ll dx[4] = {1,-1,0,0};
ll dy[4] = {0,0,1,-1};
ll ddx[8] = {1,1,1,-1,-1,-1,0,0};
ll ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  IN(ll,N);
  IN(ll,K);
  AIN(ll,A,N);
  map<ll,ll> flag;
  flag[1] = 0;
  vll route = {1};
  ll circle;
  ll num;
  ll count = 0;
  ll i = 0;
  while(count < K){
    flag[A.at(i)];
    if(flag.size() != (count+2)){
      circle = count + 1 - flag[A.at(i)];
      num = count + 1 - circle + (K - count - 1)%circle;
      OUT(route.at(num));
      return 0;
    }else{
      flag[A.at(i)] = count+1;
      route.push_back(A.at(i));
      i = A.at(i) - 1LL;
      count++;
    }
  }
  OUT(route.at(K));
}

Measured memory_bytes: 15832
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 1010
#define EMPTY -20000000000
typedef long long ll;

ll n, m, maxn = EMPTY;
ll x[MAX_N][3];

int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> x[i][j];
        }
    }

    for (int i = 0; i < 8; i++)
    {
        vector<ll> vec;
        for (int j = 0; j < n; j++)
        {
            ll s = 0;
            for (int k = 0; k < 3; k++)
            {
                if ((i / (1 << k)) % 2 == 0)
                {
                    s += x[j][k];
                }
                else
                {
                    s -= x[j][k];
                }
            }
            vec.push_back(s);
        }
        sort(vec.begin(), vec.end()); reverse(vec.begin(), vec.end());
		ll ans = 0;
		for (int j = 0; j < m; j++) ans += vec[j];
		maxn = max(maxn, ans);
    }

    cout << maxn;

    return 0;
}

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

using namespace std;

int a[222222];
int main()
{
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		int b;
		scanf("%d", &b);
		a[b]++;
	}
	sort(a, a + n + 1, greater<int>());
	int r = 0;
	for (; k < n; k++)
		r += a[k];
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 1024
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

def main():
	n,m,k=MI()
	mod=10**9+7

	f=[1]
	for i in range(1,n*m+10):
		f.append((f[-1]*i)%mod)
	#print(f)

	finv=[]
	for i in f:
		finv.append(pow(i,mod-2,mod))
	#print(finv[:10])


	ans=0

	cnt=0
	for i in range(1,m):
		cnt+=i*(m-i)
		cnt%=mod
	ans+=n*n*cnt

	cnt=0
	for i in range(1,n):
		cnt+=i*(n-i)
		cnt%=mod
	ans+=m*m*cnt

	ans%=mod
	#print(ans)

	ans*=k*(k-1)
	ans%=mod

	ans*=f[n*m-2]*finv[n*m-2-(k-2)]
	ans*=finv[k]

	print(ans%mod)


















if __name__ == "__main__":
	main()


Measured memory_bytes: 94552
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>

using namespace std;

typedef long long ll;
typedef long double ld;

const ll M = 900000;
const ld X = 0.6;
const ld Y = 0.9999;
ll n;
ll x[55], y[55];
ld cx, cy;
ld now = X;

void f(ld p)
{
    ld mx = 0;
    ll mi = 0;
    for(ll i = 0; i < n; i++)
    {
        ld r = (cx - x[i]) * (cx - x[i]) + (cy - y[i]) * (cy - y[i]);
        if(mx < r) mx = r, mi = i;
    }
    cx += (x[mi] - cx) * p;
    cy += (y[mi] - cy) * p;
}

int main()
{
    scanf("%lld", &n);
    for(ll i = 0; i < n; i++)
    {
        scanf("%lld%lld", &x[i], &y[i]);
        cx += x[i];
        cy += y[i];
    }
//    cx /= n;
//    cy /= n;
    cx = x[0];
    cy = y[0];
    for(ll i = 0; i < M; i++)
    {
        f(now);
        now *= Y;
    }
    ld ans = 0;
    for(ll i = 0; i < n; i++)
    {
        ld r = (cx - x[i]) * (cx - x[i]) + (cy - y[i]) * (cy - y[i]);
        ans = max(ans, r);
    }
    printf("%.12Lf", sqrt(ans));
    return 0;
}


Measured memory_bytes: 384
n,a,b,c = [input() for i in range(4)]
counter = 0
for i in range(int(n)):
    if a[i] == b[i] != c[i]:
        counter += 1
    elif a[i] == c[i] != b[i]:
        counter += 1
    elif a[i] != b[i] == c[i]:
        counter += 1
    elif a[i] != b[i] != c[i]:
        counter += 2
print(counter)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N; cin >> N;
    int M; cin >> M;
    vector <int> seiseki(N);
    vector <int> ans_seiseki(N);

    for(int i = 0; i < N; i++){
        int tmp; cin >> tmp;
        seiseki[i] = tmp;
        ans_seiseki[i] = tmp;
    }

    for(int i = 0; i < M; i++){
        int A; cin >> A;
        int B; cin >> B;
        A --; B --;
        if(seiseki[A] == seiseki[B]){
            ans_seiseki[A] = 0;
            ans_seiseki[B] = 0;
        }
        if(seiseki[A] > seiseki[B]){
            ans_seiseki[B] = 0;
        }
        else{
            ans_seiseki[A] = 0;
        }
    }

    int ans = 0;
    for(int i = 0; i < N; i++){
        int tmp = ans_seiseki[i];
        if(tmp != 0) ans ++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 4032
// Aizu Vol0 0006: Reverse Sequence
// 2017.7.28

#include <stdio.h>
#include <string.h>

char *gets(char *);

int main()
{
	char buf[100], *p;

	gets(buf);
	p = buf + strlen(buf) - 1;
	while (p >= buf) putchar(*p--);
	putchar('\n');
	return 0;
}

Measured memory_bytes: 524
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	long long a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<max(max(a*c,a*d),max(b*c,b*d));
}

Measured memory_bytes: 3624
import java.io.*;
import java.util.List;
import java.util.StringTokenizer;

public class Main {

    int[] arr;

    int size;

    int swaps;

    public static void main(String[] args)
    {

        Main g = new Main();

        g.readArray();

        g.bubbleSort();

        g.printArray();

        System.out.println("\n" + g.swaps);
    }

    private void readArray() {

        InputReader reader = new InputReader(System.in);

        size = reader.nextInt();

        arr = new int[size];

        for(int i=0; i<size; ++i)
            arr[i] = reader.nextInt();
    }

    private void printArray() {

        PrintWriter writer = new PrintWriter(System.out);

        for(int i=0; i<size; ++i) {

            writer.write("" + arr[i]);

            if(i<size-1) writer.write(" ");
        }

        writer.flush();
    }


    private void bubbleSort() {

        boolean flag=false;

        for(int i=0; i<size-1; ++i) {

            flag=false;

            for(int j=0; j<size-1-i; ++j) {

                if(arr[j]>arr[j+1]) {

                    flag=true;

                    ++swaps;

                    int tmp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = tmp;
                }
            }

            // no swap has taken place so array is already sorted at this point
            if(!flag) break;
        }

    }


    class InputReader {

        private BufferedReader reader;

        private StringTokenizer tokenizer;

        InputReader(InputStream ip) {

            reader = new BufferedReader(new InputStreamReader(ip));
        }

        String next() {

            if(tokenizer==null || !tokenizer.hasMoreTokens()) {

                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

            return tokenizer.nextToken();
        }

        int nextInt() {

            return Integer.parseInt(next());
        }
    }
}



Measured memory_bytes: 24540
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		long a=sc.nextLong(),b=sc.nextLong();
		long sum = 0;
		if(a>=b/2){
			sum+=b/2;
		}else{
			sum+=a;
			b-=a*2;
			if(b>=4)
				sum+=b/4;
		}
		System.out.print(sum);
	}
}


Measured memory_bytes: 21972
package main

import "fmt"
func minInt(a, b int) int{
	if a < b{return a}
	return b
}

func main(){
	var N , max int
	var B[100000] int
	var A[100000] int

	fmt.Scan(&N)

	for i := 0 ; i < N - 1 ; i++ {
		fmt.Scan(&B[i])
	}
	A[0] = B[0]
	for i := 1 ; i < N-1 ; i++ {
		A[i] = minInt(B[i-1], B[i])
	}
	A[N-1] = B[N-2]
	for i := 0 ; i < N ; i++ {
		max += A[i]
	//	fmt.Printf("%d ", A[i])
	}
	fmt.Println()
	fmt.Println(max)
	
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
using namespace std;
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
/*************************************/

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n;
  cin >> n;
  vector<string> a(n);
  vector<int> t(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> t[i];
  }
  string x; cin >> x;
  int ok = 0, ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += ok * t[i];
    ok |= x == a[i];
  }
  kek(ans);
}


Measured memory_bytes: 256
#include <stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define MOD 998244353

ll inv[1000010];
ll coe[1000010];
ll a[1000010];
int main(){
	inv[1]=1;
	rep(i,2,1000001)inv[i]=inv[MOD%i]*(MOD-MOD/i)%MOD;
	rep(i,1,1000001){
		coe[i]=(coe[i]+inv[i])%MOD;
		repp(j,2*i,1000001,i)coe[j]-=coe[i];
	}

	int n;
	ll ans=0;
	scanf("%d",&n);
	rep(i,0,n){
		int t;
		scanf("%d",&t);
		a[t]++;
		ans-=t;
	}
	rep(d,1,1000001){
		ll sum=0;
		repp(i,d,1000001,d)sum+=i*a[i];
		sum%=MOD;
		ans+=sum*sum%MOD*coe[d]%MOD;
	}
	ans%=MOD;
	if(ans<0)ans+=MOD;
	printf("%lld",ans*inv[2]%MOD);
}


Measured memory_bytes: 23552
import numpy as np
import math
import collections
import fractions
import itertools

def mput(): return map(int, input().split())
def lput(): return list(map(int, input().split()))
def iput(): return int(input())

def solve():
    n, m = mput()
    a = lput()
    line = sum(a) / (4 * m)
    bit = 0
    for i in a:
        if i >= line:
            bit += 1
    if bit >= m:
        print("Yes")
    else:
        print("No")
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 27148
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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


fn main() {
    input!{
        a: i32,
        b: i32,
        c: i32,
    }
    let mut x = vec![a,b,c];
    x.sort();
    let y = vec![5,5,7]; 
    match x == y {
        true  => println!("YES"),
        false => println!("NO")
     }
}


Measured memory_bytes: 4352
#include<stdio.h>

int main()
{
	int a,b,c,x=0,y=0,z=0,t;
	for(;scanf("%d%d%d",&a,&b,&c);)
	{
		if(a>c)a^=c^=a^=c;
		if(b>c)b^=c^=b^=c;
		if(c>=a+b){printf("%d %d %d %d\n",x+y+z,y,x,z);return 0;}
		else{t=a*a+b*b-c*c;t>0?x++:!t?y++:z++;}
	}
	return 0;
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
template <class T>
T GCD(T a, T b)
{
    T r;
    while (a)
        r = b, b = a, a = r % a;
    return b;
}
template <class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repe(i, n) for (ll i = 0; i <= (n); i++)
#define repd(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<ll> vl;
#define ERASE(x) x.erase(unique(ALL(x)), x.end()); // erase same elements
#define VEC(type, c, n)     \
    std::vector<type> c(n); \
    for (auto &i : c)       \
        std::cin >> i;

// input
#define INIT                          \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define VAR(type, ...) \
    type __VA_ARGS__;  \
    MACRO_VAR_Scan(__VA_ARGS__);
template <typename T>
void MACRO_VAR_Scan(T &t)
{
    std::cin >> t;
}
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First &first, Rest &... rest)
{
    std::cin >> first;
    MACRO_VAR_Scan(rest...);
}

// output
template <typename T>
void MACRO_OUT(const T t) { std::cout << t; }

#define OUT(...) MACRO_OUT(__VA_ARGS__);
#define SP std::cout << " ";
#define TAB std::cout << "\t";
#define BR std::cout << "\n";
#define ENDL std::cout << std::endl;

#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define yes() printf("yes\n")
#define no() printf("no\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
    cout << a;
    ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
    cout << a << ' ';
}

ll ans = 0;
bool check = 0;
bool boo = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b, c, d, n, m = 0;
int x = 0, y = 0;
int sum;
char ch;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// cout << (conditon ? (result:  == 1 ): (==0)) << endl; <- output result of if
// long long 型が表せる値の上限はおよそ 9 × 10＾18 です．
int main()
{
    INIT;
    cin >> n;
    rep(i, n)
    {
        cin >> a;
        if (m <= a)
            ans++;
        m = max(m, a);
    }
    pr(ans);

    return 0;
}


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

int main(void){
    int n,s;
    float a;
    cin >> n;

    if(n % 2 == 0) s = n / 2;
    else s = n / 2 + 1;
    a = float(s) / n;

    cout << a << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;

ll dp[100005][13]; // dp[i][j] := 先頭i文字として考えられるもののうち、13で割った余りがjであるものの数
int n;
char s[100005];
int main(void){
	int i,j,ki;
	int ans = 0;
	scanf("%s",s);
	n = strlen(s);
	dp[0][0] = 1;
	for(int i=0;i<n;i++){
		int c;
		if(s[i] =='?') c = -1;
		else c = s[i] - '0';
		for(int j=0;j<10;j++){
			if(c!=-1&&c!=j)continue;
			for(int ki=0;ki<13;ki++){
				dp[i+1][(ki*10 + j)%13] += dp[i][ki];
			}
		}
		for(int j=0;j<13;j++)dp[i+1][j] %=mod;
	}
	ans = dp[n][5];
	cout << ans << endl;
}

Measured memory_bytes: 10496
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		long b = sc.nextInt();
		long c = sc.nextInt();
		long d = sc.nextInt();
		long ac = a*c;
		long ad = a*d;
		long bc = b*c;
		long bd = b*d;
		long r = 0;
		long l = 0;
		if(ac-ad>0) {
			r = ac;
		}
		else {
			r = ad;
		}
		if(bc-bd>0) {
			l = bc;
		}
		else {
			l = bd;
		}
		System.out.println(Math.max((long)r, (long)l));
		
	}
}

Measured memory_bytes: 35712
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const int maxn = 2e5;
int n, a[maxn];

int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
    a[i] -= i;
    if (a[i] > 0 || a[i] <= -n || i && a[i - 1] < a[i]) {
      puts("-1");
      return 0;
    }
  }
  long long sum = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (i == n - 1 || a[i] != a[i + 1]) {
      sum += i + a[i];
    }
  }
  printf("%lld\n", sum);
  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int main()
{   int x;
    string y;
    cin>>x>>y;
    int z=0;
    for(int i=0; i<y.size()-2; i++){
        if(y[i]=='A'&&y[i+1]=='B'&&y[i+2]=='C'){
            z++;
        }
    }
    cout<<z<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fr(i1,m) for(int i1=0;i1<m;i1++)
using namespace std;
int main()
{
    long n,m;
    while(cin>>n>>m)
    {
        if(n==m)
            cout<<"Draw\n";
        else if(n==1||n>m&&m!=1)
        {
            cout<<"Alice\n";
        }
        else if(m==1||m>n&&n!=1)
            cout<<"Bob\n";

      //  else if(n>)

    }
    return 0;

}




Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define revrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
const int INF = 1 << 30;//10^9
int MOD = 1000000007;

int H, W;
char S[12][12];

bool subsolve(vector<int> now){
  deque<int> deq;
  rep(i, H){
    if(i % 2){
      deq.push_front(now[i]);
    }else{
      deq.push_back(now[i]);
    }
  }

  char S_[W][H];

  rep(i, deq.size()){
    rep(j, W){
      S_[j][i] = S[deq[i]][j];
    }
  }
  vector<string> all;
  rep(i, W){
    string s = "";
    rep(j, H) s += S_[i][j];
    all.pb(s);
  }
  for(int i = 0; i < W; i++){
    if(all[i] == "") continue;
    string x = all[i];
    reverse(x.begin(), x.end());
    for(int j = i+1; j < W; j++){
      if(all[j] == "") continue;
      if(x == all[j]){
        all[i] = "";
        all[j] = "";
        break;
      }
    }
  }
  int cnt = 0;
  rep(i, W){
    if(all[i] != "") cnt++;
  }
  int odd = 0;
  if(W % 2){
    if(cnt <= 1){
      return true;
    }
    else return false;
  }else{
    if(cnt == 0) return true;
    else return false;
  }

  return 1;
}

bool solve(vector<int> rest, vector<int> now){
  if(rest.size() == 0){
    return subsolve(now);
  }else if(rest.size() % 2 == 1){
    bool res = false;
    for(int i = 0; i < rest.size(); i++){
      vector<int> nextrest = rest, nextnow = now;
      nextnow.pb(rest[i]);
      nextrest.erase(nextrest.begin() + i);
      res |= solve(nextrest, nextnow);
    }
    return res;
  }else{
    bool res = false;
    for(int i = 1; i < rest.size(); i++){
      vector<int> nextrest = rest, nextnow = now;
      nextnow.pb(rest[0]);
      nextnow.pb(rest[i]);
      nextrest.erase(nextrest.begin() + i);
      nextrest.erase(nextrest.begin() + 0);
      res |= solve(nextrest, nextnow);
    }
    return res;
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> H >> W;
  rep(i, H)rep(j, W) cin >> S[i][j];
  vector<int> rest, now;
  rep(i, H){
    rest.pb(i);
  }
  if(solve(rest, now)){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }

}


Measured memory_bytes: 256
#include<iostream>

using namespace std;
long long sum;
const int N = 200005, INF = 1e9+5;
void merge(int A[], int p, int q, int r){
    int n1, n2;
    n1 = q - p + 1;
    n2 = r - q;
    int L[N], R[N];
    for (int i = 0; i < n1; i++)
        L[i] = A[p + i];
    for (int i = 0; i < n2; i++)
        R[i] = A[q + i + 1];
    L[n1] = INF;
    R[n2] = INF;
    int i = 0, j = 0;
    for (int k = p; k <= r; k++)
    {
        if (L[i] <= R[j])
        {
            A[k] = L[i];
            i++;
        }
        else 
        {
            A[k] = R[j];
            sum += n1 - i;
            j++;
        }
    }    
}

void merge_sort(int A[], int p,int r){
    int q;
    if (p < r)
    {
        q = (p + r) / 2;
        merge_sort(A, p, q);
        merge_sort(A, q+1, r);
        merge(A, p, q, r);
    }
}

int main(){
    int n; cin >> n;
    int A[N];
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }
    merge_sort(A, 0, n-1);
    cout << sum << endl;
}


Measured memory_bytes: 4684
n=int(input())
nl=[9**i for i in range(1,6)][::-1]
sl=[6**i for i in range(1,7)][::-1]
tl=[]
for i in range(n+1):
    totals=0
    ps=i
    for j in sl:
        if ps >= j:
            totals+=ps//j
            ps= ps-ps//j*j
    totaln=0
    pn=n-i
    for k in nl:
        if pn >=k:
            totaln+= pn //k
            pn=pn-pn//k*k
    tl.append(totals+totaln+ps+pn)
print(min(tl))


Measured memory_bytes: 3864
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007ll)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			(3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
template<class T> void chmax(T &a, const T &b){if(a<b)a=b;}
template<class T> void chmin(T &a, const T &b){if(a>b)a=b;}
void YN(bool b){cout<<(b?"YES":"NO")<<endl;}
void Yn(bool b){cout<<(b?"Yes":"No")<<endl;}
void yn(bool b){cout<<(b?"yes":"no")<<endl;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	string a,b,c;
	cin>>a>>b>>c;
	int cnt=0;
	rep(i,n){
		if(!(a[i]==b[i]&&b[i]==c[i]))cnt++;
		if(!(a[i]==b[i]||b[i]==c[i]||a[i]==c[i]))cnt++;
	}
	cout<<cnt<<endl;

}



Measured memory_bytes: 256
def isCLKWISE(ph):
    if (ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0 : return False
    else : return True
     
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:]:
        phU.append(p)
        while(True):
            if isCLKWISE(phU) : break
            else :
                del phU[-2]
                if len(phU) == 2 : break
    phL = [P[-1],P[-2]]
    for p in P[-3::-1]:
        phL.append(p)
        while(True):
            if isCLKWISE(phL) : break
            else :
                del phL[-2]
                if len(phL) == 2 : break
    ph = phU + phL[1:-1]
    return ph
 
n = int(input())
P = []
for i in range(n):
    P.append([int(x) for x in input().split()])
     
Q = ConvexHullScan(P)
Q.reverse()
print(len(Q))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(Q)])[2]
R = Q[idx:] + Q[:idx]
for r in R:
    print(r[0],r[1])

Measured memory_bytes: 33896
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader();
        long N = r.l();
        println(N*(N-1)/2);
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


Measured memory_bytes: 21204
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) throws FileNotFoundException {

    //Scanner cin = new Scanner(new FileReader("input.txt"));
   Scanner cin = new Scanner(System.in);
    String in = cin.next();

    if (in.length()==2) {
      System.out.println(in);
    }

    else if (in.length()==3) {
      String res = new StringBuilder(in).reverse().toString();
      System.out.println(res);
    }

  }

}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
template <class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
int sum(int n){
    int res=0;
    while(n>0){
        res+=n%10;
        n/=10;
    }
    return res;
}
signed main() {
    int a,b;cin>>a>>b;
    cout<<(a+b)/2<<endl;
}



Measured memory_bytes: 3112
#include<iostream>
using namespace std;
int main()
{
  int n;
  string s;
  cin>>n>>s;
  int l=s.size();
  for(int i=0;i<l;i++)
  {
    s[i]=s[i]+n;
    if(s[i]<=90)
      cout<<s[i];
    if(s[i]>90)
      cout<<char((s[i]-'A')%26+65);
  }
  return 0;
}

Measured memory_bytes: 256
n,a,b = gets.split(' ').map(&:to_i)

total = []
(1..n).each do |m|
  if m >= 10
  	sum = m.to_s.chars.map(&:to_i).reduce(:+)
    if sum <= b && sum >= a
      total.push(m)
    end
  else
    if m <= b && m >= a
      total.push(m)
    end
  end
end

puts total.inject(:+)

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main(void){

    double N, X;
    int T;
    cin >> N >> X >> T;
    N = ceil(N / X);
    cout << (int)N * T;

    return 0;
}

Measured memory_bytes: 3716