akhauriyash/Code-Regression huggingface dataset:
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
template<typename T> ll min(ll a, const T&& b) { return a < b ? a : b; }
template<typename T> ll min(const T&& a, ll b) { return a < b ? a : b; }
template<typename T> ll max(ll a, const T&& b) { return a > b ? a : b; }
template<typename T> ll max(const T&& a, ll b) { return a > b ? a : b; }
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

constexpr ll maxN = 100000;

ll n, X;
ll b[maxN], l[maxN], u[maxN];

ll f(ll all) {
  ll rest = all % X, use = min(n, all / X);
  vector<P> v;
  rep(i, n) {
    ll odd = rest >= b[i] ? l[i] * b[i] + (rest - b[i]) * u[i] : l[i] * rest;
    v.eb(l[i] * b[i] + u[i] * (X - b[i]), odd);
  }
  sort(all(v), greater<P>());
  ll sum = 0;
  rep(i, use) {
    sum += v[i].first;
  }
  if (use == n) return sum;
  ll res = 0;
  rep(i, use) {
    chmax(res, sum - v[i].first + v[i].second + v[use].first);
  }
  rep(i, use, n) {
    chmax(res, sum + v[i].second);
  }
  return res;
}

void solve() {
  cin >> n >> X;
  rep(i, n) cin >> b[i] >> l[i] >> u[i];
  ll base = 0;
  rep(i, n) base -= l[i] * b[i];
  ll lb = 0, ub = linf;
  rep(t, 60) {
    ll mid = (lb + ub) / 2;
    if (f(mid) + base >= 0) {
      ub = mid;
    }
    else {
      lb = mid;
    }
  }
  cout << ub << endl;
}


Measured memory_bytes: 6880
#include<iostream>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<assert.h>
#include <math.h>
#include<iomanip>
using namespace std;
#define OUT 0
#define ON 1
#define IN 2
#define EPS (1e-10)
class P{                    //???
public:
    double x,y;
    
    P(double _x=0,double _y=0):x(_x),y(_y){};
    P operator + (const P &p     )const{ return P( x+p.x , y+p.y ); }  //??????
    P operator - (const P &p     )const{ return P( x-p.x , y-p.y ); }  //??????
    P operator * (const double k )const{ return P( x*k   , y*k    ); } //??????
    P operator / (const double k )const{ return P( x/k   , y/k    ); } //??????
    
    bool operator == (const P &p){ return ( fabs(x-p.x)<EPS && fabs(y-p.y)<EPS ); }
    bool operator < (const P &p) const{ return ( x!=p.x ? x<p.x:y<p.y ); }
    
    double norm(){ return x*x+y*y; }        //?????????
    double abs() { return sqrt(norm()); }   //??§??????
    void normalize() {double d = sqrt(x*x+y*y); x /= d; y /= d;}	//??£??????
};
struct C{P p;double r;};    //???
struct S{P p1,p2;};         //??????
typedef vector<P> Polygon;  //????§???¢
typedef P Vector;           //????????????
typedef S L;                //??´???

double norm (P p)               { return p.norm(); }
double abs  (P p)               { return p.abs(); }
double dot  (Vector a,Vector b) { return a.x*b.x+a.y*b.y; }
double cross(Vector a,Vector b) { return a.x*b.y-a.y*b.x; }
double sqDist(P a, P b)         {return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);}
double dist (P a, P b)          {return sqrt(sqDist(a,b));}
Vector vec(S a)                 {return P(a.p2.x-a.p1.x,a.p2.y-a.p1.y);}

int ccw(P p0,P p1,P p2){    //AOJ_BOOK_P386 verified
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    
    if( cross(a,b) > EPS  ) return 1 ;      //COUNTER_CLOCKWISE
    if( cross(a,b) < -EPS ) return -1;      //CLOCKWISE
    if( dot(a,b)   < -EPS ) return 2;       //ONLINE_BACK
    if( a.norm()   < b.norm() ) return -2;  //ONLINE_FRONT
    
    return 0;                               //ON_SEGMENT;
}

// ??´?????¨??´???????????? vefiried AOJ CGL_2
P getCrossPointSS(S l1, S l2){
    double A = cross(vec(l1), vec(l2));
    double B = cross(vec(l1), l1.p2 - l2.p1);
    if(abs(A)<EPS && abs(B)<EPS) return l2.p1; // ?????´??????????????£?????????
    if(abs(A)<EPS) assert(false); // ??´?????????????????????
    return l2.p1 + vec(l2) * B / A;
}

//????????¨???????????¢ verified ARC042-B
double dLP(S l, P p) { return abs(cross(l.p2-l.p1, p-l.p1)) /(l.p2-l.p1).abs(); }

int main() {
    // source code
    int n, k;
    cin >> n >> k;
    double theta = (360.0/n)*(acos(-1)/180.0);
    P p = P(0, 1);
    vector<P> vp;
    for(int i = 0; i < n; i++){
        vp.push_back(P(p.x*cos(i*theta) - p.y*sin(i*theta),
                       p.x*sin(i*theta) + p.y*cos(i*theta)));
    }
    double area = cross(vp[0], vp[1])/2.0;
    S a = S{vp[0], vp[k]};
    S b = S{vp[(1-k+n)%n], vp[1]};
    P cp = getCrossPointSS(a, b);
    //double dist = seg_to_point_dis(line(vp[0], vp[1]), cp);
    double d = dLP(S{vp[0], vp[1]}, cp);
    cout << setprecision(12) << (area - dist(vp[0], vp[1])*d/2)*n << endl;
    return 0;
}

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

using namespace std;

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

int my_abs(int x) {
    return x < 0 ? -x : x;
}

int number[1000000];

int main() {

    int n;
    cin >> n;
    vector<int> a(n);
    a[0] = 0;
    for(int i=1; i<n; i++) cin >> a[i];

    sort(a.begin(), a.end());

    for(int i=0; i<n; i++) {
        number[a[i]]++;
    }



    for(int i=0; i<n; i++) {
        cout << number[i+1] << endl;
    }

    return 0;
}


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

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

	int64_t ans = 0;

	for (int64_t a = 1; a < n; a++)
	{
		ans += (n - 1) / a;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define ff first
#define ss second
#define rep(i,l,r) for(int i = (int)l;i<(int)r;i++)
#define td(v) v.begin(),v.end()
#define M   1000000007 // 1e9 + 7
#define MAXN 100100
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int exp(int a,int b,int m){
	
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);

}
const int N = 100100;
int dp[N];

int a[N];
int32_t main(){
	fastio;
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>a[i]; 
	dp[0] = 0;
	for(int i=0;i<=k;i++){
		if(dp[i]==1)continue;
		for(int j=1;j<=n;j++){
			if(dp[i]==0 && i + a[j]<=k){
				dp[i+a[j]] = 1;
			}
		}
	}
	
	if(dp[k])cout<<"First"<<endl;
	else cout<<"Second"<<endl;
	
}

Measured memory_bytes: 1024
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
double n,m,a,b,c,d,x,y,z;
string s,t;
//

signed main() {
  RAPID;
  IN2(a,b);
  OUT(ceil((a+b)/2));
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public long[] A, S;

        public void Run()
        {
            {
                N = Input.ReadInt();
                A = Input.ReadLongArray();
            }

            S = new long[N];
            for (int i = 0; i < N; i++)
            {
                S[i] = (i == 0 ? 0 : S[i - 1]) + A[i];
            }

            long ret = 0;
            int check = 0;
            for (int i = 0; i < N; i++)
            {
                while (true)
                {
                    long s = (i == 0 ? 0 : S[i-1]) - (check == 0 ? 0 : S[check-1]);
                    if ((s | A[i]) == s + A[i]) break;
                    check++;
                }

                ret += (i - check) + 1;
            }

            Console.WriteLine(ret);

        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 34012
N,K = map(int,input().split())
X = list(map(int,input().split()))

X.sort()
Ans = 10**20
for i in range(N-K+1):
    l = X[i]
    r = X[i+K-1]
    # 0を含む または 同じ符号の場合
    if l*r >= 0:
        ans = max(abs(l),(r))
    # 符号が異なる場合
    else:
        ans = max(abs(l),abs(r)) + min(abs(l),abs(r))*2
    Ans = min(Ans,ans)

print(Ans)

Measured memory_bytes: 14224
n,W=map(int,input().split())
sumv=0
v,w=[],[]
m=10**9
for i in range(n):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)
    sumv+=b
dp=[m]*(sumv+1)
dp[0]=0
for i in range(n):
    for j in range(sumv,v[i]-1,-1):
        dp[j]=min(dp[j],dp[j-v[i]]+w[i])
ans=0

for i in range(sumv+1):
    if dp[i]<=W:
        ans=i 
# print(dp)
print(ans)


Measured memory_bytes: 41308
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
const ll MOD = 1000000007;
using pint = pair<ll, ll>;

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

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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define loop(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}

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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }


int main(void){
  int n;cin >> n;
  vint v(n),c(n);
  vin(v);vin(c);
  int ans=0;
  rep(i,n)
    if(0<v[i]-c[i]) ans+=v[i]-c[i];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Scanner;

/* AtCoder AGC001-A
 * BBQ easy : Find the maximum sum */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int numOfSticks;
        int[] lenOfSticksArr;

      
        numOfSticks = scanner.nextInt() << 1; // 2N

        lenOfSticksArr = new int[numOfSticks];
        for (int i=0; i<numOfSticks; i++) {
          lenOfSticksArr[i] = scanner.nextInt();
        }

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

        System.out.println(solve(lenOfSticksArr));
    }

    /**
     * Solve function for AGC001A
     *
     * We can find the answer for this problem just using sort.
     * The BBQ can needs 2 sticks, and the max # of ingredient is a smaller length of sticks.
     * Namely we can make BBQ with A ingredients when length A is shorter than B.
     * For example, sticks that length 10 and 7, can make 1 BBQ with 7 ingredients cause 7 < 10.
     * In other words, we can solve this problem just using sorting, and just get the odd number of values.
     *
     * ex) 3 10 8 6 can ordered
     * 3 6 8 10, and we know that
     * 3<6 and 8<10
     * so the answer is 3+8 = 11.
     * Of course, we can make the BBQ like 3 and 10, 8 and 6. but
     * if this will be 3<10 and 6<8, so the max number of ingredient is 3+6 = 9.
     *
     * @param arr the array of sticks
     * @return the maximum sum that we can stick ingredients */
    static int solve(int[] arr) {
        // sort array in ascending order
        Arrays.sort(arr);

        // add odd number of values
        int sum = 0;
        for (int i=0; i<arr.length; i+=2) {
            sum += arr[i];
        }

        return sum;
    }
}


Measured memory_bytes: 21716
import java.util.*;

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*b %2 == 0){
        System.out.println("Even");
      }else{
        System.out.println("Odd");
      }
    }
}

Measured memory_bytes: 35660
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  vi a(n);
  rep (i, n) {
    scanf("%d", &a[i]);
  }
  sort(all(a));
  reverse(all(a));
  vi b(2, 0);
  int cnt = 0;
  rep (i, n-1) {
    if (cnt == 2) { break; }
    if (a[i] == a[i+1]) {
      b[cnt] = a[i];
      cnt += 1;
      i += 1;
    }
  }
  ll ans = b[0];
  ans *= b[1];
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1272
b = input()
white = 0
bl = []
for k in b:
    if k == 'B':
        bl.append(1)
    else:
        white += 1
        bl.append(0)
k = 0
wp = white
ans = 0
for p in bl:
    if p==1:
        ans += wp - k
        wp += 1
    k += 1

print(ans)    

Measured memory_bytes: 5096
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H & b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H & b) const { return x == b.x && y == b.y; }
	bool operator!=(const H & b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T & a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T & a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int x, a;
signed main() {
	cin >> x >> a;
	cout << (x >= a) * 10 << endl;
}

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

using namespace std;

int main(int argc, char* argv[]) {
  int A, B, C, X;
  cin >> A >> B >> C >> X;

  int count = 0;
  for (int i = 0; i <= A; i++) {
    for (int j = 0; j <= B; j++) {
      int rest = X - 500 * i - 100 * j;
      if (rest >= 0 && rest % 50 == 0 && rest / 50 <= C) {
        count++;
      }
    }
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A = LI()
    wakeme = N
    Aleftsum = [0 for _ in range(3*N+1)]
    leftA = [x for x in A[:N]]
    heapq.heapify(leftA)
    subsum = sum(leftA)
    Aleftsum[wakeme] = subsum
    for i in range(N):
        heapq.heappush(leftA, A[wakeme + i])
        subsum += A[wakeme + i]
        subsum -= heapq.heappop(leftA)
        Aleftsum[wakeme+i+1] = subsum

    Arightsum = [0 for _ in range(3*N+1)]
    rightA = [-x for x in A[-N:]]
    heapq.heapify(rightA)
    subsum = sum(rightA)
    wakeme = 2*N
    Arightsum[wakeme] = -subsum
    for i in range(1, N+1):
        heapq.heappush(rightA, -A[wakeme-i])
        subsum -= A[wakeme - i]
        subsum -= heapq.heappop(rightA)
        Arightsum[wakeme - i] = -subsum
    ans = -inf
    for i in range(N, 2*N+1):
        ans = max(ans, Aleftsum[i] - Arightsum[i])
    print(ans)
main()



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

int main() {
	long long N;
	cin >> N;
	long long ans = 1e18;
	for (long long i = 1; i*i <= N; ++i) {
		if (0 == N % i) {
			long long y = 0;
			long long subi = N / i; 
			while (subi > 0) {
				y++;
				subi /= 10;
			}
			ans = min(ans, y);
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin() x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin() x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n; cin >> n;
	vll l(n);
	ll maxi = 0, sum=0;
	rep(i, n) cin >> l[i], maxi=max(maxi, l[i]), sum+=l[i];
	sum -= maxi;
	if (sum > maxi){
		cout << "Yes\n";
	}else{
		cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
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;
}
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}

using Graph=vector<vector<int>>;
Graph G;
bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: return true;
    } // n > 2 が保証された

    if(n%2 == 0) return false;

    // 上で i=2 相当は調べたので、i=3から奇数のみ調べる
    for(unsigned i=3;i*i<=n;i+=2){
        if(n%i == 0) return false;
    }

    return true;
}


int main(){
  int x;
  cin >> x;
  for(int i=x;i<=100500;i++){
    if(is_prime(i)){
      cout << i << endl;
      return 0;
    }
  }
}
    


Measured memory_bytes: 256
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Sat Jan  5 17:15:43 2019
//
package main

import "fmt"

func main() {
	var H, W int
	fmt.Scan(&H, &W)

	graph := make([][]int, 10)
	for i := range graph {
		graph[i] = make([]int, 10)
		for j := range graph[i] {
			fmt.Scan(&graph[i][j])
		}
	}

	for k := 0; k < 10; k++ {
		for i := 0; i < 10; i++ {
			for j := 0; j < 10; j++ {
				if graph[i][k]+graph[k][j] < graph[i][j] {
					graph[i][j] = graph[i][k] + graph[k][j]
				}
			}
		}
	}

	ans := 0
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			var a int
			fmt.Scan(&a)
			if a != -1 {
				ans += graph[a][1]
			}
		}
	}
	fmt.Println(ans)
}


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

typedef long long ll;

// Vectors
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    if(n >= 30) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }
    return 0;
}

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

main(){
     ios_base::sync_with_stdio(false);
     cin.tie(nullptr);
     int x, y; cin >> x >> y;
     if(!(y&1) && y >= 2*x && y <= 4*x) cout << "Yes";
     else cout << "No";
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;

int main(){
    string s;
    int ans=0;
    cin>>s;
    rep(i,s.size()){
        int c=0;
        while(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T'){
            i++;
            c++;
            ans = max(ans,c);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define long long long
#define ull unsigned long long
#define up(i,a,b) for (int i=a; i<=b; i++)
#define down(i,a,b) for (int i=a; i>=b; i--)
#define endl '\n'
#define pb push_back
#define X first
#define Y second
#define II pair<int, int>
#define III pair<int, pair<int, int> >
#define V vector
#define debug(X) cerr<< #X << " = " <<X << endl
#define debug2(X,Y) cerr<< #X << " = " <<X << ","<<#Y<<" = "<<Y<<endl
#define show(X,a,b) {cerr << #X << " = "; up(__,a,b) cerr << X[__] << ' '; cerr << endl;}
#define gc getchar
#define pc putchar

using namespace std;

inline void read(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for (;((c<48 || c>57) && c != '-') ;c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
inline void writeln(int x){

         char buffor[21];
         register int i=0;
         int neg=0; if (x<0) {neg=1; x= -x;}
         do{
               buffor[i++]=(x%10)+'0';
               x/=10;
            } while(x);
           i--;
           if (neg) pc('-');
           while(i>=0) pc(buffor[i--]);
           pc('\n');
       }
const int base= 1e9+ 7;
int n,m;
V<II> con[302];
int dp[302][302][302];

void input()
{
    cin>>n>>m;
    up(i,1,m)
    {
    	int l,r,x; cin>>l>>r>>x;
    	con[r].pb(II(l,x) );
    }
}

int Add(int x,int y)
{
	return (x+y) % base;
}
bool ok(int x,int y,int z)
{
	int Max= max(max(x,y),z);
	for (auto v: con[Max])
	{
		int cnt=0;
		if (x>= v.X) cnt++;
		if (y>= v.X) cnt++;
		if (z>= v.X) cnt++;
		if (cnt!= v.Y) return false;
	}
	return true;
}
void update(int x,int y,int z)
{
    if (!ok(x,y,z)) dp[x][y][z]= 0;
    if (dp[x][y][z]==0) return;
	int Max= max(max(x,y),z);
    dp[Max+1][y][z]= Add(dp[Max+1][y][z],dp[x][y][z]);
    dp[x][Max+1][z]= Add(dp[x][Max+1][z],dp[x][y][z]);
    dp[x][y][Max+1]= Add(dp[x][y][Max+1],dp[x][y][z]);
}
void solve()
{
    dp[0][0][1]= dp[0][1][0]= dp[1][0][0]= 1;
    up(Max,1,n)
    {
    	up(x,0,Max-1)
    	 up(y,0,Max-1)
    	 {
            update(x,y,Max); update(x,Max,y); update(Max,x,y);
    	 }
    }



    int res=0;

    up(x,0,n-1)
     up(y,0,n-1)
      {
      	res= Add(res, dp[x][y][n]);
      	res= Add(res, dp[x][n][y]);
      	res= Add(res, dp[n][x][y]);
      };
    cout<<res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);// don't use when interactive
    #define TASK "tmp"
  //  freopen(TASK".inp","r",stdin);
   // freopen(TASK".out","w",stdout);

    input();
    solve();

    return 0;
}


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

int A[100000], n;
int binarySearch(int key){
    int left = 0;
    int right = n;
    int mid;
    while(left < right){
        mid = (left + right) / 2;
        if(A[mid] == key){
            return 1; // 1 -- true
        }
        if(A[mid] < key){
            left = mid + 1;
        }else if(A[mid] > key){
            right = mid;
        }
    }
    return 0; // 0 -- false
}

int main(){
    int i, q, key, sum = 0;
    cin >> n;
    for(i = 0; i < n; i++)  cin >> A[i];

    cin >> q;
    for(i = 0; i < q; i++){
        cin >> key;
        if(binarySearch(key)) sum++;
    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3428
#include <stdio.h>
int main () {
	int i, v, j, k, N;
	scanf("%d", &N);
	int A[N];
	for ( i = 0; i < N; i++ ) {
		scanf ( "%d", &A[i]);
	}
	for ( i = 0; 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;
		for ( k = 0; k < N; k++ ) {
			printf ( "%d", A[k]);
			if ( k < N-1) {
				printf ( " " );
			}
		}
		printf  ( "\n" );
	}
	return 0;
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define prtd(var, i) cout << fixed << setprecision(i) << var << endl;
#define ll long long
#define P pair<int, int>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> cntAC(n+1), cntWA(n+1);
  int ans = 0, penalty = 0;
  rep(i, m){
    int p;
    string s;
    cin >> p >> s;
    if(s == "WA" && cntAC[p] == 0){
      cntWA[p]++;
    }else if(s == "AC" && cntAC[p] == 0){
      ans++;
      cntAC[p] = 1;
    }
  }
  for(int i = 1; i <= n; i++){
    if(cntAC[i] == 1){
      penalty += cntWA[i];
    }
  }

  cout << ans << " " << penalty << endl;


}





Measured memory_bytes: 4028
# -*- coding: utf-8 -*-

import sys
import math

class Point_Class():
    def __init__(self, x, y):
        self.x = x
        self.y = y

def isIn(p1, p2, p3, pp):
    a = p2.y-p1.y
    b = p2.x-p1.x
    c = p2.x*p1.y-p1.x*p2.y
    d = p3.y-p2.y
    e = p3.x-p2.x
    f = p3.x*p2.y-p2.x*p3.y
    g = p1.y-p3.y
    h = p1.x-p3.x
    i = p1.x*p3.y-p3.x*p1.y
    if (a*pp.x-b*pp.y+c)*(a*p3.x-b*p3.y+c) < 0:
        return False
    if (d*pp.x-e*pp.y+f)*(d*p1.x-e*p1.y+f) < 0:
        return False
    if (g*pp.x-h*pp.y+i)*(g*p2.x-h*p2.y+i) < 0:
        return False
    return True


for line in sys.stdin:
    x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
    p1 = Point_Class(x1, y1)
    p2 = Point_Class(x2, y2)
    p3 = Point_Class(x3, y3)
    pp = Point_Class(xp, yp)
    print "YES" if isIn(p1, p2, p3, pp) else "NO"

Measured memory_bytes: 6380
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli v,e,r;
mat g;
mat d;
lli x,y,c;
priority_queue<pll,vector<pll>,greater<pll> > pq;
vbl vis;
vll ans;

int main(){
    cin >> v >> e >> r;
    g = d = mat(v);
    for(lli i = 0;i < e;i++){
        cin >> x >> y >> c;
        g[x].push_back(y);
        d[x].push_back(c);
    }
    pq.push(pll(0,r));
    vis = vbl(v);
    ans = vll(v,-1);
    while(!pq.empty()){
        x = pq.top().second;
        c = pq.top().first;
        pq.pop();
        if(vis[x]) continue;
        vis[x] = true;
        ans[x] = c;
        for(lli i = 0;i < g[x].size();i++){
            if(!vis[g[x][i]]) pq.push(pll(c+d[x][i],g[x][i]));
        }
    }
    for(lli i = 0;i < v;i++){
        if(ans[i] >= 0) cout << ans[i] << endl;
        else cout << "INF" << endl;
    }
    return 0;
}

Measured memory_bytes: 25316
while True:
    N = int(input())
    if N == 0:
        break

    ans1 = -1
    ans2 = -1
    for i in range(N):
        p,d1,d2 = [int(j) for j in input().split()]
        if d1+d2 > ans2:
            ans1 = p
            ans2 = d1+d2
    print(ans1,ans2)


Measured memory_bytes: 5620
S = input()

if 'N' in S:
    if 'S' not in S:
        print('No')
        exit()

if 'S' in S:
    if 'N' not in S:
        print('No')
        exit()

if 'W' in S:
    if 'E' not in S:
        print('No')
        exit()

if 'E' in S:
    if 'W' not in S:
        print('No')
        exit()

print('Yes')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
using ll = long long; using ld = long double; const char nl = '\n';
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */

#include <bits/extc++.h>
namespace pbds =  __gnu_pbds;
template <typename key, typename val=pbds::null_type, typename comp=less<key>>
using ostree=pbds::tree<key,val,comp,pbds::rb_tree_tag,pbds::tree_order_statistics_node_update>;
using vi = vector< int >; using vll = vector< ll >;
#define all(x) std::begin(x), std::end(x)
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename...Args, template<typename...> typename T> string to_string(T<Args...> const&);
string to_string(string const&s){return '"'+s+'"';}
string to_string(char const &c) {return to_string(string(1,c));}
string to_string(char const *c) {return to_string(string(c));}
string to_string(bool const &b) {return (b ? "1" : "0");}
template<typename... Args> string to_string(pair<Args...> const&p)
{return "("+to_string(p.first)+", "+to_string(p.second)+")";}
template <typename...Args, template<typename...> typename T> string to_string(T<Args...> const&S)
{string s = "{"; for(auto const& e: S)s+=" "+to_string(e);s+=" }"; return s;}
template<typename Tail> void debug_out(Tail t) {cerr<<" "<<to_string(t)<<" ]"<<endl;}
template<typename Head, typename... Tail> void debug_out(Head h, Tail... t)
{cerr << " " << to_string(h) << ","; debug_out(t...);}
#define pr(...) cerr<<"["<<(#__VA_ARGS__)<<"] : [", debug_out(__VA_ARGS__)
template <typename T> void dbr(T lb, T ub)
{cerr<<'{'; for(auto it=lb; it!=ub; it++) cerr<<' '<<to_string(*it); cerr<<" }"<<endl;}
template<typename T, typename Comp=less<T>> bool smin(T &mem, T const&v, Comp const&cmp=Comp())
{return cmp(v, mem) ? mem = v, true : false;}
template<typename T, typename Comp=less<T>> bool smax(T &mem, T const&v, Comp const&cmp=Comp())
{return cmp(mem, v) ? mem = v, true : false;}
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */



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

  int n; cin >> n;
  using ii = pair<int,int>;
  set< ii > S;
  int a[n];
  for(int i=0; i<n; i++) {
    cin >> a[i];
    S.emplace(a[i], i);
  }

  for(int i=0; i<n; i++) {
    S.erase(make_pair(a[i], i));
    cout << (S.rbegin()->ff) << endl;
    S.emplace(a[i], i);
  }

}
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */


Measured memory_bytes: 11776
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x) {
  S[++top] = x;
}

int pop() {
  top--;
  return S[top+1];
}

int main() {
  int a, b;
  top = 0;
  char s[100];

  while( scanf("%s", s) != EOF ) {
    if ( s[0] == '+' ) {
      b = pop();
      a = pop();
      push(a + b);
    } else if ( s[0] == '-' ) {
      b = pop();
      a = pop();
      push(a - b);
    } else if ( s[0] == '*' ) {
      b = pop();
      a = pop();
      push(a * b);
    } else {
      push(atoi(s));
    }
  }

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

  return 0;
}


Measured memory_bytes: 2760
operator = ["+", "-", "*"]
input_list = input().split()


num_stack = [] #数字
for e in input_list:
    if e in operator:
        num = 0
        if e == "+":
            num = num_stack.pop() + num_stack.pop()
            
        elif e == "-":
            b = num_stack.pop()
            a= num_stack.pop()
            num = a - b
            
        elif e == "*":
            num = num_stack.pop() * num_stack.pop()
        
        num_stack.append(num)
    else:
        num_stack.append(int(e))

print(*num_stack)


Measured memory_bytes: 5596
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>

#define BIT(a) (1 << (a))

using namespace std;

long long MOD = 1000000007;


long long mod_pow(long long x, long long n){
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

int a[100005];
int b[100005];

int main(void){
	int N;
	cin >> N;
	for (int i = 0; i < N; i++){
		cin >> a[i];
	}
	for (int i = 0; i < N; i++){
		int x;
		cin >> x;
		b[x]++;
	}
	int flag = 0;
	for (int i = 0; i < N; i++){
		if (!b[a[i]]){
			flag = 1;
		}
	}
	if (flag){
		cout << "No" << endl;
		for (int i = 0; i < N; i++){
			if (i) cout << " ";
			cout << 1;
		}
		cout << endl;
		for (int i = 0; i < N; i++){
			if (i) cout << " ";
			if (!b[a[i]]){
				cout << 2;
			}else{
				cout << 1;
			}
		}
		cout << endl;
	}else{
		cout << "Yes" << endl;
	}
	return 0;
}




Measured memory_bytes: 3880
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll = long long;
const ll MOD = 1000000007; 
using plong = pair<ll,ll>;

int main(){
    ll N;
    cin>>N;
    map<plong,ll> mp;
    ll ax,ay,ah;
    bool fl=true;
    for(ll i=0;i<N;i++){
        ll a,b,c;
        cin>>a>>b>>c;
        mp[make_pair(a,b)]=c;
        if(fl&&c>0){
            ax=a;ay=b;ah=c;
            fl=false;
        }
    }

    for(ll x=0;x<=100;x++){
        for(ll y=0;y<=100;y++){
            ll H;
            bool f=true;
            H = ah+abs(x-ax)+abs(y-ay);
            for(auto pa:mp){
                ll h = mp[pa.first];
                if(max(H-abs(x-pa.first.first)-abs(y-pa.first.second),(ll)0)!=h){
                        f=false;
                }
            }
            if(f){
                cout<<x<<" "<<y<<" "<<H<<endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define abs(a) (a > 0? a : -(a))

#define move(s) s += "#"

#define eprintf(...) fprintf(stderr, __VA_ARGS__);

template <typename T>
void printArr(const T * arr, int s, int fn) {
    for (int i = s; i <= fn; ++ i) cout << arr[i] << " ";
    cout << '\n';
}

template <typename T>
long long minArr(const T * arr, int s, int fn) {
    ll res = 1e16 + 1;
    for (int i = s; i <= fn; ++ i) {
        res = min(res, arr[i]);
    }
    return res;
}

template <typename T>
void printVec(const T * arr) {
    for (int i = 0; i < sz(arr); ++ i) cout << arr[i] << " ";
    cout << '\n';
}

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

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

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cerr << "Ready\n";
}

const int N = 1e5 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

int main () {
    to_pray();

    string s, t;

    cin >> s >> t;

    int cnt = 0;

    for (int i = 0; i < sz(s); ++ i)
        if (s[i] == t[i])
            ++cnt;

    cout << cnt;

    //eprintf("%.18lf seconds\n", (double)clock() / CLOCKS_PER_SEC);

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

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

using i64 = long long;
using P = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()


void solve(long long N, long long M, std::vector<long long> p, std::vector<std::string> S){
    vector<i64> cnt(N);
    vector<bool> flag(N);
    i64 ans = 0, ac = 0;
    rep(i, M){
        if(S[i] == "AC"){
            if(!flag[p[i] - 1]){
                ans += cnt[p[i] - 1];
                cnt[p[i] - 1] = 0;
                flag[p[i] - 1] = true;
                ++ac;
            }
        }else if(!flag[p[i] - 1]){
            cnt[p[i] - 1]++;
        }
    }
    cout << ac << " " <<  ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> p(M);
    std::vector<std::string> S(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&p[i]);
        std::cin >> S[i];
    }
    solve(N, M, std::move(p), std::move(S));
    return 0;
}


Measured memory_bytes: 7296
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

using namespace std;

#define LL long long

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

LL getz(LL n) {
	LL res = 0;
	for (LL a = (LL)(5); a <= n; a *= 5) {
		res += (n / a);
	}
	return res;
}

int main() {
	LL n;
	cin >> n;
	if (n % (LL)(2) == (LL)(0)) {
		cout << getz(n / (LL)(2)) << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

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

const int N = 1000;

int lcs(string s1, string s2) {
    int c[N + 1][N + 1];
    int m = s1.size();
    int n = s2.size();
    s1 = ' ' + s1;
    s2 = ' ' + s2;
    c[0][0]  = 0;
    for (int i = 1; i <= m; i++)
        c[i][0]  = 0;
    for (int i = 1; i <= n; i++)
        c[0][i] = 0;

    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= n; j++) {
            if (s1[i] == s2[j]) {
                c[i][j] = c[i-1][j-1] + 1;
            } else {
                c[i][j] = max(c[i-1][j], c[i][j-1]);
            }
        }
    }
    return c[m][n];
}

int main() {
    int n;
    string s1, s2;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s1 >> s2;
        cout << lcs(s1, s2) << "\n";
    }
    return 0;
}



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

using namespace std;

using ll = long long;
using Pii = pair<int, int>;

const ll INF = (ll)1e11;

int main() {
    ll N, x;
    vector<ll> a;

    cin >> N >> x;
    ll mina = INF, ii;
    ll ans = 0;
    for (int i = 0, t; i < N; ++i) {
        cin >> t;
        if (t > x) {
            ans += t - x;
            t = x;
        }
        a.push_back(t);
        if (mina > t) {
            mina = t;
            ii = i;
        }
    }

    
    for (ll d = 0; 0 < ii - d || ii + d < N - 1; ++d) {
        ll l = ii - d, r = ii + d;
        if (0 < l) {
            ll le = max(0ll, a[l] + a[l - 1] - x);
            a[l - 1] -= le;
            ans += le;
        }
        if (r < N - 1) {
            ll re = max(0ll, a[r + 1] + a[r] - x);
            a[r + 1] -= re;
            ans += re;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {

	public static void main (String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int point = 0;

		point = x/500;
		x = x-500*point;
		point*=1000;
		point += (x/5)*5;
		System.out.println(point);
	}

}

Measured memory_bytes: 23764
N, M = map(int, input().split())
L = {}
for i in range(N):
    A = list(map(int, input().split()))
    for j, a in enumerate(A):
        if j == 0:
            continue
        if not a-1 in L.keys():
            L[a-1] = [i]
        else:
            L[a-1].append(i)

class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]

union = UnionFind(N)

for list_l in L.values():
    for l in list_l:
        union.Unite(l, list_l[0])

ans = "YES"
for i in range(N):
    if not union.isSameGroup(0, i):
        ans = "NO"
print(ans)

Measured memory_bytes: 16308