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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

template <typename T>
class BIT {
 public:
  BIT(int n) : v_(n) {}
  T Sum(int i) const {
    T ret = 0;
    while (i >= 0) {
      ret += v_[i];
      i = (i & (i + 1)) - 1;
    }
    return ret;
  }
  T Get(int i) const { return Sum(i) - Sum(i - 1); }
  void Add(int i, T v) {
    while (i < v_.size()) {
      v_[i] += v;
      i |= i + 1;
    }
  }

 private:
  std::vector<T> v_;
};

struct Q {
  int l, r, i, v;
};

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

  in(int, n, q);
  V<int> c(n);
  rep(i, n) cin >> c[i];
  V<Q> qs;
  rep(i, q) {
    in(int, l, r);
    --l, --r;
    qs.push_back({l, r, i, 0});
  }
  sort(all(qs), [](const Q& a, const Q& b) { return a.r < b.r; });
  V<int> seen(n, -1);
  int seen_cnt = 0;
  BIT<int> bit(n);
  auto qit = qs.begin();
  V<int> ans(q);
  rep(i, n) {
    int& s = seen[c[i] - 1];
    if (s == -1) {
      ++seen_cnt;
    } else {
      bit.Add(s, -1);
    }
    s = i;
    bit.Add(i, 1);
    while (qit != qs.end() && qit->r == i) {
      ans[qit->i] = seen_cnt - bit.Sum(qit->l - 1);
      ++qit;
    }
  }
  rep(i, q) out(ans[i]);
}

Measured memory_bytes: 19352
class Graph
  def initialize(n)
    @g = Array.new(n){ [] }
    @dp = Array.new(n, -1)
  end
  def add(a,b)
    @g[a] << b
  end
  def bfs(v)
    return @dp[v] if @dp[v] != -1
    return @dp[v] = 0 if @g[v].empty?
    ans = 0
    @g[v].each do |nv|
      len = bfs(nv)
      ans = len if ans < len
    end
    @dp[v] = ans + 1
  end
end

n,m = gets.split.map(&:to_i)
g = Graph.new(n)
m.times do
  x,y = gets.split.map(&:to_i)
  x -= 1
  y -= 1
  g.add(x,y)
end

ans = 0
n.times do |v|
  len = g.bfs(v)
  ans = len if ans < len
end

puts ans

Measured memory_bytes: 73088
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

constexpr char endl('\n');

#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define INF 100000000000ULL

#define H 10ULL
#define W 10ULL

size_t n, q;
vector<size_t> c, p, x;
vector<vector<size_t>> g;


void dfs(size_t i, size_t p, size_t val)
{
    size_t next_val = val + c.at(i);
    c.at(i) += val;
    size_t s = g.at(i).size();
    REP(j, s) {
        size_t target = g.at(i).at(j);
        if (target == p) continue;
        dfs(target, i, next_val);
    }
}


int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    cin >> n >> q;
    c.resize(n);
    g.resize(n);
    p.resize(q);
    x.resize(q);
    fill(c.begin(), c.end(), 0);

    REP(i, n-1) {
        size_t a, b;
        cin >> a >> b;
        a -= 1;
        b -= 1;
        g.at(a).push_back(b);
        g.at(b).push_back(a);
    }
    REP(i, q) {
        size_t pi, xi;
        cin >> pi >> xi;
        p.at(i) = pi - 1;
        x.at(i) = xi;
    }

    REP(i, q) {
        c.at(p.at(i)) += x.at(i);
    }
    dfs(0, INF, 0);
    REP(i, n) {
        cout << c.at(i) << (i == (n - 1) ? "\n" : " ");
    }


    return 0;
}


Measured memory_bytes: 33664
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;


int main(){
	int N;
	scanf("%d", &N);

	int F[N][10];
	long long P[N][11];

	for(int i=0;i<N;i++){
		for(int j=0;j<10;j++){
			scanf("%d", &F[i][j]);
		}
	}
	for(int i=0;i<N;i++){
		for(int j=0;j<=10;j++){
			scanf("%lld", &P[i][j]);
		}
	}

	long long max = 100*(-10000000);
	for(int i=1;i<1024;i++){
		int J[10];
		int tmp = i;
		for(int j=0;j<10;j++){
			J[j] = tmp%2;
			tmp /= 2;
		}
		long long sum = 0;
		for(int j=0;j<N;j++){
			int t = 0;
			for(int k=0;k<10;k++){
				if(J[k]==1 && J[k]==F[j][k]) t++;
			}
			sum += P[j][t];
		}
		if(max < sum) max = sum;
	}

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

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdlib>
using namespace std;
bool index(int s,int k){
  if(s>k) return true;
  else return false;
}
int main(){
  int d,n,m;
  while(cin>>d,d){
    cin >> n >> m;
    int s[n+1],k,ans = 0;
    for(int i=1;i<n;i++) cin >> s[i];
    s[0] = 0;
    s[n] = d;
    sort(s,s+n+1);
    for(int i=0;i<m;i++){
      cin >> k;
      int max = n;
      int mins = 0;
      while(max!=mins+1){
 int a = (max+mins) / 2;
 if(index(s[a],k)) max = a;
 else mins = a;
      }
      ans += min(abs(k-s[max]),abs(k-s[mins]));
    }
    cout << ans << endl;
  }
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    int h0, h, c = 0, m = 0;
    for (int i = 0; i < n; ++i) {
        if (i == 0) {
            cin >> h0;
            continue;
        }
        cin >> h;
        if (h0 >= h) {
            ++c;
        } else {
            c = 0;
        }
        if (c > m) {
            m = c;
        }
        h0 = h;
    }
    cout << m << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
int main()
{
    int a,b;
    while (cin >> a >> b)
    {
        cout << __gcd(a,b) << " " << (long long)a*b/__gcd(a,b) << endl;
    }
}

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

using namespace std;
int main()
{
    string s;
    int x, y, i;
    cin >> x >> y;
    for(i=0;i<y+2;i++) putchar('#');
    putchar('\n');
    for(i=0;i<x;i++)
    {
        cin >> s;
        printf("#%s#\n",s.c_str());
    }
    for(i=0;i<y+2;i++) putchar('#');
    putchar('\n');
    return 0;
}


Measured memory_bytes: 256
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let a=read::<i32>();
    println!("{}",if a/100==a%10{"Yes"}else{"No"})
}

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

int main(void)
{
    int x, a, b;

    scanf("%d %d %d", &x, &a, &b);
    if (abs(x - a) < abs(x - b))
        printf("A");
    else if (abs(x - a) > abs(x - b))
        printf("B");

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

void solve(){
 ll n;
  cin >> n;
 vll l(n);
  rep(i,0,n) cin >> l[i];
  sort(all(l));
 
  ll ans=0;
  rep(i,0,n){
   rep(j,i+1,n){
     if(l[i]==l[j]) continue;
     rep(k,j+1,n){
      if(l[j]==l[k]) continue;
      if(abs(l[j]-l[i])<l[k]&&l[k]<l[i]+l[j]) ++ans;
     }
   }
  }
  cout << ans << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 3660
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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

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

int main(void) {
    ll W, H, x, y;
    cin >> W >> H >> x >> y;

    double area = (((double) W) / 2.0f) * ((double) H);

    if (x * 2 == W && y * 2 == H) {
        printf("%.10f %d\n", area, 1);
    } else {
        printf("%.10f %d\n", area, 0);
    }

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main()
    {
        string s = Console.ReadLine();

        Console.WriteLine(s.Substring(0, 3) + "8" + s.Substring(4, s.Length - 4));
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define rt return
#define dll(x) scanf("%I64d",&x)
#define xll(x) printf("%I64d\n",x)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll powmod(ll a,ll b,ll MOD){ll ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
int par[maxn];
int par2[maxn];
int n;
int m1,m2;
void init()
{
	repd(i,0,n)
	{
		par[i]=i;
		par2[i]=i;
	}
}
int findpar(int x)
{
	return x==par[x]?x:par[x]=findpar(par[x]);
}
int findpar2(int x)
{
	return x==par2[x]?x:par2[x]=findpar2(par2[x]);
}
void merg(int x,int y)
{
	x=findpar(x);
	y=findpar(y);
	if(x!=y)
	{
		par[x]=y;
	}
}
void merg2(int x,int y)
{
	x=findpar2(x);
	y=findpar2(y);
	if(x!=y)
	{
		par2[x]=y;
	}
}
std::vector<int> v[maxn];
// std::vector<int> v2[];

int main()
{
    //freopen("D:\\common_text\\code_stream\\in.txt","r",stdin);
	//freopen("D:\\common_text\\code_stream\\out.txt","w",stdout);
	gg(n);
	gg(m1);
	gg(m2);
	init();
	int a,b;
	repd(i,1,m1)
	{
		gg(a);
		gg(b);
//		v[a].pb(b);
//		v[b].push_back(a);
		merg(a,b);
	}
	repd(i,1,m2)
	{
		gg(a);
		gg(b);
//		v[a].pb(b);
//		v[b].push_back(a);
		merg2(a,b);
	}
	map<pii,int> ans;
	repd(i,1,n)
	{
//	    sort(ALL(v[i]));
//	    v[i].erase(unique(ALL(v[i])),v[i].end());
        ans[mp(findpar(i),findpar2(i))]++;
//		int cnt=0;
//		repd(x,1,n)
//		{
//			if((findpar(i)==findpar(x))&&(findpar2(i)==findpar2(x)))
//			{
//				cnt++;
//			}
//		}
////		cnt++;
//		printf("%d ",cnt);
	}
    repd(i,1,n)
    {
        cout<<ans[mp(findpar(i),findpar2(i))]<<" ";
    }

    return 0;
}

inline void getInt(int* p) {
    char ch;
    do {
        ch = getchar();
    } while (ch == ' ' || ch == '\n');
    if (ch == '-') {
        *p = -(getchar() - '0');
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 - ch + '0';
        }
    }
    else {
        *p = ch - '0';
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 + ch - '0';
        }
    }
}



Measured memory_bytes: 38656
#include<bits/stdc++.h>
using namespace std;
int p[20010],a[20010],b[20010];
int main(){
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>p[i];
	}
	for(int i=1;i<=n;i++){
		a[i]=i*(n+10);
		b[i]=(n+10)*(n-i+1);
	}
	for(int i=1;i<=n;i++){
		a[p[i]]+=i;
	}
	for(int i=1;i<=n;i++){
		cout<<a[i];
		if(i==n) cout<<endl;
		else cout<<" ";
	}
	for(int i=1;i<=n;i++){
		cout<<b[i];
		if(i==n) cout<<endl;
		else cout<<" ";
	}
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Sep 19 21:26:14 JST 2020
 **/

signed main() {
    Int n;
    std::cin >> n;
    Int ans = 0;
    REP(a, 1, n + 1) { ans += (n - 1) / a; }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC091A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;

            var word = Console.ReadLine().Split(' ');
            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);
            


            if (c <= a + b)
                Console.WriteLine("Yes");

            else
                Console.WriteLine("No");

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
int main() {
	int A, B, C, D, E, F;
	std::cin >> A >> B >> C >> D >> E >> F;
	if (A + 5 * B + 10 * C + D * 50 + E * 100 + F * 500 >= 1000) {
		std::cout << 1 << std::endl;
	}
	else {
		std::cout << 0 << std::endl;
	}
}


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

int main() {
  int N,Y,a=0,i,j,k;
  cin >> N >> Y;
  
  for(i=0;i<=N;i++){
    for(j=0;i+j<=N;j++){
      k=N-i-j;
      if(Y == 10000*i + 5000*j + 1000*k && N == i+j+k){
        a=1;
        break;
      }
    if(a)
      break;
    }
    if(a)
      break;
  }
  
  if(a)
    cout << i << " " << j << " " << k << endl;
  else
    cout << "-1 -1 -1" << endl;
}


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

int m,n;
int books[110];
int solves();
int search(int a);

int main(){
	while(1){
		cin >> m >> n;
		if(m == 0 && n == 0) break;
		for(int i=0;i<n;i++){
			cin >> books[i];
		}
		int ans = solves();
		cout << ans << endl;
	}
}

int solves(){
	int ub = 0,lb = 2000000, mid;
	for(int i=0;i<1000;i++){
		mid = (ub + lb) / 2;
		if(search(mid)) lb = mid;
		else ub = mid;
	}
	return lb;
}

int search(int a){
	int len = a;
	int cou = 0;
	for(int i=0;i<n;i++){
		while(1){
			if(0 > len-books[i]){
				cou++;
				len = a;
			}
			else break;
			if(cou == m) return 0;
		}
		len -= books[i];
	}
	return 1;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <cstdio>
typedef long long lld;
const int MAXN = 105;
const int MAXW = 1e5+5;
lld dp[MAXN][MAXW];
int v[MAXN];
int w[MAXN];
int N, W;

lld solve() {
  for (int j = 0; j <= W; ++j) {
    dp[0][j] = 0;
  }
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= W; ++j) {
      dp[i][j] = dp[i-1][j];
      if (j < w[i]) continue;
      dp[i][j] = std::max(dp[i-1][j - w[i]] + v[i], dp[i][j]);
    }
  }
  return *std::max_element(dp[N], dp[N] + W + 1);
}

int main() {
  scanf(" %d%d", &N, &W);
  for (int i = 1; i <= N; ++i) {
    scanf(" %d%d", &w[i], &v[i]);
  }
  printf("%lld\n", solve());
  return 0;
}

Measured memory_bytes: 80000
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H, W, i, j;
  cin >> H >> W;
  char S[H+2][W+2];
  int Ms[H][W];
  for(i=0;i<H+2;i++)
    for(j=0;j<W+2;j++)
      S[i][j] = Ms[i%H][j%W] = 0;
  for(i=0;i<H;i++)
    scanf("%s", S[i+1]+1);
  for(i=0;i<H;i++){
    for(j=0;j<W;j++){
      if(S[i+1][j+1]=='.')
        Ms[i][j] = (S[i][j]=='#')+(S[i][j+1]=='#')+(S[i][j+2]=='#')
        +(S[i+1][j]=='#')+(S[i+1][j+2]=='#')
        +(S[i+2][j]=='#')+(S[i+2][j+1]=='#')+(S[i+2][j+2]=='#');
      printf(((S[i+1][j+1]=='.')?"%d":"%c"),((S[i+1][j+1]=='.')?Ms[i][j]:'#'));
    }
    cout << endl;
  }
}

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

#define lli long long int
#define pb push_back
#define in insert
#define pi pair<int, int>
#define pii pair<int, pi>
#define mp make_pair
#define fir first
#define sec second
#define MAXN 101
#define MAXS 901
#define INF 1000000000
#define mod 1000000007

signed main()
{
  string s;
  cin >> s;
  lli ans = 0;
  map<int, int> m;
	m[0]++;
	int t = 0 , p2 = 1 ;
  for(int i = s.size() - 1 ; i >= 0 ; i--) 
  {
    t = (t + (s[i] - '0') * p2) % 2019 ;
    ans += m[t];
    m[t]++;
    p2 = p2 * 10 % 2019;
  }
  cout << ans << endl;
  return 0;
}


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

int solve() {
  int N; std::cin >> N;
  std::vector<long long> l(N);
  for (int i = 0; i < N; ++i) std::cin >> l[i];

  
  /* 全探索 */
  long long cnt = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i; j < N; ++j) {
      for (int k = j; k < N; ++k) {
        if (l[i] == l[j] || 
            l[j] == l[k] || 
            l[k] == l[i]) continue; // 3辺の長さがすべて異なる

        if (l[i] + l[j] > l[k] && 
            l[j] + l[k] > l[i] && 
            l[k] + l[i] > l[j]) ++cnt; // 三角形の成立条件
      }
    }
  }

  return cnt;
    
}

int main() {
  std::cout << solve() << std::endl; 

  return 0;
}


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

int main(){
	int n;
	cin >> n;
	vector<int> x(n), s(n);
	for(int i=0; i<n; i++){
		cin >> x[i];
		s[i] = x[i];
	}
	sort(s.begin(), s.end());
	for(int i=0; i<n; i++){
		if(x[i] <= s[n/2 - 1]) cout << s[n/2] << endl;
		else cout << s[n/2 - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 3712
s = list(input())
l = len(s)
if s==s[::-1] and s[:int((l-1)/2)]==s[int((l-1)/2)-1::-1] and s[int((l-1)/2)+1:]==s[:int((l-1)/2):-1]:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<ll,ll> P;
//ll const INF=1001001001;
//ll const INF=1001001001001001001;
ll const MOD=1000000007;

ll N;
ll A[100000];

int main(){
    cin>>N;
    rep(i,N) cin>>A[i];

    map<ll,ll> m;
    rep(i,N) m[A[i]]++;

    ll x=0,y=0;
    repr(e,m){
        if(4<=e.second){
            x=y=e.first;
        }else if(2<=e.second){
            x=y;
            y=e.first;
        }
    }

    ll ans=x*y;
    cout<<ans<<endl;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,x; cin>>n>>x;
    vi l(n);
    rep(i,n) cin>>l[i];
    int d = 0;
    int ans = 1;
    rep(i,n){
        if ((d=d+l[i])>x) break;
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

bool check(int n, vector<int> vec){
	while(n){
		int a = n%10;
		for(int i = 0; i < vec.size(); i++){
			if(a == vec[i]) return false;
		}
		n /= 10;
	}
	return true;
}

int
main(void){
	int n, k;
	cin >> n >> k;
	vector<int> vec(k);
	for(int i = 0; i < k; i++) cin >> vec[i];
	for(int i = n; ;i++){
		if(check(i, vec)){
			cout << i;
			break;
		}
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		if (n%k == 0) {
			System.out.println(0);
		} else {
			System.out.println(1);
		}
	}
}


Measured memory_bytes: 20688
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n,x,t,s;
  cin>>n>>x>>t;
  if(n%x!=0)
  s=((n/x)+1)*t;
  else
    s=(n/x)*t;
  cout<<s<<'\n';
  return 0;
}

Measured memory_bytes: 3632
#pragma GCC optimize("O3") 

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

typedef long long int           ll;
typedef unsigned long long int  ull;
typedef long double             ld;

typedef pair<int, int>          pii;
typedef pair<ll,ll>             pll;
typedef vector<int>             vi;
typedef vector<ll>              vll;
typedef vector<pii>             vpii;
typedef vector<pll>             vpll;

#define test(t)		        int t; cin >> t; while(t--)
#define f(i, a, b)	        for(int (i) = (a); (i) < (b); ++(i))
#define all(a)		        (a).begin(), (a).end()
#define endl 		        "\n"
#define maxvec(vec)             *max_element(all(vec))
#define minvec(vec)             *min_element(all(vec))
#define maxarr(arr)             *max_element(arr, arr + n)
#define minarr(arr)             *min_element(arr, arr + n)
#define deb(x)		        cout << #x << ": " << x << endl;
#define deb2(x,y)	        cout << #x << ": " << x << " ~ " <<  #y << ": " << y << endl;
#define deba(arr)	        cout << #arr << " ~ [ "; for(auto n: arr) cout << n << " "; cout << "]" << endl;
#define debap(arr)	        cout << #arr << " ~ [ "; for(auto n: arr) cout << n.first << "-" << n.second << " "; cout << "]" << endl;
#define fast 		        ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define mx9		1000000007
#define mx7		10000007
#define mx6		1000006
#define mx5		200005
#define inf		1<<30                                 
#define eps		1e-9
#define mod		1000000007
#define PI		3.141592653589793238462643383279502884L

void solve()
{
  ll n;
  cin >> n;
  ll a[n];
  vector<ll> vec;
  f(i, 0, n)
    cin >> a[i];
  ll cnt = 0;
  f(i, 0, n)
    f(j, i + 1, n)
    	f(k, j + 1, n)
    		if(a[i] + a[j] > a[k] && a[i] + a[k] > a[j] &&  a[j] + a[k] > a[i] && a[i] != a[j] && a[j] != a[k] && a[k] != a[i])
    		    cnt += 1;
    cout << cnt << endl;
}

int main()
{
    fast;
    //test(t)
        solve();
    return 0;
}

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

public class Main {
public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] a = new int[3];
    for(int i = 0;i < 3;i ++){
        a[i] = sc.nextInt();
    }
    Arrays.sort(a);
    int ans = a[2] * 10 + a[1] + a[0];
    System.out.println(ans);

}
}

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

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

    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<char>());

    if (s < t)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
int n, a, b, i;
int max = 0;
int min = 0;
long int sum = 0;

scanf("%d", &n);

for(i = 0; i < n; i++)
{
 scanf("%d", &a);

if(i == 0)
{
max = a;
min = a;
}

if(a > max)
max = a;

if(a < min)
min = a;

sum = sum + a;

}

printf("%d %d %ld\n", min, max, sum);

return 0;

}




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

int n,m;
int a[310][310]; 
int ans;
int vis[310];
stack<int> s[310];

int main()
{
	cin>>n>>m;
	for (int i=1;i<=n;i++)
		for (int o=1;o<=m;o++) cin>>a[i][o];
	for (int i=1;i<=n;i++)
		for (int o=m;o;o--) s[i].push(a[i][o]);
	
	ans=n;
	for (int i=1;i<=m;i++)
	{
		int c[310];
		memset(c,0,sizeof c);
		
		for (int o=1;o<=n;o++) c[s[o].top()]++;
		int maxi=s[1].top();
		for (int o=2;o<=n;o++) if (c[s[o].top()]>c[maxi]) maxi=s[o].top();
		vis[maxi]=1;
		ans=min(ans,c[maxi]);
		for (int o=1;o<=n;o++)
			while (!s[o].empty() && vis[s[o].top()]) s[o].pop();
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define md 1000000007
#define ll long long 
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fastmap mp.reserve(1024);mp.max_load_factor(0.25);
#define fastset st.reserve(1024);st.max_load_factor(0.25);

//freopen("inp.txt",r,stdin);
//freopen("out.txt",w,stdout);
ll int mpw(ll int a,ll int b,ll int m)
{
	ll int ans=1;
	if(a==0)return 0;
	if(a==1 || b==0)return 1;
	while(b)
	{
		if(b&1)
		{
			ans=(ans*a)%m;
		}
		a=(a*a)%m;
		b>>=1;
	}
	return ans;
}
 
ll int pw(ll int a,ll int b)
{
	ll int ans=1;
	if(a==0)return 0;
	if(a==1 || b==0)return 1;
	while(b)
	{
		if(b&1)
		{
			ans*=a;
		}
		a*=a;
		b>>=1;
	}
	return ans;
}
 
ll int mn(ll int a,ll int b)
{
	if(a<=b)
	{
		return a;
	}
	return b;
}
 
ll int mx(ll int a,ll int b)
{
	if(a>=b)
	{
		return a;
	}
	return b;
}

struct line{
	ll int m,c;
	ll int eval(ll int x){
		return m*x+c;
	}
	ll int intersect(line l){
		return (long double) (c-l.c)/(l.m-m);
	}
};

int main()
{
	fio
	int n;
	ll int c;
	cin>>n>>c;
	vector<ll int>h(n);
	vector<ll int>D(n);
	D[0]=0;
	for(int i=0;i<n;++i)
	{
		cin>>h[i];
	}
	deque<line>dq;
	dq.resize(0);
	ll int ans=0;
	dq.push_front({2*h[0],-h[0]*h[0]});
	for(int i=1;i<n;++i)
	{
		while(dq.size()>=2 && dq.back().eval(h[i])<=dq[dq.size()-2].eval(h[i]))
		{
			dq.pop_back();
		}
		ll int val=(h[i]*h[i])+c-dq.back().eval(h[i]);
		D[i]=val;
		line cur={2*h[i],-D[i]-(h[i]*h[i])};
		while(dq.size()>=2 && cur.intersect(dq[0]) <= dq[0].intersect(dq[1]))
		{
			dq.pop_front();
		}
		dq.push_front(cur);
	}	

	cout<<D[n-1]<<"\n";
	return 0;
}

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

typedef long long ll;

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

    int n,k,ans=0;
    cin >> n >> k;
    for(int i=0;i<n;i++){
        int h;
        cin >> h;
        if(h>=k) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

#define F first
#define S second
#define pb push_back
#define ll long long
#define all(v) (v).begin(),(v).end()
#define endl '\n'

using namespace std;

//TooNewBie

const int N = 2005;
const int MOD = 1e9 + 7;
const int INF = 2000000000;
const ll INFLL = 1LL * INF * INF;

int a[N], b[N];
ll dp[N][N];
int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= m; i++) cin >> b[i];
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
            dp[i][j] = (dp[i][j] - dp[i - 1][j - 1] + MOD) % MOD;
            if (a[i] == b[j]) {
                dp[i][j] = (dp[i][j] + 1 + dp[i - 1][j - 1]) % MOD;
            }
        }
    }
    cout << (dp[n][m] + 1) % MOD << endl;
    return 0;
}


Measured memory_bytes: 31616
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
vector<ll> tree(900010,0);
void up(ll x,ll l,ll r,ll node,ll val){
	if(l==r){
		if(l==x)
		tree[node]=val;
		return;
	}
	else if(l>x || r<x){
		return;
	}
	else{
		ll mid=(l+r)/2;
		up(x,l,mid,2*node,val);
		up(x,mid+1,r,2*node+1,val);
		tree[node]=max(tree[2*node],tree[2*node+1]);
		return;
	}
}
ll qu(ll l,ll r,ll node,ll st,ll en){
	if(l>=st && en>=r){
	return tree[node];
	}
	else if(r<st || en<l){
		return 0;
	}
	else{
		ll mid=(l+r)/2;
		ll x1=qu(l,mid,2*node,st,en);
		ll x2=qu(mid+1,r,2*node+1,st,en);
		return max(x1,x2);
	}
}
int main(){
	int n;
	cin>>n;
	ll a[n];
	ll b[n];
	ll ans=0;
	for(int i=0;i<n;i++)
	cin>>a[i];
	for(int i=0;i<n;i++)
	cin>>b[i];
	for(int i=0;i<n;i++){
		/*if(i==0){
			up(a[i],1,n,1,b[0]);
			ans=max(ans,b[0]);
		}
		else{*/
		ll z=0;
		if(a[i]!=1)
		z=qu(1,n,1,1,a[i]-1);
		up(a[i],1,n,1,b[i]+z);
		ans=max(ans,b[i]+z);
		//}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 10368
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String text=sc.next();
		char word[]=new char[26];
		for(int i=0;i<text.length();i++) {
			word[text.charAt(i) - 'a']++;
		}
		sc.close();
		for(int i=0;i<26;i++) {
			if((word[i] %2 )== 1) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  int n; cin >> n;
  V<lint> a(n); for (int i = 0; i < n; ++i) cin >> a[i];
  V<lint> r(n + 1);
  map<int, int> mp;
  for (int i = n - 2; i >= 0; --i) {
    if (a[i] <= a[i + 1]) {
      r[i] = r[i + 1];
      int k = 0;
      while (a[i] << 2 * (k + 1) <= a[i + 1]) ++k;
      mp[i + 1] = k;
    } else {
      int k = 0;
      while (a[i] > a[i + 1] << 2 * k) ++k;
      r[i] = r[i + 1];
      auto itr = mp.lower_bound(i + 2);
      int j = i + 1;
      while (itr != end(mp)) {
        if (k < itr->second) {
          r[i] += k * (itr->first - j);
          j = itr->first;
          itr->second -= k;
          k = 0;
          break;
        } else {
          r[i] += k * (itr->first - j);
          j = itr->first;
          k -= itr->second;
          mp.erase(itr++);
          if (k == 0) break;
        }
      }
      r[i] += k * (n - j);
    }
  }
  reverse(begin(a), end(a));
  V<lint> l(n + 1);
  map<int, int>().swap(mp);
  for (int i = n - 2; i >= 0; --i) {
    if (a[i] <= a[i + 1]) {
      l[i] = l[i + 1];
      int k = 0;
      while (a[i] << 2 * (k + 1) <= a[i + 1]) ++k;
      mp[i + 1] = k;
    } else {
      int k = 0;
      while (a[i] > a[i + 1] << 2 * k) ++k;
      l[i] = l[i + 1];
      auto itr = mp.lower_bound(i + 2);
      int j = i + 1;
      while (itr != end(mp)) {
        if (k < itr->second) {
          l[i] += k * (itr->first - j);
          j = itr->first;
          itr->second -= k;
          k = 0;
          break;
        } else {
          l[i] += k * (itr->first - j);
          j = itr->first;
          k -= itr->second;
          mp.erase(itr++);
          if (k == 0) break;
        }
      }
      l[i] += k * (n - j);
    }
  }
  reverse(begin(l), end(l));
  lint res = 1e18;
  for (int i = 0; i <= n; ++i) {
    res = min(res, 2 * (l[i] + r[i]) + i);
  }
  cout << res << '\n';
}

Measured memory_bytes: 14336
#include<stdio.h>
#include<string.h>
int main()
{
    long long a,b,res,temp;
    while(scanf("%lld%lld",&a,&b)==2)
    {
        temp=0;
        res=a+b;
        while(res!=0)
        {
            long long div,mod;
            mod=res%10;
            div=res/10;
            temp+=1;
            res=div;
        }
        printf("%lld\n",temp);
    }
    return 0;
}

Measured memory_bytes: 1028
import copy
def bubbleSort(B, N):
    stable = True
    flag = 1
    while flag:
        flag = 0
        for j in range(N-1, 0, -1):
            if B[j][1] < B[j-1][1]:
                if B[j][1] == B[j-1][1] and j != j-1:
                    stable = False

                B[j-1], B[j] = B[j], B[j-1]
                flag = 1

    return B

def selectionSort(S, N):
    stable = True
    for i in range(N):
        minj = i
        for j in range(i,N):
            if S[j][1] < S[minj][1]:
                minj = j
        if S[i][1] == S[minj][1] and i != minj:
            stable = False

        if i != minj:
            S[i], S[minj] = S[minj], S[i]

    return S

N = int(input())
A = list(input().split())
B = A.copy()

out_A = selectionSort(A,N)
out_B = bubbleSort(B,N)

print(" ".join(out_B))
print("Stable")

print(" ".join(out_A))
if out_A == out_B:
    print("Stable")
else:
    print("Not stable")


Measured memory_bytes: 6344
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
long long int fie[110][11][1100];
int main(){
    while(1){
        for(int i=0;i<110;i++){
            for(int j=0;j<11;j++){
                for(int k=0;k<1100;k++)fie[i][j][k]=0;
            }
        }
        int N,S;
        cin>>N>>S;
        if(N==0&&S==0)break;
        fie[1][0][0]=1;fie[1][1][1]=1;
        for(int i=1;i<100;i++){
            for(int j=0;j<10;j++){
                for(int k=0;k<=1000;k++){
                    fie[i+1][j][k]+=fie[i][j][k];
                    fie[i+1][j+1][k+i+1]+=fie[i][j][k];
                }
            }
        }
        cout<<fie[100][N][S]+fie[100][N-1][S]<<endl;
    }
    return 0;
}

Measured memory_bytes: 11556
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using V = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#define YN(e) cout << ((e) ? "YES" : "NO") << endl
#define yn(e) cout << ((e) ? "Yes" : "No") << endl
#pragma endregion RegionDefs

template<class T>
bool combination_with_replacement_dfs(const vector<T>& seed, int size, bool (*callback)(const vector<T>&), int depth, vector<int>& used, vector<T>& temp)
{
    if (depth == size)
        return callback(temp);
    for (int i = depth == 0 ? 0 : used[depth-1]; i < seed.size(); ++i)
    {
        temp[depth] = seed[i];
        used[depth] = i;
        if (combination_with_replacement_dfs(seed, size, callback, depth+1, used, temp))
            return true;
    }
    return false;
}

template<class T>
bool combination_with_replacement_dfs(const vector<T>& seed, int size, bool (*callback)(const vector<T>&))
{
    vector<int> used(size);
    vector<T> temp(size);
    return combination_with_replacement_dfs(seed, size, callback, 0, used, temp);
}

vector<tuple<ll, ll, ll, ll>> cond;
ll mx = 0;

// callbackがtrueを返すと、その時点で探索を終了する。
bool test_callback(const vector<ll>& comb)
{
    ll pts = 0;
    for (auto&& t : cond)
    {
        if (comb[get<1>(t)] - comb[get<0>(t)] == get<2>(t))
            pts += get<3>(t);
    }
    chmax(mx, pts);
    return false;
}

void solve()
{
    IN(n, m, q);
    vector<ll> v(m);
    rep(i, m)
        v[i] = i+1;
    rep(i, q)
    {
        IN(a, b, c, d);
        cond.emplace_back(a-1, b-1, c, d);
    }
    combination_with_replacement_dfs(v, n, test_callback);
    cout << mx << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
const ll MOD=1000000007;

int main(){
    int N,C;
    cin >> N >> C;
    vector<vector<Pii>> table(C);
    rep (i,N){
        int s,t,c;
        cin >> s >> t >> c;
        s--;
        table[c-1].push_back(Pii(s,t));
    }
    map<int,int> m;
    rep (i,C){
        sort(table[i].begin(),table[i].end());
        rep (j,table[i].size()){
            if (j!=table[i].size()-1&&table[i][j].second-1==table[i][j+1].first){
                table[i][j+1].first++;
            }
            m[table[i][j].first]++;
            m[table[i][j].second]--;
        }
    }
    int now=0,ans=0;
    for (auto x:m){
        now+=x.second;
        ans=max(ans,now);
    }
    cout << ans << endl;
}

Measured memory_bytes: 5748
import java.util.Scanner;
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();
      String x = "NO";
      if(a == 5){
        if ((b == 5) && (c == 7)){
          x = "YES";
        } else if ((b == 7) && (c == 5)) {
          x = "YES";
        }
      } else if (a == 7) {
        if ((b==5) && (c==5)){
          x = "YES";
        }
      }
      System.out.println(x);
      sc.close();
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
	static Scanner s = new Scanner(System.in);

	public static void main(String[] args) {

		int N = s.nextInt();
		String[] bArr = new String[N];
		boolean[] bBoolArr = new boolean[N];

		for (int i = 0; i < N; i++) {
			bArr[i] = s.next();
			bBoolArr[i] = true;
		}

		int M = s.nextInt();
		String[] rArr = new String[M];

		for (int i = 0; i < M; i++) {
			rArr[i] = s.next();
		}

		int count = 1;
		int ans = 0;

		if (N == 1) {
			for (int k = 0; k < M; k++) {
				if (rArr[k].equals(bArr[0])) {
					System.out.println(0);
					return;
				}
			}
			System.out.println(1);
			return;
		}

		for (int i = 0; i < N; i++) {
			if (bBoolArr[i] == true) {
				count = 1;
				for (int j = i + 1; j < N; j++) {

					if (bArr[i].equals(bArr[j])) {
						bBoolArr[j] = false;
						count++;
					}
				}

				for (int k = 0; k < M; k++) {
					if (bArr[i].equals(rArr[k])) {
						count--;
					}
				}
			}if (count < 1) {
				count = 0;
			}
			if (ans < count) {
				ans = count;
			}



			bBoolArr[i] = false;
		}
		System.out.println(ans);

	}
}


Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, x;
    cin >> n >> m >> x;
    int sum1 = 0, sum2 = 0;
    for(int i = 0; i < m; i++)
    {
        int a;
        cin >> a;
        if(a > x) sum1++;
        else sum2++;
    }
    cout << min(sum1, sum2) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;

    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;

    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

void solve() {
    int n;
    cin >> n;
    unordered_map<string, int> count;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        count[s]++;
    }
    vector<pair<int, string>> vec;
    for (auto& p : count) {
        vec.emplace_back(p.second, p.first);
    }
    sort(vec.begin(), vec.end());
    vector<string> ans;
    int sz = vec.size();
    for (int i = sz - 1; i >= 0 && vec[i].first == vec[sz - 1].first; --i) {
        ans.push_back(vec[i].second);
    }
    sort(ans.begin(), ans.end());
    for (auto& s : ans) {
        cout << s << '\n';
    }
}

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

    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}

Measured memory_bytes: 29760
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, c; cin >> a >> b >> c;
    ll res = 0;
    if((a % 2 == b % 2) && (c % 2 != a % 2)){
        a++;
        b++;
        res++;
    }
    else if((b % 2 == c % 2) && (a % 2 != b % 2)){
        b++;
        c++;
        res++;
    }
    else if((c % 2 == a % 2) && (b % 2 != c % 2)){
        c++;
        a++;
        res++;
    }
    else{
        ;
    }
    res += ((max({a, b, c}) - a) / 2 + (max({a, b, c}) - b) / 2 + (max({a, b, c}) - c) / 2);
    cout << res;
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))

data=[[(A[0],0),(-1,-1)] for i in range(2**N)]
for i in range(1,2**N):
    for j in range(N):
        if i>>j&1==1:
            a,b=data[i-2**j]
            if a[0]>data[i][0][0]:
                data[i][1]=data[i][0]
                data[i][0]=a
            elif a[0]>data[i][1][0] and a[1]!=data[i][0][1]:
                data[i][1]=a
            if b[0]>data[i][0][0]:
                data[i][1]=data[i][0]
                data[i][0]=b
            elif b[0]>data[i][1][0] and b[1]!=data[i][0][1]:
                data[i][1]=b
    a=(A[i],i)
    if a[0]>data[i][0][0]:
        data[i][1]=data[i][0]
        data[i][0]=a
    elif a[0]>data[i][1][0] and a[1]!=data[i][0][1]:
        data[i][1]=a


ans=[data[i][0][0]+data[i][1][0] for i in range(2**N)]
for i in range(2,2**N):
    ans[i]=max(ans[i],ans[i-1])

for i in range(1,2**N):
    print(ans[i])


Measured memory_bytes: 132428
import java.io.*;
        import java.text.*;
        import java.util.*;

public class Main {

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solver s = new solver();
        int t = 1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    }

    static class InputReader {

        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int ni() {
            return Integer.parseInt(sn());
        }

        public String snl() throws IOException {
            return br.readLine();
        }

        public long nlo() {
            return Long.parseLong(sn());
        }

        public double nd() {
            return Double.parseDouble(sn());
        }

        public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        }

        public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        }
    }

    static int inf = 5000013;

    static class solver {
        DecimalFormat df = new DecimalFormat("0.00000000");
        long maxi = Integer.MAX_VALUE;
        long mod = (long) (1e9 + 7);

        long pro(long a, long b) {
            return (a % mod * b % mod) % mod;
        }

        long add(long a, long b) {
            return (a + b) % mod;
        }

        void solve() {
            int n = sc.ni();
            int a[] = new int[n];
            HashMap<Integer, Long> map = new HashMap<>();
            for (int i = 0; i < n; i++) {
                a[i] = sc.ni();
                map.put(a[i], map.getOrDefault(a[i], 0l) + 1);
            }
            long ans = 0;
            for (long h : map.values())
                ans += h * (h - 1) / 2;
            for (int i = 0; i < n; i++) {
                long d = map.get(a[i]) - 1;
                out.println(ans - d);
            }
        }
    }
}


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

string we[3] = {"Sunny","Cloudy","Rainy"};
string s;

int main()
{
  cin >> s;
  rep(i,3)
  {
    if(s == we[i]) cout << we[(i+1)%3] << endl;
  }
}

Measured memory_bytes: 3576
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> Pint;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (ll i = begin; i < (ll)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 998244353;

int main()
{
    vector<string> s(3);
    rep(0, i, 3)
    {
        cin >> s.at(i);
    }

    ll t = 0;
    char ans;
    while (1)
    {
        if (s.at(t).size() == 0)
        {
            ans = 'A' + t;
            break;
        }
        char a = s.at(t).at(0);
        s.at(t) = s.at(t).substr(1, s.at(t).size() - 1);
        t = (ll)(a - 'a');
    }

    cout << ans << endl;
}

Measured memory_bytes: 3572