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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,vec) VL (vec)(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t make_tuple
#define eb emplace_back
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a),greater<>())
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (ll)(a.size())
#define ENDL cout<<endl
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define cont const auto
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
#define PQ priority_queue
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef tuple<ll,ll,ll> T3;
typedef tuple<ll,ll,ll,ll> T4;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin>>n;
  VL a(n),b(n);
  rep(i,n)cin>>a[i]>>b[i];
  reverse(all(a));
  reverse(all(b));
  int res=0;
  rep(i,n){
    int now=a[i]+res;
    res+=(now%b[i]==0?0:b[i]-now%b[i]);
  }
  out(res);
  
  
  
  return 0;
}



Measured memory_bytes: 1792
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int n, flg = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
  {
    int a;
    scanf("%d", &a);
    if (a % 2 == 0)
    {
      if (a % 3 != 0 && a % 5 != 0)
      {
        flg = 1;
        break;
      }
    }
  }
  puts(!flg ? "APPROVED" : "DENIED");
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		
		if (N == 0) {
			System.out.println(0);
			return;
		}
		
		String ans = "";
		while(N != 0) {
			if (N % 2 != 0) {
				N--;
				ans = "1" + ans;
			} else {
				ans = "0" + ans;
			}
			
			N /= -2;
		}
		
		System.out.println(ans);

	}
	
}

Measured memory_bytes: 21844
def f(x):
  if x == "A" or x == "C" or x == "G" or x == "T":
    return "1"
  else:
    return "0"
S = input()
s = list(S)
n = len(s)
u = list(map(f,s))
U = "".join(u)
print(max(list(map(len,U.split("0")))))



Measured memory_bytes: 8904
def main():
    N_ko, K_kai = map(int, input().split())
    init_light = list(map(int, input().split()))


    for k in range(min(42,K_kai)):
        light_list = [0 for i in range(N_ko)]

        for i in range(N_ko):
            left = max(0, i - init_light[i])
            right = min(N_ko - 1, i + init_light[i])
            
            light_list[left] += 1

            if (right + 1 < N_ko):
                light_list[right + 1] -= 1
            
        for i in range(1, N_ko):
            light_list[i] += light_list[i - 1]
        
        init_light = light_list

    
    print(' '.join(map(str,light_list)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 219912
/*input
10
AC
AC
AC
AC
AC
AC
AC
AC
AC
AC

*/ 
#include <iostream>
#include <bits/stdc++.h>
#include <math.h> 
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define int long long
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define ms(a,x) memset(a, x, sizeof(a));
#define endl "\n"
#define trav(a,x) for(auto &a:x)
#define bits(n) __builtin_popcount(n)
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
int mpow(int base, int exp); 
void ipgraph(int m);
//void dfs(int u, int par);
const int mod = 1000000007;
const int N = 1000000001;
const int MAX = 2*pow(10,6)+5;
 

//standard input and output template
template<typename... T>
void in(T&... args) {
    ((cin >> args), ...);
}

template<typename... T>
void out(T&&... args) {
    ((cout << args << " "), ...);
}

template<typename... T>
void outl(T&&... args) {
    ((cout << args << endl), ...);
}


int fast_exp(int base, int exp) {
    int res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base)%mod;
       base=(base*base)%mod;
       exp/=2;
    }
    return res%mod;
}




int32_t main() {
  IOS;
  int n;cin>>n;
  map<string,int> mx;
  mx["AC"] = 0;
  mx["WA"] = 0;
  mx["TLE"] = 0;
  mx["RE"] = 0;
  for(int i=0;i<n;i++){
  	string s;cin>>s;
  	mx[s]++;
  }

  out("AC x",mx["AC"]);cout<<endl;
  out("WA x",mx["WA"]);cout<<endl;
  out("TLE x",mx["TLE"]);cout<<endl;
  out("RE x",mx["RE"]);cout<<endl;
  return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
//#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;

struct x
{
    int index;
    int num;
    bool operator< (const x &rhs)
    {
        return num < rhs.num;
    }
};

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<x> a(n);
    for(int i = 0; i < n; i++)
    {
        a[i].index = i + 1;
        cin >> a[i].num;
    }
    sort(a.begin(), a.end());
    for(int i = 0; i < n; i++)
    {
        cout << a[i].index << ' ';
    }

    return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(void){
	int N,K;
	cin>>N>>K;
	int ind;
	rep(i,N){
		int work;
		cin>>work;
		if(work == 1){
			ind = i;
			break;
		}
	}
	int ans;
	ans += ind/(K-1);
	if(ind%(K-1) != 0)ans++;
	ans += (N-1-ind)/(K-1);
	if((N-1-ind)%(K-1) != 0)ans++;
	if(ind%(K-1)+(N-1-ind)%(K-1) <  K && ind%(K-1) != 0 && (N-1-ind)%(K-1) != 0)ans--;
	cout<<ans<<endl;
	return 0;

}


Measured memory_bytes: 256
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int n, b, c;
vector<int> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
	int ans=0;
  	int keta=1;
    for (int i = 0; i < 3; i++)
    {
      int t=n%10;
      n/=10;
      if(t==1){
      t=9;
      }
      else{
      t=1;
      }
      ans+=keta*t;
      keta*=10;
    }
    cout << ans << "\n";
}



Measured memory_bytes: 892
package main

import (
    "fmt"
)

func main() {
  var a, b int
  fmt.Scan(&a)
  fmt.Scan(&b)
  for i := 0; i < a + 1; i++ {
    if 4 * i + (2 * (a - i)) == b {
      fmt.Print("Yes")
      return
    }
  }
  fmt.Print("No")
}

Measured memory_bytes: 1768
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'

int gcd(int a, int b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	int ans = ((W - w) * H) - (W - w) * h;
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

//long longのシフト演算には気をつけよう

int main(){
    string s; cin >> s;
    int ans = 0;

    for(int i=0; i<s.size(); i++){
        int tmp = 0;
        int id = i;
        while(s[id] == 'A' || s[id] == 'C' || s[id] == 'G' || s[id] == 'T'){
            id++; tmp++;
        }
        ans = max(ans, tmp);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define line cout<<"\n"
#define ci std ::cin
#define co std ::cout
#define sf(n) scanf("%d",&n);
#define sff(n,m) scanf("%d%d",&n,&m);
#define pf(n) printf("%d",n);
#define n_line printf("\n");
#define cas(n) printf("Case %d: ",n++);
#define task return
#define loop(x,n)  for(int x = 0 ; x < n ; x++)
#define constloop(x,a,n) for(int x = a ; x < n ; x++)
#define revloop(x,a,n)  for(int x = a ; x >= n ; x--)
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define pi acos(-1)
#define mx 10000000
ll P[mx+5],cnt=1;
bool nP[mx+5];
void sieve(void)
{
    P[0]=2;
    nP[0]=true;
    nP[1]=true;
    for(ll i=3 ; i<=mx ; i+=2)
    {
        if(nP[i]==true)
            continue;
        for(ll j=i+i ; j<=mx ; j+=i)
            nP[j]=true;
        P[cnt++]=i;
    }
}
void solve()
{
    //Code here
 	string s;
 	cin>>s;
 	ll sum=0;
 	for(int i=0 ; i<s.size() ; i++)
 	{
 		sum+=s[i]-'0';
 	}
 	if(sum%9==0)
 		cout<<"Yes";
 	else
 		cout<<"No";
 	line;
}
int main()
{
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	/*ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);*/
	solve();
	return 0;
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
  string s;
  cin >> s;
  int ct = 0;
  bool flag = false;
  rep(i,0,s.size()){
    if(s[i] == 'R'){
      ct++;
      flag = true;
    }
    if(flag && s[i] == 'S'){
      break;
    }
  }
  cout << ct << endl;
}

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

int main() {
	int X, Y, Z, K;
	cin >> X >> Y >> Z >> K;
	vector<long long int> A(X), B(Y), C(Z);
	for (int i = 0; i < X; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < Y; i++) {
		cin >> B[i];
	}
	for (int i = 0; i < Z; i++) {
		cin >> C[i];
	}

	sort(A.begin(), A.end(), greater<>());
	sort(B.begin(), B.end(), greater<>());
	sort(C.begin(), C.end(), greater<>());

	vector<long long int> ans;

	for (int i = 0; i < X; i++) {
		for (int j = 0; j < Y; j++) {
			for (int l = 0; l < Z; l++) {
				if ((i + 1) * (j + 1) * (l + 1) <= K) {
					ans.push_back(A[i] + B[j] + C[l]);
				}
			}
		}
	}

	sort(ans.begin(), ans.end(), greater<>());

	for (int i = 0; i < K; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}

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

int main() {
    std::ios::sync_with_stdio(false);
    int n;
    std::cin >> n;
    long long ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (i % 3 == 0 || i % 5 == 0) {
            continue;
        } else {
            ans += (long long)i;
        }
    }
    std::cout << ans << std::endl;


    return 0;
}


Measured memory_bytes: 3660
#include<string>
#include<iostream>
#include<map>
using namespace std;
int main() {
	map<double, int>d;
	for (int i = 0; i < 3; i++) {
		map<double, int>a;
		int b;
		double c;
		for (int j = 0; j < 8; j++) {
			cin >> b >> c;
			a.insert(map<double, int>::value_type(c, b));
		}
		map<double, int>::iterator it = a.begin();
		cout << (*it).second << " " << (*it).first << endl;
		it++;
		cout << (*it).second << " " << (*it).first << endl;
		it++;
		d.insert(map<double, int>::value_type((*it).first, (*it).second));
	}
	map<double, int>::iterator it = d.begin();
	cout << (*it).second << " " << (*it).first << endl;
	it++;
	cout << (*it).second << " " << (*it).first << endl;
	it++; 
}

Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;

int main(){
    char ch;int cnt[26]={0};
    while(cin>>ch){
        if(65<=ch&&ch<=90) cnt[ch-'A']++;
        else if(97<=ch&&ch<=122) cnt[ch-'a']++;
    }
    for(int i=0;i<26;i++){
        printf("%c : %d\n",i+'a',cnt[i]);
    }
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    string a, b, c; cin >> a >> b >> c;

    cout << "A" << b[0] << "C" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << endl;
#else
	#define DBG(X)
	#define endl '\n'
#endif
 
using namespace std;

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

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const ll mod = 1e9 + 7;
const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }

void solve()
{
	int a;
	string s;

	cin >> a >> s;

	if(a >= 3200)
		cout << s << endl;
	else
		cout << "red" << endl;
}

int main()
{
	fast_io();
	solve();

	return 0;
}


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 P = pair<int,int>;

const int A = 1000005;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> c(A);
	rep(i,n) {
		cin >> a[i];
		c[a[i]]++;
	}
	bool pairwize = true;
	for (int i=2;i < A;i++) {
		int cnt = 0;
		for (int j=i;j < A;j += i)
			cnt += c[j];
		if (cnt > 1) {
			pairwize = false;
			break;
		}
	}
	if (pairwize){
		cout << "pairwise coprime" << endl;
		return 0;
	}
	int g = 0;
	rep(i,n) g = gcd(g, a[i]);
	if (g == 1) {
		cout << "setwise coprime" << endl;
		return 0;
	}
	cout << "not coprime" << endl;
	return 0;
}


Measured memory_bytes: 10920
import java.util.Scanner;

public class Main {

  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();

    if(a == (b + c) || b == (a + c) || c == (a + b)){
      System.out.println("Yes");
    }
    else {
      System.out.println("No");
    }
  }
}


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

struct LowLink {
  using A = vector<int>;
  using B = vector<pair<int, int>>;
  int n;
  vector<vector<int>> es;
  vector<bool> vis;
  vector<int> ord, low;
  A articulation;
  B bridge;
  LowLink(int n) : n(n), es(n) {}
  void add_edge(int v, int u) {
    es[v].push_back(u);
    es[u].push_back(v);
  }
  void dfs(int v, int p, int &k) {
    vis[v] = true;
    ord[v] = k++;
    low[v] = ord[v];
    bool is = false;
    int cnt = 0;
    for (auto u : es[v]) {
      if (vis[u])  {
        if (u != p) low[v] = min(low[v], ord[u]);
        continue;
      }
      cnt++;
      dfs(u, v, k);
      low[v] = min(low[v], low[u]);
      if (p != -1 && ord[v] <= low[u]) is = true;
      if (ord[v] < low[u]) bridge.emplace_back(min(v, u), max(v, u));
    }
    if (p == -1 && cnt > 1) is = true;
    if (is) articulation.push_back(v);
  }
  pair<A, B> build() {
    int k = 0;
    vis.assign(n, false);
    ord.assign(n, 0);
    low.assign(n, 0);
    articulation.clear();
    bridge.clear();
    dfs(0, -1, k);
    return pair<A, B>(articulation, bridge);
  }
};

int main() {
  int N, M; cin >> N >> M;
  auto low = LowLink(N);
  for (int i = 0; i < M; i++) {
    int v, u; cin >> v >> u;
    low.add_edge(v, u);
  }
  auto ans = low.build().second;
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << '\n';
  }
  return 0;
}



Measured memory_bytes: 4620
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <numeric>
#include <math.h>
#include <climits>
#include <stack>
#include <iomanip>
#include <sstream>

using namespace std;

template <typename T>
inline bool sign(T A) {
    return (A>0)-(A<0);
}
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SREP(i,s,n) for(int i=s; (n-i)*sign(n-s)>0; i+=sign(n-s))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

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

template <template<class,class,class...> class C, typename K, typename V, typename... Args>
V map_get(const C<K,V,Args...>& m, K const& key, const V & defval)
{
    typename C<K,V,Args...>::const_iterator it = m.find( key );
    if (it == m.end())
        return defval;
    return it->second;
}

#define MOD (1'000'000'000 + 7)



int main(void)
{
    ll T1,T2,A1,A2,B1,B2;
    cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
    if (A1*T1+A2*T2 > B1*T1+B2*T2) {
        swap(A1, B1);
        swap(A2, B2);
    }
    ll C1 = B1 - A1;
    ll C2 = B2 - A2;
    if (C1 == 0 || C1 * T1 + C2 * T2 == 0)
    {
        cout << "infinity" << endl;
    }
    else if (C1 > 0)
    {
        cout << 0 << endl;
    }
    else  {
        ll d = -C1 * T1;
        ll u = C1 * T1 + C2 * T2;
        cout << 2 + 2 * (d / u) - 1 - int(d%u == 0)<< endl;
    }

}


Measured memory_bytes: 256
import sys
def t(A,p,r):
 x=A[r][1];i=p-1
 for j in range(p,r):
  if A[j][1]<=x:i+=1;A[i],A[j]=A[j],A[i]
 A[i+1],A[r]=A[r],A[i+1]
 return i+1
def k(A,p,r):
 if p<r:q=t(A,p,r);k(A,p,q-1);k(A,q+1,r)
def s(A):
 for i in range(n-1):
  if A[i][1]==A[i+1][1]:
   if A[i][2]>A[i+1][2]:return'Not s'
 return'S'
n=int(input())
f=lambda x,y:(x,int(y))
A=[(*f(*e.split()),i)for i,e in enumerate(sys.stdin)]
k(A,0,n-1)
for e in[[s(A)+'table']]+A:print(*e[:2])


Measured memory_bytes: 21120
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9
#define MOD 1000000007
#define ll long long
using namespace std;
typedef unsigned long long ull;
typedef pair<ll,ll> pr;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<pr>v(51);
    // p,b
    v[0]=make_pair(1,0);
    for(int i=0;i<50;i++){
        ll p=2*v[i].first+1;
        ll b=2*v[i].second+2;
        v[i+1]=make_pair(p,b);
//        cout<<p<<" "<<b<<endl;
    }
    vector<ll> s(51);
    s[0]=1;
    ll x=1;
    for(int i=0;i<51;i++){
        s[i]=x;
        x=x*2+3;
    //    cout<<s[i]<<endl;
    }
    ll n,eat;
    cin>>n>>eat;
    ll ans=0;
    // B BPPPB P BPPPB B
    for(int i=n-1;i>=0;i--){
        if(eat==1){
            break;
        }
        else if(eat<1+s[i]){
            eat-=1LL;
        }
        else if(eat==1+s[i]){
            ans+=v[i].first;
            break;
        }
        else if (eat==2+s[i]){
        //    cout<<"vv"<<v[i].first<<endl;
            ans+=v[i].first+1LL;
            break;
        }
        else if(eat<2+2*s[i]){
            ans+=v[i].first+1;
            eat-=(2LL+s[i]);
        }
        else{
            ans+=2LL*v[i].first+1LL;
            break;
        }
//        cout<<ans<<" "<<eat<<endl;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char a[50];
    char b[50];
    char c[100];
    int i,n,k;
    scanf("%s",a);
    scanf("%s",b);
    for(i=2;i<=100;i++)
    {
        c[0]=a[0];
        c[1]=b[0];
        if(i%2==0)
            c[i]=a[i/2];
         else
            c[i]=b[(i-1)/2];
    }
    printf("%s",c);
 return 0;
 }

Measured memory_bytes: 128
#include<stdio.h>
int main(void){

int i, d = 1;
scanf("%d", &i);
printf("Case %d: %d\n", d, i);
while (i>0){
scanf("%d", &i);
if (i == 0){ break; }
else{
d = d + 1;
printf("Case %d: %d\n", d, i);
}
}

	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

struct BUG
{
	LL out, in;
	
	bool operator < (const BUG& t) const{
		return out < t.out;
	}
};

bool cmp(const BUG& a, const BUG& b)
{
	return a.in > b.in;
};

int n;
BUG bug[300001];

bool solve(int x)
{
	priority_queue<BUG> que;
	LL sum = 0;
	int i;
	for (i = 0; i < x; i++){
		que.push(bug[i]);
		sum += bug[i].out;
	}
	
	for (i--; i < n; i++){
		if (i >= x){
			que.push(bug[i]);
			sum += bug[i].out;
			BUG b = que.top(); que.pop();
			sum -= b.out;
		}
		if (sum <= bug[i].in * x){
			return true;
		}
	}
	
	return false;
}

/*
bool solve(int x)
{
    int lim = x - 1;
     
    while (true){
        priority_queue<BUG> que;
        for (int i = 0; i <= lim; i++){
            que.push(bug[i]);
        }
         
        puts("");
        LL sum = 0;
        for (int i = 0; i < x; i++){
            BUG b = que.top(); que.pop();
        	printf("%lld\n", b.out);
            sum += b.out;
        }
         
        if (sum <= bug[lim].in * x) return true;
        else {
            lim++;
            if (lim == n) return false;
        }
    }
}
*/

int main()
{
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++){
		scanf("%lld %lld", &bug[i].out, &bug[i].in);
	}
	
	sort(bug, bug + n, cmp);
	
	int l = 1, r = n;
	while (l <= r){
		int m = (l + r) / 2;
		
		if (solve(m)) l = m + 1;
		else r = m - 1;
	}
	
	if (r == -1) puts("0");
	else printf("%d\n", r);
	
	return 0;
}

Measured memory_bytes: 20016
N, M = [int(x) for x in input().split(" ")]
S = input()
T = input()

N = len(S)
M = len(T)


S = [ord(c) for c in S]
T = [ord(c) for c in T]


def gcd(a, b):
    if a < b:
        a, b = b, a
    while b:
        a, b = b, a % b
    return a


def maxkobai(a, b):
    return a * b // gcd(a, b)


L = maxkobai(N, M)
ret = L
x = dict()

for n in range(0, N):
    x[n * (L//N) + 1] = S[n]


for m in range(0, M):
    idx = m * (L // M) + 1
    tmp = x.get(idx, 0)

    if tmp != T[m] and tmp != 0:
        ret = -1
        break

print(ret)


Measured memory_bytes: 16380
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<ll(n); i++)
#define REPR(i, n) for(ll i=n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=m; i<ll(n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ll(x.size()) 
using P = pair<int, int>;
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; }
const int INF = 2e9;
const ll LINF = (1LL<<60);

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,k; cin >> n >> k;
  vector<int> p(n), c(n);
  REP(i,n){ 
    cin >> p[i]; 
    p[i]--;
  }
  REP(i,n) cin >> c[i];

  ll ans = -LINF;
  REP(i,n){
    int cur = i;
    ll sum = 0;
    vector<int> loop;
    while(true){
      cur = p[cur];
      sum += c[cur];
      loop.push_back(c[cur]);
      if(cur==i) break;
    }
    ll tmp = 0;
    REP(j,loop.size()){
      tmp += loop[j];
      if(j+1>k) break;
      if(sum>0){
        int cyc = (k-(j+1)) / loop.size();
        chmax(ans, sum*cyc+tmp);
      }
      chmax(ans, tmp);
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3708
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            string S = cin.Read;
            string T = cin.Read;

            char[] array1 = S.ToCharArray();
            char[] array2 = T.ToCharArray();
            int counter = 0;

            for (int i = 0; i < S.Length; i++) {

                    if (array1[i] != array2[i]) {
                        counter++;
                    }
                
            }

            WriteLine(counter);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 28572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

constexpr auto INF = INT_MAX/2;
constexpr auto MOD = 1000000007;

int main() {
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	vi p(a), q(b), r(c);
	rep(i, a)cin >> p[i];
	rep(i, b)cin >> q[i];
	rep(i, c)cin >> r[i];

	sort(all(p),greater<int>());
	sort(all(q),greater<int>());
	rep(i, x)r.push_back(p[i]);
	rep(i, y)r.push_back(q[i]);
	sort(all(r),greater<int>());

	ll ans = 0;
	rep(i, x + y)ans += r[i];
	cout << ans << endl;
}

Measured memory_bytes: 2552
//98B
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;
int main(void){
    int n;
    int ans=0;
    string s, s1, s2, s3=" ";
    cin >> n >> s;
    for(int i=1; i<n; i++){
        s1 = s.substr(0,i);
        s2 = s.substr(i,n-i);
        //cout << s1 << ' '<< s2 << ' '<< s3 << endl;
        int cnt =0;
        s3=" ";
        rep(j, s1.size()){
            if(s2.find(s1[j]) !=-1 and s3.find(s1[j]) ==-1){
                cnt+=1;
                s3+=s1[j];
            }
        }
        if(ans< cnt) ans = cnt;
        
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
//using arr = array;
using pi = pair<ll, ll>;
using vi = vector<ll>;
using vpi = vector<pi>;
using ld = long double;
#include<bits/extc++.h>
using namespace __gnu_pbds;
using oset = tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;
const int maxn = 1<<18, mod = 1e9 + 7, lg = 19;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll n,a[maxn];
ll ans;
map<array<int, 3>, ll> dp;
ll dfs(int i, int b, int l) {
	if(dp.count({i, b, l})) return dp[{i, b, l}];
	if(abs(b) > 3) return -(1ll<<50);
	if(i > n) return (i+b)/2 == n/2 ? 0 : -(1ll<<50);
	if(l == 0) {
		return dp[{i, b, l}] = max(a[i] + dfs(i+1, b+1, 1), dfs(i+1, b-1, 0));
	}
	return dp[{i, b, l}] = dfs(i+1, b-1, 0);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	cout << dfs(1, 0, 0);
	return 0;
}


Measured memory_bytes: 80200
#include<bits/stdc++.h>
using namespace std;
typedef int sign;
typedef long long ll;
#define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
#define Fordown(i,a,b) for(register sign i=(sign)(a);i>=(sign)(b);--i)
const int N=1e5+5;
template<typename T>bool cmax(T &a,T b){return (a<b)?a=b,1:0;}
template<typename T>bool cmin(T &a,T b){return (a>b)?a=b,1:0;}
template<typename T>T read()
{
	T ans=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')f=-1,ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
	return ans*f;
}
template<typename T>void write(T x,char y)
{
	if(x==0)
	{
		putchar('0'),putchar(y);
		return;
	}
	if(x<0)
	{
		putchar('-');
		x=-x;
	}
	static char wr[20];
	int top=0;
	for(;x;x/=10)wr[++top]=x%10+'0';
	while(top)putchar(wr[top--]);
	putchar(y);
}
void file()
{
#ifndef ONLINE_JUDGE
	freopen("in","r",stdin);
	freopen("out","w",stdout);
#endif
}
int n,a[N];
void input()
{
	n=read<int>();
	For(i,1,n)a[i]=read<int>();
}
struct node
{
	int id,num;
}odd[N],even[N];
int top1,top2;
bool cmpid(node a,node b){return a.id<b.id;}
bool cmpnum(node a,node b){return a.num>b.num;}
void work()
{
	For(i,1,n)if(i&1)odd[++top1]=(node){a[i],1};
	sort(odd+1,odd+top1+1,cmpid);
	int top=top1;top1=0;
	For(i,1,top)
	{
		if(i==1||odd[top1].id^odd[i].id)odd[++top1]=odd[i];
		else odd[top1].num++;
	}
	sort(odd+1,odd+top1+1,cmpnum);


	For(i,1,n)if(!(i&1))even[++top2]=(node){a[i],1};
	sort(even+1,even+top2+1,cmpid);
	top=top2;top2=0;
	For(i,1,top)
	{
		if(i==1||even[top2].id^even[i].id)even[++top2]=even[i];
		else even[top2].num++;
	}
	sort(even+1,even+top2+1,cmpnum);
	odd[top1+1]=(node){0,0};
	even[top2+1]=(node){0,0};
	if(odd[1].id^even[1].id)write(n-odd[1].num-even[1].num,'\n');
	else
	{
		int ans=max(odd[1].num+even[2].num,odd[2].num+even[1].num);
		write(n-ans,'\n');
	}
}
int main()
{
	//file();
	input();
	work();
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cmath>
using namespace std;
int main(void) {
    long n, m=1;
    cin >> n;
    for(int i=0;i<n;i++) {
        m = (m * (i+1)) % ((int)pow(10, 9) + 7);
    }
    cout << m << endl;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
#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 inf 9000000000000000000
#define all(x) x.begin(),x.end()
#define sz(x) (ll)(x).size()
#define trav(a,x) for(auto& a : x)

int main(){
  ios::sync_with_stdio(0);
  ll n;
  ll res = 0;
  string a,b,c; cin >> n >> a >> b >> c;
  rep(i,0,n){
    if (a[i] == b[i]) {
      if (c[i] == a[i]) continue;
      else res++;
    } else if (a[i] == c[i]) res++;
    else if (b[i] == c[i]) res++;
    else res += 2;
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> p;
typedef vector<p> vp;
int n,k;
priority_queue<p,vp,greater<p> >  que;
ll ans=0;
int main(int argc,char const* argv[])
{
  cin >> n >>k;
  ll b=n/k;
  ans+=b*b*b;
  if(k%2==0)
    {
      ll a=(n+k/2)/k;
      ans+=a*a*a;
    }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
from collections import Counter

H, W = map(int, input().split())
mat = [input() for _ in range(H)]
cnts = Counter(c for r in mat for c in r)
odd = 0
if H % 2:
    odd += 1
if W % 2:
    odd += 1


def solve():
    v1 = list(cnts.values())
    rest = sum(v1)
    assert rest == H * W
    v2, v3 = [], []
    for v in v1:
        rest -= v - v % 4
        if v % 4:
            v2.append(v % 4)
    if odd == 0:
        return rest == 0 and not v2
    if H % 2 and W % 2 == 0 and rest > W:
        return False
    if H % 2 == 0 and W % 2 and rest > H:
        return False
    if H % 2 and W % 2 and rest > H + W - 1:
        return False
    for v in v2:
        rest -= v - v % 2
        if v % 2:
            v3.append(v % 2)
    if odd == 1:
        return rest == 0 and not v3
    return rest == 1 and len(v3) == 1


print("Yes" if solve() else "No")


Measured memory_bytes: 3316
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>

bool is_same(char *x, char *y, int y_len)
{
    for (int i = 0; i <= y_len; i++)
    {
        if (tolower(x[i]) != tolower(y[i]))
        {
            return false;
        }
    }
    return true;
}

bool mystrcmp(const char *s1, const char *s2) //s1にs2が含まれていればbreakするようにしたい
{
    while (*s2)
    {
        if (*s1 != *s2)
        {
            return false;
        }
        s1++;
        s2++;
    }
    return true;
}

bool count_string(char *s1, char *s2) //文字列s1の中に文字列s2が何個含まれるかカウント
{
    int len = strlen(s2);
    while (*s1)
    {
        if (is_same(s1, s2, len))
        {
            return true;
        }
        s1++;
        s2++;
    }
    return false;
}

int main(void)
{
    char W[11];
    char T[1001];
    char end[] = {"END_OF_TEXT"};
    int count_W = 0;

    scanf("%s", W);
    scanf("%s", T);

    while (!mystrcmp(T, end))
    {
        if (count_string(T, W))
        {
            count_W++;
        }
        scanf("%s", T);
    }
    printf("%d\n", count_W);

    return 0;
}



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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll r; cin >> r; cout << 3 * r * r << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort(key=lambda x:x[0])
answer = 0
for ab in AB:
    if M - ab[1] <= 0:
        answer += M * ab[0]
        break
    else:
        answer += ab[0] * ab[1]
        M -= ab[1]
print(answer)


Measured memory_bytes: 29020
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    string S; cin >> S;
    bool x = true;
    for (int i = 1; i < S.size(); ++i) {
        x &= S[i-1] != S[i];
    }
    if (x) cout << "Good" << endl;
    else cout << "Bad" << endl;
}


Measured memory_bytes: 256
N, *XL = map(int, open(0).read().split())

A = sorted(((x - l, x + l) for x, l in zip(*[iter(XL)] * 2)), key=lambda x: x[1])

ans = 0
cur = -10 ** 9
for s, t in A:
    if cur <= s:
        ans += 1
        cur = t

print(ans)

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

int main()
{
    long A, B, K;
    long a, b;
    cin >> A >> B >> K;
    a = max(long(0), A-K);
    K = max(long(0), K-A);
    b = max(long(0), B-K);
    cout << a << " " << b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,c=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if((i+1)%2 && a[i]%2)
        c++;}
        cout<<c;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll N,M,K;
  cin>>N>>M>>K;
  ll a[N],b[M];
  ll sum=0;
  ll sumsum=0;
  ll counta=-1,countb=0;
  ll ans=0;
  rep(i,N){
    cin>>a[i];
    if(sumsum+a[i]<=K){
      sum+=a[i];
      ans++;
      counta=i;
    }
    sumsum+=a[i];
  }
  sumsum=sum;
  
  rep(i,M){
    cin>>b[i];
    if(sumsum+b[i]<=K){
      sum+=b[i];
      ans++;
      countb++;
    }
    sumsum+=b[i];
  }
  ll ma=ans;
  for(int i=counta;i>=0;i--){
    sum-=a[i];
    ans--;
    while(sum+b[countb]<=K&&countb<M){
      sum+=b[countb];
      countb++;
      ans++;
    }
    ma=max(ma,ans);
  }
  cout<<ma<<endl;
  
}


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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	const int k = (n / 2) + 1;
	for(int i = 0; i < n; ++i){
		if(i != 0){ cout << " "; }
		cout << (i < k ? 0 : m);
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) ((int)(x).size())
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

const int inf = 1 << 30;
const ll INF = 1LL << 60;

int main(){
    int n;
    cin >> n;
    int ans = 0;
    int ba = 0, a = 0, b = 0;
    rep(i,n){
        string s;
        cin >> s;
        for(int j = 0; j < sz(s)-1; j++){
            if (s[j] == 'A' && s[j+1] == 'B') ans++;
        }
        if (s[0] == 'B' && s[sz(s)-1] == 'A') ba++;
        else if (s[0] == 'B') b++;
        else if (s[sz(s)-1] == 'A') a++;
    }
    if (ba == 0){
        ans += min(a, b);
    }else{
        if (a == 0 && b == 0){
            ans += ba-1;
        }else{
            ans += ba;
            ans += min(a, b);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3568
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int i = a; i <= (n); ++i)
#define repD(i, a, n) for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a) memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;


int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	int n; cin >> n; vi a1(n), a2(n);
	rep(i,n) cin >> a1[i];
	rep(i,n) cin >> a2[i];
	vi aa1(n+1), aa2(n+1);
	aa1[0] = 0;
	aa2[0] = 0;
	repA(i,1,n) aa1[i] = aa1[i-1] + a1[i-1];
   	repA(i,1,n) aa2[i] = aa2[i-1] + a2[n-i];
	int ans = 0;
	repA(i,1,n)
		ans = max(ans, aa1[i] + aa2[n+1-i]);
	cout << ans << endl;	
	return 0;
}



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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  for (int i = 0; i < n; i++) cin >> p.at(i);
  int s = 0;
  for (int i = 0; i < k; i++) s += p.at(i);
  int smax = s;
  for (int i = k; i < n; i++) {
    s += p.at(i) - p.at(i - k);
    if (s > smax) smax = s;
  }
  cout << setprecision(17) << 0.5 * (smax + k) << endl;
}


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

#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

const ll INF = 1LL << 60;

ll mod=1000000007;

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;}


int main() {
  string s;cin>>s;
  int m9=0;
  for(auto c:s){
    int d=c-'0';
    m9+=d;
  }
  m9%=9;
  cout<<(m9==0?"Yes":"No");
}

Measured memory_bytes: 3716
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
import math
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n, d = map(int, input().split())

    print(int(math.ceil(n / (d * 2 + 1))))


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 29292
// use proconio::marker::Chars;
use proconio::{fastout, input};
// use std::cmp::{max, min};

#[fastout]
fn main() {
    input! {
        d: usize
    };

    match d {
        25 => println!("Christmas"),
        24 => println!("Christmas Eve"),
        23 => println!("Christmas Eve Eve"),
        _ => println!("Christmas Eve Eve Eve"),
    }
}


Measured memory_bytes: 2140