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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);
#define eps 1e-9



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];



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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;

	//string s1[100],s2;

	char s1[100][100];

	int ara[n_size],ara2[n_size];

	cin>>n>>m;

	f(i,0,n-1){
        f(j,0,m-1){
            cin>>s1[i][j];
        }
	}



	f(i,0,n-1){

        f(j,0,m-1){
            count=0;
            if(s1[i][j]=='#'){
                if(i+1<n && s1[i+1][j]!='#') count++;
                if(j+1<m && s1[i][j+1]!='#') count++;
                if(i-1>=0 && s1[i-1][j]!='#') count++;
                if(j-1>=0 && s1[i][j-1]!='#') count++;
            }
            if((i==0 && j==0) || (i==0 && j==m-1) || (i==n-1 && j==0) || (i==n-1 && j==m-1)){
                if(count==2) cout<<"No"<<endl,exit(0);
            }

            else if((i==0 && (j>0 && j<n-1)) || (i==n-1 && (j>0 && j<n-1)) || ((i>0 && i<n-1) && j==0) || ((i>0 && i<n-1) && j==m-1)){
                if(count==3) cout<<"No"<<endl,exit(0);
            }
            else if(count==4) cout<<"No"<<endl,exit(0);
        }
	}
    cout<<"Yes"<<endl;
}


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

// ABCテンプレート

#define rep(i,n) for (int i = 0; i<(n); i++)
#define in(n) cin >> (n)
#define out(ans) cout << (ans) << endl;
#define keta(n) cout << fixed << setprecision((n));
using ll = int64_t;
using v = vector<int>;


int main() {
  string S, T;
  cin >> S >> T;
  int ans = T.size();
  for(int i=0; i<=S.size()-T.size(); i++) {
    int jud = 0;
    for(int j=0; j<T.size(); j++) {
      if(S.at(i+j)!=T.at(j)) jud++;
    }
    ans = min(ans, jud);
  }
  cout << ans;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <cstring>
using namespace std;

int dx[] = {0, -1, 0, 1};
int dy[] = {-1, 0, 1, 0};
char dir[] = {'U', 'L', 'D', 'R'};

int W,H;
string field[10];

string solve(int x, int y, int d, int c, string str)
{
	if(c == 0)	return str;
	

	string res;
	for(int i=-1; i<2; i++) {
		bool ok = false;
		int nx=x, ny=y, nd=(d+i+4)%4;
		while(1) {
			nx += dx[nd]; ny+=dy[nd];
			if(nx<0||ny<0||nx>=W||ny>=H) break;
			if(field[ny][nx]=='o') {
				ok=true;
				break;
			}
		}

		if(ok) {
			field[ny][nx] = '.';
			res = max(res, solve(nx,ny,nd,c-1,str+dir[nd]));
			field[ny][nx] = 'o';
		}

	}

	return res;
}

int main()
{
	cin >> H >> W;
	for(int i=0; i<H; i++)
		cin >> field[i];

	int sx,sy,sd,cnt=0;
	for(int i=0; i<H; i++)
	for(int j=0; j<W; j++)
	{
		if(field[i][j] == 'o') cnt++;

		if(field[i][j]=='U') sd = 0;
		if(field[i][j]=='L') sd = 1;
		if(field[i][j]=='D') sd = 2;
		if(field[i][j]=='R') sd = 3;

		if(isupper(field[i][j])) {
			sx=j; sy=i;
		}
	}

	cout << solve(sx,sy,sd,cnt,"") << endl;
}

Measured memory_bytes: 0
// Undone
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MOD 1000000007
using namespace std;
int student[100100][2000];
stack<int> login[1010];
signed main() {
  int N, M, r, q;
  while (cin >> N >> M, N+M) {
    // initialize
    for (int i = 0; i < M; i++) {
      for (int j = 540; j < 1261; j++) {
        student[i][j] = 0;
      }
    }

    // input
    cin >> r;
    for (int i = 0; i < r; i++) {
      int t, n, m, s;
      cin >> t >> n >> m >> s;
      if (s) {
        // login
        login[n].push(t);
      } else {
        // logout
        for (int j = login[n].top(); j < t; j++) {
          student[m][j] = 1;
        }
        login[n].pop();
      }
    }
    
    // output
    cin >> q;
    for (int i = 0; i < q; i++) {
      int t, u, m;
      cin >> t >> u >> m;
      int ans = 0;
      for (int j = t; j < u; j++) {
        ans += student[m][j];
      }
      cout << ans << endl;
    }
  }  
}




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

//////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////// ここからコピペ ////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////

// N*M型行列
template<typename T = int64_t>
class Matrix {
private:
	class RowVector {
	private:
		std::vector<T> container_;
	
	public:
		RowVector(const int column_size)
			: container_(column_size){}
		T& operator[](const int c) { return container_[c]; }
		const T& operator[](const int c) const { return container_[c]; }
	};

	std::vector<RowVector> container_;

public:
	const int N, M;
	Matrix(const int row_size, const int column_size)
		: N(row_size), M(column_size), container_(row_size, RowVector(column_size)){}
	Matrix(Matrix<T>&& mat)
		: N(mat.N), M(mat.M), container_(std::move(mat.container_)){}
	Matrix(Matrix<T>& mat)
		: N(mat.N), M(mat.M), container_(mat.container_){}
	RowVector& operator[](const int r) { return container_[r]; }
	const RowVector& operator[](const int r) const { return container_[r]; }

	// 環の演算
	Matrix<T> operator+(const Matrix<T>& mat) const
	{
		Matrix<T> ret{*this};
		for (int r_i{}; r_i < N; r_i++)
			for (int c_i{}; c_i < M; c_i++)
				ret[r_i][c_i] += mat[r_i][c_i];
		return std::move(ret);
	}
	Matrix<T> operator-(const Matrix<T>& mat) const
	{
		Matrix<T> ret{*this};
		for (int r_i{}; r_i < N; r_i++)
			for (int c_i{}; c_i < M; c_i++)
				ret[r_i][c_i] -= mat[r_i][c_i];
		return std::move(ret);
	}
	Matrix<T> operator*(const Matrix<T>& mat) const
	{
		Matrix<T> ret(this->N, mat.M);
		for (int r_i{}; r_i < this->N; r_i++)
			for (int c_i{}; c_i < mat.M; c_i++)
				for (int l_i{}; l_i < this->M; l_i++)
					ret[r_i][c_i] += (*this)[r_i][l_i] * mat[l_i][c_i];
		return std::move(ret);
	}
	std::vector<T> operator*(const std::vector<T>& vec) const
	{
		std::vector<T> ret(N);
		for (int r_i{}; r_i < N; r_i++)
			for (int c_i{}; c_i < M; c_i++)
				ret[r_i] += (*this)[r_i][c_i] * vec[c_i];
		return std::move(ret);
	}

	// 代入演算子
	Matrix<T>& operator+=(const Matrix& mat)
	{
		*this = *this + mat;
		return *this;
	}
	Matrix<T>& operator-=(const Matrix& mat)
	{
		*this = *this - mat;
		return *this;
	}
	Matrix<T>& operator*=(const Matrix& mat)
	{
		*this = *this * mat;
		return *this;
	}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////// ここまでコピペ ////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=3035
int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	Matrix<> A(n, m);
	for (int i{}; i < n; i++)
		for (int j{}; j < m; j++)
			scanf("%lld", &A[i][j]);
	std::vector<int64_t> b(m);
	for (auto& e: b)
		scanf("%lld", &e);
	std::vector<int64_t> c(A * b);
	for (auto& e: c) printf("%lld\n", e);
	return 0;
}


Measured memory_bytes: 3256
#include <stdio.h>
int main(){
	int n,q,i,j,min,max;
	scanf("%d %d",&n,&q);
	char s[n+1],t[q],d[q];
	scanf("%s",s);
	for(i=0;i<q;i++)scanf("\n%c %c",&t[i],&d[i]);
	for(min=0,max=n-1,i=q-1;i>=0;i--){
		switch(d[i]){
		case 'R':
			if(t[i]==s[max])max--;
			if(min>0&&t[i]==s[min-1])min--;
			break;
		case 'L':
			if(t[i] ==s[min])min++;
			if(max<n-1&&t[i]==s[max+1])max++;
			break;
		}
	}
	printf("%d",max-min+1);
}

Measured memory_bytes: 768
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

ll K;
unordered_map<ll, unordered_map<ll, ll>> count_memo;

ll count_lunlun(ll i, ll n) {
    if (count_memo[i].find(n) != count_memo[i].end()) {
        return count_memo[i][n];
    }
    ll ret = 0;
    if (i == 0) {
        ret = 1;
    } else {
        if (n == 0) {
            ret = count_lunlun(i-1, 0) + count_lunlun(i-1, 1);
        } else if (n == 9) {
            ret = count_lunlun(i-1, 9) + count_lunlun(i-1, 8);
        } else {
            ret = count_lunlun(i-1, n-1) + count_lunlun(i-1, n) + count_lunlun(i-1, n+1);
        }
    }
    count_memo[i][n] = ret;
    return ret;
}

ll count_lunlun_len(ll len) {
    ll ans = 0;
    rep(n,1,10) {
        ans += count_lunlun(len-1, n);
    }
    return ans;
}

int main() {
    cin >> K;
    ll len = 1;
    vector<ll> count_leq_len;
    count_leq_len.push_back(0);
    while (true) {
        ll cnt = count_lunlun_len(len);
        count_leq_len.push_back(cnt + count_leq_len.back());
        if (count_leq_len.back() >= K) {
            break;
        }
        len++;
    }
    vector<ll> ans;
    rep(i,0,len) {
        ll cnt_below;
        ll start;
        ll end;
        if (i == 0) {
            start = 1;
            end = 10;
            cnt_below = count_leq_len[len-1];
        } else {
            ll pre = ans.back();
            start = max(pre-1, (ll)0);
            end = min(pre+1, (ll)9)+1;
            cnt_below = 0;
        }
        rep(digit,start,end) {
            ll cnt = count_lunlun(len-1-i, digit);
            if (cnt_below + cnt >= K) {
                ans.push_back(digit);
                break;
            }
            cnt_below += cnt;
        }
        K -= cnt_below;
    }
    rep(i,0,len) {
        cout << ans[i];
    }
    cout << endl;
}


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

int main() {
  string c;
  cin>>c;
  if(c.at(0)=='7'){
    cout<<"Yes"<<endl;
  }else if(c.at(1)=='7'){
    cout<<"Yes"<<endl;
  }else if(c.at(2)=='7'){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  
  
}



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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

int main() {
	int n, m;
	cin >> n >> m;
	
	vector< vector< int > > dst(n, vector< int >(n, 1 << 29));
	for_(i,0,n) dst[i][i] = 0;
	
	struct Edge { int u, v, c; };
	vector< Edge > edges;
	for_(i,0,m) {
		int u, v, c;
		cin >> u >> v >> c;
		--u; --v;
		edges.push_back(Edge{u, v, c});
		dst[u][v] = dst[v][u] = c;
	}
	
	for_(k,0,n) for_(i,0,n) for_(j,0,n) dst[i][j] = min(dst[i][j], dst[i][k] + dst[k][j]);
	
	int ans = 0;
	for (Edge e : edges) if (dst[e.u][e.v] < e.c) ++ans;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

int main(void)
{
    long long int sum=0,range=0;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=0,money;
    long long int a1,a2,a3;
    //vector <int> v;
    //float f,g,h;
    //int c,d,big=0;
    string s,s1;
    cin>>a1>>a2>>n;
    if(a1>=n) cout<<a1-n<<" "<<a2;
    else
    {
        n-=a1;
        if(a2>=n) cout<<0<<" "<<a2-n;
        else cout<<"0 0";
    }
    return 0;
}





Measured memory_bytes: 256
l,s = [],0
for _ in range(5):
    l.append(int(input()))
if len(set(l))==1:
    if l[0]%10 != 0:
        s = (10-(l[0]%10))*4
    print(sum(l) + s)
else:
    a = list(i%10 for i in l)
    b = list(10-i if i%10 else 0 for i in a)
    p = b.index(max(b))
    ans = 0
    for i in range(5):
        if l[i] != l[p]:
            ans += l[i]
            ans += b[i]
    print(ans+l[p])

Measured memory_bytes: 9192
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
const int INF = 1001001001;

int main()
{
    int n;
    in n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n-1);

    rep(i,n)
    {
        in a[i];
        a[i]--;
    }
    rep(i,n)in b[i];
    rep(i,n-1)in c[i];

    int ans=0;
    rep(i,n)
    {
        ans+=b[a[i]];
        if(i>0&&a[i]==a[i-1]+1)ans+=c[a[i-1]];
    }
    cout<<ans<<endl;
}


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

int main() {
  long n,a,ans;
  cin >> n;
  ans=n;
  map<long,long> mp;
  for(long i=0;i<n;i++) {
    cin >> a;
    mp[a]++;
    if(a==mp[a]) ans-=a;
  }
  cout << ans << endl;
}

Measured memory_bytes: 9568
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

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



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;



int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		if (i % 2 == 0) {
			if (s[i] == 'L') {
				cout << "No" << endl;
				return 0;
			}
		}
		else {
			if (s[i] == 'R') {
				cout << "No" << endl;
				return 0;
			}

		}
	}

	cout << "Yes" << endl;
}


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

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

  for(int x=0;x<=k;x++){
    for(int y=0;y<=k;y++){
      int z=s-x-y;
      if(z>=0&&z<=k){
        ans++;
      }
    }
  }

  cout<<ans<<endl;
  
  return 0;

}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int[] wt = new int[n];
        int[] v = new int[n];

        for(int i = 0; i < n; i++){
            wt[i] = sc.nextInt();
            v[i] = sc.nextInt();
        }

        long[][] dp = new long[n+1][w+1];

        for(int i = 0; i < n+1; i++){
            dp[i][0] = 0;
        }

        for(int i = 0; i < w+1; i++){
            dp[0][i] = 0;
        }

        for(int i = 1; i < n+1; i++){
            for(int j = 1; j < w+1; j++){
                dp[i][j] = Math.max(dp[i-1][j],j-wt[i-1] >= 0 ? dp[i-1][j-wt[i-1]]+v[i-1] : 0);
            }
        }

        System.out.println(dp[n][w]);
    }
}


Measured memory_bytes: 133460
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int n;
class ed {
public:
	int s, t, w;
	ed(int s, int t, int w) : s(s), t(t), w(w) {};
	bool operator < (const ed &e) const{
		return w < e.w;
	}
};
vector<ed> v;
class djs {
public:
	vector<int> rank;
	int p[10000];
	djs(int size) {
		rank.resize(size, 0);
		for (int i = 0; i < size; i++) p[i] = i;
	}
	int findset(int k) {
		if (p[k] != k) {
			p[k] = findset(p[k]);
		}
		return p[k];
	}
	bool same(int x, int y) { return findset(x) == findset(y); }
	void merge(int x, int y) {
		int a = findset(x);
		int b = findset(y);
		if (rank[a] > rank[b]) {
			p[b] = a;
		}
		else {
			p[a] = b;
			if (rank[a] == rank[b]) rank[b]++;
		}
	}
};
inline void solve() {
	int sum = 0;
	sort(v.begin(), v.end());
	djs d(n);
	for (int i = 0; i < v.size(); i++) {
		if (!d.same(v[i].s, v[i].t)) { 
			sum += v[i].w; 
			d.merge(v[i].s, v[i].t);
		}
	}
	cout << sum << endl;
}
int main() {
	int e, s, t, w;
	cin >> n >> e;
	for (int i = 0; i < e; i++) {
		cin >> s >> t >> w;
		v.push_back(ed(s, t, w));
	}
	solve();
	return 0;
}

Measured memory_bytes: 4524
#include <cstdio>
using namespace std;
int vis[3][3];
int arr[3][3];
int main(){
    for(int i = 0; i < 3; i ++){
        for(int j = 0; j < 3; j ++){
            scanf("%d", &arr[i][j]);
        }
    }
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i ++){
        int num;
        scanf("%d", &num);
        for(int ii = 0; ii < 3; ii ++){
            for(int jj = 0; jj < 3; jj ++){
                if(arr[ii][jj] == num){
                    vis[ii][jj] = 1;
                }
            }
        }
    }
    for(int i = 0; i < 3; i ++){
        int flag = 1;
        for(int j = 0; j < 3; j ++){
            if(!vis[i][j]){
                flag = 0;
                break;
            }
        }
        if(flag){
            printf("Yes\n");
            return 0;
        }
    }
    for(int i = 0; i < 3; i ++){
        int flag = 1;
        for(int j = 0; j < 3; j ++){
            if(!vis[j][i]){
                flag = 0;
                break;
            }
        }
        if(flag){
            printf("Yes\n");
            return 0;
        }
    }
    int flag = 1;
    for(int i = 0; i < 3; i ++){
        if(!vis[i][i]) {
            flag = 0;
            break;
        }
    }
    if(flag){
        printf("Yes\n");
        return 0;
    }
    flag = 1;
    for(int i = 0; i < 3; i ++){
        if(!vis[i][2 - i]){
            flag = 0;
            break;
        }
    }
    if(flag){
        printf("Yes\n");
        return 0;
    }
    printf("No\n");
    return 0;
}


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

int main()
{
	int a,b;
	cin >> a >> b;
	int ans = 0;
	int n =0;
	for(ans = 1;ans<b;)
	{
		n++;
		ans -=1;
		ans += a;
	}	
	cout<<n<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = INT_MAX;
const ll LLINF = LLONG_MAX;
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cout<<"!"<<endl
#define SHOW(a,b) cout<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cout<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
  
#define DIV 1000000007
typedef vector<ll> Array;
typedef vector<Array> matrix;
typedef tuple<int,int,int> tiii;
#define mt make_tuple

ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if(n&1==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}

int main(){
  string s;
  cin >> s;
  cout  << "ABC" + s << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int m = sc.nextInt();
        int d = sc.nextInt();

        int count = 0;
        int ones = 0;
        int tens = 0;

        if(d > 21) {
            for(int i = 22; i <= d; i++) {
                ones = i % 10;
                tens = i / 10;
                if(ones > 1) {
                    if(ones * tens <= m) {
                        count++;
                    }
                }

            }
        }
        //System.out.println(ones + " " + tens);
        System.out.println(count);

    }

}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll a[311][311];
ll ans=0;
int main()
{
	cin >>n;
	for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)
	cin >>a[i][j];
	for (int i=0;i<n;i++)
	for (int j=0;j<i;j++)
	{
		ll w=a[i][j]+1;
		for(int k=0;k<n;k++)
		{
			if(i==k||j==k)
			continue;
			w = min(w, a[i][k] + a[k][j]);
		}
		if (w < a[i][j])
		{
			printf("-1\n");
			return 0;
		}
			if (w > a[i][j]) ans += a[i][j];
		}
	cout <<ans;
	return 0;
}

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

int main() {
  int H,N;
  cin >> H>>N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
 
 int a=0;
 for(int i=0; i<N; i++){
  a+=A.at(i);
 }
  
    if(a>=H){
      cout<<"Yes"<<endl;
    }
    if(a<H){
      
  
  cout<<"No"<<endl;
    }
  

}

Measured memory_bytes: 640
// $%D%$.$%M%$.$%Y%$
// $%h%$:$%m%$:$%s%$

#pragma GCC optimize("O3")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define IOS ios::sync_with_stdio(false); cin.tie(0)
#define ll long long
#define ld long double
#define rep(i,a,n) for (int i=(int)(a);i<(int)(n);i++)
#define per(i,a,n) for (int i=(int)(n-1);i>=(int)(a);i--)
#define mp(a, b) make_pair(a, b)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define fi first
#define se second


const int MOD = 998244353; // = (119<<23)+1
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = 4*atan((ld)1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};




int main() {
    int n, k;
    cin >> n >> k;
    vector<int> dp(n + 1);
    dp[0] = 1;
    vector<int> pref(n + 2);
    pref[1] = 1;
    vector<pii> da(k);

    for (int i = 0; i < k; ++i) {
        cin >> da[i].first >> da[i].second;
    }
    for (int i = 1; i <= n; ++i) {
        for (auto x : da) {
            int l = i - x.second;
            int r = i - x.first + 1;
            dp[i] = (dp[i] + (pref[max(0, r)] - pref[max(0, l)] + MOD) % MOD) % MOD;
        }
        pref[i + 1] = (pref[i] + dp[i]) % MOD;
    }
    cout << dp[n - 1] << '\n';

}

Measured memory_bytes: 4836
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<climits>
#include<bitset>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
inline int read(){
    int f=1,ans=0;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}
    return f*ans;
}
const int MAXN=3e5+11;
char str[MAXN];int N,S[MAXN];
int Q(int l,int r){if(l>r) return 0;return S[r]-S[l-1];}
int main(){
    N=read();scanf("%s",str+1);
    for(int i=1;i<=N;i++) S[i]=S[i-1]+(str[i]=='W');
    int Minn=N;
    for(int i=1;i<=N;i++){
        Minn=min(Minn,Q(1,i-1)+(N-i)-Q(i+1,N));
    }printf("%d\n",Minn);return 0;
}



Measured memory_bytes: 4636
#include <stdio.h>


/*struct heap{
  int key;

  };*/
int main(){
  int H,i;

  scanf("%d",&H);
  int A[H+1];

  for(i=1;i<H+1;i++){
    scanf("%d",&A[i]);

  }


  for(i=1;i<H+1;i++){
     if(i==1)printf("node %d: key = %d, left key = %d, right key = %d, \n",i,A[i],A[2*i],A[2*i+1]);
     else if((2*i)>=(H+1) && (2*i+1)>=(H+1))printf("node %d: key = %d, parent key = %d, \n",i,A[i],A[i/2],A[2*i]);
     else if((2*i+1)>=(H+1))printf("node %d: key = %d, parent key = %d, left key = %d, \n",i,A[i],A[i/2],A[2*i]);
    else printf("node %d: key = %d, parent key = %d, left key = %d, right key = %d, \n",i,A[i],A[i/2],A[2*i],A[2*i+1]);
  }


  return 0;
}

Measured memory_bytes: 596
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {
    ll N,T;
    cin >> N >> T;
    ll out = 10000;
    rep(i,N){
      ll c,t;
      cin >> c >> t;
      if(t<=T) out = min(out,c);
    }
    if(out!=10000) cout << out << endl;
    else cout << "TLE" << endl;
    return 0;
}



Measured memory_bytes: 3620
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
typedef long long ll;

using namespace std;


int main() {
	vector<ll> v(3);
	rep(i, 3) cin >> v[i];
	sort(all(v));
	cout << v[0] * v[1] / 2 << endl;
}

Measured memory_bytes: 256
//Totka hai dosto
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
int n,m,q;
vector<int> a,b,c,d;
int ans=0;
void dfs(vector<int> s)
{
	if(s.size()==n+1)
	{
		int cur=0;
		for(int i=0;i<q;i++)
		{
			if(s[b[i]]-s[a[i]]==c[i])cur+=d[i];
		}
		ans=max(ans,cur);
		return;
	}
	s.push_back(s.back());
	while(s.back()<=m)
	{
		dfs(s);
		s.back()++;
	}
}
int32_t main()
{
	cin>>n>>m>>q;
	a=b=c=d=vector<int>(q);
	for(int i=0;i<q;i++)
	{
		cin>>a[i]>>b[i]>>c[i]>>d[i];
	}
	dfs(vector<int>(1,1));
	cout<<ans;
	
}

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

int main()
{
	// freopen("input.txt","r",stdin);
	string s;
	cin >>s;
	if(s == "Sunny")
		cout<<"Cloudy"<<endl;
	else if(s == "Cloudy")
		cout<<"Rainy"<<endl;
	else 
		cout<<"Sunny"<<endl;
	return 0;
}

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

P = sum(X)//N
P2 = P+1
P3 = P-1
def score(X,P):
    s = 0
    for i in range(N):
        s += (X[i]-P)**2
    return s
#print(P,P2,P3)
S0 = score(X,P)
S1 = score(X,P2)
S2 = score(X,P3)
#print(S0,S1,S2)
print(min(S0,S1,S2))

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

using namespace std;
typedef long long ll;

map<string,int>mp;

int main()
{
   string s;cin>>s;
   for(int i=0;i<s.size();i++){
     if(i%2==0&&s[i]=='L'){cout<<"No"<<endl;return 0;}
     if(i%2==1&&s[i]=='R') {cout<<"No"<<endl;return 0;}
   }
   cout<<"Yes"<<endl;
    return 0;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    if (a > b) {
        cout << "a > b" << endl;
    } else if (a == b) {
        cout << "a == b" << endl;
    } else {
        cout << "a < b" << endl;
    }
    return 0;
}




Measured memory_bytes: 3076
import java.util.Scanner;

//AtCoder Beginner Contest 141
//C	Attack Survival
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int K = Integer.parseInt(sc.next());
		int Q = Integer.parseInt(sc.next());

		long[] arrN = new long[N];
		for (int i = 0; i < Q; i++) {
			int a = Integer.parseInt(sc.next()) - 1;
			arrN[a]++;
		}
		sc.close();

		for (int n = 0; n < N; n++) {
			if (arrN[n] <= (Q - K)) {
				System.out.println("No");
			} else {
				System.out.println("Yes");
			}
		}
	}
}


Measured memory_bytes: 57256
using System;

namespace ABC145
{
    class Abc145b
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            var answer = false;
            if(N % 2 == 0) {
                var t1 = S.Substring(0, N / 2);
                var t2 = S.Substring(N / 2);
                if(Equals(t1, t2))
                    answer = true;
            }

            Console.WriteLine(answer ? "Yes" : "No");
        }
    }
}


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

int main()
{
		int a, b, d, r;
		long double f;
		cin >> a >> b;
		d = a/b;
		r = a%b;
		f = (long double)a/b;
		cout << d << " " << r << " ";
		cout << fixed << f << "\n";
}

Measured memory_bytes: 3200
c = [[]]*3

for i in range(3):
    c[i] = list(map(int, input().split()))
ans = 0
for i in range(3):
    ans += sum(c[i])

if ans % 3 == 0:
    arr = [[0]* 6]*3
    for i in range(3):
        arr[i][0] = c[i][0] - c[i][1]
        arr[i][1] = c[i][0] - c[i][2]
        arr[i][2] = c[i][1] - c[i][0]
        arr[i][3] = c[i][1] - c[i][2]
        arr[i][4] = c[i][2] - c[i][0]
        arr[i][5] = c[i][2] - c[i][1]
    for i in range(6):
        if arr[0][i] == arr[1][i] and arr[0][i] == arr[2][i]:
            continue
        else:
            print("No")
            exit(0)

    for i in range(3):
        arr[i][0] = c[0][i] - c[1][i]
        arr[i][1] = c[0][i] - c[2][i]
        arr[i][2] = c[1][i] - c[0][i]
        arr[i][3] = c[1][i] - c[2][i]
        arr[i][4] = c[2][i] - c[1][i]
        arr[i][5] = c[2][i] - c[0][i]
          

    for i in range(6):
        if arr[0][i] == arr[1][i] and arr[0][i] == arr[2][i]:
            continue
        else:
            print("No")
            exit(0)

    arr = [0]*3
    sum = 0
    for i in range(3):
        arr[0] += c[i][i]
    for i in range(3):
        if i + 1 < 3:
            arr[1] += c[i][i+1]
        else:
            arr[1] += c[i][0]
    for i in range(3):
        if i + 2 < 3:
            arr[2] += c[i][i+2]
        else:
            arr[2] += c[i][i-1]
    
    if arr[0] != arr[1] or arr[0] != arr[2]:
        print("No")
        exit(0)

    print("Yes")
    exit(0)

print("No")

Measured memory_bytes: 3192
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bits/c++config.h>
using namespace std;


int main()
{

   int sx,sy,tx,ty;

   cin >>sx>>sy>>tx>>ty;

   char up='u';
   char down = 'd';
   char right = 'r';
   char left = 'l';

   int h=ty - sy;
   int w=tx - sx;

   for (int a=0;a<h;a++)
   {
       cout << "U";

   }
   for (int b=0;b<w;b++)
   {
       cout << "R";
   }
   for (int c=0;c<h;c++)
   {
       cout << "D";

   }
   for (int d=0;d<w+1;d++)
   {
       cout << "L";
   }
    for (int e=0;e<h+1;e++)
   {
       cout << "U";

   }
      for (int g=0;g<w+1;g++)
   {
       cout << "R";
   }

   cout <<"DR";
     for (int f=0;f<h+1;f++)
   {
       cout << "D";

   }
   for (int i=0;i<w+1;i++)
   {
       cout << "L";
   }

   cout <<"U";
}



Measured memory_bytes: 256
#!/usr/bin/env pypy3


import heapq
import sys


M = 10 ** 15
INF = 10 * M


def dijkstra(num_vs, source, adj_vs, costs):
    min_dist = [INF for _ in range(num_vs)]
    min_dist[source] = 0
    pq = [(min_dist[i], i) for i in range(num_vs)]
    heapq.heapify(pq)
    while pq:
        min_dist_i, i = heapq.heappop(pq)
        for j in adj_vs[i]:
            new_length = min_dist[i] + costs[(i, j)]
            if new_length < min_dist[j]:
                min_dist[j] = new_length
                heapq.heappush(pq, (new_length, j))
    return min_dist


def max_values(n, s, t, adj_vs, yen_costs, snuke_costs):
    s_to_x_yen_dists = dijkstra(n, s, adj_vs, yen_costs)
    # s_to_x_snuke_dists = dijkstra(n, s, adj_vs, snuke_costs)
    # t_to_x_yen_dists = dijkstra(n, t, adj_vs, yen_costs)
    t_to_x_snuke_dists = dijkstra(n, t, adj_vs, snuke_costs)
    # 両替所 i を経由したときの残金
    p2r = [M - s_to_x_yen_dists[i] - t_to_x_snuke_dists[i] for i in range(n)]
    # print(p2r, file=sys.stderr)
    res = [p2r[n - 1]]
    for i in range(n - 1)[::-1]:
        new_r = p2r[i]
        if new_r > res[-1]:
            res.append(new_r)
        else:
            res.append(res[-1])
    res.reverse()
    # print(res, file=sys.stderr)
    return res


def main():
    n, m, s, t = (int(x) for x in input().split())
    s -= 1
    t -= 1
    yen_costs = dict()
    snuke_costs = dict()
    adj_vs = [set() for _ in range(n)]
    for _ in range(m):
        u, v, a, b = (int(x) for x in input().split())
        u -= 1
        v -= 1
        adj_vs[u].add(v)
        adj_vs[v].add(u)
        yen_costs[(u, v)] = yen_costs[(v, u)] = a
        snuke_costs[(u, v)] = snuke_costs[(v, u)] = b
    res = max_values(n, s, t, adj_vs, yen_costs, snuke_costs)
    for line in res:
        print(line)


if __name__ == '__main__':
    main()


Measured memory_bytes: 110816
#include "bits/stdc++.h"
using namespace std;int main(){int n,x,y,a[2020];cin>>n>>x>>y;for(int i=0;i<n;i++)cin>>a[i];n==1?cout<<abs(y-a[n-1]):cout<<max(abs(y-a[n-1]),abs(a[n-1]-a[n-2]));}	

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  string S;
  int w;
  cin >> S >> w;
  for (int i = 0; i < S.length(); i++)
  {
    if (i % w == 0)
      cout << S[i];
  }
  cout << '\n';
  return 0;
}

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

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

#define fr first
#define sc second

int main(){
	string s;
	cin >> s;
	int n = s.size();
	//s = "1" + s;
	if(s[0] == '0' || s[n-1] == '1'){
		puts("-1");
		return 0;
	}
	vector<int> vec;
	for(int i = 0 ; i*2 <= n-2 ; i ++){
		if(s[i] != s[n-2-i]){
			puts("-1");
			return 0;
		}
		else if(s[i] == '1' && i > 0){
			vec.push_back(i);
		}
	}
	
	int v = 1,cnt = 1;
	for(int i = 0 ; i < vec.size() ; i ++){
		while(cnt <= vec[i]){
			printf("%d %d\n",cnt+1,v);
			cnt ++;
		}
		printf("%d %d\n",v,cnt+1);
		cnt ++;
		v = cnt;
	}
	for(int i = cnt+1 ; i <= n ; i ++){
		printf("%d %d\n",v,i);
	}
}



Measured memory_bytes: 1916
// head{{{
/* vim: set foldmethod=marker ft=cpp: */
#include <iostream>
#include <list>
#pragma GCC optimize("O3")
using namespace std;
// }}}
 
int main() {
    //optimize{{{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //---------}}}

    // A op B
    // A,B is int(not float or double)
    // op is + or -
    // cin is 'A op B'
    // I have to output diff.
    int A,B;
    char op;
    cin >> A >> op >> B;
    if (op == '+')
        cout << A + B << endl;
    else if (op == '-')
        cout << A - B << endl;

}



Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
//using namespace atcoder;
const int Mod = 1000000007;
class mll {
public:
	long long x;
	mll(long long x = 0) : x((x% Mod + Mod) % Mod) {};
	void operator - () {
		x = (-x % Mod + Mod) % Mod;
	}
	void operator += (const mll& a) {
		if ((x += a.x) >= Mod) x -= Mod;
	}
	void operator ++ () {
		*this += 1;
	}
	void operator ++(int) {
		operator++();
	}
	void operator -= (const mll& a) {
		if ((x += Mod - a.x) >= Mod) x -= Mod;
	}
	void operator *= (const mll& a) {
		(x *= a.x) %= Mod;
	}
	void operator /= (const mll& a) {
		mll b = a.inv();
		(x *= b.x) %= Mod;
	}
	mll operator + (const mll& a) const {
		mll ans = *this;
		ans += a;
		return ans;
	}
	mll operator - (const mll& a) const {
		mll ans = *this;
		ans -= a;
		return ans;
	}
	mll operator * (const mll& a) const {
		mll ans = *this;
		ans *= a;
		return ans;
	}
	bool operator < (const mll& a) {
		return this->x < a.x;
	}
	void pow(long long n) {
		long long xx = x;
		x = 1;
		while (n > 0) {
			if (n & 1) x = x * xx % Mod;
			xx = xx * xx % Mod;
			n >>= 1;
		}
	}
	mll inv() const {
		long long a = x, b = Mod, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= Mod;
		if (u < 0) u += Mod;
		a = u;
		return mll(a);
	}

};

mll calc(int N, int i, vector<mll>& Memo) {
	if (i >= N) return 1ll;
	if (Memo[i].x > 0) return Memo[i];
	Memo[i] = calc(N, i + 1, Memo) + calc(N, i + 3, Memo);
	return Memo[i];
}

int main() {
	int S;
	cin >> S;
	if (S < 3) {
		cout << 0 << endl;
		return 0;
	}
	if (S < 5) {
		cout << 1 << endl;
		return 0;
	}
	vector<mll> Memo(S - 5, 0ll);
	cout << calc(S - 5, 0, Memo).x << endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

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

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    vector<int> A(3);
    REP(i,3)cin >> A[i];
    sort(ALL(A));
    cout << A[2]-A[0] << "\n";
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = sc.nextInt();
    int ans = 1;
    int place = 0;
    for(int i=0;i<n;i++){
      int a = sc.nextInt();
      place += a;
      if(place <= x){
        ans++;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21972
n = $stdin.gets.chop!
t = $stdin.gets

n = n.to_i
t = t.split

inc = 0
for e in 0...t.length
    t[e] = t[e].to_i
    inc += t[e]
end

str = ""
str =  inc - t.max > t.max ? "Yes" : "No"

print str

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;


int main()
{
    vector<vector<int>> c(3,vector<int>(3));
    rep(i,3)rep(k,3)cin >> c[i][k];
    vector<int> a(3),b(3);
    for(int i=0;i<=100;i++)
    {
        a[0]=i;
        b[0]=c[0][0]-i;
        if(b[0]<0)continue;
        for(int k=0;k<=100;k++)
        {
            a[1]=k;
            b[1]=c[1][1]-k;
            if(b[1]<0)continue;
            for(int k=0;k<=100;k++)
            {
                a[2]=k;
                b[2]=c[2][2]-k;
                if(b[2]<0)continue;
                bool ok=true;
                for(int t=0;t<=2;t++)for(int p=0;p<=2;p++)
                {
                    if(c[t][p]==a[t]+b[p])continue;
                    ok = false;
                    break;
                }
                if(ok)
                {
                    cout<<"Yes"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#ifndef LOCAL
#define endl '\n'
#endif

const int mod = 1e9 + 7;

int pwr(int a,int b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

const int N = 2e5 + 5;
int a[N];
ll pre_e[N], pre_o[N];
ll dp_even[N], dp_odd[N];

void solve() {
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
		pre_e[i] = pre_e[i - 1];
		pre_o[i] = pre_o[i - 1];
		if(i & 1)
			pre_o[i] += a[i];
		else
			pre_e[i] += a[i];
	}
	ll maxi = -1e18;
	dp_even[2] = max(a[1], a[2]);
	for(int i = 4; i <= n; i += 2) {
		maxi = max(maxi, pre_o[i - 3] - pre_e[i - 1]);
		dp_even[i] = pre_e[i];
		dp_even[i] = max(dp_even[i], pre_e[i] + maxi);
	}
	if(n % 2 == 0) {
		cout << dp_even[n];
		return ;
	}
	for(int i = 3; i <= n; i += 2) {
		dp_odd[i] = -1e18;
		dp_odd[i] = max(dp_odd[i], pre_o[i]);
		dp_odd[i] = max(dp_odd[i], dp_odd[i - 2] + a[i]);
		dp_odd[i] = max(dp_odd[i], dp_even[i - 3] + a[i - 1]);
	}
	cout << dp_odd[n];
}

int main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	// cin >> t;
	t = 1;
	for(int tt = 1; tt <= t; tt++) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 10672
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

constexpr ll INF = 1e16;
constexpr ll MOD = 1000000007;

#define rep(i, N) for(ll i=0; i<(N); ++i)

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


ll max(ll a, ll b) {return a < b ? b : a; }
ll min(ll a, ll b) {return a > b ? b : a; }
double maxf(double a, double b) { return a < b ? b : a; }

template<typename T> inline string toString(const T &a) {
  ostringstream oss; oss << a; return oss.str();
}

ll gcd(ll x, ll y) { return x % y ? gcd(y, x % y) : y; }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  map<string, int> mp;
  rep(i, N) {
    string S;
    cin >> S;
    ++mp[S];
  }
  int mv = 0;
  for(auto m : mp) {
    if(m.second > mv) mv = m.second;
  }
  for(auto m : mp) {
    if(m.second == mv) cout << m.first << endl;
  }  
}


Measured memory_bytes: 26752
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int h,w;
    cin>>h>>w;
    int tate[101]={0};
    int yoko[101]={0};
    int map[101][101]={0};
    char c;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>c;
            if(c=='#'){
                map[i][j]=1;
            }
            else{
                yoko[i]++;
                tate[j]++;
            }
        }
    }
    /*for(int i=0;i<h;i++){
        cout<<yoko[i]<<endl;
    }*/
    for(int i=0;i<h;i++){
        if(yoko[i]!=w){
            for(int j=0;j<w;j++){
                if(tate[j]!=h){
                    if(map[i][j]==0){
                        cout<<'.';
                    }
                    else{
                        cout<<'#';
                    }
                }
            }
            cout<<endl;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  int a=0;
  vector<int> v(N);
  for(int i=0; i < N;i++){
  cin >> v.at(i);
    if(v.at(i) !=i+1){
      a++;
    }
  
  }
  if(a>2){
    cout << "NO" <<endl;
  }
    else{
      cout << "YES" <<endl;
    }
  }



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

using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
static const ll maxLL = (ll)1 << 62;

ll c[500] = {};
ll S[500] = {};
ll F[500] = {};

int main() {
	ll N; cin >> N;
	rep(i, 1, N)cin >> c[i] >> S[i] >> F[i];

	ll ct = 0;
	ll wt = 0;
	ll cs = 1;
	rep(i, 1, N) {
		// i station
		ct = S[i];
		ct += c[i];

		rep(j, i + 1, N) {
			//already departed
			ll wt = 0;
			if (ct > S[j]) {
				if ((ct - S[j]) % F[j] == 0) {
					wt = 0;
				}
				else {
					wt = F[j] - (ct - S[j]) % F[j];
				}
			}
			else {
				wt = (S[j] - ct);
			}

			ct += wt;
			ct += c[j];
		}
		cout << ct << endl;
	}

	cout << 0 << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scTmp = new Scanner(System.in);) {

			String sTmp = scTmp.nextLine();
			String sOut = "";
			int iLen = sTmp.length();

			for (int i = 0; i < iLen; i++) {
				char cTmp = sTmp.charAt(i);
				switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				}
			}

			System.out.println(sOut);
		}
	}
}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
#define INF (1e9)

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> p(N);
  for (ll i = 0; i < N; i++) {
    cin >> p[i];
  }
  sort(p.begin(), p.end());  // 昇順

  ll ans = 0;
  for (int i = 0; i < K; i++) {
    ans += p[i];
  }

  cout << ans << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define R cin>>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long unsigned int ll;
int main(){
    int N, A;
    cin >> N >> A;
    int l = A;
    int r = A + N - 1;
    int eat;
    if (r <= 0) eat = r;
    else if (l >= 0) eat = l;
    else eat = 0;

    int ans = (r+l) * N / 2 - eat;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import numpy as np
n = int(input())

x = []
y = []

for i in range(n):
    a, b = map(int, input().split())
    x.append(a)
    y.append(b)

x, y = np.array(x), np.array(y)

idx = np.argsort(y)
x = x[idx]
y = y[idx]

t = 0
for i in range(n):
    t += x[i]
    if y[i] < t:
        print("No")
        quit()
print("Yes")


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

using std::cin;
using std::cout;
using std::endl;
using std::string;

int main()
{
	string in, ans;

	// input
	cin >> in;

	if (in == "ABC") {
		ans = "ARC";
	}
	else {
		ans = "ABC";
	}

	cout << ans;
	cout << endl;

	return 0;
}


Measured memory_bytes: 3600