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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int H = nextInt();
  int N = nextInt();

  vector<ll> A(N);
  REP(i, N) A[i] = nextInt();
  ll S = accumulate(ALL(A), 0LL);

  if (H <= S) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


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

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

long long GCD(long long x, long long y) {
    return y ? GCD(y, x%y) : x;
}

int main() {
    long long A, B;
    cin >> A >> B;
    long long G = GCD(A, B);
    auto pf = prime_factorize(G);
    cout << pf.size() + 1 << endl;
}

Measured memory_bytes: 256
fun main(args : Array<String>) {
    val (n, x) = readLine()!!.split(" ").map { it.toInt() }
    val aa = readLine()!!.split(" ").map { it.toLong() }.toMutableList()

    var eaten = 0L
    for (i in 0 until n-1) {
        if (aa[i] > x) {
            val diff = aa[i] - x
            eaten += diff
            aa[i] -= diff
        }
        if (aa[i] + aa[i+1] > x) {
            val diff = (aa[i] + aa[i+1]) - x
            eaten += diff
            aa[i+1] -= diff
        }
    }

    println(eaten)
}

Measured memory_bytes: 73788
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<ll> a(N);
	vector<ll> b(N);
	for (int i = 0; i < N; ++i) { cin >> a[i]; }
	for (int i = 0; i < N; ++i) { cin >> b[i]; }

	vector<ll> x(N);
	vector<ll> y(N);
	ll sum_x = 0;
	ll sum_y = 0;
	int size_x = 0;
	int size_y = 0;
	for (int i = 0; i < N; ++i) {
		if (a[i] > b[i]) {
			x[size_x++] = (a[i] - b[i]);
			sum_x += (a[i] - b[i]);
		}
		if (a[i] < b[i]) {
			y[size_y++] = (b[i] - a[i]);
			sum_y += (b[i] - a[i]);
		}
	}

	if (sum_y > sum_x) {
		cout << -1 << endl;
		return 0;
	}

	sort(x.begin(), x.end(), greater<long long>());
	int ix = 0, iy = 0;
	vector<bool> used(N, false);
	int lp = 0;
	while ((iy < size_y) && (lp++ < 1e7)) {
		if (x[ix] >= y[iy]) {
			x[ix] -= y[iy];
			used[ix] = true;
			y[iy] = 0;
			++iy;
		}
		if (x[ix] < y[iy]) {
			y[iy] -= x[ix];
			x[ix] = 0;
			used[ix] = true;
			++ix;
		}
	}

	int res = size_y;
	for (int i = 0; i < N; ++i) {
		if (used[i]) { ++res; }
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 3328
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_sz_asc(const void* a, const void* b) {
    return *((size_t*)a) < *((size_t*)b) ? -1 : 1;
}

int compare_sz_desc(const void* a, const void* b) {
    return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}

int compare_i64_asc(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_i64_desc(const void* a, const void* b) {
    return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1;
}

int compare_c_asc(const void* a, const void* b) {
    return *((char*)a) < *((char*)b) ? -1 : 1;
}

int compare_c_desc(const void* a, const void* b) {
    return *((char*)a) > * ((char*)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
    size_t result = 1;

    for (size_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
    uint64_t result = 1;

    for (uint64_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static size_t gcdZu(size_t m, size_t n) {
    size_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static uint64_t gcdU64(uint64_t m, uint64_t n)
{
    uint64_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

int main(void) {
    int32_t A,B,C;

    scanf("%"PRId32" %"PRId32" %"PRId32, &A, &B, &C);

    printf("%"PRId32, A == B ? C : (B == C ? A : B));

    return 0;
}


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

#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define NP next_permutation
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;

const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;

template<class T> bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T> void decimal(T a){cout<<fixed<<setprecision(a);}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}

void YesNo(bool a){if(a) out("Yes"); else out("No");}
void yesno(bool a){if(a) out("yes"); else out("no");}
void YESNO(bool a){if(a) out("YES"); else out("NO");}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){ll c=1; while(b>0){if(b&1){c=a*c %mod;}a=a*a %mod;b>>=1;}return c;}
vi calc(ll x){vi res; while(x>0){res.pb(x%10);x/=10;}reverse(all(res)); return res;}

void solve() {
  int n,m;
  cin>>n;
  vector<string> s(n);
  rep(i,n) cin>>s[i];
  cin>>m;
  vector<string> t(m);
  rep(i,m) cin>>t[i];
  int ans=0; //変なこと言う
  string test;
  int p;
  rep(i,n){
    p=0;
    test=s[i];
    rep(a,n) if(test==s[a]) p++;
    rep(a,m) if(test==t[a]) p--;
    chmax(ans,p);
  }
  rep(i,m){
    p=0;
    test=t[i];
    rep(a,n) if(test==s[a]) p++;
    rep(a,m) if(test==t[a]) p--;
    chmax(ans,p);
  }
  out(ans);
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(2)<<(x)
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inf std::numeric_limits<int>::max();
#define highest_2_pow(n)  __builtin_clzll((long long)0)- __builtin_clzll((long long)n) - 1
//-----------------------------------------------------------------------------------------------------
#define lli long long int 
#define int long long
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define vi vector<int>
#define vlli vector<long long int>
#define si set<int>
#define slli set<long long int>
#define mt make_tuple
#define mp make_pair
#define eb emplace_back
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
//---------------------------------------------------
using namespace std;
// GCD and LCM are available
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}

void faster(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
void solve(){
    // int mynumber = 100;
    // cout<<setfill('0')<<setw(6)<< mynumber<<endl; 
    // cout<<setfill('0')<<setw(4)<< mynumber;
    int n,m;
    cin>>m>>n;
    vector< vector<pii> > vs(m+1);
    vector<pii> ans;
    int pi,yi;
    rep(i,0,n){
        cin>>pi>>yi;
        vs[pi].push_back({yi,i});
        ans.push_back(mp(pi,0));
    }
    rep(i,1,m+1){
        sort(all(vs[i]));
    }
    rep(i,1,m+1){
        rep(j,0,vs[i].size()){
            pii e = vs[i][j];
            ans[e.sc].sc = j+1;
        }
    }
    for(auto e:ans){
        cout<<setfill('0')<<setw(6)<<e.fr;
        cout<<setfill('0')<<setw(6)<<e.sc<<endl;
    }


}
signed main()
{
    faster();
    int t=1;
    //cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 8688
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  string color;
  int flag = 0;
  for (int i=0;i<n;i++){
    cin >> color;
    if (color == "Y")
    flag +=1;
  }
  if(flag !=0){
    cout << "Four" <<endl;
  }else{
    cout <<"Three" <<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int MAX = 100;
int main() {
  int n;
  cin >> n;
  vector<int> ans(n);
  rep(i,MAX)rep(j,MAX)rep(k,MAX){
    int x=i+1,y=j+1,z=k+1;
    int v=x*x+y*y+z*z+x*y+y*z+z*x;
    if(v<=n)++ans[v-1];
  }
  rep(i,n) cout << ans[i] << endl;
}


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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/f.in", "r", stdin);
//  freopen("../IO/f.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}

struct point_t {
  int x, y;
  point_t() = default;
  point_t(int x, int y) : x(x), y(y) {}
  int quad() const {
    return y > 0 || (y >= 0 && x >= 0);
  }
  int64_t abs2() const {
    return (int64_t) x * x + (int64_t) y * y;
  }
  int64_t dot(point_t rhs) const {
    return (int64_t) x * rhs.x + (int64_t) y * rhs.y;
  }
  int64_t det(point_t rhs) const {
    return (int64_t) x * rhs.y - (int64_t) y * rhs.x;
  }
};

struct PolarAngleComparator {
  bool operator()(point_t a, point_t b) const {
    int c1 = a.quad(), c2 = b.quad();
    if (c1 != c2) {
      return c1 > c2;
    }
    auto orientation = a.det(b);
    if (orientation == 0) {
      return a.abs2() < b.abs2();
    } else {
      return orientation > 0;
    }
  }
};

void solve(std::istream &in, std::ostream &out) {
  int n;
  in >> n;
  vector<point_t> points(n);
  for (point_t &point : points) {
    in >> point.x >> point.y;
  }
  sort(points.begin(), points.end(), PolarAngleComparator());
  int64_t result = 0;
  int64_t sx = 0, sy = 0;
  for (int r = 0, l = 0; l < n; ++l) {
    if (points[l].x == 0 && points[l].y == 0) {
      continue;
    }
    while (r - l < n && (points[l].det(points[r % n]) > 0 ||
                         (points[l].det(points[r % n]) == 0 && points[l].dot(points[r % n]) >= 0))) {
      sx += points[r % n].x;
      sy += points[r % n].y;
      ++r;
      result = max(result, sx * sx + sy * sy);
    }
    sx -= points[l].x;
    sy -= points[l].y;
    result = max(result, sx * sx + sy * sy);
  }
  out << fixed << setprecision(12) << sqrt(result) << '\n';
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
from collections import deque,defaultdict,Counter

def main():
    N = int(input())
    A = list(map(int,input().split()))
    if N%3 == 0:
        C = Counter(A)
        flag = True
        if len(C) > 3:
            flag = False
        elif len(C) == 3:
            a,b,c = tuple(C.keys())
            for _ in range(3):
                if a^b == c:
                    a,b,c = b,c,a
                else:
                    flag = False
                    break
            if not all(v*3 == N for v in C.values()):
                flag = False
        elif len(C) == 2:
            a,b = tuple(C.keys())
            if a*b == 0:
                if C[0]*3 == N:
                    pass
                else:
                    flag = False
            else:
                flag = False
        else:
            if 0 not in C:
                flag = False
        print('Yes' if flag else 'No')
    else:
        if set(A) == {0}:
            print('Yes')
        else:
            print('No')
if __name__ == '__main__':
    main()

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

int main(){
  int H,W,N;
  cin>>H>>W>>N;
  int Sr,Sc;
  cin>>Sr>>Sc;
  string S,T;
  cin>>S>>T;
  
  int R=Sr,C=Sc;
  bool j=false;
  for(int i=0;i<N;i++){
    if(S[i]=='L'){
      C--;
    }
    if(C==0){
      j=true;
      break;
    }
    if(T[i]=='R'&&C<W){
      C++;
    }
  }
  R=Sr,C=Sc;
  for(int i=0;i<N;i++){
    if(S[i]=='R'){
      C++;
    }
    if(C==W+1){
      j=true;
      break;
    }
    if(T[i]=='L'&&C>1){
      C--;
    }
  }
  R=Sr,C=Sc;
  for(int i=0;i<N;i++){
    if(S[i]=='U'){
      R--;
    }
    if(R==0){
      j=true;
      break;
    }
    if(T[i]=='D'&&R<H){
      R++;
    }
  }
  R=Sr,C=Sc;
  for(int i=0;i<N;i++){
    if(S[i]=='D'){
      R++;
    }
    if(R==H+1){
      j=true;
      break;
    }
    if(T[i]=='U'&&R>1){
      R--;
    }
  }
  if(j)
    cout<<"NO"<<endl;
  else
    cout<<"YES"<<endl;
}

Measured memory_bytes: 776
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <queue>
#include <sstream>
#include <cmath>
#include <functional>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define all(a)  (a).begin(),(a).end()
#define int64 long long
#define debug cerr << __FILE__ << ":" << __LINE__ << endl;
#define INF 2147483647

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
    }
} init;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    for(int i = 0; i < (int) v.size(); i++) {
        ostr << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const map<_K, _V>& v) {
    ostr << "{";
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << (*iter).first << ": " << (*iter).second << ", ";
    }
    ostr << "}";
    return ostr;
}

template <typename _K>
ostream& operator << (ostream& ostr, const set<_K>& v) {
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << *iter << (iter != v.end() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const pair<_K, _V>& v) {
    ostr << v.first << " " << v.second;
    return ostr;
}

int64 powmod(int64 n, int64 count, int64 mod) {
    if (count == 0) return 1;
    if (count % 2 == 0) {
        int64 t = powmod(n, count / 2, mod);
        return t * t % mod;
    }
    return n * powmod(n, count - 1, mod) % mod;
}

int64 ncr(int64 n, int64 r, int64 mod) {
    int64 a;
    if (n < r) a = min(n, r - n);
    else a = min(n - r, r);

    int64 res = 1;
    rep(i, a) {
        res = res * (n - i) % mod;
        res = res * powmod(i + 1, mod - 2, mod) % mod;
    }

    return res;
}

int main() {
    string S;
    cin >> S;
    if (S == "ARC") {
        cout << "ABC" << endl;
    } else {
        cout << "ARC" << endl;
    }
}


Measured memory_bytes: 3648
# -*- coding: utf-8 -*-
"""
Created on Sat Mar  9 21:40:34 2019

@author: iwata
"""

N,M = map(int, input().split())
numlist =[]
money = 0
count = 0
count1 = 0
count2 = 0

for i in range(N):
    AB = list(map(int, input().split()))
    numlist.append(AB)

numlist.sort()

while count < M:
    while numlist[count1][1] > count2:
        money = money + numlist[count1][0]
        count = count + 1
        count2 = count2 + 1
        if count == M:
            break
    count1 = count1 + 1
    count2 = 0
    
print(money)


Measured memory_bytes: 27760
#include <algorithm>
#include <iostream>
#include <cstdio>

int main()
{
    int a = 0, b = 0;
    for (std::cin >> a >> b; a || b ; std::cin >> a >> b)
        if (a > b)
            std::cout << b << " " << a << std::endl;
        else
            std::cout << a << " " << b << std::endl;
    return 0;
}


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

long long gcb(long long a,long long b){
  if(a<b) return a? gcb(a,b%a) : b;
  return b? gcb(b,a%b) : a;
}

int main() {
    int K;
    ll ans = 0;
    cin >> K;
    for(int i=1;i<=K;++i) {
        for(int j=1;j<=K;++j) {
            for(int k=1;k<=K;++k) ans += gcb(gcb(i,j),k);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
//状态:
//题号:
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <iomanip>
#include <cassert>
#include <complex>
#include <functional>
#include <list>
#include <cmath>
using namespace std;
map<int,int> ind;
int n;
int dp[200005],a[200005],from[200005];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=n;i++){
		dp[i]=dp[ind[a[i]-1]]+1;
		from[i]=ind[a[i]-1];
		ind[a[i]]=i; 
	}
	int ans=0,ansi=0;
	for(int i=1;i<=n;i++){
		if(ans<dp[i])ans=dp[i],ansi=i;
	}
	printf("%d\n",n-ans);
	return 0;
}

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

const int MOD = 1000000007;
const int MAX = 5100000;
ll gcd(ll a, ll b) {
    return (b==0) ? a : gcd(b, a%b);
}

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// 以下から
const int MAX_N = 100000;
struct Edge {
    int to;
    int id;
};

const int D = 80 * 160 + 10;
const int D2 = D*2;
typedef bitset<D2> bs;
int a[100][100];
bs dp[90][90];

int main(){
    char c; cin >> c;
    cout << (char)(c+1) << endl;
   
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    int n,k;cin>>n>>k;
    vin v(n);rep(i,n)cin>>v[i];
    int sum,tmp;int m=0;
    rep(i,k+1){//i回取り出す→最大でmin(i,k-i)個しまう
        rep(j,i+1){//左端からj個取り出す
            vin jew;sum=0;
            rep(l,min(j,n)){
                jew.push_back(v[l]);
                sum+=v[l];
            }
            for(int l=n-1;l>=max(j,n-i+j);l--){
                jew.push_back(v[l]);
                sum+=v[l];
            }
            sort(all(jew));
            tmp=jew.size();
            rep(l,min(tmp,min(i,k-i)))if(jew[l]<0)sum-=jew[l];
            m=max(m,sum);
        }
    }
    cout<<m<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

//有向辺(逆に貼って遡る)
typedef struct{
  int f,t; ll c;
}edge;


const int N_MAX = 1010;
const int M_MAX = 2010;
vector<edge> ve;
vector<ll> d(N_MAX,0);
int N,M;

void bellman_ford(int s){
  d = vector<ll>(N_MAX,MIN_LL);
  d[s] = 0;
  int loop=N;
  while(--loop){
    for(edge &e : ve){
      if(d[e.f] == MIN_LL)continue;
      if(d[e.t] < d[e.f] + e.c) d[e.t] = d[e.f] + e.c;
    }
  }
}

bool find_positive_loop(){
  vector<bool> positive(N,false);
  int loop = N;
  while(loop--){
    for(edge &e :ve){
      if(d[e.f] == MIN_LL)continue;
      if(d[e.t] < d[e.f] + e.c){
        d[e.t] = d[e.f] + e.c;
        positive[e.f] = true;
      }
      if(positive[e.f]) positive[e.t] = true;
    }
  }
  return positive[N-1];
}


int main(void){
  SPEEDUP
  cout << setprecision(15);
  cin >> N >> M;
  rep(i,M){
    int x,y;
    ll c;
    cin >> x >> y >> c;
    --x;--y;
    ve.push_back({x,y,c});
  }

  bellman_ford(0);
  ll ans = d[N-1];
  if(find_positive_loop()) cout << "inf" << endl;
  else cout << ans << endl;
  return 0;
}


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



int main(void){
    cin.tie(0);
	ios::sync_with_stdio(false);
  
  int a,b,c;
  cin >> a>>b>>c;
  int d;
  d=c-(a-b);
  if(d<=0){d=0;}
  cout << d << "\n";
  
}

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

int main() {
	int H, W, ans = 0;
	cin >> H >> W;
	vector<pair<int, int>> a;
	for (int i = 0; i < H; ++i) {
		string c;
		cin >> c;
		for (int j = 0; j < W; ++j) {
			if ('B' == c[j]) a.emplace_back(i, j);
		}
	}
	for (int i = 0; i < a.size() - 1; ++i) {
		for (int j = 1 + i; j < a.size(); ++j) ans = max(abs(a[i].first - a[j].first) + abs(a[i].second - a[j].second), ans);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];

int main()
{
    int n,m,k,a,b,x,y,q;
    ll sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n;

    for(int i=1;i<=n;i++)
        cin>>A[i];

    ll res =0;

    for(int i=1;i<=n;i++){
        if(!A[i]){
            res+=(sum>>1);
            sum = 0;
        }
        else sum+=(ll)A[i];
    }

    res+=(sum>>1);

    cout<<res<<"\n";

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array);

int main(){
	
	string s;
	cin>>s;
	IOS
	ll n=sz(s);
	//dbg("dsvds");
	ll power[2000005];
	power[0]=1;
	FOR(i,1,n+1){
		power[i]=(power[i-1]*10)%2019;
	}
	map<ll,ll> mp;
	ll tmp=0;
	ll our;
	fo(i,n){
		our=s[i]-'0';
		tmp=(tmp+our*power[n-1-i])%2019;
		mp[tmp]++;
	}
	ll ans=0;
	ll ho;
	for(auto kk:mp){
		if(kk.second>1){
			ho=kk.second;

			ans=ans+(ho)*(ho-1)/2;

		}
	}
	ans+=mp[0];
	cout<<ans<<endl;



	

}




Measured memory_bytes: 5412
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<double> VL;
typedef vector<string> VS;
typedef vector<PLL> VP;
typedef vector<ll> VLL;
const static int INF = 1000000000;
const static int MOD = 1000000007;
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法(最大公約数)
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision


int main()
{
    int N;
    cin >> N;
    VLL T(N);
    ll ans=1;
    rep(i,N){
        cin >> T[i];
        ans=lcm(ans,T[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <set>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
#include <iomanip>
#include <list>
#include <limits>

using namespace std;

typedef vector<pair<char, int>> vp;

bool myDataSortPredicate(const pair<char, int>& lhs, const pair<char, int>& rhs)
{
	return lhs.second < rhs.second;
}

class cQuickSort
{
	int mn;
	vector<pair<char, int>> m_va, m_vb;
	bool isStable;

public:
	cQuickSort(int n, vp &va)
		: mn(n), isStable(true)
	{
		m_va = m_vb = va;
		sort(m_va, 0, m_va.size() - 1);
		stable_sort(m_vb.begin(), m_vb.end(), myDataSortPredicate);
	}

	int partition(vp &, int, int);
	void sort(vp &, int, int);
	void output();
};

int cQuickSort::partition(vp &va, int p, int r)
{
	int x = va[r].second;
	int i = p - 1;
	for (int j = p; j <= r - 1; ++j)
	{
		if (va[j].second <= x)
		{
			++i;
			swap(va[i], va[j]);
		}
	}
	swap(va[i + 1], va[r]);
	return i + 1;
}

void cQuickSort::sort(vp &va, int p, int r)
{
	if (p < r)
	{
		int q = partition(va, p, r);
		sort(va, p, q - 1);
		sort(va, q + 1, r);
	}
}

void cQuickSort::output()
{
	for (int i = 0; i < m_va.size(); ++i)
	{
		if (m_va[i].first != m_vb[i].first)
		{
			isStable = false;
			break;
		}
	}
	cout << ((isStable) ? string("Stable") : string("Not stable")) << endl;
	for (int i = 0; i < mn; ++i)
	{
		cout << m_va[i].first << " " << m_va[i].second << endl;
	}
}

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

	int n;
	cin >> n;
	cin.ignore();

	char s;
	int a;
	vp va;

	for (int i = 0; i < n; ++i)
	{
		cin >> s >> a;
		va.push_back(pair<char,int>(s,a));
	}

	cQuickSort cqs(n, va);
	cqs.output();

	return 0;
}

Measured memory_bytes: 5820
NKQ = list(map(int,input().split()))
point = [0]*NKQ[0]

for i in range(NKQ[2]):
    A = int(input())
    point[A-1] += 1

for j in range(NKQ[0]):
    if NKQ[1] - NKQ[2] + point[j] > 0:
        print('Yes')
    else:
        print('No')

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define inf (1LL<<61)
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define int long long
#define vi vector<int> 
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >  
#define N 200001
#define mod 1000000007
#define ll long long


int32_t main()
{
    IOS;
   
    int n;
    cin>>n;
    int v[n][n];
    for(int i = 0;i < n;i++)
    {
        for(int j = 0;j < n;j++)
            cin>>v[i][j];
    }
    vector<int> dp((1<<n),0);
    
    for(int i = 0;i < (1<<n) ;i++)
    {
        int s = __builtin_popcount(i);
        for(int j = 0;j < n;j++)
        {
            if(i & (1<<j))
                ;
            else
            {
                if(v[s][j])
                {
                    if(i == 0)
                        dp[(1<<j)] = 1;
                    else
                        dp[i|(1<<j)] = (dp[i|(1<<j)] + dp[i])%mod;
                }
            }
        }
    }
    cout<<dp[(1<<n) - 1];
    return 0;
}

Measured memory_bytes: 16640
def gcd(x, y):
    while (y != 0):
        x, y = y, x%y
    return x

n, k = map(int, input().split())
A = list(map(int, input().split()))
g = A[0]
for a in A:
    g = gcd(g, a)
if k <= max(A) and k%g == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

int main(void) {
  int N, M;
  char **st;
  int *yen, i, j, cnt = 0, max = 0;
  char tmp[11];

  scanf("%d", &N);
  st = (char**)malloc(sizeof(char*) * 200);
  yen = (int*)malloc(sizeof(int) * 200);
  st[cnt] = (char*)malloc(sizeof(char) * 11);
  for (i = 0; i < N; i++) {
    scanf("%s", tmp);
    for (j = 0; j < cnt; j++) {
      if (strcmp(st[j], tmp) == 0) break;
    }
    yen[j]++;
    if (j >= cnt) {
      st[cnt] = (char*)malloc(sizeof(char) * 11);
      strcpy(st[cnt], tmp);
      cnt++;
    }
  }

  scanf("%d", &M);
  for (i = 0; i < M; i++) {
    scanf("%s", tmp);
    for (j = 0; j < cnt; j++) {
      if (strcmp(st[j], tmp) == 0) break;
    }
    yen[j]--;
    if (j >= cnt) {
      st[cnt] = (char*)malloc(sizeof(char) * 11);
      strcpy(st[cnt], tmp);
      cnt++;
    }
  }

  for (i = 0; i < cnt; i++) {
    if (max < yen[i]) max = yen[i];
  }
  printf("%d\n", max);

  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <array>
#include <cstddef>

using ll = long long;
using ull = unsigned long long;
using st = std::size_t;

auto main() -> int {
    std::array<char, 4> pass;
    std::scanf("%s", pass.data());
    for(st i = 0; i < 3; ++i) {
        if(pass[i] == pass[i+1]) {
            std::puts("Bad");
            return 0;
        }
    }
    std::puts("Good");
}

Measured memory_bytes: 128
//i ll be the king
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define rep(n) for(ll i2=0;i2<n;i2++)
#define vmp(v,a,b) v.push_back(make_pair(a,b))
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define aset(a,n,k) for(ll i3=0;i3<n;i3++)a[i3]=k; 	
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define f first
#define s second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_orde(ind)
using namespace std;
int main()
{
	sync;
	ll n,m;
	cin>>n>>m;
	ll arr[n];
	input(arr,n);
	map<ll,ll>mp;
	ll ans=0,sum=0;
	mp[0]++;
	for(ll i=0;i<n;i++)
	{
		sum+=arr[i];
		sum%=m;
		mp[sum%m]++;	
	}
	for(map<ll,ll>::iterator it=mp.begin();it!=mp.end();it++)
	ans+=(it->s*(it->s-1))/2;
	cout<<ans;
}

Measured memory_bytes: 4992
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		int c = stdIn.nextInt();
		
	    if (b >= c) {
	    	System.out.println("delicious");
	    } else if (b < c && (c - b) <= a) {
	    	System.out.println("safe");
	    } else {
	    	System.out.println("dangerous");
	    }
	} 
}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include <iomanip>
using namespace std;


int main(void){
    long int X;
    long Y;
    cin >> X >> Y;
    for(int i = 0; i <= X ; i++){
        if( (Y - (i*4)) % 2 == 0 && (i * 4) + (X - i)*2 == Y ){
            cout << "Yes" << endl;
            //cout << i << ":" <<  X - i << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3644
n,s=map(int,input().split())
a=[int(j)for j in input().split()]
mod=998244353
ans=0
import numpy as np
dp=np.zeros(3001,np.int64)
for i in a:
    dp[0]+=1
    dp[i:]+=dp[:-i].copy()
    dp%=mod
    ans+=dp[s]
    ans%=mod
print(ans)

Measured memory_bytes: 12588
#include <stdio.h>

int main(void){
  long long int l,r,i,j,min=2020;
  scanf("%lld %lld",&l,&r);

  if(r-l>=2019){
    min=0;
  }
  else{
    for(i=l;i<r;i++){
      for(j=i+1;j<=r;j++){
        if(((i*j)%2019)<min){
          min=(i*j)%2019;
        }
      }
    }
  }
  printf("%lld\n",min);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define vec(x) vector<x>
#define IINF INT_MAX
#define LLINF LLONG_MAX
ll gcd(ll a,ll b){while(b){ll tmp = a % b;a = b;b = tmp;}return a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
#define rep(x, y) for(int x = 0; x < (y); x++)
#define REP(x, z, y) for(int x = (z); x < (y); x++)
#define all(x) x.begin(), x.end()
#define split_str(str, sp_word) istringstream stream(str); string res; for(int cnt = 0; getline(stream,res,sp_word); cnt++)
#define digit(x) ((int)log10((double)(x)) + 1)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define out(x) for(auto i : x) cout << i << " "; cout << endl;
#define outln(x) for(auto i : x) cout << i << " " << endl;
#define vec_cpy(to,from) copy(all(to),back_inserter(from))
#define ary_cpy(to,from) memcpy(to, from, sizeof from)
#define MOD = 1000000007; 
#define DEBUG false

int main() {
  int n; cin >> n;
  set<vec(int)> st;
  vec(int) abc(3);
  rep(i,n){
    cin >> abc[0] >> abc[1] >> abc[2];
    sort(all(abc));
    st.insert(abc);
  }
  cout << n - st.size() << endl;
  return 0;
}

Measured memory_bytes: 3248
class UFTree
      def initialize(n)
        @parent = (0...n).to_a
        @rank = Array.new(n, 0)
      end
     
      def find(x)
        return x if @parent[x] == x
        return @parent[x] = find(@parent[x])
      end
     
      def unite(a, b)
        a = find(a)
        b = find(b)
        return if a == b
        if @rank[a] < @rank[b]
          @parent[a] = b
        else
          @parent[b] = a
          @rank[a] += 1 if @rank[a] == @rank[b]
        end
      end
    end
    
    def smaller(a, b)
      a < b ? a : b
    end
    
    N = gets.to_i
    G = []
    G2N = {}
    i = 0
    N.times do
      x = gets.split.map(&:to_i)
      G << x
      G2N[x] = i
      i += 1
    end
     
    Q = []
    H = G.sort{|a, b| a[0] <=> b[0]}
    H.zip(H.drop(1)).take(N - 1).each do |a, b|
      Q << [G2N[a], G2N[b], smaller((a[0] - b[0]).abs, (a[1] - b[1]).abs)]
    end
     
    J = G.sort{|a, b| a[1] <=> b[1]}
    J.zip(J.drop(1)).take(N - 1).each do |a, b|
      Q << [G2N[a], G2N[b], smaller((a[0] - b[0]).abs, (a[1] - b[1]).abs)]
    end
     
    tree = UFTree.new(N)
    cost = 0
    n = 0
    Q.sort!{|a, b| a[2] <=> b[2]}.each do |a, b, c|
      break if n == N
      next if tree.find(a) == tree.find(b)
      cost += c
      tree.unite(a, b)
      n += 1
    end
     
    puts cost

Measured memory_bytes: 33484
n=int(input())
p=list(map(int,input().split()))

count=0
for i in range(n-2):

    if p[i]<p[i+1] and p[i+1]<p[i+2]:
        count+=1
    elif p[i]>p[i+1] and p[i+1]>p[i+2]:
        count+=1
print(count)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;i++)
int main(){
    ll n,a,b,ans=0;
    cin >> n >> a >> b;
    ans=(n/(a+b))*a+min(a,n%(a+b));
  	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int n;
    cin >> n;
    int *p = new int[n];
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    int cnt = 0;
    int min = INT_MAX;
    for (int i = 0; i < n; i++) {
        if (p[i] <= min) {
            min = p[i];
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 4376
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {
	
	int a;
	scanf("%d", &a);
	printyn(a % 10 == 9 || a / 10 == 9);
	
	Please AC;
}


Measured memory_bytes: 256
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll M =1e9+7;
const int N = 1e5+7;
ll ME(ll x,ll n)
{
	ll res=1;
	
	while(n)
	{
		if(n&1)
		res=res*x;

		x=x*x;

		n/=2;

	}

	return res;

}

int main()
{
       
       int n,x,t;
       scf(n),scf(x),scf(t);
       
       int a=(n+x-1)/x;
       
       prin(a*t);
		
	
            
}


Measured memory_bytes: 3824
def cmb1(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 998244353 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


n, a, b, k = map(int, input().split())
mod = 998244353

ans = 0
for i in range(n+1):
    if k - a*i >= 0 and (k - a*i)%b == 0:
        j = (k - a*i)//b
        ans += cmb1(n, i, mod)*cmb1(n, j, mod)
        ans %= mod

print(ans)

Measured memory_bytes: 128780
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);
	        long H = sc.nextInt();	
	        long W = sc.nextInt();	
	        if(H%3==0||W%3==0) {
	        	System.out.println(0);
	        	return;
	        }
	        long ans=1000000000;
	        for(int i=0;i<H;i++) {
	        	long x=W/2;
	        	long a=x*i;
	        	long b=(W-x)*i;
	        	long c=W*(H-i);
	        	long max = Math.max(a, b);
	        	max=Math.max(max, c);
	        	long min = Math.min(a, b);
	        	min =Math.min(min, c);
	        	ans=Math.min(ans,max-min);
	        }
	        for(int i=0;i<W;i++) {
	        	long x=H/2;
	        	long a=x*i;
	        	long b=(H-x)*i;
	        	long c=H*(W-i);
	        	long max = Math.max(a, b);
	        	max=Math.max(max, c);
	        	long min = Math.min(a, b);
	        	min =Math.min(min, c);
	        	ans=Math.min(ans,max-min);
	        }
	        ans=Math.min(ans, H);
	        ans=Math.min(ans, W);
	        
	        
	        System.out.println(ans);
	    }
	}

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

int main(void){
    ll n, t, a;
    cin >> n >> t >> a;

    ld mi = 10000000;
    ll mi_num = 0;
    rep(i, n){
        ll h;
        cin >> h;

        if(mi > abs(a - (t - h * 0.006))){
            mi = abs(a - (t - h * 0.006));
            mi_num = i + 1;
        }
    }

    cout << mi_num << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

int main() {
    vector<int> x;
    int temp = 9;
    REP(i, 5){
        int a;
        cin >> a;

        if(a%10 < temp and a%10 != 0){
            auto it = x.begin();
            it = x.insert(it, a);
            temp = a%10;
        }

        else x.push_back(a);
    }

    int res = 0;
    FORD(i, 4, 1){
        res += ceil((double)x[i]/10)*10;
    }
    res += x[0];
    cout << res << endl;
}

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

using namespace std;

int main() {

	long k,n;

	cin >> k >> n;

	vector<long> a(n);
	vector<long> b(n);

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

	for (int i = 0; i < n-1; i++) {
		b[i]=a[i+1]-a[i];
	}
	b[n - 1] = a[0] + k - a[n - 1];

	cout << k-*max_element(b.begin(),b.end());

	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
//#include <bits/stdc++.h>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<int,int>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()

typedef long long ll;

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "YES" : "NO";
}

int main(){

    int n; cin >> n;
    vi a(n),b(n),c(n);
    
    rep(i,n) scanf("%d",&a[i]);//cin >> a[i];
    rep(i,n) scanf("%d",&b[i]);//cin >> b[i];
    rep(i,n) scanf("%d",&c[i]);//cin >> c[i];
    
    Sort(a);Sort(b);Sort(c);
    
    ll ans = 0;
    rep(i, n){
        ll numa = lower_bound(ALL(a),b[i])-a.begin();
        ll numc = c.end()-upper_bound( ALL(c), b[i]);
        
        ans += numa*numc;
    }

    cout << ans << endl;
    

}






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

int main() {
	string S;
    cin >> S;
    for(int i=0; i<S.size() ; i++){
    	if((i%2==0 && S[i]=='L')||(i%2 ==1 && S[i]=='R')){
    	cout << "No" <<endl;
        return 0;
    	}
    }
  	cout << "Yes" << endl;
  	return 0;
}

Measured memory_bytes: 256