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

typedef struct
{
  string rule, src, dest;
} Filter;

int main()
{
  int n, m;
  while (cin >> n >> m) {
    if ((n|m) == 0)
      break;

    vector<Filter> filter(n);
    for (int i = 0; i < n; ++i)
      cin >> filter[i].rule >> filter[i].src >> filter[i].dest;
    reverse(filter.begin(), filter.end());

    vector<Filter> ans;
    for (int i = 0; i < m; ++i) {
      string src, dest, msg;
      cin >> src >> dest >> msg;

      for (int j = 0; j < n; ++j) {
	if (filter[j].rule == "permit") {
	  bool permit = true;
	  for (unsigned int k = 0; k < 8 && permit; ++k) {
	    if (filter[j].src[k] != '?' && filter[j].src[k] != src[k])
	      permit = false;
	    if (filter[j].dest[k] != '?' && filter[j].dest[k] != dest[k])
	      permit = false;
	  }
	  if (permit) {
	    ans.push_back((Filter){msg, src, dest});
	    break;
	  }
	} else {
	  bool deny = true;
	  for (unsigned int k = 0; k < 8 && deny; ++k) {
	    if (filter[j].src[k] != '?' && filter[j].src[k] != src[k])
	      deny = false;
	    if (filter[j].dest[k] != '?' && filter[j].dest[k] != dest[k])
	      deny = false;
	  }
	  if (deny)
	    break;
	}
      }
    }

    cout << ans.size() << endl;
    for (unsigned int i = 0; i < ans.size(); ++i)
      cout << ans[i].src << " " << ans[i].dest << " " << ans[i].rule << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n ;
	cin >> n;
	ll x = 2, y = 1;
	for(int i = 2 ; i <= n ; i++)
	{
		ll tmp = x+y;
		x = y;
		y = tmp;
	}
	cout << y << endl;
}


Measured memory_bytes: 256
c = ''
while True:
    a,b = map(int, input().split())
    if(a == 0 and b == 0):
        break
   
    for i in range(0,a):
        if(i == 0):
            for j in range(0,b):
                print("#", end="")
        elif(i < a-1):
            print("#", end="")
            for j in range(1,b-1):
                print(".", end="")
            print("#", end="")
        else:
            for j in range(0,b):
                print("#", end="")
        print()
    print()



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

int main()
{
  string s, t;
  cin >> s >> t;
  
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  
  if (s < t) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 764
h, w, m = map(int, input().split())

target = set()
rows = [0] * h
cols = [0] * w
for i in range(m):
    y, x = map(lambda x: int(x) - 1, input().split())
    rows[y] += 1
    cols[x] += 1
    target.add((y, x))

rows_sorted = [(a, i) for i, a in enumerate(rows)]
rows_sorted.sort(reverse=True)
cols_sorted = [(a, i) for i, a in enumerate(cols)]
cols_sorted.sort(reverse=True)

max_r = rows_sorted[0][0]
max_c = cols_sorted[0][0]

i = 0
max_val = max(max_r, max_c)
while i < h and rows_sorted[i][0] == max_r:
    j = 0
    while j < w and cols_sorted[j][0] == max_c:
        val = rows_sorted[i][0] + cols_sorted[j][0]
        if (rows_sorted[i][1], cols_sorted[j][1]) in target:
            val -= 1
        else:
            max_val = val
            break
        max_val = max(max_val, val)
        j += 1
    i += 1
print(max_val)


Measured memory_bytes: 123996
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <map>
#include <cstdlib>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

int main()
{
    int n;
    cin >> n;
    if(n%10==7){
        cout << "Yes" << endl;
        return 0;
    }
    n /= 10;
    if(n%10==7){
        cout << "Yes" << endl;
        return 0;
    }
    n /= 10;
    if(n%10==7){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long t;
    cin>>t;
    vector<long long> v(t);
    long long x = 0;
    for (long i = 0; i < t; i++)
    {
        cin>>v[i];
        x = x^v[i];
    }
    for (int i = 0; i < t; i++)
    {
        cout<<(x^v[i])<<" ";
    }
    
}

Measured memory_bytes: 4776
#include<bits/stdc++.h>
#define inf ((int)(1e9))
using namespace std;
int n,m,s,t;
int main()
{
	cin>>n>>m;
	vector<vector<int> > graph(n);
	for(int i=0;i<m;i++)
	{
		int u,v;
		cin>>u>>v;
		--u,--v;
		graph[u].push_back(v);
	}
	cin>>s>>t;
	--s,--t;
	vector<int> d(n*3,inf);
	d[s]=0;
	queue<int> q;
	q.push(s);
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		int now=x%n;
		for(int i=0;i<graph[now].size();i++)
		{
			int dd=d[x]+1;
			int y=graph[now][i]+n*(dd%3);
			if(d[y]!=inf)
				continue;
			d[y]=dd;
			q.push(y);
		}
	}
	cout<<(d[t]==inf?-1:(d[t]/3))<<endl;
	return 0;
}

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

  int a,b;

  while(1){

    scanf("%d %d",&a,&b);
    if(a == 0 && b == 0) break;

    if(a*b%2 == 0) printf("yes\n");
    else printf("no\n");

  }

  return 0;

}

Measured memory_bytes: 584
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================


vbool made(1e8);

bool k;

int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================


	string S, key;

	cin >> S >> key;



	vstring answers;
	for (int i = 0; i < S.length() - key.length() + 1; i++)
	{
		string T = S;
		for (int j = 0; j < key.length(); j++)
		{
			if (S[i + j] == key[j] || S[i + j] == '?')
			{

				if (j == key.length() - 1)
				{
					for (int k = 0; k < key.length(); k++)
					{
						T[i + k] = key[k];
					}
					for (int k = 0; k < S.length(); k++)
					{
						if (T[k] == '?')
						{
							T[k] = 'a';
						}
					}

					answers.emplace_back(T);


				}
			}
			else
			{
				break;
			}
		}
	}

	
	if (answers.size() == 0)
	{
		cout << "UNRESTORABLE" << endl;
		return 0;
	}
	else
	{
		sort(answers.begin(), answers.end());
		cout << answers[0] << endl;
	}




}



Measured memory_bytes: 12416
#include <iostream>
#include <string>

using namespace std;

char MCXI[] = "mcxi";

int mcxi2int(const char* str)
{
	int ret = 0;
	int idx = 0;
	for(int i = 0; i < 4; i++){
		if(str[idx] == MCXI[i])
			 ret++,idx++;
		else if(str[idx] >= '2' && str[idx] <= '9' && str[idx+1] == MCXI[i])
			ret += str[idx] - '0',idx += 2;
		ret *= 10;
	}

	return ret/10;
}

void int2mcxi(int num)
{
	int j = 1000;
	for(int i = 0; i < 4; i++,j /= 10){
		int x = (num / j) % 10;
		if(x == 0) continue;
		if(x != 1) cout << (char)('0' + x);
		cout << MCXI[i];
	}
	cout << endl;
}

void solve()
{
	string s1,s2;
	cin >> s1 >> s2;
	int2mcxi(mcxi2int(s1.c_str()) + mcxi2int(s2.c_str()));
}

int main()
{
	int m;
	cin >> m;
	for(int i=0;i<m;i++)
		solve();
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    
   int h,w;
   cin>>h>>w;
   
   char mat[h+1][w+1];
   int i,j;
   for(i=0;i<h;++i)
     {
         for(j=0;j<w;++j)
            {
                cin>>mat[i][j];
            }
     }
     
    for(i=0;i<h+2;++i)
      {
          for(j=0;j<w+2;++j)
           {
               if(i==0||i==h+1 ||j==0 ||j==w+1)
                  cout<<"#";
                  
               else
                cout<<mat[i-1][j-1];
           }
           
           cout<<endl;
      }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int N, X;
  int m[110];
  cin >> N >> X;
  for(int i = 0; i < N ;i++){
    cin >> m[i];
  }
  int sum;
  for(int i =0 ; i < N; i++){
    sum += m[i];
  }
  int left = X - sum;
  int min = m[0];
  for(int i = 0; i < N; i++){
    if(min > m[i]) min = m[i];
  }
  int count = left / min;

  cout << N + count << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int func(int );

int func(int x){
  	if(x%2==0){
      	return x/2;
    }else{
      	return 3*x+1;
    }
}

int
main()
{	
  	int s;
  	scanf("%d",&s);
  	int line[1000000];
  	int i,j;
  	int cnt=1000000;
  	line[0]=s;
      
    for(i=1;;i++){
      	line[i]=func(line[i-1]);
      	for(j=0;j<i;j++){
          	if(line[j]==line[i]){
              	printf("%d",i+1);
              	return 0;
            }
            
        }
      	
    }
      
   
      

    }
              	
      
      
      
      
      
  	

Measured memory_bytes: 128
import sys, math
from collections import defaultdict
def input(): return sys.stdin.readline().strip()


def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit < p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


def main():
    N = int(input())
    if N < 10:
        print(0)
        return
    table = get_sieve_of_eratosthenes(N)
    #print(table)
    primes = defaultdict(int)
    for n in range(2, N + 1):
        for p in table:
            cnt = 0
            while n % p == 0:
                n //= p
                cnt += 1
            primes[p] += cnt
    #print(primes)
    
    over_3 = 0
    over_5 = 0
    over_15 = 0
    over_25 = 0
    over_75 = 0
    for p in primes:
        if primes[p] >= 2: over_3 += 1
        if primes[p] >= 4: over_5 += 1
        if primes[p] >= 14: over_15 += 1
        if primes[p] >= 24: over_25 += 1
        if primes[p] >= 74: over_75 += 1
    #print(over_3)
    #print(over_5)
    #print(over_15)
    #print(over_25)
    #print(over_75)
    
    val1 = over_5 * (over_5 - 1) * (over_3 - 2) // 2
    val2 = over_15 * (over_5 - 1)
    val3 = over_25 * (over_3 - 1)
    print(val1 + val2 + val3 + over_75)

    




if __name__ == "__main__":
    main()


Measured memory_bytes: 38512
n = input()
max_ = 0
m = 0
for i in range(len(n)):
    if n[i] == "A" or n[i] == "C" or n[i] == "T" or n[i] == "G":
        m += 1
        if i == len(n) - 1:
            max_ = max(m,max_)
    else:
        max_ = max(m,max_)
        m = 0
print(max_)

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
vector<long long> divisor(long long num) {
  vector<long long> res;
  for (long long i = 1; i * i <= num; ++i) {
    if (num % i == 0) {
      res.emplace_back(i);
      if (i * i != num) res.emplace_back(num / i);
    }
  }
  sort(ALL(res));
  return res;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  long long n; cin >> n;
  // FOR(i, 1, n) {
  //   cout << i << ' ' << n / i << ' ' << n % i << '\n';
  // }
  vector<long long> divi = divisor(n);
  long long ans = 0;
  FOR(i, 1, divi.size()) {
    if (n / (divi[i] - 1) == n % (divi[i] - 1)) ans += divi[i] - 1;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
   ll n;
   cin>>n;
   cout<<n%2+n/2<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int x;
    cin>>x;
    if (x>=400&&x<=599) {
        cout<<8<<endl;
    } else if (x>=600&&x<=799) {
        cout<<7<<endl;
    } else if (x>=800&&x<=999) {
        cout<<6<<endl;
    } else if (x>=1000&&x<=1199) {
        cout<<5<<endl;
    } else if (x>=1200&&x<=1399) {
        cout<<4<<endl;
    } else if (x>=1400&&x<=1599) {
        cout<<3<<endl;
    } else if (x>=1600&&x<=1799) {
        cout<<2<<endl;
    } else if (x>=1800&&x<=1999) {
        cout<<1<<endl;
    }
}

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

int main(){
  int d;
  cin >> d;
  switch(d){
    case 25:
      cout << "Christmas" << endl;
	  break;
    case 24:
      cout << "Christmas Eve" << endl;
      break;
    case 23:
      cout << "Christmas Eve Eve" << endl;
      break;
    case 22:
      cout << "Christmas Eve Eve Eve" << endl;
      break;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<size_t I,class H,class...T>struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
template<class H,class...T>struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
template<class...T>istream&operator>>(istream&i,tuple<T...>&t){t=TupleReaderWriter<sizeof...(T),T...>::r(i);return i;}
template<class...T>ostream&operator<<(ostream&o,tuple<T...>&t){string delim=" ";TupleReaderWriter<sizeof...(T)-1,T...>::w(o,t,delim);return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(auto&x:v)i>>x;return i;}
template<class T>ostream&operator<<(ostream&o,vector<T>&v){string delim="";for(auto&x:v)o<<delim<<x,delim=" ";return o;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int x;fixprec(int d):x(d){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.x);}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }

i64 divceil(i64 a, i64 b) {
    return a / b + (a > 0 && a % b ? 1 : 0);
}

int main() {
    int K;
    cin >> K;
    vector<i64> A(K);
    for(i64 &x : A) cin >> x;
    reverse(WHOLE(A));
    i64 a = 2, b = 2;
    for(i64 x : A) {
        a = divceil(a, x) * x;
        b = (b / x + 1) * x - 1;
        if(a > b) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << a << " " << b << endl;
    return 0;
}



Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        
        if(str.equals("Sunny")){
            System.out.println("Cloudy");
        }
        else if(str.equals("Cloudy")){
            System.out.println("Rainy");
        }
        else{
            System.out.println("Sunny");
        }
    }
}


Measured memory_bytes: 19796
#!/usr/bin/env python3
import sys


def solve(N: int, S: str):

    res = 0
    for i in range(len(S)):
        aset = set(list(S[0:i]))
        bset = set(list(S[i:]))
        res = max(len(aset&bset),res)

    print(res)

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()


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

using namespace std;

#define OnlineJudge1

#define loop(x,a,n) for(int x = a;x < n;x++)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x)  (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define readline(s) getline(cin,s)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define EPS 1e-7
#define modulo ll (1e9 + 7)
const long double PI = 3.141592653589793238L;

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

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

#define time__(d) \
    for ( \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second; \
        debug("%s: %lld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false \
    )

void init(){
    cin.tie(0);
    ios::sync_with_stdio(0);
#ifdef OnlineJudge
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
}

const int N = 600, K = 600, OO = 0x3f3f3f3f;

ll power(ll b, ll p){
    if(p == 0)return 1;
    ll res = power(b,p/2);
    res *= res;
    //res %= modulo;
    if(p & 1)res *= b;
    return res;// % modulo;
}

int main(){
    init();

    int n;  cin >> n;
    int arr[n], sum = 0;
    for(int i = 0;i < n;i++)
        cin >> arr[i];

    for(int i = 0;i < n;i++){
        int x;  cin >> x;
        sum += x;
    }

    for(int i = 2;i <= n;i++){
        int x;  cin >> x;
        int f = 0;
        for(int j = 0;j < n;j++){
            if(arr[j] == i && j - 1 >= 0 && arr[j - 1] == i - 1){
                sum += x;
                break;
            }
        }
    }

    cout << sum;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

template<class T>bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#pragma endregion

void solve() {
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i=0; i<n; i++) {
        cin >> p.at(i);
    }
    vector<int> q(n);
    for (int i=0; i<n; i++) {
        cin >> q.at(i);
    }
    vector<int> a;
    for (int i=1; i<=n; i++) {
        a.push_back(i);
    }
    int pp, qq;
    int i=0;
    do {
        if (a == p) pp = i;
        if (a == q) qq = i;
        i++;
    } while (next_permutation(a.begin(), a.end()));
    cout << abs(pp-qq) << "\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main  implements Runnable {
	int [] ans_ar; 
	public static void main(String[] args) {
		new Thread(null, new Main(), "", 32 * 1024 * 1024).start(); //
	}
	public void run() {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());

		int m = (int)Math.pow(2,n);
		int[] a = new int[m];
		int va = 0;
		for (int i = 0; i < m; i++) {
			a[i] = Integer.parseInt(sc.next());
		}
		Arrays.parallelSort(a);
		int p = -1;
		int cr = 0;
		int[] b = new int[m];
		for (int i = m-1; i >= 0; i--) {
			if(cr != a[i])
			{
				cr = a[i];
				p++;
				b[p] = 1;
			}
			else {
				b[p]++;
			}
		}
		String ans = "Yes";
		int maxp = p;
		int[] prep = new int[n];
		int totalp = n;
		prep[0] = 1;
		for (int i = 1; i < n; i++) {
			prep[i] = 1;
			totalp++;
		}
		if(b[0] > 1)
		{
			ans = "No";
		}
		for (int i = 1; i <= maxp; i++) {
			if(b[i] > totalp)
			{
				ans = "No";
			}
			else {
				int cp = 0;
				int[] prep_next = new int[n];
				while(b[i] > 0)
				{
					if(cp >= prep.length)
					{
						ans = "No";
						break;
					} 
					else if(prep[cp] > 0)
					{
						if(prep[cp]< b[i])
						{
							for (int j = cp+1; j < n; j++) {
								prep_next[j] += prep[cp];
							}
							b[i] -= prep[cp];
							prep[cp] = 0;
						}
						else {
							for (int j = cp+1; j < n; j++) {
								prep_next[j] += b[i];
							}
							prep[cp] -= b[i];
							b[i] = 0;
						}
					}
					cp++;
				}
				totalp = 0;
				for (int j = 0; j < n; j++) {
					prep[j] += prep_next[j];
					totalp += prep[j];
				}
			}
		}
		out.println(ans);
		out.flush();
	}




    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;
        public FastScanner(String in) {
        	StringReader sr = new StringReader(in);
            reader = new BufferedReader(new BufferedReader(sr));
            tokenizer = null;
        }
        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }
        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
    }
}

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

#define select(_1, _2, x, ...) x

#define repn(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (int i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define rrep(i, ...) select(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define umax(m, x) (m = max(m, x));
#define umin(m, x) (m = min(m, x));

#define rng(v) v.begin(), v.end()
#define rrng(v) v.rbegin(), v.rend()

#define debug(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;

const int INF = 1e9;
const ll LINF = 1e18;


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

    ll sum = 0;

    ll a, b;

    a = x / 500;
    x -= a * 500;
    sum += a * 1000;

    b = x / 5;
    x -= b * 5;
    sum += b * 5;

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

ll h,w,sy,sx,gy,gx;
ll N=1e3+10;
vector<string> maze(N);
mat d(N,vec(N,-1));

vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

vector<pll> check_list;
vector<pll> check_list2;

void dfs(ll y, ll x, ll cnt) {
  if(y<0||x<0||y>=h||x>=w) return;
  if(maze[y][x]=='#') return;
  if(d[y][x]>=0) return;
  d[y][x]=cnt;
  check_list.push_back({y,x});
  for(ll i=0;i<4;i++) {
    ll ny=y+dy[i];
    ll nx=x+dx[i];
    dfs(ny,nx,cnt);
  }
}

void dfs2(ll y, ll x, ll cnt) {
  for(ll i=-2;i<=2;i++) {
    for(ll j=-2;j<=2;j++) {
      ll ny=y+i;
      ll nx=x+j;
      dfs(ny,nx,cnt);
    }
  }
}

int main() {
  cin >> h >> w >> sy >> sx >> gy >> gx;
  sy--,sx--,gy--,gx--;
  for(ll i=0;i<h;i++) {
    cin >> maze[i];
  }
  ll cnt=0;
  dfs(sy,sx,cnt);
  while(check_list.size()) {
    cnt++;
    check_list2.clear();
    for(auto p:check_list) {
      check_list2.push_back(p);
    }
    check_list.clear();
    for(auto p:check_list2) {
      ll y=p.first;
      ll x=p.second;
      dfs2(y,x,cnt);
    }
  }
  cout << d[gy][gx] << endl;
}

Measured memory_bytes: 13620
use std::io::{stdout, Write, BufWriter};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn trivial_division(n: u64) -> Vec<u64> {
    let mut result = n;
    for i in 2..((n as f64).sqrt() as u64)+1 {
        if n % i == 0 {
            result = i;
            break;
        }
    }

    if result == n {
        return vec![n];
    } else {
        let mut v1 = vec![result];
        let mut v2 = trivial_division(n / result);

        v1.append(&mut v2);

        return v1;
    }
}

use std::collections::HashSet;
fn main() {
    input!{
        n: usize,
        p: usize,
    }

    let sosus = trivial_division(p as u64);
    let unique: HashSet<u64> = sosus.clone().into_iter().collect();

    let mut ans: u64 = 1;
    for sosu in unique {
        let kosu: u64 = (sosus.iter().filter(|&&e| e == sosu).count() / n) as u64;
        if kosu > 0 {
            ans = ans * sosu.pow(kosu as u32);
        }
    }

    let out = stdout();
    let mut out = BufWriter::new(out.lock());

    writeln!(out, "{}", ans).unwrap();
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
const long long MOD=1e09+7;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define vi vector<int>




long long gcd(long long x, long long y){
  long long smaller=min(x,y);
  long long bigger=max(x,y);
  if (bigger%smaller==0){
    return smaller;
  }
  else {
    return gcd(smaller, bigger%smaller);
  }
}


int main(){
  

  long long a,b,c,d;
  cin>>a>>b>>c>>d; 
  long long mylcm=(c*d)/gcd(c,d);
  
  long long cord;
  
  cord=(b/c-(a-1)/c)+(b/d-(a-1)/d)-(b/mylcm-(a-1)/mylcm);
  
  cout<<(b-a+1-cord)<<endl;
  
  
  
  
      
 

  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int n;
long long a, b, c, d, x[2], y[2];
 
int main() {
	scanf("%d%lld%lld%lld%lld", &n , &a, &b, &c ,&d);
	a = abs(a - b);
	n--;
	for (int i = 0; i <= n; i++) {
		x[0] = c * i;
		x[1] = d * i;
		y[0] = c * (n - i) + a;
		y[1] = d * (n - i) + a;
		if (x[0] >= y[0] && x[0] <= y[1]) {
			printf("YES\n");
			return 0;
		}
		if (x[1] >= y[0] && x[1] <= y[1]) {
			printf("YES\n");
			return 0;
		}
	}
	printf("NO\n");
	return 0;
}

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

int main()
{
    int a[5];

    for (int i = 0; i < 5; i++)
    {
        cin >> a[i];
    }

    for (int i = 0; i < 5; i++)
    {
        if (a[i] != i + 1)
        {
            cout << i + 1 << endl;
            break;
        }
    }
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M);
  for(int i=0; i<M; i++){
    cin >> A.at(i) >> B.at(i);
  }
  
  int count;
  for(int i=0; i<N; i++){
    count = 0;
    for(int j=0; j<M; j++){
       
    if(A.at(j)==i+1 || B.at(j)==i+1){
      count++;
    }
    }
    cout << count << endl;
  }
    
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	String X;
    	Stack<Character> S = new Stack<>();
    	Stack<Character> T = new Stack<>();
    	
        void solve(InputReader in, PrintWriter out) {
        	X = in.next();
        	for (char c : X.toCharArray()) {
        		if (c == 'T') {
        			if (S.isEmpty()) {
        				T.push(c);
        			} else {
        				S.pop();
        			}
        		} else {
        			S.push(c);
        		}
        	}
        	out.println(S.size() + T.size());
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

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

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}


Measured memory_bytes: 25400
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (ll (i) = (s); (i) < (e); ++(i))
#define per(i, s, e) for (ll (i) = (s); (i) >= (e); --(i))
#define all(x) x.begin(),x.end()
 
int main(void) {
  string s; cin >> s;
  rep(i, 0, s.length()) {
    s[i] = 'x';
  }
  cout << s << endl;

}


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

long long n;
vector<long long> a;

long long solve();

int main() {
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long bit = 0, sum = a[0] + a[1], tmp = 0;
  vector<int> id;
  for (int i = 2; i < n; ++i) bit ^= a[i];
  if ((sum ^ bit) & 1) return -1;
  for (int i = 0; i < 50; ++i)
    if (bit >> i & 1) {
      sum -= 1LL << i;
      id.push_back(i);
    }
  if (sum < 0) return -1;
  for (int i = 1; i < 50; ++i) {
    if ((sum >> i & 1) && (bit >> (i - 1) & 1)) return -1;
    if (sum >> i & 1) tmp += 1LL << (i - 1);
  }
  if (tmp > a[0]) return -1;
  reverse(id.begin(), id.end());
  for (auto x : id)
    if ((1LL << x) + tmp < a[0]) tmp += 1LL << x;
  if (tmp == 0) return -1;
  return a[0] - tmp;
}

Measured memory_bytes: 3600
//Daniel Grzegorzewski
#include <bits/stdc++.h>

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios()
{
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

const int N = (int)1e5 + 10;

int n, a[N];
set<int> s;
VI v;

int dis(int z, int pol)
{
	if (n%2 == 0)
		return abs(pol-z);
	return min(abs(pol-z), abs(pol+1-z));
}

int main()
{
	init_ios();
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
		s.insert(a[i]);
	}
	int q = *(--s.end());
	int pol = q/2+1;
	auto it = s.upper_bound(pol);
	if (*it == q)
		--it;
	if (it != s.end())
		v.PB(*it);
	if (it == s.begin()) {
		cout<<q<<" "<<v.back()<<"\n";
		return 0;
	}
	--it;
	int qq = 3;
	while (qq--) {
		v.PB(*it);
		if (it == s.begin())
			break;
		--it;
	}
	int bst = v.back();
	for (int i = 0; i+1 < v.size(); ++i)
		if (dis(v[i], q/2) < dis(bst, q/2))
			bst = v[i];
	cout<<q<<" "<<bst<<"\n";
}

Measured memory_bytes: 5376
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
  string s, t;
  string ans="";
  int dp[3010][3010];
  cin >> s >> t;
  for(int i=0; i<=s.size(); i++){
    for(int j=0; j<=t.size(); j++) dp[i][j]=0;
  }
  for(int i=0; i<s.size(); i++){
    for(int j=0; j<t.size(); j++){
      if(s[i]==t[j]){
        dp[i+1][j+1]=dp[i][j]+1;
      }
      else dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
    }
  }
  int S=s.size();
  int T=t.size();
  while(S>0 && T>0){
    if(dp[S][T]==dp[S-1][T]) S--;
    else if(dp[S][T]==dp[S][T-1]) T--;
    else{
      ans=s[S-1]+ans;
      S--;
      T--;
    }
  }

  cout << ans << endl;
  
  return 0;
}

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


public class Main {
        public static void main(String[] args) {
            MyScanner sc = new MyScanner();
            //out = new PrintWriter(new java.io.BufferedOutputStream(System.out));
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            int k = sc.nextInt();
            int count = 0;
            if (a >= k) {
                System.out.println(k);
            } else {
                count += a;
                k -= a;
                if (b >= k) {
                    System.out.println(count);
                } else {
                    System.out.println(count - (k - b));
                }
            }



        }


       // public static PrintWriter out;

        public static class MyScanner {
            BufferedReader br;
            StringTokenizer st;

            public MyScanner() {
                br = new BufferedReader(new InputStreamReader(System.in));
            }

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

        }
    }

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

using namespace std;

const int INF = 1 << 30;

int main()
{
  int N, A[100000];

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

  int ret = 0;
  vector< int > dp(31, INF);
  dp[0] = 0;
  for(int i = 0; i < N; i++) {
    int z = A[i], x = 0;
    while(z > 1) z = (z + 1) >> 1, ++x;
    vector< int > nt(31, INF);
    if(__builtin_popcount(A[i]) == 1) {
      for(int j = 0; j < 31; j++) nt[x] = min(nt[x], dp[j] + max(0, x - j));
    } else {
      for(int j = 0; j < 31; j++) nt[x] = min(nt[x], dp[j] + max(0, x - j - 1) + 1);
      for(int j = 1; j < 31; j++) nt[x - 1] = min(nt[x - 1], dp[j] + max(0, x - j));
    }
    nt.swap(dp);
  }
  cout << *min_element(begin(dp), end(dp)) << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#include <utility>
#include <numeric>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
const int MOD = 1000000007;
using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	if (2 * k - 1 <= n) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
constexpr ll mod = 1e9 + 7;
#define endl '\n'
 
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  string s,t;
  cin >> s >> t;
  cout << (t+s) << endl;

}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

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

istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	rep(i,N) cin >> A[i];
	int stat = 0;
	int res = 1;
	for(int i = 1; i < N; i++) {
		if(stat == 0) {
			if(A[i] > A[i-1]) stat = 1;
			else if(A[i] < A[i-1]) stat = -1;
			else stat = 0;
		}
		else if(stat > 0 && A[i] < A[i-1]) {
			stat = 0;
			res++;
		}
		else if(stat < 0 && A[i] > A[i-1]) {
			stat = 0;
			res++;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>
#include <map>
#include <set>
#include <stack>
#include <deque>

#define INF 1000000000;
#define MOD 1000000007;
#define LIMIT 1000000000000000000;
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
typedef pair<int, int> P;

template<typename T>
T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return (a * b) / gcd(a, b);
}

int main()
{
    int group[] = { -1,0,2,0,1,0,1,0,0,1,0,1,0 };
    int x, y; cin >> x >> y;
    string ans = group[x] == group[y] ? "Yes" : "No";
    cout << ans << endl;
}

Measured memory_bytes: 256
let n, m = Scanf.scanf "%d %d\n" (fun n m -> n, m)
let edge = Array.make (n + 1) []

let rec load_graph i =
  if i < m then
    Scanf.scanf "%d %d\n" (fun a b ->
      edge.(a) <- b :: edge.(a);
      edge.(b) <- a :: edge.(b);
      load_graph (i + 1)
    )

let rec ans v exists rest =
  if rest = 0 then 1
  else
    let rec f ret = function
        [] -> ret
      | u :: l ->
        if exists.(u) then (
          let copy = Array.init (n + 1) (fun i -> exists.(i)) in
          copy.(u) <- false;
          f (ret + ans u copy (rest - 1)) l
        ) else f ret l
    in f 0 edge.(v)

let () =
  load_graph 0;
  let exists = Array.make (n + 1) true in
  exists.(1) <- false;
  print_int (ans 1 exists (n - 1))


Measured memory_bytes: 2432
# -*- coding: utf-8 -*-
import sys
import collections

def main():
	N = int(input())
	S = input()
	S = list(S)
	
	R = 0
	B = 0
	for i in S:
		if i == "R":
			R += 1
		else:
			B += 1
	
	if R > B:
		print("Yes")
	else:
		print("No")
			
if __name__ == "__main__":
	main()
	

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int K;
    cin >> K;
    long long ans = 0;
    int gcdij;
    for(int i = 1;i <= K;i++)
    {
        for(int j = 1;j <= K;j++)
        {
            gcdij = __gcd(i,j);
            for(int k = 1;k <= K;k++)
            {
                ans += __gcd(k,gcdij);
            }
        }
    }
    cout << ans << '\n';
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
    int x, t;
    cin >> x >> t;

    cout << max(0, x - t) << "\n";

    return 0;
}


Measured memory_bytes: 3564
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct node
{
	int key;
	node *prev,*next;
	
};

node *nil;
void init(){
	nil=(node*)malloc(sizeof(node));
	nil->next=nil;
	nil->prev=nil;
}
void insert(int key){
	node *x=(node*)malloc(sizeof(node));
	x->key=key;
	x->next=nil->next;
	nil->next->prev=x;
	nil->next=x;
	x->prev=nil;
}
void print(){
	node *cur=nil->next;
	int flag=0;
	while(cur!=nil){
		if(flag++)printf(" ");
		printf("%d",cur->key);
		cur=cur->next;
	}
	printf("\n");
}
node* Search(int key){
	node *cur=nil->next;
	while(cur!=nil && cur->key!=key){
		cur=cur->next;
	}
	return cur;
}
void deleteNode(node *t){
	if(t==nil)return;
	t->next->prev=t->prev;
	t->prev->next=t->next;
	free(t);
}
void deleteFirst(){
	deleteNode(nil->next);
}
void deleteLast(){
	deleteNode(nil->prev);
}
void deleteKey(int key)
{

	deleteNode(Search(key));
}
int main(){
    int n;
    scanf("%d",&n);
    char s[10];
    int key;
	init();
    while(n--){
        scanf("%s",s);
        if(s[0]=='i'){scanf("%d",&key);insert(key);}
        else if(s[0]='d'){
			if(strlen(s)==6){scanf("%d",&key);deleteKey(key);}
        	else{ 
        		if(s[6]=='F')deleteFirst();
        		else if(s[6]=='L')deleteLast();
        	}

        }
    }
    print();
    return 0;
}


Measured memory_bytes: 33812
import itertools
N, K = map(int, input().split())
S = input()


human = []
humancount = []
for key, group in itertools.groupby(S):
    human.append(key)
    humancount.append(len(list(group)))

humancount_ac = [0] + list(itertools.accumulate(humancount))

ans = 0
j = 0
count = 0

for i in range(N):
    while j <= len(human)-1:
        if human[j] == "0" and count < K:
            count += 1
            j += 1
            ans = max(ans, humancount_ac[j] - humancount_ac[i])
        elif human[j] == "1":
            j += 1
            ans = max(ans, humancount_ac[j] - humancount_ac[i])
        else:
            if human[i] == "0":
                count -= 1
            break
print(ans)


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


int main(){

    int N; cin >> N;
    string S; cin >> S;
    int ans = 0;
    rep(i, N - 1){
        if(S[i] != S[i + 1])ans++;
    }

    cout << ans + 1;

}

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

int main() {
	int n;
	cin >> n;
	string s[100000];
	long long x['X'];
	for (int i = 0;i < n;i++) {
		cin>>s[i];
		if (s[i][0] == 'M' || s[i][0] == 'A' || s[i][0] == 'R' || s[i][0] == 'C' || s[i][0] == 'H') {
			x[s[i][0]]++;
		}
	}
	sort(x, x + 'X');
	reverse(x, x + 'X');
	long long ans = 0;
	for (int i = 0;i < 3;i++) {
		for (int j = i + 1;j < 4;j++) {
			for (int k = j + 1;k < 5;k++)
				ans += x[i] * x[j] * x[k];
		}
	}
	cout << ans << endl;
}


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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    string s, t; cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());

    if(s < t) cout << "Yes" << endl;
    else cout <<"No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int N,K,ans=0,j=1,a;
  scanf("%d%d",&N,&K);

  for (int i = 0; i < N; i++)
  {
    scanf("%d",&a);
  }
  

  while (j<N)
  {
    j+=K-1;
    ans++;
  }

  printf("%d",ans);

  return 0;
}


Measured memory_bytes: 1704
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 M = sc.nextInt();
        int X = sc.nextInt();
        int Y = sc.nextInt();
        int[] x = new int[N];
        for (int i = 0; i < x.length; i++) {
            x[i] = sc.nextInt();
        }
        int[] y = new int[M];
        for (int i = 0; i < y.length; i++) {
            y[i] = sc.nextInt();
        }
        Arrays.sort(x);
        Arrays.sort(y);
        boolean war = true;
        for (int i = X + 1; i <= Y; i++) {
            if (i > x[x.length - 1] && i <= y[0]) {
                war = false;
            }
        }
        if (war) {
            System.out.println("War");
        } else {
            System.out.println("No War");
        }
        sc.close();
    }
}

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

int change(char x) {
  if (x == '1') return 1;
  if (x == '2') return 2;
  if (x == '3') return 3;
  if (x == '4') return 4;
  if (x == '5') return 5;
  if (x == '6') return 6;
  if (x == '7') return 7;
  if (x == '8') return 8;
  if (x == '9') return 9;
}
int main() {
  string S;
  cin >> S;
  vector<int> vec(S.size() - 2), vec2(S.size() - 2);
  int a, b, c;
  for (int i = 0; i < S.size() - 2; i++) {
    a = change(S.at(i));
    b = change(S.at(i + 1));
    c = change(S.at(i + 2));
    vec.at(i) = a * 100 + b * 10 + c;
  }
  for (int i = 0; i < S.size() - 2; i++) vec2.at(i) = abs(vec.at(i) - 753);
  sort(vec2.begin(), vec2.end());
  cout << vec2.at(0) << endl;
}

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

map<string, int> M;
string s[222222];

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

	int n, i, ans = 0;

	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> s[i];
		M[s[i]]++;
		if (M[s[i]] == 1)
			++ans;
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 26216