akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (1e+18) + 7;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

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

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 20;
modint fact[max_n], factinv[max_n];
void init() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}


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

void solve() {
	int a, b; cin >> a >> b;
	cout << (a + b - 1) / b << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	//int t; cin >> t; rep(i, t)solve();
	//while (cin >> n, n)solve();
	solve();
	stop
		return 0;
}


Measured memory_bytes: 16640
#include <iostream>
using namespace std;
int main()
{
    int n, m, a, b, ans = 0;
    int h[100001] = {}, ab[100001] = {};
    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        scanf("%d", &h[i]);
    }
    for(int i = 0; i < m; i++) {
        scanf("%d%d", &a, &b);
        if(ab[a] < h[b]) {
            ab[a] = h[b];
        }
        if(ab[b] < h[a]) {
            ab[b] = h[a];
        }
    }
    for(int i = 1; i <= n; i++) {
        if(h[i] > ab[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

a = list(set(A))

ans = "No"

if len(a) == 1:
    if a == [0]:
        ans = "Yes"
elif len(a) == 2:
    if N % 3 == 0 and A.count(0) == N//3:
        ans = "Yes"
elif len(a) == 3:
    if a[0] ^ a[1] ^ a[2] == 0 and N % 3 == 0 and (A.count(a[0]),A.count(a[1]),A.count(a[2])) == (N//3,N//3,N//3):
        ans = "Yes"

print(ans)

Measured memory_bytes: 14212
#include<bits/stdc++.h>
using namespace std;
int n,a[10010],maxi=-999999;
long long ans=0;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		ans+=a[i];
	}
	ans-=n;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 200000
#define MOD 1000000007
int n,ans,tp;
char s[MAXN+1];
char stk[MAXN+1];
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	ans=1;
	if(s[1]=='W'){
		printf("0\n");return 0;
	}
	stk[++tp]='B';stk[0]='W';
	for(int i=2;i<=2*n;i++){
		if(stk[tp]==s[i]){
	       ans=(1LL*ans*tp)%MOD,tp--;
		}
	    else stk[++tp]=s[i];
	    if(tp<0){printf("0");return 0;}
	}
	for(int i=1;i<=n;i++)
	ans=(1LL*ans*i)%MOD;
	if(!tp)printf("%d",ans);
	else printf("0");
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int a, b, c;
	cin >> a >> b >> c;
	set<int> st;
	st.insert(a);
	st.insert(b);
	st.insert(c);
	if ((int)st.size() == 2) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
 	return 0; 
}


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

int main(){
	
	string s, t;
	cin >> s >> t;
	
	int n = s.size();
	
	int cnt[26] = {0};
	map<char,int> mp;
	
	for(int i = 0; i < n; i++){
		cnt[s[i]-'a']++;
		if(cnt[s[i]-'a'] > 1 && mp[s[i]] != t[i]){
			cout << "No";
			return 0;
		}
		else if(cnt[s[i]-'a'] == 1) mp[s[i]] = t[i];
	}
	
	int cnt1[26] = {0};
	map<char,int> mpn;
	
	for(int i = 0; i < n; i++){
		cnt1[t[i]-'a']++;
		if(cnt1[t[i]-'a'] > 1 && mpn[t[i]] != s[i]){
			cout << "No";
			return 0;
		}
		else if(cnt1[t[i]-'a'] == 1) mpn[t[i]] = s[i];
	}
	
	cout << "Yes";
	
	return 0;
}

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

#define endl "\n"
#define MOD 1000000007

#define forn(i, a, n) for (int i = a; i < n; i++)
#define forns(i, a, n, step) for (int i = a; i < n; i += step)
#define fornr(i, a, n) for (int i = n; i > a; --i)
#define fornrs(i, a, n, step) for (int i = n; i > a; i -= step)
#define forlimits(i, l, r) for (int i = l; i <= r; i++)

// Choose auto x when you want to work with copies.
#define foritc(i, v) for (auto i = v)
// Choose auto &x when you want to work with original items and may modify them.
#define foritm(i, v) for (auto &i = v)
// Choose auto const &x when you want to work with original items and will not modify them.
#define forit(i, v) for (auto const &i = v)

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

#define fill(arr, n, k) \
    forn(i, 0, n) { arr[i] = k; }

#define print(arr, n)                        \
    forn(i, 0, n) { cout << arr[i] << " "; } \
    cout << endl;

#define intersection(a, b, out) set_intersection(all(a), all(b), out.begin())

#define sum_n(n) ((n) * (n + 1) / 2)
typedef long long ll;
void solve();

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    solve();
    // ll t;
    // cin >> t;
    // while (t--) {
    //     solve();
    // }
    // return 0;
}

void solve() {
    ll n;
    cin >> n;
    ll arr[n], cost[n];
    forn(i, 0, n) {
        cin >> arr[i];
    }
    cost[0] = 0;
    cost[1] = abs(arr[1] - arr[0]);

    forn(i, 2, n) {
        ll v1 = cost[i - 1] + abs(arr[i] - arr[i - 1]);
        ll v2 = cost[i - 2] + abs(arr[i] - arr[i - 2]);
        cost[i] = min(v1, v2);
    }

    cout << cost[n - 1] << endl;
}

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

int main()
{
  int A, B, C;
  cin >> A >> B >> C;
  
  int max = A;
  if(max < B)
  {
    max = B;
  }
  if(max < C)
  {
    max = C;
  }
  
  cout << max * 10 + (A+B+C-max) << endl;
  
  return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define inlld(x) scanf("%lld", &x)
#define ind(x) scanf("%d", &x)
#define inlld2(x, y) scanf("%lld%lld", &x, &y)
#define inlld3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z)
#define ind2(x, y) scanf("%d%d", &x, &y)
#define ind3(x, y, z) scanf("%d%d%d", &x, &y, &z)

const int N=1e5+5;
const int MOD=1e9+7;

typedef long long ll;
typedef long double ld;

using namespace std;

int main()
{
	ll n;
	inlld(n);
	ll ans = 0;
	for(ll a = 1; a <= n; a++)
		for(ll b = 1; b <= n; b++)
			for(ll c = 1; c <= n; c++)
				ans += __gcd(a, __gcd(b, c));
	printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3812
import sys

input = sys.stdin.readline


def ii():
    return int(input())


def il():
    return list(map(int, input().split()))


def sum_digits(n: int, base: int) -> int:
    if n < base:
        return n
    else:
        return sum_digits(n // base, base) + (n % base)


N = int(input())
s = sum_digits(N, 10)
print("Yes" if N % s == 0 else "No")


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var xyxy = ReadSplitInt();
            var x1 = xyxy[0];
            var y1 = xyxy[1];
            var x2 = xyxy[2];
            var y2 = xyxy[3];

            var x = x2 - x1;
            var y = y2 - y1;

            var x3 = x2 - y;
            var y3 = y2 + x;

            var x4 = x1 - y;
            var y4 = y1 + x;
            Println($"{x3} {y3} {x4} {y4}");
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


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

int main()
{
	string s, t;
	cin >> s >> t;
	int n = 0;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] != t[i])
		{
			n++;
		}
	}
	cout << n;
}

Measured memory_bytes: 3440
#include <bits/stdc++.h>
//#define DEBUG
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define deb(x) std::cout << #x << " " << x << endl;

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}
template<typename... T>
void write(T... a){
    ((cout << a << "\n"),...);
}

void solve(){
    int n, m;
    read(n, m);
    vector<bool> solved(n, false);
    vector<int> try_num(n, 0);
    int count_ac = 0;
    int count_penalty = 0;
    REP(i,m){
        int p;
        string s;
        cin >> p >> s; 
        p--;
        if( solved[p]) continue;
        if( s == "AC"){
            count_ac++;
            solved[p] = true;
            count_penalty += try_num[p];
        }else{
            try_num[p]++;
        }
    }
    cout << count_ac << " " << count_penalty << endl;
} 

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 2;
    while(TEST_CASES--){
    #endif // DEBBUG

    solve();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}

//Thanks to CSES problemset
// I am trained with this kind of problem

Measured memory_bytes: 3728
from math import sqrt

n = int(input())
XY = [list(map(int, input().split())) for _ in range(n)]
total = sum(
    sqrt((XY[i][0] - XY[j][0])**2 + (XY[i][1] - XY[j][1])**2)
    for i in range(n)
    for j in range(i + 1, n)
)

print(2 * total / n)


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

int main(){
	int cont1 = 1,cont2 = 1,aux=0;
	char a,b,c,d;
	scanf("%c",&a);
	scanf("%c",&b);
	scanf("%c",&c);
	scanf("%c",&d);

	if(a == b){
		++cont1;
		if(c == d){
			++cont2;
			if(a != c)
				aux = 1;
		}
	}else if(c == a){
		++cont1;
		if(b == d){
			++cont2;
			if(a != b)
				aux = 1;
		}
	}else if(a == d){
		++cont1;
		if(b == c){
			++cont2;
			if(a != b)
				aux = 1;
		}
	}


	if(cont1 == 2 && cont1 == cont2 && aux)
		puts("Yes");
	else
		puts("No");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int i,j;
  for(i=0;i<s.size();i++){
    if(s.at(i)=='A'){
      break;
    }
  }
  for(j=s.size()-1;j>=0;j--){
    if(s.at(j)=='Z'){
      break;
    }
  }
  cout << j-i+1;
}
  


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
# 文字列の入力
s = input()

if a%2==1:
  print("No")
else:
  if s[int(a/2):] == s[:int(a/2)]:
    print("Yes")
  else:
    print("No")

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

using namespace std;

int main() {

    int n, m, l;
    int ste[50000][3];
    int b[10000], c[10000];
    int cnt = 0;

    cin >> n >> m;

    while(1) {
        cin >> ste[cnt][0]; --ste[cnt][0];
        cin >> ste[cnt][1]; --ste[cnt][1];
        cin >> ste[cnt][2];
        if(ste[cnt][2] == 0) {
            break;
        } else {
            ++cnt;
        }
    }

    cin >> l;

    for(int i = 0; i < l; ++i) {
        for(int j = 0; j < n; ++j) {
            c[j] = 0;
        }
        for(int j = 0; j < m; ++j) {
            cin >> b[j];
        }
        for(int j = 0; j < cnt; ++j) {
            c[ste[j][0]] += b[ste[j][1]] * ste[j][2];
        }

        cout << c[0];
        for(int j = 1; j < n; ++j) {
            cout << " " << c[j];
        }
        cout << endl;
    }

}

Measured memory_bytes: 3740
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;



int main(){
    ll n,m; cin >> n >> m;
    vector<vpl> v(n);
    rep(i,m){
        ll p,y; cin >> p >> y; p--;
        v[p].emplace_back(y,i);
    }
    vpl ans(m);
    rep(i,n) sort(all(v[i]));
    rep(i,n){
        rep(j,v[i].size()){
            ans[v[i][j].second].first = i+1;
            ans[v[i][j].second].second = j+1;
        }
    }
    rep(i,m){
        printf("%06lld%06lld\n",ans[i].first,ans[i].second);
    }
}


Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	int H,W;
	cin>>H>>W;
	
	vector<vector<int>> A(H,vector<int>(W));
	vector<vector<int>> B(H,vector<int>(W));
	
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin>>A[i][j];
		}
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin>>B[i][j];
		}
	}
	
	vector<vector<bitset<14000>>> flag(H,vector<bitset<14000>>(W));
	
	flag[0][0][7000+A[0][0]-B[0][0]]=true;
	flag[0][0][7000-A[0][0]+B[0][0]]=true;
	
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(i!=H-1){
				int a = abs(A[i+1][j]-B[i+1][j]);
				flag[i+1][j] |= (flag[i][j] << a);
				flag[i+1][j] |= (flag[i][j] >> a);
			}
			if(j!=W-1){
				int a = abs(A[i][j+1]-B[i][j+1]);
				flag[i][j+1] |= (flag[i][j]<<a);
				flag[i][j+1] |= (flag[i][j]>>a);
			}
		}
	}
	int ans = 10000000;
	for(int i=0;i<14000;i++){
		if(flag[H-1][W-1][i]){
			ans = min(ans,abs(7000-i));
		}
	}
	
	cout<<ans<<endl;
	

	return 0;
}


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

int main(){
  int N, K, a, d;
  cin >> N >> K;
  
  vector <int> S (N); //すぬけ 1 ~ N の それぞれの お菓子所持数
  
  int T = 0;//かわいそうな すぬけ君の数
  
  for(int i = 0; i < K; i++){
    
    cin >> d;
    
    for(int j = 0; j < d; j++){
      
      cin >> a;
      
      S.at(a - 1)++;
      
    }
    
  }
  
  for(int i = 0; i < N; i++){
    
    if(S.at(i) == 0)T++;
    
  }
  
  cout << T << endl;
  
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define reps(i,s,n) for (int i = (s); i <= (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    
    
    int N;
    cin >> N;
    int A[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }

    map<int, int> M;

    for(int i = 0; i < N; i++){
        M[A[i]]++;
    }
    int ans = 0;
    for(auto m:M){
        if(m.second % 2 != 0){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for(int i = (int)(n); i>=0; --i)
struct fast_ios { fast_ios(){cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast_ios_;

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

    set<string> prize;
    rep(i, N)
    {
        string s;
        cin >> s;
        prize.insert(s);
    }

    cout << prize.size() << endl;
    return 0;
}

Measured memory_bytes: 19236
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    ll n, m; cin >> n >> m;
    ll ans = 0;
    ans += min(n, m/2);
    ans += (m-2*ans)/4;
    cout << ans;
}


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

using namespace std;

constexpr int MOD = 1'000'000'007;

int modPow(int a, int b = MOD - 2, int c = MOD) {
    long long x = 1, y = a;
    while (b > 0) {
        if (b % 2 == 1) {
            x = (x * y) % c;
        }
        y = (y * y) % c;
        b /= 2;
    }
    return x % c;
}
int ncr(int n, int k, const vector<int> &fac) {
    return 1LL * fac[n] * modPow(1LL * fac[k] * fac[n - k] % MOD) % MOD;
}

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

    int H, W, A, B;
    cin >> H >> W >> A >> B;
    constexpr int MX = 400'000;
    vector<int> fac(MX + 1, 1);
    for (int i = 2; i <= MX; ++i) {
        fac[i] = (1LL * fac[i - 1] * i) % MOD;
    }
    int res = 0;
    for (int hi = 0; hi < H - A; ++hi) {
        int c1 = ncr(hi + B - 1, hi, fac);
        int c2 = ncr(H - 1 - hi + W - B - 1, H - 1 - hi, fac);
        res = (res + 1LL * c1 * c2) % MOD;
    }
    cout << res << "\n";

    return 0;
}

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

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

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

	map<string, int> mp;
	int mx = 0;
	for (int i = 0; i < n; i++) {
		string x;
		cin >> x;
		mp[x]++;
		mx = max(mx, mp[x]);
	}
	for (auto p : mp) {
		if (p.second == mx) cout << p.first << "\n";
	}
}

Measured memory_bytes: 25216
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ac = 0 , wa = 0 , tle = 0 , re = 0 ;
        String a = "AC";
        String w = "WA";
        String t = "TLE";
        for(int i = 1 ; i <= n ; i++ ){
            String ch = sc.next();
            if( a.equals(ch) ){
                ac++;
            }else if(w.equals(ch)){
                wa++;
            }else if(t.equals(ch)){

                tle++;
            }else{
                re++;
            }
        }
        System.out.println("AC x " + ac);
        System.out.println("WA x " + wa);
        System.out.println("TLE x " + tle);
        System.out.println("RE x " + re);
        sc.close();
    }
}

Measured memory_bytes: 57836
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0;i<n;i++)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 2LL << 60;
using ll = long long;
using P = pair<ll, ll>;
int main(int argc, char const *argv[]){
    ll n;
    cin >> n;
    ll size=2;
    while(size<n*2){
        size*=2;
    }
    vector<ll> a(size+1);
    rep(i,n) {
        cin >> a[size/2+i];
    }
    for(int i=size/2-1;i>0;i--){
        a[i]=a[i*2]^a[i*2+1];
    }
    for(int i=0;i<n;i++){
        int ans=0;
        int r=size/2+i+1;
        int l=size/2+i-1;
        if(i==0)l=1;
        if(i==n-1)r=1;
        while(r>1){
            if(r%2==1){
                ans^=a[r];
                r++;
            }
            r/=2;
        }
        while(l>1){
            if(l%2==0){
                ans ^= a[l];
                l--;
            }
            l/=2;
        }
        cout << ans << endl;
    }

    return 0;
}




Measured memory_bytes: 7492
#include<iostream>
#include<cstdio>
using namespace std;
int n,m,a[202020];
long long ans,res,sum[202020];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<n;i++)
	{
		int l=a[i],r=a[i+1];
		if(l>r) r+=m;
		ans+=r-l;
		l+=2;
		if(l>r) continue;
		sum[l]++;sum[r+1]-=r-l+2;sum[r+2]+=r-l+1;
	}
	for(int i=1;i<=m+m;i++)
		sum[i]+=sum[i-1];
	for(int i=1;i<=m+m;i++)
		sum[i]+=sum[i-1];
	res=ans;
	for(int i=1;i<=m;i++)
		res=min(res,ans-sum[i]-sum[i+m]);
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 2176
/*input
10000000019
*/
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<ll,ll>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll INF64=4e18;
const int INF=1e6+1;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll sub(ll a,ll b){
    ll x=a-b;
    while(x<0) x+=MOD;
    while(x>MOD) x-=MOD;
    return x;
}
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=(res*a);
        if(res>1e10) return 1e11;
        a=(a*a);
        b>>=1;
    }
    return res;
}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
int main(){
    ll n;
    cin>>n;
    ll ans=INF64;
    for(int i=1;i<=sqrt(n);i++){
        if(n%i==0) ans=min(ans,i+n/i-2);
    }
    cout<<ans;
}

Measured memory_bytes: 256
N, M=map(int, input().split())
r=(N-M)*100+M*1900
p=1/2**M
q=1-p
ans=0
for i in range(1,10000):
  ans+=(r*i)*p*q**(i-1)
if ans-int(ans)>0.5:
  print(int(ans)+1)
else:
  print(int(ans))

Measured memory_bytes: 9412
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
	"unsafe"
)

func main() {
	ABC := sc.nextInts()
	A := ABC[0]
	B := ABC[1]
	C := ABC[2]
	AMB := A - B
	if C-AMB < 0 {
		fmt.Println(0)
		return
	}
	fmt.Println(C - AMB)
}

var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}

// Pair a
type Pair struct {
	first  int
	second int
}

// Queue a
type Queue struct {
	v []Pair
}

// Push for queue
func (q *Queue) Push(v Pair) {
	q.v = append(q.v, v)
}

// Pop for queue
func (q *Queue) Pop() Pair {
	r := q.v[0]
	q.v = q.v[1:]
	return r
}

// Front for queue
func (q Queue) Front() Pair {
	return q.v[0]
}

// Empty return true if empty
func (q Queue) Empty() bool {
	return len(q.v) == 0
}


Measured memory_bytes: 640
import sys
readline = sys.stdin.readline

# スタートを0で塗り、行先が奇数であれば違う色で塗る、を繰り返せばよい
N = int(readline())
G = [[] for i in range(N)]

for i in range(N - 1):
  u,v,w = map(int,readline().split())
  G[u - 1].append([v - 1, w])
  G[v - 1].append([u - 1, w])

ans = [-1] * N

stack = []
# 頂点, 色
stack.append([0,0])
while stack:
  v,color = stack.pop()
  if ans[v] != -1:
    continue
  ans[v] = color
  for child in G[v]:
    col = color
    if child[1] % 2 == 1:
      col ^= 1
    stack.append([child[0], col])

for a in ans:
  print(a)

Measured memory_bytes: 45396
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

using namespace std;
using ll = long long;
using ull = unsigned long long;
#define out(S) cout<<(S)<<endl;
#define REP(i,b) for(size_t i=0;i<(b);i++)
#define rREP(i,b) for(size_t i=(b)-1;i>=0;i--)
#define FOR(i,a,b) for(size_t i=(a);i<(b);i++)
#define rFOR(i,a,b) for(size_t i=(b)-1;i>=0;i--)
#define Foreach(item,collection) for(auto item:collection)
#define mod(i) ((i) % (ll)(1e9 + 7))
ll modpow(ll i, ll j) { ll tmp = 1; while (j) { if (j % 2)tmp = mod(tmp*i); i = mod(i*i); j /= 2; }return tmp; }
#define divmod(a,b) (mod(a * modpow((ll)b,(ll)(1e9 + 5))))

int main(){
	int N;
	cin >> N;
	vector<int> s;
	int sum = 0;
	REP(i, N) {
		int si;
		cin >> si;
		s.push_back(si);
		sum += si;
	}
	sort(s.begin(), s.end());

	int index = 0;
	int tmp = sum;
	while (tmp % 10 == 0 && index < s.size()) {
		tmp = sum - s[index];
		index++;
	}
	if (tmp % 10 == 0) { out(0); return 0; }
	out(tmp);
    return 0;
}



Measured memory_bytes: 256
program main
    use,intrinsic :: iso_fortran_env
    implicit none
    character(10):: a,b,c
    integer(int32):: la,lb,lc

    read*, a,b,c
    la = len_trim(a)
    lb = len_trim(b)
    lc = len_trim(c)

    if (a(la:la) == b(1:1) .and. b(lb:lb) == c(1:1)) then
        print'(a)', 'YES'
    else
        print'(a)', 'NO'
    end if
    
end program main

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;


class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		final int NUM = 28;
		final int NUMs = 30;
		ArrayList<Integer> al = new ArrayList<Integer>();
		HashSet<Integer> h = new HashSet<Integer>();
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		for(int i = 0; i < NUM ;i++){
			h.add(Integer.parseInt(in.readLine()));
		}
		for(int i= 0;i < NUMs ;i++){
			if(!h.contains(i+1)){
				al.add(i+1);
			}
		}
		System.out.println(al.get(0));
		System.out.println(al.get(1));

	}

}

Measured memory_bytes: 16872
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }

struct Tmp
{
public:
  int N;
  vector<int> input;
  Tmp(int N)
  : N(N)
  , input(N)
  {}
};

void solve(void)
{
  string s; cin >> s;
  auto ans = s[2] == s[3] && s[4] == s[5];
  cout << (ans ? "Yes" : "No") << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 384
N = int(input())
min_time = 1000000000000000
for i in range(5):
    a = int(input())
    if min_time > a:
        min_time = a

if N % min_time == 0:
    waste_time = N // min_time - 1
else:
    waste_time = N // min_time
print(waste_time + 5)


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

signed main(){
	int N,K;
	cin>>N>>K;
	if(2*K-1>N){
		cout<<-1<<endl;
		return 0;
	}
	vint z(N);iota(all(z),2*N);
	vint x,y;
	if(N&1){
		for(int i=0;i<N;i+=2)x.pb(i);
		for(int i=1;i<N;i+=2)x.pb(i);

		for(int i=N/2;i>=0;i--)y.pb(N+i);
		for(int i=N-1;i>N/2;i--)y.pb(N+i);
	}
	else{
		for(int i=1;i<N;i+=2)x.pb(i);
		for(int i=0;i<N;i+=2)x.pb(i);

		for(int i=N/2-1;i>=0;i--)y.pb(N+i);
		for(int i=N-1;i>=N/2;i--)y.pb(N+i);
	}
	rep(i,N){
		cout<<x[i]+K<<" "<<y[i]+K<<" "<<z[i]+K<<endl;
	}
	return 0;
}

Measured memory_bytes: 4724
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

	int N;
	cin >> N;
	int a[100];
	for(int i=0; i<N; i++) cin >> a[i];
	LL ans = LL_MAX;
	for(int i=-100; i<=100; i++){
		LL tmp = 0;
		for(int j=0; j<N; j++){
			tmp += (i-a[j])*(i-a[j]);
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
string s,p;
int main()
{
    ft
    int t,i,j,n,m,l,r;
    cin>>s;
    l=0;
    r=s.size();
    for(i=0;i<r;i++)
    {
        if(i%2==0)
        {
            if(!(s[i]=='R' || s[i]=='U' || s[i]=='D'))
            {
                l=1;
            }
        }
        else
        {
            if(!(s[i]=='L' || s[i]=='U' || s[i]=='D'))
            {
                l=1;
            }
        }
    }
    (l==1)? cout<<"No\n": cout<<"Yes\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr long long INF = 1LL << 62;
constexpr ll MOD = 2019;


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll L,R;cin >> L >> R;
    ll ans = INF;
    if(R-L >= 2019) ans = 0;
    else {
        for(int i=L; i <= R; ++i){
            for(int j=i+1; j <= R; ++j){
                ans = min(ans, i%MOD*j%MOD);
            }
        }
    }
    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int no = n + 1 >> 1, ne = n >> 1;
    double ans = no / (double)(n);
    cout << fixed << setprecision(13) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

ll BIT[200100];

void add(int A, ll B) {
	while (A <= 200100) {
		BIT[A] = max(BIT[A], B);
		A += A & -A;
	}
}

ll query(int A) {
	ll kotae = 0;
	while (A > 0) {
		kotae = max(kotae, BIT[A]);
		A -= A & -A;
	}
	return kotae;
}

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

	int N;
	cin >> N;
	int H[200001], A[200001];
	rep1(i, N) cin >> H[i];
	rep1(i, N) cin >> A[i];

	rep1(i, N) {
		add(H[i], query(H[i]) + A[i]);
	}

	co(query(200010));

	Would you please return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main(){
  long int n,p,e=0,a=1,b=0;cin>>n>>p;
  for(int i=0;i<n;i++){
    int a;cin>>a;
    if(a%2==0)e++;
  }
  if(e>0){
    for(int i=0;i<e;i++)a*=2;
  }
  if(p==0){
    for(int i=0;i<=n-e;i+=2){
      long int c=1;
      for(int j=n-e-i+1;j<=n-e;j++){
        c*=j;
        c/=j-n+e+i;
      }
      b+=c;
    }
    cout<<a*b<<endl;
  }
  else{
    for(int i=1;i<=n-e;i+=2){
      long int c=1;
      for(int j=n-e-i+1;j<=n-e;j++){
        c*=j;
        c/=j-n+e+i;
      }
      b+=c;
    }
    cout<<a*b<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<ll(n);i++)
int main() {
    ll n, m;
    ll ans = 0;
    cin >> n >> m;
    ll minR, maxL;
    minR = 1e7;
    maxL = -1;
    ll r, l;
    rep(i, m){
        cin >> l >> r;
        minR = min(minR, r);
        maxL = max(maxL, l);
    }
    ans = minR - maxL + 1;
    if (ans < 0) {
        ans = 0;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3632
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		boolean flag = false;
		
		if(a == b && b == c && c == a) flag = true;
		if(a != b && b != c && c != a) flag = true;
		
		if(flag == true){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
}	

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

int main() {
    vector<string> v;
    v.push_back(".,!? ");
    v.push_back("abc");
    v.push_back("def");
    v.push_back("ghi");
    v.push_back("jkl");
    v.push_back("mno");
    v.push_back("pqrs");
    v.push_back("tuv");
    v.push_back("wxyz");

    int N;
    cin >> N;
    while (N--) {
        string s;
        cin >> s;
        int x = 0, cnt = 0;
        for (char c : s) {
            if (c == '0') {
                x--;
                cnt--;
                if (x != -1) {
                    cout << v[x][cnt % v[x].size()];
                }
                x = 0;
            } else {
                if (x == 0) {
                    x = c - '0';
                    cnt = 1;
                } else {
                    cnt++;
                }
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

// #define int ll
#define REP(i,n) for (int i = 0; i < (n); ++i)
#define FORE(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define debug(x) cerr << #x << ": " << x << '\n'
#define hyphen() cerr << "--\n"

#define fst first
#define pb push_back

const int MOD = (int)1e9 + 7;

int bigger(int a, int b) {
    return a >= b ? a : b;
}

int smaller(int a, int b) {
    return a >= b ? b : a;
}


signed main() {
    int N;
    string A, B, C;

    cin >> N >> A >> B >> C;;

    int ans = 0;
    REP(i, N) {
        int sames = (A.at(i) == B.at(i) ? 1 : 0) + (B.at(i) == C.at(i) ? 1 : 0) + (C.at(i) == A.at(i) ? 1 : 0);
        debug(i);
        debug(sames);
        hyphen();
        if (sames == 3) {
            // 3つ同じ場合は変えなくてOK
            ;
        } else if (sames == 2) {
            // ないのでは?
            ;
        } else if (sames == 1) {
            ans += 1;
        } else {
            ans += 2;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			d = scanner.nextInt();
			n = scanner.nextInt();
			if ((d | n) == 0)
				break;
			aer = new AER[n];
			for (int i = 0; i < n; i++) {
				aer[i] = new AER(scanner.nextInt(), scanner.nextInt(),
						scanner.nextInt());
			}
			dp = new int[d + 1][101];
			for (int[] dpp : dp)
				Arrays.fill(dpp, -1);
			int ans = dfs(d, 0);
			System.out.println(ans == INF ? "NA" : ans);
		}
	}

	private int dfs(int hp, int exp) {
		if (hp == 0)
			return 0;
		if (dp[hp][exp] > -1)
			return dp[hp][exp];

		int res = INF;
		for (AER a : aer) {
			if (a.r > exp)
				continue;

			int nhp = Math.max(0, hp - a.a);
			int nexp = Math.min(100, exp + a.e);
			if (hp == nhp && exp == nexp)
				continue;
			res = Math.min(res, dfs(nhp, nexp) + 1);
		}
		return dp[hp][exp] = res;
	}

	int d, n;
	int[][] dp;
	int INF = 1 << 30;
	AER[] aer;

	class AER {
		int a, e, r;

		public AER(int a, int e, int r) {
			super();
			this.a = a;
			this.e = e;
			this.r = r;
		}

		@Override
		public String toString() {
			return "AER [a=" + a + ", e=" + e + ", r=" + r + "]";
		}

	}
}

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

int main(void){
 	int n, m, h[100001], ma[100001];
	cin >> n >> m;
  	for(int i=1; i<=n; i++){
        cin >> h[i];
        ma[i] = 0;
    }
  	for(int i=0; i<m; i++){
    	int a, b;
      	cin >> a >> b;
      	ma[a] = max(ma[a], h[b]);
        ma[b] = max(ma[b], h[a]);
    }
  	int ans = 0;
  	for(int i=1; i<=n; i++){ 
        ans += h[i] > ma[i];
    }
  	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4376
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll mod=1000000007;
int main()
{
    ll i,j,k,l,m,n;
    cin>>m>>n;
    string s[m];
    for(i=0;i<m;i++)
        cin>>s[i];
    ll arr[m+1][n+1];
    memset(arr,0,sizeof arr);
    arr[0][1]=1;
    for(i=1;i<=m;i++)
        for(j=1;j<=n;j++)
            (s[i-1][j-1]=='.')?arr[i][j]=(arr[i-1][j]+arr[i][j-1])%mod:arr[i][j]=0;
    cout<<arr[m][n]<<endl;


}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,K,ans=0;
  cin >> N >> K;
  vector<int>p(N);
  for (int i=0; i<N; i++){
    cin >> p.at(i);
  }
  sort(p.begin(), p.end());
  for (int i=0; i<K; i++){
    ans += p.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>
#include <map>


#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

string ws;
int cnt =0;
	while(cin >> ws){
		if(cin.eof()) break;
		int cnt1=0;
		rep(i,ws.size()){
			if(ws[i] >= '0' && ws[i] <= '9'){
				if(cnt1 > 0) cnt1 *= 10;
				cnt1 += ws[i] - '0';
			}else{
				cnt += cnt1;
				cnt1=0;
			}
		}
		if(cnt1>0) cnt += cnt1;
	}
	cout << cnt << endl;
	return 0;
	
}

Measured memory_bytes: 1184
N = int(input())
A1 = [int(i) for i in input().split()]
A2 = [int(i) for i in input().split()]

ret = 0
for i in range(1, N+1):
	p = sum(A1[:i])
	p += sum(A2[i-1:])
	ret = max(ret, p)

print(ret)


Measured memory_bytes: 3060
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Question1();
        }

        private static void Question1()
        {
            var input = Console.ReadLine();
            char ans = input[0] <= 'Z' ? 'A' : 'a';
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 25772
#ABC085C
N, Y=map(int, input().split())
for Fukuzawa in range(N+1):
    for Higuchi in range(N+1-Fukuzawa):
        if Y==Fukuzawa*10000+Higuchi*5000+(N-Fukuzawa-Higuchi)*1000:
            print(Fukuzawa, Higuchi, N-Fukuzawa-Higuchi)
            exit()
print(-1, -1, -1)

Measured memory_bytes: 3060