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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;

int mod = 1000000007;

#define mul(a, b) ((a % mod) * (b % mod)) % mod

long long int dp[55][55][2600] = {0};

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

    dp[0][0][0] = 1;

    rep(i, n + 1)
    {
        rep(j, i + 1)
        {
            rep(k, score + 1)
            {
                dp[i + 1][j][k + j * 2] += dp[i][j][k] % mod;

                dp[i + 1][j + 1][k + (j + 1) * 2] += dp[i][j][k] % mod;

                dp[i + 1][j][k + j * 2] += mul(dp[i][j][k], 2 * j);

                if (j >= 1)
                {
                    dp[i + 1][j - 1][k + (j - 1) * 2] += mul(mul(dp[i][j][k], j), j);
                }
            }
        }
    }

    OP(dp[n][0][score] % mod)

    return 0;
}

Measured memory_bytes: 57600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 998244353;

ll powmod(ll a, int b) {
  a %= MOD;
  ll res = 1;
  while (b) {
    if (b % 2 == 1) res = res * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}

ll f[200005];
void cominit() {
  f[0] = 1;
  for (int i = 0; i < 200000; i++) f[i + 1] = f[i] * (i + 1) % MOD;
}

ll nCr(int n, int r) {
  if (n < r) return 0;
  if (n < 0 || r < 0) return 0;
  return f[n] * powmod(f[r] * f[n - r], MOD - 2) % MOD;
}

int main() {
  ll n, m, k;
  cin >> n >> m >> k;
  cominit();
  ll ans = 0;
  for (int i = 0; i <= k; i++) {
    ll res = nCr(n - 1, i);
    res *= m * powmod(m - 1, n - i - 1) % MOD;
    res %= MOD;
    ans = (ans + res) % MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 5200
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n; cin >> n;
  cout << n*n*n << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int N=1505;
int n,a[N][N];
int L[N][N],R[N][N],f[N][N];
ll ans;
char s[N];
int main(){
	scanf("%d",&n);
	For(i,1,n){
		scanf("%s",s+1);
		For(j,1,n) a[i][j]=(s[j]=='#'?0:s[j]-'0');
	}
	Rep(i,n,1)
		if (a[n][i]){
			L[i][n]=i;
			R[i][n]=(a[n][i+1]?R[i+1][n]:i);
			f[n][i]=f[n][i+1]+a[n][i];
			ans+=a[n][i]*f[n][i+1];
		}
	Rep(i,n-1,1) Rep(j,n,1) if (a[i][j]){
		if (!a[i+1][j]&&!a[i][j+1]){
			L[j][i]=R[j][i]=j;
			For(k,i+1,n) L[j][k]=n+1,R[j][k]=0;
		}
		else if (!a[i+1][j]){
			memcpy(L[j],L[j+1],4*(n+1));
			memcpy(R[j],R[j+1],4*(n+1));
			L[j][i]=j; R[j][i]=R[j+1][i];
			f[i][j]=f[i][j+1];
		}
		else if (!a[i][j+1]){
			L[j][i]=R[j][i]=j;
			f[i][j]=f[i+1][j];
		}
		else{
			f[i][j]=f[i+1][j]+f[i][j+1];
			L[j][i]=j; R[j][i]=R[j+1][i];
			int las=0;
			For(k,i+1,n){
				if (L[j+1][k]<=R[j][k]&&las<L[j+1][k])
					f[i][j]-=f[k][L[j+1][k]];
				las=R[j][k];
				R[j][k]=max(R[j][k],R[j+1][k]);
				L[j][k]=min(L[j][k],L[j+1][k]);
			}
		}
		ans+=a[i][j]*f[i][j];
		f[i][j]+=a[i][j];
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 35584
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		int d=sc.nextInt();

		if(a+b>c+d) {
			System.out.println("Left");
		}

		else if(a+b<c+d) {
			System.out.println("Right");
		}

		else{
			System.out.println("Balanced");
		}
	}
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define N 2000009
using namespace std;
typedef long long LL;

LL s[6];

int main()
{
    LL a, b, ans = 0x3f3f3f3fll;
    cin >> a >> b;
    for(int i = 1; i < a; i++)
    {
       s[0] =  i*b;
       LL k = a-i;
       s[1] = (k - k/2) * b;
       s[2] = k/2*b;
       sort(s, s+3);
       ans = min(ans, s[2]-s[0]);

       s[0] =  i*b;
       s[1] = k*(b/2);
       s[2] = k*(b - b/2);
       sort(s, s+3);
       ans = min(ans, s[2]-s[0]);
    }
    for(int i = 1; i < b; i++)
    {
        s[0] = i*a;
        LL k = b-i;
        s[1] = k/2*a;
        s[2] = (k - k/2)*a;
        sort(s, s+3);
        ans = min(ans, s[2]-s[0]);

        s[0] = i*a;
        s[1] = k*(a/2);
        s[2] = k*(a - a/2);
        sort(s, s+3);
        ans = min(ans, s[2]-s[0]);
    }
    cout << ans << endl;
    return 0;
}











Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define ld long double
#define mkp make_pair
#define sz(x) (int)x.size()
#define pi pair<long long, long long>
#define watch(x) cout << (#x) << " is " << (x) << endl; cout.flush()
#define endl '\n'
#define _ << ' '
#define FAST_LOG2(x) (sizeof(unsigned long)*8 - 1 - __builtin_clzl((unsigned long)(x)))
#define clog2(x) (((x) - (1 << FAST_LOG2(x))) ? FAST_LOG2(x) + 1 : FAST_LOG2(x))
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> idxset;
//find_by_order(i) : iterator to the value at index i, order_of_key(x) : the index of value x
const ll mod = (ll)1e9+7;
const ll INF = (ll)1e9+1;

int n, a[11111], ans=0;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("B.txt", "r", stdin);
    #endif
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            ans += a[i]*a[j];
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// --------------------------------------------------------
template<class T> bool chmax(T& a, const T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T b) { if (b < a) { a = b; return 1; } return 0; }
#define FOR(i,l,r) for (int i = (l); i < (r); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUM(c) accumulate(ALL(c), 0)
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define SZ(c) ((int)(c).size())
#define debug(x) cerr << #x << " = " << (x) << '\n';
using P = pair<int,int>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
static const double EPS = 1e-10;
static const double PI  = acos(-1.0);
static const ll MOD = 1000000007;
// static const ll MOD = 998244353;
static const int INF = 1 << 30;
// static const ll INF = 1LL << 62;
// --------------------------------------------------------


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

    string S; cin >> S;

    set<string> T = {
        "AKIHABARA",

        "KIHABARA",
        "AKIHBARA",
        "AKIHABRA",
        "AKIHABAR",

        "KIHBARA",
        "KIHABRA",
        "KIHABAR",
        "AKIHBRA",
        "AKIHBAR",
        "AKIHABR",

        "KIHBRA",
        "KIHBAR",
        "KIHABR",
        "AKIHBR",

        "KIHBR",
    };

    cout << (T.count(S) == 1 ? "YES" : "NO") << '\n';

    return 0;
}


Measured memory_bytes: 3680
#include <bits/stdc++.h>
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;
const int INF = 0x3f3f3f3f;
using namespace std;

int a, b, c;
int main() {
    IOS
    cin >> a >> b >> c;
    cout << max(0, c-(a-b)) << endl;

    return 0;


}


Measured memory_bytes: 256
use text_io::*;
use std::process::exit;

fn main() {
    let l:usize = read!();
    let r:usize = read!();
    let d:usize = read!();
    let mut n:usize = 0;
    for i in l..=r {
        if i%d == 0 {
            n += 1;
        }
    }
    println!("{}",n);
}

Measured memory_bytes: 2104
import java.util.Scanner;

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

		while (true) {
			if (N%-2 == 0) {
				s = "0" + s;
			} else {
				s = "1" + s;
				N--;
			}
			if (N/-2==0) break;
			N /= -2;
		}
		System.out.println(s);
	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
int a[10010];
int main(){
	int n;
	long long sum=0;
	int mini=10000000;
	int ma=-10000000;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
		if(mini>a[i])mini=a[i];
		if(ma<a[i])ma=a[i];
	}
	cout<<mini<<" "<<ma<<" "<<sum<<endl;
	return 0;
}


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

class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		int ans = 0;
		for (int i = 0; i < N; i++)
		{
			var lr = Console.ReadLine().Split().Select(int.Parse);
			int l = lr.First(), r = lr.Last();
			ans += (r - l + 1);
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 11348
def resolve():
    from scipy.sparse.csgraph import floyd_warshall
    import numpy as np
    import sys
    input = sys.stdin.readline
    n, m, l = map(int, input().split())
    inf = 10 ** 20
    ar = [[0] * n for _ in range(n)]
    for _ in range(m):
        a, b, c = map(int, input().split())
        ar[a - 1][b - 1] = c
    x = floyd_warshall(ar, directed=False)
    br = [[0] * n for _ in range(n)]
    for i in range(n):
        for j in range(i + 1, n):
            if x[i, j] <= l:
                br[i][j] = 1
    y = floyd_warshall(br, directed=False)
    q = int(input())
    for _ in range(q):
        s, t = map(int, input().split())
        p = y[s - 1, t - 1]
        print(int(p) - 1 if p < inf else -1)


if __name__ == "__main__":
    resolve()


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

using namespace std;

int main()
{
    uint32_t N;
    string tmp;
    uint32_t sum = 1;
    
    cin >> N >> tmp;
    
    for(auto i = 1; i < N; i++){
        if(tmp[i-1] != tmp[i]) sum++;
    }
    cout << sum << endl;
    return 0;
    
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x, y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x, y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
#define T ll tt; cin>>tt; while(tt--)
using namespace std;
ll mode=pow(10,9)+7;
bool cmp(pair<long double ,int > x, pair<long double , int> y){ return x.F<y.F; }
const ll maxn=2*1e4+5;
ll __lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }

int main(){ 
    
//    #ifndef ONLINE_JUDGE
//  	freopen("input.txt", "r", stdin);
//    #endif
    
    ios::sync_with_stdio(0);
    cin.tie(0);
	
	ll h,w,n;
	cin>>h>>w>>n;
	
	ll a1,a2,a3;
	if (n%h==0){
		a1=n/h;
	}
	else{
		a1=n/h;
		a1++;
	}
	if (n%w==0){
		a2=n/w;
	}
	else{
		a2=n/w;
		a2++;
	}
	cout<<min(a1,a2)<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>

using namespace std;

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

    bool judge = true;

    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] != t[i])
        {
            judge = false;
        }
    }

    if (s.length() + 1 != t.length())
    {
        judge = false;
    }

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

    return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a)), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long
#define INF             __LONG_LONG_MAX__

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  ll N, K; cin >> N >> K;

  if (K % 2 == 0) {
    ll a = N / K;
    ll b = (N + K/2) / K;
    outl(a*a*a + b*b*b);
  } else {
    ll a = N / K;
    outl(a*a*a);
  }
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int n; ll m;
vll a;
vll sum;

ll cur, cnt;
bool check(ll X){
    cur = 0LL, cnt = 0LL;
    rrep(k, n){
        ll e = a[k];
        ll lb = X - e;
        int i = lower_bound(_all(a), lb) - begin(a);
        int num = n - i;
        cur += num * e + (sum[n] - sum[i]);
        cnt += num;
    }
    return cnt >= m;
}

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

    cin >> n >> m;
    a = vll(n); for(auto& e : a) cin >> e;
    sort(_all(a));

    sum = vll(n + 1);
    rep(i, n){
        sum[i + 1] = sum[i] + a[i];
    }

    ll lb = 0, ub = (int)(1e6);
    rep(_, 50){
        ll mid = (lb + ub) / 2;

        if(check(mid)){
            lb = mid;
        }
        else {
            ub = mid;
        }
    }
    check(lb);
    ll res = cur - lb * (cnt - m);

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1792
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let n = read_as_vec::<usize>()[0];
    let mut s: Vec<String> = vec![];

    for _ in 0..n{
        s.push(read_as_string());
    }

    let m = read_as_vec::<usize>()[0];
    for _ in 0..m{
        let t = read_as_string();
        for i in 0..s.len(){
            if s[i] == t{
                s.remove(i);
                break;
            }
        }
    }

    let mut ans = 0;
    for i in 0..s.len(){
        ans = cmp::max(
            ans,
            s.iter().filter(|elem| **elem == s[i]).count()
        );
    }
    println!("{}", ans);

}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <list>
#include <iterator>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
typedef  pair<int,int> P;

int n;
int a[1000005];
set<int>S[1000005];
set<int>A;
bool pairwise=true;

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

int gcd_all()
{
int ans=a[0];
for(int i=1;i<n;i++)
ans=gcd(ans,a[i]);
return ans;

}

set<int> prime_factor(int n) 
{
set<int> res;
for (int i = 2; i * i <= n; i++) {
while (n % i == 0) {
res.insert(i);
n /= i;
}
}
if (n != 1) res.insert(n);
return res;
}


int main()
{
//素因数分解して独立なものの個数を求める
//重複があると入れないデータ構造に素因数を突っ込んでいって、個数分増えたか
//調べる
//それぞれについてカウンターをつけておいて、カウンターの個数がnと一致するか

cin>>n;
rep(i,n)cin>>a[i];
rep(i,n)
{
S[i]=prime_factor(a[i]); 
int len=S[i].size();
int lenA=A.size();  
while(S[i].size()!=0)
{

int t=*S[i].begin();
A.insert(t);
S[i].erase(t);
}int len_A=A.size(); 
if(len_A!=len+lenA)pairwise=false;
}
if(pairwise==true)cout <<"pairwise coprime";
else if(gcd_all()!=1)cout<<"not coprime";
else cout <<"setwise coprime";
}


Measured memory_bytes: 57932
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

const ll mod = 1e9 + 7;


map<pair<int,int>, int> mp;


int main()
{
    FASTIO
    int T;
    T = 1;
    for(int cs = 1; cs <= T; cs++)
    {
        string s;
        cin >> s;
        int l = s.length();
        int i = l - 1;
        while(i >= 0)
        {
            if(i< 4)
            {
                cout << "NO\n";
                return 0;
            }
            if(s[i - 2] == 'e')  // dream
            {
                if(s[i - 4] == 'd' && s[i - 3] == 'r' && s[i - 1] == 'a' && s[i] == 'm') i -= 5;
                else
                {
                    cout << "NO\n";
                    return 0;
                }
            }

            else if(s[i - 2] == 'a') 
            {
                if(s[i - 4] == 'e' && s[i - 3] == 'r' && s[i - 1] == 's' && s[i] == 'e') i -= 5;
                else
                {
                    cout << "NO\n";
                    return 0;
                }
            }
            else if(i < 5)
            {
                cout << "NO\n";
                return 0;
            }

            else if(s[i - 2] == 's') 
            {
                if(s[i - 5] == 'e' && s[i - 4] == 'r' && s[i - 3] == 'a' && s[i - 1] == 'e' && s[i] == 'r') i -= 6;
                else
                {
                    cout << "NO\n";
                    return 0;
                }
            }

            else if(i < 6)
            {
                cout << "NO\n";
                return 0;
            }

            else if(s[i - 2] == 'm')  
            {
                if(s[i - 6] == 'd'&& s[i - 5] == 'r' && s[i - 4] == 'e' && s[i - 3] == 'a' && s[i - 1] == 'e' && s[i] == 'r') i -= 7;
                else
                {
                    cout << "NO\n";
                    return 0;
                }
            }
          else {
          cout << "NO\n";
            return 0;
          }


        }
        cout << "YES\n";
    }

    return 0;
}


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

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
	int n; cin>> n;
  	int ac=0, tle=0, wa=0, re=0;
	while(n--){
    	string s;cin>> s;
      	if(s=="AC")ac++;
      	else if(s=="WA")wa++;
      	else if(s=="TLE")tle++;
      	else if(s=="RE")re++;
    }
  	cout<<"AC x "<< ac<< endl<< "WA x "<< wa<< endl<< "TLE x "<< tle<< endl<< "RE x "<< re<< endl;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i = n;i >= 0;--i)
#define FOR(i,m,n) for(int i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

int main(void)
{
    int n;
    cin >> n;
    vector<int> a(n + 1);
    a[0] = 0;
    FOR(i,1,n+1)
    {
        cin >> a[i];
    }

    vector<int> L(n + 2,0);
    vector<int> R(n + 2,0);

    for (int i = 0; i < L.size() - 1;i++){
        L[i + 1] = gcd(L[i], a[i]);
    }

    for (int i = n; i >= 1;i--){
        R[i] = gcd(R[i + 1], a[i]);
    }

    vector<int> M(n);
    for (int i = 1; i <= n;i++){
        M[i - 1] = gcd(L[i], R[i + 1]);
    }

    int ans = *max_element(all(M));
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class CStep {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        vector<int> A(N);
        REP(i, N) cin >> A[i];
        int max = A[0];

        int res = 0;
        for (int i = 1; i < N; i++) {
            if (A[i] > max) {
                max = A[i];
            } else {
                res += max - A[i];
            }
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    CStep solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 4780
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<stack>
#include<queue>
using namespace std;
 
typedef long long i64;
#define put(n) cout<<(n)<<"\n"
#define FOR(i,num,N) for(int(i)=(num);(i)<(N);(i)++)
#define RFOR(i,num,N) for(int (i)=(num);(i)>=(N);(i)--)
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()
 
int main(){
    string s;
    cin>>s;
    int left = 0;
    int right = 0;
    int ans = 0;
    bool find = false;
 
    FOR(i,0,s.size()){
        if(s[i] == 'A') break;
        left++;
    }
    RFOR(i,s.size()-1,0){
        if(s[i] == 'Z') break;
        right++;
    }
 
    ans = s.size() - left - right;
 
    put(ans);
}

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

void trace(int A[], int N) {
    for (int i = 0; i < N; ++i) {
        if (i > 0) cout << " ";
        cout << A[i];
    }
    cout << endl;

}

void insertionSort(int A[], int N) {
    int v, j;
    for (int i = 1; i < N; ++i) {
        v = A[i];
        j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            --j;
        }
        A[j+1] = v;
        trace(A, N);
    }
}

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

    trace(A, N);
    insertionSort(A, N);

    return 0;
}


Measured memory_bytes: 3096
/*C - Maximum Volume*/
#include <bits/stdc++.h>

using namespace std;

int main(){

	double L;
	double raiz;
	double ans;

	cin >> L;

	raiz = L / 3.0;

	ans = raiz * raiz * raiz;

	cout << fixed << setprecision(12) << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

  double r, l, s;

  scanf("%lf", &r);

  l = 2 * 3.141592653589793 * r;
  s = 3.141592653589793 * r * r;

  printf("%f %f\n", s, l);

  return 0;
}



Measured memory_bytes: 2036
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		if(a >= 13) {
			System.out.println(b);
		} else if(a <= 5){
			System.out.println(0);
		} else {
			System.out.println(b/ 2);
		}
	}
}

Measured memory_bytes: 35768
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  cout << 800*n - int (n/15) * 200 << endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

ll n, a, b, h[100000];

bool solve(ll v) {
	ll res = 0;
	REP(i, n) res += (max((ll)0, h[i] - v * b) + (a - b) - 1) / (a - b);
	return res <= v;
}

int main(int argc, char **argv) {
	cin >> n >> a >> b;
	REP(i, n) cin >> h[i];

	ll l = 0, r = 1000000000;
	while (l + 1 < r) {
		ll m = (l + r) / 2;
		if (solve(m)) r = m;
		else l = m;
	}
	cout << r << endl;

	return 0;
}


Measured memory_bytes: 1152
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()


using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;



int main(){
    int n, k;
    cin >> n >> k;
    vector<ll> x(n), y(n);
    vector<P> p;
    rep(i, n){
        cin >> x[i] >> y[i];
        p.emplace_back(x[i], y[i]);
    }
    sort(ALL(x));
    sort(ALL(y));
    ll res = INF * INF * 100;
    for(int lx = 0; lx < n; lx++){
        for(int rx = lx + 1; rx < n; rx++){
            for(int ly = 0; ly < n; ly++){
                for(int ry = ly + 1; ry < n; ry++){
                    int cnt = 0;
                    for(int now = 0; now < n; now++){
                        if(x[lx] <= p[now].first && p[now].first <= x[rx] && y[ly] <= p[now].second && p[now].second <= y[ry])cnt++;
                    }
                    if(cnt >= k){
                        res = min(res, (ll)((x[rx] - x[lx]) * (y[ry] - y[ly])));
                    }
                }
            }
        }
    }
    cout << res << endl;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/10/04  Problem: Nagoya_univ_contest_17_d  / Link: http://tenka1-2017-beginner.contest.atcoder.jp/tasks/tenka1_2017_b  ----- */
/* ------問題------

何人かの人がゲームをしました。全ての人の点数は異なる非負整数でした。
高橋君は、N 個の情報を持っています。
i 個目の情報は、得点の大きいほうから Ai 番目の人の得点が Bi 点であったことを表します。
ゲームの参加人数としてありうる最大値を求めてください。

-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	cin >> N;
	int max = -1;
	FOR(i, 0, N) {
		int a, b;
		cin >> a >> b;
		if (a > max) {
			ans =b+a;
			max = a;
		}
	}
	
	cout << ans << "\n";

	return 0;
}

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

const int maxN = 200010;
const int INF = 0x3f3f3f3f;

int A[maxN];
char str[maxN];
int dp[maxN][27];
int mp[1 << 26];

int main (){
	int n, i, j, s;
	scanf("%s", str);
	memset(dp, INF, sizeof dp);
	memset(mp, INF, sizeof mp);
	for(i = 0; str[i]; ++i) A[i] = str[i] - 'a'; n = i;
	s = (1 << A[0]);
	mp[0] = 0;
	mp[s] = dp[0][A[0]] = 1;
	for(i = 1; i < n; ++i){
		int bs = s;
		//printf("#%d ", i);
		s ^= (1 << A[i]);
		//printf("bs = %d s = %d\n", bs, s);
		for(j = 0; j < 26; ++j){
			if(j == A[i]) dp[i][j] = dp[i - 1][26];
			dp[i][j] = mp[bs ^ (1 << j) ^ (1 << A[i])] + 1;
		}
		dp[i][26] = dp[i - 1][A[i]];
		for(j = 0; j <= 26; ++j)
			mp[s] = min(mp[s], dp[i][j]);
	}
	int ans = INF;
	for(i = 0; i <= 26; ++i) ans = min(ans, dp[n - 1][i]);
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 288004
import numpy as np

num= list(map(int,input().split()))

num = np.array(num)

ans = 0
for i in range(51):
    num = np.sort(num)
    if num[1] == num[2]:
        break

    else:
        num[0]+=1
        num[1]+=1
        ans+=1

ans+=(num[1] - num[0])//2 


if (num[1] - num[0])%2 == 0:
    print(ans)
else:
    print(ans+2)



Measured memory_bytes: 12508
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m,ans;
  cin>>n>>m;
  ans=0;
  if(n>=2){
    ans=ans+n*(n-1)/2;
    
  }
  if(m>=2){
    ans=ans+m*(m-1)/2;
  
    
  }
  cout<<ans;
}

Measured memory_bytes: 256
#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; 
#define ordered_set tree < pairs ,  null_type , greater<pairs>,  rb_tree_tag ,  tree_order_statistics_node_update > 
#define ll long long
#define lld long double
#define vc vector<ll>
const ll MOD=(1e9 +7);
typedef pair<ll,ll>pairs;
ll power(ll a, ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;b--;}a=(a*a)%MOD;b>>=1;}
    return res;}

int main() {
	// your code goes here
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	ll t,n,i,j,k,l,c,f;
	cin>>n;
	vc a(n+1),dp(n+1);
	for(i=1;i<=n;i++)
	    cin>>a[i];
	dp[2]=llabs(a[2]-a[1]);
	for(i=3;i<=n;i++)
	    dp[i]=min(llabs(a[i]-a[i-1])+dp[i-1],llabs(a[i]-a[i-2])+dp[i-2]);
	//for(i=1;i<=n;i++)
    cout<<dp[n];
	return 0;
}


Measured memory_bytes: 4752
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
using ll=long long;
#ifdef ONLINE_JUDGE
#define D(...)
#else
#define D(...)cerr<<__LINE__<<":"<<"["<<#__VA_ARGS__<<"]->",P(__VA_ARGS__)
#endif
void P(){cerr<<endl;} 
template<typename H,typename...T>void P(H h,T...t){cerr<<h<<" ";P(t...);}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int n;cin>>n;
    vector<string>vs;
    for(int i=0;i<n;++i){
        string s;cin>>s;
        if(find(all(vs),s)==vs.end()){
            if(int(vs.size())>0){
                if(vs.back().back()!=s.front())
                    return cout<<"No",0;
            }
            vs.emplace_back(s);
        }
        else
        return cout<<"No",0;
    }
    cout<<"Yes";
    
}

Measured memory_bytes: 3612
from collections import deque


def solve(width, height):
    ver_walls = []
    hor_walls = []

    x_dir = [0, 1, 0, -1]
    y_dir = [-1, 0, 1, 0]

    for i in xrange(2 * height - 1):
        if i % 2 == 0:
            ver_walls.append(map(int, raw_input().split()))
        else:
            hor_walls.append(map(int, raw_input().split()))

    maze = [[True for j in xrange(2 * width + 1)] for i in xrange(2 * height + 1)]

    for i in xrange(len(ver_walls)):
        for j in xrange(len(ver_walls[i])):
            if not ver_walls[i][j]:#no wall
                maze[i * 2 + 1][(j  + 1) * 2] = False

    for i in xrange(len(hor_walls)):
        for j in xrange(len(hor_walls[i])):
            if not hor_walls[i][j]:#no wall
                maze[(i + 1) * 2][j * 2 + 1] = False

    queue = deque([])

    queue.append((1, 1, 1))

    goal = (2 * width - 1, 2 * height - 1)
    path_goal = 0

    while len(queue) != 0:
        now_x, now_y, path_now = queue.popleft()

        if (now_x, now_y) == goal:
            path_goal = path_now
            break

        for i in xrange(4):
            next_y = now_y + y_dir[i]
            next_x = now_x + x_dir[i]
            if not maze[next_y][next_x]:#no wall
                maze[next_y][next_x] = True
                next_y += y_dir[i]
                next_x += x_dir[i]
                maze[next_y][next_x] = True
                queue.append((next_x, next_y, path_now + 1))

    print path_goal


def main():
    while True:
        temp = map(int, raw_input().split())
        width = temp[0]
        height = temp[1]

        if width == 0 and height == 0:
            break

        solve(width, height)

if __name__ == '__main__':
    main()

Measured memory_bytes: 6852
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;
// gcd
LL gcd(LL a, LL b) {
	while(b){
		auto t=a%b;
		a=b;
		b=t;
	}
	return a;
}


int main() {
	LL A,B;
	cin >> A >> B;
	cout << A*B/gcd(A,B) << endl;

	return 0;
}



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

int main()
{
    int max_rain =0,x=0;
    string weather;
    cin >> weather;
    for(int i=0;i<weather.size();i++){
        if(weather[i]=='R'){
            x++;
        }
        else{
            max_rain=(max_rain>x)?max_rain:x;
            x=0;
        }
    }
    max_rain=(max_rain>x)?max_rain:x;
    cout << max_rain;
}

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cout << (*begin) << " ";
    *begin++;
  }
  cout << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cout << " " << Array[i][j];
    }
    cout << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

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

const int INF = 1e18;

int N, A, B, C;
vec<int> l;

int calc(vec<int> a, vec<int> b, vec<int> c) {
  int aRes = abs(accumulate(all(a), 0LL) - A) + ((a.size()-1) * 10);
  int bRes = abs(accumulate(all(b), 0LL) - B) + ((b.size()-1) * 10);
  int cRes = abs(accumulate(all(c), 0LL) - C) + ((c.size()-1) * 10);

  return aRes + bRes + cRes;
}

int rec(int idx, vec<int> a, vec<int> b, vec<int> c) {
  if (idx >=  N) {
    if (a.size() == 0 or b.size() == 0 or c.size() == 0) return INF;
    return calc(a, b, c);
  }

  int ret = INF;

  a.push_back(l[idx]);
  chmin(ret, rec(idx+1, a, b, c));
  a.pop_back();

  b.push_back(l[idx]);
  chmin(ret, rec(idx+1, a, b, c));
  b.pop_back();

  c.push_back(l[idx]);
  chmin(ret, rec(idx+1, a, b, c));
  c.pop_back();

  chmin(ret, rec(idx+1, a, b, c));

  return ret;
}

signed main() {
  cin >> N >> A >> B >> C;
  l.resize(N);
  rep (i, N) {
    cin >> l[i];
  }

  vec<int> a;
  vec<int> b;
  vec<int> c;
  cout << rec(0, a, b, c) << endl;

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>

int main(){
	int N, X;
	scanf("%d %d", &N, &X);
	int min_cost = 2000;
	for (int i = 0; i < N; ++i){
		int tmp;
		scanf("%d", &tmp);
		X -= tmp;
		if(tmp < min_cost) min_cost = tmp;
	}
	printf("%d\n", N + X/min_cost);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC(T, v) static_cast<T>(v)
#define SI(v) SC(int, v.size())
#define SL(v) SC( LL, v.size())
#define RF(e, v) for(auto & e: v)
#define ei else if
#define UR assert(false)

// ---- ----

int n, a, b, ab, ans;
string s[10000];

int main() {
	cin >> n;
	inc(i, n) { cin >> s[i]; }
	
	inc(i, n) {
		inc(j, SI(s[i]) - 1) { if(s[i].substr(j, 2) == "AB") { ans++; } }
		bool A = (s[i].back()  == 'A');
		bool B = (s[i].front() == 'B');
		if(A) { a++; }
		if(B) { b++; }
		if(A && B) { ab++; }
	}
	
	ans += min(a, b);
	if(ab > 0 && max(a, b) == ab) { ans--; }
	
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;

int main() {
	int N;
	cin >> N;
	int T[101] = {};
	for (int i = 0; i < N; i++) {
		cin >> T[i];
	}
	int M;
	cin >> M;
	int P = {};
	int X = {};
	int tt[1001] = {};
	for (int i = 0; i < M; i++) {
		int tmp = 0;
		cin >> P >> X;
		for (int j = 0; j < N; j++) {
			if (P - 1 == j) tmp += X;
			else tmp += T[j];
			
		}
		tt[i] = tmp;
	}

	for (int i = 0; i < M; i++) {
		cout << tt[i] << endl;
	}
	return 0;
}

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

#define abs(N) ((N>0)?N:-1*N)
#define min(A,B) ((A>B)?B:A)
#define max(A,B) ((A<B)?B:A)
#define print(S) (cout << S)
#define println(S) (cout << S << endl)

int main(){
	int n;
	bool tbl[4][13];
	char ss[4] = {'S','H','C','D'};

	for (int i = 0; i < 4; ++i) {
		for (int j = 0; j < 13; ++j) {
			tbl[i][j]=false;
		}
	}

	cin >> n;
	char s;
	int r;
	for (int i = 0; i < n; ++i) {
		cin >> s >> r;
		switch(s){
		case 'S':
			tbl[0][r-1] = true;break;
		case 'H':
			tbl[1][r-1] = true;break;
		case 'C':
			tbl[2][r-1] = true;break;
		case 'D':
			tbl[3][r-1] = true;break;
		}
	}

	for (int i = 0; i < 4; ++i) {
		for (int j = 0; j < 13; ++j) {
			if(!tbl[i][j]){
				printf("%c %d\n",ss[i],j+1);
			}
		}
	}


	return 0;
}



Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,W;
    cin>>n>>W;
    vector<int> v(n),w(n);
    for(int i=0;i<n;i++)cin>>v[i]>>w[i];
    int dp[10010];
    //dp[i]:ちょうど重さiで達成できる最高の価値
    fill(dp,dp+10010,-1);
    dp[0]=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<=W;j++){
            if(j-w[i]<0)continue;
            dp[j]=max(dp[j-w[i]]+v[i],dp[j]);
        }
    }
    int res=0;
    for(int i=0;i<=W;i++)res=max(res,dp[i]);
    cout<<res<<endl;
}


Measured memory_bytes: 3296
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#define ll long long 
using namespace std;

int main() {
	string w, ans = "Yes";
	int a[(int)'z' +1] = {};
	cin >> w;
	for (int i = 0; i < w.length(); i++) {
		a[(int)w[i]]++;
	}
	for (int i = (int)'a'; i <= (int)'z'; i++) {
		if (a[i] % 2 != 0) {
			ans = "No";
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long long int n,m,a[1005];
    long long int i,number=0;
    double average=0;
    scanf("%lld %lld",&n,&m);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
        average+=a[i];
    }
    average=average*1.0/(4*m);
    for(i=0;i<n;i++)
    {
        if(a[i]>=average)
            number++;
        if(number>=m)
            break;
    }
    if(number>=m)
        printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  string str;
  
  cin >> str;
  
  if (str.at(2) == str.at(3) && str.at(4) == str.at(5)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include<iomanip>

using namespace std;
 
int main() {
    
    long double L;
    
    // input
    cin >> L;
    
    long double bunbo = L*L*L;
    long double ans = bunbo / (long double)27;
 
    //output
    cout<<setprecision(20)<<ans<<endl;
    
    return 0;
}

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

namespace A_ABC156
{
    class MainClass
    {

        static int[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);

            if (s[0] < 10)
            {
                int diff = 100 * (10-s[0]);
                WriteLine(s[1]+diff);
            }else{
                WriteLine(s[1]);
            }
        }


    }
}


Measured memory_bytes: 13268