akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>

int main(){

    size_t n;
    std::string s;
    std::cin >> n >> s;

    size_t cnt = 0, pos = 0;

    while((pos = s.find("ABC", pos)) != std::string::npos){
        cnt++;
        pos++;
    }

    std::cout << cnt << std::endl;

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
#include <chrono>

#define _ << " " <<
#define all(v) v.begin(), v.end()
#define sp(n) fixed << setprecision(n)
#define ff first
#define ss second

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const ll mod = 1e9 + 7;
const double eps = DBL_EPSILON;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef LOCAL_DEBUG
	freopen("input.txt", "r", stdin);
#endif
	int h, n;
	cin >> h >> n;
	vector<pii> a(n);
	for (pii& i : a) cin >> i.ff >> i.ss;
	vector<ll> dp(h + 1, LLONG_MAX);
	dp[0] = 0;
	for (int i = 1; i <= h; i++) {
		for (int j = 0; j < n; j++) {
			ll c = i - a[j].ff > 0 ? a[j].ss + dp[i - a[j].ff] : a[j].ss;
			dp[i] = min(dp[i], c);
		}
	}
	cout << dp.back();
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pii pair<int, int>
#define pll pair<long long, long long>
#define rep(i,l,r) for(long long i = l;i<r;i++)

#define fastout  ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
using namespace __gnu_pbds;

typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update> order_set;

const int INF = (int)1e9 + 7;
const long long LLINF = (long long)1e18 + 7;

mt19937 mt('O' + '4' + 'K' + 'O');

void kekek()
{
    
    mt();
    #ifdef EB_UG
        freopen("in.txt", "r", stdin), freopen("out.txt", "w", stdout);
    #endif
    #ifndef EB_UG
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    #endif
}

int main() {
    kekek();
    int n, m;
    cin >> n >> m;
    vector<int> nums(n);
    int summ = 0;
    for (int i = 0 ; i < n; ++i) {
        cin >> nums[i];
        summ += nums[i];
    }
    int need = 0;
    for (int i = 0; i < n; i++) {
        if (nums[i] * 4 * m >= summ) {
            need++;
        }
    }
    if (need >= m) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int N;
    cin >> N;
    string S[N];
    rep(i, N) cin >> S[i];
    int now;
    //m[i]:=S[i]が最小でどこまで減るか
    int m[N], a[N], M[N], A[N];
    rep(i, N){
        now = 0;
        m[i] = M[i] = 0;
        rep(j, sz(S[i])){
            if(S[i][j] == '(') now++;
            else now--;
            chmin(m[i], now);
        }
        a[i] = now;
        now = 0;
        rep3(j, sz(S[i])-1, 0){
            if(S[i][j] == ')') now++;
            else now--;
            chmin(M[i], now);
        }
        A[i] = now;
    }
    int sum = 0;
    rep(i, N) sum += a[i];
    if(sum != 0) {cout << "No" << endl; return 0;}
    vector<pii> v1, v2;
    rep(i, N){
        if(a[i] >= 0) v1.pb(pii(m[i], a[i]));
        else v2.pb(pii(M[i], A[i]));
    }
    sort(all(v1), greater<pii>());
    sum = 0;
    for(auto &e: v1){
        if(sum+e.first < 0) {cout << "No" << endl; return 0;}
        sum += e.second;
    }
    sort(all(v2), greater<pii>());
    sum = 0;
    for(auto &e: v2){
        if(sum+e.first < 0) {cout << "No" << endl; return 0;}
        sum += e.second;
    }
    cout << "Yes" << endl;
}

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

using namespace std;

int main() {
	int n, m, t;
	scanf("%d", &n);
	map<int, int> s;
	for (int i = 0; i < n; i++) {
		scanf("%d", &t);
		s[t]++;
	}
	scanf("%d", &m);
	for (int i =0; i < m; i++) {
		scanf("%d", &t);
		if (s[t] <= 0) {
			printf("NO\n");
			return 0;
		}
		s[t]--;
	}
	printf("YES\n");
}

Measured memory_bytes: 9600
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(A[k-1])



Measured memory_bytes: 2940
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 1000000007;

     signed main(){
        int x,n;
        cin>>x>>n;
        if(n==0){
             cout<<x<<endl;
             return 0;
        }
        int p[n];
        for(int i=0;i<n;i++)cin>>p[i];
        
        for(int i=0;i<=100;i++){
             bool t=true;
             for(int j=0;j<n;j++)if(p[j]+i==x){
                  t=false;
                  break;
             }

             if(t){
                  cout<<x-i<<endl;return 0;
             }
             t=true;
             for(int j=0;j<n;j++)if(p[j]-i==x){
                  t=false;
                  break;
             }

             if(t){
                  cout<<x+i<<endl;return 0;
             }
        }

     }


 


 






    





      

        


Measured memory_bytes: 3624
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <string>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	int a,b; cin>>a>>b;
	cout << max(0,a-2*b);


  return 0;
}


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

const int64_t MAX_ROW = 64; // to be set appropriately
const int64_t MAX_COL = 510; // to be set appropriately
struct BitMatrix {
    int H, W;
    bitset<MAX_COL> val[MAX_ROW];
    BitMatrix(int64_t m = 1, int64_t n = 1) : H(m), W(n) {}
    inline bitset<MAX_COL>& operator [] (int64_t i) { return val[i]; }
};

ostream& operator << (ostream& s, BitMatrix A) {
    s << endl;
    for (int64_t i = 0; i < A.H; ++i) {
        for (int64_t j = 0; j < A.W; ++j) {
            s << A[i][j] << ", ";
        }
        s << endl;
    }
    return s;
}

inline BitMatrix operator * (BitMatrix A, BitMatrix B) {
    BitMatrix R(A.H, B.W);
    BitMatrix tB(B.W, B.H);
    for (int64_t i = 0; i < tB.H; ++i) for (int64_t j = 0; j < tB.W; ++j) tB[i][j] = B[j][i];
    for (int64_t i = 0; i < R.H; ++i) for (int64_t j = 0; j < R.W; ++j) R[i][j] = ((A[i] & tB[j]).count() & 1);
    return R;
}

int64_t GaussJordan(BitMatrix &A, bool is_extended = false) {
    int64_t rank = 0;
    for (int64_t col = 0; col < A.W; ++col) {
        if (is_extended && col == A.W - 1) break;
        int64_t pivot = -1;
        for (int64_t row = rank; row < A.H; ++row) {
            if (A[row][col]) {
                pivot = row;
                break;
            }
        }
        if (pivot == -1) continue;
        swap(A[pivot], A[rank]);
        for (int64_t row = 0; row < A.H; ++row) {
            if (row != rank && A[row][col]) A[row] ^= A[rank];
        }
        ++rank;
    }
    return rank;
}

bool check(int64_t x, const vector<int64_t>& v) {
    //xをvのものから適切に選ぶことで排他的論理和を0にできるか
    int64_t N = 63;
    int64_t M = v.size();

    BitMatrix A(N, M + 1);
    for (int64_t i = 0; i < N; i++) {
        for (int64_t j = 0; j < M; j++) {
            A[i][j] = bool(v[j] & (1ull << i));
        }
    }
    for (int64_t i = 0; i < N; i++) {
        A[i][M] = bool(x & (1ull << i));
    }

    int64_t r = GaussJordan(A);

//    cout << A << endl;
//    cout << r << endl;

    for (int64_t i = 0; i < N; i++) {
        if (A[i][M] == 0) {
            continue;
        }

        bool ok = false;
        for (int64_t j = 0; j < M; j++) {
            if (A[i][j] != 0) {
                ok = true;
                break;
            }
        }
        if (!ok) {
            return false;
        }
    }
    return true;


    return r <= M;
}

int main() {
    int64_t T;
    cin >> T;
    for (int64_t _ = 0; _ < T; _++) {
        int64_t N;
        cin >> N;
        vector<int64_t> A(N);
        for (int64_t& a : A) {
            cin >> a;
        }
        string S;
        cin >> S;

        vector<int64_t> v0;
        bool ok = true;
        for (int64_t i = N - 1; i >= 0; i--) {
            if (S[i] == '0') {
                v0.push_back(A[i]);
            } else {
                if (!check(A[i], v0)) {
                    ok = false;
                    break;
                }
            }
        }

        cout << (ok ? 0 : 1) << endl;
    }
}

Measured memory_bytes: 3576
n = int(input())
ans = 0
dic = {}
for i in range(n):
    sorted_s = sorted(input())
    s = ""
    for j in range(10):
        s = s + sorted_s[j]
    
    if s not in dic:
        dic[s] = 1
    else:
        ans += dic[s]
        dic[s] = dic[s] + 1
print(ans)

Measured memory_bytes: 17852
H,W,K=map(int,input().split())
C=[list(input())for _ in range(H)]
S=0
for c in C:
    S+=c.count('#')

ans=0
for i in range(2**H): # 全てのビットを生成するループ
    Bit_i = list(range(1,H+1)) # [1,1,1...]の形でビットを初期化したリスト
    for k in range(H): #　いい感じのビットを生成するループ
        if (i >> k) & 1:
            Bit_i[k]*=-1
    for j in range(2**W): # 全てのビットを生成するループ
        Bit_j = list(range(1,W+1)) # [1,1,1...]の形でビットを初期化したリスト
        for l in range(W): #　いい感じのビットを生成するループ
            if (j >> l) & 1:
                Bit_j[l]*=-1
        count=0
        for a in Bit_i:
            for b in Bit_j:
                if a>0:
                    count+=(C[a-1][abs(b)-1]=='#')
                elif b>0:
                    count+=(C[abs(a)-1][b-1]=='#')
        ans+=(S-count==K)         

print(ans)

Measured memory_bytes: 9124
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let m = 3;
    let mut dp = vec![0; m];
    for _ in 0..n {
        let v: Vec<u32> = (0..m).map(|_| it.next().unwrap().parse().unwrap()).collect();
        let mut next = vec![0; 3];
        for i in 0..3 {
            for j in 0..3 {
                if i == j {
                    continue;
                }
                next[j] = std::cmp::max(next[j], dp[i] + v[j]);
            }
        }
        dp = next;
    }
    let ans = *dp.iter().max().unwrap();
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 6396
#include<bits/stdc++.h>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------

int main(){
    string S;
    cin >> S;
    while(S.size() > 3){
        bool did = false;
        for(int i=1; i<S.size()-3; i++){
            if(S.substr(i,3) == "mew"){
                S.erase(i,3);
                did = true;
            }
        }
        if(!did) break;
    }
    if(S == "mew"){
        cout << "Cat" << enld;
    }else{
        cout << "Rabbit" << enld;
    }
    return 0;
}


Measured memory_bytes: 3172
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    S = input()
    L = len(S)
    ans = 0
    ACGT = ['A', 'C', 'G', 'T']
    tmp = 0
    for i in range(L):
        if S[i] in ACGT:
            tmp += 1
            ans = max(ans, tmp)
        else:
            tmp = 0
    print(ans)

if __name__ == '__main__':
    main()

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

int main() {
  string s,t;
  cin >> s >> t;
  int ans = 0;
  rep(i, 3) {
    if (s.at(i) == t.at(i)) ans++;
  }
  cout << ans;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <cstdio>
using namespace std;
struct nood
{
	int time,end;	
}food[10]; 
bool cmp(nood a,nood b)
{
	if(a.end==0||b.end==0)
		return true;
	else
		return a.end>b.end;
}
int main()
{
	int sum=0;
	for(int i=0;i<5;i++)
	{
		cin>>food[i].time;
		food[i].end=food[i].time%10;
	}
	sort(food,food+5,cmp);
	for(int i=0;i<5;i++)
	{
		sum=sum+food[i].time;
		if(sum%10!=0&&i!=4)
		sum=(sum/10+1)*10;
	}
	cout<<sum;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  int a,b;
  cin >> a >> b;
  int tap = 1;
  int count = 0;
  while(tap<b){
    tap--;
    tap += a;
    count++;
  }
 
  printf("%d",count);
 
}

Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
constexpr uint64_t L1 = 1ull;
constexpr ull bit(int n){ return 1ull << n;}

// for(auto && i : Range(l,r))
// -> i = [l..r)
class Range {
private: struct It{ int x; int operator*(){return x;}
 bool operator!=(It& lhs){ return x<lhs.x;} void operator++(){++x;} }; It l,r;
public: Range(int n):l({0}),r({n}){} Range(int i,int n):l({i}),r({n})
 {}It& begin(){return l;} It& end(){return r;} };

void solve(istream& cin) {
    int N, M;
    while(cin >> N >> M) {
        vector<int> a, b, c, d;
        auto mD = [](int a, int b, int c, int d) { return abs(a - c) + abs(b - d); };
        for (int i = 0; i < N; ++i) {
            int ta, tb;
            cin >> ta >> tb;
            a.push_back(ta);
            b.push_back(tb);
        }
        for (int j = 0; j < M; ++j) {
            int tc, td;
            cin >> tc >> td;
            c.push_back(tc);
            d.push_back(td);
        }
        for (int i = 0; i < N; ++i) {
            int mind = INT32_MAX;
            int minc = 0;
            for (int j = 0; j < M; ++j) {
                int di = mD(a[i], b[i], c[j], d[j]);
                if (di < mind) {
                    mind = di;
                    minc = j + 1;
                }
            }
            cout << minc << endl;
        }
    }
}

int main(int argc, char *argv[]) {
    string FileName("B2"), Modifier("MEPH_");
    string ExecutionName = Modifier + FileName;
    string sub(argv[0]);
    if(sub.size() > ExecutionName.size())
        sub = sub.substr(sub.size()-ExecutionName.size(), ExecutionName.size());
    cerr << sub << endl;
    if (sub != ExecutionName) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        solve(cin);
    }
    else {
        string inFile = "sample.txt";
        auto fs = fstream(inFile, fstream::in);
        solve(fs);
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
int N;
int A[250000], v[500][500];
int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
bool B[500][500];


int main() {
    init();
    cin >> N;
    rep(i, N * N) cin >> A[i], A[i]--;
    
    rep(i,N)rep(j,N){
        v[i][j] = min(min(i, j), min(N - i - 1, N - j - 1)), B[i][j] = true;
    }

    queue<int> q;
    int ans = 0;

    for(int i = 0; i < N * N; i++) {
        int R = A[i] / N, C = A[i] % N;
        ans += v[R][C];
        B[R][C] = false;

        q.emplace(A[i]);
        while(!q.empty()){
            int r = q.front() / N, c = q.front() % N;
            q.pop();
            int cost = v[r][c] + B[r][c];

            for (int j = 0; j < 4; j++) {
                int rr = r + dx[j], cc = c + dy[j];
                if (rr < 0 or rr >= N or cc < 0 or cc >= N) continue;
                if (v[rr][cc] > cost) q.emplace(rr * N + cc), v[rr][cc] = cost;
            }
        }
    }

    cout << ans << endl;
}

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

class Program
{
    public static void Main()
    {
        String[] input = Console.ReadLine().Split();
        int S = int.Parse(input[0]);
        int W = int.Parse(input[1]);
        if (S <= W) { Console.WriteLine("unsafe"); }
        else { Console.WriteLine("safe"); }
    }
}

Measured memory_bytes: 27480
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
// bool debug=false;

/*---------------------------------------------------*/

#define int long long

signed main() {
  cin.tie(0); ios::sync_with_stdio(false);
  
  string S;
  cin >> S;
  vector<int> data(200005, 0);
  for(int i = 0; i < S.size() - 1; i++) {
    if(S[i] == 'B' && S[i + 1] == 'C') data[i] = 1;
  }
  for(int i = S.size() - 3; i >= 0; i--) {
    if(data[i]) data[i] += data[i + 2];
    if(S[i] == 'A') data[i] = data[i + 1];
  }

  int ans = 0;
  for(int i = 0; i < S.size(); i++) {
    if(S[i] == 'A') ans += data[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2196
package main
 
import "fmt"

func main() {
  var n int
  var x, mon, sum float32
  var u string

  fmt.Scan(&n)
  
 
  for i := 0; i < n; i++ {
    fmt.Scan(&x)
    fmt.Scan(&u)
    
    if u == "JPY" {
      mon = x
    } else {
      mon = x * 380000
    }
     
    sum += mon
  }

  fmt.Println(sum)
  
}


Measured memory_bytes: 512
#include<cstdio>
#include<queue>
using namespace std;
int main(){
	int n, tmp, top;
	queue<int> q;
	scanf("%d", &n);
	while(n--){
		top = 1;
		while (!q.empty()) q.pop();
		bool flag = true;
		for(int i = 0; i < 10; i++){
			scanf("%d", &tmp);
			if (tmp == top){
				top++;
				continue;
			}
			if (!q.empty() && q.front() == tmp){
				q.pop();
				continue;
			}
			if (tmp < top){
				flag = false;
				break;
			}
			while (top != tmp){
				q.push(top);
				top++;
			}
			top++;
		}
		if (flag) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

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

typedef long long ll;

int dp[100010];
int num[12];

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

  for ( int i = 0; i <= 100009; i++ ) dp[i] = 1e9;
  
  int num6[6];
  num6[0] = 6;
  int num9[5];
  num9[0] = 9;
  

  for ( int i = 1; i < 6; i++ ) num6[i] = num6[i-1] * 6;
  for ( int i = 1; i < 5; i++ ) num9[i] = num9[i-1] * 9;
  
  for ( int i = 0; i < 6; i++ ) num[i] = num6[i];
  for ( int i = 0; i < 5; i++ ) num[i+6] = num9[i];
  num[11] = 1;
  sort(num,num+12);
  for ( int i = 0; i < 12; i++)  dp[num[i]] = 1;
  //for ( int i = 0; i < 12; i++ ) cout << num[i] << endl;  

  for ( int i = 0; i < N; i++ ) {
    for ( int j = 0; j < 12; j++ ) {
      if ( i-num[j] >= 0) {
	dp[i+1] = min(dp[i+1],dp[i+1-num[j]]+1);
      } 
    }
  }
  //for ( int i = 1; i <= 25; i++ ) cout << dp[i] << endl;
  cout << dp[N] << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;

int main()
{
    string s;
    cin >> s;
    map<char, int> sdic;

    for (int i=0; i<s.size(); i++) {
        if(sdic.count(s[i])) {
            sdic[s[i]]++;
        } else {
            sdic[s[i]] = 1;
        }
    }

    if(sdic.size() != 2) {
        cout << "No" << endl;
    } else {
        bool valid = true;
        for (auto const&p : sdic) {
            if (p.second != 2) {
                valid = false;
                break;
            }
        }
        if (valid) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}

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

int main(){ 
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i = 0 ; i< n ; i++){
       cin >> h[i];
    }
    int ans = 0;
    for(int i = 0; i< n; i++){
       if(h[i]>=k) ans++;
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 640
/*    _                     _     
  __| | _____   _____  ___| |__  
 / _` |/ _ \ \ / / _ \/ __| '_ \ 
| (_| |  __/\ V /  __/\__ \ | | |
 \__,_|\___| \_/ \___||___/_| |_|
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define faster       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define  endl    '\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define mpi         map<pair<ll int,ll int>,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define maxpq       priority_queue<ll>
#define minpq       priority_queue<ll, vector<ll>, greater<ll> >
#define F           first
#define S           second
#define rep(i,j,k)  for(int i=j;i<k;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define present(c,x) ((c).find(x) != (c).end())
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define what_is(x)  cout << #x << " is " << x << endl;
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }


using namespace std;
using namespace __gnu_pbds;
 
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)); }
#define N  100005

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...);
}
 
int main(){
  faster
   int n;
   cin>>n;

  int a[n],b[n+1];
  rep(i,0,n)cin>>a[i];
  b[0]=0,b[1]=abs(a[1]-a[0]);
  rep(i,2,n){
    b[i]=min(b[i-2]+abs(a[i]-a[i-2]),b[i-1]+abs(a[i]-a[i-1]));
  } 
  cout<<b[n-1]<<endl;
}


 

Measured memory_bytes: 4364
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout.setf(ios::fixed); cout.precision(17);
  int k;
  cin >> k;
  cout << (k/2) * (k/2 + k %2) << "\n";
  return 0;
}

Measured memory_bytes: 256
S = input()
ml = 0

for i in range (len(S)):
  for j in range (i+1, len(S)+1):
    cnt = S[i:j].count("A")+S[i:j].count("G")+S[i:j].count("C")+S[i:j].count("T")
    if cnt == len(S[i:j]) and cnt > ml:
      ml = cnt
    
print(ml)
    

Measured memory_bytes: 3060
/**
 *    author        : Sudipta Banik Trisha 
 *    created       : August 29, 2020 6:00 PM
 *    Problem Name  : B - Substring
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/abc177/tasks/abc177_b
 *    @genarated by : ai-virtual-assistant
**/

#include<bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);

    string s,t;
    cin >> s >> t;

    int cnt=t.length();

    for(int i=0; i<=s.length()-t.length(); i++){
        int temp = t.length();
        for(int j=0; j<t.length(); j++){
            if(s[i+j] == t[j]) temp--; 
        }
        cnt = min(cnt,temp);
    }

    cout << cnt << endl;
    return 0 ;
}


Measured memory_bytes: 3560
N, M , Q = map(int, input().split())

LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for i in range(M):
  L, R = map(int, input().split())
  LR[L][R-L+1] += 1

  
for i in range(2,N+2):
  for j in range(1,N-i+2):
    LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
    
for i in range(Q):
  p, q = map(int, input().split())
  print(LR[p][q-p+1]-LR[q+1][0])


Measured memory_bytes: 8456
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

int main() {
	string s;

	cin >> s;
	int q;
	cin >> q;
	int re = 0;

	for (int i = 0;i < q;i++) {
		int t;
		cin >> t;
		if (t == 1) {
			re++;
		}
		else {
			int f;
			string c;
			cin >> f >> c;
			if (re % 2 == 0) {
				if (f == 1) {
					s.insert(0, c);
				}
				else {
					s.append(c);
				}
			}
			else
			{
				if (f == 1) {
					s.append(c);
				}
				else {
					s.insert(0, c);
				}
			}
		}
	}

	if (re % 2 == 1) {
		reverse(s.begin(), s.end());
	}

	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3856
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a > c || b < c) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;    
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	x := make([]int, n+1)
	y := make([]int, m+1)
	fmt.Scan(&x[0], &y[0])

	for i := 1; i < n+1; i++ {
		fmt.Scan(&x[i])
	}
	for i := 1; i < m+1; i++ {
		fmt.Scan(&y[i])
	}

	sort.Sort(sort.IntSlice(x))
	sort.Sort(sort.IntSlice(y))

	if x[n] < y[0] {
		fmt.Println("No War")
	} else {
		fmt.Println("War")
	}
}


Measured memory_bytes: 512
import math, fractions


def main():
    A, B = map(int, input().split())
    n = fractions.gcd(A, B)
    print(num_prime_factor(n))

def num_prime_factor(n):
    
    ret = 0

    for i in range(1, int(math.sqrt(n)) + 2):

        composite = False

        if n % i == 0:
            ret += 1
            n = n / i

            if i != 1:
                while n % i == 0:
                    n = n / i

            if n == 1:
                break

            for j in range(2, int(math.sqrt(n)) + 2):
                if n % j == 0:
                    composite = True
                    break

            if not composite:
                ret += 1
                break

    return ret

if __name__ == "__main__":
    main()

Measured memory_bytes: 64236
#include <iostream>
#include <string>
#define ll long long
using namespace std;

int d[1000010];
ll m_cnt[1000010], c_num[1000010], mc[1000010];

int main() {
	int N, Q;
	string S;
	cin >> N >> S >> Q;
	int d_now=0;
	for(int i=0; i<N; ++i){
	    if(S[i]=='D'){
	        d[d_now]=i;
	        ++d_now;
	    }
	    m_cnt[i+1]=m_cnt[i];
	    if(S[i]=='M') ++m_cnt[i+1];
	    c_num[i+1]=c_num[i];
	    mc[i+1]=mc[i];
	    if(S[i]=='C'){
	        ++c_num[i+1];
	        mc[i+1] += m_cnt[i];
	    }
	}
	for(int i=0; i<Q; ++i){
	    int k;
	    cin >> k;
	    ll ans=0;
	    for(int i=0; i<d_now; ++i){
	        ans += mc[min(d[i]+k, N)]-mc[d[i]]-(c_num[min(d[i]+k, N)]-c_num[d[i]])*m_cnt[d[i]];
	    }
	    cout << ans << endl;
	}
	return 0;
}


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

int main() 
{
	int n,ans=0;
	string s;
	cin >> n >> s;
	for(int i=0; i<s.length(); i++)
	{
		//cout << "i is: " << i << "\n";
		if(i+2 < s.length())
		{
			if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C')	
			{
				++ans;
				i = i+2;
			}
		}
	}
	cout << ans << "\n";
}

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

int main() {
    int N, M;
    cin >> N >> M;

    // Bs[i] := A が i であるような B の集まり
    vector<vector<int>> AtoB(M+1);
    for (int i = 0; i < N; ++i) {
        int A, B;
        cin >> A >> B;
        if (A > M) continue;
        AtoB[A].push_back(B);
    }

    long long result = 0;
    priority_queue<long long> que;
    for (int i = M-1; i >= 0; --i) {
        for (auto B : AtoB[M-i]) que.push(B);
        if (que.empty()) continue;
        result += que.top(); // キューの最大値を足す
        que.pop(); // キューの最大要素を削除
    }
    cout << result << endl;
}

Measured memory_bytes: 8540
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define readvec(vec) for(auto& e: vec){cin >> e;}
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long int ll;
typedef vector<int >    vecint;
typedef vector<ll >      vecll;
typedef vector<double >   vecd;
typedef vector<string > vecstr;
typedef vector<char >  vecchar;
typedef vector<bool >  vecbool;
typedef vector<vector<bool> >  vec2bool;
typedef vector<vector<int> >    vec2int;
typedef vector<vector<double> >   vec2d;
////////////////////////////////////////////////
void init()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
////////////////////////////////////////////////
bool isprime(int n){
  if(n == 1)return false;
  else if(n == 2) return true;
  else if(n == 3) return true;
  else if(n == 5) return true;
  else if(n%6 != 1&&n%6 != 5) return false;
  else{
    for(int i = 2; i*i <= n; i++){
      if(n%i == 0)return false;
    }
    return true;
  }
}
///////////////////////////////////////////////
int main()
{
  int n; cin >> n;
  vecint l(n,0), r(n,0);
  int lmin, rmax;
  lmin = 100000; rmax = 0;
  REP(i,n){
    cin >> l[i] >> r[i];
    lmin = min(lmin, l[i]);
    rmax = max(rmax, r[i]);
  }
  auto check = [](int i){
    if(i%2 == 0) return false;
    if(isprime((i + 1)/2) && isprime(i)){
      return true;
    }else{
      return false;
    }
  };
  vecbool v(rmax + 1, false);
  vecint num(rmax + 1, 0);
  for(int i = lmin; i <= rmax; i += 2){
    v[i] = check(i);
    // cout << "i = " << i << " " << v[i] << endl;
  }
  num[lmin] = v[lmin];
  for(int i = lmin + 1; i <= rmax; i ++){
    num[i] = num[i - 1] + (v[i]);
  }
  REP(i,n){
    cout << num[r[i]] - num[l[i] - 1] << endl;
  }

}



Measured memory_bytes: 1792
#include <iostream>
 
using std::cin;
using std::cout;
using std::endl;

static int const MODULO = 1e9 + 7;

static inline long
mmul(long a, long b)
{
  long ret = a * b;
  return ret < MODULO ? ret : ret % MODULO;
}

int
main()
{
  int N;
  cin >> N;
  long p = 1;
  for (int i = 1; i <= N; i++)
  {
    p = mmul(p, i);
  }
  cout << p << endl;
  return 0;
}


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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

const int MAX_N = 110;
const int MAX_V = 100100;
// 入力
int N;
long long W, weight[MAX_N], value[MAX_N]; // 品物の個数は 100 個なので少し余裕持たせてサイズ 110 に

// DPテーブル
long long dp[MAX_N][MAX_V];

int main() {
    cin >> N >> W;
    for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];

    // 初期化
    for (int i = 0; i < MAX_N; ++i) for (int j = 0; j < MAX_V; ++j) dp[i][j] = INF_LL;

    // 初期条件
    dp[0][0] = 0;

    // DPループ
    for (int i = 0; i < N; ++i) {
        for (int sum_v = 0; sum_v < MAX_V; ++sum_v) {

            // i 番目の品物を選ぶ場合
            if (sum_v - value[i] >= 0) chmin(dp[i+1][sum_v], dp[i][sum_v - value[i]] + weight[i]);

            // i 番目の品物を選ばない場合
            chmin(dp[i+1][sum_v], dp[i][sum_v]);
        }
    }

    // 最適値の出力
    long long res = 0;
    for (int sum_v = 0; sum_v < MAX_V; ++sum_v) {
        if (dp[N][sum_v] <= W) res = sum_v;
    }
    cout << res << endl;
}


Measured memory_bytes: 86272
#include <iostream>

using namespace std;

int main(){
	int h,w;
	cin >> h >> w;
	char c[h][w];
	for(int i = 0;i < h;i++){
		cin >> c[i];
	}
	bool f = true;
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			if(c[i][j] == '#'){
				if((i > 0 && c[i-1][j] == '#') || (i < h-1 && c[i+1][j] == '#') || (j > 0 && c[i][j-1] == '#') || (j < w-1 && c[i][j+1] == '#')){
					
				}
				else{
					f = false;
				}
			}
		}
	}
	if(f){
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef long double ld;
ll A[100000];



int main() {
	ll S;
	cin >> S;
	ll bottom = pow(60, 2);
	ll h = S / bottom;
	ll m = (S%bottom) / 60;
	ll s = ((S%bottom) % 60);
	cout << h << ":" << m << ":" << s << endl;
	return 0;
}





Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;

using namespace std;
int cal(ll n)
{
    ll t = n;
    int cnt = 0;
    while(t > 0)
    {
        t/=10;
        cnt++;
    }
    return cnt;
}
//
int main()
{
    //cout << sqrt(9876543210) << '\n';
    ll n;
    sl(n);
    //cout <<cal(n)<< endl;
    /*if(cal(n) & 1 == 1){
       cout << cal(sqrt(n)) << '\n';
    }
    else{
        cout << cal(n) << '\n';
    }
    */
    int maxlen = 1000;
    REP(i, 1, sqrt(n)+1)
    {
        if(n % i == 0)
        {
            //将数字分解
            int maxx = max(cal(n/i), cal(i));
            maxlen = min(maxlen, maxx);
            //maxlen = max(maxlen, cal(i));
            //cout << i << endl;
        }
    }

        cout << maxlen << '\n';

}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const string YES = "POSSIBLE";
const string NO = "IMPOSSIBLE";

vector<vi> g;
vi x;
int dfs(int v) {
    vector<bool> dp(x[v]+1);
    dp[0] = true;
    int sum = 0;
    for (int t : g[v]) {
        int val = dfs(t);
        if (val == -1) return -1;
        sum += x[t] + val;
        vector<bool> tdp(x[v]+1);
        repr(j, x[v]+1) {
            if (j-x[t] >= 0) tdp[j] = (tdp[j] | dp[j-x[t]]);
            if (j-val >= 0) tdp[j] = (tdp[j] | dp[j-val]);
        }
        dp = tdp;
    }
    int res = x[v];
    while (res >= 0) {
        if (dp[res]) break;
        --res;
    }
    if (res == -1) return -1;
    else return (sum - res);
}

int main(){
    int n;
    cin >> n;
    g = vector<vi>(n);
    rep1(i, n-1) {
        int p;
        cin >> p;
        --p;
        g[p].pb(i);
    }
    x = vi(n);
    rep(i, n) cin >> x[i];
    if (dfs(0) != -1) cout << YES << endl;
    else cout << NO << endl;
    return 0;
}


Measured memory_bytes: 3820
n, limit = map(int, input().split())
c = [0] * n
t = [0] * n
for i in range(n):
    c[i], t[i] = map(int, input().split())
intime = []
for i in range(n):
    if t[i] <= limit:
        intime.append(i)
minn = 100000
for i in intime:
    if c[i] < minn:
        minn = c[i]
if intime == []:
    print('TLE')
else:
    print(minn)

Measured memory_bytes: 3188
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Van Hanh Pham (skyvn97)
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        private static final String yes = "Yes";
        private static final String no = "No";

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();
            String s = in.nextString();
            int cntA = 0;
            int cntB = 0;
            for (int i = 0; i < n; i++) {
                if (s.charAt(i) == 'c') {
                    out.println(no);
                    continue;
                }
                if (s.charAt(i) == 'a') {
                    if (cntA + cntB < a + b) {
                        out.println(yes);
                        cntA++;
                    } else out.println(no);
                } else {
                    if (cntA + cntB < a + b && cntB < b) {
                        out.println(yes);
                        cntB++;
                    } else out.println(no);
                }
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String nextString() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

    }
}



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

int main(){
    int a, b;
    cin >> a >> b;
    int ret, ans;
    ret = a * b;
    ans = (a + b) * 2;
    cout << ret << " " << ans << endl;
    return 0;
}


Measured memory_bytes: 3068
/**
 *   author: bholuakku
**/

#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define MOD 1000000007
#define Endl cout<<"\n"
#define Test cout<<"Hello\n"

using namespace std;

typedef long long ll;

int power(ll x, ll y, ll p) { ll res = 1; x = x % p; while (y>0){ if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x)%p;} return res;}
int modInverse(ll n) {ll p = MOD;return power(n, p-2, p);}
int min(int a, int b, int c) { return min(a, min(b, c)); }
int max(int a, int b, int c) { return max(a, max(b, c)); }
inline void swap(int &a, int &b) { int t = a; a = b; b = t;}
bool cmp(int a, int b){return a>b;}

vector<bool> sieve;
vector<int> ans(3000000);

void fill(){
    sieve.assign(3000010, true);
    for(int i = 2; i*i<=3000000; i++){
        if(sieve[i]){
        for(int j = i*i; j<=3000000; j+=i){
            sieve[j] = false;
        }
        }
    }
    ans[1] = 0;
    for(int i = 2; i<2100000; i++){
        ans[i] = ans[i-1];
        if(sieve[i]) ans[i]++;
    }
}

int main(){
    int n, ans=1;
    cin>>n; int mount[n];
    for(auto &m : mount) cin>>m;
    int curr = mount[0];
    for(int i = 1; i<n; i++) if(mount[i]>=curr) curr = mount[i], ans++;
    cout<<ans;
    return 0;
}


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

using namespace std;

#define long long long
#define INF 1e18
#define MOD (long) (1e9 + 7)
#define double __float128

long foo(long x)
{
    if (x == 0) return 0;
    return x / abs(x);
}

int main()
{
    long n, k;
    cin >> n >> k;

    vector<pair<long, long>> a(n);
    for (auto &p : a) {
        cin >> p.first;
        p.second = foo(p.first);
        p.first = abs(p.first);
    }
    sort(a.begin(), a.end(), greater<pair<long, long>>());

    long s = 1;
    set<long> ind;
    for (long i = 0; i < k; i++) {
        s *= a[i].second;
        ind.insert(i);
    }
    if (s == -1) {
        bool ok1 = false, ok2 = false;
        double best = -INF;
        long bj = -1, bi = -1;
        for (long i = k-1; i >= 0; i--) {
            if (not ok1 and a[i].second == 1) {
                for (long j = k; j < n; j++) {
                    if (a[j].second == -1) {
                        double x = double(a[j].first) / double(a[i].first);
                        if (x > best) {
                            best = x;
                            bj = j;
                            bi = i;
                        }
                        ok1 = true;
                        break;
                    }
                }
            } else if (not ok2 and a[i].second == -1) {
                for (long j = k; j < n; j++) {
                    if (a[j].second == 1) {
                        double x = double(a[j].first) / double(a[i].first);
                        if (x > best) {
                            best = x;
                            bj = j;
                            bi = i;
                        }
                        ok2 = true;
                        break;
                    }
                }
            }
            if (ok1 and ok2) break;
        }
        if (ok1 or ok2) {
            ind.erase(bi);
            ind.insert(bj);
        } else {
            ind.clear();
            for (long i = n-1; i >= n-k; i--) {
                ind.insert(i);
            }
        }
    }
    long ans = 1;
    for (auto &i : ind) {
        ans = (((ans * a[i].first * a[i].second) % MOD) + MOD) % MOD;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 15668