akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin>>N;
    int L[2*N];
    rep(i,0,2*N) cin>>L[i];
    sort(L,L+2*N);
    reverse(L,L+2*N);
    int res=0;
    int i=0;
    while(i<2*N){
        res+=min(L[i],L[i+1]);
        i+=2;
    }
    cout <<res<<"\n";
}

Measured memory_bytes: 256
main = do
  li <- getLine
  let [n,k] = map read $ words li
  let ans = compute n k
  print ans

{-
結局、全て最小値1にするしかない。
n = kなら全体を選んで一度でいい。さもなくば、
ai = 1がどこなのかを探すまでもなく、(n-1)+(k-1)-1 `div` (k-1)で全てを塗りつぶせる。
-}

compute :: Int -> Int -> Int
compute n k = (n+k-3) `div` (k-1)

Measured memory_bytes: 3820
t=int(input())
c=0
flag=1
while t>0:
    m,n=map(int,input().split())
    if m==n:
        c+=1
        if c==3:
            print('Yes')
            flag=0
            break
    else:
        c=0
    t-=1
if flag==1:
    print('No')

Measured memory_bytes: 9112
#include<stdio.h>

int main(void)
{
    int a, b, c, i, count=0;
    
    scanf("%d %d %d", &a, &b, &c);
    
    for(i=a; i<=b; i++){
        if(c % i == 0){
            count++;
        }
    }
    
    printf("%d\n", count);
    
    return 0;
}


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

int main()
{
  vector<string> s(3);
  while (cin >> s[0] >> s[1] >> s[2]) {
    if (s[0] == "0")
      break;
    
    for (int i = 0; i < 3; ++i) {
      int A = 0, B = 0;
      for (unsigned int j = 1; j < s[i].size(); ++j) {
	if (s[i][j] == 'A')
	  ++A;
	else
	  ++B;
      }
      
      if (A+1-B > 2)
	cout << A+1 << " " << B << endl;
      else
	cout << A << " " << B+1 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int main(void)
{
	int x,sum,aum,cum;
	scanf("%d",&x);
	if(x%7==1){
		printf("fri\n");
	}
	if(x%7==2){
		printf("sat\n");
	}
	if(x%7==3){
		printf("sun\n");
	}
	if(x%7==4){
		printf("mon\n");
	}
	if(x%7==5){
		printf("tue\n");
	}
	if(x%7==6){
		printf("wed\n");
	}
	if(x%7==0){
		printf("thu\n");
	}
	return 0;
}
	
	
	
	


Measured memory_bytes: 2704
import sys
import math
def input():
    return sys.stdin.readline()[:-1]
n,s=map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353
dp0 = [[0 for i in range(s+1)]for i in range(n+1)]
dp1 = [[0 for i in range(s+1)]for i in range(n+1)]
for i in range(1,n+1):
    for j in range(s+1):
        if j==0:
            b=1
        else:
            b=0
        dp0[i][j] += (dp0[i-1][j]+b)
        dp0[i][j] %= mod
        dp1[i][j] += (dp1[i-1][j]+dp0[i-1][j]+b)
        dp1[i][j] %= mod
        if j+a[i-1]<=s:
            dp0[i][j+a[i-1]] += (dp0[i-1][j]+b)
            dp0[i][j+a[i-1]] %= mod
            dp1[i][j+a[i-1]] += (b+dp0[i-1][j])
            dp1[i][j+a[i-1]] %= mod

        dp0[i][j]%=mod
        dp1[i][j]%=mod

print(dp1[n][s])


Measured memory_bytes: 192520
s=gets.chomp
k=gets.to_i
s.size.times do |i|
  l=(122-s[i].ord+1)%26
  if l<=k
    k-=l
    s[i]="a"
  end
end
s[-1]=((s[-1].ord-97+k)%26+97).chr
puts s


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

#define For(i, j, k) for (int i = j; i <= k; ++ i)
#define Forr(i, j, k) for (int i = j; i >= k; -- i)

using namespace std;

typedef long long ll;

inline int read() {
	int x = 0, p = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') p = -1;
	for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	return x * p;
}

inline void File() {
	freopen("C.in", "r", stdin);
	freopen("C.out", "w", stdout);
}

const int N = 1e5 + 10;
int x, y, z, n, t;
struct node { int a, b, c; } P[N];

inline bool cmp(const node &a, const node &b) {
	return a.a - a.b < b.a - b.b;
}

ll ans, sum, pre[N], suf;

priority_queue<int, vector<int>, greater<int> > Q;

int main() {

	x = read(), y = read(), z = read(), n = x + y + z;
	For(i, 1, n) 
		P[i].a = read(), P[i].b = read(), 
		sum += P[i].c = read();

	sort(P + 1, P + 1 + n, cmp);
	For(i, 1, n) P[i].a -= P[i].c, P[i].b -= P[i].c;
		
	For(i, 1, y) Q.push(P[i].b), pre[i] = pre[i - 1] + P[i].b;
	
	For(i, y + 1, n - x) {
		if (Q.top() < P[i].b) 
			t = Q.top(), Q.pop(), Q.push(P[i].b),
			pre[i] = pre[i - 1] - t + P[i].b;
		else pre[i] = pre[i - 1];
	}

	while (!Q.empty()) Q.pop();

	Forr(i, n, n - x + 1) suf += P[i].a, Q.push(P[i].a);

	ans = 1ll * pre[n - x] + sum + suf;
	
	Forr(i, n - x, y + 1) {
		if (Q.top() < P[i].a) t = Q.top(), Q.pop(), Q.push(P[i].a), suf = suf - t + P[i].a;
	 	ans = max(ans, 1ll * pre[i - 1] + suf + sum);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 2680
#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="abcdefghijklmnopqrstuvwxyg"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYG";
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;
  cin>>N;
  vector<string> s(N);
  rep(i,N){
    cin>>s[i];
    sort(s[i].begin(),s[i].end());
  }
  ll ans=0;
  ll count=0;
  sort(s.begin(),s.end());
  rep(i,N-1){
    if(s[i]==s[i+1]){
      count++;
      ans+=count;
    }
    else{
      count=0;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 6340
// youtubeの公式解説動画を見て
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;

// A + B = A xor B + (A & B)*2

int main(){
    int n;
    cin >> n;
    vector<ll> v(n);
    ll s = 0;
    for(int i = 0; i < n; i++){
        cin >> v[i];
        s ^= v[i];
    }
    ll ans = s; // A+B = A^B
    // sで1が立っている桁についてはどう塗り分けようがA&Bのその桁は0　
    // どう頑張ったって0なので考えない
    for(int i = 0; i < n; i++)  v[i] &= ~s; 
    
    // 掃き出し
    int rnk = 0;
    vector<int> top(61); 
    for(int i = 60; i >= 0; i--){
        int j = rnk;
        for(; j < n; j++){
            if(v[j]>>i&1){
                swap(v[rnk], v[j]);
                break;
            }
        }
        if(j == n)  continue;
        top[rnk] = i;
        for(int k = 0; k < n; k++){
            if(rnk == k)    continue;
            if(v[k]>>i&1)   v[k] ^= v[rnk];
        }
        rnk++;
    }
    
    ll x = 0;
	for(int i = 0; i < n; i++){
     	x = max(x, x^v[i]); 
    }
    ans += x * 2; // (A&B)*2 を足しこむ
    cout << ans << endl;
    return 0;
}


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

typedef long long int ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(v,a,b) v.begin(a),v.end(b)
#define in cin>>
#define out cout<<
#define endl <<endl
#define INF 100000000000000

int main()
{
	int N;
	in N;
	vector<ll> a(N);
	vector<ll> l(N + 1);
	l.at(0) = 0;
	rep(i, N)
	{
		in a.at(i);
		l.at(i + 1) = l.at(i) + a.at(i);
	}
	ll ans = INF;
	rep(i, N)
	{
		ll comp = INF;
		if (l.at(i) * 2 != l.at(N))
		{
			comp = abs(l.at(i) * 2 - l.at(N));
		}
		else
		{
			comp = 0;
		}
		if (comp < ans)
		{
			ans = comp;
		}
	}
	out ans endl;
}


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

int main(void){
    int x=0;
    char s[101];
    scanf("%s",s);
    for(int i=0; s[i]!=NULL; i++){
        if(i%2==0 && s[i]=='L' || i%2==1 && s[i]=='R')
            x++;
    }
    if(x==0)
        printf("Yes");
    else
        printf("No");
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,c,d,maxx;
	cin>>a>>b>>c>>d;
	maxx=max(a*c,a*d);
	maxx=max(maxx,max(b*c,b*d));
	cout<<maxx;
	return 0;
}

Measured memory_bytes: 3540
fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    val vs = readInputLine().split(" ").map { it.toDouble() }.toDoubleArray()
    
    vs.sort()
    
    for (i in 1 until N) {
        vs[i] = (vs[i] + vs[i - 1]) / 2.0
    }

    println(vs[N - 1])
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 37952
#include <iostream>

#define MAX 110
using namespace std;

int main(){
    int num; cin >> num;
    int matrix[MAX][MAX];
    for(int i=0;i<MAX;i++){
        for(int j=0;j<MAX;j++){
            matrix[i][j] = 0;
        }
    }
    for(int i=1;i<=num;i++){
        int v; cin >> v;
        int tmp; cin >>tmp;
        for(int j=0;j<tmp;j++){
            int vi; cin >> vi;
            matrix[v-1][vi-1] = 1;
        }
    }
    for(int i=0;i<num;i++){
        for(int j=0;j<num;j++){
            if(j==0)
                cout << matrix[i][j];
            else
                cout << " " << matrix[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
#define ll long long
namespace io{
	const int l=1<<20;
	char buf[l],*s,*t;
	inline char gc(){
		if(s==t){
			t=(s=buf)+fread(buf,1,l,stdin);
			return s==t?EOF:*s++;
		}
		return *s++;
	}
	char c;
	template<class IT>inline void gi(IT &x){
		x=0;c=gc();while(c<'0'||c>'9')c=gc();
		while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^'0');c=gc();}
	}
};
using io::gi;
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
const int p=1000000007;
const int N=200005;
int dp[64][2][2];
inline void upd(int &a,int b){a=a+b<p?a+b:a+b-p;}
inline int solve(ll l,ll r){
	int s=0,t=0,n,i,a,b,c,d,x,y,ans=0;
	while((1ll<<s)<=l)++s;
	while((1ll<<t)<=r)++t;
//	printf("l=%lld r=%lld s=%d t=%d\n",l,r,s,t);
	for(n=1;n<=s;++n){
		memset(dp,0,sizeof(dp));
		dp[n-1][n!=s][n!=t]=1;
		for(i=n-2;~i;--i){
			x=l>>i&1ll;
			y=r>>i&1ll;
			for(a=0;a<2;++a)for(b=0;b<2;++b)if(dp[i+1][a][b]){
				for(c=0;c<2;++c)for(d=c;d<2;++d){
					if((a||c<=x)&&(b||d<=y))upd(dp[i][a|(c<x)][b|(d<y)],dp[i+1][a][b]);
				}
			}
		}
//		printf("%d\n",n);
//		for(i=n-1;~i;--i)printf("%d %d  %d %d\n",dp[i][0][0],dp[i][0][1],dp[i][1][0],dp[i][1][1]);
		for(a=0;a<2;++a)for(b=0;b<2;++b)upd(ans,dp[0][a][b]);
	}
//	printf("%d\n",ans);
	return ans;
}
int main(){
	ll l,r;
	scanf("%lld%lld",&l,&r);
	printf("%d",(solve(r,r)-solve(l-1ll,r)+p)%p);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>

using namespace std;

typedef long long int64;

int main(void){
    int64 N,L;
    cin>>N>>L;
    int64 sum=(2*L+N-1)*N/2;
    
    if(L*(N+L-1)<=0){
        cout<<sum<<endl;
    }else{
        if(L<0){
            sum+=min(abs(L),abs(N+L-1));
        }else{
            sum-=min(abs(L),abs(N+L-1));
        }
        
        cout<<sum<<endl;
    }
    return 0;
}

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

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

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 1000000007;

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

  LL R,G,B,N;
  cin >> R >> G >> B >> N;

  LL cnt = 0;

  REP(r,3001){
    REP(g,3001){
      LL a = r * R + g * G;
      if(N-a>=0&&(N-a)%B==0){
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
n = int(input())
s = input()

ans = 3 * 10**7
w = [0]
e = [0]

for i, a in enumerate(s):
    if a == 'W':
        w.append(w[-1]+1)
    else:
        w.append(w[-1])

for i, a in enumerate(s[::-1]):
    if a == 'E':
        e.append(e[-1]+1)
    else:
        e.append(e[-1])

e.reverse()

for i in range(n):
    ans = min(ans, w[i]+e[i+1])

print(ans)

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

void solve(){
    string s;
    cin>>s;
    bool ok =1;
    for(int i=1;i<=s.size();i+=2){
        if(!(s[i-1]=='R' || s[i-1]=='U' || s[i-1]=='D')) ok=0;
    }

    for(int j=2;j<=s.size();j+=2){
        if(!(s[j-1]=='L' || s[j-1]=='U' || s[j-1]=='D')) ok=0;
    }

    if(ok) cout << "Yes";
    else cout << "No";

}


int main(){
   solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
//using namespace __gnu_pbds;
#define rep(i,a,b) for(i=(a);i<=(b);i++)
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define maxn 100005
#define inf 1e18
#define boost ios::sync_with_stdio(false);cin.tie(0)
#define fr freopen("source.txt","r",stdin),freopen("output.txt","w",stdout)
#define SET(a,b) memset(a,b,sizeof(a))
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
#define ps(x,y) fixed<<setprecision(y)<<x
//template<typename T>
//using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out <<  "(" << a.F << ", " << a.S << ")";
}
 
template<class A> ostream& operator << (ostream& out, const vector<A> &a) {
	out << "[";
	for (auto it = a.begin(); it != a.end(); ++it) {
		if (it != a.begin())
			out << ", ";
		out << *it;
	}
	return out << "]";
}
int main()
{
    boost;
    ll n,i,j,x,t,y;
	string s;
	cin>>s;
	if(s[2]==s[3]&&s[4]==s[5]) cout<<"Yes";
	else cout<<"No";
}

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 1;
  for(int i = 1; i < n; i++) {
    if(s[i] != s[i-1]) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main()
{
	int n;
	cin >> n;
	vi p(n);
	rep(i,n) cin >> p[i];
	int ans = 0;
	for(int i = 1; i < n-1; i++){
		int ma = max({p[i-1],p[i],p[i+1]});
		int mi = min({p[i-1],p[i],p[i+1]});
		if(p[i] != ma && p[i] != mi) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define int long long

void test_case(){
	int n,d;
	cin >> n >> d;
	int cnt=0;

	for(int i=0;i<n;i++){
		int x,y;
		cin >> x >> y ;
		if( x*x + y*y <= d*d ) cnt++;
	}
	cout << cnt << endl;
}

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	int t=1;
	// cin >> t;

	while(t--) test_case();
	
	return 0;
}



Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
/* int floorSearch(int arr[], int low,
                int high, int x)
{
    // If low and high cross each other
    if (low > high)
        return -1;

    // If last element is smaller than x
    if (x >= arr[high])
        return high;

    // Find the middle point
    int mid = (low + high) / 2;

    // If middle point is floor.
    if (arr[mid] == x)
        return mid;

    // If x lies between mid-1 and mid
    if (mid > 0 && arr[mid - 1] <= x
        && x < arr[mid])
        return mid - 1;

    // If x is smaller than mid, floor
    // must be in left half.
    if (x < arr[mid])
        return floorSearch(
            arr, low, mid - 1, x);

    // If mid-1 is not floor and x is
    // greater than arr[mid],
    return floorSearch(arr, mid + 1, high, x);
} */
int main()
{
    int n, m, k, csum, temp, cntr, maxc, temp2, index;
    cin >> n;
    cin >> m;
    cin >> k;
    csum = 0;
    vector<int> a;
    vector<int> b;
    for ( int i = 0; i < n; i ++) {
        cin >> temp2;
        temp = csum + temp2;
        if ( temp <= k && temp > 0){
            a.push_back(temp);
            csum = temp;
        }
        else break;
    }
    if ( ! (n == a.size()) ){
        for ( int i = 0; i < n - a.size() - 1; i++) cin >> temp2;
    }
    csum = 0;
    for ( int i = 0; i < m; i++) {
        cin >> temp2;
        temp = csum + temp2;
        if ( temp <= k && temp > 0){
            b.push_back(temp);
            csum = temp;
        }
        else break;
    }
    if ( ! (m == b.size()) ) {
        for ( int i = 0; i < m - b.size() - 1; i++) cin >> temp2;
    }
    maxc = b.size();
    for ( int i = 0; i < a.size(); i++) {
        auto it = lower_bound(b.begin(), b.end(), k - a[i]);
        index = it - b.begin();
        if ( it != b.end() && (*it > k - a[i])) index--;
        if ( it == b.end() ) cntr = b.size() + i + 1;
        else cntr = index + 1 + i + 1;
        if ( cntr > maxc ) maxc = cntr;
    }
    cout << maxc;
    return 0;
}

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

/* snippet: useful macros and functions */
#define ARC(i, a, b) for(Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(Int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; }
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; }
template<class T> T rng(const T &a, const T &b){ return a < b ? b - a : a - b; }
template<class T> void th(T &a, const T &b, T (*f)(const T &, const T &)){ a = f(a, b); }
#define anth(a, b) th(a, b, ant)
#define onth(a, b) th(a, b, ont)

/* snippet: modint library */
template<class T, int MOD>
class Modint{
	T val;
public:
	Modint(T val = 0) : val(val) {}
	operator T(){ return val; }
	Modint &operator+=(const Modint &a){ val += a.val; if(val >= MOD) val -= MOD; return *this; }
	Modint &operator-=(const Modint &a){ val -= a.val; if(val < 0) val += MOD; return *this; }
	Modint &operator*=(const Modint &a){ val = val * a.val % MOD; return *this; }
	void inverse(){T x[2]={MOD,val},a[2]={0,1};int i;for(i=0;x[!i];i^=1){a[i]-=x[i]/x[!i]*a[!i];x[i]=x[i]%x[!i];}if(!i)a[i]+= MOD;val=a[i];}
	Modint &operator/=(Modint a){ a.inverse(); return *this *= a; }
	friend Modint modpow(Modint a, int n){ Modint ret(1); while(n){ if(n & 1) ret *= a; a *= a; n >>= 1; } return ret; }
	friend Modint operator+(Modint a, const Modint &b){ return a += b; }
	friend Modint operator-(Modint a, const Modint &b){ return a -= b; }
	friend Modint operator*(Modint a, const Modint &b){ return a *= b; }
	friend Modint operator/(Modint a, const Modint &b){ return a /= b; }
	friend std::ostream &operator<<(std::ostream &os, const Modint &a){ return os << a.val; }
};

/* snippet: using declarations */
using Int = long long;
using std::cout;
using std::cin;
using std::endl;
using Mint = Modint<long long, 1000000007>;

Int n, k;
Mint a[112345];
Mint tmp;

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

	a[1] = 1;
	for(Int i = 2; i <= k; ++i){

		for(Int j = 2; j * j <= i; ++j){
			if(i % j == 0){
				tmp -= a[i / j - 1];
				tmp += a[i / j];
				if(j != i / j){
					tmp -= a[j - 1];
					tmp += a[j];
				}
			}
		}
		tmp = tmp + Mint(1);

		a[i] = modpow(Mint(i), n) - tmp;

	}

	// for(Int i = 1; i <= k; ++i){
// 		cout << i << " " << a[i] << endl;
	// }

	Mint ans = a[k];
	for(Int i = 2; i <= k; ++i){
		ans += a[k / i] * Mint(i);
	}
	cout << ans << endl;
}


Measured memory_bytes: 4500
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int gotiusa_is_god;
    while (cin>>gotiusa_is_god,gotiusa_is_god) {
        int w,h; cin>>w>>h;
        vector<vector<int>>v(h,vi(w,0));
        rep(_,gotiusa_is_god){
            pii tiya; cin>>tiya.first>>tiya.second;
            v[--tiya.second][--tiya.first]=1;
        }
        int range_x,range_y;
        cin>>range_x>>range_y;
        int ans=-INF;
        rep(i,h){
            rep(j,w){
                if(i+range_y>h||j+range_x>w)continue;
                int gotiusa=0;
                for(int k=i; k<i+range_y;k++)
                    for(int l=j; l<j+range_x;l++)
                        if(v[k][l])gotiusa++;
                cmax(ans,gotiusa);
            }
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3180
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().solve();
	}

	private void solve() throws IOException {
		try {
			solveA();
			//			 solveB();
			//			 solveC();
			//			 solveD();
			//			 solveE();
			//			 solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		char[] wk = next().toCharArray();
		for (int i = 1; i < wk.length; i++) {
			if (wk[i-1] == wk[i]) {
				out.println("Bad");
				return;
			}
		}

		out.println("Good");
	}

	private void solveB() {
		int n = nextInt();

		out.println("");
	}

	private void solveC() {
		int n = nextInt();

		out.println("");
	}

	private void solveD() {
		int n = nextInt();

		out.println("");
	}

	private void solveE() {
		int n = nextInt();

		out.println("");
	}

	private void solveF() {
		int n = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

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

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

Measured memory_bytes: 21204
def smaller(x, y):
	if x < y: return x
	return y
def larger(x, y):
	if x > y: return x
	return y

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
Asum = []
sum = 0
for i in range(0, N):
	sum += A[i]
	Asum.append(sum)
controllist = []
for i in range(0, M):
	controllist.append(list(map(int, input().split())))
controllist.sort(key = lambda v: v[1], reverse = True)
addlist = []
flag = False
for i in range(0, M):
	for j in range(0, controllist[i][0]):
		addlist.append(controllist[i][1])
		if len(addlist) == N:
			flag = True
			break
	if flag: break
sum = 0
for i in range(0, smaller(N, len(addlist))):
	sum += larger(A[i], addlist[i])
for i in range(len(addlist), N):
	sum += A[i]
print(sum)

Measured memory_bytes: 88472
a = int(input())
i = 0
if (a % 10 == 2) or (a % 10 == 4) or (a % 10 == 5) or (a % 10 == 7) or (a % 10 == 9) :
    print("hon")
if (a % 10 == 0) or (a % 10 == 1) or (a % 10 == 6) or (a % 10 == 8) :
    print("pon")
if (a % 10 == 3) :
    print("bon")

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

map<string, ll> M;

int main() {
    ll N;
    cin >> N;
    vector<string> S(N);
    REP(i, N) {
        cin >> S[i];
    }
    sort(S.begin(), S.end());
    ll max = 0;

    REP(i, N) {
        M[S[i]]++;
        max = std::max(max, M[S[i]]);
    }

    S.erase(unique(S.begin(), S.end()), S.end());
    REP(i, S.size()) {
        if (M[S[i]] == max)
            cout << S[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 27136
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
 
string s;
ll cnt[26];
 
int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s;
	FOR(i, s.size()) {
		cnt[s[i]-'a']++;
	}
	ll n = s.size();
	ll ans = n * (n-1) / 2 + 1;
	FOR(i, 26) {
		ans -= cnt[i] * (cnt[i]-1) / 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
const ull MOD = 1000000007;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
ll digitPoor(ll n)
{
    assert(INT_MAX == 2147483647);
    assert(n >= 0);

    if (n < 10)         return 1;
    if (n < 100)        return 2;
    if (n < 1000)       return 3;
    if (n < 10000)      return 4;
    if (n < 100000)     return 5;
    if (n < 1000000)    return 6;
    if (n < 10000000)   return 7;
    if (n < 100000000)  return 8;
    if (n < 1000000000) return 9;
    return 10;
}
struct p{
  ll x;
  bool end;
};

int main(){
    ll N,M;
    //cin>>N>>M;
    
    REP1(i,5){
        ll t;
        cin>>t;
        if(t==0){
            cout<<i;return 0;
        }
    }
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void) {
	int num,i,ans;
	double mon;
	mon = 100000;
	scanf("%d",&num);
	for (i = 1;i <= num;i++){
		mon = mon + mon * 0.05;
		mon = mon / 1000;
		mon = ceil(mon);
		mon = mon * 1000;
	}
	ans = mon;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 596
import java.util.*;

public class Main {
    boolean[][] map;
    void run() {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            map = new boolean[14][14];
            for (int y = 1; y <= 12; y++) {
                String str = sc.next();
                for (int x = 1; x <= 12; x++) {
                    map[y][x] = str.charAt(x - 1) == '1';
                }
            }
            int cnt = 0;
            for (int y = 1; y <= 12; y++) for (int x = 1; x <= 12; x++) if (map[y][x]){
                cnt++;
                dfs(x, y);
            }
            System.out.println(cnt);
        }
    }
    
    int[] dx = {-1,0,1,0}, dy = {0,-1,0,1};
    void dfs(int x, int y) {
        map[y][x] = false;
        for (int i = 0; i < 4; i++) if (map[y+dy[i]][x+dx[i]]) dfs(x + dx[i], y + dy[i]);
    }
    
    public static void main(String[] args) {
        new Main().run();
    }
}

Measured memory_bytes: 17360
n,m=map(int,input().split())
AB=[]
for i in range(n):
    a,b=map(int,input().split())
    AB.append((a,b))

AB.sort()

cnt=0
ans=0
for a,b in AB:

    temp=min(m-cnt,b)
    ans+=a*temp
    cnt+=temp
    if cnt==m:
        print(ans)
        break

Measured memory_bytes: 16908
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S,T;
    int A,B;
    string U;
    cin>>S>>T>>A>>B>>U;
    if(U==S){
    cout<<A-1<<" "<<B<<endl;
    }
    else
    cout<<A<<" "<<B-1<<endl;
}

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

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

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

int main() {
	ll n;
	cin >> n;

	vector<int> vi(n);

	for (int i = 0; i < n; i++) {
		cin >> vi[i];
	}
	sort(vi.begin(), vi.end());

	double ans = vi[0];

	for (int i = 1; i < n; i++) {
		ans += vi[i];
		ans /= 2.0;
	}

	cout << ans << endl;

}


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

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int INF = pow(2,29);
const int MOD = 1000000007;

int main() {
  int N; cin >> N;
  ll X[N], Y[N]; rep(i,N) cin >> X[i] >> Y[i];

  ll a[N], b[N];
  ll oe = abs(X[0]+Y[0])%2;
  rep(i,N) {
    if (abs(X[i]+Y[i])%2==oe) {
      a[i] = X[i]-Y[i];
      b[i] = X[i]+Y[i];
    }
    else{ 
      cout << -1 << endl;
      return 0;
    }
  }

  vector<ll> len;
  for (ll i=31; i>=0; i--) len.push_back(pow(2,i));
  if (!oe) len.push_back(1);

  cout << len.size() << endl;
  for (auto x: len) cout << x << " "; cout << endl;
  rep(i,N) {
    for(auto x: len) {
      bool ap, bp;
      if (a[i]>0) { a[i] -= x; ap = true; }
      else { a[i] += x; ap = false; }
      if (b[i]>0) { b[i] -= x; bp = true; }
      else { b[i] += x; bp = false; }

      string result;
      if (ap) result = bp ? "R" : "D";
      else result = bp ? "U" : "L";
      cout << result;
    }
    cout << endl;
  }
  return 0;
}

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

int main()
{
   long long n;
   cin >> n;
   string ans = "";
   while(n!=0)
   {
       n--;
       ans+=('a' +n%26);
       n/=26;
   }
   reverse(ans.begin(), ans.end());
   cout << ans;
}


Measured memory_bytes: 3572
from heapq import heappush, heappop
from collections import defaultdict

n = int(input())
s = [input() for i in range(n)]
start = tuple("sssssssssss")
goal = tuple("ggggggggggg")
s.append("ggggggggggg;")
v = defaultdict(list)
la = tuple([start[i] for i in range(11)])
k = 0
for i in s:
    if i[:4] == "goto":
        v[la].append((tuple(i[5:-1]),k))
        k += 1
    else:
        v[la].append((tuple(i[:-1]),k))
        la = tuple([i[j] for j in range(len(i)-1)])
        k = 0
q = [(0,start)]
dist = defaultdict(lambda : float("inf"))
dist[start] = 0
while q:
    dx,x = heappop(q)
    for y,d in v[x]:
        if dx + d < dist[y]:
            dist[y] = dx+d
            heappush(q,(dist[y],y))
print(dist[goal])




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

int main() {
  string s;
  cin >> s;
  int64_t n = s.size();
  long long k;
  cin >> k;
  for (int i = 0; i < k; i++) {
    if (s.at(i) != '1') {
      cout << s.at(i) << endl;
      return 0;
    }
  }
  cout << 1 << endl;
  return 0;
}



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

A = []
C = []

for _ in range(N):
    a,b = map(int, input().split())
    A.append([a,b])
for _ in range(M):
    c,d = map(int, input().split())
    C.append([c,d])
S = []*N


for i in range(N):
    S.append([])
    min = float('inf')
  
    for j in range(M):
        temp = abs(A[i][0]-C[j][0])+abs(A[i][1]-C[j][1])
        if min > temp:
            min = temp
            S[i].clear()
            S[i].append(j)

for i in range(N):
    print(S[i][0]+1)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#define T 1001
#define M 1000000007
#define E e[x][i]
#define S e[x].size()
using namespace std;
typedef long long ll;
int N,s,t,j;
string n[T];
vector<int> e[T];
 
ll func(int x){
  ll r=0,i;
  if(!S){
    if(n[x]=="E") return 1;
    return 2;
  }
  if(n[x][0]=='E'){
    r++;
    for(i=0;i<S;i++) r*=func(E);
    if(n[x]=="E?") r++;
  }
  else if(n[x][0]=='A'){
    for(i=0;i<S;i++) r+=func(E);
    if(n[x]=="A?") r++;
  }else{
    r++;
    for(i=0;i<S;i++) r*=(1+func(E));
    if(n[x]=="R") r--;
  }
  return r%M;
}
  
main(){
  cin>>N;
  for(j=0;j<N;j++) cin>>n[j];
  while(--N) cin>>s>>t,e[s-1].push_back(t-1);
  cout<<func(0)%M<<endl;
}

Measured memory_bytes: 1356
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG//空配列へのアクセスでエラー表示
using namespace std;

struct ca{
  int a;
  int b;
  int c;
};

int main() {

  int M,A,B,minav=10000000,minbv=10000000,m;

  cin >> A >> B >> M;

  vector<int> av(A),bv(B);
  
  vector<ca> ca(M);

  for(int i=0; i<A; i++){

    cin >> av.at(i);

  }

  for(int i=0; i<B; i++){

    cin >> bv.at(i);

  }

  for(int i=0; i<A; i++){

    if(minav>av.at(i)){
      minav = av.at(i);
    }

  }

    for(int i=0; i<B; i++){

    if(minbv>bv.at(i)){
      minbv = bv.at(i);
    }

  }

  m = minav + minbv;

  

  for(int i=0; i<M; i++){

    cin >> ca.at(i).a >> ca.at(i).b >> ca.at(i).c;

  }


  for(int i=0; i<M; i++){

     int s;

     s = av.at((ca.at(i).a)-1) + bv.at((ca.at(i).b)-1) - ca.at(i).c;

     if(m>s){
       m = s;
     }
  }  

     cout << m << endl; 
   
  return 0;

}

Measured memory_bytes: 2176
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	/* --------------------------------------------------------------------
	   main
	 * -------------------------------------------------------------------- */
	public static void main(String args[]) throws Exception {

		// ----- input -----
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		input.readLine();
		String values[] = input.readLine().split(" ");
		input.close();

		// ----- main -----
		int[] ary = new int[values.length];
		for(int i=0; i < values.length; i++) {
			ary[i] = Integer.parseInt(values[i]);
		}
		Arrays.parallelSort(ary);

		System.out.println(ary[ary.length-1] - ary[0]);
	}
}

Measured memory_bytes: 23124
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.next();
		if(S.charAt(0) == S.charAt(1) && S.charAt(2) == S.charAt(3) && S.charAt(0) != S.charAt(2)){
			System.out.println("Yes");
		}
		else if(S.charAt(0) == S.charAt(2) && S.charAt(1) == S.charAt(3) && S.charAt(0) != S.charAt(1)){
			System.out.println("Yes");
		}
		else if(S.charAt(0) == S.charAt(3) && S.charAt(1) == S.charAt(2) && S.charAt(0) != S.charAt(1)){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
		stdIn.close();
	}
}

Measured memory_bytes: 35508
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define INF 100000000
int main(){
    ll A,P;
    cin>>A>>P;
    cout<<(3*A+P)/2<<endl;
}

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

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

Measured memory_bytes: 256
//omajinai c++ atcoder
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define itn int
typedef long long ll;
constexpr auto mod = 1000000007;
using namespace std;
int main() {
 string s;
  cin>>s;
  int f=0;
  for(int i=0;i<s.length();i++){
    if(s[i]=='7'){
      f=1;
      break;
    }
  }
  
  if(f==0){
    cout<<"No";
  }
  else{
    cout<<"Yes";
  }
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
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; }
typedef vector<vector<int> > Graph;
typedef pair<int, int> P; 
// MOD
//const int mod = 1000000007;
typedef long long ll;
long long INF = 1<<30;
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
//int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
 
mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n/2);
  x *= x;
  if (n%2 == 1) x *= 2;
  return x;
}
 
mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i,a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double PI=3.14159265358979323846;
bool seen[100][100];

bool memo[110];
bool flag;

int dist[100][100];

bool compare_f(pair<int, int> &x, pair<int, int> &y) {
  return x.second< y.second;
}


struct Unionfind{
    vector<int> par;

    Unionfind(int n) : par(n, -1){}

    int root(int x){
        if(par[x] < 0) return x;
        else return par[x] = root(par[x]);
    } 

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

    bool merge(int x, int y){
        x = root(x); y = root(y);
        if(x == y) return false;
        if(par[x]>par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

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

P s(int x){
    int a = x%10;
    int b = 0;
    while(x){
        b = x;
        b/=10;
    }
    return P(a, b);
}

int main() {
  int a, b; cin >> a >> b;
  ll ans = a*b;
  cout << ans << endl;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0; i<(n); ++i)
#define rep1(i,n) for(ll i=1; i<=(n); ++i)
#define repi(i,a,b) for(ll i=a; i<=(b); ++i)
#define rrep(i,n) for(ll i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define print(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
using Edge = pair<ll,ll>;
using Graph = vector<vector<Edge>>;
typedef pair<ll,ll> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
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);}
ll devc(ll x, ll y){return 1 + (x-1)/y;}

ll solve(string S){
    string S2 = S;
    reverse(ALL(S2));
    ll ans = 0;
    rep(i,sz(S)/2){
        if(S[i] != S2[i]) ans++;
    }
    return ans;
}

int main(){
    string S; cin >> S;
    print(solve(S));
}

Measured memory_bytes: 256
//
// Created by eightnoteight on 10/12/16.
//

#include <bits/stdc++.h>
#ifdef __mr__
    #include "prettyprint.hpp"
#else
    #define endl                    '\n'
#endif
#define len(x)                      (uint)(x).size()
#define int                         int32_t
#define uint                        uint32_t
#define ulong                       uint64_t
#define long                        int64_t
#define maxof(x)                    numeric_limits<x>::max()
#define minof(x)                    numeric_limits<x>::min()
using namespace std;
const ulong mod = 1000000007ul;

int main(int argc, char const *argv[]) {
    #ifndef __mr__
        ios::sync_with_stdio(0);cin.tie(0);
    #endif
    char c;
    cin >> c;
    if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
        cout << "vowel" << endl;
    else
        cout << "consonant" << endl;
    return 0;
}


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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)

#define mt              make_tuple
#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////

int main()
{
    FASTIO;

    string st;

    cin >> st;


    if(st[2]==st[3] && st[4]==st[5])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }





    return 0;
}



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

int main() {
	int A, B, c = 0, K = 0, i;
	cin >> A >> B;
	if (A > B) {
		c = A;
		A = B;
		B = c;
	}
	for (i = 0; i < B; i++) {
		if (abs (A - i)  == abs(B - i) )
		{
			K = i;
			cout << K << endl;
			break;
		}
		else { K = -1; }
	}
	if (K == -1) {
		cout << "IMPOSSIBLE" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mk make_pair
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define vl vector<long long int>
#define vvl vector<vector<ll> > 
#define fo(i,a,b) for(int i=a;i<b;i++)
#define rof(i,a,b)  for(int i=b;i>=a;i--)
using namespace std;
ll mod=1000000007;

int main()
{
    string s,t;cin>>s>>t;
    ll n=s.length(),m=t.length();
    ll dp[n+1][m+1];
    memset(dp,0,sizeof(dp));
    fo(i,1,n+1)
        fo(j,1,m+1)
        {
            if(s[i-1]==t[j-1])
                dp[i][j] = max(dp[i-1][j-1]+1,max(dp[i-1][j],dp[i][j-1]));
            else
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
        }
    ll i=n-1,j=m-1;
    string res;
    while(i>=0&&j>=0)
    {
        if(s[i]==t[j])
        {
            res+=s[i];
            i--;j--;
        }
        else if(dp[i][j+1]>=dp[i+1][j])
            i--;
        else
            j--;
    }
    reverse(res.begin(),res.end());
    cout << res;
}



Measured memory_bytes: 73960
#include <iostream>                                                                                                                                           
#include <vector>    
    
int main() {    
    std::string buf;    
    int l, r;    
    std::vector<long> v;    
    std::cin >> l >> r >> buf;    
    v.push_back(0);    
    int num = 0;    
    char prev = buf[0];    
    for (int i = 1; i < (int)buf.size(); i++) {    
        if (prev == 'A' && buf[i] == 'C') {    
            v.push_back(++num);    
            prev = buf[i];    
            continue;    
        }    
        prev = buf[i];    
        v.push_back(num);    
    }    
    while(std::cin >> l >> r) {    
        std::cout << v[r - 1] - v[l - 1] << std::endl;    
    }    
}  

Measured memory_bytes: 1908
#include<bits//stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n;i++)
int main() {
	int x, y, a, b, c, f, g, h,s;cin >> x >> y >> a >> b >> c;ll sum = 0;
	priority_queue<int> p, q, r;
	p.push(0);q.push(0);r.push(0);
	rep(i, a) {
		cin >> f;p.push(f);
	}
	rep(i, b) {
		cin >> f;q.push(f);
	}
	rep(i, c) {
		cin >> f;r.push(f);
	}
	s = x + y;int d = 0;
	while (s > 0) {
		if (x != 0) f = p.top();
		else f = 0;
		if (y != 0) g = q.top();
		else g = 0;
		h = r.top();
		if (f >= h && f >= g && x > 0) {
			sum += f;x--;p.pop();
		}
		else if (g >= h && g > f&& y > 0) {
			sum += g;y--;q.pop();
		}
		else {
			sum += h;r.pop();d++;
		}
		s = x + y - d;
	}
	cout << sum << endl;
}

Measured memory_bytes: 1784