akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include<cstdint>
#include<unordered_map>
#include<boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

typedef pair<int, int> P;

bool pairsort1(const P& element1, const P& element2)
{//first昇順
	return element1.first < element2.first;
}
bool pairsort2(const P& element1, const P& element2)
{//first降順
	return element1.first > element2.first;
}
bool pairsort3(const P& element1, const P& element2)
{//second昇順
	return element1.second < element2.second;
}
bool pairsort4(const P& element1, const P& element2)
{//second降順
	return element1.second > element2.second;
}

int main() {
	int n;
	cin >> n;
	vector<pair<int, int>>x(n);
	rep(i, n) {
		scanf("%d",&x[i].F);
		x[i].second = i;
	}
	sort(all(x), pairsort1);
	int ans1 = x[n / 2 - 1].first;
	int ans = x[n / 2].first;
	rep(i, n) {
		int ite = x[i].second;
		if (x[i].second >= n / 2) {
			x[ite].first = ans1;
		}
		else {
			x[ite].first = ans;
		}
	}
	sort(all(x), pairsort3);
	rep(i, n) {
		printf("%d\n",x[i].first);
	}

}



Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 1000000000000000000;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
    ll N;cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    ll ans = 0,pre = 0;
    rep(i,N){
        if(pre <= A[i]){
            ans += pre;
            ans += (A[i]-pre) / 2;
            pre = A[i] - pre - ((A[i]-pre)/2) * 2;
        }else{
            ans += A[i] / 2;
            pre = 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <string> vs;
typedef vector <long long> vll;
typedef vector <pii> vpii;
typedef vector <vi> vvi;
typedef vector <vll> vvll;

#define forn(i, n) for((i) = 0; (i) < (n); (i)++)
#define form(i, m, n) for((i) = m; (i) < (n); (i)++)
#define vsort(v) sort((v).begin(), (v).end())

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll n, k, m, i;
    vi a;

    cin >> n >> k;

    forn(i, n)
    {
        cin >> m;
        a.push_back(m);
    }
    vsort(a);

    m = 0;
    forn(i, k)
    {
        m += a[i];
    }
    cout << m;

    return 0;
}

Measured memory_bytes: 3604
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_A&lang=jp

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    s = input().strip()
    toggled = s.swapcase()
    print(toggled)


if __name__ == '__main__':
    main(sys.argv[1:])
    

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

int main() {
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    for(auto& e:a){
        cin >> e;
    }
    auto sum = accumulate(begin(a),end(a),0);
    int cnt = 0;
    for(auto e:a){
        cnt += 4*m*e >= sum;
    }
    cout << (cnt >= m ? "Yes\n" : "No\n");
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Joy
 */

#include <bits/stdc++.h>

#define REP(i, N) for (ll i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF ll(1e9)
#define INFL ll(1e18)
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int ctoi(char c) {return c - '0';}

ll mod_pow(ll N, ll P) {
    if (P == 0) return 1;
    if (P % 2 == 0) {
        ll t = mod_pow(N, P/2);
        return t*t;
    }
    return (N * mod_pow(N, P-1));
}

class DCaracalVsMonster {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll H; in >> H;
	    ll ans = 1;
	    while (H > 1) {
	        H /= 2;
	        ans = ans << 1;
	        ans += 1;
	    }
        out << ans << '\n';
	}
};


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

	DCaracalVsMonster solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int N, M;

int main(void)
{
    cin >> N >> M;
    int ans = 1;
    for (int i = 1; i * i <= M; i++)
    {
        if (M % i == 0)
        {
            int j = M / i;
            if ((long)i * N <= M)
                ans = max(ans, i);
            if ((long)j * N <= M)
                ans = max(ans, j);
        }
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;



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

	}

	ll cnt = 0;
	for (int i = n-1; i >= 0;i--) {
		cnt += (b[i] - ((a[i] + cnt) % b[i])) % b[i];
		
	}

	cout << cnt << endl;
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<string>
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define ll long long
#define mod (ll)(1e9+7)
#define nax (ll)(1e5)
#define INFL LLONG_MAX
#define NINFL LLONG_MIN
#define INF INT_MAX
#define disp(a,n,arr) for(int i=a;i<(ll)n;i++) cout << arr[i] << " "; cout << "\n";
#define check cout << "Working\n";
#define pi pair<int,int>
#define pl pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vpl vector<pl>
#define vpi vector<pi>
#define vb vector<bool>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(a) a.begin(),a.end()
using namespace std;

int main() {
	FIO;
	int t = 1;
	//cin >> t;
	while (t--) {
		ll n,k;
		cin >> n >> k;
		string s;
		cin >> s;
		for(int i=0;i<n;i++){
			if(i == k-1) cout << (char)tolower(s[i]) ;
			else cout << s[i];
		}
		cout << "\n";
	}
	


	return 0;
}


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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 1000000007LL

#define cil(a,b) ( ((a)%(b) == 0)?((a)/(b)):((a)/(b)+1) )

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;

ll mypow(ll a, ll b) { if(b == 0) return 1; ll temp=mypow(a,b/2); temp=(temp*temp)%INF; if(b%2 == 1) temp=(a*temp)%INF; return temp; }
int mygcd(int a, int b) { if(b==0) return a; return mygcd(b,a%b); }
int cntBits(ll a) { int ret=0; while(a>0) { ret++; a/=2; } return ret; }
int main()
{
	ios::sync_with_stdio(0);
	int tt=1; 
//	cin >> tt;
	for(int tcase=1;tcase<=tt;tcase++)
	{
		int x,y; cin >> x >> y;
		cout << x+(y/2) << "\n";
	}
	return 0;
}

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

int top,S[1000];

void push(int x)
{
	S[++top] = x;
	
}
int pop()
{
	top--;
	return S[top+1];
}

int main(void)
{
	int a,b;
	char s[100];
	while(scanf("%s",s) != EOF)
	{
		if(s[0] =='+')
		{
			a= pop();
			b= pop();
			push(a+b);
		}
		else if(s[0] =='-')
		{
			b= pop();
			a= pop();
			push(a-b);
		}
		else if(s[0] =='*')
		{
			b= pop();
			a= pop();
			push(a*b);
		}
		else
		{
			push(atoi(s));
		}
	}
	
	printf("%d\n",pop());
	
	return 0;
}

Measured memory_bytes: 548
#include<stdio.h>

int main(void){
  int n,k,i,a=1;

  scanf("%d %d",&n,&k);

  for(i=0;i<n;i++){
    if(a<k) a*=2;
    else a+=k;
  }

  printf("%d\n",a);

  return 0;
}

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

int main(){
  string S;
  cin >> S;
  int distanceA=0;
  int distanceB=0;
  int N = S.size();
  for(int i=0;i<N;i++){//終了状態0101010...との距離(distanceA)を測る
    if(i%2==0){
      if(S.at(i) == '0'){
        distanceA ++;
      }
    }else{
      if(S.at(i) == '1'){
        distanceA ++;
      }
    }
  }
    for(int i=0;i<N;i++){//終了状態0101010...との距離(distanceA)を測る
    if(i%2==0){
      if(S.at(i) == '1'){
        distanceB ++;
      }
    }else{
      if(S.at(i) == '0'){
        distanceB ++;
      }
    }
    }
  cout << min(distanceA,distanceB) << endl;
}


Measured memory_bytes: 512
#include <iostream>
int main(){
  int N,ans=0;
  std::cin>>N;
  int b[N-1];
  for (int i=0;i<N-1;i++){
    std::cin>>b[i];
  }
  for (int i=0;i<N;i++){
    if(i==0){
      ans+=b[0];
    }else if(i==N-1){
      ans+=b[N-2];
    }else{
      ans+=std::min(b[i-1],b[i]);
    }
  }
  std::cout<<ans<<std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
#define ll long long
#define ld long double
     
int main(){
  ll n; cin >> n;
  vector<ll> a(n+1); rep(i,n+1) cin >> a[i];
  vector<ll> b(n);   rep(i,n) cin >> b[i];
  
  ll destroy = 0;
  for(ll i = 1; i <= b.size(); i++){
    ll enemySum = a[i-1] + a[i];
    if(enemySum>=b[i-1]){
      destroy += b[i-1];
      if(a[i-1]<b[i-1]){a[i] -= (b[i-1]-a[i-1]); a[i-1] = 0;}
    }else{
      destroy += (a[i-1]+a[i]);
      a[i-1] = 0; a[i] = 0;
    }
  }
  cout << destroy << endl;
}

Measured memory_bytes: 4824
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

int main() {
    int n, q, k, b, e;
    cin >> n;
  	int a[n];
  	for (int i = 0; i < n; i++) cin >> a[i];
  	cin >> q;
  	for (int i = 0; i < q; i++)
  	{
        cin >> b >> e >> k;
        cout << count(a+b,a+e,k) << endl;
  	}
	return 0;
}


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

int main(){
    int n,a,min=1000000001,max=0;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a;
        if(a<min) min=a;
        if(a>max) max=a;
    }
    cout << max-min << endl;
    return 0;
}

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

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1061109567
#define int long long
#define pb push_back
#define in(s) freopen(s,"r",stdin);
#define out(s) freopen(s,"w",stdout);
#define fi first
#define se second
#define bw(i,r,l) for (int i=r-1;i>=l;i--)
#define fw(i,l,r) for (int i=l;i<r;i++)
#define fa(i,x) for (auto i:x)
using namespace std;
const int N=2e5+5;
int n,k,a[N];
map<int,int> pos;
vector<int> v;
struct fenwick {
	int t[N];
	void init() {
		memset(t,0,sizeof(t));
	}
	void upd(int pos,int val) {
		pos++;
		for (;pos<=v.size();pos+=(pos&-pos)) t[pos]+=val;
	}
	int get(int pos) {
		pos++;
		long long ans=0;
		for (;pos>0;pos-=(pos&-pos)) ans+=t[pos];
		return ans;
	}
} t;
signed main() {
	#ifdef aome
	in("aome.inp");	
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>n>>k;
	fw (i,0,n) cin>>a[i], a[i]-=k;
	/*
	Count the number of ranges having a sum >= 0
	psum[r] - psum[l - 1] >= 0. So psum[r] >= psum[l - 1]. This can be easily processed with
	coordinate compression and a BIT.
	*/
	v.pb(0);
	int cur=0;
	fw (i,0,n) cur+=a[i], v.pb(cur);
	sort(v.begin(),v.end());
	v.resize(unique(v.begin(),v.end())-v.begin());
	fw (i,0,v.size()) pos[v[i]]=i;
	t.init();
	t.upd(pos[0],1);
	cur=0;
	long long ans=0;
	fw (i,0,n) {
		cur+=a[i];
		ans+=t.get(pos[cur]);
		t.upd(pos[cur],1);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 17392
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll a,b,c,i,j,k,l,m,n,ans,tmp,hoge,fuga,piyo;
ll x[10010],y[10010];
string s,str;
int main(){
  cin>>s;
  if(s=="ABC")cout<<"ARC";
  else cout<<"ABC";
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <stack>
#include <cstdio>
#include <cmath>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using P1 = pair<int, P>;
#define FOR(t, a, b) for (int t = (a); t < (b); ++t)
#define REP(t, n) FOR(t, 0, n)

string s;
int k;
string ans[5];
vector<string> setted;

void change(string q)
{
    auto itr = find(setted.begin(), setted.end(), q);
    if (itr != setted.end())
    {
        return;
    }
    setted.push_back(q);
    if (q < ans[0])
    {
        ans[4] = ans[3];
        ans[3] = ans[2];
        ans[2] = ans[1];
        ans[1] = ans[0];
        ans[0] = q;
    }
    else if (q < ans[1])
    {
        ans[4] = ans[3];
        ans[3] = ans[2];
        ans[2] = ans[1];
        ans[1] = q;
    }
    else if (q < ans[2])
    {
        ans[4] = ans[3];
        ans[3] = ans[2];
        ans[2] = q;
    }
    else if (q < ans[3])
    {
        ans[4] = ans[3];
        ans[3] = q;
    }
    else if (q < ans[4])
    {
        ans[4] = q;
    }
}

int main()
{
    cin >> s >> k;
    REP(i, 5)
    {
        ans[i] = "zzzzz";
    }
    REP(i, s.length())
    {
        FOR(j, 1, 6)
        {
            if (i + j <= s.length())
            {
                change(s.substr(i, j));
            }
        }
    }
    cout << ans[k - 1] << endl;

    return 0;
}


Measured memory_bytes: 1024
N = int(input())
H_list = [int(i) for i in input().split()]
count = 0
counter_list =[]

for i in range(N-1):
    if H_list[i] >= H_list[i+1]:
        count += 1
    else:
        counter_list.append(count)
        count = 0

counter_list.append(count)

sort_list = sorted(counter_list)
print(sort_list[len(sort_list) - 1])

Measured memory_bytes: 14224
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 
int n,deg[101010],k=0,ans[101010];
vi adj[101010];
map<pi,int> mp;

void dfs(int s, int p, int col){
	int cur = 0;
	for(auto t:adj[s]){
		if(t==p)continue;
		cur++;
		if(col==cur)cur++;
		int x = s;
		int y = t;
		if(x>y)swap(s,t);
		ans[mp[{s,t}]]=cur;
		dfs(t, s, cur);
	}
}

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

	
	cin >> n;
	for(int i=1;i<n;i++){
		int x,y;
		cin >> x >> y;
		adj[x].pb(y);
		adj[y].pb(x);
		mp[{x,y}]=i;
		deg[x]++;
		deg[y]++;
	}
	for(int i=1;i<=n;i++){
		k = max(k, deg[i]);
	}
	dfs(1,-1, 0);
	cout << k << endl;
  for(int i=1;i<n;i++){
  	cout << ans[i] << endl;
  }
    

return 0;
}
///....


Measured memory_bytes: 16384
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
const int maxn = 100005;
int N, M;
struct Node {
	int x, y, id;
} p[maxn];
bool cmpx(const Node &x, const Node &y) {
	return x.x < y.x;
}
bool cmpy(const Node &x, const Node &y) {
	return x.y < y.y;
}
struct Edge {
	int u, v, w;
	Edge(int u = 0, int v = 0, int w = 0) : 
		u(u), v(v), w(w) {}
	bool operator < (const Edge &x) const {
		return w < x.w;
	}
} e[maxn << 1];
int f[maxn];
int find(int x) {
	return f[x] == x ? x : f[x] = find(f[x]);
}
int main() {
	scanf("%d", &N);
	for(int i = 1; i <= N; ++i) {
		scanf("%d %d", &p[i].x, &p[i].y);
		p[i].id = i;
	}
	sort(p + 1, p + N + 1, cmpx);
	for(int i = 1; i < N; ++i)
		e[++M] = Edge(p[i].id, p[i + 1].id, p[i + 1].x - p[i].x);
	sort(p + 1, p + N + 1, cmpy);
	for(int i = 1; i < N; ++i)
		e[++M] = Edge(p[i].id, p[i + 1].id, p[i + 1].y - p[i].y);
	sort(e + 1, e + M + 1);
	for(int i = 1; i <= N; ++i) f[i] = i;
	long long ans = 0;
	for(int i = 1; i <= M; ++i) {
		int fa = find(e[i].u), fb = find(e[i].v);
		if(fa == fb) continue;
		ans += e[i].w;
		f[fb] = fa;
	}
	printf("%lld\n", ans);
	return 0;
}

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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end

#include <atcoder/lazysegtree>
#include <atcoder/modint>
//python3 ac-library/expander.py sol.cpp

using Fp=atcoder::modint998244353;
struct P{Fp a,b;};
P f(P a,P b){return P{a.a+b.a,a.b+b.b};};
P e(){return P{0,0};}
P g(P a,P b){
   return P{a.a*b.a+a.b*b.b,b.b};
};
P h(P a,P b){
   return P{a.a*b.a,a.a*b.b+a.b};
};
P id(){return P{1,0};}

int main(){
   int n,q; cin>>n>>q;
   vector<P> a(n);
   rep(i,0,n){
      int x; cin>>x;
      a[i]=P{x,1};
   }
   atcoder::lazy_segtree<P,f,e,P,g,h,id> seg(a);
   rep(i,0,q){
      int t; cin>>t;
      if(t==0){
         int lb,rb,b,c; cin>>lb>>rb>>b>>c;
         seg.apply(lb,rb,P{b,c});
      }
      if(t==1){
         int lb,rb; cin>>lb>>rb;
         cout<<seg.prod(lb,rb).a.val()<<endl;
      }
   }
   return 0;
}

Measured memory_bytes: 19284
#include <stdio.h>

int main(void)
{
	int n,h,w,a[1001],b[1001],i,m;
	scanf("%d %d %d",&n,&h,&w);
	
	m=n;
	
	for(i=0;i<n;i++){
		scanf("%d %d",&a[i],&b[i]);
		if(a[i]<h||b[i]<w)m=m-1;
	}
	
	printf("%d\n",m);
	return 0;
}

Measured memory_bytes: 128
/**************
*	Shell Sort
*************/

#include <iostream>
#include <vector>	//??£?¨?
using namespace std;

void insertionSort(vector<int>* A, int g, int* cnt  ){

	for(unsigned int i=g ; i<(A->size()); i++){
		int v = (*A)[i];
		int j = i-g;
		while(j>=0 && (*A)[j]>v){
			(*A)[j+g] = (*A)[j];
			j = j-g;
			(*cnt)++;
		}
		(*A)[j+g] =v;
	}
	return ;
}
//---------------------------------------------------------
void shellSort(vector<int>* A, vector<int>* G, int* cnt){
//	*cnt =0;
//	int m = A->size();
//	vector<int> G(1,m);
	for(unsigned int i=0; i<(G->size()); i++){
		insertionSort(A, (*G)[i], cnt);
	}

	return;
}
//--<<???????????¢??°>>-------------------------------------------------------
int main(){

	//??\???
	int n;
	cin >> n;
	vector<int> A;
	A.resize(n);
	for(unsigned int i=0; i< A.size(); i++){
		cin >> A[i];
	}

	//??????
// 	vector<int> G(1,1);
	vector<int> G;
// 	for(int i= n; i!=0; --i){
// 	    G.push_back(i) ;
// 	}

if(88573 < n){
    G.push_back(88573);
}
if(29524 < n){
    G.push_back(29524);
}
if(9841 < n){
    G.push_back(9841);
}
if(3280 < n){
    G.push_back(3280);
}
if(1093 < n){
    G.push_back(1093);
}
if(364 < n){
    G.push_back(364);
}
if(121 < n){
    G.push_back(121);
}
if(40 <n ){
    G.push_back(40);
}
if(13< n){
G.push_back(13);
}
if(4<n){
    G.push_back(4);
}
if(1<=n){
    G.push_back(1);
}

	int cnt = 0;
	shellSort(&A, &G, &cnt);

	//??????
	cout << G.size() << endl;
	for(unsigned int i=0; i<(G.size()); i++){
		cout << G[i];
		if(i!=(G.size()-1)){
			 cout <<" " ;
		}
	}
	cout << endl;
	cout << cnt << endl;
	for(int i=0; i< n; i++){
		cout << A[i]<< endl;
	}

	return 0;
}
//-----------------------------------------------

Measured memory_bytes: 6700
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll INF = 1LL << 58;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;
 
	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}
 
	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}
 
	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}
 
	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}
 
		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);
 
		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;
 
		return true;
	}
};
//x以下の要素への最小index
template <class T> int former(const vector<T> &v, T x) {
  return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
//x以上の要素への最小index
template <class T> int latter(const vector<T> &v, T x) {
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}
//vector書き出し
template <class T1>
void cout_vec(const int n, vector<T1> &vec1){
  rep(i, n){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}
//nCk
ll comb(ll n,ll k){
    ll ans=1;
    FOR(i,n-k+1,n+1){
        ans*=i;
    }
    FOR(i,1,k+1){
        ans/=i;
    }
    return ans;
}
//a,bの最大公約数
ll gcd(ll a,ll b) {
	if (b == 0) return a;
	else return gcd(b, a % b);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> a(n+2);
    vector<int> sum(n+2); 
    a[0]=0;
    a[n+1]=0;
    FOR(i,1,n+1){
        cin>>a[i];
    } 
    int ma=*max_element(a.begin(),a.end());
    int mi=*min_element(a.begin(),a.end());
    sum[0]=0;
    rep(i,n+1){
        sum[i+1]=sum[i]+abs(a[i+1]-a[i]);//観光スポットi+1を訪れるまでにかかる金
    }
    FOR(i,1,n+1){
        if(a[i]>a[i-1] && a[i]>a[i+1]){//極大だったら
            cout<<sum[n+1]-abs(a[i]-a[i-1])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1])<<endl;
        }else if(a[i]<a[i-1] && a[i]<a[i+1]){//極小だったら
            cout<<sum[n+1]-abs(a[i]-a[i-1])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1])<<endl;
        }else{
            cout<<sum[n+1]<<endl;
        }
    }
}

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

int main() {
    ll n;
    cin >> n;
    string *result = new string[n];
    int *c = new int[4];

    string temp;
    for (ll i = 0; i < n; i++) {
        cin >> temp;
        if (temp == "AC") {
            c[0]++;
        } else if (temp == "WA") {
            c[1]++;
        } else if (temp == "TLE") {
            c[2]++;
        } else {
            c[3]++;
        }
    }

    cout << "AC x " << c[0] << endl;
    cout << "WA x " << c[1] << endl;
    cout << "TLE x " << c[2] << endl;
    cout << "RE x " << c[3] << endl;

    return 0;
}

Measured memory_bytes: 6724
#import sys
#import numpy as np
#import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect

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

for i in range(n):
    if a[i]%2==0:
        n2+=1
    if a[i]%4==0:
        n4+=1
if n2==n:
  print("Yes")
  exit()
if n4>=n//2:
    print("Yes")
else:
    if (n2-n4)>=n-2*n4:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 14636
/*
    Queue
    https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/all/ALDS1_3_B
*/
#include <bits/stdc++.h>
using namespace std;
#define MAX 100002

struct Process {
    string name;
    int time;
};

class Queue {
  private:
    Process queue[MAX];
    int head;
    int tail;

  public:
    Queue() {
        head = 0;
        tail = 0;
    }

    void enqueue(Process p) {
        queue[tail] = p;
        if (tail + 1 == MAX)
            tail = 0;
        else
            tail++;
    }

    Process dequeue() {
        Process x = queue[head];
        if (head + 1 == MAX)
            head = 0;
        else
            head++;
        return x;
    }

    bool is_empty() {
        return tail == head;
    }
};

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

    Queue *queue = new Queue();
    int n, time;
    cin >> n >> time;
    for (int i = 0; i < n; i++) {
        string name;
        int rest;
        cin >> name >> rest;
        Process p = Process();
        p.name = name;
        p.time = rest;
        queue->enqueue(p);
    }

    int elaps = 0;
    int diff = 0;
    while (!queue->is_empty()) {
        Process proc = queue->dequeue();
        diff = min(time, proc.time);
        proc.time -= diff;
        elaps += diff;
        if (proc.time > 0)
            queue->enqueue(proc);
        else
            cout << proc.name << " " << elaps << endl;
    }

    delete queue;
}


Measured memory_bytes: 6768
#include<iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  int p[N], temp[3];
  int counter = 0;
  for(int i=0; i<N; ++i){
    cin >> p[i];
  }
  for(int i=1; i<N-1; ++i){
  	if((p[i-1]-p[i])*(p[i]-p[i+1]) >0) counter++;
  }
  cout << counter << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

// sqrt(n) までの素数を求める。1000014129 (31623 * 31623) まで対応
void create_primes(int64_t n, bitset<1000001> & primes) {
	primes.flip();

	int64_t u_b = sqrt(n + 1);
	assert(u_b < 1000002);

	{
		for (int64_t j = 4; j <= u_b; j += 2) {
			primes.reset(j);
		}
	}
	for (int64_t i = 3; i <= u_b; i += 2) {
		if (!primes.test(i)) continue;

		for (int64_t j = i * 2; j <= u_b; j += i) {
			primes.reset(j);
		}
	}
}

struct FactorInfo {
	int64_t v;
	int64_t c;
};

// n の素因数分解を行う。 
bitset<1000001> primes;
vector<FactorInfo> make_factors(int64_t n)
{
	create_primes(n, primes);

	int64_t v = n;
	int64_t limit = sqrt(n + 1);

	vector<FactorInfo> ans;
	FOR_LE(i, 2, limit) {
		if (!primes.test(i)) continue;

		int64_t count = 0;
		while (v % i == 0) {
			v /= i;
			count++;
		}

		if (count != 0) {
			ans.push_back({ i, count });
		}
	}

	if (v != 1) {
		ans.push_back({ v , 1 });
	}

	return ans;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int64_t a, b; cin >> a >> b;

	int64_t g = gcd(a, b);
	vector<FactorInfo> factors = make_factors(g);

	cout << factors.size() + 1 << endl;

	return 0;
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


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

    int N; cin >> N;
    string S; cin >> S;
    int x = 0, ans = 0;
    rep(i, N) {
        if (S[i] == 'I') chmax(ans, ++x);
        else if (S[i] == 'D') --x;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
 
int main(void){
  char s[11];
  scanf("%s", s);
  int flag = 1;
  if(s[0] != 'A') flag = 0;
  int i, count = 0;
  for(i = 2; i < strlen(s) - 1; i++){
    if(s[i] == 'C') count++;
  }
  if(count != 1) flag = 0;
  
  count = 0;
  for(i = 1; i < strlen(s); i++){
    if(s[i] < 'a' || 'z' < s[i]) count++;
  }
  if(count != 1) flag = 0;
  
  if(flag == 0) printf("WA\n");
  else printf("AC\n");
  return 0;
}

Measured memory_bytes: 128
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//main function
fn main() {
    let k:i64 = read();
    if k%2 == 0{
	println!("{}",k*k/4);
    }else{
	println!("{}",k*k/4);
    }
}


Measured memory_bytes: 4352
n, s = map(int, input().split())
a = list(map(int, input().split()))

d = [[0 for _ in range(2)] for _ in range(s+1)]
mod = 998244353

for i in range(n):
    for j in reversed(range(s-a[i]+1)):
        d[j + a[i]][0] += d[j][0]
        d[j + a[i]][1] += d[j][0] * (n - i)
        d[j + a[i]][0] %= mod
        d[j + a[i]][1] %= mod
    if a[i] <= s:
        d[a[i]][0] += i + 1
        d[a[i]][1] += (i + 1) * (n - i)
        d[a[i]][0] %= mod
        d[a[i]][0] %= mod

print(d[s][1])

Measured memory_bytes: 44380
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <random>
#include <complex>
#include <assert.h>

using namespace std;
typedef long long ll;
#define endl '\n'

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

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

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

	double r; cin >> r;
	cout << setprecision(15) << r * 2 * acos(-1) << endl;

	return 0;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void _read(T &x)
{
	x = 0;
	char t = getchar();
	while (!isdigit(t)) t = getchar();
	while (isdigit(t))
	{
		x = x * 10 + t - '0';
		t = getchar();
	}
}
const int MAXN = 1e6 + 10, mo = 998244353;
int n, m, ans, sum, fac[MAXN], inv[MAXN];
inline int C(int n, int m)
{
    return 1ll * fac[n] * inv[m] % mo * inv[n - m] % mo;
}
int main()
{
	_read(n), _read(m);
    if (n < m)
        swap(n, m);
    ans = n;
    fac[0] = fac[1] = inv[0] = inv[1] = 1;
    for (int i = 2; i <= n + m; ++i)
        fac[i] = 1ll * fac[i - 1] * i % mo, inv[i] = 1ll * (mo - mo / i) * inv[mo % i] % mo;
    for (int i = 2; i <= n + m; ++i)
        inv[i] = 1ll * inv[i] * inv[i - 1] % mo;
    for (int i = 1; i <= m; ++i)
        sum = (1ll * C(i << 1, i) * C(n + m - (i << 1), n - i) + sum) % mo;
    printf("%d", (1ll * sum * inv[2] % mo * inv[n + m] % mo * fac[n] % mo * fac[m] + ans) % mo);
    return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
int main(){
    while(1){
	int w;
	int ans=0;
	cin>>w;
	if(w==-1) break;
	if(w<=10) cout<<4280-1150<<endl;
	else if(w<=20) cout<<4280-(1150+(w-10)*125)<<endl;
	else if(w<=30) cout<<4280-(1150+1250+(w-20)*140)<<endl;
	else cout<<4280-(1150+1400+1250+(w-30)*160)<<endl;
    }
    return 0;
}



Measured memory_bytes: 3000
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
	FastIO
	lld n, i;
	cin >> n;
	lld A[n];
	lld count = 0;
	foi(i,n){
		cin >> A[i];
		if (A[i]!=(i+1)){
			count += 1;
		}
	}
	if (count <= 2){
		cout << "YES";
	}
	else
		cout <<  "NO";
	return 0;
}

Measured memory_bytes: 256
import heapq

n,m=map(int,input().split())
a = sorted([int(i) for i in input().split()])
a = list(map(lambda x: x*(-1), a))
heapq.heapify(a)

while m > 0:
    t = heapq.heappop(a)*(-1)//2
    heapq.heappush(a,-t)
    m-=1
print(-sum(a))

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

#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define pr(a, b) pair<a, b>
#define si set<int>
#define sl set<long long>
#define pq prioirty_queue
#define all(v) v.begin(),v.end()
#define left (2*idx)+1
#define right (2*idx)+2
#define frt(i,a,b) for(ll i=a; i<b; i++)
#define rew(i,a,b) for(ll i=a; i>=b; i--)
#define fre(i,a,b) for(ll i=a; i<=b; i++)
#define pb push_back

#define test if(!true)
#define N 1007
#define MOD (ll)(1e9 + 7)

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

    int cur = 0;
    map<pr(int, int), int> m;

    for(int i=2; i<=n; i+=1)
    {
        for(int j=i+1; j<=n; j+=1)
        {
            if(cur == k)
            {
                goto th;
            }

            m[{i, j}] = 1;
            cur+=1;
        }

    }
    th:

    if(cur < k)
    {
        cout << -1 << "\n";
    }
    else
    {
        cout << (n * (n - 1))/2 - m.size() << "\n";

        for(int i=1; i<=n; i++)
        {
            for(int j=i+1; j<=n; j+=1)
            {
                if(m[{i, j}] == 1)
                {
                    continue;
                }
                cout << i << " " << j << "\n";
            }
        }
    }

    return 0;
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const long long MOD = 1e9 + 7;
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;
}

///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
int main() {
    int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K; cin >> K;
    cout << a[K - 1] << endl;
}

Measured memory_bytes: 256
/*
　　　　　　 ＿＿
　　　　　／＞　　 フ
　　　　　|   _　 _l  
　 　　　／` ミ＿x ノ   Zzz..
　　 　 /　 　 　 |   コード見ちゃだめ！！
　　　 /　 ヽ　　  ﾉ
　 　 │　　|　|  |   
　／￣|　　 |　|  |
　| (￣ヽ＿_ヽ_)_ _)
　＼二つ
*/

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) reverse((a).begin(),(a).end())
#define REP(i, n) for(int i = 0; i < n; i++)
const int MOD = 1e9+7;
typedef long long ll;

int main(){
  string s;
  cin>>s;
  int acnt=0;
  int bcnt=0;
  int ccnt=0;
  for(int i=0;i<s.length();i++){
    if(s[i]=='a') acnt++;
    if(s[i]=='b') bcnt++;
    if(s[i]=='c') ccnt++;
  }
  if(abs(acnt-bcnt)<=1 &&abs(acnt-ccnt)<=1 &&abs(bcnt-ccnt)<=1 ) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;


}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  string s;
  cin>>s;
  if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]) {
    cout << "Bad" << endl;
  } else {
    cout << "Good" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        mut a: [i128; n],
    }

    a.sort();
    a.reverse();
    let mut sum = a[0];
    let mut t = n - 2;
    for i in 1..n {
        let lim = 2;
        for _ in 0..lim {
            if t > 0 {
                sum += a[i];
                t -= 1;
            }
        }
    }
    println!("{}", sum);
}



Measured memory_bytes: 8600
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;
 
ll gcd(ll a, ll b){
if(a<b){return gcd(b,a);}
else if(a%b){return gcd(b,a%b);}
else{return b;}
}
int main(){
string a,b,c;
cin>>a>>b>>c;
cout<<a[0]<<b[0]<<c[0]<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <deque>

//using namespace std;
using std::cin, std::cout, std::endl, std::string;
using ll = long long;

#define rep(countName, left, right, up) for (auto countName = left; countName < right; countName += up)
#define REP(countName, end) for (auto countName = 0; countName < end; countName++)
#define rev(countName, right, left, down) for (auto countName = right; countName >= left; countName -= down)
#define REV(countName, end) for (auto countName = end; countName >= 0; countName--)

auto solve1(ll x)
{
    for (ll a = -200; a <= 200; a++)
    {
        for (ll b = -200; b <= 200; b++)
        {
            ll A = a * a * a * a * a, B = b * b * b * b * b;
            //cout << A << " " << B << " " << A - B - x << endl;
            if (A - B - x == 0)
            {
                return std::make_pair(a, b);
            }
        }
    }
    return std::make_pair(-1LL, -1LL);
}

int main(void)
{
    ll x;
    cin >> x;
    auto pair = solve1(x);
    std::cout << pair.first << " " << pair.second << std::endl;
    return 0;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
int main()
{
	int n;
	std::cin>>n;
	int arr[n];
	for(int i=0;i<n;i++)
	std::cin>>arr[i];
	int j=0;
	for(int i=1;i<n-1;i++)
	{
		if(arr[i]<arr[i-1] and arr[i]>arr[i+1])
		j++;
		else if(arr[i]>arr[i-1] and arr[i]<arr[i+1])
		j++;
	}
	std::cout<<j<<"\n";
}

Measured memory_bytes: 3516
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long a,b,c,i;
	cin>>a>>b>>c;
	  for(i=1;i<=b;i++)
	  {
	  	if((a*i)%b==c){cout<<"YES"<<endl;return 0;}
	  }
	  printf("NO\n");
	  	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a;
  cin>>a;
  ll b=0;
  vector<ll>vec(a+1);
  for(ll i=0;i<a+1;i++){
    cin>>vec.at(i);
    b+=vec.at(i);
  }
  for(ll i=0;i<a;i++){
    ll c;
    cin>>c;
    if(vec.at(i)>c){
      vec.at(i)-=c;
    }
    else{
      
      ll g=0;
      vec.at(i+1)=max(g,vec.at(i+1)-c+vec.at(i));
      vec.at(i)=0;
    }
  }
    
  ll s=0;
  for(ll i=0;i<a+1;i++){
    s+=vec.at(i);
  }
  cout<<b-s<<endl;
  return 0;
}

  
  
    
  


Measured memory_bytes: 3984
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
A.sort()
BC = [0]*M
for i in range(M):
    BC[i] = tuple(map(int, input().split()))

BC.sort(key=lambda x: x[1], reverse=True)

idx, flg = 0, 0
for i in BC:
    B, C = i
    for i in range(B):
        if idx > N-1:
            flg = 1
            break
        if A[idx] >= C:
            flg = 1
            break
        else:
            A[idx] = C
            idx += 1
            B -= 1
            if B == 0:
                break
    if flg:
        break

print(sum(A))


Measured memory_bytes: 22520
#include <stdio.h>
#include <stdlib.h>
 
void merge_sort (int array[], int left, int right) {
  int i, j, k, mid;
  int work[200001];  // 作業用配列
  if (left < right) {
    mid = (left + right)/2; // 真ん中
    merge_sort(array, left, mid);  // 左を整列
    merge_sort(array, mid+1, right);  // 右を整列
    for (i = mid; i >= left; i--) { work[i] = array[i]; } // 左半分
    for (j = mid+1; j <= right; j++) {
      work[right-(j-(mid+1))] = array[j]; // 右半分を逆順
    }
    i = left; j = right;
    for (k = left; k <= right; k++) {
      if (work[i] < work[j]) { array[k] = work[i++]; }
      else                   { array[k] = work[j--]; }
    }
  }
}
 
int main(void){
    
    int n;
    scanf("%d",&n);
    
    int a[200002]={0};
    
    int furui[1000001]={0};
    int ans=0;
    for(int i=1;i<=n;i++){
    scanf("%d",&a[i]);
    }
    
    merge_sort(a, 1, n);
    
    for (int i=1; i<=n; i++) {
        
        if(furui[a[i]]==0){
            for(int j=a[i];j<=1000001;j+=a[i]){
                furui[j]=1;
            }
            if (a[i]!=a[i-1]&&a[i]!=a[i+1]){
                ans++;
            }
        }
        
    }
   /* 
    for (int i=1; i<=n; ++i) {
        printf("%d ",a[i]);
    }
    printf("\n");
    for (int i=0; i<primenum; ++i) {
        printf("%d ",prime[i]);
    }
    printf("\n");
    */
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 20480
//============================================================================
// Author       : Sun YaoFeng
//============================================================================

//#pragma 	comment(linker, "/STACK:100240000,100240000")
//#include	<cstdio>
//#include	<cstdlib>
//#include	<cstring>
//#include	<algorithm>

#include	<bits/stdc++.h>

using	namespace	std;

#define DB		double
#define	lf		else if
#define I64		long long
#define	Rd()	(rand()<<15|rand())
#define For(i,a,b)	for(int i=a,lim=b;i<=lim;i++)
#define Rep(i,a,b)	for(int i=a,lim=b;i>=lim;i--)

#define	fi	first
#define se	second
#define MK	make_pair
#define PA	pair<int, int>

//#define	min(a,b)	((a)<(b)?(a):(b))
//#define	max(a,b)	((a)<(b)?(b):(a))

#define	CH	(ch=getchar())
int		IN()	{
		int x= 0, f= 0, ch;
		for	(; CH < '0' || ch > '9';)	f= (ch == '-');
		for	(; ch >= '0' && ch <= '9'; CH)	x= x*10 + ch -'0';
		return	f? -x : x;
}

#define n	15

int		N, M, C, F[n][n];

char	s[n][n];

int		main(int argc, char* argv[]){
		N= IN();
		M= IN();
		For(i, 1, N)	scanf("%s", s[i] + 1);
		
		For(i, 1, N)	For(j, 1, M)	C+= s[i][j] == '#';
		
		if	(C != N+M-1 || s[1][1] != '#')	puts("Impossible");
		else	{
			F[1][1]= 1;
			For(i, 1, N)	For(j, 1, M)	if	(i != 1 || j != 1)
				F[i][j]= F[i-1][j] || F[i][j-1];
			
			puts(F[N][M] ? "Possible" : "Impossible");
		}
		
		return	0;
}

Measured memory_bytes: 764
a, b = input().split()
product = int(a) * int(b);
complete = product
tmp = product
for i in range(2, min(int(a), int(b)) + 1):
    tmp = product / i
    if tmp % int(b) == 0 and tmp % int(a) == 0:
        complete = tmp
print(int(complete))


Measured memory_bytes: 2940
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

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

        Map<String, Boolean> an = new HashMap<String, Boolean>();
        for (int i = 0; i < s.length(); i++) {
            String k = s.substring(i, i+1);
            if (an.containsKey(k)) {
                System.out.println("no");
                System.exit(0);
            } else {
                an.put(k, true);
            }
        }

        System.out.println("yes");
    }

}

Measured memory_bytes: 23892
#%%
def search(x, y, z):
    return [[x-1, y, z+1], [x, y-1, z+1], [x, y+1, z+1], [x+1, y, z+1]]
    
h, w = map(int, input().split())
s = [[] for _ in range(h)]
for i in range(h):
    s[i] = list(input())

sharp = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            sharp += 1

check = [[0] * w for _ in range(h)]
que = [[0,0,1]]
check[0][0] == 1
flag = False

while len(que) > 0:
    tmp = que.pop(0)
    #print(tmp)
    for i in search(tmp[0], tmp[1], tmp[2]):
        if 0 <= i[0] <= h-1 and 0 <= i[1] <= w-1 and s[i[0]][i[1]] == '.':
            if check[i[0]][i[1]] == 0:
                que.append(i)
                check[i[0]][i[1]] = 1
    if tmp[0] == h-1 and tmp[1] == w-1:
        key = tmp[2]
        flag = True
        break
#print(key)

if check[0][0] =='#':
    flag = False

if flag:
    print(h*w - sharp - key)
else:
    print(-1)
                



Measured memory_bytes: 3188
import sys
sys.setrecursionlimit(int(1e6))

S = input()

for i in range(len(S)):
    if i % 2:
        # 偶数番目
        if S[i] == 'R':
            print('No')
            exit()
    else:
        # 奇数番目
        if S[i] == 'L':
            print('No')
            exit()

print('Yes')


Measured memory_bytes: 2940
S=input()
K=int(input())

first=0
for i in range(len(S)):
  if S[i]==S[0]:
    first+=1
  else:
    break
last=0
for i in range(len(S)):
  if S[-i-1]==S[0]:
    last+=1
  else:
    break
#print(first,last)
if first+last==2*len(S): #すべての文字が同じ
  num=(len(S)*K)//2
else:
  cont_n=1
  count=0
  char=S[0]
  for i in range(first, len(S)-last):
    #print(S[i],char,cont_n)
    if S[i]==char:
      cont_n+=1
    else:
      char = S[i]
      count += cont_n//2
      cont_n = 1
  count += cont_n//2
  num=K*count
  num += first//2
  num += last//2
  num += (K-1)*((first+last)//2)
print(num)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    ll n,a,b;cin>>n>>a>>b;
    ll ans = n/(a+b) * a;
    if(n%(a+b)<=a){
        ans += n%(a+b);
    }else{
        ans += a;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256