akhauriyash/Code-Regression huggingface dataset:
import Data.Attoparsec.ByteString.Char8
import qualified Data.ByteString.Char8 as BS
import Data.Char (isLower)

main :: IO ()
main = do
  s <- BS.getLine
  putStrLn $ solve s

solve :: BS.ByteString -> String
solve s = case parseOnly acParser s of
  Left _ -> "WA"
  Right () -> "AC"

acParser :: Parser ()
acParser = ()
  <$ char 'A'
  <* many1 lower
  <* char 'C'
  <* many1 lower
  <* endOfInput
  where lower = satisfy isLower


Measured memory_bytes: 508
/* 
    @author : srinathbalaji_99
*/


#include<bits/stdc++.h>

#define PB push_back
#define MP make_pair
#define endl '\n'
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define rep(i, a, b, inc) for(long long i = a; i < b; i += inc)
#define REP(i, n) rep(i, 0, n, 1)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define PLL pair<long long, long long>
#define VL vector<long long>
#define VS vector<string>
#define VLL vector<PLL>
#define VVL vector<VL>
#define MPLL map<long long, long long>
#define UMPLL unordered_map<long long, long long>
#define SETL set<long long>
#define MSETL multiset<long long>
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) (a * b)/GCD(a, b)
#define ff first
#define ss second
#define pall(a) REP(i, sizeof(a)/sizeof(a[0]))cout << a[i] << " ";cout << endl;
#define pvall(v) REP(i, v.size())cout << v[i] << " ";cout << endl;
#define gall(a, n) REP(i, n)cin >> a[i];
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef unsigned long long ULL;
typedef long long LL;
typedef long double LD;


using namespace std;

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int main()
{
    fast();


    LL t,n,i,j,k,x,y,c,m;
    cin >> n >> k;
    cout << ceil((LD)(n) / (LD)((2 * k) + 1));
    
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cctype>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<cmath>
#include<vector>

using namespace std;
using ll = long long;
const ll N = 1e6;
const double PI = acos(-1.0);
#define Test ll tesnum;tesnum = read();while(tesnum--)
ll read();

int main()
{
    int n;
    bool f = true;
    cin>>n;
    while(n--){
        int x;
        cin>>x;
        if(x%2==0){
            if((x%3!=0)&&(x%5!=0)){
                f = false;
            }
        }
    }
    if(f){
        cout<<"APPROVED"<<endl;
    }else
        cout<<"DENIED"<<endl;
    return "BT7274", NULL;
}

inline ll read() {
    ll hcy = 0, dia = 1;char boluo = getchar();
    while (!isdigit(boluo)) {if (boluo == '-')dia = -1;boluo = getchar();}
    while (isdigit(boluo)) {hcy = hcy * 10 + boluo - '0';boluo = getchar();}
    return hcy * dia;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 10001
#define INF (1e9)
#define s second
#define f first
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> PP;
vector<PP> G[N];

int dijkstra(){
  P D[N];
  for(int i=0;i<N;i++) D[i]=P(INF,INF);
  priority_queue<PP,vector<PP>,greater<PP> >Q;
  Q.push(PP(P(0,0),0));
  D[0]=P(0,0);
  int res=0;
  while(!Q.empty()){
    PP t=Q.top();Q.pop();
    int pos=t.s,d=t.f.f,c=t.f.s;
    if(D[pos]<t.f) continue;
    res+=c;
    for(int i=0;i<G[pos].size();i++){
      int nx=G[pos][i].f.f;
      int nd=G[pos][i].f.s+d;
      int nc=G[pos][i].s;
      if(D[nx]>P(nd,nc)) Q.push(PP(P(nd,nc),nx)),D[nx]=P(nd,nc);
    }
  }
  return res;
}

int main(){
  while(1){
  int n,m;
  cin>>n>>m;
  if(!n&&!m)break;
  for(int i=0;i<n;i++) G[i].clear();
  for(int i=0,a,b,d,c;i<m;i++){
    cin>>a>>b>>d>>c;
    G[a-1].push_back(PP(P(b-1,d),c));
    G[b-1].push_back(PP(P(a-1,d),c));
  }
  cout << dijkstra()<<endl;  
  }
  return 0;
}

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

#ifdef TESTING
  #include "dump.hpp"
#else
  #define DUMP(...)
  #define DEBUG(...)
#endif

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define FOR(it,c) for(auto&& it=begin(c);it!=end(c);it++)
#define ROF(it,c) for(auto&& it=rbegin(c);it!=rend(c);it++)
#define EB emplace_back
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define INT(n) int n;assert(0<scanf("%d",&n))

int main(){
  INT(n); INT(m);
  vector<pair<int, int>> vp;
  REP(m){
    INT(a); INT(b);
    vp.EB(-a, b);
  }
  sort(vp.begin(), vp.end());
  set<int> ans;
  for(auto p: vp){
    int a, b;
    a = -p.first, b = p.second;
    auto it = ans.lower_bound(a);
    if (it == ans.end() || b <= *it){
      ans.insert(a);
    }
  }
  printf("%d\n", SZ(ans));
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    int n, m;

	cin >> n >> m;

    pair<ll, ll> students[n];
	pair<ll, ll> points[m];
	pair<ll, ll> s, p;
	ll dist, d;
	int index;

	int i, j;

	rep(i, n) cin >> students[i].X >> students[i].Y;
	rep(i, m) cin >> points[i].X >> points[i].Y;

	rep(i, n) {
		s = students[i];
		dist = LLONG_MAX;
		index = -1;

		rep(j, m) {
			p = points[j];
			d = Abs(s.X - p.X) + Abs(s.Y - p.Y);

			if (d < dist) {
				index = j + 1;
				dist = d;
			}
		}

		Out(index);
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef long double ld;
typedef pair<ld, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

#define MAX_V 1010
#define INF 5e18

struct edge { int to; ld cost; };
int V;

vector<edge> tree[MAX_V];
ld d[MAX_V];
int n;

// s: 開始地点の頂点
void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + n + 2, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) { continue; }
        for (int i = 0; i < tree[v].size(); i++) {
            edge e = tree[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

ll x[1010], y[1010], r[1010];

ld dist(ll x1, ll y1, ll x2, ll y2){
    ll dx = (x1 - x2);
    ll dy = (y1 - y2);
    return pow(dx*dx + dy*dy, 0.5);
}

int main(){
    int sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;
    cin >> n;
    x[0] = sx, y[0] = sy, r[0] = 0;
    x[n+1] = gx, y[n+1] = gy, r[n+1] = 0;
    rep(i, n) cin >> x[i+1] >> y[i+1] >> r[i+1];

    rep(i, n+2) rep(j, n+2){
        if (i == j) continue;
        ld dis = dist(x[i], y[i], x[j], y[j]);
        tree[i].push_back({j, max(dis - (r[i]+r[j]), ld(0))});
        tree[j].push_back({i, max(dis - (r[i]+r[j]), ld(0))});
    }

    dijkstra(0);

    // rep(i, n) cout << fixed << setprecision(10) << d[i+1] << endl;

    cout << fixed << setprecision(10) << d[n+1] << endl;

    return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]A - Favorite Sound
            var line = ReadLine();
            int a = line[0];
            int b = line[1];
            int c = line[2];

            if (b / a > c)
            {
                Console.WriteLine(c);
            }
            else
            {
                Console.WriteLine(b / a);
            }
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine().TrimEnd();
            var array = line.Split(' ');
            var numbers = new List<int>();

            foreach (var s in array)
            {
                int num = int.Parse(s);
                numbers.Add(num);
            }

            return numbers;
        }
    }
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

ll f( ll n, ll k ){
    while( n%k == 0 ) n/=k;
    return n%k;
}

int main() {

    ll N;
    Scll(N);
    if( N == 2 ){
        printf ("%d\n", 1 );
        return 0;
    }

    int ans = 2;
    for( ll k = 2; k*k <= N; k++ ){
        // printf ("%lld -> %lld\n", k , f(N,k) );
        if( f(N,k) == 1 ) ans++;
        if( (N-1)%k == 0 && (N-1)/k != k ) {
            // printf ("%lld -> %lld\n", (N-1)/k , f(N,(N-1)/k) );
            if( f(N,(N-1)/k) == 1 ) ans++;
        }
    }

    printf ("%d\n", ans );

    // ll tans = 0;
    // Repe(i,N+2,2){
    //     if( f(N,i) == 1 ) tans++;
    // }
    //printf ("%d\n", tans );

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T> >;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repb(i, n) for(ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define reprb(i, a, b) for(ll i = (b)-1; i >= (a); i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
const ld EPS = 1e-12L;
const ld PI = 3.1415926535897932385L;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(ull x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class S, class T>inline bool chmax(S &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class S, class T>inline bool chmin(S &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

// < val の要素数
int CountLower(const vll &vec, ll val){
    return distance(vec.begin(), lower_bound(ALL(vec), val));
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    cin >> n;
    vll l(n);
    rep(i, n){
        cin >> l[i];
    }
    sort(ALL(l));
    ll ans = 0;
    rep(i, n)repr(j, i+1, n){
        ll val = l[i]+l[j];
        ll k = CountLower(l, val);
        ans += max(k-j-1, 0ll);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;
int h[200],n,a[200];
void doo()
{
    for(int i=0; i<n; i++)
        if(h[i]>0)
            h[i]--;
}
int main()
{
    int ans=0,ma=1999;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d",&h[i]);
        ma=min(ma,h[i]);
    }
    for(int i=0;i<n;i++) h[i]-=ma;
    ans=ma;
    while(1){
        int po=0;
        for(int i=0;i<n;i++){
            if(h[i]>0) a[po++]=i;
        }
        if(po==0) break;
        int k=0;
        for(int i=1;i<po;i++){
            if((a[i]-a[i-1])>1){
                k++;
            }
        }
        doo();
        ans+=(k+1);
    }
    printf("%d\n",ans);

}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int a,b[100],i,j,n=0,m;
  scanf("%d",&a);
  for(i=0;i<a;i++){
    scanf("%d",&b[i]);
  }
  for(i=0;i<a-1;i++){
    for(j=a-1;j>i;j--){
      if(b[j]<b[j-1]){
	m=b[j];
	b[j]=b[j-1];
	b[j-1]=m;
	n++;
      }
    }
  }
  for(i=0;i<a-1;i++){
    printf("%d ",b[i]);
  }
  printf("%d\n",b[i]);
  printf("%d\n",n);
  return 0;
}



Measured memory_bytes: 2040
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;

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


int main(){
    int n; cin >> n;
    vector<VI> edge(n);
    VI d(n, -1);
    REP(i, n){
        int u; cin >> u; --u;
        int k; cin >> k;
        REP(j, k){
            int v; cin >> v; --v;
            edge[u].PB(v);
        }
    }
    
    queue<int> que;
    d[0] = 0;
    que.push(0);
    while(!que.empty()){
        int u = que.front(); que.pop();
        for(int v: edge[u]){
            if(d[v] == -1){
                d[v] = d[u] + 1;
                que.push(v);
            }
        }
    }

    REP(i, n){
        cout << i+1 << " " << d[i] << "\n";
    }
    return 0;
}



Measured memory_bytes: 3144
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
	int N; cin>>N;
	vector<int>point(N);
	int sum=0;
	for(int i=0;i<N;i++){
		cin>>point[i];
		sum+=point[i];
	}
	sort(point.begin(),point.end());
	if(sum%10==0){
	for(int i=0;i<N;i++){
		if(point[i]%10==0)continue;
		else {
			sum-=point[i];
			break;
		}
	}
	}
	
	cout<<(sum%10==0 ? 0 : sum)<<endl;
}

Measured memory_bytes: 256
#%%
import sys
INPUT = sys.stdin.readline

def SINGLE_INT(): return int(INPUT())
def MULTIPLE_INT_LIST(): return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP(): return map(int, INPUT().split())
def SINGLE_STRING(): return INPUT()
def MULTIPLE_STRING(): return INPUT().split()

#%%

N, A, B, C = MULTIPLE_INT_MAP()
materials = [int(input()) for _ in range(N)]
INF = 10 ** 9

#%%

def dfs(cursor, a, b, c):  # cursor:カーソル a,b,c:現在の竹の長さ
    if cursor == N:  # cursorが最後まで行ったら終了する。
        return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) != 0 else INF
    # なぜ30を減じているのかというと、
    # dfs(0,0,0,0)で始まる以上、最初に選ばれるa,b,cを決定する際にもコストが10増加してしまうからである。

    # a,b,cのいずれかに1本も竹を利用していない場合は不適であるため、三項演算子を利用してその場合のコストをINFとする。

    # 再帰(4**N)
    # カーソルの当たっている竹に対して、(A or B or Cに合成する) or (合成しない)の場合に分ける
    no_compound = dfs(cursor+1, a, b, c)
    compound_to_a = dfs(cursor+1, a + materials[cursor], b, c) + 10
    compound_to_b = dfs(cursor+1, a, b + materials[cursor], c) + 10
    compound_to_c = dfs(cursor+1, a, b, c + materials[cursor]) + 10

    return min(no_compound, compound_to_a, compound_to_b, compound_to_c)

print(dfs(0, 0, 0, 0))

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

int main() {
  int N;
  cin >> N;
  // vector<int> p(N, 0);
  int sum = 0;
  int max = 0;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    if (max < tmp)
      max = tmp;
    sum += tmp;
  }

  sum -= max;
  sum += max / 2;
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	long long A, B, K;
	cin >> A >> B >> K;

	if (K <= A) {
		cout << A - K << " " << B << endl;
	}
	else if(K <= A + B){
		cout << 0 << " " << B - (K - A) << endl;
	}
	else {
		cout << 0 << " " << 0 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

ll gcd(ll a, ll b){ return b==0?a:gcd(b,a%b);}

ll add(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a+b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll mul(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a*b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

int a, b;

int main(){
	ri(a);
	char op = getchar();
	op = getchar();
	getchar();
	ri(b);
	if(op == '+') a += b;
	else a -= b;
	cout << a << endl;
	return 0;
}


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

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

using namespace std;


int main()
{
	int n;
	while(cin >>n){
		if(n ==0) break;
		vector<int> p(n);
		rep(i,n){ cin >> p[i];}
		int ans =0;
		vector<int> q(105), np(n, -1);
		while(np != p){
			ans++;
			fill(q.begin(), q.end(),0);
			rep(i,n) q[p[i]]++;
			rep(i,n) np[i] = q[p[i]];
			//for(auto x :np) printf("%d, ",x); puts("");
			swap(p, np);
		}
		cout << ans -1 <<"\n";
		rep(i,n)  printf("%s%d",(i? " ":""),p[i]);
		printf("\n");
		
		
	}
	return 0;

}

Measured memory_bytes: 3144
if __name__ == '__main__':
    n = int(input())
    now =""
    list=[]
    flag =True

    for i in range(n):
        s =input()
        if now =="":
            now=s
            list.append(s)
        elif now[len(now)-1] != s[0] or s in list:
            flag=False
            break
        else:
            now=s
            list.append(s)
    if flag:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    ll ans = 0;
    int maxn = 0;
    for (int i = 0; i < n; i++) {
        maxn = max(maxn, a.at(i));
        ans += maxn - a.at(i);
    }
    cout << ans << endl;
}


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

using namespace std;

using ll = long long;

int main(){
  ll n, k;
  cin >> n >> k;
  cin.ignore();
  char s[n + 1];
  cin >> s;
  cin.ignore();
  s[n] = '\0';

  vector <ll> a;
  ll tmp = 1;

  // 今の幸福度は？

  ll kohuku = 0;
  ll kyokai = 0;
  for(int i = 1; i < n; i++){
    if(s[i] == s[i - 1]){
      ++kohuku;
    } else {
      ++kyokai;
    }
  }

  // 1回やるごとに境界は2つ減る
  if(k * 2 < kyokai){
    kohuku += k * 2;
    cout << kohuku << endl;
    return 0;
  }

  if(k * 2 >= kyokai){
    kohuku += kyokai;
    cout << kohuku << endl;
    return 0;
  }
  
  

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define FILE "chad"
#define ll long long
#define up(i,j,k) for(int i=(j);i<=(k);i++)
#define pii pair<int,int>
template<class T> bool cmin(T& a,T b){return a>b?a=b,true:false;}
template<class T> bool cmax(T& a,T b){return a<b?a=b,true:false;}
template<class T> T max(T& a,T& b){return a>b?a:b;}
template<class T> T min(T& a,T& b){return a<b?a:b;}
const int maxn=255000,inf=1e9,mod=9901;
int read(){
	int ch=getchar(),x=0,f=1;
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return f*x;
}
char s[maxn];
int n,ans=0;
int main(){
	//freopen(FILE".in","r",stdin);
	//freopen(FILE".out","w",stdout);
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;i++)
		if(s[i]!=s[i-1])ans++;
	printf("%d\n",ans-1);
	return 0;
}



Measured memory_bytes: 384
n = int(input())
a = list(map(int, input().split()))

num = [0 for i in range(n + 1)]
tugi = 1
count = 0
flag = False

for i in range(n):
    if a[i] == 1:flag = True
    if a[i] != tugi:
        count += 1
    else:
        tugi += 1

if flag:
    print(count)
else:
    print(-1)

Measured memory_bytes: 24744
#include<iostream>
using namespace std;
int main(void)
{
	int a,n,i,max=0,min=1000000000;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>a;
		if(max<=a) max=a;
		if(min>=a) min=a;
	}
	cout<<max-min<<endl;
	return 0;
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/


int main()
{
    int max_n = 100000;
    bool isprime[max_n+1];
    rep(i,max_n+1) isprime[i] = true;

    isprime[0] = isprime[1] = false;
    for(int i=4; i<=max_n; i+=2){
        isprime[i] = false;
    }

    // エラトステネスの篩
    for(int i=3; i*i<=max_n; i+=2){
        if(isprime[i]){
            int j=i+i;
            while(j<=max_n){
                isprime[j] = false;
                j += i;
            }
        }
    }

    int prime_num[max_n+1];
    prime_num[0] = prime_num[1] = prime_num[2] = 0;
    for(int i=3; i<=max_n; i++){
        if(i%2 == 1){
            if(isprime[i] && isprime[(i+1)/2]) prime_num[i] = prime_num[i-1]+1;
            else prime_num[i] = prime_num[i-1];
        }
        else prime_num[i] = prime_num[i-1];
    }

    int q; cin >> q;
    rep(_,q){
        int l, r; cin >> l >> r;
        //cout << prime_num[l] << endl;
        //cout << prime_num[r] << endl;
        cout << (prime_num[r] - prime_num[l-1]) << endl;
    }
}

Measured memory_bytes: 4084
# coding : utf-8

import numpy as np

A = [int(i) for i in input().split()]

cost = 0

if A[0] + A[1] > A[2]*2:
	minl = min(A[3],A[4]) 
	cost += minl*2*A[2]
	A[3] -= minl
	A[4] -= minl
	if A[3] > 0:
		if A[0] > A[2]*2:
			cost += A[3]*2*A[2]
		else:
			cost += A[0]*A[3]
	else:
		if A[1] > A[2]*2:
			cost += A[4]*2*A[2]
		else:
			cost += A[1]*A[4]
else:
	cost += A[0]*A[3] + A[1]*A[4]

print(cost)

Measured memory_bytes: 13432
#include <bits/stdc++.h>
using namespace std;
char s[100005];
int ans;
int main() {
    scanf("%s", s);
    int n = strlen(s);
    for (int i=1;i<n;i++) {
        if (s[i] == s[i-1]) s[i] = (1 - (s[i-1]-'0')) + '0', ans++;
    }
    printf("%d\n", ans);
    return 0;
}

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

int main()
{
  int n,m,d;
  scanf("%d%d%d",&n,&m,&d);
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      int a=(i+j)/d%2,b=(i+m-j)/d%2;
      putchar(a==0?b==0?'R':'Y':b==0?'G':'B');
    }
    putchar('\n');
  }
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int32_t main() {
    fastio
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int N;
    cin >> N;
        int change = 0;
        change = N % 1000;
        if (change > 0)
                change = 1000 - change;

    cout << change << '\n';
    return 0;

}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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

  string s;
  cin >> s;

  vector<int> W(N+1, 0);
  REP(i, N){
    W[i+1] += W[i]+(s[i] == 'W'? 1: 0);
  }

  vector<int> E(N+1, 0);
  RREP(i, N){
    E[i] += E[i+1]+(s[i] == 'E'? 1: 0);
  }

  int ans = INF;
  REP(i, N){
    chmin(ans, W[i]+E[i+1]);
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 5396
/******************************************
*    AUTHOR:         CHIRAG AGARWAL       *
*    INSTITUITION:   BITS PILANI, PILANI  *
******************************************/
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL; 
typedef long double LD;
const int MAX=2e5+5;
int arr[MAX];
int cnt[MAX];
int ms[MAX];

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

    for(int i=1;i<=n;i++)
    {
        scanf("%d",&arr[i]);
        cnt[arr[i]]++;
    }   

    for(int i=1;i<=n;i++)
    {
        ms[max(0,i-cnt[i]+1)]++;
        ms[i+1]--;   
    }

    int cur=0;
    
    for(int i=1;i<=n;i++)
    {
        ms[i]+=ms[i-1];
        if(ms[i]==0)
        {
            cur++;
        }
       // printf("%d\n",ms[i]);
    }
//    printf("%d\n",cur);

    for(int i=1;i<=m;i++)
    {
        int a,b;
        scanf("%d %d",&a,&b);
        ms[max(0,arr[a]-cnt[arr[a]]+1)]--;
        if((arr[a]-cnt[arr[a]]+1)>=1)
        {
            if(ms[max(0,arr[a]-cnt[arr[a]]+1)]==0)
            {   
                cur++;
            }
        }
        cnt[arr[a]]--;
        cnt[b]++;
        ms[max(0,b-cnt[b]+1)]++;
        if((b-cnt[b]+1)>=1)
        {
            if(ms[max(0,b-cnt[b]+1)]==1)
            {
                cur--;
            }
        }
        arr[a]=b;
        printf("%d\n",cur);
    }

    return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 
struct point
{
    ll x,y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll n;
    cin>>n;
    ve <ll> adj[n+1];
    rep (i,0,n-1)
    {
        ll x;
        cin>>x;
        adj[x].pb(i);
    }
    rep (i,1,n+1)
    {
        cout<<adj[i].size()<<"\n";
    }
}


Measured memory_bytes: 14520
n=int(input())
s=input()

d=[0]*n

cnt=0
for i in range(n):
    if s[i]=='(':
        cnt+=1
    else:
        cnt-=1
    d[i]=cnt

x=min(d)

s='('*(-x) + s

d2=[0]*(len(s))
cnt=0
for i in range(len(s)):
    if s[i]=='(':
        cnt+=1
    else:
        cnt-=1
    d2[i]=cnt

s=s+')'*d2[-1]

print(s)

Measured memory_bytes: 9048
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

const ll INF = 1LL << 60;

int F(ll a, ll b){
  string ca = to_string(a);
  string cb = to_string(b);
  int sa = ca.size();
  int sb = cb.size();
  return max(sa, sb);
}

int main(){
  ll n; cin >> n;
  int ans = 1000;
  for (ll i = 1; i*i <= n; i++) {
    if(n%i == 0){
      chmin(ans, F(i, n/i));
    }
  }
  std::cout << ans << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int a,b,d=0,e,f;
    cin>>a>>b;
    d=(a+b)/2;
    e=a-d;
    f=b-d;
    if(e<0)
        e=e*(-1);
    if(f<0)
        f=f*(-1);
    if(e==f)
        cout<<d;
    else
        cout<<"IMPOSSIBLE";
}


Measured memory_bytes: 256
import math
s = list(input())
s.append("R")
c = {"R":1, "L":1}
for i in range(len(s)-1):
  if s[i] == "R":
    if s[i+1] == "R": c["R"] += 1
  elif s[i] == "L":
    if s[i+1] == "L": c["L"] += 1
    elif s[i+1] == "R":
      for _ in range(c["R"]-1): print("0 ", end="")
      print(math.ceil(c["R"]/2) + math.floor(c["L"]/2), math.floor(c["R"]/2) + math.ceil(c["L"]/2), end="")
      for _ in range(c["L"]-1): print(" 0", end="")
      if i == len(s) - 2: print()
      else: print(" ", end="")
      c = {"R":1, "L":1}

Measured memory_bytes: 5088
#include <bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < n; i++)
using namespace std;

int main(){
	int N;
	cin >> N;
	vector<string> s(N);
	REP(i, N){
		cin >> s[i];
	}

	int M;
	cin >> M;
	vector<string> t(M);
	REP(i, M){
		cin >> t[i];
	}

	int max_point = 0;
	REP(i, N){
		string selected = s[i];
		int point = 0;
		REP(j, N){
			if(s[i] == s[j])
				point++;
		}
		REP(j, M){
			if(s[i] == t[j])
				point--;
		}
		if(point > max_point)
			max_point = point;
	}
	cout << max_point << endl;
}


Measured memory_bytes: 3540
import * as fs from 'fs';

// パラメタのセパレータ
// - 問題に合わせて変更
const sep = "\n"; 

// エントリポイント
// - OSによるパラメタの処理の違いを吸収
entrypoint(sep);
function entrypoint(sep) {
    try {
        var input = fs.readFileSync("/dev/stdin", "utf8").split(sep);
        main(input);
    }
    catch (ex) {
        const lines = [];
        const reader = require('readline').createInterface({
            input: process.stdin,
            output: process.stdout
        });
        reader.on('line', function (line) {
            lines.push(line);
        });
        reader.on('close', function () {
            if (sep == "\n") {
                input = lines;
            } else {
                input = lines[0].split(sep);
            }
            main(input);
        });
    }
}

// メイン
function main(input) {
    const s = input[0];
    const t = input[1];
    var l = t.length;
    for (var i = 0; i <= s.length - t.length; i++) {
        var l0 = 0;
        for (var j = 0; j < t.length; j++) {
            if (s[i + j] != t[j]) {
                l0++;
                if (l < l0) break;
            }
        }
        if (l0 < l) l = l0;
        if (l == 0) break;
    }
    console.log(l);
}

Measured memory_bytes: 32252
x,y;
main(){
    char c;
    for(;scanf("%d %c %d",&x,&c,&y),c!='?';){
        switch(c){
        case '+':x=x+y;break;
        case '-':x=x-y;break;
        case '*':x=x*y;break;
        case '/':x=x/y;break;
        }
        printf("%d\n",x);
    }
    return 0;
}

Measured memory_bytes: 1828
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
A, B, C = MAP()
print("Yes" if A <= C <= B else "No")


Measured memory_bytes: 5204
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int A, B, C;
    cin >> A >> B >> C;
    cout << max(max(A, B), C) * 9 + A + B + C;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;

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

    int res;

    if( n%500 <=a ) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main() {
	int N, M; 
	cin >> N >> M; 
	long long int A[100010] = {}; 
	for(int i = 0; i < N; i++){
		cin >> A[i]; 
	}
	sort(A, A+N); 	
	pair<long long int, int> R[100010] = {}; 
	for(int i = 0; i < M; i++){
		cin >> R[i].second >> R[i].first; 
	}
	sort(R, R+M, greater<pair<long long int, int>>()); 
	long long int S[300010] = {}; int index = 0; 
	for(int i = 0; i < M; i++){
		for(int j = 0; j < R[i].second; j++){
			S[index] = R[i].first; index ++; 
			if(index >= N) break; 
		}
		if(index >= N) break; 
	}
	long long int ans = 0; 
	for(int i = 0; i < N; i++){
		ans += max(A[i], S[i]); 
	}
	cout << ans << endl; 
}

Measured memory_bytes: 4992
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>

typedef long long ll;

using namespace std;

ll calc(vector<ll> use, ll index, ll H, ll W, vector<vector<ll>> c, ll K){
  if(index == H+W){
    //for(ll i=0;i<H+W;i++){
    //  cout << use[i] << ' ';
    //}
    //cout << '\n';
    ll sum = 0;
    for(ll i=0;i<H;i++){
      for(ll j=0;j<W;j++){
        sum += use[i]*use[H+j]*c[i][j];
      }
    }
    if(sum==K)
      return 1;
    return 0;
  }
  use[index]=0;
  ll a = calc(use, index+1, H, W, c, K);
  use[index]=1;
  ll b = calc(use, index+1, H, W, c, K);
  return a+b;
}

int main(int argc, const char * argv[]) {
  ll H,W,K;
  cin >> H >> W >> K;
  char m;
  vector<vector<ll>> c(H,vector<ll>(W,0));
  for(ll i=0;i<H;i++){
    for(ll j=0;j<W;j++){
      cin >> m;
      if(m=='#')
      c[i][j] = 1;
    }
  }
  vector<ll> use(H+W, 0);
  cout << calc(use, 0, H, W, c, K);
}



Measured memory_bytes: 3636
import java.util.Scanner;
 
public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
 
		int n = sc.nextInt();
		long x = sc.nextLong();
		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
		}
 
		long count = 0;
		for (int i = 1; i < n; i++) {
			long sum = a[i] + a[i - 1];
			long k = Math.max(0, sum - x);
			count += k;
			a[i] = Math.max(0, a[i] - k);
		}
		System.out.println(count);
	}
 
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 62508
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val a = sc.nextInt
    val b = sc.nextInt
    val c = sc.nextInt

    if ((c-b)*(b-a) > 0){
      println("Yes")
    } else {
      println("No")
    }
  }
}

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

using namespace std;
typedef long long ll;

int main(){
    int N;cin >> N;
    vector<int> num_list(N);
    int count = 0;
    int min = 0;
    rep(i,N){
        int tmp;
        cin >> tmp;
        num_list.push_back(tmp);
        if (count == 0){
            min = tmp;
            count++; 
            continue;
        }
        if (tmp <= min){
            min = tmp;
            count++;
        }
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 4704
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
#define int long long
signed main() {
    int n;cin >> n;
    vi a(n+1),b(n);
    rep(i, n+1) cin >> a[i];
    rep(i, n) cin >> b[i];
    int count = 0;
    rep(i, n) {
        if(a[i]>=b[i]) {
            a[i]-=b[i];
            
            count+=b[i];b[i]=0;
        }
        else {
            b[i]-=a[i];
            
            count+=a[i];a[i]=0;
        }
        if(a[i+1]>=b[i]) {
            a[i+1]-=b[i];
            
            count+=b[i];b[i]=0;
        }
        else {
            b[i]-=a[i+1];
            
            count+=a[i+1];a[i+1]=0;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 4724
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v) cerr << #v << ":"; rep(i, v.size()) cerr << " " << v[i]; cerr<<endl
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    char c;
    cin >> c;
    if ('a' <= c && c <= 'z') {
        cout << "a" << endl;
    } else {
        cout << "A" << endl;
    }
}

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


Measured memory_bytes: 3608
from sys import stdin

def main():
    point = 0
    r,g,b,n = [int(x) for x in stdin.readline().rstrip().split()]
    for i in range(n//r+1):
        for j in range(n//g+1):
            if n-r*i-g*j >= 0:
                if (n-r*i-g*j)%b == 0:
                    point += 1
    print(point)

main()

Measured memory_bytes: 39408
#include <iostream>
using namespace std;
#define min(a,b) ((a)<(b) ? (a) : (b))
int digit(int a){
  if(a==0) return 0;
  else return digit(a/10)+1;
}
int main(){
  int n,result=0;
  cin >> n;
  for(int i=1;i<=n;i++){
    if(digit(i)%2==1) result++;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3612
#include <stdio.h>
int main(void){
    // Your code here!
    int n,x,i,j,k,c;
    c=0;
    while(1){
        scanf("%d %d",&n,&x);
        if(n == 0 && x == 0)break;
        for(i =1;i <n+1;i++){
            for(j=1;j < n+1;j++){
                for(k=1;k<n+1;k++){
                    if(j !=k && i != j&& i != k&& i+j+k==x){
                     c=c+1;
                    }
                }
            }
        }
        printf("%d\n",c/6);
    c = 0;
    }
    
    
    return 0;
}
   


Measured memory_bytes: 2068
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int k;
    cin>>k;
    if (k&1)
        cout<<((k+1)/2)*(k/2)<<endl;
    else
        cout<<(k/2)*(k/2)<<endl;
}

Measured memory_bytes: 256