akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

// #define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

// constexpr inline ll MOD = 1'000'000'007;

int n, res;
string s;

int main()
{
    // 入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    // 1:15~

    cin>>n>>s;
    rep(pas0,10){
        rep(pas1,10){
            rep(pas2,10){
                int pas_i = 0;
                vector<int> v = {pas0, pas1, pas2};
                rep(i,n){
                    if (v[pas_i] + '0' == s[i])
                    {
                        pas_i++;
                    }
                    if (pas_i == 3)
                    {
                        res++;
                        break;
                    }
                }
            }
        }
    }
    cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <stack>
using namespace std;

int cat(string str) {
  stack <int> stk;
  for(int i=0;i<str.size();i++) {
    if(str[i] == 'm') stk.push(0);
    else if(str[i] == 'e') stk.push(1);
    else if(str[i] == 'w') {
      if(stk.empty()) return false;
      if(stk.top() == 1)  stk.pop();
      else return false;
      if(stk.top() == 0) stk.pop();
      else return false;
      if(stk.empty() && i != str.size()-1) return false;
    }
  }
  if(stk.empty()) return true;
  return false;
}
int main() {
  string str;
  cin >> str;
  if(cat(str) == true) cout << "Cat"<<endl;
  else cout << "Rabbit"<<endl;
 
  return 0;
}

Measured memory_bytes: 1192
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    int n,m;
    cin>>n>>m;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int tot=0;
    tot=accumulate(a,a+n,tot);
    double vote=ceil(tot/(4.0*m));

    int ans=0;
    sort(a,a+n);
    for(int i=0;i<n;i++){
        if(a[i]>=vote){
            ans++;
        }
    }
    if(ans>=m){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 3708
// Problem : A - Circle Pond
// Contest : AtCoder - AtCoder Beginner Contest 163
// URL : https://atcoder.jp/contests/abc163/tasks/abc163_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n;
	cin >> n;
	double ans = 2*acos(-1)*n;
	cout << fixed << setprecision(20) ;
	cout << ans << '\n';
				
	return 0;
}


Measured memory_bytes: 3804
n,m,c= map(int, input().split())
b= list(map(int, input().split()))
cnt=0
for i in range(n):
    ans=0
    a= list(map(int, input().split()))
    for j in range(m):
        ans+=a[j]*b[j]
    if ans+c>0:
        cnt+=1
print(cnt)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define Rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

int main() {
	int N;
	cin >> N;
	vector<ll> A(N), sum(N+1,0);
	Rep(i, N) {
		cin >> A[i];
		sum[i + 1] += sum[i] + A[i];
	}
	ll res = sum[N];
	For(mid, 2, N - 1) {
		int left = lower_bound(sum.begin(), sum.begin() + mid, sum[mid] / 2) - sum.begin();
		if (left > 1) {
			ll tmp1 = abs(sum[left] - (sum[mid] - sum[left]));
			ll tmp2 = abs(sum[left - 1] - (sum[mid] - sum[left - 1]));
			if (tmp1 > tmp2) left--;
		}
		int right = lower_bound(sum.begin() + mid + 1, sum.begin() + N, (sum[mid] + sum[N]) / 2) - sum.begin();
		if (right > mid + 1) {
			ll tmp3 = abs(sum[right]-sum[mid] - (sum[N] - sum[right]));
			ll tmp4 = abs(sum[right - 1] - sum[mid] - (sum[N] - sum[right - 1]));
			if (tmp3 > tmp4) right--;
		}
		ll M = max({ sum[left],sum[mid] - sum[left],sum[right] - sum[mid],sum[N] - sum[right] });
		ll m = min({ sum[left],sum[mid] - sum[left],sum[right] - sum[mid],sum[N] - sum[right] });
		if (res > M - m) res = M - m;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 3328
S = gets.chomp
Alphabet = (97..122).to_a.map {|num| num.chr}
used = S.split('')
unused = Alphabet - used
if unused.size == 0
  if used == Alphabet.reverse
    ans = '-1'
  else
    reverse_used = used.reverse
    reverse_used.each_with_index do |c, i|
      if c > reverse_used[i + 1]
        tail = reverse_used[0..i].select {|item| item > reverse_used[i + 1]}
        ans = (reverse_used[i+2..-1].reverse << tail[0]).join
        break
      end
    end
  end
else
  ans = (used << unused[0]).join
end
puts ans


Measured memory_bytes: 1788
N = int(input())
tasks = [None] * N

for i in range(N):
  tasks[i] = tuple(map(int,input().split()))

tasks = sorted(tasks, key = lambda x:x[1])

time = 0
for t in tasks:
  if t[1] - t[0] < time:
    print("No")
    break
  time += t[0]
else:
  print("Yes")

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

//define ll long long;
//define ar array;

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

    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++){
        int k;
        cin >> k;
        if (i%2!=0 && k%2!=0){
            ans++;
        }
    }
    cout << ans << endl;;

    return 0;
}



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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()
#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
#define INF LLONG_MAX

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n;
  cin >> n;

  ld ans = 0;
  rep(i, n) {
    ld x;
    string u;
    cin >> x >> u;
    if (u == "JPY") {
      ans += x;
    } else {
      ans += x * 380000.0;
    }
  }

  cout << ans;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

ll n,ans;
void cal(ll now){
	bool a,b,c;
	a=b=c=false;
	while(now!=0){
		ll nex=now%10;
		if(nex==3){
			a=true;
		}
		else if(nex==5){
			b=true;
		}
		else{
			c=true;
		}
		now/=10;
	}
	if(a&&b&&c){
		ans++;
	}
}

void dep(ll now){
	if(now>n){
		return ;
	}
	cal(now);
	now*=10;
	dep(now+3);
	dep(now+5);
	dep(now+7);
}
int main() {
	cin>>n;
	dep(0);
	cout << ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
# frozen_string_literal: true

# induce sort (internal routine)
def sa_is_induce(s, ls, sum_l, sum_s, lms)
  n = s.size
  sa = [-1]*n

  buf = *sum_s # deep copy
  lms.each{ |lms|
    if lms != n then
      sa[buf[s[lms]]] = lms
      buf[s[lms]] += 1
    end
  }

  buf = *sum_l # deep copy
  sa[buf[s[-1]]] = n-1
  buf[s[-1]] += 1
  sa.each{ |v|
    if v>=1 && !ls[v-1] then
      sa[buf[s[v-1]]] = v-1
      buf[s[v-1]] += 1
    end
  }

  buf = *sum_l # deep copy
  sa.reverse_each{ |v|
    if v>=1 && ls[v-1] then
      buf[s[v-1]+1] -= 1
      sa[buf[s[v-1]+1]] = v-1
    end
  }

  return sa
end

# SA-IS (internal routine)
def sa_is(s, upper)
  n = s.size

  return [] if n == 0
  return [0] if n == 1

  ls = [false]*n
  (n-2).downto(0){ |i|
    ls[i] = s[i]==s[i+1] ? ls[i+1] : s[i]<s[i+1]
  }

  sum_l = [0]*(upper+1)
  sum_s = [0]*(upper+1)
  n.times{ |i|
    if ls[i] then
      sum_l[s[i]+1] += 1
    else
      sum_s[s[i]] += 1
    end
  }
  0.upto(upper){ |i|
    sum_s[i] += sum_l[i]
    sum_l[i+1] += sum_s[i] if i<upper
  }

  lms = (1 ... n).select{ |i| !ls[i-1] && ls[i] }
  m=lms.size
  lms_map = [-1]*(n+1)
  lms.each_with_index{ |lms, id| lms_map[lms] = id }

  sa = sa_is_induce(s, ls, sum_l, sum_s, lms)

  return sa if m == 0

  sorted_lms = sa.select{ |sa| lms_map[sa] != -1 }
  rec_s = [0]*m
  rec_upper = 0
  rec_s[lms_map[sorted_lms[0]]] = 0
  1.upto(m-1){ |i|
    l, r = sorted_lms[i-1, 2]
    end_l = lms[lms_map[l]+1]||n
    end_r = lms[lms_map[r]+1]||n
    same = true
    if end_l-l != end_r-r then
      same = false
    else
      while l < end_l do
        break if s[l] != s[r]
        l+=1
        r+=1
      end
      same = false if l==n || s[l]!=s[r]
    end
    rec_upper += 1 if not same
    rec_s[lms_map[sorted_lms[i]]] = rec_upper
  }

  sa_is(rec_s, rec_upper).each_with_index{ |rec_sa, id|
    sorted_lms[id] = lms[rec_sa]
  }

  return sa_is_induce(s, ls, sum_l, sum_s, sorted_lms)
end

# suffix array for array of integers
def suffix_array(s, upper = nil)
  if not upper then
    # compression
    n = s.size
    idx = (0 ... n).sort_by{ |l, r| s[l] < s[r] }
    t = [0]*n
    upper = 0
    t[idx[0]] = 0
    1.upto(n-1){ |i|
      upper += 1 if s[i-1] != s[i]
      t[i] = upper
    }
    s = t
  end

  return sa_is(s, upper)
end

# suffix array for string
def suffix_array(s)
  return sa_is(s.bytes, 255)
end

# lcp array for array of integers
def lcp(s, sa)
  n = s.size
  rnk = [0]*n
  sa.each_with_index{ |sa, id|
    rnk[sa] = id
  }
  
  lcp = [0]*(n-1)
  h = 0
  n.times{ |i|
    h -= 1 if h > 0
    next if rnk[i] == 0
    j = sa[rnk[i]-1]
    h += 1 while j+h<n && i+h<n && s[j+h]==s[i+h]
    lcp[rnk[i]-1] = h
  }
  return lcp
end

# lcp array for string
def lcp_array(s, sa)
  return lcp(s.bytes, sa)
end

s = gets.chomp
lcp = lcp_array(s, suffix_array(s))
ans = s.size*(s.size+1)/2
lcp.each{ |lcp|
  ans -= lcp
}
puts ans


Measured memory_bytes: 67328
from operator import itemgetter

N = int(input())
X = [None for _ in range(N)]
for i in range(N):
    Si, Pi = input().split()
    Pi = int(Pi)
    X[i] = list((Si, Pi, i + 1))
X.sort(key=itemgetter(1), reverse=True)
X.sort(key=itemgetter(0))

for x in X:
    print(x[2])

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if (e-a > k) {
		cout << ":(";
	}
	else {
		cout << "Yay!";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, m, n) for(int i = m; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define dup(x, y) (((x) + (y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template <class T> inline void chmax(T &a, T b) {
    if(a < b) {
        a = b;
    }
}
template <class T> inline void chmin(T &a, T b) {
    if(a > b) {
        a = b;
    }
}
template <class T> inline T gcd(T x, T y) {
    if(y == 0) {
        return x;
    } else if(x == 0) {
        return y;
    }
    return gcd(y, x % y);
}
template <class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template <class T> inline void print_vector(vector<T> vec) {
    for(int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    cout << endl;
}
const LL MOD = 1e9 + 7;
const LL LLINF = 1LL << 60;
const int INF = 1 << 30;

int main(void) {
    int N, R;
    cin >> N >> R;

    if(10 <= N) {
        cout << R << endl;
    } else {
        cout << R + 100 * (10 - N) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int a,b,c,k,ans;
int main(){
	scanf("%d%d%d%d",&a,&b,&c,&k);
	if(a>=k&&k) ans+=k,k=0;else if(a<k&&k) ans+=a,k-=a;
	if(b>=k&&k) k=0;else if(b<k&&k) k-=b;
	if(c>=k&&k) ans-=k,k=0;else if(c<k&&k) ans-=c,k-=c;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1712
#include <bits/stdc++.h>
#define FASTIO
#define endl "\n" // Since endl forces a buffer flush which slows down large I/O operations.
#define ff first
#define ss second
#define pb push_back
#define input(c, n)             \
	for (int i = 0; i < (n); i++) \
		cin >> (c)[i];
#define exit_message(s) return 0 * printf(s)
#define show(c)           \
	for (auto i : (c))      \
		cout << i << " "; \
	cout << "\n";
#define display(c, n)           \
	for (int i = 0; i < (n); i++) \
		cout << (c)[i] << " ";    \
	cout << "\n";
#define forl(i, a, n) for (int (i) = (a); (i) < (n); (i)++)
#define dugbe(k) cout << "-\t> " << #k << " = " << k << "\n";

/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/

using namespace std;
typedef long long ll;
typedef pair<int, int> pr;
typedef pair<ll, ll> prll;
typedef vector<int> vi;
typedef vector<ll> vill;
typedef vector<pr> vpr;
ifstream in("input.txt");
const ll mod = 1e9 + 7;

ll mod_pow(ll a, ll b)
{
	if (b == 0)
		return 1LL;

	ll res = mod_pow(a, b >> 1);
	res = (res * res) % mod;
	if (b & 1LL)
		res = (res * a) % mod;

	return res;
}

const int N = 3000 + 5;

int n, k;
int a[N];
ll dp[N][N];

ll solve(int l, int r)
{
	if (l > r)
		return 0;

	ll &memo = dp[l][r];
	if (memo != -1)
		return memo;

	memo = max(a[l] - solve(l + 1, r), a[r] - solve(l, r - 1));
	return memo;
}

int32_t main()
{
#ifdef FASTIO
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#endif
	// freopen("in.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	memset(dp, -1, sizeof dp);

	cin >> n;
	forl(i, 0, n)
	{
		cin >> a[i];
	}
	ll ans = solve(0, n - 1);
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 71040
// Created by arvybhatt

#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define p_b push_back
#define m_p make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)

using namespace std;
using ll = long long;

int main()
{
    fast;

    int k;cin>>k;
    ll s=0;
    for(int i=1;i<=k; i++)
    {
    	for(int j=1; j<=k; j++)
    	{
    		for(int  l=1; l<=k; l++)
    		{
    				s+=__gcd(i,__gcd(j,l));
    		}
    	}
    }
    cout<<s;
    
    
    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
using namespace std;
#define N 300005
int n,a[N],b[N];
void gg(){puts("No");exit(0);}
bool check(int l,int r){
	int t1=0,t2=0;
	rep (i,l,r)
		if (a[i]<i){
			if (t1>a[i]||a[i]<l||a[i]>r) return 0;
			t1=a[i];
		} else if (a[i]>i){
			if (t2>a[i]||a[i]<l||a[i]>r) return 0;
			t2=a[i];
		}
	return 1;
}
int main(){
	scanf("%d",&n);
	rep (i,1,n) scanf("%d",&a[i]),b[i]=a[i]==i;
	rep (i,3,n) if (!b[i-2]&&!b[i-1]&&!b[i]) gg();
	for (int i=1,l,r,k;i<=n;i=r+1) if (!b[i]){
		l=i,r=i,k=0;
		while (r<n&&(b[r+1]^k)) k^=1,r++;
		if (!check(l,r)) gg();
	} else r=i;
	puts("Yes");
	return 0;
}

Measured memory_bytes: 2560
N, Q = map(int, input().split())
# The person start in this location will be stopped.
work = []
for i in range(N):
    start, end, pos = map(int, input().split())
    work.append((start - pos - 0.5, end - pos - 0.5, pos))
work.sort(key=lambda x: x[0])
depart_time = [int(input()) for _ in range(Q)]
heap = []
end_time = {}
import heapq
i = 0
for depart in depart_time:
    while i < len(work) and work[i][0] < depart:
        start, end, pos = work[i]
        heapq.heappush(heap, pos)
        end_time[pos] = end
        i += 1
    while heap and end_time[heap[0]] < depart:
        heapq.heappop(heap)
    if heap: print(heap[0])
    else: print(-1)




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

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

    vector<int> l(n);
    for ( int i = 0 ; i < n ; i++ ){
        cin >> l.at(i);
    }
    sort(l.begin(),l.end());
    int rem = x, cnt = 0;
    for ( int i = 0 ; i < n ; i++ ){
        rem -= l.at(i);
        if ( rem > 0 ){
            if ( i != n-1 )cnt++;
        }
        else if ( rem == 0 ){
            cnt++;
            break;
        }
        else break;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        for(int a=0; a<=n; a++){
            for(int b=0; b<=n-a; b++){
                int c = n-a-b;
                if(y == 10000*a + 5000*b + 1000*(c)){
                    System.out.println(a + " " + b + " " + c);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}

Measured memory_bytes: 25172
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<malloc.h>
#include<math.h>
#include<x86intrin.h>


int my_gets(char *buf,int nBuf,FILE *fp){
    int ch;

    while(--nBuf >0){
        ch=getc(fp);
        if(ch==EOF || ch=='\n')
            break;
        *(buf++)=(char)ch;
    }
    *(buf)='\0';

    return nBuf;
}

void InputIntAry(int *a,int nDigit,int N){      //nDigitは想定される最大桁数
    char *buf,*ptr;

    buf=(char*)malloc( (N*(nDigit+2)) * sizeof(char) );
    my_gets(buf,N*(nDigit+2),stdin);

    ptr=strtok(buf," ");
    while(ptr!=NULL && N-->0){
        *(a++)=atoi(ptr);
        ptr=strtok(NULL," ");
    }
    free(buf);
}

int CmpInt(const void *a, const void *b){        //b-aを返す(qsortなら降順)
    return *((int*)b)- *((int*)a);
}

#define MAXOF(a,b)  ( ((a)>(b)) ? (a) : (b) )
#define MINOF(a,b)  ( ((a)<(b)) ? (a) : (b) )

int main(){
    int N,M=-1;

    scanf("%d%*c",&N);

    if(N < 100){                // [1,99]
        M = MINOF(N, 9);
    }
    else if(N < 10000){         // [100,9999]
        M = MINOF(N-90, 999-90);
    }
    else if(N < 1000000){       // [10000, 999999]
        M = MINOF(N-(10000-(999-90))+1, 99999-(10000-(999-90))+1);
    }
    printf("%d\n",M);

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
	int A, B;
	if (scanf("%d%d", &A, &B) != 2) return 1;
	if (A > B) {
		int t = A; A = B; B = t;
	}
	if ((B - A) % 2 != 0) {
		puts("IMPOSSIBLE");
	} else {
		printf("%d\n", A + (B - A) / 2);
	}
	return 0;
}


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

int f(int n, int k) {
  for (int i = 0; i < k; i++) {
    n *= 2;
  }

  return n;
}

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;

  int ans;
  if (a > b && a > c) {
    ans = f(a, k) + b + c;
  } else if (b > c) {
    ans = f(b, k) + a + c;
  } else {
    ans = f(c, k) + a + b;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <tuple>
#include <iomanip>
#include <queue>
#include <cmath>

using namespace std;
using ll = long long;
using pa = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
const ll MOD = 1e9 + 7;
const ll INF = 1e14;
const long double EPS = 1e-11;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r)-1; i >= (l); i--)

void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N;
    cin>>N;
    vl A(N);
    rep(i,N)cin>>A[i];
    ll ans=0;
    ll cnt =0,c=A[0];
    rep(i,N){
    	if(c==A[i])cnt++;
    	else{
    		ans+=cnt/2;
    		c=A[i];
    		cnt=1;
    	}
    }
    ans+=cnt/2;
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
def main():
    # input    
    N = int(input())

    # 1.find S(N)
    res = N
    digit = []
    while res//10 != 0:
        digit.append(res%10)
        res = res//10
    digit.append(res)
    sn = sum(digit)

    #2. judge  
    if N%sn == 0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
int dp[N][3];
int grid[N][3];
int main()
{
     int n;cin>>n;
     for(int i=1;i<=n;i++)
     {
     	  for(int k=1;k<=3;k++)
     	  {
     	  	cin>>grid[i][k];
     	  }
     }
     for(int i=0;i<=n;i++)
     {
     	for(int k=1;k<=3;k++) dp[i][k] = 0;
     }
     for(int i=1;i<=1;i++)
     	for(int k=1;k<=3;k++)
     		dp[i][k] = grid[i][k];
     //cout<<dp[1][1]<<" "<<dp[1][2]<<" "<<dp[1][3]<<endl;
     for(int i=1;i<=n-1;i++)
     {
     	for(int k=1;k<=3;k++)
     	{
     		if(k==1)
     		{
     			dp[i+1][k+1] = max(dp[i+1][k+1],dp[i][k]+grid[i+1][k+1]);
     			dp[i+1][k+2] = max(dp[i+1][k+2],dp[i][k]+grid[i+1][k+2]);
     		}
     		else if(k==2)
     		{
     			dp[i+1][k-1] = max(dp[i+1][k-1],dp[i][k]+grid[i+1][k-1]);
     			dp[i+1][k+1] = max(dp[i+1][k+1],dp[i][k]+grid[i+1][k+1]);
     		}
     		else 
     		{
     			dp[i+1][k-1] = max(dp[i+1][k-1],dp[i][k]+grid[i+1][k-1]);
     			dp[i+1][k-2] = max(dp[i+1][k-2],dp[i][k]+grid[i+1][k-2]);
     		}
     	}
     }
     int res = -1;
     for(int i=1;i<=3;i++)
     { 
     	  //cout<<dp[n][i]<<endl;
          res = max(res,dp[n][i]);
     }
     cout<<res<<"\n";
     return 0;

}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;

int main()
{
    int n;
    cin>>n;
    bool ok=false;
    
    FOR(i,1,10){
        FOR(j,1,10){
            if(n==i*j){
                ok=true;
            }
        }
    }
    if(ok){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}


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

int modify(int n){
    string s = to_string(n);
    int ret = -1;
    for(int i = 1; i < s.length(); i++){
        string a = s.substr(0,i), b = s.substr(i);
        ret = max(ret, stoi(a)*stoi(b));
    }
    return ret;
}

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

    int n;
    while(q-- > 0){
        cin >> n;
        int step = 0;
        while(n > 9){
            n = modify(n);
            step++;
        }
        cout << step << endl;
    }

    return 0;
}


Measured memory_bytes: 3280
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    int a, b;
    cin >> a >> b;

    if ((a * b) % 2 == 0)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n, m;
    string s;
    cin >> n >> m >> s;

    vl dp(n+1, INF);  // dp[i] : マスiからマスnへの最小移動回数
    queue<ll> Q;

    dp[n] = 0;
    Q.push(0);
    for(ll i = n-1; i >= 0; i--) {
        while(1) {

            if(Q.size() == 0) {
                out(-1);
                re0;
            }

            if(Q.front() == INF || Q.size() > m) {
                Q.pop();
            }
            else {
                break;
            } 

        }
        if(s[i] == '0') {
            dp[i] = Q.front() + 1;
        } 
        Q.push(dp[i]);
    }
    
    vl ans;
    ll now = 0;  // いまいるマス
    ll rest = dp[0];  // 残りの移動回数
    while(now < n) {
        rest--;
        ll i = 1;
        while(dp[now+i] != rest) {
            i++;
        } 
        ans.pb(i);
        now += i;
    }

    rep(i, ans.size()) {
        cout << ans[i] << " ";
    }

    re0;
}

Measured memory_bytes: 2296
def abk(x,y):
  if x%2==1:
    x = x-1
  y = y + x/2
  x = x/2
  return (x,y)

a,b,k = map(int, input().split())
for _ in range(k):
  if _%2==0:
    a,b = abk(a,b)
  else:
    b,a = abk(b,a)
    
a = int(a)
b = int(b)
print(a,b)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int A =b-a+1;
		int B =b+a;
		for(int c=A;c<B;c++){
		if(c<B-1){
			System.out.print(c+" ");
			}
		else {
			System.out.println(c);
		}
		}
	}
}


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

template<typename First, typename Second, typename Third>
struct triple {
   First first;
   Second second;
   Third third;
};

using namespace std;
void solve(){
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   int mx=max(a,c);
   int mn=min(b,d);
   if(mn-mx<0)
       cout<<0;
   else 
      cout<<(mn-mx);

}

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


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

//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

#define rep(i,n) for(i=1;i<=n;i++)
#define Rep(i,n) for(i=0;i<n;i++)
#define For(i,a,b) for(i=a;i<=b;i++)

#define pb(x) push_back(x)
#define sz(x) x.size()

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define eps 1e-9

#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(ch) scanf("%s",ch)
#define pi(x) printf("%d",x)
#define pii(x,y) printf("%d %d",x,y)
#define piii(x,y,z) printf("%d %d %d",x,y,z)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define plll(x,y,z) printf("%lld %lld %lld",x,y,z)
#define ps(ch) printf("%s",ch)
#define Afridi 0
#define NL printf("\n")
#define debug(x) printf("wow  %d !!\n",x)
#define Max 8005
#define INF (LL)1e18
#define mod 1000000007

#define FI freopen("in.txt","r",stdin)

#define D(x) cout << #x << " = " << x << endl
#define DD(x,y) cout << #x << " = " << x << "   " << #y << " = " << y << endl

typedef long long LL;
typedef unsigned long long ULL;

using namespace std;


LL bigmod(LL b,LL p,LL m)
{
    if(p == 0)return 1;
    LL my = bigmod(b,p/2,m);
    my*=my;my%=m;
    if(p & 1)my*=b,my%=m;
    return my;
}
int setb(int n,int pos){return n=n | (1 << pos);}
int resb(int n,int pos){return n=n & ~(1 << pos);}
bool checkb(int n,int pos){return (bool)(n & (1 << pos));}

char str[100];

int main()
{
    ss(str);
    if( str[0] == str[2] )puts("Yes");
    else puts("No");
	return 0;
}


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

const int MAXN = 2e5+5;
vector<int> h;
int n, x, k;

vector<int> dp(MAXN, -1);

int solve(int x) {
	if (dp[x] != -1)
		return dp[x];

	if (x == 0)
		return 0;
	if (x < k)
		return abs(h[x] - h[0]);

	auto ans = INT_MAX;
	for (int i = 1 ; i <= k ; i++) {
		int z = max(x - i, 0);
		ans = min(ans, abs(h[x] - h[z]) + solve(z));
	}

	return dp[x] = ans;
}


int main(int argc, char const **argv) 
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	cin >> n >> k;
	for (int i = 0 ; i < n ; i++) {
		cin >> x;
		h.push_back(x);
	}

	cout << solve(n - 1);
	
	return 0;
}


Measured memory_bytes: 7800
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>

using namespace std;
int main() {
	char str[100];
	int cnt[130] = { 0 };
	cin >> str;
	int len = strlen(str);
	for (int i = 0; i <len; i++) {
		int k = (int)(str[i] - 'a');
		cnt[k]++;
		if (cnt[k] > 1) {
			cout << "no" << endl;
			system("pause");
			return 0;
		}
	}
	cout << "yes" << endl;


	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

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

    int d,t,s;
    cin >> d >> t >> s;
    int a=t*s;

    if (a<d)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ll long long
#define inf 100000000000000000
#define mod 1000000007
#define endl '\n'
#define omarshagar                    \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
using namespace std;
bool check(int mn,int mx,bool arr[])
{
    for(int i=mn;i<=mx;i++)
    {
        if(arr[i]==0)return 0;
    }
    return 1;
}
int main() {
    omarshagar
   ll n,m;
    cin>>n>>m;
    ll arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        arr[i]%=m;
       // cout<<arr[i]<<" sss"<<endl;
    }
    ll sum[n];
    ll ss=0;
    ll res=0;
    for(int i=0;i<n;i++)
    {
        sum[i]=(arr[i]+ss)%m;
        ss=sum[i];
        ss%=m;
       // cout<<"vv "<<ss<<endl;
        if(sum[i]==0){res++;/*cout<<i<<endl;*/};
    }

    sort(sum,sum+n);


    for(int i=0;i<n;)
    {
        ll tmp=sum[i];
        ll cnt=0;
        for(int ii=i;ii<n;ii++)
        {
            if(sum[ii]!=tmp)break;
            cnt++;
        }
        i+=cnt;
          //  cout<<cnt<<endl;
        if(cnt>1)
        {
            res+=(cnt*(cnt-1))/2.0;
        }
    }
    cout<<res<<endl;
    return 0;
}
/*
 1
 4
1000
0010
0100
0001


 */

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

#define fi first
#define se second

const int N = 200200;
const int mod = 1e9 + 7;

using namespace std;

int n, m, k;
int a[100][100];
set < int > s[N];

int main()
{
        ios_base::sync_with_stdio(0);

        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        cin >> n >> m >> k;
        for(int i = 1; i <= k; i++){
                int x, y;
                cin >> x >> y;
                s[x].insert(y);
                //a[x][y] = 1;
        }
        //for(int i = 1; i <= n; i++, cout << "\n") for(int j = 1; j <= m; j++) cout << a[i][j];
        int res = 1, l = 1, r = 1;
        while(res < n){
                res += 1;
                auto p = s[res].lower_bound(l);
                if(p != s[res].end() && *p <= r){
                        res -= 1;
                        break;
                }
                if(s[res].find(r + 1) == s[res].end()){
                        r += 1;
                }
        }
        cout << res << "\n";
}


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

int main() {
	int A, B, C;
	bool isPoor = false;

	cin >> A >> B >> C;

	if (A == B && B != C) {
		isPoor = true;
	}
	else if (A == C && A != B) {
		isPoor = true;
	}
	else if (B == C && A != C) {
		isPoor = true;
	}
	else {
		cout << "No" << endl;
	}

	if (isPoor) {
		cout << "Yes" << endl;
	}
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define md 1000000007


int main() 
{ 
    ll k,x,h,l;
    cin>>k>>x;
    if(k==1)
        cout<<x;
    else
    {
      h=k+x-1;
      l=x-k+1;
      //cout<<h<<" "<<l;
      for(ll i=l;i<=h;i++)
         cout<<i<<" ";
    }
    return 0;
} 


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

#ifndef ONLINE_JUDGE
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
#else
#define dbg(x)
#endif

#define X first
#define Y second

int main(){
    std::ios_base::sync_with_stdio(false);
    int n; cin >> n;
    vi arr(n);
    for(int i = 0; i < n; i++) cin >> arr[i];
    int res = INT_MAX;
    for (int i = -100; i <= 100; i++){
        int cur = 0;
        for (int j = 0; j < n; j++){
            cur += (i - arr[j]) * (i - arr[j]);
        }
        res = min(res, cur);
    }
    cout << res << endl;


    return 0;
}


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

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

	int N,M;
	int p;
	string S;
	int i,k;
	int AC=0;
	int WA=0;

	cin >> N >> M;
	int wrong[N+5]={0};

	for(i=0;i<M;i++){
		cin >> p >> S;
		if(S=="AC" && wrong[p]>=0){
			AC++;
			WA+=wrong[p];
			wrong[p]=-1000000;
		}else{
			wrong[p]++;
		}
	}

	cout << AC << " " << WA << endl;

	return 0;
}



Measured memory_bytes: 4024
import java.util.*;

class Main {

	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		for(;;){
			int n = in.nextInt();
			if( n == 0 ) return ;
			int key = -1, dist = -1;
			for(int i=0; i<n; i++){
				int id = in.nextInt();
				int d = in.nextInt() + in.nextInt();
				if( d > dist ){
					key = id;
					dist = d;
				}
			}
			System.out.println(key + " " + dist);
		}
	}

}

Measured memory_bytes: 13000
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int[] X = new int[N];
    for (int i = 0; i < N; i++) X[i] = scanner.nextInt();

    int min = 1_000_000;
    for (int i = 1; i <= 100; i++) {
      int cost = 0;
      for (int j = 0; j < N; j++) cost += (X[j] - i) * (X[j] - i);
      min = Math.min(min, cost);
    }
    System.out.println(min);
  }
}


Measured memory_bytes: 21844
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int i;
        for(int x = 1; x <= n; x++){
            if(String.valueOf(x).contains("3")){
                System.out.print(" " + x);
            }
            else if(x % 3 == 0){
                System.out.print(" " + x);
            }
            else if(x % 10 == 3){
                System.out.print(" " + x);
            }
            else{
                i = x /10;
                if(i % 10 == 3){
                    System.out.print(" " + x);
                }
            }
        }
        System.out.println();
    }
}


Measured memory_bytes: 29952
n, k = map(int, input().split())
has = [False for _ in range(n)]
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        has[a[j] - 1] = True
count = 0
for i in range(n):
    if not has[i]:
        count += 1
print(count)


Measured memory_bytes: 67832
import sys
sys.setrecursionlimit(15000)

n, m = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

key = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}
#k = [1, 7, 4, 5, 3, 2, 9, 6, 8]

dpi = [-1<<50] * 9 + [0]
def dp(i):
    '''i should be started from 1'''

    ans = []
    for j in a:
        ans.append(dpi[len(dpi) - key[j]] + 1)
    dpi.append(max(ans))

    if i == n:
        return dpi[len(dpi) - 1]
    else:
        return dp(i + 1)

i = dp(1)
a.sort()

s = ''
cur = -1
for j in range(i):
    for k in reversed(a):
        if dpi[cur-key[k]] == dpi[cur] - 1:
            s += str(k)
            cur -= key[k] 
            break
        else:
            continue

print(int(s))


Measured memory_bytes: 16420
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
int a,b,c;
cin>>a>>b>>c;
int kouho1,kouho2,kouho3;
kouho1=max(10*a+b+c,10*b+a+c);
kouho2=max(10*b+c+a,10*c+b+a);
kouho3=max(10*c+a+b,10*a+c+b);
int ans;
ans=max(kouho1,kouho2);
ans=max(kouho3,ans);
cout<<ans<<endl;



return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#include <iostream>
#include <stack>

using namespace std;

int main(){
    int n;
    scanf("%d\n", &n);
    vector<pair<long, long> > ps;
    ps.resize(n);
    for(int i = 0; i  < n; ++i){
        int x, y;
        scanf("%d %d", &x, &y);
        ps.at(i).first = x;
        ps.at(i).second = y;
    }

    multiset<pair<long long, long long> > ds;
    for(int i = 0; i < n; ++i){
        for(int j = i + 1; j < n; ++j){
            long long dx = ps.at(i).first - ps.at(j).first;
            long long dy = ps.at(i).second - ps.at(j).second;
            ds.insert(make_pair(dx, dy));
            ds.insert(make_pair(-dx, -dy));
        }
    }

    int max_count = 0;
    pair<long long, long long> max_d;
    for(auto x : ds){
        if(max_count < ds.count(x)){
            max_count = ds.count(x);
            max_d = x;
        }
    }

    cout << (n - max_count) << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>                              
#include <algorithm>                             
                                                 
using namespace std;                             
                                                 
int main(int argc, char **argv) {                
    int mountain[10];                            
                                                 
    for (int i = 0; i < 10; i++) {               
        cin >> mountain[i];                      
    }                                            
                                                 
    sort(mountain, mountain + 10, greater<int>());
                                                 
    for (int j = 0; j < 3; j++) {                
        cout << mountain[j] << endl;             
    }                                            
                                                 
    return 0;                                    
}                                                
                                                 
                                                 
                                                 
                                                 
                                                 


Measured memory_bytes: 3112
n = int(input())
s = input()
ans = s.count('R') * s.count('G') * s.count('B')

for i in range(n):
    d = 1
    while i + 2*d < n:
        if s[i] != s[i+d] and s[i] != s[i+2*d] and s[i+d] != s[i+2*d]:
            ans -= 1
        d += 1
print(ans)


Measured memory_bytes: 9160
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define PI            (acos(-1.0))
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define repp(i,a,n)   for(int i=a;i<n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define w(t)          int t;cin>>t;while(t--)
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;

const int N = 1e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
    string s,k;
    cin>>s>>k;
    for(int i=0;i<SZ(s);i++)
    {
        if(s[i]!=k[i]){cout<<"No"<<nl;return 0;}
    }
    cout<<"Yes"<<nl;
    return 0;
}


Measured memory_bytes: 3684
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#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;
}

map<char, vector<int>> counter;

int main(void) {
    string s, t;
    cin >> s >> t;
    const int slen = (int) s.size();
    const int tlen = (int) t.size();

    for (int i = 0; i < slen; i++) {
        counter[s[i]].push_back(i);
    }

    for (int i = 0; i < tlen; i++) {
        if ((int) counter[t[i]].size() == 0) {
            cout << -1 << endl;
            return 0;
        }
    }

    ll scnt = 0;
    int si = 0;
    for (auto &tc : t) {
        auto p = lower_bound(counter[tc].begin(), counter[tc].end(), si);
        if (p == counter[tc].end()) {
            si = counter[tc][0] + 1;
            scnt++;
        } else {
            si = *p + 1;
        }
    }

    cout << ll(slen) * ll(scnt) + ll(si) << endl;

    return 0;
}


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

#define fa(x,v) for(auto x:v)
#define f(i,a,b) for(ll i=(ll)a;i<=(ll)b;i++)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define spc " "
#define endl '\n'
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(s) (ll)int(s.length())
#define sz(v) (ll)int(v.size())
#define MOD 1000000007

void Fast_IO() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
    freopen("debug.out","w",stderr);
    #endif
} 

// Code Here

int main()
{
    // Fast_IO();
    ll a[5];
    f(i,0,4) cin >> a[i];
    ll ans = 0;
    f(i,0,4) if(a[i] == 0) {
    	ans = i+1;
    	break;
    }
    cout << ans;
    return 0;
}

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

int main(void){
    int n, k;
    cin >> n >> k;
    
    bool d[10] = {false};
    int input;
    int i;
    for(i = 1; i <= k; i++){
        cin >> input;
        d[input] = true;
    }
    
    int cpy;
    while(true){
        cpy = n;
        while(cpy){
            if(d[cpy % 10]){
                goto next;
            }
            cpy /= 10;
        }
        
        cout << n << endl;
        return 0;
        
        next:
        n++;
    }
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	int len = (int)1e6 + 1;

	void doIt() {
		int N = sc.nextInt();
		int M = sc.nextInt();
		int ans = (N * (N - 1)) / 2 + (M * (M - 1)) / 2;
		System.out.println(ans);
	}

	
	
	public static void main(String[] args) {
		new Main().doIt();
	}

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;


const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    int N; cin >> N;
    vector<int> s(N);
    int S = 0;
    for(int i=0;i<N;i++) {cin >> s[i]; S+=s[i];}
    sort(s.begin(), s.end());
    if(S%10==0){
        for(int i=0;i<N;i++){
            if(s[i]%10 != 0) {S-=s[i]; break;}
            if(i == N-1) S = 0;
        }
    }
    cout << S << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
 
using namespace std;
using namespace __gnu_pbds;
 	// find_by_order()  // order_of_key
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inff (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
#define SPEED ios_base::sync_with_stdio(false) ;cin.tie(NULL) ;cout.tie(NULL) ;
#define fp(i,a,n) for(ll i=n-1; i>a ;i--)
#define deb(x) cout << #x << " ---> " << x << endl;
#define X first
#define Y second
#define pia 3.1415926536
#define mod 1000000007 
#define N 300050
#define ml map<ll,ll>
#define mll map<pair<ll,ll> ,ll>
#define letsh(a,b) a<<b
#define rigsh(a,b) a>>b 
#define vvl vector<vl>
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count()) ;
		ll lcm(ll a, ll b)
		{
               return a / __gcd(a, b) * b;
       	}
       ll power(ll a,ll n,ll m=mod)
	   {
        ll ans=1;
        while(n)
		{
        if(n&1) ans=(ans*a)%mod;
        a=(a*a)%mod ;
        n=n>>1;
   		 }
   		 return ans;
      }
      //ll n,m,k ;
      vll dir({{1, 0}, {-1, 0}, {0, 1}, {0, -1}}) ;
      void solve()
      {
       string s ;cin>>s ;
       ll n =s.size() ;
       ll sum =0 ;
       f(i,0,n) sum +=(s[i] -'0') ;
       if(sum%9 ==0) cout<<"Yes"<<endl ;
       else cout<<"No"<<endl ;
      }
		
      
      int main() 
	  {
	  	SPEED
	  	cout.precision(30) ;
        ll t =1; ;
        while(t--) solve() ; 
	  }

Measured memory_bytes: 3792