akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(int argc, char *argv[]){
  int K,S;
  cin>>K>>S;
  //int T=(S/3)+(S%3);
  int X=K,Y=K,Z;
  int count=0;
  for(int i=X; i>=0; i--){
    if(i>S){
      i=S+1;
      continue;
    }
    for(int j=Y; j>=0; j--){
      Z=S-i-j;
      if(Z>K||Z<0) continue;
      //cout<<i<<" "<<j<<" "<<Z<<endl;
      if(i+j+Z==S) count++;
      else if(i+j+Z<S) break;
      
    }
  }
  cout<<count<<endl;
}


Measured memory_bytes: 256
#include <iostream>

int main(int argc, char const *argv[]) {
  int n;
  int cards[4][13] = {};
  std::cin >> n;

  for(int i=0;i<n;i++){
    char mark;
    int num;
    std::cin >> mark >> num;
    switch(mark){
      case 'S':
        cards[0][num-1] = 1;
        break;
      case 'H':
        cards[1][num-1] = 1;
        break;
      case 'C':
        cards[2][num-1] = 1;
        break;
      case 'D':
        cards[3][num-1] = 1;
        break;
      default:
        break;
    }
  }
  for(int i=0;i<4;i++){
    for(int j=0;j<13;j++){
      if(!cards[i][j]){
        switch(i){
          case 0:
            std::cout << "S " << (j+1) << std::endl;
            break;
          case 1:
            std::cout << "H " << (j+1) << std::endl;
            break;
          case 2:
            std::cout << "C " << (j+1) << std::endl;
            break;
          case 3:
            std::cout << "D " << (j+1) << std::endl;
            break;
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3088
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

long X[200010]={};

void swap(long *x, long *y);
void quicksort(long X[], long low, long high);

int main(void)
{
	int N,tmp;

	cin >> N;
	for(int i =0; i<N; i++){
	 cin >> X[i];
	}
	quicksort(X,0,N-1);

/*
	for(int i=0;i<N; i++){
		cout << i << "=" << X[i] << endl;
	}
	*/
	int mid1; int mid2=0;
	if(X[N-1] % 2 == 0){
		mid1 = X[N-1]/2;
		long tmp = X[N-1];
		long min;
		for(int i = 0; i < N; i++){
			if(abs(mid1 - X[i]) < tmp){
				tmp = abs(mid1 - X[i]);
				min = X[i];
			}
		}
		
		cout << X[N-1] << " " <<  min << endl;
	}else{
		mid1 = X[N-1]/2;
		mid2 = X[N-1]/2 + 1;
		long tmp = X[N-1];
		long min;
		for(int i = 0; i < N; i++){
			if(abs(mid1 - X[i]) < tmp){
				tmp = abs(mid1 - X[i]);
				min = X[i];
			}
			if(abs(mid2 - X[i]) < tmp){
				tmp = abs(mid2 - X[i]);
				min = X[i];
			}
		}
		
		cout << X[N-1] << " " << min << endl;
	} 
	
	
	return 0;
}

void quicksort(long X[], long low, long high){
	if(low < high){
		int mid = (low + high) /2;
		long x= X[mid];
		long i = low; long j = high;
		while(i <= j){
			while(X[i] < x) i = i+1;
			while(X[j] > x) j = j-1;
			if(i<=j) swap(&X[i++], &X[j--]);
		}
		quicksort(X,low,j);
		quicksort(X,i,high);
	}
}

void swap(long *x, long *y){
	long tmp;
	tmp = *x;
	*x = *y;
	*y = tmp;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <deque>
#include <math.h>
#include <map>
#include <bitset>
#include <queue>
#include <list>1
#include <utility>

//#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
using p = pair<int, int>;
using Graph = vector<vector<char>>;
#define rep(i,n)  for(int i = 0; i < n ; i++)
int dx[4]{ -1,0,1,0 };
int dy[4]{ 0,1,0,-1 };
	int main()
	{
		long N;
		cin >> N;
		ll sum = 0;
		for (int i = 1; i <= N; i++)
		{
			if (i % 3 == 0 || i % 5 == 0)
			{
				continue;
			}
			sum += i;
		}
		cout << sum << endl;
	}


Measured memory_bytes: 3636
import java.util.*;
public class Main {
	public static void main (String [] args) {
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		if (d == 25) System.out.println("Christmas");
		if (d == 24) System.out.println("Christmas Eve");
		if (d == 23) System.out.println("Christmas Eve Eve");
		if (d == 22) System.out.println("Christmas Eve Eve Eve");
	}
}


Measured memory_bytes: 20820
n = int(input())
d = []
for i in range(n):
    x,u = input().split()
    d.append([float(x),u])

ans = 0
for j in range(n):
    if d[j][1] == "JPY":
        ans += d[j][0]
    else:
        ans += d[j][0]*380000
        
print(ans)

Measured memory_bytes: 3060
mod = int(10**9+7)
N = int(input())
S = input()
S = list(S)
alp = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
cnt = [S.count(c) for c in alp]
ans = 1
for i in range(len(cnt)):
    ans *= (cnt[i]+1) % mod
if ans == 0:
    print(mod-1)
else:
    print((ans-1) % mod)


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

int main()
{
	int a[8];
  	for(int i=0 ; i<5 ; ++i)
    cin>>a[i];
  	int k;
  	cin>>k;
  	for(int i=0 ; i<5 ; ++i)
    {
    	for(int j=0 ; j<5 ; ++j)
        {
        	if(abs(a[i]-a[j])>k)
            {
            	cout<<":("<<endl;
              	return 0;
            }
        }  
    }
  	cout<<"Yay!"<<endl;
}

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

typedef pair<string,int> P;
map<string,int> state;
map<string,int>::iterator it;
queue<P> que;
int dir[] = {-1,1,-4,4};  //状?数?的下?第一行? 0 1 2 3 第二行? 4 5 6 7 ,上下交?下?+4或-4; 

bool ok(string& s,int cur,int newcur){
	it = state.find(s);
	if(it != state.end())	return false;
	if((cur == 3 && newcur == 4) || (cur==4 && newcur == 3))	return false;
	if(cur < 0 || cur > 7 || newcur < 0 || newcur >7)	return false;
	return true;
}
	
void bfs(){
	que.push(P("01234567",0));
	state["01234567"] = 0;
	while(que.size()){
		P p = que.front(); que.pop();
		string s = p.first;
		int cur = p.second;
		for(int i = 0 ; i < 4 ; i ++){
			string str = s;
			int newcur = cur + dir[i];
			swap(str[cur],str[newcur]);
			if(ok(str,cur,newcur)){
				que.push(P(str,newcur));
				state[str] = state[s] + 1;
			}			
		}
	}
}

int main(){
	bfs();
	string s;
	while(getline(cin,s)){
		s.erase(remove(s.begin(), s.end(), ' '),s.end());
		printf("%d\n",state[s]);
	}
	return 0;
	
}

Measured memory_bytes: 3452
#include <iostream>
using namespace std;
int main(void){
    int n = 0;
    cin >> n;
    long A[1000];
    for(int i = 0; i < 1000; i++){
        A[i] = 0;
    }
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }
    int q = 0;
    cin >> q;
    for(int i = 0; i < q; i++){
        int b = 0, e = 0, t = 0;
        cin >> b >> e >> t;
        for(int j = 0; j < (e-b); j++){
            int temp = A[b+j];
            A[b+j] = A[t+j];
            A[t+j] = temp;
        }
    }
    for(int i = 0; i < n-1; i++){
        cout << A[i] << " ";
    }
    cout << A[n-1] << endl;
    return 0;
}



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


void solve(std::vector<long long> H, std::vector<long long> M, long long K){
    if (M[0] > M[1]) {
        H[1]--;
        M[1] += 60;
    }
    cout << (H[1] - H[0]) * 60 + M[1] - M[0] - K << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::vector<long long> H(2);
    std::vector<long long> M(2);
    for(int i = 0 ; i < 2 ; i++){
        scanf("%lld",&H[i]);
        scanf("%lld",&M[i]);
    }
    long long K;
    scanf("%lld",&K);
    solve(std::move(H), std::move(M), K);
    return 0;
}


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

typedef long long ll;
const int N = 1e5 + 5;
int t[N];
int n, c, k;

int main() {
    scanf("%d%d%d", &n, &c, &k);
    for (int i=1; i<=n; ++i) {
        scanf("%d", &t[i]);
    }
    sort(t+1, t+n+1);
    int i = 1, j = 1, ans = 1;
    while (j <= n) {
        if (t[j] > t[i]+k || j-i+1 > c) {
            ans++;
            i = j;
        }
        j++;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(int i=s;i<t;i++)
#define MAXNUM 222222
int dp[MAXNUM];
vector<int> e[MAXNUM];
int maxdep,maxpos;
void dfs(int now,int p,int d)
{
    if(d>maxdep)maxdep=d,maxpos=now;
    for(int k:e[now])if(k!=p)
        dfs(k,now,d+1);
}
int main()
{
    int n,a,b;scanf("%d",&n);
    rep(i,1,n)scanf("%d%d",&a,&b),e[a].push_back(b),e[b].push_back(a);
    dfs(1,1,0);
    maxdep=0,dfs(maxpos,0,0);maxdep++;
    dp[1]=0,dp[2]=1;
    for(int i=3;i<=maxdep;i++)
    {
        if(!dp[i-1]&&!dp[i-2])dp[i]=1;
        else dp[i]=0;
    }
    if(dp[maxdep])printf("Second");
    else printf("First");
}

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

using namespace std;


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

for(int i=0;i<N-2;i++){
  if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
      ans++;
  }
}

cout << ans;
return 0;
}

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

int main()
{
  int n;
  cin >>  n;
  
  int ans = n % 10;
  if(ans == 3){
    cout << "bon" << endl;
  }else if( (ans == 0) || (ans == 1) || (ans == 6) || (ans == 8) ){
    cout << "pon" << endl;
  }else{
    cout << "hon" << endl;
  }
  
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
  int n,a,b;
  cin >> n >> a >> b;

  if(n*a >= b) cout << b << endl;
  else cout << n*a << endl;
}

Measured memory_bytes: 3620
N = int(input())
H = [int(x) for x in input().split()]

prev = -1
is_possible = "Yes"
for i in range(N):
    if prev < H[i]:
        H[i] -= 1
    if prev > H[i]:
        is_possible = "No"
        break
    prev = H[i]

print(is_possible)


Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define pb push_back 
#define endl '\n'
#define INF 0x3f3f3f3f
#define MOD 1000000007

#define bug(x) cout << #x << " = " << x << '\n'
const int MAXN = 200050;

map<int, set<pair<int, int>>> mp;
pair<int, int> resp[MAXN];

int32_t main()
{
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < m; i++)
	{
		int p, y;
		scanf("%d %d", &p, &y);
		mp[p].insert({y, i});
	}
	
	for(auto elem: mp)
	{
		int cnt = 1;
		for(auto it: elem.se)
		{
			resp[it.se] = {elem.fi, cnt};
			cnt++;
		}
	}
	
	for(int i = 0; i < m; i++)
	{
		printf("%.06d%.06d\n", resp[i].fi, resp[i].se);
	}
	return 0;
}


Measured memory_bytes: 16384
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

int cost[4] = { 125, 140, 160 };

int main(){
  int w;
  while(scanf("%d",&w), w+1){
    int ans = 1150;
    w -= 10;
    for(int i=0; i < 2 && w > 0; i++){
      if(w >= 10){
	w -= 10;
	ans += cost[i] * 10;
      }else{
	ans += cost[i] * w;
	w = 0;
      }
    }
    if(w > 0)
      ans += 160 * w;

    print(4280 - ans);
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=long long int;

int main() {
    string s;
    cin >> s;

    int c1 = count(s.begin(), s.end(), '0');
    int c2 = count(s.begin(), s.end(), '1');
    int ans = min(c1, c2) * 2;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <iomanip>
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cmath>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 1001001000;
const int MOD = 1000000007;

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

using Graph = vector<vector<int>>;
//再帰とかグラフを使うときは予めNの最大値のグローバル配列を取っておく
int N;
vector<int> E[200001];
bool shipment[15][15];
vector<bool> seen;
typedef pair<int, int> P;
int D[101];
//頂点状態を表すcolor[]において、0は未訪問、1は訪問中、2は完了を表す。
int color[101];
int find_time = 0;
int H, W;
//vector<vector<int>> F(H+2, vector<int>(W+2));
int F[92][92];
vector<int> dx{ -1,0,1,0 };
vector<int> dy{ 0,-1,0,1 };
int ans = 0;

int calc_digits(long long A, long long B) {
    int digitsA = 1; int digitsB = 1;
    while (A > 0 || B > 0) {
        A /= 10; B /= 10;
        if (A > 0) digitsA++;
        if (B > 0) digitsB++;
    }

    return max(digitsA, digitsB);
}

int main() {
    long long N; cin >> N;
    double A = sqrt(N);
    //Aについてはintでも可
    long long waru = A;
    int ans = 114514;

    for (int div1 = 1; div1 <= waru; div1++) {
        long long div2 = 0;
        if (N % div1 == 0) div2 = N / div1;
        else continue;
        int count = calc_digits(div1, div2);
        ans = min(ans, count);
    }
    cout << ans << endl;
}


Measured memory_bytes: 4992
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
using namespace std;


int main(){
    long N;
    scanf("%ld",&N);
    long cnt=0;
    for(long i=0;;i++){
        N = N/2;
        cnt++;
        if(N==0)break;
    }
    long b=1;
    long res=0;
    for(long i=0;i<cnt;i++){
        res += b;
        b = 2*b;
    }
    cout<<res<<"\n";
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, m;
  cin >> n >> m;
  vector<vl> g(n);
  rep(i, m) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<vl> seen(n, vl(2, 0));
  stack<pair<int, int>> st;
  seen[0][0] = 1;
  st.push({0, 0});
  while(!st.empty()) {
    int i = st.top().first;
    int j = st.top().second;
    st.pop();
    for(auto v : g[i]) {
      if(seen[v][!j]) continue;
      seen[v][!j] = true;
      st.push({v, !j});
    }
  }
  ll odd = 0, even = 0;
  rep(i, n) {
    if(seen[i][0] && !seen[i][1]) even++;
    if(!seen[i][0] && seen[i][1]) odd++;
  }
  ll ans = n * (n - 1) / 2 - m - odd * (odd - 1) / 2 - even * (even - 1) / 2;
  cout << ans << endl;
}

Measured memory_bytes: 14676
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vector<int>>
#define fin(ar,k,n) for(int i=k;i<n;i++) cin>>ar[i]
#define fout(ar,k,n) for(int i=k;i<n;i++) cout<<ar[i]<<' '
#define all(z) z.begin(),z.end()
#define mcc ((int)1e9+7)
#define mcf 998244353
#define mi map<int,int>
#define mem(a,n) memset(a,n,sizeof(a))
#define pii pair<int,int>
#define mp(a,b) make_pair(a,b)

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> fst;

const int K=1e5+7;
int dp[K],ar[101],n,k;

void solve()
{
	cin>>n>>k;
    fin(ar,0,n);
	for(int i=0;i<=k;i++)
	{
		for (int j=0;j<n;j++)
		{
			if ( i>=ar[j] && !dp[i-ar[j]]) dp[i]=1;
		}
	}
	cout<<(string[]){"Second","First"}[dp[k]]<<endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
char n;
int a,b;
int main()
{
    cin>>a>>b;
    for(int s=0;s<a;s++)
    {
        cin>>n;
        if(n<'0'||n>'9')
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cin>>n;
    if(n!='-')
    {
        cout<<"No"<<endl;
        return 0;
    }
    for(int s=0;s<b;s++)
    {
        cin>>n;
        if(n<'0'||n>'9')
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;

namespace ABC116A
{
    using System;
    using System.Collections.Generic;
    using System.Linq;

    class MainClass
    {
        static int[] s;



        public static void Main(string[] args)
        {

            s = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);


            Console.WriteLine(s[0]*s[1]/2);
            return;
        }
    }
}


Measured memory_bytes: 13268
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n)cin >> a[i];
    vector<ll> b = a;
    sort(ALL(b), greater<ll>());
    //b.erase(unique(ALL(b)), b.end());
    
    rep(i, n){
        if(a[i] == b[0]) cout << b[1] << endl;
        else cout << b[0] << endl;
    }

}

Measured memory_bytes: 4736
/*BINH :))*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long llu;
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define f  first
#define s  second
#define mp make_pair
#define pb push_back
#define ep emplace_back
#define sz(a) (int) a.size()
#define FOR(x,a,b) for (int x=a;x<=b;x++)
#define FOD(x,a,b) for (int x=a;x>=b;x--)
#define REP(x,a,b) for (int x=a;x<b;x++)
#define RED(x,a,b) for (int x=a;x>b;x--)
#define EL cout<<endl
#define max 1005
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
void init(){
}
int main(){
    int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin>>k;
    cout<<a[k-1];
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
int main()
{
    int A,B;
    std::cin >> A >> B;
    if(A>8 || B > 8){
        std::cout << ":(" << std::endl;
    }else{
        std::cout << "Yay!" << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
N,K = map(int,input().split())
S = list(input())
if(S[K-1] == "A"):
    S[K-1] = "a"
elif(S[K-1] == "B"):
    S[K-1] = "b"
else:
    S[K-1] = "c"
print("".join(S))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int
const int MAX = 510000;


using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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


//UnionFind
template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

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

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, m;
    cin >> n >> m;
    UnionFind<ll> uf(n);
    rep(i, m){
        ll l, r, d;
        cin >> l >> r >> d;
        --l, --r;
        if(uf.issame(l, r)){
            if(d != uf.diff(l, r)) {
                cout << "No" << endl;
                return 0;
            }
        }
        else uf.merge(l, r, d);
    }
    cout << "Yes" << endl;

}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            long X = long.Parse(s[0]);
            long Y = long.Parse(s[1]);

            int ans = 0;
            while(X <= Y)
            {
                ans++;
                X *= 2;
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define ll long long
using  namespace std;
int a[100010];

int main () {
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b&&a!=c){
        cout<<"Yes";
    }else if(c==b&&a!=c){
        cout<<"Yes";
    }else if(a==c&&a!=b){
        cout<<"Yes";
    } else
        cout<<"No";

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#include <iomanip>
#define ll long long
#define intm INT_MAX
#define llm LLONG_MAX

using namespace std;
typedef pair<int,int> P;
const int MOD = 998244353;
const ll mod = 1e9 + 7;
const int mxN = 2e5 + 9;

ll a[mxN];
ll b[mxN];

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
    int n,m,k,tmp;
    cin >> n >> m >> k;
    for(int i=1; i <= n; i++){
        cin >> tmp;
        a[i] = a[i-1] + tmp;
    }
    for(int i=1; i <= m; i++){ cin >> tmp; b[i] = b[i-1] + tmp; }
    int g_ans = 0;
    for(int i=0; i <= n; i++){
        int now_ans = 0;
        int ans = 0;
        if( a[i] > k ) break;
        else if( a[i] == k ){
            g_ans = max( g_ans, i );
            break;
        }
        else{
            // a[i] < k;
            int tmp_k = k - a[i];
            now_ans = i;
            int L = 1; int R = m;
            while( L <= R ){
                int mid = L + (R-L)/2;
                if( b[mid] > tmp_k ){
                    R = mid-1;
                }
                else{
                    ans = max( ans, mid );
                    L = mid+1;
                }
            }
            now_ans += ans;
            g_ans = max( g_ans, now_ans );

        }
    }
    cout << g_ans;
}


Measured memory_bytes: 6780
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
// template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



int main() {
    int n, x;
    cin >> n >> x;
    
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    
    ll ans = 0;
    if (a[0] > x) {
        ans += a[0] - x;
        a[0] = x;
    }
    
    rep(i, n - 1) {
        if (a[i] + a[i + 1] > x) {
            ans += a[i] + a[i + 1] - x;
            a[i + 1] -= a[i] + a[i + 1] - x;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 640
H, W = map(int, input().split())
if H % 3 == 0 or W % 3 == 0: print(0)
else:
    total = H*W
    ans = 10**10
    for i in range(1, H):
        S1 = W*i
        S2a = W*((H-i)//2); S3a = total - (S1 + S2a);
        S2b = (W//2)*(H-i); S3b = total - (S1 + S2b);
        ans = min(ans, min(max(S1, S2a, S3a) - min(S1, S2a, S3a), max(S1, S2b, S3b) - min(S1, S2b, S3b)))
    for i in range(1, W):
        S1 = H*i
        S2a = H*((W-i)//2); S3a = total - (S1 + S2a);
        S2b = (H//2)*(W-i); S3b = total - (S1 + S2b);
        ans = min(ans, min(max(S1, S2a, S3a) - min(S1, S2a, S3a), max(S1, S2b, S3b) - min(S1, S2b, S3b)))
    print(ans)

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CSqrtInequality solver = new CSqrtInequality();
        solver.solve(1, in, out);
        out.close();
    }

    static class CSqrtInequality {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long a = in.nextInt();
            long b = in.nextInt();
            long c = in.nextInt();

            out.println(c - a - b > 0 && 4 * a * b < (c - a - b) * (c - a - b) ? "Yes" : "No");
        }

    }
}



Measured memory_bytes: 25044
a = list(map(int,input().split()))
a.sort()
ans = a[2]-a[1]
if (a[2]-(a[0]+ans))%2==0:
    ans += (a[2]-(a[0]+ans))//2
else:
    ans += (a[2]-(a[0]+ans))//2+2
print(ans)


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

void solve(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,0,n) cin >> a[i];
    int ans=0,i=0;
    for(;i<n;){
        ++ans;
        int j=i+1,k=i+1;
        for(;j<n; ++j) if(a[j]>a[j-1]) break;
         for(;k<n; ++k) if(a[k]<a[k-1]) break;
         i=max(j,k);
    }
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


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

void solve() 
{
    int n,d;cin>>n>>d;int cnt=0;
    REP(i,n){
        double x,y;cin>>x>>y;
        if(sqrt(x*x+y*y)<=d)cnt++;
    }
    cout<<cnt<<endl;
}

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

Measured memory_bytes: 3856
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define INF (1<<29)
using namespace std;
typedef long long ll;
int d[40][40];
int main(){
      int a,b,n,x,y;
      while(cin>>a>>b&&a&&b){
            cin>>n;
            bool ok[40][40];
            memset(d,0,sizeof(d));
            memset(ok,true,sizeof(ok));
            REP(i,n){cin>>x>>y;ok[--x][--y]=false;}
            d[0][0]=1;
            REP(i,a-1)if(ok[i+1][0])d[i+1][0]=d[i][0];
            REP(i,b-1)if(ok[0][i+1])d[0][i+1]=d[0][i];
            for(int i=1;i<b;i++){
                  for(int j=1;j<a;j++){
                        if(ok[j][i])d[j][i]=d[j-1][i]+d[j][i-1];
                  }
            }
            //REP(i,b)REP(j,a)printf("%d%c",d[j][i],j==a-1?'\n':' ');
            cout<<d[a-1][b-1]<<endl;
      }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int arr[5];
  int ans=0;
  for(int i=0;i<5;i++)
  {
    cin>>arr[i];
    if(arr[i]==0)
      ans=i+1;
  }
    cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3568
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <numeric>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define PB push_back
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807
#define sortR(a,b) sort(a, b, greater<int>())

using namespace std;

long long GCD(long long a, long long b) {
	if (a < b)
		swap(a, b);
	if (b == 0) return a;
	else return GCD(b, a % b);
}
bool sosuu_check(int num) {
	int i;
	for (i = 2; i <= sqrt(num); ++i) {
		if (num%i == 0)
			return false;
	}
	return (num < 2) ? false : true;
}
int main() {
	int N, t,x,y, i,bt=0,bx=0,by=0, dis;
	cin >> N;
	REP(i, N) {
		cin >> t >> x >> y;
		dis = abs(bx - x) + abs(by - y);
		if (dis > (t - bt) || dis % 2 != (t - bt) % 2) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

}

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

int main() {
	string S,T;
	cin >> S >> T;
	int k = S.size();
	int flag= 1;
	for(int i=0;i<k;i++){
		if(k + 1 != T.size()){
			flag = 0;
			break;
		}
		else if(S.at(i)==T.at(i)){
			continue;
		}
		else{
			flag = 0;
			break;
		}
	}
	if(flag==0){
		cout << "No" << endl;
	}
	else{
		cout << "Yes" << endl;
	}

}

Measured memory_bytes: 3628
import java.io.*;
import java.util.*;

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int a = in.nextInt();
        int b = in.nextInt();
        String first = nCopies(String.valueOf(a), b);
        String second = nCopies(String.valueOf(b), a);
        out.println(
                first.compareTo(second) < 0 ? first : second
        );
    }

    private static String nCopies(String s, int n) {
        return String.join("", Collections.nCopies(n, s));
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 21204
N = int(input())
D = sorted(list(map(int,input().split())))
for i in range(0,N,2):
    D[i] = 24-D[i]
D.insert(0,0)
dmin = 24
for i in range(N):
    for j in range(i+1,N+1):
        a = D[i]
        b = D[j]
        if a>b:
            a,b = b,a
        d = b-a
        if d>12:
            d = 24-d
        dmin = min(dmin,d)
print(dmin)

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

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;


int main(){
  vector<int> v(5, 0);
  int ans = 0;
  int min_int = 11;
  int min_index = 0;
  rep(i, 5){ 
    cin >> v[i];
    if(v[i] % 10 != 0){
      min_int = min(min_int, v[i] % 10);
      min_index = i;
      v[i] += 10 - (v[i] % 10);
    }
  }
  
  rep(i, 5){
    // cout << v[i] << endl;
    ans += v[i];
  }
  if(min_int != 11){
    ans -= 10 - (min_int % 10);
  }
  // cout << min_index << endl;
  cout << ans << endl;
  
  return 0;
}


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

#define endl "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first 
#define ss second 
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vii vector<pii>
#define vvi vector<vi>
#define for(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}


int32_t  main(){
	//IOS;
  double t,x;cin>>t>>x;
  double ans=t/x*1.0;
  printf("%.6lf\n",ans);
  return 0;
}



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

const int N=14;

int n,m,k,c[N],sz,x,ans=INT_MAX;
vector <vector <int>> v;

int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&c[i]);
		v.push_back({});
		for(int i=0;i<m;i++)
		{
			scanf("%d",&x);
			v.back().push_back(x);
		}
	}

	for(int mask=0;mask<(1<<n);mask++)
	{
		int cost=0;
		vector <int> dp(m,0);
		for(int i=0;i<n;i++)
		{
			if(mask&(1<<i)) continue;
			cost+=c[i];
			for(int j=0;j<v[i].size();j++) dp[j]+=v[i][j];
		}
		if(*min_element(dp.begin(),dp.end())>=k) ans=min(ans,cost);
	}
	if(ans==INT_MAX) ans=-1;
	printf("%d",ans);
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<ll> vec){
    ll n = vec.size();
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
}

void pr2d(vector<vector<ll>> vvec){
    ll h = vvec.size();
    ll w = vvec.at(0).size();
    rep(i,h){
        rep(j,w){
            cout << vvec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
}

int main(){
    ll a,b,c,d; cin >>a>>b>>c>>d;
    while(true){
        c-=b;
        if(c<=0){
            cout << "Yes" << endl;
            return 0;
        }
        a-=d;
        if(a<=0){
            cout << "No" << endl;
            return 0;
        }
    }
}

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> k(n);
  vector<vector<int>> a(n, vector<int>(0));
  for(int i = 0; i < n; ++i){
    cin >> k.at(i);
    for(int j = 0; j < k.at(i); ++j){
      int l;
      cin >> l;
      a.at(i).push_back(l);
    }
  }
  
  vector<int> ans(m);
  for(int i = 0; i < n; ++i){
    for(auto t : a.at(i)){
      ans.at(t-1)++;
    }
  }
  
  int cnt = 0;
  for(int i = 0; i < m; ++i){
    if(ans.at(i) == n) cnt++;
  }
  
  cout << cnt << endl;
}

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

#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
#define mp(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ll IINF = INT_MAX;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    int ar[n];
    for (int i = 0; i < n; i++) {
        cin >> ar[i];
    }
    int l = 1, r = *max_element(ar, ar + n), m, ans = -1;
    while (l <= r) {
        m = (l + r) / 2;
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            cnt += (ar[i] + m - 1) / m - 1;
        }
        if (cnt <= k) {
            ans = m;
            r = m - 1;
        } else {
            l = m + 1;
        }
    }
    if (ans == -1) ans = 0;
    cout << ans << '\n';
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i = 0;i < N; i++) cin >> vec.at(i);
  sort(vec.begin(),vec.end());
  int max = 0;
  int D = 0;
  for(int i = 0; i < N; i++){
    if(vec.at(i) > max){
      max = vec.at(i);
      D++;
    }
  }
  cout << D << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
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; }
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}
ll comb(ll n, ll r){
  if (r*2>n) r=n-r;
  ll x=1, y=1;
  reps(i,1,r+1){ x *= (n-i+1); y *= i; }
  return x / y;
}


int main(){
  int n; cin >> n;
  vector<int> a(n); rep(i,n) cin >> a[i];
  sort(all(a), greater<int>());
  ll x=0, y=0;
  rep(i,n){
    if(x==0 && a[i]==a[i+1]){ x=a[i]; i++; }
    else if(y==0 && a[i]==a[i+1]){ y=a[i]; i++; }
    if(x!=0 && y!=0) break;
  }
  
  cout << x*y;
  
return 0;
}


Measured memory_bytes: 640
def main():
    """
    2 <= N <= 100
    1 <= ai <= N

    色の種類は10^4存在するが、N<=100より色は気にしなくて良い
    もし2色なら奥の色を考慮する必要がある

    abab: 0
    aaab: 1 (abab)
    aabb: 2 (acbc)
    aaaa: 2 (acac)
        2つ目のaを変更したあと、2と3つ目の関係を気にする必要がないので4つ目を考える
        4つ目を考慮することで3/5との関係を考慮できる
    """
    N = int(input())
    *A, = map(int, input().split())

    # A.append(-1)
    ans = 0
    i = 1
    while i < N:
        if A[i-1] == A[i]:
            ans += 1
            i += 2
        else:
            i += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
 
namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }
 
        public static void Solve()
        {
            var AB = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var A = AB[0];
            var B = AB[1];
            var S = Console.ReadLine();
            var answer = true;
            for (var i = 0; i < S.Length; i++)
            {
                if (i == A)
                {
                    if (S[i] != '-') answer = false;
                }
                else
                {
                    if (S[i] == '-') answer = false;
                }
            }
            Console.WriteLine(answer ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 28248
use std::io::stdin;
use std::vec::Vec;

mod utils {
    use std::io::BufRead;
    use std::str::{self, FromStr};

    pub struct StdinReader<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> StdinReader<R> {
        pub fn new(reader: R) -> StdinReader<R> {
            StdinReader {
                reader: reader,
                buf: Vec::new(),
            }
        }

        #[allow(unused)]
        #[inline]
        pub fn reads<T: FromStr>(&mut self) -> T {
            self.read_until(b' ')
        }

        #[allow(unused)]
        #[inline]
        pub fn readl<T: FromStr>(&mut self) -> T {
            self.read_until(b'\n')
        }

        #[allow(unused)]
        #[inline]
        pub fn read_vec<T: FromStr>(&mut self) -> Vec<T> {
            return self.read_until::<String>(b'\n').trim().split_whitespace().map(|c| c.parse().ok().unwrap()).collect();
        }

        #[inline]
        pub fn read_until<T: FromStr>(&mut self, delim: u8) -> T {
            loop {
                self.buf.clear();
                let len = self.reader
                    .read_until(delim, &mut self.buf)
                    .expect("failed reading bytes");
                match len {
                    0 => panic!("early eof"),
                    1 if self.buf[0] == delim => (),
                    _ => {
                        if self.buf[len - 1] == delim {
                            self.buf.truncate(len - 1);
                        }
                        break;
                    }
                }
            }

            let elem = unsafe { str::from_utf8_unchecked(&self.buf) };
            elem.parse().unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
         }
    }
}


fn main(){
    let stdin = stdin();
    let mut r = utils::StdinReader::new(stdin.lock());
    let n:usize = r.readl();
    let mut a_s:Vec<i16> = r.read_vec();

    a_s.sort();
    a_s.reverse();

    let mut score_alice = 0;
    let mut score_bob = 0;

    for i in 0..n {
        if(i % 2 == 1){
            score_bob += a_s[i];
        }else{
            score_alice += a_s[i];
        }
    }

    println!("{}", score_alice - score_bob);
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++)
        cin >> arr[i];
    long long dp[n][n];
    for (int i = 0; i < n; i++)
        dp[i][i] = arr[i];
    for (int i = 2; i <= n; i++)
        for (int j = 0; j <= n - i; j++)
            dp[j][j + i - 1] = max(arr[j] - dp[j + 1][j + i - 1], arr[j + i - 1] - dp[j][j + i - 2]);
    cout << dp[0][n - 1] << "\n";
    return 0;
}

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

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

    vector<long long> divisor(0);
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            divisor.push_back(i);
            if (i != n / i) divisor.push_back(n / i);
        }
    }

    long long sum = 0;
    for (long long i = 0; i < (int)divisor.size(); i++)
    {
        if (n / divisor.at(i) - 1 > 0 && (n / (n / divisor.at(i) - 1)) == n % (n / divisor.at(i) - 1)) sum += n / divisor.at(i) - 1;
    }
    cout << sum << endl;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int N;

int main()
{
	in >> N;
	for (int i = 0; i <= N / 4; ++i)
	{
		auto n = N - i * 4;
		if (n % 7 == 0)
		{
			out << "Yes" << std::endl;
			return 0;
		}
	}
	out << "No" << std::endl;
	return 0;
}


Measured memory_bytes: 256