akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define mp make_pair
#define ins insert
#define sz size
#define whoami(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); whi(_it, args); }

void whi(istream_iterator<string> it) { cerr<<"\n"; }

template<typename T, typename... Args>
void whi(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<" "<<a<<" "; whi(++it, args...); }

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed); cerr.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed); cerr.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;
const ll INF = 4e18;

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

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	string s,t;
	cin>>s>>t;
	int n = (int)s.sz();
	int cc = 0;
	for(int i=0;i<n;i++)
	cc += (s[i] != t[i]);
	cout<<cc<<"\n";
	return;	
}

int main(void)
{
	FLASH();
	//freopen("cowjog.in", "r", stdin);
	//freopen("cowjog.out", "w", stdout);
	int T;
	T = 1;

#ifndef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif

	//cin>>T;
	while(T--)
	solve(T);

#ifndef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cerr<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif

	return 0;
}

Measured memory_bytes: 3808
# 26min
q = int(input())

length = 100010
primes = [1] * length
primes[1] = 0
for i in range(2, len(primes)):
    if primes[i] == 1:
        n = i*2
        while n < length:
            primes[n] = 0
            n += i

a = [0]*length

for i in range(len(a)):
    if i % 2 == 0:
        continue
    # 2017-like
    is2017Like = primes[i] and primes[(i+1) // 2]
    a[i] = (1 if is2017Like else 0)

accum = [0]*(length+1)

for i in range(length):
    accum[i+1] = accum[i] + a[i]

for _ in range(q):
    l, r = map(int, input().split())
    print(accum[r+1] - accum[l])

Measured memory_bytes: 9684
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;
long long A[200000];
long long prefix[200000];
int main(){
  long long N;
  cin >> N;
  for(long long i=0;i<N;++i){
    cin >> A[i];
  }
  prefix[0] = A[0];
  for(long long i=1;i<N;++i){
    prefix[i] = prefix[i-1] + A[i];
  }
  map<long long,long long> m;
  for(long long i=0;i<N;++i){
    m[prefix[i]]++;
  }
  long long num = 0;
  for(const auto &p:m){
    if(p.second>=2){
      num+=p.second*(p.second-1)/2;
    }
    if(p.first==0){
      num+=p.second;
    }
  }
  cout << num << endl;
  return 0;
}

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> d(n);
  std::cin >> d;
  int64_t ans = 0;

  for (int64_t i = 0; i < n; i++) {
    for (int64_t j = i + 1; j < n; j++) {
      ans += d[i] * d[j];
    }
  }
  std::cout << ans << std::endl;
  return 0;
}


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

int main()
{
    int h,w,i,j,sum;
    char a[55][55];
    for(i=0;i<55;i++)
    {
        for(j=0;j<55;j++)
            a[i][j]='0';
    }
    cin>>h;cin>>w;
    for(i=1;i<=h;++i)
    {
        for(j=1;j<=w;++j)
        {
            cin>>a[i][j];
        }
        getchar();
    }
    for(i=1;i<=h;++i)
    {
        for(j=1;j<=w;++j)
        {
            sum=0;
            if(a[i][j]=='#'){cout<<"#";continue;}
            else
            {
                if(a[i-1][j-1]=='#')sum++;
                if(a[i-1][j]=='#')sum++;
                if(a[i-1][j+1]=='#')sum++;
                if(a[i][j-1]=='#')sum++;
                if(a[i][j+1]=='#')sum++;
                if(a[i+1][j-1]=='#')sum++;
                if(a[i+1][j]=='#')sum++;
                if(a[i+1][j+1]=='#')sum++;
            }
            cout<<sum;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

  vector<bool> prime(1000000, true);
  vector<int> cnt(1000000, 0);
  for(int i=2;i<1000000;++i){
	cnt[i] = cnt[i-1];
	if(prime[i]){
	  ++cnt[i];
	  for(int j=i+i;j<1000000;j+=i)
		prime[j] = false;
	}
  }

  int n;
  while(true){
	if(!(cin >> n)) return 0;
	cout << cnt[n] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 5160
// ALDS1_5_A.cpp
// Divide and Conquer - Exhaustive Search

#include <iostream>
#include <vector>
using namespace std;

bool solve(vector<int>& A, int cnt, int m)
{
	if (m == 0) return true;
	if (cnt == A.size()) return false;
	return solve(A, cnt + 1, m) || solve(A, cnt + 1, m - A[cnt]);
}

int main()
{
	int n;
	cin >> n;
	vector<int> A(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	int q;
	cin >> q;
	vector<int> M(q);
	for (int i = 0; i < q; i++) {
		cin >> M[i];
		if (solve(A, 0, M[i])) cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return 0;
}

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



int main(){
    string s; int ans,now; cin>>s;
    ans=0; now=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G'){
            now++;
            if(now>ans) ans=now;
        }else{
            now=0;
        }
    }
    cout << ans <<endl;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	char s[3];
	char d[3];
	scanf("%s",&s);
	scanf("%s",&d);
	int ans=0;
	for(int i=0;i<3;i++){
		if(s[i]==d[i])ans++;
	}
	cout << ans << endl;
}

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

int main(){
    int N;
    cin >> N;
    int a[100010];
    int i;
    for(i=1; i<=N; i++){
        cin >> a[i];
    }

    int count=0;
    int ans;
    int light=1;
    int nlight;

    while(1){
        count++;
        nlight=a[light];
        a[light]=-1;
        light=nlight;
        if(light==2){
            ans=count;
            break;
        }
        if(light==-1){
            ans=-1;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3976
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> h(N);
    for(int i=0;i<N;i++){
        cin >> h[i];
    }
    sort(h.begin(),h.end());
    int min = 1000000000;
    for(int i=0;i<N-K+1;i++){
        int diff = h[i+K-1] - h[i];
        if(diff < min) min = diff;
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 640
a, b, c = gets.split.map(&:to_i)
memo = Array.new(100){ 0 }
n = 0
loop do
  n += a
  m = n % b
  if m == c
    puts "YES"
    break
  elsif memo[m] == 0
    memo[m] = 1
  else
    puts "NO"
    break
  end
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define endl "\n"
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;

ll n,k,c;string s;


int main(){
    
  cin>>n>>k>>c>>s;
  int cnt=0,l=202020;
  int fday[202020];
  int d=0;
  int w=k;
  int canw[202020],lw=404040;
  // repr(i,s.size()){
  //   if(s[i]=='o'){
  //     if()
  //   }
  // }
  rep(i,s.size()){
    l++;
    if(s[i]=='o'){
      
      if(l>c){
        l=0;
        cnt++;
      }
      fday[d]=cnt;
      d++;
    }
    
  }
  cnt=k+1;l=202020;
  int lday[202020];
  int md=d;
  repr(i,s.size()){
    l++;
    
    if(s[i]=='o'){
      d--; 
      if(l>c){
        l=0;
        cnt--;
      }

      lday[d]=cnt;
    }
    
  }
  rep(i,s.size()){
    if(s[i]=='o'){
      
      if(lday[d]!=fday[d]){
        lday[d]=-100;fday[d]=-10;
      }
      d++;
    }
      


    
    
  }
  d=0;
  rep(i,s.size()){
    if(s[i]=='o'){
      if(fday[d]==lday[d]){
        if(d==0||fday[d-1]!=fday[d]&&lday[d-1]!=lday[d])
        if(d==md-1||fday[d+1]!=fday[d]&&lday[d+1]!=lday[d])
        cout<<i+1<<endl;
      }
      d++;
    }
      
    
  }
  
}


Measured memory_bytes: 3332
n, k = map(int, input().split())
a = list(map(int, input().split()))
dest = [1]
dest_set = {1}
now = 1
while True:
    nxt = a[now-1]
    if nxt in dest_set:
        loop = dest.index(nxt)
        break
    dest.append(nxt)
    dest_set.add(nxt)
    now = nxt
if k<len(dest):
    print(dest[k])
else:
    print(dest[(k-len(dest))%(len(dest)-loop)+loop])

Measured memory_bytes: 125084
def bom bom_map,y,x
  if bom_map[y][x] == 1
    bom_map[y][x] = 0
    for i in -3...4
      next if i == 0
      bom(bom_map,y+i,x) if -1 < y+i && y+i < 8
      bom(bom_map,y,x+i) if -1 < x+i && x+i < 8
    end
  end
  bom_map[y][x] = 0
end

n = gets.chomp.to_i
n.times do |data_num|
  bom_map = Array.new(8).map!{Array.new(8,0)}
  gets
    8.times do |ele|
      bom_map[ele] = gets.chomp.split(//).map(&:to_i)
    end
  x = gets.chomp.to_i
  y = gets.chomp.to_i
  bom(bom_map,y-1,x-1)
  print("Data ",data_num+1,":\n")
  bom_map.each do |ele|
    ele.each do |num|
      print num 
    end
    print "\n"
  end
end

Measured memory_bytes: 6188
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define ALL(a) (a).begin(), (a).end()
string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}


int main(void){
  ll N, A, B, W, H, C, D, Q, X, Y;
  string S, T;
  cin >> N;
  cout << (24-N)+24 << endl;

}


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

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

    int q, maxi = -1e9;
    cin >> q;
    vector<int> L(q), R(q);
    for(int i = 0; i < q; i++){
        cin >> L[i] >> R[i];
        maxi = max(maxi, R[i]);
    }

    vector<bool> F(maxi + 1, true);
    F[0] = false;
    F[1] = false;
    F[maxi + 1] = 0;
    for(int i = 2; i <= sqrt(maxi); i++){
        if(F[i] == true){
            for(int j = i + i; j <= maxi; j += i){
                F[j] = false;
            }
        }
    }

    vector<int> S(maxi + 2, 0);
    for(int i = 3; i <= maxi; i += 2){
        if(F[i] == true and F[(i + 1) / 2] == true){
            S[i] = 1;
        }
    }

    for(int i = 1; i < maxi + 1; i++){
        S[i] += S[i - 1];
    }

    for(int i = 0; i < q; i++){
        cout << S[R[i]] - S[L[i] - 1] << endl;
    }

    return 0;
}

Measured memory_bytes: 2428
#include <iostream>
#include <map>

using namespace std;

int main () {
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  int ans = 0;
  map<int, int> cnt;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;

    if (cnt.count(x) == 0) {
      cnt[x] = 0;
    }

    cnt[x]++;
    if (cnt[x] > x) ans++;
  }

  for (auto it = cnt.begin(); it != cnt.end(); it++) {
    if (it->second < it->first) ans += it->second;
  }

  cout << ans << endl;
}


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

using namespace std;

typedef long long ll;

ll mod;

ll powimod(ll x,ll n,ll mod){
    ll res=1;
    while(n){
        if(n&1) res=(res*x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return res;
}

ll powi(ll x,ll n){
    ll res=1;
    while(n){
        if(n&1) res*=x;
        x*=x;
        n>>=1;
    }
    return res;
}

vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
    return z;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    while(t--)
    {
    int x;
    cin>>x;
    int a=1;
    if(x<=599) a=8;
    else if(x<=799) a=7;
    else if(x<=999) a=6;
    else if(x<=1199) a=5;
    else if(x<=1399) a=4;
    else if(x<=1599) a=3;
    else if(x<=1799) a=2;
    cout<<a;
    }
}


Measured memory_bytes: 3688
#include <stdio.h>

int main(){
	int countTable[256] = {0};
	char ch;

	while((ch = getchar()) != EOF){
				countTable[ch]++;
	}
	for(int i = 97; i <=122;i++)printf("%c : %d\n",i,countTable[i]+countTable[i-32]);
}





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


int dp__[100];

//最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp__[n] = 1;
  if(dp__[n] != -1) return dp__[n];
  return dp__[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  rep(i,n) p[i]++;
  int ans = 0;
  int s = 0;
  queue<int> q;
  rep(i,n){
    s += p[i];
    q.push(p[i]);
    if(q.size() > k){
      s -= q.front();
      q.pop();
    }
    if(q.size() == k){
      ans = max(ans, s);
    }
  }
  double anss = ans;
  anss /= 2;
  printf("%.10f", anss);
}




Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define vc vector<int>
#define um unordered_map<int,int>
#define ll long long 
#define rep(i,a,b) for(__typeof(a) i=a; i<b; i++)
#define si(a) a.size()
#define all(a) a.begin(),a.end()
#define ss(a) a.second
#define ff(a) a.first
#define M 1000000
#define pb push_back
#define repit(i,a) for(auto i=a.begin(); i!=a.end(); i++)
#define take(arr,n) for(int i=0;i<n;i++)cin>>arr[i]
#define out(arr,n) for(int i=0;i<n;i++)cout<<arr[i]<<' '
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define reprev(i,b,a) for(__typeof(b) i=b; i>=a; i--)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define doublearray vector<vector<int>>
#define mod 998244353 
using namespace std;
ll max(ll a, ll b){ return a>b?a:b; }
ll min(ll a, ll b){ return a<b?a:b; }
// ll gcd(ll a, ll b){
//     if(b==0) return a;
//     return gcd(b,a%b);
// }
// ll lcm(ll a, ll b){
//     return (a*b)/gcd(a,b);
// }
int binaryS(ll x, ll sb[], int m){
    int l = 0, r=m;
    int mid = (l+r)/2;
    while(l<r){
        mid = (l+r)/2;
        if(sb[mid]<x) l= mid+1;
        else if(sb[mid]>x) r = mid-1;
        else return mid;
    }
    return l;
}
int main(){
    fastio;
    int n,m,k; cin>>n>>m>>k; 
    um r,c;
    vector<pair<int,int>>tar;
    ll maxr = 0, maxc = 0;
    rep(i,0,k){
        int x,y; cin>>x>>y;
        r[x]++; c[y]++;
        maxr = max(maxr,r[x]); maxc = max(maxc,c[y]);
        tar.emplace_back(x,y);
    }
    ll co=0;
    rep(i,0,k){
        if((r[ff(tar[i])]==maxr)&&(c[ss(tar[i])]==maxc)){
            co++;
        }
    }
    ll crmax = 0;
    repit(it,r){
        if(it->second==maxr) crmax++;
    }
    ll ccmax = 0;
    repit(it,c){
        if(it->second==maxc) ccmax++;
    }
    if(co<(crmax*ccmax)){
        cout<<(maxr+maxc)<<endl;
    }
    else cout<<(maxc+maxr-1)<<endl;
    return 0;
}


Measured memory_bytes: 32580
#include<iostream>

using namespace std;

int main(void){

    int N, Y;
    int a=-1,b=-1,c=-1;

    cin >> N;
    cin >> Y;

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

            int k = N - i -j ;
            if(k<0) k=0;
                if(i+j+k == N){
                    if(10000*i+5000*j+1000*k == Y){
                        a=i;b=j;c=k;     
                        i=N+1;j=N+1;k=k+1;                 
                    }
                }

        
        }
    }

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

}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main () {
  long long A, B;
  cin >> A >> B;
  long long a = min(A, B);
  long long b = max(A, B);
  while(a) {
    b %= a;
    swap(a, b);
  }
  cout << A * B / b << endl;
}

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
var [x,a,b]=arr.shift().split(" ").map(Number);
var n=arr.shift()-0;
for(var i=0;i<n;i++){
   if(arr[i]=="nobiro")x+=a;
   else if(arr[i]=="tidime")x+=b;
   else if(arr[i]=="karero")x=0;
   x=Math.max(0,x);
}
console.log(x);


Measured memory_bytes: 15444
while True:
    try:
        s = input()
    except EOFError:
        break

    a, b, n = map(int, s.split())
    a %= b
    x = 0
    for i in range(n):
        a *= 10
        if a >= b:
            q, a = divmod(a, b)
            x += q
    print(x)

Measured memory_bytes: 6720
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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 <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    if (s == "ABC") cout << "ARC\n";
    else cout << "ABC\n";
    return 0;
}

Measured memory_bytes: 3648
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	int N,M;
	int[] v;
	public void solve(){
		N = nextInt();
		M = nextInt();

		v = new int[N];

		for(int i = 0;i < M;i++){
			int a = nextInt()-1;
			int b = nextInt()-1;

			v[a]++;
			v[b]++;
		}

		for(int i = 0;i < N;i++){
			if(v[i] % 2 == 1){
				out.println("NO");
				return;
			}
		}

		out.println("YES");
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

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

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 39300
def no():
    print("No")
def yes():
    print("Yes")

s=input().rstrip()
len=len(s)
#print(len)
for i in range(0,len):
    if i%2==0:
        if(s[i]=='L'):
            no()
            exit()
    else:
        if(s[i]=='R'):
            no()
            exit()
yes()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m,h;
  
  cin>>n>>m;
  
  int a[n];
  
  for(int i=0;i<n;i++)
  {
    a[i]=0;
  }
  
  for(int i=0;i<m;i++)
  {
    int t;
    int r;
  
    cin>>t>>r;
    
    a[t-1]++;
    a[r-1]++;
  }
 
  for(h=0;h<n;h++)
  {
     cout<<a[h]<<endl;
  }
 
 
 
}

Measured memory_bytes: 256
#!/usr/bin/env python
N, A = map(int, raw_input().split())
x = map(int, raw_input().split())

ADD = 10000
DP = [0 for i in range(N * 50 + 1 + 2 * ADD)]
 
DP[ADD] = 1

for i in range(N):
    if x[i] < A:
        for j in range(-N * 60, N * 60):
            DP[j + ADD] += DP[j + (A - x[i]) + ADD]
    else:
        for j in range(N * 60, -N * 60, -1):
            DP[j + ADD] += DP[j + (A - x[i]) + ADD]

print DP[ADD] - 1

Measured memory_bytes: 3588
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#include <queue>
#include <numeric>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int64_t> a, dif;
	for (int i = 0; i < n; ++i) {
		int64_t ai;
		cin >> ai;
		a.push_back(ai);
	}
	int64_t sum = 0;
	for (int i = 0; i < n; ++i) {
		int64_t bi;
		cin >> bi;
		dif.push_back(a[i]-bi);
		sum += a[i]-bi;
	}
	if (sum < 0) {
		cout << "-1" << endl;
		return 0;
	}

	sort(dif.begin(), dif.end());
	int c1, c2;
	c1 = 0;
	c2 = dif.size() - 1;
	int cnt = 0;
	int64_t rest = 0;
	while (dif[c1] < 0) {
		if (rest + dif[c1] >=0) {
			rest += dif[c1];
			c1++;
			cnt++;
		}
		else {
			while (rest + dif[c1] < 0) {
				rest += dif[c2];
				c2--;
				cnt++;
			}
		}
	}
	cout << cnt << endl;
	return 0;
}

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

void solve();
int main(int argc, char *argv[]) {
    if (argc == 2) {
        freopen(argv[1], "r", stdin);
    } else if (argc == 3) {
        freopen(argv[1], "r", stdin);
        freopen(argv[2], "w", stdout);
    }
    solve();
    return 0;
}

const int N=100+10;
int n,a[N],cnt[N];
bool check(int x, int y){
    for(int i=x;i<=y;i++) if(cnt[i]<2) return false;
    return true;
}
void solve() {
    while(cin>>n) {
        fill(cnt,cnt+n,0);
        for(int i=0;i<n;i++) {
            cin>>a[i];
            cnt[a[i]]++;
        }

        sort(a,a+n);
        int minD=a[0], maxD=a[n-1];
        bool flag=false;
        if(maxD==2*minD-1) {
            if(cnt[minD]==2&&check(minD+1,maxD)) flag=true;
        } else if(maxD==2*minD) {
            if(cnt[minD]==1&&check(minD+1,maxD)) flag=true;
        }
        if(flag) puts("Possible");
        else puts("Impossible");

    }
}

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

int n,m;
int x[100000],y[100000],z[100000];
vector<int> route[100001];
bool visited[100001];
void connect(int x, int y) {
    route[x].push_back(y);
    route[y].push_back(x);
}

void dfs(int p) {
    visited[p] = true;
    stack<int> s;
    s.push(p);
    while (s.size() > 0) {
        p = s.top(); s.pop();
        for (int i: route[p]) {
            if (not visited[i]) {
                visited[i] = true;
                s.push(i);
            }
        }
    }
}
int main() {
    cin >> n >> m;
    rep(i,m) cin >> x[i] >> y[i] >> z[i];
    rep(i,m) connect(x[i], y[i]);
    int ans = 0;
    for(int i=1; i <= n; i++) {
        if (not visited[i]) {
            ans ++;
            dfs(i);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 10544
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cfloat>
#include <algorithm>
#include <memory>
using namespace std; 

typedef long long ll; 
typedef unsigned long long ull;
typedef unsigned uint; 
typedef long double l_double;

#define vtr vector
#define PB push_back
#define EB emplace_back
#define gcd __gcd
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define st_ct static_cast // <>
#define TEST uint _ {}; cin >> _; while (_--)
#define PI (3.1415926535897932384626433832795)
#define MOD st_ct<int>(1e9 + 7)
#define EPS 1e-9
#define deb(x) cout<< #x << " --> " << x << endl;

template<typename T>
void vtrS(const vector<T> &ARR) 
{ for (T const &val: ARR) cout<<val<<" "; cout<<endl; }

template<typename T>
void vtrV(const vector<T> &ARR) 
{ for (T const &val: ARR) cout<<val<<endl; }

template<typename T>
void read_vvtr(vector<vector<T>> &ARR) 
{ for (vector<T> &i: ARR) for (T &j: i) cin >> j; }

template<typename T>
void vvtrS(const vector<vector<T>> &ARR) 
{ for (vector<T> const &i: ARR) { for (T const &j: i) cout<<j<<" "; cout<<endl; } }

template<typename T>
void vvtrNS(const vector<vector<T>> &ARR) 
{ for (vector<T> const &i: ARR) { for (T const &j: i) cout<<j; cout<<endl; } }

template<typename T>
T cntDigits(const T &N) { return (floor(log10(N)) + 1); }

template<typename T>
bool isPowOfTwo(const T &N) { return (N && (!(N&(N-1)))); }

template<typename T>
T lcm(T a, T b) { return ((a*b)/gcd(a, b)); }
// --------------------------------------------------------------------------------

vtr<int> arr (200001);

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // cout.setf(std::ios::boolalpha);
    cout<<std::fixed<<std::setprecision(10); 
    // --------------------------------------
    
    int n {};
    cin >> n;
    for (int i {1}; i <= n; ++i) {
        int s {};
        if (cin >> s) ++arr.at(s);
    }
    for (int i {1}; i <= n; ++i) {
        cout<<arr.at(i)<<endl;
    }
    return 0;
}

Measured memory_bytes: 3904
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

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

    string str = "";
    rep(i, s.size())if(s[i] != 'x')str = str + s[i];
    string rv = str;
    reverse(ALL(rv));
    if(rv != str){
        cout << -1;
        return 0;
    }

    ll f = 0, b = s.size()-1;
    ll ans = 0;
    while(f < b){
        if(s[f] == 'x' && s[b] != 'x')++f, ++ans;
        else if(s[f] != 'x' && s[b] == 'x')--b, ++ans;
        else ++f, --b;
    }
    cout << ans << endl;
}

Measured memory_bytes: 696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} //配列vにn個の要素を入力する
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 

const int mod = 1000000007;
const int inf = 1e9;

int main(){
    vi m(10);
    rep(i,0,10){
        cin >> m[i];
    }
    sort(m.rbegin(), m.rend());
    rep(i,0,3){
        cout << m[i] << endl;
    }
    
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
        using namespace std;
         
        int main() {
          char s1,s2,s3;
          int i,cnt = 0;
          cin >> s1 >> s2 >> s3;
          char box[3] = {s1, s2, s3};
          for (i = 0; i<=2; i++) {
          	if(box[i] == '1'){
              cnt++;
            }
          }
          cout << cnt  << endl;
        }

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int N,C,K;
    cin>>N>>C>>K;
    vector<int>T(N);

    for(int i=0;i<N;++i)cin>>T[i];
    sort(T.begin(),T.end());

    int count=0;

        for(int i=0;i<N;){

            int s=i;
            while(T[i]-T[s]<=K && i-s<C && i<N)++i;
        
        ++count;
            
        }
    cout<<count;

}

Measured memory_bytes: 3152
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>

using namespace std;
const int dx[] = {1,0,-1,0} , dy[] = {0,1,0,-1};
#define INF 999999
int main(){
    int n;
    while(scanf("%d",&n),n){
        int so[128]={0};
        for(int i = 0; i < n; i++)scanf("%d",&so[i]);

        int cnt = 0;
        for(int i = n-1; i > 0; i--){
            for(int j = 1; j <= i; j++){
                if(so[j] < so[j-1]){
                    swap(so[j],so[j-1]);
                    cnt++;
                }
            }
        }
        printf("%d\n",cnt);
    }
	return 0;
}

Measured memory_bytes: 1192
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;
int n,m,a[N];

int mod = 1e9+7;
struct modular {
    int value;
    modular(long long v = 0) { value = v % mod; if (value < 0) value += mod;}
    modular(long long a, long long b) : value(0){ *this += a; *this /= b;}
    modular& operator+=(modular const& b) {value += b.value; if (value >= mod) value -= mod; return *this;}
    modular& operator-=(modular const& b) {value -= b.value; if (value < 0) value += mod;return *this;}
    modular& operator*=(modular const& b) {value = (long long)value * b.value % mod;return *this;}
    //其他函数调用mexp(modular(10),3);
    friend modular mexp(modular a, long long e) {
        modular res = 1; while (e) { if (e&1) res *= a; a *= a; e >>= 1; }
        return res;
    }
    friend modular inverse(modular a) { return mexp(a, mod - 2); }
    modular& operator/=(modular const& b) { return *this *= inverse(b); }
    friend modular operator+(modular a, modular const b) { return a += b; }
    friend modular operator-(modular a, modular const b) { return a -= b; }
    friend modular operator-(modular const a) { return 0 - a; }
    friend modular operator*(modular a, modular const b) { return a *= b; }
    //除法只有在mod是素数可用;
    friend modular operator/(modular a, modular const b) { return a /= b; }
    friend ostream& operator<<(ostream& os, modular const& a) {return os << a.value;}
    friend istream& operator>>(istream& is, modular & a){long long value; is >> value;a.value = 0; a += value;  return is;}
    friend bool operator==(modular const& a, modular const& b) {return a.value == b.value;}
    friend bool operator!=(modular const& a, modular const& b) {return a.value != b.value;}
};

modular dp[N];

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
 
    cin>>n>>m;
 
    int x;
    for (int i = 0; i < m; i++){
        cin>>x;
        a[x] = 1;
    }
 
    dp[0] = 1;
    for (int i = 1; i <= n; i++){
        if(a[i])continue;
        dp[i] = dp[i-1] + dp[i-2];
    }
 
 cout<<dp[n]<<endl;
 
 
 
    return 0;
}


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

int main(){
  int n;
  string s;
  cin >> n >> s;
  vector<int> m(n);
  rep(i,n){
    if(s[i]=='R')m[i]=0;
    if(s[i]=='B')m[i]=1;
    if(s[i]=='G')m[i]=2;
  }
  vector<int> c(3);
  rep(i,n)c[m[i]]++;
  ll t=1;
  rep(i,3)t*=c[i];
  rep(j,n){
    rep(i,j){
      int k=j+(j-i);
      if(k<n){
      	if(m[i]==m[j])continue;
        if(m[j]==m[k])continue;
        if(m[k]==m[i])continue;
      	--t;
      }
    }
  }
  cout << t << endl;
  return 0;
}



Measured memory_bytes: 3612
def output(picture, ranks):
    for i in range(1, 14):
        if i not in ranks:
            print(picture, i)

n = int(input())

s = []
h = []
c = []
d = []

for i in range(n):
    inputs = input().split(' ')
    picture = inputs[0]
    rank = int(inputs[1])
    if 'S' == picture:
        s.append(rank)
    elif 'H' == picture:
        h.append(rank)
    elif 'C' == picture:
        c.append(rank)
    else:
        d.append(rank)

output('S', s)
output('H', h)
output('C', c)
output('D', d)



Measured memory_bytes: 5608
s[50],j,p,q;
main(i){for(;j=i=atoi(gets(s));printf("%d\n",i)){
for(;i;s[j-i--]=strlen(gets(s+j)));
for(;j;)for(p=i++,j=q=6;q>0;)for(q=6842496>>--j*4&15;q>1;)q-=s[p++];
}}

Measured memory_bytes: 532
from sys import stdin
from collections import namedtuple

Card = namedtuple('Card', ['suit', 'value', 'init'])

def QuickSort(A, begin, end):
    if end - begin <= 1:
        return

    piv = A[end - 1].value
    left, right = begin, begin

    for i in range(begin, end - 1):
        if A[i].value <= piv:
            if i - left > 0:
                A[left], A[i] = A[i], A[left]
            left += 1

    A[left], A[end - 1] = A[end - 1], A[left]

    QuickSort(A, begin, left)
    QuickSort(A, left + 1, end)

n = int(stdin.readline())
A = [None] * n

for i in range(n):
    suit, value = stdin.readline().split()
    A[i] = Card(suit, int(value), i)

QuickSort(A, 0, n)

for i in range(n - 1):
    if A[i].value == A[i + 1].value and A[i].init > A[i + 1].init:
        print('Not stable')
        break
else:
    print('Stable')

for a in A:
    print(a.suit, a.value)

Measured memory_bytes: 23528
import java.util.Scanner;

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



			System.out.println("No");
		}
	}
}

Measured memory_bytes: 26168
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define fi first
#define se second
#define pii pair<int, int>

const int N = 1e5 + 10;
vector<vector<pii>> g(N);
vector<bool> visited(N, false);
vector<int> dist(N, 0);
void dfs(int v) {
    visited[v] = true;
    for (auto &u : g[v]) {
        if (!visited[u.fi]) {
            dist[u.fi] = dist[v] + u.se;
            dfs(u.fi);
        }
    }
}
signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); 
    int n;
    cin >> n;
    for (int i = 1; i < n; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        g[u].push_back({v, w});
        g[v].push_back({u, w});
    }
    dfs(1);
    for (int i = 1; i <= n; i++) {
        cout << dist[i] % 2 << "\n";
    }
}

Measured memory_bytes: 10240
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

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

    int n = sc.nextInt();

    Map<String, String> result = new HashMap<>();
    int sum = 0;

    for (int i = 0; i < n; i++) {
      String s = sc.next();
      if (result.get(s) == null) {
        result.put(s, "have");
        sum++;
      }
    }
    System.out.println(sum);
  }
}


Measured memory_bytes: 78064
N, A, B = map(int, input().split())

if A > B:
  print(0)
elif A == B:
  print(1)
else:
  if N == 1:
    if A != B:
      print(0)
    else:
      print(1)
  else:
    print((N - 2) * (B - A) + 1)

Measured memory_bytes: 38384
module M = Map.Make (struct type t = int let compare = compare end) ;;

let n = read_int () in
let add key v map = M.add key (v + try M.find key map with _ -> 0) map in
let rec loop0 i map =
    if i = 1 then map else
        let rec loop c cur map =
            if cur * cur > c then (if c = 1 then map else add c 1 map) else
                if c mod cur = 0 then (
                    let rec loop2 c count =
                        if c mod cur = 0 then loop2 (c / cur) (count + 1)
                        else loop c (cur + 1) (add cur count map)
                    in
                    loop2 c 0
                ) else loop c (cur + 1) map
        in
        loop0 (i - 1) (loop i 2 map)
in
let map = loop0 n M.empty in
let l = M.fold (fun _ v acc -> v :: acc) map [] in
let count target =
    let rec loop acc list = function
        | [] -> acc + 1
        | hd :: tl -> (
            let rec loop2 acc = function
                | [] -> acc
                | hh :: tt when hh >= hd - 1 ->
                        let acc = loop acc tt tl in
                        loop2 acc tt
                | hh :: tt -> loop2 acc tt
            in
            loop2 acc list
        )
    in
    loop 0 l target
in
let result =
    count [ 75 ] +
    count [ 3; 25 ] +
    count [ 5; 15 ] +
    count [ 15; 5 ] +
    count [ 25; 3 ] +
    count [ 3; 5; 5 ] +
    count [ 5; 3; 5 ] +
    count [ 5; 5; 3 ]
in
Printf.printf "%d\n" result

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

class TimeCard {
private:
    int arrivalSec = 0;
    int leavingSec = 0;

public:
    TimeCard(int in_hour,int in_min,int in_sec,int out_hour,int out_min,int out_sec);
    void setArrival(int hour,int minute,int sec);
    void setLeaving(int hour,int minute,int sec);
    int timeToSec(int hour,int minute,int sec);
    std::string getWorkTime();
};

TimeCard::TimeCard(int in_hour,int in_min,int in_sec,int out_hour,int out_min,int out_sec){
    setArrival(in_hour,in_min,in_sec);
    setLeaving(out_hour,out_min,out_sec);
}

void TimeCard::setArrival(int hour,int minute,int sec){
    arrivalSec = timeToSec(hour,minute,sec);
}

void TimeCard::setLeaving(int hour,int minute,int sec){
    leavingSec = timeToSec(hour,minute,sec);
}

int TimeCard::timeToSec(int hour,int minute,int sec){
    return (hour * 60 * 60) + (minute * 60) + (sec);
}

std::string TimeCard::getWorkTime(){
    std::string strWorkTime = "";
    
    int workTime = leavingSec - arrivalSec;
    
    int hour = workTime / (60 * 60);
    workTime -= hour * (60 * 60);
    
    int minute = workTime / 60;
    workTime -= minute * 60;

    strWorkTime = std::to_string(hour) + " " + std::to_string(minute) + " " + std::to_string(workTime);
    
    return strWorkTime;
}

const int INPUT_COUNT = 3;

int main(){

    std::vector<TimeCard> vecTc;
    
    int in_h = 0, in_m = 0, in_s = 0, out_h = 0, out_m = 0, out_s = 0;
    for(int i = 0;i < INPUT_COUNT;i++){
        std::cin >> in_h >> in_m >> in_s >> out_h >> out_m >> out_s ;
        vecTc.push_back(TimeCard(in_h,in_m,in_s,out_h,out_m,out_s));
    }

    for(TimeCard tc : vecTc){
        std::cout << tc.getWorkTime() << std::endl;
    }

    return 0;
}

Measured memory_bytes: 3268
using System.Linq;
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        string line;
        for (; (line = Console.ReadLine()) != null;)
        {
            var s = line.Trim();
            var a = new List<int>();
            for (int i = 0; i < s.Length; i++)
                a.Add(int.Parse(s[i].ToString()));
            Console.WriteLine(getBottom(a));
        }
    }
    public static int getBottom(List<int> a)
    {
        if (a.Count() == 2) return a.Sum() % 10;
        else
        {
            var temp = new List<int>();
            for (int i = 1; i < a.Count(); i++)
                temp.Add((a[i] + a[i - 1]) % 10);
            return getBottom(temp);
        }
    }
}

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

int main() {
  int N;
  cin >> N;
  vector<int> match;
  for (int i = 1; i <= N; i++) {
    int x;
    cin >> x;
    if (i == x) match.push_back(i);
  }
  
  int p = 0;
  int sw = 0;
  int k = 0;
  for (int e : match) {
    if (p+1 != e) {
      sw += (k+1)/2;
      k = 0;
    }
    k += 1;
    p = e;
  }
  cout << sw + (k+1)/2 << endl;
}

Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    string s; cin >> s;
    sort(s.begin(),s.end());
    if(s.at(0)==s.at(1) && s.at(2)==s.at(3) && s.at(0)!=s.at(2)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;   
}

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

int main(){
    vector<int> time(5,0);
    int sum=0,m=INT_MAX;
    for(int i=0;i<5;i++){
        cin>>time[i];
        sum+=time[i];
        int temp=time[i]%10;
        if(temp==0) temp=10;
        sum+=10-temp;
        m=min(temp,m);
    }
    sum=sum-(10-m);
    cout<<sum;
    return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

S = readline().rstrip()
N = len(S)
ans = N
ans2 = N
for i in range(N):
    if S[i] == "1":
        ans = min(ans,max(N-i-1,i))
    else:
        ans2 = min(ans2,max(N-i-1,i))
print(max(ans,ans2))


Measured memory_bytes: 9492
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

vector<int> used;
vector<int> rel[200];
bool visited[200];

bool tansaku(int u){
	visited[u]=true;

	for(int i=0;i<rel[u].size();i++){
		if(visited[rel[u][i]] || tansaku(rel[u][i])){
			return true;
		}
	}

	visited[u]=false;
	return false;
}

int solve(){
	for(int i=0;i<used.size();i++){
		fill(visited,visited+200,false);
		if(tansaku(used[i])) return 1;
	}
	return 0;
}

int main(){
	int n;
	int u,d;
	char _rel[5];

	fill(visited,visited+100,false);
	cin>>n;
	while(n--){
		cin>>u>>_rel>>d;
		u--;d=99+d;

		if(!visited[u]){
			visited[u]=true;
			used.push_back(u);
		}

		if(_rel[0]=='l'){
			rel[d].push_back(u);
		}else if(_rel[0]=='w'){
			rel[u].push_back(d);
		}
	}

	cout<<solve()<<endl;
	return 0;
}

Measured memory_bytes: 3148
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;


int main(void) {
  int n;
  string s;
  cin >> s;
  n = s.size();
  vector<int> ans(n);
  rep(ri, 2) {
    {// solve R
      int cnt = 0;
      rep(i, n) {
        if(s[i] == 'R') cnt++;
        else {
          ans[i] += cnt/2;
          ans[i-1] += (cnt+1)/2;
          cnt = 0;
        }
      }
    }
  
    reverse(ans.begin(), ans.end());
    reverse(s.begin(), s.end());
    rep(i, n) {
      if(s[i] == 'L') s[i] = 'R';
      else s[i] = 'L';
    }
  }

  rep(i, n) {
    printf("%d\n", ans[i]);
  }

  return 0;
}


Measured memory_bytes: 1024
import collections

n=int(input())
*a,=map(int,input().split())
 
b=[0]
 
for i in range(n):
  b.append(a[i]+b[i])
 
L=collections.Counter(b)

ans=0
for i in L.values():
      if i>1:
            ans+=i*(i-1)//2
print(ans)


Measured memory_bytes: 41708
def calcurate_cost(A, B, n):
    cost = 0
    s = min(A)
    V = [False] * n
    T = { j:i for i, j in enumerate(B) }
    for i in range(n):
        if V[i]:
            continue
        cur = i
        S = 0
        an = 0
        m = 10000
        while True:
            V[cur] = True
            an += 1
            v = A[cur]
            m = min(m, v)
            S += v
            cur = T[v]
            if V[cur]:
                break
        cost += min(S + (an - 2) * m, m + S + (an + 1) * s)
    return cost
    
def minimum_cost_sort(A, n):
    B = sorted(A)
    return calcurate_cost(A, B, n)

n = int(input())
A = [int(i) for i in input().split()]
print(minimum_cost_sort(A, n))


Measured memory_bytes: 5688