akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;
int main(){
    string o,e,t = "";
    int a,b;
    cin >> o >> e;
    a = o.size();
    b = e.size();
    if(a-b==0){
        for(int i=0;i<a;i++){
        t = t+o[i]+e[i];
    }
    cout << t << endl;
    }else{
        for(int i=0;i<a-1;i++){
            t = t+o[i]+e[i];
        }
        cout << t+o[a-1] << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main ()
{
    int n;
    cin>>n;
    int A[n];
    int shuma=1;
    for(int i=0;i<n;i++)
    {
        cin>>A[i];
    }
    int min=A[0];
    for(int i=1;i<n;i++)
    {
        if(A[i]>=min)
        {
            shuma++;
            min=A[i];
        }
    }
    cout<<shuma<<endl;
    return 0;
}


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

int main() {
	int K;
	string S;
	cin >> K >> S;

	int sl = S.size();
	if (sl <= K) {
		cout << S << endl;
	}
	else {
		for (int i = 0; i < K; i++) {
			cout << S.at(i);
		}
		cout << "..." << endl;
	}
}

Measured memory_bytes: 3632
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }

int main() {
   int N, M;
   cin >> N >> M;
   int S[N], T[M];
   for (int i = 0; i < N; i++) cin >> S[i];
   for (int i = 0; i < M; i++) cin >> T[i];

   ll sum[N + 1][M + 1];
   ll dp[N + 1][M + 1];
   memset(sum, 0, sizeof(sum));
   memset(dp, 0, sizeof(dp));
   for (int i = 0; i < N; i++) {
      for (int j = 0; j < M; j++) {
         if (S[i] == T[j]) {
            // cout << i << " " << j << endl;
            dp[i + 1][j + 1] = sum[i][j] + 1;
         } else dp[i + 1][j + 1] = 0;
         dp[i + 1][j + 1] %= MOD;
         sum[i + 1][j + 1] = sum[i][j + 1] + sum[i + 1][j];
         sum[i + 1][j + 1] %= MOD;
         sum[i + 1][j + 1] -= sum[i][j];
         sum[i + 1][j + 1] += MOD;
         sum[i + 1][j + 1] %= MOD;
         sum[i + 1][j + 1] += dp[i + 1][j + 1];
         sum[i + 1][j + 1] %= MOD;
      }
   }
   cout << (sum[N][M] + 1) % MOD << endl;
   return 0;
}


Measured memory_bytes: 62848
h,w=map(int,input().split())
s=[input() for _ in range(h)]
flag=1
nx=[1,0,-1,0]
ny=[0,1,0,-1]
for y in range(h):
  for x in range(w):
    if(s[y][x]=="#"):
      for i in range(4):
        tx,ty=x+nx[i],y+ny[i]
        if(0<=ty and ty<h and 0<=tx and tx<w):
          if(s[ty][tx]=="#"):break
      else:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        while (scan.hasNext()) {
            int a = scan.nextInt();
            int b = scan.nextInt();
            Integer sum =  a + b;
            System.out.println(sum.toString().length());
        }
    }
}

Measured memory_bytes: 20432
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;
const ll INF = 1LL << 60;
#define MOD 1000000007
#define MAX_V 100010
#define MAX_N 100010

bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}

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

ll junnretu(ll n){
    ll ans=1;
    for (ll i=1;i<=n;i++){
        ans*=i;
    }
    return ans;
}

int main(){
    ll a[5],ans=0,x=10;
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
    for (ll i=0;i<5;i++){
        if (a[i]%10==0){
            ans+=a[i];
        }else{
            x=min(x,a[i]%10);
            a[i]=a[i]/10;
            ans+=a[i]*10+10;
        }
    }
    if (x!=10)x=10-x;
    if (x==10)x=0;
    cout << ans-x << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    int A,B; cin >> A >> B;
    if(1 <= A && A <= 9 && 1 <= B && B <= 9){
        cout << A*B << endl;
    }else{
        cout << -1 << endl;
    }

}


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

const int INF = 2e9;

int main(){
    int x,n;
    cin >> x >> n;
    if(n == 0){
        cout << x << endl;
        return 0;
    }
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    sort(p.begin(),p.end());
    queue<int> que;
    int j = 0;
    rep(i,102){
        if(i == p[j]) j++;
        else que.push(i);
    }
    int s = que.front();
    que.pop();
  	int ans = 2e9;
  	int res = 2e9;
    while(!que.empty()){
        int t = que.front();
        que.pop();
        int a = abs(s - x);
        int b = abs(t - x);
        if(a <= b){
            if(res > a){
                res = a;
                ans = s;
            }
        }
        else{
            if(res > b){
                res = a;
                ans = t;
            }
        }
        s = t;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
/* AUTHOR :  SHIVANK JAIN */

#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false)
#define itt cin.tie(0)
#define now cout.tie(0)

using namespace std;

#define ll long long
#define li long int

#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define reprev(i,n,a) for(int i=n;i>=a;i--)
#define endl "\n"

#define vi vector<int>
#define vll vector<ll>
#define vpi vector< pair<int , int> >
#define mapi map<int , int>
#define mapll map<ll ,ll >
#define seti set<int> 

#define fr first
#define se second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mp make_pair
#define sort(v) sort(v.begin() , v.end())

#define BIG 1000000007
int gcd(int a, int b) 
{ // builtin function __gcd(a,b)
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
int main(){

     fast;itt;now;
 
//    #ifndef ONLINE_JUDGE
//    // for getting input from input.txt
//    freopen("input.txt", "r", stdin);
//    // for writing output to output.txt
//     freopen("output.txt", "w", stdout);
//    #endif
    
     double r; cin>>r;
     double pi = 3.14159265358979323846 ;
     
     cout<<fixed<<setprecision(20)<<2*pi*r<<endl;
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 998244353
ll fact[300005], inv[300005];
ll pw(ll a, ll n){
	ll res = 1;
	while(n){
		if(n%2){
			res*=a;
			res%=mod;
		}
		a*=a;
		a%=mod;
		n/=2;
	}
	return res;
}

ll ncr(ll n, ll r){
	return (((fact[n]*inv[r])%mod)*inv[n-r])%mod;
}

int main(void){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, a, b , k;
    cin>>n>>a>>b>>k;
    if(a>b){
    	swap(a, b);
	}
    //if(k==0){
    //	cout<<"1";
    //	return 0;
	//}
	fact[0] = 1;
	inv[0] = pw(fact[0], mod-2);
	for(int i=1; i<=n; i++){
		fact[i] = (fact[i-1]*i)%mod;
		inv[i] = pw(fact[i], mod-2);
	}
	ll ans = 0;
	ll x = 0, y= 0;
	while(k-y*b>=0 && y<=n){
		if((k-y*b)%a==0){
			x = (k-y*b)/a;
			if(x<=n){
				ans += (ncr(n, x)*ncr(n, y))%mod;
				ans %=mod;
			}
		}
		y++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4992
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int arr[] = new int[101];
        for(int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        int count = 0;
        for(int i = 0; i < 100; i ++) {
            count += arr[i];
        }
        if(arr[100] < count) {
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const long long INF = 1e10;
const long long MOD = 1e9+7;
using Graph = vector<vector<ll>>;
using pll = pair<ll, ll>;
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;}

// 0 false, 1 true 
// string to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

ll n;
vector<vector<ll>> to(n);
vector<bool> seen(n);
vector<ll> d(n);
vector<ll> f(n);

ll dfs(ll node, ll time){
    if(seen[node] == false){
        seen[node] = true;
        d[node] = time;
    }

    for(ll next : to[node]){
        if(seen[next]){
            continue;
        }else{
            time = dfs(next, time+1);
        }
    }
    time += 1;

    f[node] = time;

    return time;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    cin >> n;
    to.resize(n);
    seen.resize(n);
    d.resize(n);
    f.resize(n);
    rep(i, n){
        ll u; cin >> u; u--;
        ll k; cin >> k;
        rep(j, k){
            ll v; cin >> v; v--;
            to[u].push_back(v);
        }
    }

    ll time = 0;
    for(ll i = 0; i < n; i++){
        if(seen[i] == false){
            time = dfs(i, time+1);
        }
    }
    

    for(ll i = 0; i < n; i++){
        cout << i+1 << " " << d[i] << " " << f[i] << endl;
    }






}


Measured memory_bytes: 3136
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	char inputStr[1200] = { '\0' };
	cin.getline(inputStr, 1200);
	int length = strlen(inputStr);
	for(int i = 0;i < length;i++)
	{
		if(inputStr[i] >= 'a' && inputStr[i] <= 'z')
		{
			inputStr[i] += 'A' - 'a';
		}
		else if(inputStr[i] >= 'A' && inputStr[i] <= 'Z')
		{
			inputStr[i] += 'a' - 'A';
		}
		cout << inputStr[i];
	}
	cout << endl;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;

int main() {
  int n, m;
  cin >> n >> m;
  ll dp[n + 1];
  dp[0] = 1;
  set<int> a;
  int t;
  rep(i, m) cin >> t, a.insert(t);
  if (a.find(1) == a.end())
    dp[1] = 1;
  else
    dp[1] = 0;

  for (int i = 2; i <= n; ++i) {
    if (a.find(i) == a.end())
      dp[i] = dp[i - 1] + dp[i - 2], dp[i] %= mod;
    else
      dp[i] = 0;
  }

  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<ll, ll>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const ll INF = 1E+18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n, k;
    cin >> n >> k;
    vl p(n), c(n);
    rep(i, n) {
        cin >> p[i];
        p[i]--;
    }
    rep(i, n) {
        cin >> c[i];
    }
    vector<P> cycle(n);
    rep(i, n) {
        vector<bool> used(n);
        ll now = i;
        ll score = 0;
        ll num = 0;
        while (1) {
            if (used[p[now]]) break;
            now = p[now];
            score += c[now];
            used[now] = true;
            num++;
        }
        cycle[i] = P(score, num);
    }
    ll ans = -INF;
    rep(i, n) {
        ll res = -INF;
        ll num = k;
        ll score = 0;
        ll now = i;
        //if (k<=n*2) {;}
        if (cycle[i].first>0) {
            ll z = k/cycle[i].second;
            z--;
            if (z<0) z = 0;
            score += cycle[i].first*z;
            num -= cycle[i].second*z;
        }
        else {
            num %= cycle[i].second;
            num += cycle[i].second;
            if (num>k) num = k;
        }
        //debug(num);
        while (num>0) {
            now = p[now];
            score += c[now];
            //debug(res);
            chmax(res, score);
            num--;
        }
        chmax(ans, res);
    }
    
    pr(ans);
    return 0;
}


Measured memory_bytes: 3816
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include <utility>
#include<map>
#include<functional>
using namespace std;
using ll = long long;
const int mod = 10000007;

int main() {
ll ans = 0,memo=0;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[s.size()-1-i] == 'B') {
			ans += i-memo;
			memo++;
		}
	}
	cout << ans << endl;
}


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

using namespace std;

int main() {
    int_fast64_t a, b, c, k;

    cin >> a >> b >> c >> k;

    if(k <= a) {
        printf("%ld\n", k);
    } else if(k <= a + b) {
        printf("%ld\n", a);
    } else {
        printf("%ld\n", 2 * a + b - k);
    }

    return 0;
}

Measured memory_bytes: 3744
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
	int a,b;
	cin >> a >> b;
	if(a*b % 2 == 0 )
		P("Even");
	else
		P("Odd");
	
	ret 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
//#define int long long

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

	int ans = 0;
	string S;
	cin >> S;

	for (size_t i = 0; i < S.size(); i++)
	{
		if (S[i] == '1')ans++;
	}

	cout << ans << endl;

	return 0;
}


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

int main() {
    int a, b, x;
    cin >> a >> b >> x;
    int ans = 1e9;
    for(int i = 0; i <= (x + 499) / 500; ++i) {
        const int r = max(0, x - i * 500);
        ans = min(ans, i * b + (r + 999) / 1000 * a);
    }
    cout << ans << endl;
}



Measured memory_bytes: 3068
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

void solve(void){
	ENJYU;
	int N, A, B;
	string S;
	cin >> N >> A >> B >> S;
	int sa = 0, sb = 0;
	rep(N, i) {
		if (S[i] == 'c') {
			cout << "No" << endl;
			continue;
		}
		if (S[i] == 'a') {
			if (sa + sb + 1 <= A + B) {
				cout << "Yes" << endl;
				sa++;
			}
			else cout << "No" << endl;
		}
		if (S[i] == 'b') {
			if (sa + sb + 1 <= A + B && sb + 1 <= B) {
				cout << "Yes" << endl;
				sb++;
			}
			else cout << "No" << endl;
		}
	}
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 848
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

struct edge {
  int to, cost;
  edge() {}
  edge(int to, int cost) : to(to), cost(cost) {}
};

int N,M,L,K,A,H;
int freeze[110];
vector<edge> G[110];
int dis[110][110];

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  while (cin >> N >> M >> L >> K >> A >> H, N) {
    ZERO(freeze);
    REP(i,110) G[i].clear();
    REP(i,L) {
      int x;
      cin >> x;
      freeze[x] = 1;
    }
    REP(i,K) {
      int s,t,c;
      cin >> s >> t >> c;
      G[s].emplace_back(t,c);
      G[t].emplace_back(s,c);
    }
    MINF(dis);
    dis[A][M] = 0;
    using P = tuple<int,int,int>;
    priority_queue<P,vector<P>,greater<P>> que;
    que.emplace(0,A,M);
    while (!que.empty()) {
      int dd,v,t;
      tie(dd,v,t) = que.top(); que.pop();
      if (dis[v][t] < dd) continue;
      if (freeze[v]) {
        for (int i = t+1; i <= M; i++) {
          if (CHMIN(dis[v][i],dis[v][t]+i-t)) {
            que.emplace(dis[v][i],v,i);
          }
        }
      }
      for (edge e : G[v]) {
        if (t >= e.cost) {
          if (CHMIN(dis[e.to][t-e.cost],dis[v][t]+e.cost)) {
            que.emplace(dis[e.to][t-e.cost],e.to,t-e.cost);
          }
        }
      }
    }
    int ans = INF;
    REP(i,M+1) CHMIN(ans,dis[H][i]);
    if (ans == INF) cout << "Help!" << endl;
    else cout << ans << endl;
  }

  return 0;
}


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

using namespace std;

#define ll long long 
#define REPL(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
static const int MAX = 10010;
static const ll INFTY = 1e12;
static const ll NUMMAX = 1000000007;
static const ll MOD = 1000000007;
 #define LOOP 10000000


int main() {

    ll X;
    bool flag = false;

    cin >> X;

    while(1){
        /* 素数かどうかを判定 */

        for( int i=2;i<=sqrt(X);++i ) {
           // cout <<  X << "AA" <<i << endl;
            if( X%i==0 ) {
                
                flag = true;
                break;
            } 
        } 
        if( flag == true ){
            
            X++;
            flag = false; 
        } else {
            break;
        }
    }

    cout << X << endl;

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int ar[n + 4];
    for (int i = 1; i <= n; i++) cin >> ar[i];
    int dp[n + 4]; dp[n] = 0;
    for (int i = n - 1; i > 0; i--){
        dp[i] = abs(ar[i] - ar[i + 1]) + dp[i + 1];
        if (i + 2 <= n) dp[i] = min(dp[i], abs(ar[i] - ar[i + 2]) + dp[i + 2]);
    }
    cout << dp[1] << endl;
}

Measured memory_bytes: 4420
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)

class modint {
  public:
    using ll = long long;
    ll num;
    static const ll MOD = 1e9+7;
    static vector<modint> factorial;

    modint(): num(0) {};
    modint(ll n_): num((n_ + MOD) % MOD) {}
    modint(const modint &r): num(r.num) {}
    operator ll() const { return (num+MOD)%MOD; }
    friend istream& operator>>(istream& is, modint &r){
        ll num_;
        is >> num_;
        r = num_;
        return is;
    }
    modint operator+(const modint &r) const { return modint(num + r.num); }
    modint operator-(const modint &r) const { return modint(num - r.num); }
    modint operator*(const modint &r) const { return modint(num * r.num); }

    template<typename T>
    modint operator^(const T &r) const {
        if(r == 0) return 1;
        return (((*this)*(*this)) ^ (r/2)) * modint(r&1 ? num : 1);
    }
    modint operator/(const modint &r) const { return num * (r^(MOD-2)); }

    modint operator+=(const modint &r) { return *this = *this + r; }
    modint operator-=(const modint &r) { return *this = *this - r; }
    modint operator*=(const modint &r) { return *this = *this * r; }
    modint operator/=(const modint &r) { return *this = *this / r; }

    template<typename T>
    modint operator^=(const T &r) { return *this = *this ^ r; }

    static modint pow(const modint x, ll r) {
        return x^r;
    }

    static modint fact(int n){
        if((int)factorial.size() <= n) factorial.resize(n+1);
        if(factorial[n]) return factorial[n];
        if(n == 0) return 1;
        return factorial[n] = modint(n) * fact(n-1);
    }

    static modint C(ll n,ll r){
        return n >= r ? fact(n)/(fact(n-r)*fact(r)) : modint(0);
    }
};
vector<modint> modint::factorial;
#define fact(n) modint::fact(n)
#define C(n,r) modint::C(n,r)
#define H(a,b) C(a+b, a)


int main(void){
    ll n,k;
    cin >> n >> k;
    rep1(i,k){
        cout << C(k-1, i-1) * C(n-k+1, i) << endl;
    }

    return 0;
}


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

typedef long long ll;

void solve() {
    ll N, A, B;
    cin >> N >> A >> B;
    vector<ll> h(N);
    rep(i, N) cin >> h[i];
    ll ans_min = 0, ans_max = 1e9;
    while (ans_min + 1 < ans_max) {
        ll ans = (ans_min + ans_max) / 2;
        ll count = 0;
        rep(i, N) if (h[i] - B * ans > 0) count += (h[i] - B * ans + A - B - 1) / (A - B);
        if (count > ans) ans_min = ans;
        else ans_max = ans;
    }
    cout << ans_max << endl;
    return;
}

int main() {
    solve();
}

Measured memory_bytes: 1024
def xor_gauss_jordan(A):
    """掃き出し法でジョルダン標準形を求める"""
    cnt_row = len(A)
    cnt_col = len(bin(max(A))[2::])

    rank = 0
    for col in range(cnt_col):
        # ピボットを探す
        pivot = -1
        for row in range(rank, cnt_row):
            if A[row] & 2**(cnt_col - col - 1):
                pivot = row
                break

        #  ピボットがない場合は次の列に
        if pivot == -1:
            continue

        # 行をスワップする
        A[pivot], A[rank] = A[rank], A[pivot]

        # ピボットのある列の値がすべて0になるように掃き出す
        A_rank = A[rank]
        for row in range(cnt_row):
            if row != rank and A[row] & 2**(cnt_col - col - 1):
                A[row] ^= A[rank]
        rank += 1

    return A


n = int(input())
a = list(map(int, input().split()))

# 全てのxorを計算

# 全てのaを2進数に変換
max_a = max(a)
max_a = bin(max_a)[2::]
len_max_a = len(max_a)

# 全てのxorを計算
# xor_sumが1のビットは興味深くない
# 興味深くないビットについては予めansに答えを足して、ビットを0にしておく
ans = 0
xor_sum = 0
for i in range(n):
    xor_sum ^= a[i]
for i in range(len_max_a):
    mask = 2**i
    tmp = mask & xor_sum
    if tmp:
        ans += tmp
        for i in range(n):
            a[i] -= tmp & a[i]

# ジョルダン標準形
a = xor_gauss_jordan(a)

tmp = 0
for i in range(n):
    tmp ^= a[i]
print(ans + 2*tmp)
    


Measured memory_bytes: 76832
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define MOD 1000000007
#define ALL(a) (a).begin(),(a).end()
#define pb(x) push_back(x)
#define ms(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(10) 
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef long long ll;
struct edge{ int from, to, cost; };

int main()
{
	int n;
	while (cin >> n)
	{
	
		if (n == 1) break;
		cout << n << ":";
		vector<int> v;
		FOR(i, 2, 300001)
		{
			if (i % 7 == 1 || i % 7 == 6)
			{
				if (n%i == 0)
				{
					bool f = true;
					REP(j, v.size())
					{
						if (i % v[j] == 0)
						{
							f = false;
							break;
						}
					}
					if (f)
					{
						v.push_back(i);
						cout << " " << i;

					}
				}
			}
		}
		cout << endl;
	}

}

Measured memory_bytes: 1208
#include<stdio.h>
int main ( )
{
	int N,a,i,sum=0,result;
	
	scanf("%d",&N);
	for(i=1,sum=0;i<=N;i++)
	{
		scanf("%d",&a);
		
		sum+=a;
		
		result=sum-N;
	}
	
	printf("%d\n",result);
	
	return 0;
	
}

Measured memory_bytes: 1728
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;

vector<int> uf;

bool cmp(pair<int, long long> a, pair<int, long long> b) {
  return(a.second < b.second);
}

bool cmp_tuple(tuple<int, int, long long> a, tuple<int, int, long long> b) {
  return(get<2>(a) < get<2>(b));
}

int group(int idx) {
  int original_idx = idx;
  int group_idx;
  while (uf[idx] != idx) {
    idx = uf[idx];
  }
  group_idx = idx;
  idx = original_idx;
  while (uf[idx] != idx) {
    int parent_idx = uf[idx];
    uf[idx] = group_idx;
    idx = parent_idx;
  }
  return(group_idx);
}

void merge(int src_idx, int dest) {
  while (uf[src_idx] != src_idx) {
    int parent_idx = uf[src_idx];
    uf[src_idx] = dest;
    src_idx = parent_idx;
  }
  uf[src_idx] = dest;
  return;
}

int main(){
  vector<pair<int, long long>> x, y;
  vector<tuple<int, int, long long>> dist;
  long long yen = 0;
  int n;
  cin >> n;
  for (int i=0;i<n;i++) {
    long long xx, yy;
    cin >> xx >> yy;
    //    pair<int, long long> x_tuple = make_pair(i, xx);
    //    pair<int, long long> y_tuple = make_pair(i, yy);
    x.push_back(make_pair(i, xx));
    y.push_back(make_pair(i, yy));
    uf.push_back(i);
  }
  sort(x.begin(), x.end(), cmp);
  sort(y.begin(), y.end(), cmp);
  for (int i = 1;i < n;i++) {
    dist.push_back(make_tuple(x[i].first, x[i-1].first, x[i].second - x[i-1].second));
  }
  for (int i = 1;i < n;i++) {
    dist.push_back(make_tuple(y[i].first, y[i-1].first, y[i].second - y[i-1].second));
  }
  sort(dist.begin(), dist.end(), cmp_tuple);
  for (auto it = dist.begin();it != dist.end();it++) {
    if (group(get<0>(*it)) == group(get<1>(*it))) {
      continue;
    }
    yen += get<2>(*it);
    int dest = group(get<0>(*it));
    int src_idx = get<1>(*it);
    merge(src_idx, dest);
    //    cout << get<0>(*it) << "\t" << get<1>(*it) << "\t" << get<2>(*it) << endl;
  }
  cout << yen << endl;
  return(0);
}


Measured memory_bytes: 12132
from itertools import accumulate

def main():
    N, K, *A = map(int, open(0).read().split())

    M = [a if a < 0 else 0 for a in A]
    P = [a if a > 0 else 0 for a in A]

    MA = [0] + list(accumulate(M))
    PA = [0] + list(accumulate(P))

    minus = max(q - p for p, q in zip(MA, MA[K:]))
    plus = min(q - p for p, q in zip(PA, PA[K:]))

    print(sum(P) + max(minus, -plus))


if __name__ == '__main__':
    main()


Measured memory_bytes: 19036
#include<bits/stdc++.h> 
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=next[p])  
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,0x3f,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define MEMx(a,b) memset(a,b,sizeof(a));
#define INF (0x3f3f3f3f)
#define F (1000000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int> 
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<' '; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
						For(j,m-1) cout<<a[i][j]<<' ';\
						cout<<a[i][m]<<endl; \
						} 
#pragma comment(linker, "/STACK:102400000,102400000")
#define ALL(x) (x).begin(),(x).end()
#define gmax(a,b) a=max(a,b);
#define gmin(a,b) a=min(a,b);
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
	while(isdigit(ch)) { x=x*10+ch-'0'; ch=getchar();}
	return x*f;
} 
int main()
{
//	freopen("A.in","r",stdin);
//	freopen(".out","w",stdout);
	double t=1e50;
	ll a=read(),b=read(),c=read(),k=read();
	k&=1;
	if(a==b) puts("0"),exit(0);
	if(k) cout<<b-a<<endl;else cout<<a-b<<endl;
	 
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int X,Y,A,B,C;
vector<int> D,E;
int F[100010];
vector<P> v;
priority_queue<int,vector<int>,greater<int>> Q,Q2;

signed main(){
	cin>>X>>Y>>A>>B>>C;
	REP(i,A){
		int a;
		cin>>a;
		D.push_back(a);
	}
	REP(i,B){
		int a;
		cin>>a;
		E.push_back(a);
	}
	REP(i,C){
		cin>>F[i];
	}
	sort(D.begin(),D.end());
	sort(E.begin(),E.end());
	sort(F,F+C,greater<>());
	
	REP(i,X){
		Q.push(D[D.size()-1-i]);
	}
	REP(i,Y){
		Q2.push(E[E.size()-1-i]);
	}
	REP(i,C){
		int p=Q.top();
		int q=Q2.top();
		if(p<=q&&F[i]>p){
			Q.push(F[i]);
			Q.pop();
		}
		if(q<p&&F[i]>q){
			Q2.push(F[i]);
			Q2.pop();
		}
	}
	int ans=0;
	while(Q.size()){
		ans+=Q.top();Q.pop();
	}
	while(Q2.size()){
		ans+=Q2.top();Q2.pop();
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4852
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() /4;
const ll linf = numeric_limits<ll>::max() /4;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////

double t[205] = {},v[205] = {};
int n;
double f(double x){
    double mps = inf;
    
    rep(i,1,n+3){
        if(x <= t[i-1])mps = min(mps, v[i]+(t[i-1]-x));
        else if(t[i] <= x)mps = min(mps,v[i]+(x-t[i]));
        else mps = min(mps,v[i]);
    }
    ret mps;
}

int main(){
    
    cin >> n;

    rep(i,2,n+2){
        cin >> t[i];
        t[i] += t[i-1];
    }
    rep(i,2,n+2)cin >> v[i];
 
    double m = 0;
    
    double ov = 0;
    for(double x = 0;x <= t[n+1]; x+=0.5){
    
        double v = f(x);
        
        m+=0.25*(ov + v);

        ov = v;
    }
 
    printf("%.18f\n",m);
 
	return  0;
}

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

int main(){
    string S;
    cin >> S;
    if(S == "AAA" || S== "BBB"){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

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

int main(){
  char b;
  cin >> b;
  
  if(b=='C'){
    cout << "G" << endl;
  }else if(b=='G'){
    cout << "C" << endl;
  }else if(b=='A'){
    cout << "T" << endl;
  }else if(b=='T'){
    cout << "A" << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;
class Main{
    public static void main(String[] args){
	Scanner stdIn=new Scanner(System.in);
	int a = stdIn.nextInt();
	int b = stdIn.nextInt();
	int c = stdIn.nextInt();
	int d = stdIn.nextInt();
	int ab=a-b;
	int bc=b-c;
	int ac=a-c;
	if(Math.abs(ab)<=d&&Math.abs(bc)<=d){
	    System.out.println("Yes");
	}else if(Math.abs(ac)<=d){
	    System.out.println("Yes");	    
	}else{
	    System.out.println("No");
	}
    }
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define INF (int)1e9+4
#define INFL (ll)1e18+4
#define md (int)1e9+7
#define mx 10000000
#define mk make_pair
#define pi pair<int,int>
#define ss second
#define ff first
#define pb emplace_back 
#define onell(x) __builtin_popcountll(x)
#define one(x) __builtin_popcount(x)
#define all(s) s.begin(),s.end()
#define rall(x) (x).rbegin(), (x).rend()
#define trav(x, a) for (auto& x: a)
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define rf(i,a,b) for(int i=a;i>=b;i--)
#define sz(x) ((long long)x.size())
#define mez(s) memset(s,0,sizeof s)
#define mex(s) memset(s,-1,sizeof s)
#define metr(s) memset(s,true, sizeof s)
typedef vector<int> vi; 
typedef vector<ll>vl;
typedef map<int,int> mp;
typedef queue<int> que;
typedef vector<pi> vp;
void solve(){
int n=0,k=0,ans=0,r=0,m=0,x=0,y=0,z=0;
string st;
cin>>st;
rep(i,0,sz(st)){
	if(st[i]=='R')
	x++;
	else
	x=0;
	ans=max(ans,x);
}
cout<<ans;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t=1;
   //cin>>t;
  while(t--){
  	solve();
  }
  return 0;
}

Measured memory_bytes: 3668
from sys import stdin
import heapq

n,q = map(int,input().split())
q_list = [list() for i in range(n)]

for i in range(q):
    l = list(map(int,stdin.readline().split()))
    if l[0] == 0:
        heapq.heappush(q_list[l[1]],-l[2])
    elif l[0] == 1:
        if q_list[l[1]]:
            print(-q_list[l[1]][0])
    elif q_list[l[1]]:
        heapq.heappop(q_list[l[1]])





Measured memory_bytes: 13460
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        static void Main(string[] args)
        {

            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            //var p = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int K = input[1];
            string S = Console.ReadLine();

            
            int end = 0;
            int c = S[0] == '0' ? 1 : 0;
            
            List<int> ans = new List<int>();
            if (N == 1)
            {
                Console.WriteLine(1);
                return;
            }
            for (var st = 0; st < N; st++) 
            {
                
                if (c <= K) 
                {
                    while (c <= K)
                    {
                        ans.Add(end - st + 1);

                        if (end == N - 1) { break; }

                        end++;
                        if (S[end] == '0' && S[end-1] == '1')
                        {
                            c++;
                        }
                    }
                    
                }
                if (c > K)
                {
                    if (S[st] == '0' && S[st + 1] == '1')
                    {
                        c--;
                    }
                }
            }

            Console.WriteLine(ans.Max());

            //Console.Out.Flush();

        }
    }

    //010100

    public class Calculation
    {

    }

    public class Graph
    {

    }
}




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

const ll INF = 1001001001;


int main(){
  int h,a;
  cin>>h>>a;
  int ans = h/a;
  if(h%a==0){
    cout<<ans<<endl;
  }else{
    ans++;
    cout<<ans<<endl;
  }
}

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

using namespace std;

int main(){
  int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  long long int ans = 0LL;
  if(N > K){
  for(int i = 1; i <= K; i++) ans += X;
  for(int i = K + 1; i <= N; i++) ans += Y;
  }else{
  for(int i = 1; i <= N; i++) ans += X;
  }
  
  cout << ans;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace ITP1_3_D {
    class Program {
        static void Main(string[] args) {
            int[] s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int s1 = s[0];
            int s2 = s[1];
            int s3 = s[2];
            int count = 0;
            for(int i = s1; i <= s2; i++) {
                if((s3 % i) == 0) count++;
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 9576
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N;
  cin>>N;
  vector<ll> vec(4);

 for(ll i=0;i<N;i++) {
string S;
   cin>>S;
   if(S=="AC") {
vec[0]++;
   }
   else if (S=="WA") {
vec[1]++;
   }
   else if(S=="TLE") {
vec[2]++;
   }
   else {
vec[3]++;
   }
 }
  
  
  cout<<"AC"<<" "<<"x"<<" "<<vec[0]<<endl;
   cout<<"WA"<<" "<<"x"<<" "<<vec[1]<<endl;
   cout<<"TLE"<<" "<<"x"<<" "<<vec[2]<<endl;
   cout<<"RE"<<" "<<"x"<<" "<<vec[3]<<endl;
}
  


Measured memory_bytes: 3644
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int MOD=1000000007;

long long qexp(long long b,long long p,int m){
    long long res=1;
    while (p){
        if (p&1) res=(res*b)%m;
        b=(b*b)%m;
        p>>=1;
    }
    return res;
}

ll inv(ll i){
	return qexp(i,MOD-2,MOD);
}

ll fix(ll i){
	i%=MOD;
	if (i<0) i+=MOD;
	
	return i;
}

int n,m;
ll fac[500005];
ll ifac[500005];

ll nPk(int i,int j){
	return fac[i]*ifac[i-j]%MOD;
}

ll nCk(int i,int j){
	return nPk(i,j)*ifac[j]%MOD;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	fac[0]=1;
	rep(x,1,500005) fac[x]=(fac[x-1]*x)%MOD;
	rep(x,0,500005) ifac[x]=inv(fac[x]);
	
	cin>>n>>m;
	
	ll ans=0;
	rep(x,0,n+1){ //how many same
		ll curr=nCk(n,x)*nPk(m-x,n-x);
		
		//cout<<nCk(n,x)<<" "<<nPk(m-x,n-x)<<endl;
		
		if (x%2==0) ans=fix(ans+curr);
		else ans=fix(ans-curr);
	}
	
	cout<<ans*nPk(m,n)%MOD<<endl;
}


Measured memory_bytes: 11444
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
bool np[10111];
int p[10111],pn;
ll cube[10111];
int n;
map<ll,int> mp;
ll calc(ll x)
{
	ll t=x,y=1;
	for(int i=0;cube[i]<=x;i++)
	{
		if(t%p[i]==0)
		{
			t/=p[i];
			if(t%p[i]==0)
			{
				y=y*p[i];
				t/=p[i];
			}
		}
	}
	if(t>1)
	{
		ll p=ll(sqrt(t)+0.5);
		if(p*p==t)y=y*p;
	}
	return (x/y/y)*x/y;
}
int main()
{
	for(int i=2;i<=10000;i++)
	{
		if(np[i])continue;
		cube[pn]=1ll*i*i*i;
		p[pn++]=i;
		for(int j=i+i;j<=10000;j+=i)np[j]=1;
	}
	geti(n);
	bool has1=0;
	for(int i=1;i<=n;i++)
	{
		ll x;
		geti(x);
		for(int j=0;cube[j]<=x;j++)
		{
			while(x%cube[j]==0)x/=cube[j];
		}
		if(x==1)has1=1;
		else
		{
			mp[x]++;
		}
	}
	int ans=0;
	foreach(it,mp)
	{
		ll other=calc(it->FF);
		if(mp.find(other)!=mp.end())ans+=max(it->SS,mp[other]);
		else ans+=it->SS*2;
	}
	cout<<ans/2+has1<<endl;
	return 0;
}


Measured memory_bytes: 6656