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

int N;
int A[20];
int x[20][20];
int y[20][20];
// "<<"　左シフト演算　
// ">>" 右シフト演算
// "&" AND演算(ビット積)
// "^" 排他的論理和
void input() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
		for (int j = 1; j <= A[i]; j++) {
			cin >> x[i][j] >> y[i][j];
		}
	}
}
int counter(int x) {
	if (x == 0) return 0;
	return counter(x >> 1) + (x & 1); //2進数の並びを、フラグの数の合計にして返すカウンタ関数
}

void solve() {
	input();
	int ans = 0;   

	//, 0 以上 2^N 未満の整数 j が「1 以上 N 以下の整数 k について, 人 k が正直者であることと, 
	//j を 2 進数表記した際に k−1 桁目が 1 であることが同値」という状態を表すことと定義すると, 容易に全ての場合を試すことが出来る。 
	//この手法は bit 全探索と呼ばれる。

	for (int bits = 1; bits < (1 << N);bits++) {//bit全探索　すべての組み合わせ
		bool judge = true;
		for (int i = 1; i <= N; i++) {//A[i]について
			if (!(bits & (1 << (i - 1)))) continue;  //フラグがない
			for (int j = 1; j <= A[i]; j++) { //bitsのi-1番目のフラグがある
				if (((bits >> (x[i][j] - 1)) & 1) ^ y[i][j]) judge = false;  //矛盾がある： 正直者と仮定している中で不親切だという証言があった
			}
		}
		if (judge) ans = max(ans, counter(bits));
	}
	cout << ans << endl;
	return;
}

int main(){
  solve();
  return 0;
}
  
  
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[6] = {0,1,0,-1,1,-1};
const int vy[6] = {1,0,-1,0,1,1};



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

    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i,n){
        cin >> p[i];
    }
    sort(all(p));
    int ans = 0;
    rep(i,k){
        ans += p[i];
    }
    cout << ans << endl;

    cout << endl;
    return 0;
}


Measured memory_bytes: 3656
//let input = "4\n3 8 5 1";

function main(input){
let line1 = input.split("\n")[0];
let line2 = input.split("\n")[1];
let n = parseInt(line1);
let ls = line2.split(" ");
for(let i=0; i<ls.length; i++){
  ls[i] = parseInt(ls[i]);
}

function compareFunc(a, b) {
  return b- a;
} 
ls.sort(compareFunc);

let max = ls[0];
let sum = 0;
  for(let i=1;i<ls.length; i++){
    sum += ls[i];
  }
  let answer="";
  if(max<sum){
    answer="Yes";
  }else{
    answer="No";
  }
console.log(answer)
}

//main(input);
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29468
#include <iostream>
using namespace std;
int main(void){
    int N,D,X,a[110],sum = 0;
    cin >> N >> D >> X;
    for(int i = 0;i < N;i++){
        cin >> a[i];
        for(int j = 0;;j++){
            if(j*a[i] + 1 <= D)sum++;
        else{
            break;
        }
        }
    }
    cout << sum + X<< endl;
    return 0;
}

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

int main()
{
    int H,W;

    while(cin>>H>>W)
    {
        if(H==0 && W==0)
            break;
        for(int i=0; i<H; i++)
        {
            for(int j=0; j<W; j++)
            {
                if(i==0 || j==0 ||
                   i==H-1 || j==W-1)
                    cout<<"#";
                else
                    cout<<".";
            }
            cout<<"\n";
        }
        cout<<"\n";
    }

    return 0;
}



Measured memory_bytes: 3000
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long lli;
lli n,m;
vector<pair<lli,lli> > lr;
template<class T>
class bit : public vector<T> {
private:
    lli n;
public:
    bit():vector<T>(){}
    bit(lli n):vector<T>(n+1,0){
        this->n = n;
    }
    T sum(lli i){
        T s = 0;
        for(;i > 0;i -= i & -i) s += this->at(i);
        return s;
    }
    void add(lli i,T x){
        for(;i <= n;i += i & -i) this->at(i) += x;
    }
};
bit<lli> bitp;
bit<lli> bitm;
int main(int argc, char const *argv[]) {
    cin >> n >> m;
    lr = vector<pair<lli,lli> > (n);
    bitp = bit<lli>(m+1);
    bitm = bit<lli>(m+1);

    for(lli i = 0;i < n;i++){
        cin >> lr[i].first >> lr[i].second;
    }
    sort(lr.begin(),lr.end(),
    [](const pair<lli,lli>& a,const pair<lli,lli>& b)
    {return (a.second-a.first) < (b.second-b.first);});
    auto itr = lr.begin();
    for(lli i = 1;i <= m;i++){
        lli ans = 0;
        while(itr->second - itr->first + 1 < i && itr != lr.end()){
            bitp.add(itr->first,1);
            bitm.add(itr->second,1);
            itr++;
        }
        ans = lr.end() - itr;
        for(lli j = i;j <= m;j+=i){
            ans += bitp.sum(j) - bitm.sum(j-1);
        }
        cout << ans << endl;

    }
    return 0;
}


Measured memory_bytes: 7168
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    //降順
    priority_queue<int> A;
    for (int i=0;i<N;i++){
       int tmp;
       cin >> tmp;
       A.push(tmp);
    }

    for (int i=0;i<M;i++){
        int discount = A.top() / 2;
        A.pop();
        A.push(discount);
    }

    long long int sum =0;
    for (int i=0;i<N;i++){
       sum += A.top(); 
       A.pop();
    }

    cout << sum;
    
}

Measured memory_bytes: 892
N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]

import itertools
import math

count = 0
for u, v in itertools.combinations(X, 2):
  d = 0
  for i in range(D):
    d += abs(u[i] - v[i]) ** 2
  dd = round(math.sqrt(d))
  if d == dd ** 2:
    count += 1

print(count)

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

int main() {
	vector<int> a(3); cin>>a.at(0)>>a.at(1)>>a.at(2);
  	int k; cin>>k;
  	sort(a.begin(),a.end());
  
  	for(int i=0;i<k;i++){
      a.at(2)*=2;
    }
  	cout<<a.at(0)+a.at(1)+a.at(2)<<endl; 	
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,a,b;
    while(~scanf("%d",&n))
    {
        scanf("%d",&a);
        scanf("%d",&b);
        if(n==1)
            printf("Hello World\n");
        if(n==2)
            printf("%d\n",a+b);
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>

using namespace std;

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


    long long b = 0;
    for (int i = 0; i < N; ++i){
        b = A[i] - b;
    }
    long long x = b / 2;


    long long R = x;
    for (int i = 0; i < N; ++i) {
        cout << R << " ";
        R = A[i] - R;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 2048
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
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(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	debug("debug test\n");
   	int n,m;
	vvint d, b;
	initvv(d, 3, 3, 0);
	initvv(b, 3, 3, 0);
	rep(i, 3){
		rep(j, 3){
			cin>>d[i][j];
		}
	}
	cin>>n;
	rep(i, n){
		int a;cin>>a;
		rep(j, 3){
			rep(k, 3){
				if(d[j][k]==a){
					b[j][k] = 1;
				}
			}
		}
	}
	rep(i, 3){
		if(b[0][i]==1&&b[1][i]==1&&b[2][i]==1){cout<<"Yes"<<endl;return 0;}
		if(b[i][0]==1&&b[i][1]==1&&b[i][2]==1){cout<<"Yes"<<endl;return 0;}
	}
	if(b[0][0]==1&&b[1][1]==1&&b[2][2]==1){cout<<"Yes"<<endl;return 0;}
	if(b[0][2]==1&&b[1][1]==1&&b[2][0]==1){cout<<"Yes"<<endl;return 0;}
	cout << "No" << endl;
	return 0;
}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n;
  string s;
  cin >> n >> s;
  if(s.substr(0, n/2) + s.substr(0, n/2) == s) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3620
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

class UnionFind {
	vector<int> data;
public:

	UnionFind(int size = 0) {
		resize(size);
	}
	void resize(int size) {
		data.resize(size, -1);
	}

	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}

	int size(int x) {
		return -data[root(x)];
	}

	void unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y)
			return;

		if (data[y] < data[x])
			swap(x, y);
		data[x] += data[y];
		data[y] = x;
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	int count() {
		int cnt = 0;
		for (int i = 0, n = data.size(); i < n; ++i) {
			if (i == root(i))
				cnt++;
		}
		return cnt;
	}
};

//??????????????????
//??¨?´????????????£?????¨???club[root]???????´?
//?????§????????§?????°???????????£?????´???NG

int club[100001];

int main() {
	int n, m, k, t, a, b, ra, rb;
	cin >> n >> m >> k;
	UnionFind uf(n + 1);
	int i = 1;
	for (; i <= k; ++i) {
		cin >> t >> a >> b;
		ra = uf.root(a);
		if (t == 1) {
			rb = uf.root(b);
			if (club[ra] == 0 && club[rb] > 0)
				club[ra] = club[rb];
			else if (club[rb] == 0 && club[ra] > 0)
				club[rb] = club[ra];
			else if (club[ra] > 0 && club[rb] > 0 && club[ra] != club[rb])
				break;
			uf.unite(a, b);
		}
		else {
			if (club[ra] > 0 && club[ra] != b)
				break;
			club[ra] = b;
		}
	}

	cout << (i - 1 == k ? 0 : i) << endl;

	return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
using LL  = long long;
using VI  = vector<LL>;
using VVI = vector<VI>;
using VB  = vector<bool>;
using VS  = vector<string>;
using PII = pair<LL, LL>;
using VP  = vector<PII>;
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first < y.first;});
#define FRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first > y.first;});
#define SSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second < y.second;});
#define SRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second > y.second;});
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define $(x) {cout << #x << " = " << (x) << endl;}


int main() {
    LL N, W;
    cin >> N >> W;
    VI w(N + 1), v(N + 1);
    LL V = 0;
    FOR(i, 1, N + 1) {
        cin >> w[i] >> v[i];
        V += v[i];
    }

    VVI dp(N + 1, VI(V + 1, W + 1));
    dp[0][0] = 0;
    REP(i, N) {
        REP(j, V + 1) {
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
            if (j + v[i + 1] <= V) {
                dp[i + 1][j + v[i + 1]] = min(dp[i + 1][j + v[i + 1]], dp[i][j] + w[i + 1]);
            }
        }
    }

    /*
    REP(i, N + 1) {
        REP(j, V + 1) {
            if (dp[i][j] == LLONG_MAX) {
                cout << "- ";
            } else {
                cout << dp[i][j] << " ";
            }
        }
        cout << endl;
    }
    */

    for (LL j = V; j >= 0; --j) {
        LL min_w = LLONG_MAX;
        REP(i, N + 1) min_w = min(min_w, dp[i][j]);
        if (min_w <= W) {
            cout << j << endl;
            break;
        }
    }
	
    return 0;
}


Measured memory_bytes: 80256
n = int(input())

A = [""]

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

# print(A)

for i in range(1, len(A)):
    print("node {}: key = {},".format(i, A[i]), end = " ")

    if i != 1:
        print("parent key = {},".format(A[i//2]), end = " ")
    
    if 2 * i + 1 < len(A):
        print("left key = {}, right key = {},".format(A[2 * i], A[2 * i + 1]), end = " ")

    elif 2 * i + 1 == len(A):
        print("left key = {},".format(A[2 * i]), end = " ")

    print("")
   
"""
5 
7 8 1 2 3
"""


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

int main() {
    int n, m;
    cin >> n >> m;
    int n_ = n*(n-1)/2;
    int m_ = m*(m-1)/2;
    cout << n_+m_ << endl;
}

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



int main() {
    int r;
    cin >> r;
    
    cout << 3 * r * r << endl;
    
    
    
    return 0;
}




Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

bool input_check(std::string& input);
std::vector<int> count_alphabet(std::string sentence);
void output(std::vector<int> answer);

int main()
{
	std::string input;
	std::string sentence;

	while (input_check(input))
	{
		sentence += input;
	}

	std::vector<int> count_alp = count_alphabet(sentence);
	output(count_alp);
}

bool input_check(std::string& input)
{
	bool check;
	getline(std::cin, input);
	if (input != "")
	{
		check = true;
	}
	else
	{
		check = false;
	}
	return check;
}


std::vector<int> count_alphabet(std::string sentence)
{
	std::vector<int> count_alp(26,0);
	std::transform(sentence.begin(), sentence.end(), sentence.begin(), toupper);
	size_t size = sentence.size();
	for (int i = 0; i < size; i++)
	{
		if (sentence[i] >= 65 && sentence[i] <= 90)
		{
			count_alp[sentence[i] - 'A'] += 1;
		}
	}
	return count_alp;
}

void output(std::vector<int> answer)
{
	size_t size = answer.size();
	for (int i = 0; i < size; i++)
	{
		char alp = 'a' + i;
		std::cout << alp << " : " << answer[i] << std::endl;
	}
}



Measured memory_bytes: 3160
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	int r,g,b;
	cin>>r>>g>>b;
	cout<<((r*100+g*10+b)%4==0?"YES":"NO");
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

int main()
{
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  
  while(1)
  {
    c=c-b;
    if(c<=0)
    {
      cout<<"Yes"<<endl;
      break;
    }
    a=a-d;
    if(a<=0)
    {
      cout<<"No"<<endl;
      break;
    }
  }
}

Measured memory_bytes: 3636
#include <stdio.h>

int main(int argc, char *argv[]){
    
int a,b,c;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  

  if( a<b && b<c ){
   printf("Yes\n");
}
else
   printf("No\n");     

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++)
    cin >> d[i];

  sort(d.begin(), d.end(), greater<int>());

  int cnt = 1;
  int pre = d[0];
  for (int i = 1; i < n; i++) {
    if (pre <= d[i]) { continue; }
    pre = d[i];
    cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

a,v=mp()
b,w=mp()
t=int(input())
if b-w*t>=a-v*t and a+v*t>=b+w*t:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 10460
class UnionFindNode:
    def __init__(self, group_id, parent=None, value=None):
        self.group_id_ = group_id
        self.parent_ = parent
        self.value = value
        self.rank_ = 1
        self.member_num_ = 1

    def is_root(self):
        return not self.parent_

    def root(self):
        parent = self
        while not parent.is_root():
            parent = parent.parent_
            self.parent_ = parent
        return parent

    def find(self):
        root = self.root()
        return root.group_id_

    def rank(self):
        root = self.root()
        return root.rank_

    def unite(self, unite_node):
        root = self.root()
        unite_root = unite_node.root()

        if root.group_id_ != unite_root.group_id_:
            if root.rank() > unite_root.rank():
                unite_root.parent_ = root
                root.rank_ = max(root.rank_, unite_root.rank_ + 1)
                root.member_num_ = root.member_num_ + unite_root.member_num_
            else:
                root.parent_ = unite_root
                unite_root.rank_ = max(root.rank_ + 1, unite_root.rank_)
                unite_root.member_num_ = root.member_num_ + unite_root.member_num_


if __name__ == "__main__":
    N,M,Q=[int(i) for i in input().strip().split(" ")]
    node_list = [UnionFindNode(i) for i in range(N)]
    import sys
    es = set()
    for line in sys.stdin:
        x,y,z=[int(i) for i in line.strip().split(" ")]
        if z == 0:
            node_list[x].unite(node_list[y])
        else:
            es.add((x,y))
    if M == N-1:
        if len(es):
            print("No")
            sys.exit()
    for e in es:
        if node_list[e[0]].root() == node_list[e[1]].root():
            print("No")
            sys.exit()
    counter = 0
    b = 0
    for node in node_list:
        if node.is_root():
            counter += 1
            b += node.root().member_num_ - 1
    if M<=b+((counter)*(counter-1)//2):
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 50236
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

	int n,k,s;
	cin>>n>>k>>s;

	vector<int> res;
	for(int i=0;i<k;i++)
		res.push_back(s);

	if(s==1e9)
	{
		while(res.size()<n)
			res.push_back(1);
	}
	else
	{
		while(res.size()<n)
			res.push_back(1e9);
	}

	for(int i=0;i<n;i++)
		cout<<res[i]<<(i==n-1?"\n":" ");

	return 0;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_H = (int)(1e3 + 5);
const int MAX_W = (int)(1e3 + 5);

int h, w;
char a[MAX_H][MAX_W];

int ans;

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

bool check() {
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (a[i][j] == '.') {
        return false;
      }
    }
  }
  return true;
}

int main(void) {
  // Here your code !
  scanf("%d %d", &h, &w);

  for (int i = 0; i < h; ++i) {
    scanf("%s", &(a[i]));
  }

  queue<pair<int, int>> que;

  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (a[i][j] == '#') que.push(make_pair(i, j));
    }
  }

  // for (int i = 0; i < h; ++i) {
  //   for (int j = 0; j < w; ++j) {
  //     printf("%c", a[0][i][j]);
  //   }
  //   printf("\n");
  // }

  int cnt = 0;

  if (check()) {
    printf("%d\n", 0);
    return 0;
  }

  for (int i = 0;; ++i) {
    // printf("%d\n", i);

    // for (int i = 0; i < h; ++i) {
    //   for (int j = 0; j < w; ++j) {
    //     printf("%c", a[i][j]);
    //   }
    //   printf("\n");
    // }

    if (cnt == h * w) {
      ans = i;
      break;
    }

    queue<pair<int, int>> que_next;

    while (!que.empty()) {
      auto cur = que.front();
      que.pop();

      int cur_i = cur.first;
      int cur_j = cur.second;

      cnt += 1;

      for (int k = 0; k < 4; ++k) {
        int ni = cur_i + dx[k];
        int nj = cur_j + dy[k];

        if (a[ni][nj] == '#') continue;
        if (!(0 <= ni && ni < h && 0 <= nj && nj < w)) continue;

        a[ni][nj] = '#';
        que_next.push(make_pair(ni, nj));
      }
    }

    que = que_next;
  }

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

  return 0;
}


Measured memory_bytes: 9600
#include <stdio.h>

int main(int argc, char *argv[])
{
	int n;
	scanf("%d", &n);
	int a[n];
	int tmp, cnt = 0;
	while (cnt < n)
	{
		scanf("%d", &tmp);
		a[cnt] = tmp;
		cnt++;
	}

	if (n % 2 == 0)
	{
		cnt = 0;
		while (cnt < n / 2)
		{
			int tmpNum = a[cnt];
			a[cnt] = a[n - cnt - 1];
			a[n - cnt - 1] = tmpNum;
			cnt++;
		}
	}
	else
	{
		cnt = 0;
		while (cnt < n / 2)
		{
			int tmpNum = a[cnt];
			a[cnt] = a[n - cnt - 1];
			a[n - cnt - 1] = tmpNum;
			cnt++;
		}
	}

	cnt = 0;
	while (cnt < n)
	{
		printf("%d", a[cnt]);
		cnt++;
		if (cnt < n)
		{
			printf(" ");
		}
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2040
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>

using namespace std;
int N;

long gcd(long a, long b) {
  long r = 1;
  while (r != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}

long lcm(long a, long b) {
  return a/gcd(a,b)*b;
}

int main() {
  cin >> N;
  vector<long> T(N);

  for (int i=0; i<N; i++) {
    cin >> T.at(i);
  }
  sort(T.rbegin(), T.rend());
  long ans = 1;
  for (int i=0; i<N; i++) {
    ans = lcm(ans, T.at(i));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
'use strict'
function Main(input){
  input=input.trim().split(/\n/);
  var N=input[0]-0,S=input[1].split(''),K=input[2]-0;
  var e=S[K-1];
  var ans=S.map(x=>x===e?e:'*').join('');
  console.log(ans);
}

Main(require('fs').readFileSync('/dev/stdin','utf8'));


Measured memory_bytes: 7372
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

int main() {
  int N, M;
  cin >> N;
  vector<string> s(N);
  for (int i = 0; i < N; i++) {
    cin >> s[i];
  }
  sort(s.begin(), s.end());
  vector<string> s_copy = s;
  decltype(s)::iterator result = unique(s.begin(), s.end());
  s.erase(result, s.end());
  cin >> M;
  vector<string> t(M);
  for (int i = 0; i < M; i++) {
    cin >> t[i];
  }
  int amount = -100;
  int num_in_s, num_in_t, tmp;
  for (int i = 0; i < s.size(); i++) {
    num_in_s = count(s_copy.begin(), s_copy.end(), s[i]);
    num_in_t = count(t.begin(), t.end(), s[i]);
    tmp = num_in_s - num_in_t;
    if (tmp > amount) {
      amount = tmp;
    }
  }
  if (amount < 0) {
    amount = 0;
  }
  cout << amount << endl;
  return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define COUT(x) cout<<x<<endl

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double PI = acos(-1.0);
const LL MOD = 1e9 + 7;
const ULL INF = 1e18;
const int dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };

//function
//--------------------------------------------
LL gcd(LL, LL);
bool isEven(LL);
void coutY();
void coutN();
LL ave(LL, LL);
bool isMultiOf(LL, LL);

int main() {
	LL n; cin >> n;
	VLL a(n);
	REP(i, n)cin >> a[i];
	SORT(a);
	REP(i, n) {
		if (i == 0) {
			i++;
		}
		if (a[i] == a[i - 1]) {
			cout << "NO";
			return 0;
		}
	}
	cout << "YES";
}

LL gcd(LL a, LL b) {
	if (a == 0 || b == 0)return 0;
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	else gcd(b, a % b);
}
bool isEven(LL a) {
	return !((bool)(a % 2));
}
void coutY() {
	cout << "Yes" << endl;
	return;
}
void coutN() {
	cout << "No" << endl;
	return;
}
LL ave(LL a, LL b) {
	return (a + b) / 2;
}
bool isMultiOf(LL a, LL b) {
	return a % b == 0;
}

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

int main() {
    int x1, x2, x3, x4, x5;
    cin >> x1 >> x2 >> x3 >> x4 >> x5;
    int ans = 0;
    if (x1 == 0) ans = 1;
    if (x2 == 0) ans = 2;
    if (x3 == 0) ans = 3;
    if (x4 == 0) ans = 4;
    if (x5 == 0) ans = 5;

    cout << ans << endl;
    return 0;
}

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

int main() {
	int a[100000 + 1] = {};

	int n;

	cin >> n;

	for(int i = 0; i < n; i++) {
		int t;
		cin >> t;
		if (n % 2 == 1) {
			if (t % 2 == 1) {
				cout << 0 << endl;
				return 0;
			}
			a[t]++;
			if (a[t] > 2) {
				cout << 0 << endl;
				return 0;				
			}

			if (t == 0 && a[t] > 1) {
				cout << 0 << endl;
				return 0;				
			}
			if (t > n) {
				cout << 0 << endl;
				return 0;				
			}
		} else {

			if (t % 2 == 0) {
				cout << 0 << endl;
				return 0;
			}
			a[t]++;
			if (a[t] > 2) {
				cout << 0 << endl;
				return 0;				
			}
			if (t > n) {
				cout << 0 << endl;
				return 0;				
			}
		}
	}

	long long ans = 1;
	for (int i = 0; i < n / 2; i++) {
		ans = (ans * 2) % 1000000007;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;
int main() {
    long long H, W;
    cin >> H >> W;

    if (H == 1 || W == 1) {
        cout << 1 << endl;
        return 0;
    }
    cout << H * W / 2 + (H * W)%2 << endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

const i32 mod = 998244353;

i32 mod_pow (i32 r, i32 n) {
  i32 t = 1;
  i32 s = r;
  while (n > 0) {
    if (n & 1) t = (i64) t * s % mod;
    s = (i64) s * s % mod;
    n >>= 1;
  }
  return t;
}

i32 inv (i32 a) {
  return mod_pow (a, mod - 2);
}

i32 *fact = NULL;
i32 *iFact = NULL;
void init_fact (const i32 n) {
  fact = (i32 *) calloc (n + 1, sizeof (i32));
  fact[0] = 1;
  for (i32 i = 1; i <= n; ++i) {
    fact[i] = (i64) i * fact[i - 1] % mod;
  }
  iFact = (i32 *) calloc (n + 1, sizeof (i32));
  iFact[n] = inv (fact[n]);
  for (i32 i = n - 1; i >= 0; --i) {
    iFact[i] = (i64) (i + 1) * iFact[i + 1] % mod;
  }
}

i32 comb (i32 n, i32 k) {
  if (!(0 <= k && k <= n)) return 0;
  return (i64) fact[n] * iFact[k] % mod * iFact[n - k] % mod;
}

void run (void) {
  i32 k, n;
  scanf ("%" SCNi32 "%" SCNi32, &k, &n);
  init_fact (n + k);
  for (i32 i = 2; i <= 2 * k; ++i) {
    i32 c = 0;
    for (i32 j = 1, l = i - 1; j <= l; ++j, --l) {
      c += j <= k && l <= k ? 1 : 0;
    }
    i32 ans = 0;
    for (i32 j = 0; j <= c; ++j) {
      i32 way = (i64) comb (c, j) * mod_pow (2, j) % mod;
      ans = (ans + (i64) way * comb (n - j + (k - (2 * c - j)) - 1, n - j)) % mod;
    }
    printf ("%" PRIi32 "\n", ans);
  }
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 256
/*In the name of ALLAH, Most Gracious, Most Merciful*/
#include<bits/stdc++.h>

#define ll                      long long int
#define ull                     unsigned long long int
#define PI                      2*acos(0.0)
#define sqr(x)                  (x)*(x)
#define EPS                     10E-10
#define MOD                     1000000007
#define longlimit               92233720368547758
#define infinity                (1<<28)
#define setbits                 __builtin_popcount
#define zerobits                __builtin_ctzll
#define parity(n)               __builtin_parity(n)
#define pb(a)                   emplace_back(a)
#define mp                      make_pair
#define ff                      first
#define ss                      second
#define gcd(a, b)               __gcd(a,b)
#define lcm(a, b)               ((a)*(b))/gcd(a,b)
#define watch(x)                cout << (#x) << " is " << (x) << endl
#define TEST_CASES()            ll t;cin>>t;while (t--)
#define PRECISION(a,x)          fixed<<setprecision(x)<<a<<endl;
#define endl                    "\n"
#define all(a)                  (a.begin()),(a.end())
#define UNIQUE(X)               (X).erase(unique(all(X)),(X).end())
#define DELETE(X)               (X).erase (remove (all(X)),(X).end())
#define SORT_UNIQUE(c)          (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define FAST_IO()               ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define FILE_IO()               freopen("output.txt", "w", stdout);freopen("input.txt", "r", stdin)
using namespace std;


void solve()
{
    ll n;cin>>n;
    string s;
    cin>>s;
    map<char,char>m;
    for (int i=0;i<26;i++)m[i+'A']='A'+((i+n)%26);
    for (int i=0;s[i];i++)cout<<m[s[i]];

}

int32_t main()
{
    FAST_IO();
    //TEST_CASES()
        solve();
}




Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from functools import reduce, lru_cache
import collections, heapq, itertools, bisect
import math, fractions
import sys, copy

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline().rstrip())
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline().rstrip())
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIR1(n): return [LI1() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    A, B = LI()

    for i in range(1, 2000):
        if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B:
            print(i)
            break
    else:
        print(-1)


if __name__ == '__main__':
    main()

Measured memory_bytes: 77276
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long L, R, mod;cin >> L >> R;
  if((R-L) >= 2019){
    cout << "0" <<endl;
    return 0;
  }
  mod = 2019;
  L %= mod;
  R %= mod;
  long long mini = 1000000000;
  for(int i=L;i<R;i++){
    for(int j=i+1;j<=R;j++){
      mini = min(mini, i*j %mod);
    }
  }
  cout << mini <<endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
        #pragma comment(linker, "/stack:200000000")
        #pragma GCC optimize("unroll-loops")
         
        #include <algorithm>
        #include <bitset>
        #include <cassert>
        #include <chrono>
        #include <cmath>
        #include <complex>
        #include <cstdio>
        #include <cstdlib>
        #include <cstring>
        #include <ctime>
        #include <deque>
        #include <functional>
        #include <iomanip>
        #include <iostream>
        #include <iterator>
        #include <limits>
        #include <climits>
        #include <list>
        #include <map>
        #include <numeric>
        #include <queue>
        #include <random>
        #include <ratio>
        #include <set>
        #include <sstream>
        #include <stack>
        #include <string>
        #include <unordered_map>
        #include <unordered_set>
        #include <utility>
        #include <vector>
        using namespace std;
         
        typedef long long ll;
        typedef long double LD;
        #define int ll
        #define double LD
        #define pb push_back
        #define mp make_pair
        #define REP(i,n) for (int i = 0; i < n; i++)
        #define loop(i,n) for (int i = 0; i < n; i++)
        #define FOR(i,a,b) for (int i = a; i < b; i++)
        #define REPD(i,n) for (int i = n-1; i >= 0; i--)
        #define FORD(i,a,b) for (int i = a; i >= b; i--)
        #define remax(a,b) a = max(a,b)
        #define remin(a,b) a = min(a,b)
        #define mem(a, b) memset(a, b, sizeof a)
        #define append push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define print(x) cout << (x) << endl
        #define PRECISION(x) cout << fixed << setprecision(x)
        #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
        #define N 300010
        #define pb push_back
        const double PI=acos(-1);
        const int MOD = 1000000007;
        const int FMOD = 998244353;
        const double eps = 1e-9;
         
        mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());
        
        
        
        void solve(int n) 
{ 
    int arr[10000]; 
    int i = 0; 
  
    while (n) { 
        arr[i] = n % 26; 
        n = n / 26; 
        i++; 
    } 
  
    for (int j = 0; j < i - 1; j++) { 
        if (arr[j] <= 0) { 
            arr[j] += 26; 
            arr[j + 1] = arr[j + 1] - 1; 
        } 
    } 
  
    for (int j = i; j >= 0; j--) { 
        if (arr[j] > 0) 
            cout << char('a' + arr[j] - 1); 
    } 
  
    cout << endl; 
} 
        signed main()
        {
        	int n;
        	cin>>n;
        	
        	solve(n);
		}

Measured memory_bytes: 3612
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN=110000;
const int INF=0X3F3F3F3F;
int h[MAXN], f[MAXN];
int main()
{
//	freopen("B.in", "r", stdin);
//	freopen("B.out", "w", stdout);
	int n, k;
	scanf("%d%d", &n, &k);
	for (int i=1; i<=n; i++) scanf("%d", &h[i]);
	f[1]=0;
	for (int i=2; i<=n; i++)
	{
		f[i]=INF;
		for (int j=1; j<=k&&j<i; j++)
			f[i]=min(f[i], f[i-j]+abs(h[i]-h[i-j]));
	}
	printf("%d\n", f[n]);
	return 0;
}

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

//定数
const long long MOD1=1000000007;
const long long MOD2=998244353;
const long double PI=3.1415926535897932;
const long long MAXLL=9223372036854775807;
const long long INF=2305843009213693951;
const long long dx[]={0,1,0,-1,1,-1,1,-1};
const long long dy[]={1,0,-1,0,1,1,-1,-1};

//型名省略
#define ll long long
#define ull unsigned long long
#define ld long double
#define uld unsigned long double
#define pll pair<long long,long long>
#define tll(n) array<long long,(int)(n)>
#define pcc pair<char,char>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<pair<long long,long long>>
#define vt(n) vector<array<long long,(int)(n)>>
#define umap unordered_map
#define uset unordered_set
#define Lqueue priority_queue<long long>
#define Squeue priority_queue<long long,vector<long long>,greater<long long>>
#define Fi first
#define Se second
#define mp make_pair
#define eb emplace_back

//マクロ
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rbf(a,x) for(auto& a:x)
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s);i<(long long)(n);i++)
#define Maxe(x) *max_element((x).begin(),(x).end())
#define Mine(x) *min_element((x).begin(),(x).end())
#define Size(x) ((long long)(x).size())
#define lin(s) getline(cin,(s))

//MAX,MIN
template<class T,class U> auto max(T a,U b){return a>b?a:b;}
template<class T,class U> auto min(T a,U b){return a<b?a:b;}

//最大公約数,最小公倍数
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a,long long b){return a/gcd(a,b)*b;}

//累乗
template<typename t>
constexpr t mypow(t a,long long b){
    if(b==0)return 1;
    if(a==0)return 0;
    t x=1;
    while(b>0){
        if(b&1LL)x*=a;
        a*=a;
        b>>=1LL;
        }
    return x;
}
#define pow mypow

//chmin,chmax
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;}

//組み合わせ O(r)
template<typename t>
constexpr t nCr(t n,long long r){
    if(r==0)return 1;
    if(n==0)return 0;
    if(n<r)return 0;
    t x=1;
    for(long long i=1;i<=r;i++){
        x*=n-i+1;
        x/=i;
    }
    return x;
}

//main関数
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    string s;
    cin>>n>>s;
    ll res=0;
    rep(i,n-2){
        if(s.substr(i,3)=="ABC")res++;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define pb push_back
#define all(v) (v.begin(),v.end())
#define mp make_pair



int main()
{
    string a,b;
    cin>>a>>b;
    cout<<b<<a<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=b-1;i>=a;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
//constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}



int main(){
  string S;ll K;
  cin >> K >> S;
  if(S.size()<=K){
    cout<< S << endl;
  }
  else{
    rep(i,K){
      cout << S[i];
    }
    cout << "..."<<endl;
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int n;
string s;
int cnt[2019];
int main(){
    cin>>s;
    n=s.size();
    reverse(s.begin(),s.end());
    cnt[0]=1;
    ll ans=0;
    int cur=0,p10=1;
    rep(i,n){
        cur=p10*(s[i]-'0')+cur;
        cur%=2019;
        p10*=10;p10%=2019;
        ans+=cnt[cur];
        ++cnt[cur];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3740
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <functional>
#include <utility>
#define INF 9999999
using namespace std;
typedef unsigned long long int ll;

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	a.push_back(-1);
	int ans = 0;
	for (int i = 1; i < N; i++) {
		if (a[i - 1] == a[i]) {
			for (int j = 0; ; j++) {
				if (j != a[i - 1] && j != a[i] && j != a[i + 1]) {
					a[i] = j;
					ans++;
					break;
				}
			}
		}
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define MAX 500005
using namespace std;

int n;
int a[15];

int main(){
//    for(int t = 1; t <= 200; t++){
        cin>>n;
//    n = t;
        memset(a, 0, sizeof(a));
    int i = 1, now = 1;
    while(n){
        a[i]++;
        if(a[i] > 9 || (a[i] > a[i+1]+1 && i+1 <= now) || (i > 1 && a[i] > a[i-1])){
            while(a[i] > 9 || (a[i] > a[i+1]+1 && i+1 <= now) || (i > 1 && a[i] > a[i-1])) a[i+1]++, i++;
            now = max(now, i);
            for(int j = i-1; j >= 1; j--){
                a[j] = max(a[j+1]-1, 0);
            }
            i = 1;
        }
        n--;
    }

    int j = 10;
    while(!a[j]) j--;
    for(int i = j; i >= 1; i--){
        cout<<a[i];
    }
    puts("");
//}

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>

using ll = long long;

ll n, m;
std::vector<ll> v[100005];
std::priority_queue<ll> q;

int main(void)
{
	std::cin >> n >> m;
	ll a, b;
	for (int i = 1; i <= n; i++) {
		std::cin >> a >> b;
		v[a].push_back(b);
	}

	ll ans = 0;
	for (int i = 1; i <= m; i++) {

		for (int j = 0; j < v[i].size(); j++) q.push(v[i][j]);
		if (q.size() > 0) ans += q.top(),q.pop();
		
	}
	std::cout << ans << std::endl;

	return 0;
}


Measured memory_bytes: 5632
#include <stdio.h>

int main(){
  int w, d, sumw=0, sumd=0, x, y, j, k, ans;
  int hw[10], hd[10];
  scanf("%d %d", &w, &d);
  while(w!=0)
    {
      for(x=0;x<w;x++)
        {
          scanf("%d", &hw[x]);
          sumw = sumw + hw[x];
        }
      for(y=0;y<d;y++)
        {
          scanf("%d", &hd[y]);
          sumd = sumd + hd[y];
        }
      for(j=0; j<w; j++)
        {
          for(k=0; k<d; k++)
            {
              if(hw[j] == hd[k])
                {
                  hw[j] = 0;
                  hd[k] = 0;
                  break;
                }
            }
        }
      if(sumw >= sumd)
        {
          sumw = 0;
          for(x=0;x<w;x++)
            {
              sumw = sumw + hw[x];
            }
          ans = sumw + sumd;
        }
      else
        {
          sumd = 0;
          for(y=0;y<d;y++)
            {
              sumd = sumd + hd[y];
            }
          ans = sumw + sumd;
        }
      printf("%d\n", ans);
      sumw = 0;
      sumd = 0;
      scanf("%d %d", &w, &d);
    }
  return 0;
}

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

int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	while(1){
		c -= b;
		if(c <= 0){
			cout << "Yes" << endl;
			break;
		}
		a -= d;
		if(a <=0){
			cout << "No" << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3636