akhauriyash/Code-Regression huggingface dataset:
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
#define gcd(a,b) __gcd(a,b)
#define ll long long int
#define ld unsigned long long int
#define pi pair<ll,ll>
#define pb push_back
#define pf push_front
#define pu push
#define po pop
#define fi first
#define se second
#define mk make_pair
#define ve vector
#define lr(n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define be begin
#define sz(a) (ll)a.size()
#define INF 1e18
 
typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)
 
// ll mod=998244353;
// ll gcd(ll a, ll b){
//     if(a<b) swap(a,b);
//     if(b==0) return a;
//     return gcd(b,a%b);
// }
 
// ll fun(ll x, ll y){
//     ll rem=1;
//     while(y!=0){
//         if(y%2==1){
//             rem=(rem*x)%mod;
//         }
//         x=(x*x)%mod;
//         y/=2;
//     }
//     return rem;
// }

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,w;
	cin>>n>>w;
	ll dp[n+1][w+1];
	for(ll j=0;j<=w;j++) dp[0][j]=0;
	for(ll i=1,wi,vi;i<=n;i++){
		cin>>wi>>vi;
		for(ll j=0;j<=w;j++){
			if(j-wi>=0)
				dp[i][j]=max(dp[i-1][j],dp[i-1][j-wi]+vi);
			else
				dp[i][j]=dp[i-1][j];
		}
	}
	ll ans=0;
	for(ll i=0;i<=w;i++){
		ans=max(ans,dp[n][i]);
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 79232
#include <iostream>
#include <vector>
#include <bitset>
#include <cmath>

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

ll fact[500000];
ll dfact[500000];

ll h, w, a, b;

ll inq(ll x, ll q)
{
    if (q == 0)
        return 1;
    ll l = inq(x, q / 2);
    if (q % 2 == 0)
        return l * l % MOD;
    return l * l % MOD * x % MOD;
}

ll cnk(int n, int k)
{
    ll res = fact[n];
    res *= dfact[k];
    res %= MOD;
    res *= dfact[n - k];
    res %= MOD;
    return res;
}

ll get(int x1, int y1, int x2, int y2)
{
    long long n = x2 - x1 + y2 - y1;
    long long k = x2 - x1;
    //cout << n << " " << k << endl;
    return cnk(n, k);
}

int main()
{
    fact[0] = 1;
    dfact[0] = 1;
    for (int i = 1; i <= 200000; i++)
    {
        fact[i] = fact[i - 1] * i % MOD;
        dfact[i] = inq(fact[i], MOD - 2);
    }
    cin >> h >> w >> a >> b;
    long long ans = 0;
    for (int i = 1; i <= h - a; i++)
    {
        ans += get(1, 1, i, b) * get(i, b + 1, h, w);
        ans %= MOD;
    }
    cout << ans;
}


Measured memory_bytes: 5888
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

constexpr usize operator"" _z(unsigned long long x) noexcept {
  return static_cast<usize>(x);
}

class rep {
  const usize f, l;

public:
  class itr {
    friend rep;
    usize i;
    constexpr itr(const usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr rep(const usize first, const usize last) noexcept
      : f(first), l(last) {}
  constexpr itr begin() const noexcept { return itr(f); }
  constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
  const usize f, l;

public:
  class itr {
    friend revrep;
    usize i;
    constexpr itr(usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
  constexpr itr begin() const noexcept { return itr(l); }
  constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
  return a < b ? b - a : a - b;
}

} // namespace n91

#include <algorithm>
#include <iostream>
#include <string>
#include <utility>

namespace n91 {

void main_() {
  i32 n, l;
  std::cin >> n >> l;
  i32 min = std::numeric_limits<i32>::max();
  i32 ans;
  i32 sum = static_cast<i32>(0);
  for (i32 i = static_cast<i32>(0); i != n; ++i) {
    sum += l + i;
    if (std::abs(l + i) < min) {
      min = std::abs(l + i);
      ans = l + i;
    }
  }
  std::cout << sum - ans << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 256
#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 fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

ll x[222222];
int w[222222];
int I[222222];
ll ans[222222];
const int LG = 31;
int st[LG][222222];

int getnxt(int p, int times)
{
	for(int i=0;i<LG;i++)
	{
		if(times&(1<<i))
		{
			p=st[i][p];
		}
	}
	return p;
}

int circles[222222];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,L,t; cin>>n>>L>>t;
	vector<ll> V[2];
	for(int i=0;i<n;i++)
	{
		cin>>x[i]>>w[i]; w[i]--;
		x[i+n]=x[i]+L; w[i+n]=w[i];
	}
	for(int i=0;i<n;i++)
	{
		V[w[i]].pb(x[i]-L); V[w[i]].pb(x[i]); V[w[i]].pb(x[i]+L);
	}
	sort(V[0].begin(),V[0].end()); sort(V[1].begin(),V[1].end());
	for(int i=0;i<n;i++)
	{
		int ty=w[i];
		int shift = V[ty^1].size()/3;
		if(ty) shift*=-1;
		shift+=i;
		shift%=n;
		if(shift<0) shift+=n;
		st[0][i]=shift;
	}
	for(int i=1;i<LG;i++)
	{
		for(int j=0;j<n;j++)
		{
			st[i][j]=st[i-1][st[i-1][j]];
		}
	}
	ll shiftcnt = ((2LL*t)/L);
	for(int i=0;i<n;i++)
	{
		circles[i] = getnxt(i,shiftcnt);
		//cerr<<circles[i]<<' '; 
	}
	//cerr<<'\n';
	for(int i=0;i<n;i++)
	{
		int ty=w[i];
		ll id = 0;
		ll rem = (2LL*t)%L;
		if(!ty)
		{
			int lb = lower_bound(V[ty^1].begin(),V[ty^1].end(),x[i])-V[ty^1].begin();
			int rb = upper_bound(V[ty^1].begin(),V[ty^1].end(),x[i]+rem)-V[ty^1].begin();
			rb--;
			id+=rb-lb+1;
			id%=n;
		}
		else
		{
			int lb = lower_bound(V[ty^1].begin(),V[ty^1].end(),x[i]-rem)-V[ty^1].begin();
			int rb = upper_bound(V[ty^1].begin(),V[ty^1].end(),x[i])-V[ty^1].begin();
			rb--;
			id+=rb-lb+1;
			id*=-1;
			id%=n;
		}
		while(id<0) id+=n;
		id=circles[(i+id)%n];
		I[i]=id;
		//cerr<<i<<' '<<id<<'\n';
	}
	for(int i=0;i<n;i++)
	{
		ans[I[i]] = x[i] + (w[i]?-t:t);
		ans[I[i]]%=L;
		if(ans[I[i]]<0) ans[I[i]]+=L;
	}
	for(int i=0;i<n;i++)
	{
		cout<<ans[i]<<'\n';
	}
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = l[0], M = l[1];

            var A = new string[N];
            var B = new string[M];

            for (var i = 0; i < N; i++) A[i] = Console.ReadLine();
            for (var i = 0; i < M; i++) B[i] = Console.ReadLine();
            
            var count = 0;
            var countJ = 0;
            for (var i = 0; i < M; i++)
            {
                for (var j = countJ; j < N; j++)
                {
                    if (A[j].IndexOf(B[i]) >= 0)
                    {
                        count++;
                        countJ++;
                        break;
                    }
                    else
                    {
                        count = 0;
                        countJ++;
                    }
                }

                if (count == M)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 13532
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(VECTOR) (VECTOR).begin(),(VECTOR).end()

int main(){

	ll N, C, K;
	cin >> N >> C >> K;
	vector<ll> T(N);
	for(int i = 0; i < N; i ++){
		cin >> T[i];
	}
	sort(all(T));
	ll nowWaitNum = 1, nowLimit = T[0] + K, ans = 0;
	for(int i = 1; i < N; i ++){
		if(nowLimit < T[i] || nowWaitNum >= C){
			ans ++;
			nowWaitNum = 1;
			nowLimit = T[i] + K;
			continue;
		}
		nowWaitNum ++;
	}
	ans ++;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) (V).begin(),(V).end()
const ll MOD = 1000000007;

int main() {
	int N, Q;
	cin >> N >> Q;
	vector<pair<ll, pair<ll, ll>>> W(N);
	vector<ll> P(Q);
	ll s, t, x;
	for (int i = 0;i < N;i++) {
		cin >> s >> t >> x;
		W[i] = { x,{ s,t } };
	}
	for (int i = 0;i < Q;i++) {
		cin >> P[i];
	}
	sort(all(W));
	vector<queue<ll>> So(Q + 10);
	for (int i = 0;i < N;i++) {
		s = W[i].second.first;
		t = W[i].second.second;
		x = W[i].first;
		auto it1 = lower_bound(all(P), s - x);
		auto it2 = lower_bound(all(P), t - x);
		ll v = distance(P.begin(), it1);
		ll w = distance(P.begin(), it2);
		So[v].push(x);
		So[w].push(x);
	}
	multiset<ll> F;
	vector<ll> ans(Q + 10);
	for (int i = 0;i < Q;i++) {
		while (!So[i].empty()) {
			F.insert(So[i].front());
			So[i].pop();
		}
		if (F.empty()) {
			ans[i] = -1;
			continue;
		}
		if (F.size() == 1) {
			ans[i] = *F.begin();
			continue;
		}
		auto F1 = F.begin();
		auto F2 = F1++;
		while ((*F1) == (*F2)) {
			F.erase(F2);
			F.erase(F1);
			if (F.size() < 2) break;
			F1 = F.begin();
			F2 = F1++;
		}
		if (F.empty()) {
			ans[i] = -1;
			continue;
		}
		ans[i] = *F.begin();
	}
	for (int i = 0;i < Q;i++) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 162176
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))
A_sort = sorted(set(A))

bool_list = [True] * (10 ** 6 + 1)

duplicate_dic = defaultdict(int)
for a in A:
    duplicate_dic[a] += 1
    if duplicate_dic[a] > 1:
        bool_list[a] = False

for a in A_sort:
    for i in range(2*a, 10 ** 6 + 1, a):
        bool_list[i] = False

print(sum([1 for a in A_sort if bool_list[a]]))


Measured memory_bytes: 48928
def solve():
    v = read()
    result = think(v)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(v):
    local_v = list(v)
    local_v.sort()
    return recursive_call(local_v, 0, len(local_v) - 1, {})


def recursive_call(vector, from_index, to_index, cache):
    # print('{0:s}, {1:d}, {2:d}, {3:s}'.format(str(vector), from_index, to_index, str(cache)))
    key = '{0:d},{1:d}'.format(from_index, to_index)
    if key in cache:
        return cache[key]
    if to_index - from_index <= 1:
        value = (vector[from_index] + vector[to_index]) / 2
        cache[key] = value
        return value
    merged_vector = list(vector)
    elem_1 = merged_vector.pop(from_index)
    elem_2 = merged_vector.pop(from_index)
    merged_vector.insert(from_index, (elem_1 + elem_2) / 2)

    value_1 = recursive_call(merged_vector, from_index, to_index - 1, cache)
    value_2 = (elem_1 + recursive_call(vector, from_index + 1, to_index, cache)) / 2
    result = max(value_1, value_2)
    cache[key] = result

    return result


def write(result):
    print(result)


if __name__ == '__main__':
    solve()

Measured memory_bytes: 44268
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
 
int main(){
  int n,m;
  
  cin>>n;
  vector<string> s(n);
  REP(i,n){
    cin>>s[i];
  }
  
  cin>>m;
  vector<string> t(m);
  REP(i,m){
    cin>>t[i];
  }
  
  int ans=0;
  int res=0;
  REP(i,n){
    REP(j,n){
      if(s[i]==s[j]){
        res++;
      }
    }
    
    REP(j,m){
      if(s[i]==t[j]){
        res--;
      }
    }
    
    ans=max(ans,res);
    res=0;
  }
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
h, w, n= [int(i) for i in input().split()]
sr, sc = [int(i) for i in input().split()]
s = input()
t = input()

l = sc
r = sc
u = sr
d = sr

flag = True
for i in range(n):
    if s[i] == "R":
        r += 1
    if s[i] == "L":
        l -= 1
    if s[i] == "U":
        u -= 1
    if s[i] == "D":
        d += 1
    if l==0 or r==w+1 or u==0 or d==h+1:
        print("NO")
        flag = False
        break
    if t[i] == "R" and l != w:
        l += 1
    if t[i] == "L" and r != 1:
        r -= 1
    if t[i] == "U" and d != 1:
        d -= 1
    if t[i] == "D" and u != h:
        u += 1

if flag != False:
    print("YES")



Measured memory_bytes: 3788
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 


int main(void){
    ll n;
    cin>>n;
    vector<ll>a(n),ans(n);
    for(ll i=0;i<n;i++)cin>>a[i];
    ll sum = 0;
    for(ll i=0;i<n;i++){
        if(i%2==0)sum+=a[i];
        else sum-=a[i];
    }
    ans[0]=sum/2;
    for(ll i=1;i<n;i++){
        ans[i]=a[i-1]-ans[i-1];
    }
    for(ll i=0;i<n;i++){
        if(i==n-1)cout<<2*ans[i]<<endl;
        else cout<<2*ans[i]<<" ";
    }
    return 0;
}

Measured memory_bytes: 2944
from collections import deque


def solve(h, w, s_list):
    # cost_map
    cost = [[1000] * w for _ in range(h)]
    cost[0][0] = 0
    # find how many flip
    queue = deque([(0, 0)])
    while len(queue) > 0:
        i, j = queue.popleft()
        if i < h - 1:
            if s_list[i][j] != s_list[i + 1][j]:
                new_cost = cost[i][j] + 1
            else:
                new_cost = cost[i][j]
            if new_cost < cost[i + 1][j]:
                cost[i + 1][j] = new_cost
                queue.append((i + 1, j))
        if j < w - 1:
            if s_list[i][j] != s_list[i][j + 1]:
                new_cost = cost[i][j] + 1
            else:
                new_cost = cost[i][j]
            if new_cost < cost[i][j + 1]:
                cost[i][j + 1] = new_cost
                queue.append((i, j + 1))

    res = (cost[h - 1][w - 1] + 1) // 2
    # print(cost)
    # black-black not admitted
    if s_list[0][0] == "#" and s_list[h - 1][w - 1] == "#":
        res += 1
    return res


def main():
    h, w = map(int, input().split())
    s_list = [list(input()) for _ in range(h)]
    res = solve(h, w, s_list)
    print(res)


def test():
    assert solve(3, 3, [[".", "#", "#"], [".", "#", "."], ["#", "#", "."]]) == 1
    assert solve(2, 2, [["#", "."], [".", "#"]]) == 2


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 3436
#include <iostream>
#include<string>
using namespace std;
int main(int argc, char const *argv[])
{
    int n;
    string s;
    cin>>n>>s;
    if (count(s.cbegin(), s.cend(), 'R') > count(s.cbegin(), s.cend(), 'B'))
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#define ll long long
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long

#define INF 999999999

using namespace std;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
// input
ll n;
ll memo[86];

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

    int total = 0;



    cin >> n;


    memo[0] = 2;
    memo[1] = 1;

    FOR(i,2,n+1) memo [i] = memo[i-1] + memo[i-2];
    cout << memo[n] << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int w,h,x,y,r;
	scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
	int a,b,c,d;
	a = x+r;
	b = x-r;
	c = y+r;
	d = y-r;
	if(a<=w && b>=0 && c<=h && d>=0){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 584
#include <iostream>

using std::cin;
using std::cout;
using std::endl;

int
main()
{
  int K, X;
  cin >> K >> X;
  bool first = true;
  for (int i = X - K + 1; i < X + K; i++)
  {
    if (first)
    {
      first = false;
    }
    else
    {
      cout << ' ';
    }
    cout << i;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int h,w;
char map[20][21];

int search(int x, int y){
  int result=1;
  if(x<0 || x>=w||y<0 || y>=h) return 0;
  if(map[y][x]=='#') return 0;
  map[y][x]='#';
  result+=search(x-1,y);
  result+=search(x+1,y);
  result+=search(x,y-1);
  result+=search(x,y+1);

  return result;
}

int main(){
  int i,j;
  int sx, sy;
  while(scanf("%d%d", &w,&h), w!=0&&h!=0){
    for(i=0; i<h; i++){
      scanf("%s", map[i]);
      for(j=0; j<w; j++){
	if(map[i][j]=='@') sx=j,sy=i;
      }
    }
    printf("%d\n", search(sx,sy));
  }
  return 0;
}

 

Measured memory_bytes: 616
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextFloat64() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func abs(x int) int {
	if x < 0 {
		return -1 * x
	} else {
		return x
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(nil, 10000000000)

	_, _, m := nextInt(), nextInt(), nextInt()

	hs := make([]int, m)
	ws := make([]int, m)

	hsum := make(map[int]int)
	wsum := make(map[int]int)

	bomb := make(map[int]map[int]bool)

	for i := 0; i < m; i++ {
		hs[i], ws[i] = nextInt()-1, nextInt()-1

		if _, ok := bomb[hs[i]]; ok {
			bomb[hs[i]][ws[i]] = true
		} else {
			bomb[hs[i]] = make(map[int]bool)
			bomb[hs[i]][ws[i]] = true
		}

		hsum[hs[i]] += 1
		wsum[ws[i]] += 1

	}

	var hmax int
	var wmax int
	for _, v := range hsum {
		if hmax < v {
			hmax = v
		}
	}
	for _, v := range wsum {
		if wmax < v {
			wmax = v
		}
	}

	checkh := []int{}
	checkw := []int{}

	for k, v := range hsum {
		if v == hmax {
			checkh = append(checkh, k)
		}
	}

	for k, v := range wsum {
		if v == wmax {
			checkw = append(checkw, k)
		}
	}

	ans := hmax + wmax - 1
	for _, ch := range checkh {
		if _, ok := bomb[ch]; !ok {
			continue
		}
		for _, cw := range checkw {
			if _, ok := bomb[ch][cw]; !ok {
				ans = hmax + wmax
				fmt.Println(ans)
				return
			}
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 132864
i,o,t,j,l,s,z=map(int, input().split())
ans=o+j//2*2+l//2*2+i//2*2+(i&1 and j&1 and l&1)*3
k=min(i,j,l)
for n in range(max(0,k-10),k+1):
    ans=max(ans,o+n*3+(i-n)//2*2+(j-n)//2*2+(l-n)//2*2)
print(ans)

Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl;
#define DEBUG_VEC(v)                                      \
  cout << #v << ":";                                      \
  for (int i = 0; i < v.size(); i++) cout << " " << v[i]; \
  cout << endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int> >
#define vll vector<vector<ll> >
#define vs vector<string>
#define pii pair<int, int>
#define pis pair<int, string>
#define psi pair<string, int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout << setprecision(15) << fixed << p << endl;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main() {
  ll q, h, s, d, n, i;
  cin >> q >> h >> s >> d >> n;
  d = min(d, min(s * 2, min(h * 4, q * 8)));
  s = min(s, min(h * 2, q * 4));
  h = min(h, q * 2);
  cout << (n / 2) * d + (n % 2) * s << endl;
}


Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define gt getchar()
#define ll long long
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
inline int in()
{
	int k=0;char ch=gt;
	while(ch<'-')ch=gt;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return k;
}
int du[5];
int main()
{
	for(int i=1;i<=6;++i)++du[in()];
	for(int i=1;i<=4;++i)if(!du[i]||du[i]>2)return puts("NO"),0;
	puts("YES");
	return 0;
}


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

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

  vector<int> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.rbegin(), a.rend());

  int alice = 0;
  int bob = 0;
  for(int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      alice += a[i];
    } else {
      bob += a[i];
    }
  }
  cout << (alice - bob) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >>K;

  int ans=0;
  int ans1=0;
  int ans2=0;

  ans1=H1*60+M1;
  ans2=H2*60+M2;

  ans=ans2-ans1;

  if(ans<K){
    cout << 0 << endl;
  }
  else{
    cout << ans-K << endl;
  }

return 0;
}

Measured memory_bytes: 3632
N = int(input())

ans = [0] * (N + 1)

for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if n <= N:
                ans[n] += 1

print(*ans[1:], sep="\n")


Measured memory_bytes: 73880
#include <stdio.h>

int main(void){
int W;
int H;
int x;
int y;
int r;
int f=0;
scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
if(x<r){
f=1;}
if(y<r){
f=1;}
if(x>W-r){
f=1;}
if(y>H-r){
f=1;}
if(f == 1){
printf("No\n");}
if(f == 0){
printf("Yes\n");}}


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

using namespace std;

#define rep(i, n) for(int i=0; i<(int)(n); i++)

int main() {
    int K, S;
    cin >> K >> S;

    int counter = 0;
    rep(X, K+1){
        rep(Y, K+1){
            int tmp = S-(X+Y);
            if(tmp <= K && tmp >= 0){
                counter++;
            }
        }
    }
    cout << counter << endl;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
a_list_temp = list(map(int,input().split()))
a_list = []
for i in a_list_temp:
    a_list.append([1,i])

for i in range(m):
    b,c = map(int,input().split())
    a_list.append([b,c])
a_list.sort(key=lambda x: x[1], reverse=True)
#print(a_list)
count = 0
ans_sum = 0
for i in a_list:
    if count + i[0] <= n:
        ans_sum += i[0] * i[1]
        count += i[0]
    else:
        ans_sum += (n - count) * i[1]
        break
print(ans_sum)




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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;
const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int Mod = 1000000000 + 0;
//{{{ templates
#define TT_ template<typename T>inline
#define TTF_ template<typename T,typename F>inline
TT_ T sq(T x){return x*x;}
TT_ T In(){T x;cin>>x;return x;}
TT_ void Out(T&x){cout<<x;}
TT_ void sort(T&v){sort(begin(v),end(v));}
TT_ void revs(T&v){reverse(begin(v),end(v));}
TT_ void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT_ int ubnd(T&v,typename T::value_type x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT_ int lbnd(T&v,typename T::value_type x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF_ void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF_ void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
TT_ typename T::iterator minel(T&v){return min_element(begin(v),end(v));}
TT_ typename T::iterator maxel(T&v){return max_element(begin(v),end(v));}

inline void fast_io(){ios_base::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}
//}}} priority_queue queue deque front stringstream max_element min_element insert count make_tuple

int main()
{
  int N, A, B, C, X;
  while (scanf("%d%d%d%d%d", &N, &A, &B, &C, &X), N || A || B || C || X){
    queue<int> Q;
    for (int i = 0; i < N; i++) Q.push(in());
    for (int frame = 0; frame <= 10000; frame++){
      if (Q.front() == X) Q.pop();
      X = (A * X + B) % C;
      if (Q.empty()){
        printf("%d\n", frame);
        goto END;
      }
    }
    printf("-1\n");
END:;
  }
  return 0;
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x;
	cin>>x;
	if(x==0){
		cout<<1<<endl;
	}else{
		cout<<0<<endl;
	}
	return 0;
}


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

long long modpow(long long a, long long b, long long m) {
	long long p = 1, q = a;
	for (int i = 0; i < 62; i++) {
		if ((b / (1LL << i)) % 2 == 1) { p *= q; p %= m; }
		q *= q; q %= m;
	}
	return p;
}

long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

long long mod = 1000000007;
long long H, W, T;

int main() {
	cin >> H >> W >> T;
	long long V1 = gcd(H, T);
	long long V2 = gcd(W, T);
	H /= V1; W /= V2;

	long long BASE = 0;
	BASE += modpow(2, H, mod);
	BASE += modpow(2, W, mod);
	BASE += modpow(2, gcd(H, W), mod);
	BASE -= 3LL;
	BASE = (BASE + mod * mod) % mod;
	cout << modpow(BASE, V1 * V2, mod) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 1000

int main(void){
  int i,num,j;
  int l1[N]={0},l2[N]={0},l3[N]={0},l4[N]={0},l5[N]={0},
      l6[N]={0},l7[N]={0},l8[N]={0},l9[N]={0},l10[N]={0},
      v1[N]={0},v2[N]={0};
  char hoge;
  double distance[10];
  double sum;
  double ratio,collisionPoint;
  double curP;
  int currentPlace;
  int realSum;

  for(i=0;(scanf("%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d",
          &l1[i],&hoge,&l2[i],&hoge,&l3[i],&hoge,&l4[i],&hoge,&l5[i],&hoge,
          &l6[i],&hoge,&l7[i],&hoge,&l8[i],&hoge,&l9[i],&hoge,&l10[i],&hoge,
          &v1[i],&hoge,&v2[i]))==23;i++){}
  num=i;
  for(i=0;i<num;i++){
    distance[0]=l1[i];
    distance[1]=l2[i];
    distance[2]=l3[i];
    distance[3]=l4[i];
    distance[4]=l5[i];
    distance[5]=l6[i];
    distance[6]=l7[i];
    distance[7]=l8[i];
    distance[8]=l9[i];
    distance[9]=l10[i];
    sum=0.0;
    for(j=0;j<10;j++){
      sum+=(double)distance[j];
    }
    ratio=(double)v1[i]/((double)v1[i]+(double)v2[i]);
    collisionPoint=sum*ratio;
    curP=(double)distance[0]+0.5;
    for(j=1;j<10;j++){
      if(curP>=collisionPoint){
        break;
      }
      curP+=(double)distance[j];
    }
    currentPlace=curP;
    realSum=0;
    for(j=0;j<10;j++){
      realSum+=distance[j];
      if(realSum==currentPlace){
        printf("%d\n",j+1);
        break;
      }else if(realSum>currentPlace){
        printf("%d\n",j+2);
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <string.h>

/* iÛÌóµðQiÅ\»·é */

#define EVENT_MAX 7 /* HOMERUNÌ¶ */
#define RUI 3 /* ÛÌ */
#define MAX_OUT 3

#define show {int i;printf(">> %d | ",score);for(i=0;i<RUI;i++)printf("%d ",runner>>i&1);printf("\n");}

int main(void){
	char event[EVENT_MAX+1]; int score=0, out=0, runner=0, i, s, n;
	
	scanf("%d",&n);
	
	while(1){
		scanf("%s",event);
	
		if(!strcmp(event,"HIT")){
			if(runner>>(RUI-1)&1) score++;
			runner=(runner<<1)+1;
		}else if(!strcmp(event,"HOMERUN")){
			s=0;
			for(i=0; i<RUI; i++) if(runner>>i&1) s++;
			score+=s+1, runner=0;
		}else out++;
		
		if(out==MAX_OUT){
			printf("%d\n",score);
			score=0, runner=0, out=0;
			
			n--;
			if(n==0) return 0;
		}
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    string s;
    int m,d;
    cin >> m >> d;
    int ans = 0;
    loop(i,1,m+1)loop(j,1,d+1){
        if(j < 10)continue;
        int a = j%10;
        int b = j/10;
        if(a >= 2 && b >= 2 && a*b == i)ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

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

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    k: i64,
    a: [i64; n],
  }
  let mut sum = vec![0i64; n+1];
  for (i, &x) in a.iter().enumerate() {
    sum[i+1] = (sum[i] + x - 1) % k;
  }
  use std::collections::BTreeMap;
  let mut map = BTreeMap::new();
  let mut ans = 0;
  for i in 0 .. n + 1 {
    if let Some(out) = i.checked_sub(k as usize) {
      *map.get_mut(&sum[out]).unwrap() -= 1;
    }
    ans += *map.get(&sum[i]).unwrap_or(&0);
    *map.entry(&sum[i]).or_insert(0i64) += 1;
  }

  puts!("{}\n", ans);
}


Measured memory_bytes: 22776
#include <iostream>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <stdio.h> 
#include <map>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;


int main() {
	int n,a,b;
	cin>>n>>a>>b;
	
	cout << min(n*a, b);
	return 0;
}


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

using namespace std;

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

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

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

ll T[100005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    memset(T, 0, sizeof(T));
    priority_queue<pll, vector<pll>, function<bool(pll, pll)>> q([](pll a, pll b) { return a.second < b.second; });
    priority_queue<pll, vector<pll>, function<bool(pll, pll)>> q0([](pll a, pll b) { return a.second > b.second; });
    priority_queue<pll, vector<pll>, function<bool(pll, pll)>> q1([](pll a, pll b) { return a.second < b.second; });
    REP(i, N) {
        pll p;
        cin >> p.first >> p.second;
        p.first--;
        q.push(p);
    }

    ll type = 0;
    ll sum = 0;
    REP(i, K) {
        pll t = q.top();
        q.pop();
        if (T[t.first]++ == 0)
            type++;
        else
            q0.push(t);
        sum += t.second;
    }

    while (!q.empty()) {
        pll t = q.top();
        q.pop();
        if (T[t.first]++ == 0)
            q1.push(t);
    }

    ll ans = sum + type * type;
    while (!q1.empty() && !q0.empty()) {
        pll t = q1.top();
        q1.pop();
        pll s = q0.top();
        q0.pop();

        sum = sum - s.second + t.second;
        type++;
        ans = std::max(ans, sum + type * type);
    }

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

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

using ll = long long;

constexpr ll MOD = 1e9+7;
constexpr ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

ll field[110][110];

int main(int argc, char **argv)
{
	ll H, W; cin >> H >> W;
	ll N; cin >> N;
	vector<ll> A(N);
	REP(i, N) cin >> A[i];

	memset(field, 0, sizeof field);

	ll c{0};
	for (ll h = 0; h < H;)
	{
		for (ll w = 0; w < W; ++w)
		{
			field[h][w] = c;
			if (--A[c] == 0)
				++c;
		}

		++h;
		if (h == H) break;
		for (ll w = W-1; w >= 0; --w)
		{
			field[h][w] = c;
			if (--A[c] == 0)
				++c;
		}
		++h;
	}

	REP(h, H)
	{
		REP(w, W)
		{
			std::cout << field[h][w] + 1<< " ";
		}
		std::cout << std::endl;
	}
}


Measured memory_bytes: 512
using System;
using System.Linq;

namespace id_0317cs
{
    class Program
    {
        static void Main(string[] args)
        {
            var vs = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var distance = vs[0];
            var longJump = vs[1];
            Console.WriteLine(JumpNum(distance, longJump));
        }
        static int JumpNum(int distance, int longJump)
        {
            var result = distance / longJump + distance % longJump;
            return result;
        }
    }
}



Measured memory_bytes: 9624
#include<stdio.h>
#include<string.h>

int main(void){
char s[100 + 1];
scanf("%s",s);
int n=strlen(s);//文字列の長さを得るs
for(int i= 0;i<n;i++) {
    if(i% 2 == 0) {
        //奇数文字目
        if(s[i] =='L') {
            puts("No");
            return 0;
        }
        }else{
            //偶数文字目
                if(s[i] =='R') {
                    puts("No");
                    return 0;
                }
        }
    }
    puts("Yes");
    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

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

    int H, W;
    cin >> H >> W;
    vector<string> s(H);
    for (int i = 0; i < H; i++)
        cin >> s[i];
    vector<vector<int>> dp(H, vector<int>(W, 0));
    int idx = 1;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if (dp[i][j])
                continue;
            queue<P> q;
            dp[i][j] = idx;
            q.push(P(i, j));
            while (!q.empty())
            {
                P p = q.front();
                int x = p.first, y = p.second;
                q.pop();
                for (int k = 0; k < 4; k++)
                {
                    int nx = x + dx[k], ny = y + dy[k];
                    if (nx < 0 || H <= nx || ny < 0 || W <= ny)
                        continue;
                    if (dp[nx][ny])
                        continue;
                    if (s[nx][ny] == s[x][y])
                        continue;
                    dp[nx][ny] = idx;
                    q.push(P(nx, ny));
                }
            }
            idx++;
        }
    }
    map<ll, ll> bl, wh;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            int col = dp[i][j];
            if (s[i][j] == '.')
            {
                wh[col]++;
            }
            else
            {
                bl[col]++;
            }
        }
    }
    ll res = 0;
    for (auto p : bl)
    {
        ll col = p.first, num = p.second;
        res += num * wh[col];
    }
    cout << res << endl;
}


Measured memory_bytes: 18432
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t; cin>>s>>t;
  s += s;
  bool is_match =false;
  for(int i=0; i<s.size()/2; ++i){
    string ns;
    ns = s.substr(i,s.size()/2);
    if( ns == t) {
      is_match = true; break;
    }
  }
  if( is_match) cout<<"Yes";
  else cout<<"No";
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int A[] = new int[2 * N - 1];
            for (int i = 0; i < 2 * N - 1; i++) {
                A[i] = in.nextInt();
            }

            int lo = 0, hi = 2 * N;

            while (lo + 1 < hi) {
                int mid = lo + (hi - lo) / 2;

                if (onTopAtLeast(mid, A)) {
                    lo = mid;
                } else {
                    hi = mid;
                }
            }

            out.println(lo);
        }

        private boolean onTopAtLeast(int x, int[] a) {
            int LEN = a.length; // LEN = 2*N-1
            int[] b = new int[LEN];
            for (int i = 0; i < LEN; i++) {
                b[i] = a[i] < x ? 0 : 1;
            }
            int[] c = new int[LEN - 2];
            for (int i = 1; i < LEN - 1; i++) {
                c[i - 1] = b[i - 1] + b[i] + b[i + 1] < 2 ? 0 : 1;
            }

            int MID = c.length / 2;
            int left = MID;
            int right = MID;

            while (left > 0 && c[left - 1] != c[left]) left--;
            while (right < c.length - 1 && c[right] != c[right + 1]) right++;//C[1, 2*N-3]

            int ANS = (MID - left < right - MID) ? c[left] : c[right];

            return ANS == 1;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

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

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

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

    }
}


Measured memory_bytes: 39260
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <math.h>

typedef long long ll;
using namespace std;

int main() {
    vector<int> p(3);
    cin >> p[0] >> p[1] >> p[2];
    sort(p.begin(), p.end());
    cout << p[0] + p[1] << endl;
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <set>
#define llint long long

using namespace std;

llint n;
llint a[200005];
multiset<llint> S;

llint get(llint x)
{
	llint mul = 1;
	for(;x;x/=2) mul *= 2;
	return mul;
}

int main(void)
{
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i], S.insert(a[i]);
	
	llint ans = 0;
	while(S.size()){
		auto it = S.end(); it--;
		llint v = *it;
		S.erase(it);
		llint x = get(v);
		if(S.count(x-v)){
			ans++;
			S.erase(S.lower_bound(x-v));
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 11136
fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

fn main() {
    let n = read1::<usize>();
    let mut v = vec![vec![0; 26]; n];

    for i in 0..n {
        let s = read1::<String>().chars().collect::<Vec<char>>();
        for c in s.iter() {
            v[i][*c as usize - 97] += 1;
        }
    }

    let mut ans = "".to_string();
    for i in 0..26 {
        let mut k = 100;
        for j in 0..n {
            k = std::cmp::min(k, v[j][i]);
        }
        for _ in 0..k {
        	ans = ans + &(((i as u8 + 97) as char).to_string());
        }
    }

    println!("{}", ans);
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    int count = 0;
    rep(i, n)
    {
        int t = i + 1;
        if (t < 10)
        {
            count += 1;
        }
        else if (t < 100)
        {
        }
        else if (t < 1000)
        {
            count += 1;
        }
        else if (t < 10000)
        {
        }
        else if (t < 100000)
        {
            count += 1;
        }
    }
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
s=input()
p=s[0]
cnt=1
f=True
for i in range(1,len(s)):
	if f:
		if p!=s[i]:
			p=s[i]
			cnt+=1
			f=True
		else:
			p=''
			f=False
	else:
		f=True
		cnt+=1
print(cnt)


Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
using Graph = vector<vector<int>>;
using Graphl = vector<vector<ll>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define FOR(itr, v) for (auto itr = (v).begin(); itr != (v).end(); ++itr)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> void PrintVector(const vector<T> &vec) {for (auto val : vec) cout << val << " "; cout << endl;}
const long long INF = 1LL << 60;
const long long minusINF = -(1LL << 40);
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    ll n; cin >> n;
    string ans = "";
    while(1)
    {
        n--;
        ans += (char)('a' + (n % 26));
        if (n / 26 == 0) break;
        n /= 26;
    }
    reverse(ALL(ans));
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>

int main() {
  char S[4];

  char str[4];
  str[3] = '\0';
  for (int i = 0; i < 3; i++) {
    scanf("%s", S);
    str[i] = S[i];
  }
  
  printf("%s\n", str);
  return 0;

}


Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#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;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln = '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    string S; cin >> S;
    int N = S.size();
    vector<vector<int>> dp(N+1, vector<int>(2));
    rep(i,N) {
        chmax(dp[i+1][0],dp[i][1]+1);
        if (!i or S[i]!=S[i-1]) chmax(dp[i+1][0],dp[i][0]+1);
        if (i) {
            chmax(dp[i+1][1],dp[i-1][0]+1);
            if (i < 3 or S.substr(i-1,2)!=S.substr(i-3,2)) chmax(dp[i+1][1],dp[i-1][1]+1);
        }
    }

    cout << max(dp[N][0],dp[N][1]) << ln;
}


Measured memory_bytes: 14452
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll N,ans;
int cnt[100];
int main(){
	scanf("%lld",&N);
	for(int i=1,_=0;i<=11;i++){
		for(int j=_+1;j<_+i;j++)cnt[j]=i-1;
		cnt[_+=i]=i;
	}
	for(ll i=2;i*i<=N;i++)if(N%i==0){
		int c=0;
		while(N%i==0)c++,N/=i;
		ans+=cnt[c];
	}
	if(N>1)ans++;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3844
import java.util.Scanner; 

class Main {

    public static void main(String... args) {
        Scanner scan = new Scanner(System.in);
        int seconds = Integer.parseInt(scan.next());
        System.out.println(String.format(seconds / 3600 + ":" + seconds % 3600 / 60 + ":" + seconds % 60));
    }
}




Measured memory_bytes: 26312
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std; 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define pb push_back
int main(int argc, char** argv) {
	
int n;
scanf("%d",&n);
map<string,int>m;
vector<string>p;
int maxn=0;
while(n--)
{
	string s;
	cin>>s;
	m[s]++;
	
	if(m[s]>maxn)
	{
		maxn=m[s];
		p.clear();
	}
	if(m[s]==maxn)
	{
		p.pb(s);
	}
}
sort(p.begin(),p.end());
for(int i=0;i<p.size();i++)cout<<p[i]<<endl;
	return 0;
}

Measured memory_bytes: 26736