akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define IREP(i, v) for (auto i = v.begin(); i != v.end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes()
{
    cout << "Yes" << endl;
}
void no()
{
    cout << "No" << endl;
}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n ;
    cin >> n ;
    int a, b, ba ;
    a = b = ba = 0 ;
    int ans = 0 ;
    REP(i,n){
        string s ;
        cin >> s ;
        int m = SZ(s) ;
        REP(j,SZ(s)){
            if(s.substr(j,2)=="AB"){
                ans++ ;
            }
        }
        if(s[0]=='B' && s[m-1]!='A'){
            b++ ;
        }
        else if(s[0]!='B' && s[m-1]=='A'){
            a++ ;
        }
        else if(s[0]=='B' && s[m-1]=='A'){
            ba++ ;
        }
    }

    if(a>=1 && b >= 1){
        ans += ba + 1 ;
        ans += min(a-1,b-1) ;
    }
    else if(a==0 && b==0){
        ans += max(0,ba-1) ;
    }
    else{
        ans += ba ;
    }
    

    cout << ans <<endl ;
    

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
 int a,b;
 string s,t,u;
 cin >> s >> t;
 cin >> a >> b;
 cin >> u;
 if(u==s)
 a--;
 else
 b--;
 cout << a << " " << b;
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define mod 1000000007
 
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
 
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main(){
    ll a, b;
    cin >> a >> b;
    ll ans = 0;
    ll cnt = 1;
    while(1){
        if(cnt >= b){
            cout << ans << endl;
            return 0;
        }
        cnt--;
        cnt += a;
        ans++;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
#define INF 1000000001

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------
ll gcd(ll a, ll b) {
  return b == 0 ? a : gcd(b, a % b);
}
int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int n; cin>>n;
  if(n==3) {
    cout<<2<<" "<<5<<" "<<63<<"\n";
    return 0;
  }
  vector<int> st_even,st_odd;
  st_even.push_back(2);
  st_even.push_back(10);
  st_even.push_back(3);
  st_even.push_back(9);
  st_even.push_back(4);
  st_even.push_back(8);
  st_even.push_back(6);
  st_even.push_back(12);
  for(int i=1; i<=2500; i++) {
    st_even.push_back(12*i+2);
    st_even.push_back(12*i+10);
    st_even.push_back(12*i+3);
    st_even.push_back(12*i+9);
    st_even.push_back(12*i+4);
    st_even.push_back(12*i+8);
    st_even.push_back(12*i+6);
    st_even.push_back(12*i+12);
  }

  st_odd.push_back(6);
  st_odd.push_back(2);
  st_odd.push_back(10);
  st_odd.push_back(3);
  st_odd.push_back(9);
  st_odd.push_back(4);
  st_odd.push_back(8);
  st_odd.push_back(12);
  for(int i=1; i<=2500; i++) {
    st_odd.push_back(12*i+6);
    st_odd.push_back(12*i+2);
    st_odd.push_back(12*i+10);
    st_odd.push_back(12*i+3);
    st_odd.push_back(12*i+9);
    st_odd.push_back(12*i+4);
    st_odd.push_back(12*i+8);
    st_odd.push_back(12*i+12);
  }
  if(n%2==0) {
    for(int i=0; i<=n-1; i++) {
      if(i==n-1) {cout<<st_even[i]<<"\n";break;}
      cout<<st_even[i]<<" ";
    }
  }
  if(n%2==1){
    for(int i=0; i<=n-1; i++) {
      if(i==n-1) {cout<<st_odd[i]<<"\n";break;}
      cout<<st_odd[i]<<" ";
    }
  }
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int INF = 2100100100;
using ll = long long;

int main(){
   string s,s1,s2,copy_s,copy_s1,copy_s2;
   cin >> s;
   s1 = s.substr(0,(s.length()+1)/2-1);
   s2 = s.substr((s.length()+3)/2-1,s.length()-(s.length()+3)/2+1);
   copy_s = s;
   reverse(s.begin(),s.end());
   copy_s1 = s1 ;
   copy_s2 = s2 ;
   reverse(s1.begin(),s1.end());
   reverse(s2.begin(),s2.end());

   if (s==copy_s){
       if(s1 == copy_s1 && s2 == copy_s2){
        cout << "Yes" << endl;
        return 0;
       }
   }
   cout << "No" << endl;
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>


int main()
{
	long long n;

	std::cin >> n;

	std::map<long long, long long> m;

	for (size_t i = 0; i < n; i++) {
		long long a;
		std::cin >> a;

		m[a]++;
	}

	long long max = 0;
	long long hen = 0;

	for (auto i = m.rbegin(); i != m.crend(); i++) {
		if (i->second < 2) {
			continue;
		}
		if (i->second > 1) {
			if (hen == 0) {
				hen = i->first;
			} else {
				max = hen * i->first;
				break;
			}
		}
		if (i->second >= 4) {
			max = i->first * i->first;
			break;
		}
	}

	std::cout << max << std::endl;

	return 0;
}

Measured memory_bytes: 6528
n,m,x = map(int,input().split())
l = []
for i in range(n):
    l1 = list(map(int,input().split()))
    l.append(l1)
ansl = []
for i in range(2**n):
    now = 0
    nl = [0 for i in range(m)]
    for j in range(n):
        if ((i >> j) & 1):
            for k in range(1,m+1):
                nl[k-1] += l[j][k]
            now += l[j][0]
    key = 0
    #print(nl)
    for j in range(m):
        if nl[j] < x:
            key = 1
    if key == 0:
        ansl.append(now)
if len(ansl) > 0:
    print(min(ansl))
else:
    print(-1)

Measured memory_bytes: 9172
n = gets.chomp.to_i
al = gets.chomp.split.map(&:to_i)

humidai = []
highest = al.first
al.each do |a|
  if a < highest
    humidai.push(highest - a)
  end
  if a > highest
    highest = a
  end
end

puts humidai.sum

Measured memory_bytes: 31708
import sys
input = sys.stdin.readline
a,b,c=map(int,input().split())
k=int(input())
while b<=a and k>0:
    b*=2
    k-=1

while c<=b and k>0:
    c*=2
    k-=1
if a<b<c:
    print('Yes')
else:
    print('No')




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

int main() {
	
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	
	vector<vector<bool>> matrix(h+2, vector<bool>(w+2));
	
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if( (i<b && j<a) || (i>=b && j>=a) ) matrix.at(i).at(j) = 1;
		}
	}

	// do{
	// }while( next_permutation( matrix.at(0).begin(), matrix.at(0).end() ) );

	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			cout << matrix.at(i).at(j);
		}
		cout << endl;
	}

	
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int find(vector<pair<int,long long> > &in,int n){
	for(int i=0;i<in.size();++i){
		if(in[i].first==n) return i;
	}
	return -1;
}
int main(){
	int n,num,price,amount;
	while(cin>>n&&n){
		vector<pair<int,long long> > v;
		while(n--){
			cin>>num>>price>>amount;
			if(find(v,num)!=-1) v[find(v,num)].second+=(long long)price*amount;
			else v.push_back(make_pair(num,(long long)price*amount));
		}
		bool f=false;
		for(vector<pair<int,long long> >::iterator it=v.begin();it<v.end();++it){
			if((*it).second>=1000000){
				cout<<(*it).first<<"\n";
				f=true;
			}
		}
		if(!f) cout<<"NA\n";
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000009
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define rollcall cout<<"I'm Sucu."<<endl
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define int ll

const int MAX_V = 1000;
struct edge{int end,cap,rev;};
vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];


void Dinic_add_edge(int from,int end,int cap){
    G[from].push_back((edge){end,cap,(int)G[end].size()});
    G[end].push_back((edge){from,0,(int)G[from].size()-1});
}

void Dinic_bfs(int s){
    memset(level,-1,sizeof(level));
    queue<int> que;
    level[s]=0;
    que.push(s);
    while(!que.empty()){
        int v=que.front();
        que.pop();
        for(int i=0;i<G[v].size();i++){
            edge &e = G[v][i];
            if(e.cap>0 && level[e.end]<0){
                level[e.end]=level[v]+1;
                que.push(e.end);
            }
        }
    }
}

int Dinic_dfs(int v,int t,int f){
    if(v==t)return f;
    for(int &i=iter[v];i<G[v].size();i++){
        edge &e = G[v][i];
        if(e.cap>0 && level[v]<level[e.end]){
            int d = Dinic_dfs(e.end,t,min(f,e.cap));
            if(d>0){
                e.cap -= d;
                G[e.end][e.rev].cap+=d;
                return d;
            }
        }
    }
    return 0;
}

int Dinic(int s,int t){
    int flow=0;
    while(1){
        Dinic_bfs(s);
        if(level[t]<0){return flow;}
        memset(iter,0,sizeof(iter));
        int f;
        while((f=Dinic_dfs(s,t,INF))>0){
            flow+=f;
        }
    }
}

signed main(void){
    int N,Ans;
    int a[100],b[100],c[100],d[100];
    cin >> N;
    REP(i,N){
        cin >> a[i] >> b[i];
    }
    REP(i,N){
        cin >> c[i] >> d[i];
    }
    //ソースは500,シンクは501
    REP(i,N){
        Dinic_add_edge(500,i,1);
    }
    REP(i,N){
        REP(j,N){
            if(a[i]<c[j]&&b[i]<d[j]){
                Dinic_add_edge(i,j+N,1);
            }
        }
    }
    REP(j,N){
        Dinic_add_edge(j+N,501,1);
    }
    
    Ans=Dinic(500,501);
    
    cout << Ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
char map[20][21];
char count[20][20];
int s1, s2;
void solve(int y, int x) {
	if (!count[y][x]) {
		if (map[y][x] == '.' || map[y][x] == '@') {
			count[y][x] = 1;
			if (y < s2 - 1) solve(y + 1, x);
			if (y > 0) solve(y - 1, x);
			if (x < s1 - 1) solve(y, x + 1);
			if (x > 0) solve(y, x - 1);
		}
	}
}
int main() {
	int i, j, ans, point[2];
	while (1) {
		scanf("%d %d", &s1, &s2);
		if (!(s1||s2)) break;
		for (i = 0; i < s2; i ++) scanf("%s", map[i]);
		for (i = 0; i < s2; i ++) for (j = 0; j < s1; j ++) if (map[i][j] == '@') {
			point[0] = i; point[1] = j;
		}
		for (i = 0; i < 20; i ++) for (j = 0; j < 20; j ++) count[i][j] = 0;
		ans = 0;
		solve(point[0], point[1]);
		for (i = 0; i < s2; i ++) for (j = 0; j < s1; j ++) ans += count[i][j];
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 612
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
  int N,K;
  cin >> N >> K;
  vector<int> friends(N);
  for(int i=0; i<N; i++) cin >> friends[i];
  sort(friends.begin(), friends.end());
  cout << (int)(friends.end() - lower_bound(friends.begin(), friends.end(), K)) << endl;
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,s;
	cin>>n>>s;
	int a[210];
	a[0]=s;
	int sum=s;
	int mn=110;
	for(int i=1;i<n;i++)
		{
		a[i]=a[i-1]+1;
		sum+=a[i];}
	for(int i=0;i<n;i++)
	{
		if(abs(a[i])<abs(mn))
		mn=a[i];
	}
	cout<<sum-mn<<endl;
	return 0; 
 } 

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

typedef long long ll;
#define maxn 100005
ll x[maxn];
ll v[maxn], v1[maxn], v2[maxn];
ll mv1[maxn], mv2[maxn];

int main() {
    ll n, c, ans = 0;
    cin >> n >> c;

    for (int i = 1; i <= n; i++) {
        cin >> x[i] >> v[i];
        v1[i] = v1[i - 1] + v[i] - x[i] + x[i - 1];
        mv1[i] = max(mv1[i - 1], v1[i]);
    }

    x[n + 1] = c;
    for (int i = n; i >= 0; i--) {
        v2[i] = v2[i + 1] + v[i] + x[i] - x[i + 1];
        mv2[i] = max(mv2[i + 1], v2[i]);
    }

    for (int i = 0; i <= n; i++) {
        ans = max(ans, mv1[i] + mv2[i + 1] - min(x[i], c - x[i + 1]));
    }
    cout << ans << endl;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,A,B; cin >> N >> A >> B;
    string S; cin >> S;
    int sum=0,b=0;
    for (int i=0;i<N;++i){
        int ok=0;
        if (S[i]=='a'&&sum<A+B) ok=1,++sum;
        if (S[i]=='b'&&sum<A+B&&b<B) ok=1,++sum,++b;
        cout << (ok?"Yes":"No") << '\n';
    }
}

Measured memory_bytes: 848
import collections
n = int(input())
s = [input() for i in range(n)]
#print(s)
c = collections.Counter(s)
#print(c.most_common())
a = []
b = (c.most_common())
#print(b)
a.append(b[0][0])
for i in range(1,len(b)):
    if b[0][1] == b[i][1]:
        a.append(b[i][0])
print(*sorted(a))

Measured memory_bytes: 50200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i,n) for (int i=0; i<(n); i++)
#define reps(i,s,n) for (int i=(s); i<(n); i++)
#define rep1(i,n) for (int i=1; i<=(n); i++)
#define repr(i,s,n) for (int i=(s)-1; i>=(n); i--)
#define print(a) cout << (a) << endl;
#define all(v) v.begin(), v.end()


int main() {
  int H, W, K;
  cin >> H >> W >> K;
  string c[H];
  rep(i, H) {
    cin >> c[i];
  }
  int ans = 0;
  rep(i, (1<<H)) {
    rep(j, (1<<W)) {
      int cnt = 0;
      rep(k, H) {
        if ((i&(1<<k)) != 0)
          continue;
        rep(l, W) {
          if ((j&(1<<l)) != 0)
            continue;
          if (c[k][l] == '#')
            cnt++;
        }
      }
      if (cnt == K)
        ans++;
    }
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll n, m, a, b, c, t;
ll s[100];
ll A[100][100][100];

void make() {
	rep(i, 100)rep(j, 100)rep(k, 100)A[i][j][k] = 0;
	rep(i, n) {
		if (i - 1 >= 0)A[0][i][i - 1] = a;
		A[0][i][i] = b;
		if (i + 1 < n)A[0][i][i + 1] = c;
	}
	rep(i, 40) {
		rep(j, n) {
			rep(k, n) {
				rep(l, n) {
					A[i + 1][j][k] = (A[i + 1][j][k] + (A[i][j][l] * A[i][l][k]) % m) % m;
				}
			}
		}
	}
}

int main() {
	while (cin >> n >> m >> a >> b >> c >> t&&n + m + a + b + c + t) {
		rep(i, n)cin >> s[i];
		make();
		for (int i = 30; i >= 0; i--) {
			if (t >= (1LL << i)) {
				//cout << "!" << endl;
				t -= (1LL << i);
				ll ss[100] = {};
				rep(j, n) {
					rep(k, n) {
						ss[j] = (ss[j] + A[i][j][k] * s[k] + m) % m;
					}
				}
				rep(j, n)s[j] = ss[j];
			}
		}
		rep(i, n) {
			if (i)cout << " ";
			cout << s[i];
		}
		cout << endl;
	}
}


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

int main(){
    string S;
    cin>>S;
    if(S=="Sunny") cout<<"Cloudy"<<endl;
    else if(S=="Cloudy") cout<<"Rainy"<<endl;
    else cout<<"Sunny"<<endl;

}



Measured memory_bytes: 256
# ABC139
def main():
    N, *H = map(int, open(0).read().split())
    ans, cur, cnt = 0, H[0], 0
    for i in H[1:]:
        if i <= cur:
            cnt += 1
        else:
            ans = max(ans, cnt)
            cnt = 0
        cur = i
    ans = max(ans, cnt)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 14092
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;
bool isNum(ll x){
    bool nana=false, go=false, san=false;
    while(x>0){
        int num=x%10;
        x/=10;
        if(num==3) san=true;
        if(num==5) go=true;
        if(num==7) nana=true;
    }
    return san&&go&&nana;
}

int main(){
    fast_io

    int n;
    cin>>n;
    ll x;
    cin>>x;
    vector<ll> a(n);
    rep(i, n) cin>>a[i];
    sort(a.begin(), a.end());

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


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long
#define pii pair<int,int>
#define ff first
#define ss second
#define vi vector<int>
#define fo(n) for(int i = 0;i < int(n);i++)
#define foo(a,b) for(int i = int(a);i <= int(b);i++)
#define mk make_pair
#define pb push_back
#define MAXN 400
#define mod 1000000007
#define all(x) x.begin(),x.end()
#define fastio ios_base:: sync_with_stdio(false)
#define inf (ll)1e17

vi arr(MAXN);

ll MCM(int n){
	ll dp[n][n];
	ll wt[n][n];

	fo(n){
		dp[i][i] = 0;
		wt[i][i] = (ll)arr[i];
	}

	for(int gap = 1;gap < n;gap++){
		for(int i = 0;(i+gap) < n;i++){
			int j = i + gap;
			ll val = inf; 

			for(int k = i;k < j;k++){
				val = min(val, wt[i][k]+wt[k+1][j]+dp[i][k]+dp[k+1][j]);
			}

			dp[i][j] = val;
			wt[i][j] = wt[i][i] + wt[i+1][j];
		}
	}



	return dp[0][n-1];
}

int main(){

	
	fastio;
	int n;
	cin >> n;

	fo(n) cin >> arr[i];

	ll ans = MCM(n);

	cout << ans << endl;


	return 0;
 }	

Measured memory_bytes: 2816
# include <stdio.h>
#include <math.h>

int main(){
	int mat[3][3];
	int n, dentro=0;

	for(int i=0; i<3; ++i){
		for(int j=0; j<3; ++j){
			scanf("%d", &mat[i][j]);
		}
	}
	scanf("%d", &n);
	for(int k=0; k<n; ++k){
		int num;
		scanf("%d", &num);
		for(int i=0; i<3; ++i){
			for(int j=0; j<3; ++j){
				if(num==mat[i][j])
					mat[i][j]=-1;
			}
		}
	}

	for(int i=0; i<3; ++i){
		int linha=0;
		for(int j=0; j<3; j++){
			if(mat[i][j]==-1)
				linha+=1;
		}
		if(linha==3)
			dentro=1;
		
	}

	for(int j=0; j<3; ++j){
		int coluna=0;
		for(int i=0; i<3; i++){
			if(mat[i][j]==-1)
				coluna+=1;
		if(coluna==3)
			dentro=1;
		}
	}
	if(mat[0][0]==-1 && mat[1][1]==-1 && mat[2][2]==-1)
		dentro=1;


	if(mat[0][2]==-1 && mat[1][1]==-1 &&mat[2][0]==-1)
		dentro=1;


	if (dentro==1)
		printf("Yes\n");
	else
		printf("No\n");




	return 0;
}

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> p(n);
    REP(i, 0, n) {
        cin >> p[i];
    }
    REP(i, 0, n) {
        REP(j, i, n) {
            swap(p[i], p[j]);
            bool ok = true;
            REP(k, 0, n - 1) {
                if (p[k] > p[k + 1]) {
                    ok = false;
                }
            }
            if (ok) {
                cout << "YES" << endl;
                return 0;
            }
            swap(p[i], p[j]);
        }
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.function.BiConsumer;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		int ans = 0;

		for(int i=2; i <= Math.sqrt(N); i++) {
			int count = 0;
			while(N%i == 0) {
				N = N / i;
				count ++;
			}
			
			for(int j=1; count-j>=0; j++) {
				ans ++;
				count -= j;
			}
		}
		
		
		if(N > 1) {
			ans ++;
		}
		System.out.println(ans);

	}
}


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

Measured memory_bytes: 3824
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << "(" << p.first << " " << p.second << ")";
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  //os << v[0]; for (ll i = 1; i < (ll)v.size(); i++){ os << " " << v[i]; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::map< T, S > m)
{
  ll i = 0; for (auto p : m){ os << " [" << i << "]" << p.first << "->" << p.second; i++;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

int main()
{
  ll N, K;
  std::cin >> N >> K;

  ll ans = 0LL;
  for (ll b = 1; b <= N; b++) {
    ll num = N / b;
    ll mod = N % b;
    ll sum = std::max(0LL, (mod - K + 1)) + num * std::max(0LL, (b - K));
    //print(b, mod, sum);
    ans += sum;
  }

  if (K == 0) ans -= N;
  print(ans);

  return 0;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> x(n), y(n);

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

  double ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int dx = x[i] - x[j];
      int dy = y[i] - y[j];
      ans += sqrt(dx * dx + dy * dy);
    }
  }
  cout << setprecision(8) << ans / n << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
//#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
signed main(){
    int a,b;cin>>a>>b;
    string s; cin>>s;
    rep(i,s.size()){
        if(i==a&&s[i]!='-')return puts("No")*0;
        else if(i!=a){
            if(0<=s[i]-'0'&&s[i]-'0'<=9)
                continue;
            else
                return puts("No")*0;
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop(n, i) for(int i=0;i<n;i++)
#define loop1(n, i) for(int i=1;i<=n;i++)
#define rloop(n, i) for(int i=n;i;i++)
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;

int main() {
    int h, w, a, b; cin >> h >> w >> a >> b;
    int sp = 0;
    if (h > w) {
        sp = 1;
        swap(h, w);
        swap(a, b);
    }
    V<V<int>> A(h, V<int>(w));

    loop (a, i) {
        loop (h, j) {
            A[j][i] = 1;
        }
    }
    loop (w, i) {
        loop (b, j) {
            A[j][i] ^= 1;
        }
    }

    if (sp) swap(h, w);
    loop (h, i) {
        loop (w, j) {
            if (sp) cout << A[j][i];
            else cout << A[i][j];
        }
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 5120
N=int(input())
L=[set() for i in range(11)]
for i in range(1,10):
    L[0].add(i)
#print(L[0])
for i in range(1,11):
    for j in L[i-1]:
        if j%10==0:
            L[i].add(j*10)
            L[i].add(j*10+1)
        elif j%10==9:
            L[i].add(j*10+8)
            L[i].add(j*10+9)
        else:
            M=(j%10)
            for k in range(3):
                L[i].add(j*10+M-1+k)
SET=L[0]
for i in range(1,11):
    SET|=L[i]
SET=list(SET)
SET.sort()
print(SET[N-1])

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

count = 0
for i in range(n - 2):
    # if s[i] == 'A':
    #     if s[i + 1] == 'B':
    #         if s[i + 2] == 'C':
    #             count += 1
    if s[i] == 'A' and s[i + 1] == 'B' and s[i + 2] == 'C':
        count += 1

print(count)


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <vector>
#include <climits>
#include <cmath>

using namespace std;
using ll = long long;

int main()
{
    int N;
    cin >> N;

    vector<vector<int>> F(
        N, vector<int>(10, 0)
    );

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

    vector<vector<int>> P(
        N, vector<int>(11, 0)
    );

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

    int ans = -INT_MAX;

    for (int b = 1; b < (1 << 10); ++b) {
        int cc = 0;

        for (int i = 0; i < N; i++) {
            int c = 0;

            for (int j = 0; j < 10; j++) {
                if ((b >> j & 1) && F[i][j]) {
                    ++c;
                }
            }

            cc += P[i][c];
        }

        ans = max(ans, cc);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
def ints():
  return [int(x) for x in input().split()]
def ii():
  return int(input())

memo = {}

for i in range(1, 10):
  for j in range(i, 10):
    memo[i*j] = True

n = ii()
if n in memo:
  print('Yes')
else:
  print('No')



Measured memory_bytes: 2940
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

int main() {
	int H, W, h, w, i, j;
	scanf("%d %d %d %d", &H, &W, &h, &w);
	if (H % h == 0 && W % w == 0) return !printf("No\n");

	printf("Yes\n");
	for (i = 1; i <= H; i++) {
		for (j = 1; j <= W; j++) {
			if (i % h == 0 && j % w == 0) printf("%d ", -1000*(h*w-1)-1);
			else printf("1000 ");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1536
unittest
{
	assert( [ "3 3", "dxx", "axx", "cxx" ].parse.expand.solve == "axxcxxdxx" );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nl = input.front.split.to!( long[] );
	auto ss = new string[ nl[ 0 ] ];
	foreach( ref s; ss )
	{
		input.popFront;
		s = input.front;
	}
	return tuple( ss );
}

auto solve( string[] ss )
{
	return ss.sort().join;
}


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

constexpr long long mod{998244353};

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<int> a(N);
	int sum_a{};
	for (auto& e: a)
	{
		scanf("%d", &e);
		sum_a += e;
	}
	std::vector<long long> dp1(sum_a + 1), dp2(sum_a + 1);
	dp1[0] = dp2[0] = 1;
	for (auto& e: a)
	{
		for (int i{sum_a - e}; i >= 0; i--)
		{
			dp1[i + e] = (dp1[i + e] + dp1[i]) % mod;
			dp2[i + e] = (dp2[i + e] + dp2[i]) % mod;

			dp1[i] = dp1[i] * 2 % mod;
		}
	}
	long long ans{};
	for (int i{(sum_a + 1) / 2}; i <= sum_a; i++)
		ans = (ans + dp1[i]) % mod;
	if (~sum_a & 1)
	{
		ans = (ans + mod - dp2[sum_a / 2]) % mod;
	}
	ans = ans * 3 % mod;
	long long pow3{3}, all{1};
	for (long long n_i{N}; n_i > 0; n_i >>= 1)
	{
		if (n_i & 1) all = all * pow3 % mod;
		pow3 = pow3 * pow3 % mod;
	}
	ans = (all + mod - ans) % mod;
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<string>
using namespace std;
struct dice{
    int a[6];
    void b(char c){
        int d;
        if(c=='N'){
            d=a[0];
            a[0]=a[1];
            a[1]=a[5];
            a[5]=a[4];
            a[4]=d;
        }
        if(c=='W'){
            d=a[0];
            a[0]=a[2];
            a[2]=a[5];
            a[5]=a[3];
            a[3]=d;
        }
        if(c=='E'){
            d=a[0];
            a[0]=a[3];
            a[3]=a[5];
            a[5]=a[2];
            a[2]=d;
        }
        if(c=='S'){
            d=a[0];
            a[0]=a[4];
            a[4]=a[5];
            a[5]=a[1];
            a[1]=d;
        }
        if(c=='R'){
            d=a[1];
            a[1]=a[2];
            a[2]=a[4];
            a[4]=a[3];
            a[3]=d;
        }
    }
    int top(){
        return a[0];
    }
    int right(){
        return a[2];
    }
    int left(){
        return a[3];
    }
    int front(){
        return a[1];
    }
};
bool same(dice a1,dice a2){
    for(int i=0;i<6;i++) if(a1.a[i]!=a2.a[i]) return false;
    return true;
}
int main(){
    dice e[2];
    for(int j=0;j<2;j++)
        for(int i=0;i<6;i++)
           cin >> e[j].a[i];
    bool f=false;
    
    for(int i=0;i<4;i++){
        e[1].b('R');
        for(int j=0;j<4;j++){
            e[1].b('N');
            if(same(e[0],e[1])) f=true;
        }
    }
    e[1].b('E');
    for(int j=0;j<4;j++){
        e[1].b('N');
        if(same(e[0],e[1])) f=true;
    }
    
    e[1].b('W');
    e[1].b('W');
    for(int j=0;j<4;j++){
        e[1].b('N');
        if(same(e[0],e[1])) f=true;
    }
    
    cout << (f?"Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
int main(){
    int n;cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll sum=0;
    ll ans1=0;
    for(int i=0;i<n;i++){
        sum+=a[i];
        if(i%2==1) {
            if(sum>=0) {
                ans1+=sum+1;
                sum=-1;
            }
        }else {
            if(sum<=0) {
                ans1+=-sum+1;
                sum=1;
            }
        }
    }
    ll ans2=0;
    sum=0;
    for(int i=0;i<n;i++){
        sum+=a[i];
        if(i%2==0) {
            if(sum>=0) {
                ans2+=sum+1;
                sum=-1;
            }
        }else {
            if(sum<=0) {
                ans2+=-sum+1;
                sum=1;
            }
        }
    }
    ll ans=min(ans1,ans2);
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int unsigned long long
int k,a,b;
signed main()
{
	cin>>k>>a>>b;
	if(a>=b||b-a==1||b-a==2||k<=a-1)
		cout<<k+1<<endl;
	else
	{
		int ans=a;
		k-=a-1;
		ans+=(b-a)*(k/2);
		if(k%2==1)
			ans+=1;
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
template <long long mod>
class Combination
{
    std::vector<long long> fact, finv, inv;
public:
    Combination(int sz)
    {
        fact.resize(sz);
        finv.resize(sz);
        inv.resize(sz);
        fact[0] = 1;
        for (int i = 1; i < sz; ++i)
        {
            fact[i] = fact[i - 1] * i % mod;
        }
        inv[0] = 0;
        inv[1] = 1;
        for (int i = 2; i < sz; ++i)
        {
            inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        }
        finv[0] = 1;
        for (int i = 1; i < sz; ++i)
        {
            finv[i] = finv[i - 1] * inv[i] % mod;
        }
    }
    long long C(long long n, long long k)
    {
        if (n < k)
            return 0;
        if (n < 0 || k < 0)
            return 0;
        return (fact[n] * finv[k] % mod) * finv[n - k] % mod;
    }
    long long P(long long n, long long k)
    {
        if (n < k)
            return 0;
        if (n < 0 || k < 0)
            return 0;
        return fact[n] * finv[n - k] % mod;
    }
    long long H(long long n, long long k)
    {
        return this->C(n + k - 1, k);
    }
    long long getfact(int i)
    {
        return fact[i];
    }
    long long getinv(int i)
    {
        return inv[i];
    }
    long long getfinv(int i)
    {
        return finv[i];
    }
};
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  ll n, k; cin >> n >> k;
  vll a(k);
  for(int i=0;i<k;++i) {
    cin >> a[i];
  }
  vvll dp(k+1, vll(n+1, 0));
  dp[0][0] = 1;
  Combination<MOD> comb(1000000);
  for(int i=0;i<k;++i) {
    for(int j=0;j<=n;++j) {
      for(int l=0;(l+j<=n && l<=a[i]);++l) {
        dp[i+1][j+l] += dp[i][j] * comb.C(n-j, l) % MOD * comb.C(n-l, a[i]-l) % MOD;
        dp[i+1][j+l] %= MOD;
      }
    }
  }
  cout << dp[k][n] << endl;
}


Measured memory_bytes: 23936
n = int(input())
a = list(map(int, input().split()))
b = a.copy()

for i in range(n//2, 0, -1):
  if(a[i-1] != sum(b[i-1::i])%2):
    b[i-1] = 1 - a[i-1]
print(sum(b))
print(*(i+1 for i, x in enumerate(b) if x))



    
    

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

int W, H;
string donuts[10];
int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[8] = {-1,  0,  1, -1,1, -1,0, 1};

string ansstr;
set<string> strs;

int flgs[100][100];

void dfs(int x, int y, int d, string cur){
	x = (x + W) % W;
	y = (y + H) % H;
	if(flgs[y][x]) return;
	string c2 = cur + donuts[y][x];
	if(strs.find(c2) == strs.end()){
		strs.insert(c2);
	}else{
		if(ansstr.size() < c2.size() || (ansstr.size() == c2.size() && c2 < ansstr)){
			ansstr = c2;
		}
	}
	flgs[y][x] = true;
	dfs(x + dx[d], y + dy[d], d, c2);
	flgs[y][x] = false;
}

int main(){
	while(cin >> H >> W, H){
		for(int i = 0; i < H; i++){
			cin >> donuts[i];
		}
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				flgs[i][j] = 0;
			}
		}
		ansstr = "";
		strs.clear();
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				for(int k = 0; k < 8; k++){
					dfs(j, i, k, "");
				}
			}
		}
		if(ansstr.size() < 2){
			cout << 0 << endl;
		}else{
			cout << ansstr << endl;
		}
	}
}

Measured memory_bytes: 35696
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000


int main(){

	int A,B,C;
	cin>>A>>B>>C;
	
	if(A==B)cout<<C<<endl;
	else if(B==C)cout<<A<<endl;
	else cout<<B<<endl;
	
    return 0;
}



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

int main(){
  //std::ifstream in("input.txt");
  //std::cin.rdbuf(in.rdbuf());
  
  int MAX_N = 200000;
  vector<bool> is_prime(MAX_N, true);
  is_prime.at(0) = false;
  is_prime.at(1) = false;
  for(int i=2; i<MAX_N; i++){
    if(is_prime.at(i)){
      for(int j=i*2; j<MAX_N; j+=i){
        is_prime.at(j) = false;
      }
    }
  }

  vector<bool> a(MAX_N, false);
  for(int i=0; i<MAX_N; i++){
    if(is_prime.at(i) and is_prime.at((i+1)/2)){
      a.at(i) = true;
    }
  }

  vector<int> s(MAX_N+1, 0);
  for(int i=0; i<MAX_N; i++){
    s.at(i+1) = s.at(i) + a.at(i);
  }

  int N;
  cin >> N;
  for(int q=0; q<N; q++){
    int l, r;
    cin >> l >> r;
    cout << s.at(r + 1) - s.at(l) << endl;
  }

  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int main()
{
       char c;
    cin>>c;
    if(c=='a')
        cout<<"vowel"<<endl;
    else if(c=='e')
        cout<<"vowel"<<endl;
    else if(c=='i')
        cout<<"vowel"<<endl;
    else if(c=='o')
        cout<<"vowel"<<endl;
    else if(c=='u')
        cout<<"vowel"<<endl;
    else
        cout<<"consonant"<<endl;

}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
if n <= 2:
    print(1)
    exit()


def mode(a,b):
    if a<b:
        return 1
    elif a == b:
        return 0
    else:
        return -1
cnt = 1
m = mode(a[0], a[1])
for i in range(1, n):
    nm = mode(a[i-1], a[i])
    if nm != m:
        if m == 0:
            m = nm
        elif nm == 0:
            pass
        else:
            m = 0
            cnt += 1
print(cnt)

Measured memory_bytes: 14252
/*
* Author : MaxSally
*/
/********   All Required Header Files ********/
#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i <= k ; ++i)
#define rrep(i, j, k) for (int i = j; i >= k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define mp make_pair
#define pb push_back
#define inf (int) (1e9 + 7)
#define epsi 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define read(type) readInt<type>()
#define io ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define left tuyiuoi
#define right fgjhk
#define ss second
#define ff first
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) rep(i, l, r) cout << a[i] << " "; cout << endl
#define Flag(n) cout << "here " << n << endl
const double pi=acos(-1.0);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<ll, ll> pll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

const int N = 100005;
string s;
int sum[N], n, temp[N];
pii maxSum[N];

vi alph[30];

pii check(int k){
    maxSum[0] = mp(0, 0);
    rep(i, 1, n){
        temp[i] = i - 2 * sum[i];
        if(temp[i] > maxSum[i - 1].ff){
            maxSum[i].ff= temp[i];
            maxSum[i].ss = i;
        }else{
            maxSum[i] = maxSum[i - 1];
        }
    }

    rep(j, 2, n){
        if(temp[j] < maxSum[j - 1].ff && maxSum[j - 1].ss + 1 < j){
            return mp(maxSum[j - 1].ss + 1, j);
        }
    }
    return mp(-1, -1);
}

int main(){
    io;
    //freopen("input.txt", "r", stdin);
    cin >> s;
    n = s.length();
    rep(i, 0, n - 1){
        alph[s[i] - 'a'].pb(i);
    }
    rep(i, 'a', 'z'){
        sum[0] = 0;
        rep(j, 0, n - 1){
            sum[j + 1] = sum[j] + (s[j] == i);
        }
        pii ans = check(i - 'a');
        if(ans == mp(-1, -1)){
            continue;
        }else{
            cout << ans.ff << " " << ans.ss;
            return 0;
        }
    }
    cout << "-1 -1";
    return 0;
}




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

const int N = (int)1e5 + 10;
const double eps = 1e-8;

template <typename T> inline T gcd(T a, T b) { a = abs(a), b = abs(b); while ( b ) { a %= b; swap(a, b); } return a; }
vector <pair <int, int> > adj[N + 7];


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	ll n, arr[10];
	ll mn = (ll)1e18;
	cin >> n;
	for ( int i = 0; i < 5; ++i ) {
		cin >> arr[i];
		mn = min(arr[i], mn);
	}
	ll ans = 4 + ceil(n*1.0 / mn*1.0);
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    string s;
    cin >> s;
    vec<int> cs(28);
    REP(i, s.length()){
        cs[s[i]-'a']++;
    }
    REP(i, 28){
        if(cs[i]%2){
            cout << "No" << el;return;
        }
    }
    cout << "Yes" << el;
}



Measured memory_bytes: 256
n,a,b = map(int,input().split(" "))
s = input()
accept = a+b
for i in range(len(s)):
  if s[i] == "c":
    print("No")
  elif accept <= 0:
    print("No")
  elif s[i] == "a":
    print("Yes")
    accept -= 1
  elif s[i] == "b" and b > 0:
    print("Yes")
    b -= 1
    accept -= 1
  else:
    print("No")

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

using namespace std;

int main()
{
  int n, m; cin >> n >> m;
  int a[100005] = {};
  
  int x = 0, y = 0;
  while (m--) {
    int p; string s; cin >> p >> s;
    if (a[p] == -1) continue;
    if (s == "AC") {++x; y += a[p]; a[p] = -1;}
    else ++a[p];
  }
  
  cout << x << ' ' << y << endl;
  return 0;
}

Measured memory_bytes: 640
s = input()

l = len(s)

ok = True
for i in range(l):
    if i % 2 == 1:
        if s[i] == 'R':
            ok = False
    if i % 2 == 0:
        if s[i] == 'L':
            ok = False

print("Yes" if ok else "No")


Measured memory_bytes: 38484