akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
#include<deque>
#include<chrono>
using namespace std;
#define pi 3.141592653589793238


#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define f0 get<0>
#define f1 get<1>
#define f2 get<2>
typedef vector<ll> vi;
typedef vector<vi> vvi;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    
    //cin >> T;
    while (T--) {
        ll n, x;
        cin >> x >> n;
        vector<ll> v(n);
        map<ll, ll> m;
        for(i =0 ; i < n; i++){
            cin >> v[i];
            m[v[i]] = 1;
        }
        ll ans = INF, num;
        for(i = 0 ;i <= 101; i++){
            if(m[i] == 0){
                if(ans > abs(i - x)){
                    ans = abs(i - x);
                    num = i;
                }
            }
        }
        cout << num;
    }

    return 0;
}


Measured memory_bytes: 3660
s = gets.chomp.split('')
k = gets.chomp.to_i
prev = s[0]
list = []
current = 1
(1..s.count).each do |i|
  if i < s.count
    if prev == s[i]
      current += 1
    else
      list << current
      current = 1
    end
    prev = s[i]
  else
    list << current
  end
end
count = 0
if list.count == 1
  count = s.count * k / 2
else
  base = 0
  list.each do |i|
    base += i / 2
  end
  count = base * k
  head = s.slice(0...list.first)
  tail = s.reverse.slice(0...list.last).reverse
  if head[0] == tail[0] && head.count % 2 == 1 && tail.count % 2 == 1
    count += k - 1
  end
end
puts count

Measured memory_bytes: 1788
#include<stdio.h>
int main(void)
{
	int i,a,b,w,x,flg,cnt;
	cnt=0;
	scanf("%d %d",&a,&b);
	while(a!=0 && b!=0){
		flg=0;
		if(cnt!=0){
			printf("\n");
		}
		for(i=a;i<=b;i++){
			if(i%4==0 && i%100!=0){
			//	if(i%100!=0){
					printf("%d\n",i);
					flg=1;
				//}
			}
			else if(i%400==0){
				printf("%d\n",i);
				flg=1;
			}
			cnt++;
		}
		if(flg==0){
			printf("NA\n");
		}
		scanf("%d %d",&a,&b);
	}
	return 0;
}

Measured memory_bytes: 1044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define endl '\n'
#define mod 998244353
#define pi 3.14159265358979323846
#define rep(i,a,b) for(int i=a;i<b;i++)
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define inf INT_MAX
#define maxx 2*100000 + 5

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

    int n, k;
    cin >> k >> n;

    vi arr(n);
    rep(i,0,n)
    {
        cin >> arr[i];
    }

    int ans = k - arr[n-1] + arr[0];
    rep(i,1,n) ans = max(ans,arr[i]-arr[i-1]);

    cout << k - ans;

    return 0;
}

 

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

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

inline int gcd(int a, int b) { return (a%b == 0) ? b : gcd(b, a%b); }
inline int fac(int n) { return (n==0) ? 1 : n * fac(n - 1); }

int main() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
        int temp;
        cin >> temp;
        a[i] = temp - 1;
    }
    int cnt = 1;
    int target = a[0];
    for (;;)
    {
        if (target == 1) {
            break;
        }
        target = a[target];
        cnt++;
        if (cnt > n) {
            cnt = -1;
            break;
        }
    }

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


Measured memory_bytes: 3980
#include <stdio.h>

int main() {
    int a, b, c;
    scanf("%d %d %d",&a,&b,&c);
    if ((a == b && b != c) || (c == b && a != c) || (a == c && b != c)) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		char[] str = sc.next().toCharArray();
		
		if(str[2]==str[3]&&str[4]==str[5]) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 23380
import java.util.Arrays;
import java.util.Scanner;

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

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(A));

        sc.close();
    }

    static int solve(int[] A) {
        return Arrays.stream(A).map(Integer::numberOfTrailingZeros).min().getAsInt();
    }
}

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

int main() {
  int N, Q;
  int a, e;
  string S;
  cin >> N >> Q >> S;
  int b[N]; //vector<int> b(N, 0);
  b[0]=0; //b.at(0)=0;
  //cout << b.at(0);////////////////////
  for (int i=1; i<N; i++) {
    b[i]=b[i-1]; //b.at(i) = b.at(i-1);
    if ( ( S[i-1] == 'A') //if ( (S.at(i-1) == 'A') 
          && ( S[i] == 'C' ) ) b[i]++; //&& (S.at(i) == 'C') ) b.at(i)++;
    //cout << b.at(i);////////////////
  }
  for (int i=0; i<Q; i++) {
    cin >> a >> e;
    cout << b[e-1]-b[a-1] << endl; //cout << b.at(e-1)-b.at(a-1) << endl;
  }
  return 0;
}


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

using namespace std;

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

	int n;
	cin >> n;
	int last = 0;
	for (int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		if (a > last) {
			--a;
		}
		else if (a < last) {
			cout << "No";
			return 0;
		}
		last = a;
	}
	cout << "Yes";
			
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();return 0;}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d>0?i<n:i>n;i+=d)
#define foreach(a,A) for(auto &a:A)
#define endl "\n"
#ifdef __LOCAL
#include "ostreams.h"
#endif
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

void solve(){
    ld a, b, h, m; cin >> a >> b >> h >> m;
    ld deg = abs(6 * m - 30 * (h + m / 60));
    if(deg > 180) deg = 360 - deg;
    ld rad = deg * acos(-1) / 180;

    ld res = pow(a, 2) + pow(b, 2) - 2 * a * b * cos(rad);
    res = pow(res, 0.5);
    cout << res << endl;
}

Measured memory_bytes: 4184
import java.util.Scanner;
  
public class Main {
        public static void main(String[] args) {
                Scanner sc = new Scanner(System.in);
                int a = sc.nextInt();
                int b = sc.nextInt();
                int ans = new Main().gcd(Math.max(a, b), Math.min(a, b));
                System.out.println(ans);
        }
        public int gcd(int b, int l) {
                if (l == 0)
                        return b;
                if (l == 1)
                        return l;
                return gcd(l, b % l);
        }
}


Measured memory_bytes: 26272
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

const ll mod = 1e9+7;
ll fact[111111], ifact[111111];

ll modpow(ll a, ll b) {
  ll res = 1;
  while (b > 0) {
    if (b%2 == 1) res = res * a % mod;
    a = a*a%mod;
    b /= 2;
  }
  return res;
}

ll C(int n, int r) {
  if (r > n/2) r = n - r;
  // printf("%dC%d %lld %lld %lld\n", n, r, fact[n], ifact[n-r], ifact[r]);
  return fact[n]*ifact[n-r]%mod*ifact[r]%mod;
}

int n, k;
ll a[111111];

int main(void) {
  scanf("%d%d", &n, &k);
  if (k == 1) {
    puts("0");
    return 0;
  }
  for (int i = 0; i < n; i++) scanf("%lld", a + i);
  sort(a, a + n);

  fact[0] = ifact[0] = 1;
  for (int i = 1; i <= n; i++) {
    fact[i] = fact[i - 1] * i % mod;
    ifact[i] = modpow(fact[i], mod - 2);
  }

  ll res = 0;
  for (int i = 0; i < n; i++) {
    // printf("%d: \n", i);
    if (n-i >= k) {
      ll x = a[i];
      ll c = C(n - 2 - i + 1, k - 2 + 1);
      // printf("-: %lld %dC%d=%lld %lld\n", x, n-2-i+1, k-2+1, c, x*c);
      res = ((res - x*c%mod) + mod)%mod;
    }

    if (i + 1 >= k) {
      ll x = a[i];
      ll c = C(i, k - 1);
      // printf("+: %lld %dC%d=%lld %lld\n", x, i, k - 1, c, x*c);
      res = (res + x * c%mod)%mod;
    }
  }

  printf("%lld\n", res);
  return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
#include <string.h>
typedef struct{
  int time;
  char names[10];
}pr;
int main(){
  int i,n,q,time,sum=0,head=0;
  pr p[1000000],array;
  scanf("%d %d",&n,&time);
  for(i=0;i<n;i++)scanf("%s %d",p[i].names,&p[i].time);
  while(1){
    if(n==head)break;
    if(p[head].time<=time){
      sum+=p[head].time;
      printf("%s %d\n",p[head].names,sum);
      head++;
    }
    else {
      sum+=time;
      p[head].time-=time;
      p[n].time=p[head].time;
      strcpy(p[n].names,p[head].names);
      head++;
      n++;
    }

  }
  return 0;
}


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

using namespace std;

const int N=1e5+7;
int n , a[N][3] ,f[N][3] ;

int main()
{
    cin >> n ;
    for(int i=1 ; i<=n ; i++)
    {
        cin >> a[i][1] >> a[i][2] >> a[i][3];
    }
    f[1][1]=a[1][1];
    f[1][2]=a[1][2];
    f[1][3]=a[1][3];

    for(int i=2 ; i<=n ; i++)
    {
        f[i][1]=max(f[i-1][2]+a[i][1] , f[i-1][3]+a[i][1]);
        f[i][3]=max(f[i-1][2]+a[i][3] , f[i-1][1]+a[i][3]);
        f[i][2]=max(f[i-1][1]+a[i][2] , f[i-1][3]+a[i][2]);
    }
    cout << max(f[n][1] , max(f[n][2] , f[n][3]));
}


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

int main()
{
    string s;cin>>s;
    if(s[2]==s[3]){
        if(s[4]==s[5]){
            std::cout << "Yes" << std::endl;
        }
        else{
            std::cout << "No" << std::endl;
        }
    }
    else{
        std::cout << "No" << std::endl;
    }
}

Measured memory_bytes: 3604
n = int(input())
x, y = [], []
for i in range(n):
	a, b = map(int, input().split())
	x.append(a)
	y.append(b)
res = 0
for x1, y1 in zip(x, y):
	for x2, y2 in zip(x, y):
		res += ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
res /= n
print(res)

Measured memory_bytes: 38408
#include<stdio.h>

#define TILES 6
#define MAX_ROLL 3

typedef struct{
	int up;
	int front;
	int right;
	int left;
	int back;
	int bottom;
}dice;

int DiceRoll(dice* p, char c);
int SameDice(dice* a, dice* b);

int main(void){
	dice a = {0, 0, 0, 0, 0, 0};
	dice b = {0, 0, 0, 0, 0, 0};
  
	// dice label setup 
    scanf("%d %d %d %d %d %d", &a.up, &a.front, &a.right, &a.left, &a.back, &a.bottom);
	scanf("%d %d %d %d %d %d", &b.up, &b.front, &b.right, &b.left, &b.back, &b.bottom);

	if(SameDice(&a, &b) == 0) printf("Yes\n");
	else printf("No\n");

    return 0;
}

int SameDice(dice* a, dice* b){
	int i = 0;					// loop index
 
	if(a->up != b->up || a->bottom != b->bottom){
		while((a->up != b->up || a->bottom != b->bottom) && i < MAX_ROLL * 2){
			if(i < MAX_ROLL) DiceRoll(a, 'E');
			else DiceRoll(a, 'N');
			i++;
		}
		if(a->up != b->up || a->bottom != b->bottom) return -1;
	}

	i = 0;
	if(a->front != b->front || a->back != b->back){
		while((a->front != b->front || a->back != b->back) && i < MAX_ROLL){
			DiceRoll(a, 'R');
			i++;
		}
		if(a->front != b->front || a->back != b->back) return -1;
	}

	if(a->right != b->right || a->left != b->left) return -1;
	return 0;
}

int DiceRoll(dice* p, char c){
	int tmp = -1;
	
	switch(c){
	case 'E':
		tmp = p->up;
		p->up = p->left;		// up <- left
		p->left = p->bottom;	// left <- bottom
		p->bottom = p->right;	// bottom <- right
		p->right = tmp;			// right <- up
		break;
	case 'N':
		tmp = p->up;
		p->up = p->front;		// up <- front
		p->front = p->bottom;	// front <- bottom
		p->bottom = p->back;	// bottom <- back
		p->back = tmp;			// back <- up
		break;
	case 'S':
		tmp = p->up;
		p->up = p->back;		// up <- back
		p->back = p->bottom;	// back <- bottom
		p->bottom = p->front;	// bottom <- front
		p->front = tmp;			// front <- up
		break;
	case 'W':
		tmp = p->up;
		p->up = p->right;		// up <- right
		p->right = p->bottom;	// right <- bottom
		p->bottom = p->left;	// bottom <- left
		p->left = tmp;			// left <- up
		break;
	case 'R':
		tmp = p->front;
		p->front = p->left;		// front <- left
		p->left = p->back;		// left <- back
		p->back = p->right;		// back <- right
		p->right = tmp;			// right <- front
		break;
	case 'L':
		tmp = p->front;
		p->front = p->right;	// front <- right
		p->right = p->back;		// right <- back
		p->back = p->left;		// back <- left
		p->left = tmp;			// left <- front
		break;
	default:
		break;
	}

	return 0;
}

Measured memory_bytes: 580
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <string.h>
#include <fstream>

using namespace std;


#define LL long long
#define ULL unsigned long long
#define N 1000220
#define M 5000100
#define MP make_pair
#define Pi acos(-1.0)
#pragma comment(linker,"/STACK:1024000000,1024000000")
#define ls (rt << 1)
#define rs (ls | 1)
#define md ((ll+rr)/2)
#define lson ll, md, ls
#define rson md+1, rr, rs
#define mod 1000000007
#define inf 0x3f3f3f3f
#define sqr(x) ((x)*(x))
#define eps 1e-6
#define MP make_pair
#define uLL unsigned long long
LL powmod(LL a,LL b) {LL res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
#define F(x) ((x)/3+((x)%3 == 1 ? 0 : tb))
#define G(x) ((x)<tb ? (x)*3+1 : ((x) - tb)*3+2)
#define lowbit(x) ((x)&(-x))
#define fi first
#define se second
#define pii pair<int,int>
#define B 100000001
const LL INF = ~0u >> 1;

int gcd(int x,int y){
    while(y){
        int t = x % y;
        x = y;
        y = t;
    }
    return x;
}

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

const int mask = (1 << 26) - 1;
char s[N];
int a[N],id[N];

int l[N],r[N];

set<int> S;


int main(){
    srand(time(0));
    //freopen("in.txt", "r", stdin);
    //freopen("in.txt", "w", stdout);
    
    int T = 20;
    
    //scanf("%d",&T);
   
    S.clear();
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        scanf("%d",&a[i]);
        id[a[i]] = i;
        l[a[i]] = r[a[i]] = i;
    }
    
    LL ans = 0;
    
    for(int i = 1; i <= n; i++) {
        set<int>::iterator it = S.lower_bound(id[i]);
        
        if(it != S.end()){
            r[i] = *it - 1;
        }else {
            r[i] = n;
        }
        
        if(it != S.begin()){
            it--;
            l[i] = *it + 1;
        }else{
            l[i] = 1;
        }
        
        S.insert(id[i]);
    }
    
    
    for(int i = 1; i <= n; i++){
        
        ans += 1LL * (id[i] - l[i] + 1) * (r[i] - id[i] + 1) * i;
    }
    
    cout<<ans<<endl;
    
    return 0;
}



Measured memory_bytes: 12800
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
using namespace std;

int main()
{
	int n;
	cin >> n;
	int c = 0;
	int pa = 0, pb = 0;
	int c2 = 0;
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		for (int j = 0; j < s.length() - 1; j++)
			if (s[j] == 'A' && s[j + 1] == 'B')
				c++;
		
		if(s[0]=='B' && s[s.length()-1]=='A')
		{
			pb++; pa++; c2++;
		}
		else if(s[0]=='B')
		{
			pb++; c2++;
		}
		else if (s[s.length()-1] == 'A')
		{
			pa++; c2++;
		}
	}

	
	int p = min(pa, pb);
	if (p==c2 && c2!=0)
		p--;
	cout << c + p << endl;
	//system("pause");
	return 0;
}

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



int main(){
    ll N, A, B, C; cin >> N >> A >> B >> C;
    vector<char> V;
    for(int i = 0; i < N; i++){
        string S; cin >> S;
        if(S == "AB"){
            if(A == 1 && B == 1 && C == 0){
                if(i != S.size()-1){
                    i++;
                    string T; cin >> T;
                    if(T == "AC"){
                        B--;C++; V.push_back('A');
                        V.push_back('C');
                    }
                    else if(T == "BC"){
                        C++; A--; V.push_back('B');
                        V.push_back('C');
                    }
                    else {
                        V.push_back('A');
                        V.push_back('B');
                    }
                    continue;
                }
            }
            if(A < B){A++;B--;V.push_back('A');}
            else {
                B++; A--; V.push_back('B');
            }
        }
        else if(S == "BC"){
            if(A == 0 && B == 1 && C == 1){
                if(i != S.size()-1){
                    i++;
                    string T; cin >> T;
                    if(T == "AC"){
                        B--;A++; V.push_back('C');
                        V.push_back('A');
                    }
                    else if(T == "AB"){
                        A++; C--; V.push_back('B');
                        V.push_back('A');
                    }
                    else {
                        V.push_back('C');
                        V.push_back('B');
                    }
                    continue;
                }
            }
            if(B < C){B++;C--;V.push_back('B');}
            else {
                C++; B--; V.push_back('C');
            }
        }
        else if(S == "AC"){
            if(A == 1 && B == 0 && C == 1){
                if(i != S.size()-1){
                    i++;
                    string T; cin >> T;
                    if(T == "AB"){
                        B++;C--; V.push_back('A');
                        V.push_back('B');
                    }
                    else if(T == "BC"){
                        B++; A--; V.push_back('C');
                        V.push_back('B');
                    }
                    else {
                        V.push_back('A');
                        V.push_back('C');
                    }
                    continue;
                }
            }
            if(A < C){A++;C--;V.push_back('A');}
            else {
                C++; A--; V.push_back('C');
            }
        }
        if(A < 0 || B < 0 || C < 0){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for(int i = 0; i < N; i++){
        cout << V[i] << endl;
    }
}

Measured memory_bytes: 3728
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;

#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end()) // container with member function find
#define cpresent(c,x) (find(all(c),x) != (c).end()) // for vector

/* PRINT */
void print_vector(const std::vector<int>& v) {
    // Traverse all container, from begin() to end()
    for(vector<int>::const_iterator it = v.begin(); it != v.end(); it++) {
        std::cout << *it << " ";
    }
    std::cout << std::endl;
}


int main() {
    int n, a, b;
    string str;
    std::cin >> n >> a >> b;
    std::cin >> str;

    int q = a + b;
    int bq = b;

    for (int i = 0; i < n; i++) {
        if(str[i] == 'c')
            std::cout << "No" << std::endl;
        else if (str[i] == 'a' && q > 0) {
            std::cout << "Yes" << std::endl;
            q--;
        }
        else if (str[i] == 'b' && q > 0 && bq > 0) {
            std::cout << "Yes" << std::endl;
            q--;
            bq--;
        }
        else{
            std::cout << "No" << std::endl;
        }
    }

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a, b, c;
	cin>>a>>b>>c;
	if(a+b+1>=c){
		cout<<b+c<<'\n';
	}
	else{
		cout<<b+(a+b+1)<<'\n';
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;
int main() {
  int n, d[100];
  int sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      sum += d[i] * d[j];
    }
  }
  cout << sum;
  return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

	string str;cin >> str;
	cout << ((str[2] == str[3] && str[4] == str[5]) ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 256
/*
   Author : tarang
*/
#include<bits/stdc++.h>
#define ll long long
#define fastio ios_base::sync_with(false); cin.tie(0);cout.tie(0);
const int MOD = 1000000007;
#define PI = acos(-1)
using namespace std ;
int main(){
    ll a,b , c,d ;
    cin >> a >> b >> c >> d ;
    cout << max(a*c , max(a*d , max(b*c , b*d)));
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    ll dp[100010];
    REP(i,100010)dp[i] = LLONG_MAX;
    dp[0] = 0;
    REP(i,N){
        chmin(dp[i+1],dp[i]+1);
        for(int l = 6;l < N-i+1;l*=6){
            chmin(dp[i+l],dp[i] + 1);
        }
        for(int l = 9;l < N-i+1;l*=9){
            chmin(dp[i+l],dp[i] + 1);
        }
    }
    cout <<dp[N]<< "\n";
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;

class Program
{


    static void Main(string[] args)
	{
        int N = int.Parse(Console.ReadLine());
        string[] sA = Console.ReadLine().Split(' ');

        long[] A = new long[N];

        for (int i = 0; i < N; i++)
        {
            A[i] = long.Parse(sA[i]);
        }

        long ans = 0;
        long modNum = 1000000007;

        //for(int i = 0;i < N - 1; i++)
        //{
        //    for (int j = i + 1; j < N; j++)
        //    {
        //        ans += (A[i] * A[j]) % modNum;
        //        ans %= modNum;
        //    }
        //}
        long sumNum = 0;
        for(int i = 0;i < N - 1; i++)
        {
            sumNum += A[i];
            sumNum %= modNum;

            ans += sumNum * A[i + 1];
            ans %= modNum;

        }
        Console.WriteLine(ans);
    }
}

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

using namespace std;


#define ff				first
#define ss				second
#define int				long long
#define pb				push_back
#define mp				make_pair
#define pii				pair<int,int>
#define vi				vector<int>
#define mii 			map<int,int>
#define	pqb				priority_queue<int>
#define pqs				priority_queue<int,vi,greater<int> >
#define setbits(x)		__builtin_popcountll(x)
#define zrobits(x)		__builtin_ctzll(x)
#define mod				1000000007
#define inf 			1e18
#define ps(x,y)			fixed<<setprecision(y)<<x
#define mk(arr,n,type)	type *arr = new type[n]
#define w(x)			int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)


void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}


bool isPrime(int n)
{
	if (n <= 1)
		return false;
	if (n <= 3)
		return true;
	if (n % 2 == 0 || n % 3 == 0)
		return false;
	for (int i = 5; i * i <= n; i += 6)
	{
		if (n % i == 0 || n % (i + 2) == 0)
			return false;

	}
	return true;
}

vector<int> Sieve(int n)
{
	bool prime[n + 1];
	memset(prime, true, sizeof(prime));
	for (int i = 2; i * i <= n; i++)
	{
		if (prime[i])
		{
			for (int j = i * i; j <= n; j += i)
			{
				prime[j] = false;
			}
		}
	}
	vi primes;
	for (int i = 2; i <= n; i++)
	{
		if (prime[i])
			primes.pb(i);
	}
	return primes;
}


bool cmp(pair<string, int> a, pair<string, int> b)
{
	return a.ss < b.ss;
}
int lengthOfLongestIncreasingSubsequence(int arr[], int n)
{
	int max = 1, len = 1;
	for (int i = 1; i < n; i++)
	{
		if (arr[i] > arr[i - 1])
			len++;
		else
		{
			if (max < len)
				max = len;

			len = 1;
		}
	}
	if (max < len)
		max = len;

	return max;
}

set<int> primeFactors(int  n)
{
	set<int> factors;
	while (n % 2 == 0)
	{
		n /= 2;
		factors.insert(2);

	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		while (n % i == 0)
		{
			factors.insert(i);
			n /= i;
		}
	}
	if (n > 2)
		factors.insert(n);
	return factors;
}

void print(vi j)
{
	for (int i = 0; i < j.size(); i++)
	{
		cout << j[i] << " ";
	}
	cout << endl;
}


const int MAXV = 1e5 + 10;
const int MAXN = 1e3 + 10;
const int INF = 1e13;

int dp[MAXV];
int N, W, V, wi[MAXN], val[MAXN];
int32_t main()
{
	FIO;
	//c_p_c();
//--------------------------------------------------
	cin >> N >> W;
	for (int i = 1; i <= N; i++)
	{
		cin >> wi[i] >> val[i];
		V += val[i];
	}
	for (int i = 1; i <= V; i++) dp[i] = INF;
	dp[0] = 0;


	for (int i = 1; i <= N; i++)
	{
		int w = wi[i], v = val[i];
		for (int j = V; j >= v; j--)
		{
			dp[j] = min(dp[j], dp[j - v] + w);
		}
	}
	for (int i = V; i >= 0; i--)
	{
		if (dp[i] <= W)
		{	cout << i << endl;
			break;
		}
	}



}

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

int main() {
  int i=0,j,k;
  int N;
  int answer=0;
  
  cin >> N ;
  
  std::vector<int> L(N);

  for ( i = 0; i < N; i++)
  {
      cin >> L[i];
  }

  sort(L.begin(),L.end());

  for ( i = 0; i < N; i++)
  {
      for ( j = i+1; j < N; j++)
      {
          auto it = lower_bound(L.begin(),L.end(),L[i]+L[j]);
          answer += N-(j+1)-distance(it,L.end());
      }
         
  }
  
  

  cout << answer <<endl;
  
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define eb emplace_back
#define precision(n) cout << fixed << setprecision(n);
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
int main()
{
    fast;
    int a[100001];
    int n,k;
    cin>>n>>k;
    int cnt=0;
    a[0]=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
    {
        a[i]=a[i]+a[i-1];
    }
    for(int i=1;i<=n;i++)
    {
      if(a[i]<=k)
      {
          cnt++;
      }
    }
    cout<<cnt+1<<endl;

return 0;
}


Measured memory_bytes: 256
n=int(input())
arr=[]
dict1={}
for i in range(n):
	arrcount=[0]*26
	s=str(input())
	for i in s:
		arrcount[ord(i)-97]+=1
	s1='abcdefghijklmnopqrstuvwxyz'
	s2=''
	for i in range(26):
		s2+=s1[i]*arrcount[i]
	try:
		dict1[s2]+=1
	except:
		KeyError
		dict1[s2]=1

ans=0
for i in dict1.keys():
	ans+=((dict1[i]-1)*dict1[i])//2
print(ans)


Measured memory_bytes: 17892
#include <bits/stdc++.h>
using namespace std;
#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++)

int main(void)
{
    int n, root, count;
    cin >> n;
    unsigned long ln=n;

    root=sqrt(n);
    count=0;
    rep2(i, 1, n){
        rep2(j, i+1, n){
            if((unsigned long)i*j<ln){
                count++;
            }else{
                break;
            }
        }
    }
    count*=2;
    count+=root;
    if(root*root==n){
        count--;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
typedef pair< int , int > Pi;

class DisjointSet{
private:
  vector<int> rank, p;
  void link(int x,int y){
    if(rank[x] > rank[y]){
      p[y] = x;
    }else{
      p[x] = y;
      if(rank[x] == rank[y]) rank[y]++;
    }
  }
public:
  DisjointSet(){}
  DisjointSet(int size){
    rank.resize(size,0);
    p.resize(size,0);
  }
  void makeSet(int x){
    p[x] = x, rank[x] = 0;
  }
  void Union(int x,int y){
    link(findSet(x),findSet(y));
  }
  int findSet(int x){
    return( x != p[x] ? p[x] = findSet(p[x]) : p[x]);
  }
};

struct edge{
  int u, v, cost;
  bool operator<(const edge& hoge)const{
    return cost < hoge.cost;
  }
};
typedef vector< edge > Edges;
DisjointSet* uf_tree;
Pi kruskal(Edges& edges, vector< bool >& done){
  int ret = 0;
  for(int i = 0; i < edges.size(); i++){
    edge& e = edges[i];
    if(done[e.u] && done[e.v] && uf_tree -> findSet(e.u) != uf_tree -> findSet(e.v)){
      uf_tree -> Union( e.u, e.v);
      ret += e.cost;
    }
  }
  for(int i = 0; i < done.size(); i++){
    for(int j = i + 1; j < done.size(); j++){
      if(done[i] && done[j] && uf_tree -> findSet(i) != uf_tree -> findSet(j)) return make_pair( false, ret);
    }
  }
  return make_pair( true, ret);
}

int main(){
  int N, M;
  Pi h[200];
  Edges edges;

  while(cin >> N >> M, N){

    uf_tree = new DisjointSet(N);
    for(int i = 0; i < N; i++){
      uf_tree -> makeSet(i);
    }

    for(int i = 0; i < N; i++){
      cin >> h[i].first;
      h[i].second = i;
    }
    sort( h, h + N);
    for(int i = 0; i < M; i++){
      int a, b, c;
      cin >> a >> b >> c;
      a--, b--;
      edges.push_back((edge){ a, b, c});
      edges.push_back((edge){ b, a, c});
    }
    sort( edges.begin(), edges.end());

    int ret = 0;
    vector< bool > done(N, false);

    done[h[N - 1].second] = true;

    for(int i = N - 2; i >= 0; ){
      int j = i;
      while(j >= 0 && h[i].first == h[j].first){
        done[h[j].second] = true;
        j--;
      }
      Pi p = kruskal( edges, done);
      if(p.first){
        ret += p.second;
      } else {
        ret = 0;
        delete uf_tree;
        uf_tree = new DisjointSet(N);
        for(int j = 0; j < N; j++){
          uf_tree -> makeSet(j);
        }
      }
      i = j;
    }
    if(uf_tree != NULL) delete uf_tree;
    cout << ret << endl;
    edges.clear();
  }
}

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

#define INF 999999999
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
#ifdef LOCAL
  #define de(e) cout << "L" << __LINE__ << ": " << e << "\n" // debug echo
  #define dr(e) cout << "L" << __LINE__ << ": " << #e << " -> " << e << "\n" // debug repr
#else
  #define de(e)
  #define dr(e)
#endif
#define out(...) cout << __VA_ARGS__ << endl
int gcd(int m, int n) { if((0 == m) || (0 == n)){return 0;} while(m != n){ if(m > n){m -= n;}else{n -= m;} } return m; }
int lcm(int m, int n) { if((0 == m) || (0 == n)){return 0;} return (m / gcd(m, n)) * n; }

//
// Implementation
//

int main() {
  int N; cin >> N;
  vector<int> X(N);
  rep(i, N) cin >> X[i];
  sort(all(X), greater<int>());

  int cnt = 1;
  for (int i=1; i<N; i++) {
    if (X[i-1] != X[i]) {
      cnt++;
    }
  }
  out(cnt);
}


Measured memory_bytes: 256
N = int(input())

occ = {}

for i in range(N):
    s = input()
    occ[s] = occ.get(s, 0) + 1

best = 0
for s in occ: best = max(best, occ[s])

res = []
for s in occ:
    if occ[s] == best: 
        res.append(s)

res.sort()

for i in res:
    print(i)

Measured memory_bytes: 95576
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        a_s: [usize; n],
    }
    let mut b_s = vec![0; n];
    fn set(i: usize, a_s: &[usize], b_s: &mut [usize]) {
        let mut sum = 0;
        let n = a_s.len();
        for mult in 2..n + 1 {
            let j = i * mult - 1;
            if n <= j {
                break;
            }
            sum ^= b_s[j];
        }
        if sum == a_s[i - 1] {
            b_s[i - 1] = 0;
        } else {
            b_s[i - 1] = 1;
        }
    }
    for i in (1..n + 1).rev() {
        set(i, &a_s, &mut b_s);
    }

    let anss = b_s
        .iter()
        .enumerate()
        .filter(|x| *x.1 == 1)
        .collect::<Vec<_>>();
    let ones = anss.len();
    println!("{}", ones);
    for item in anss.iter() {
        let i = item.0;
        println!("{}", i + 1);
    }
}


Measured memory_bytes: 11260
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>

using namespace std;

int main()
{
    int a;
    string str;
    getline(cin,str);
    while((a=str.find("apple"))!=string::npos)
    {
        str[a]='t';
        str[a+1]='t';
        str[a+2]='t';
        str[a+3]='t';
        str[a+4]='t';
    }
    while((a=str.find("peach"))!=string::npos)
    {
        str[a]='a';
        str[a+1]='p';
        str[a+2]='p';
        str[a+3]='l';
        str[a+4]='e';
    }
    while((a=str.find("ttttt"))!=string::npos)
    {
        str[a]='p';
        str[a+1]='e';
        str[a+2]='a';
        str[a+3]='c';
        str[a+4]='h';
    }
    cout << str << endl;
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

vector<ll> d;
vector<vector<ll>> p;
vector<ll> f, deg, ans, a, b, c;
vector<ll> que;

void dfs(int i, int dep, int from) {
  d[i] = dep;
  f[i] = from;
  if (deg[i] == 1) que.push_back(i);
  for (auto &&j : p[i]) {
    if (j == from) continue;
    dfs(j, dep + 1, i);
  }
}

void dfs2(int i, ll sum, int from) {
  ans[i] += sum;
  for (auto &&j : p[i]) {
    if (j == from) continue;
    dfs2(j, ans[i], i);
  }
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  d.resize(n);
  p.resize(n);
  f.resize(n);
  a.resize(n);
  b.resize(n);
  c.resize(n);
  ans.resize(n);
  deg.resize(n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    p[u].push_back(v);
    p[v].push_back(u);
    deg[u]++;
    deg[v]++;
  }
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) c[i] = b[i] - a[i];
  dfs(0, 0, -1);
  while (que.size()) {
    int now = que.back();
    que.pop_back();
    int sum = -c[now];
    for (auto &&j : p[now]) {
      if (j == f[now]) continue;
      sum += ans[j];
    }
    if (f[now] >= 0) {
      ans[now] = sum;
      deg[f[now]]--;
      if (deg[f[now]] == 1) {
        que.push_back(f[now]);
      }
    }
  }
  ll an = 0;
  ll min_ans = 1000000000;
  dfs2(0, 0LL, -1);
  for (int i = 0; i < n; i++) {
    min_ans = min(min_ans, ans[i]);
    an += ans[i];
  }
  if (min_ans >= 0) {
    cout << an << endl;
  } else {
    cout << an - min_ans * n << endl;
  }

  return 0;
}



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

// 1s = 10 ^ 8 loop

int main() {
  int D;
  cin >> D;
  
  string str;
  switch (D)
  {
    case 22:
      str = "Christmas Eve Eve Eve";
      break;
    case 23:
      str = "Christmas Eve Eve";
      break;
    case 24:
      str = "Christmas Eve";
      break;
    case 25:
      str = "Christmas";
      break;
    default:
      break;
  }

  cout << str << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
 
using namespace std;
 
int main(){
    while(1){
        string s;
        int m;
         
        cin >> s;
        if(s == "-") break;
        cin >> m;
        for(int i=0; i<m; ++i){
            int a;
            cin >> a;
             
            string add = s.substr(0,a);
            s = s+add;
            s = s.substr(a, s.size());
        }
         
        cout << s << endl;
    }
    return 0;
}


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


/*??´??°??????A???????´???§????????????a??????b?????§????????§????????§???????????????????????????*/
int find_max(int *A,int a,int b){
  int max,i,soeji;
  max=A[a];
  soeji=a;
  for(i=a+1;i<=b;i++){
    if(max<A[i]){
      max=A[i];
      soeji=i;
    }
  }
  return soeji;
}  

int main(){
  int *R,i,n,maxsoeji=-1,ans=0,min=0,hantei=0;
  scanf("%d",&n);
  R=malloc(n*sizeof(int));
  for(i=0;i<n;i++) scanf("%d",&R[i]);
  for(i=0;i<n-1;i++){
    if(R[i]<R[i+1] && (min>R[i] || hantei==0)){
      if(hantei==0) hantei=1;
      min=R[i];
      if(i>=maxsoeji){
        maxsoeji=find_max(R,i+1,n-1);
        if(ans<(R[maxsoeji]-min)) ans=R[maxsoeji]-min;
      }
      else ans=R[maxsoeji]-min;
    }
  }
  if(ans==0){
    ans=R[1]-R[0];
    for(i=1;i<n-1;i++){
      if(ans<(R[i+1]-R[i])) ans=R[i+1]-R[i];
    }
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 1380
d = input().split(" ")
a = int(d[0])
b = int(d[1])
c = int(d[2])
if a == b:
	if b != c:
		print("Yes")
	else:
		print("No")
else:
	if a == c:
		print("Yes")
	elif b == c:
		print("Yes")
	else:
		print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,k;
cin>>n>>k;
int arr[n];
for(int i=0;i<n;i++)
    cin>>arr[i];
for(int i=k;i<n;i++)
{
    int j=i-k;
    if(arr[i]>arr[j])
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
}

















    return 0;
}


Measured memory_bytes: 5220
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
using namespace std;

int n, m;
const long long MOD = 1000000007;

long long C(long long a) {
    return a * (a - 1) / 2;
}

int main() {
    while (cin >> n >> m) {
        long long xsum = 0;
        long long cx = 0; cin >> cx;
        for (int i = 0; i < n-1; ++i) {
            long long tmp = C(n) - C(i+1) - C(n-1-i);
            long long x; cin >> x;
            xsum += (x - cx) * tmp % MOD;
            xsum %= MOD;
            cx = x;
        }
        long long ysum = 0;
        long long cy = 0; cin >> cy;
        for (int i = 0; i < m-1; ++i) {
            long long tmp = C(m) - C(i+1) - C(m-1-i);
            long long y; cin >> y;
            ysum += (y - cy) * tmp % MOD;
            ysum %= MOD;
            cy = y;
        }
        cout << (xsum * ysum) % MOD << endl;
    }
}




Measured memory_bytes: 256
l=list()
L=list()
for i in range(5):
  n=int(input())
  if n%10==0:
    l.append(n)
  else:
    L.append(n)
if len(l)==5:
  print(sum(l))
  exit()
    
LL=list()
for n in L:
  N=n%10
  LL.append(N)
key=min(LL)
LL.remove(key)

x=len(LL)*10

M=list()
for n in L:
  nn=n//10*10
  M.append(nn)
  
  
print(sum(l)+sum(M)+x+key)
  


Measured memory_bytes: 3064
#include <unordered_map>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <tuple>
#include <set>
#include <map>

#define FOR0(var, max) for (ul (var) = 0; (var) < (max); ++(var))
#define FORi(var, min, max) for (ul (var) = (min); (var) < (max); ++(var))
#define FORi_INV(var, min, max) for (ul (var) = (max) - 1; (var) + 1 > (min); --(var))
#define FORITER(var, iter) for (auto (iter) = (var).begin(); (iter) != (var).end(); (iter)++)
#define FORITER_INV(var, iter) for (auto (iter) = (var).rbegin(); (iter) != (var).rend(); (iter)++)

#define LTLT(a, b, c) (((a) < (b)) && ((b) < (c)))
#define LELT(a, b, c) (((a) <= (b)) && ((b) < (c)))
#define LTLE(a, b, c) (((a) < (b)) && ((b) <= (c)))
#define LELE(a, b, c) (((a) <= (b)) && ((b) <= (c)))

using namespace std;

using uc = unsigned char;
using ui = unsigned int;
using ul = unsigned long long int;

using sc = signed char;
using si = signed int;
using sl = signed long long int;

static ul N;

void solve(void) {
  FORi(i, 1, 10) {
    if ((N % i == 0) && (N / i <= 9)) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

int main(void) {
  cin >> N;
  solve();
  return 0;
}

Measured memory_bytes: 256
import collections

N = int(input())
a = [int(i) for i in input().split()]
count = 0
b = collections.Counter(a)
for i in b:
    if int(i) < b[i]:
        count += (b[i] - int(i))
    elif(int(i) > b[i]):
        count += b[i]
print(count)


Measured memory_bytes: 18676
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, k int
	fmt.Scanf("%d %d", &n, &k)

	h := scanNums(n)

	fmt.Println(answer(k, h))
}

func answer(k int, h *[]int) int {
	res := 0
	for _, v := range *h {
		if k <= v {
			res += 1
		}
	}
	return res
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("function min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func minArray(nums *[]int) int {
	res := (*nums)[0]
	for _, v := range *nums {
		res = int(math.Min(float64(res), float64(v)))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("function max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func maxArray(nums *[]int) int {
	res := (*nums)[0]
	for _, v := range *nums {
		res = int(math.Max(float64(res), float64(v)))
	}
	return res
}

func scanNums(len int) *[]int {
	var num int
	nums := make([]int, len)
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return &nums
}


Measured memory_bytes: 7680
class Combination:
    def __init__(self, n, mod):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % mod)
        self.inv_fact = [0] * (n + 1)
        self.inv_fact[n] = pow(self.fact[n], mod - 2, mod)
        for i in reversed(range(n)):
            self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % mod
        self.mod = mod

    def factorial(self, k):

        return self.fact[k]

    def inverse_factorial(self, k):
        return self.inv_fact[k]

    def permutation(self, k, r):
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r]) % self.mod

    def combination(self, k, r):
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.mod

    def combination_large(self, k, r):
        if k < r:
            return 0
        res = 1
        for l in range(r):
            res *= (k - l)
            res %= self.mod
        return (res * self.inv_fact[r]) % self.mod

n, m, k = map(int, input().split())
mod = 998244353
cmb = Combination(10**6, mod)

ans = 0
for i in range(k+1):
    ans += m*cmb.combination(n-1, i)*pow(m-1, n-1-i, mod)
    ans %= mod
print(ans)


Measured memory_bytes: 88044
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main(int argc, const char * argv[]) {
    int count = 0;
    int N;
    cin>>N;
    vector<int> D1(N);
    vector<int> D2(N);

    for (int i = 0;i < N;i++){
        cin>>D1[i]>>D2[i];
        if (D1[i] == D2[i]){
            count += 1;
        }
        else {
            count = 0;
        }
        if (count >= 3){
            cout<<"Yes"<<endl;
            break;
        }
    }
    if (count < 3){
        cout<<"No"<<endl;
    }
   
}

Measured memory_bytes: 3592