akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define int 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<double,double>pdd;
int dp[303][101][101]; // dp[w][N][cnt]
signed main(){
    memset(dp, 0, sizeof(dp));
    int N,W; cin>>N>>W;
    int dif=0;
    vector<int>w;
    vector<int>v;
    rep(i,N){
        int _w,_v;
        cin>>_w>>_v;
        if(!i){
            dif=_w-1;
        }
        v.push_back(_v);
        w.push_back(_w-dif);
        if(_w<W)dp[_w-dif][i][1]=_v;
    }
    rep(i,303){
        rep(j,N-1){
            rep(k,N){
                if(dp[i][j][k]==0)continue;
                cmax(dp[i][j+1][k],dp[i][j][k]);
                if(dif*k+i+w[j+1]+dif>W)continue;
                if(dp[i+w[j+1]][j+1][k+1]<dp[i][j][k]+v[j+1])
                    dp[i+w[j+1]][j+1][k+1]=dp[i][j][k]+v[j+1];
            }
        }
    }
    int ans=0;
    rep(i,301)rep(j,N)rep(k,101)if(dp[i][j][k])cmax(ans, dp[i][j][k]);
    cout<<ans<<endl;
}


Measured memory_bytes: 24448
/*                                  /   \                                                                   (Hello)//JSM//*/      
/*                                 /*****\                                                                              */
/*     Jai Shree Mataji           /       \ |\| |_| $ |-| K                                                            */
#include<vector>
#include<iostream>
#include<algorithm>                
#include<string.h>                 
#include<bits/stdc++.h>            
#include<cstring>                  
#include<map>                     
#include<cmath>                  
#include<set>
using namespace std;            
#define ll long long int        
#define ld long double
#define MOD 1000000007 
#define PI 3.1415926535897932384626433832795                                               
#define YY cout<<"YES"
#define NN cout<<"NO"
#define Yy cout<<"Yes"
#define Nn cout<<"No"
#define yy cout<<"yes"
#define nn cout<<"no"
#define EE cout<<"\n"
#define ee cout<<"\n"
#define ne cout<<"-1"
#define pb push_back 
#define fi first
#define se second
#define mkp make_pair    
#define mkt make_tuple
#define sall(v ) sort(v.begin(), v.end())      
#define all(v )  v.begin(), v.end()      
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
#define vl vector<ll>
#define vc vector<char> 
#define vll vector< pair<ll,ll> > 
#define mps map<string ,ll>
#define mpc map<char ,ll>
#define mpl map<ll, ll>
#define pr pair<ll,ll>
ll pd(ll x,ll y){if(x%y==0) return x/y;else return x/y+1;}
ll pow1(ll n,ll p){if(p==0)return 1;ll x=pow1(n, p/2);x=(x*x)%MOD;if(p%2==0) return x;else return (x*n)%MOD;}
ll mx=0;
vl v[200005];
ll vis[200005];
ll d=0;
void dfs(ll node)
{
	if(vis[node]==1)
	return ;
	vis[node]=1;
    d++;
    fo(i,v[node].size())
    {
    	dfs(v[node][i]);
	}
} 
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);	
	  ll tt=1;

//	   cin>>tt;
	      while(tt--)
{
	//anushk
	
	/*
	4 10
1 2
2 1
1 2
2 1
1 2
1 3
1 4
2 3
2 4
3 4*/
ll n,m,j,k,i;
cin>>n>>m;
ll a[m],b[m];
fo(i,m)
{
	cin>>a[i]>>b[i];
	v[b[i]].pb(a[i]);
	v[a[i]].pb(b[i]);
}
mx=0;
fo(i,n)
vis[i+1]=0;
fo(i,n)
{
	if(vis[i+1]==0)
	{   d=0;
		dfs(i+1);
	}
	mx=max(mx,d);
}
cout<<mx;
ee;


}
return 0;
}



Measured memory_bytes: 25484
#include<stdio.h>

int main(){
    int l,a,b,c,d,i;

    scanf("%d%d%d%d%d",&l,&a,&b,&c,&d);

    while(l--,a-=c,b-=d,a>0||b>0);
    printf("%d\n",l);
    return 0;
}

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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


void solve(){
    ll n,x;
    cin>>n>>x;
    if(x==1||x==2*n-1){
        cout<<"No"<<en;
        return;
    }

    cout<<"Yes"<<en;
    if(n==x){
        REP(i,2*n-1) cout<<i+1<<en;
        return;
    }else if(n>x){
        deque<ll> que;
        que.push_back(x);
        que.push_back(1);
        bool flag=true;
        rep2(i,2,2*n){
            if(x==i) continue;
            if(flag){
                que.push_front(i);
                flag=false;
            }else{
                que.push_back(i);
                flag=true;
            }
        }
        while(que.size()){
            ll v=que.front();
            que.pop_front();
            cout<<v<<en;
        }
    }else{
        deque<ll> que;
        que.push_back(x);
        que.push_back(2*n-1);
        bool flag=true;
        rep(i,1,2*n-1){
            if(x==i) continue;
            if(flag){
                que.push_front(i);
                flag=false;
            }else{
                que.push_back(i);
                flag=true;
            }
        }
        while(que.size()){
            ll v=que.front();
            que.pop_front();
            cout<<v<<en;
        }
    }

}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}

Measured memory_bytes: 3200
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;


vector<LL> neg;
vector<LL> pos;
LL zero;

int main(){
	LL N,K;
	cin >> N >> K;
	for(int i=0;i<N;i++){
		LL a;
		cin >> a;
		if(a<0){
			neg.push_back(a);
		}
		else if(a>0){
			pos.push_back(a);
		}
		else{
			zero++;
		}
	}
	sort(neg.begin(),neg.end());
	sort(pos.begin(),pos.end());
	LL ns=neg.size();
	LL ps=pos.size();
	LL l=-1e18-1;
	LL h=1e18+1;
	while(l+1<h){
		LL m=l+(h-l)/2;
		LL c=0;
		if(0==m){
			c+=2*zero*(N-zero)+zero*zero-zero;
			c+=2*ns*ps;
			c/=2;
		}
		else if(m>0){
			c+=2*zero*(N-zero)+zero*zero-zero;
			c+=2*ns*ps;
			LL i=0;
			for(LL j=ps-1;j>=0;j--){
				while(i<ps&&pos[i]*pos[j]<=m){
					i++;
				}
				c+=i;
				if(pos[j]*pos[j]<=m){
					c--;
				}
			}
			i=ns-1;
			for(LL j=0;j<ns;j++){
				while(i>=0&&neg[i]*neg[j]<=m){
					i--;
				}
				c+=ns-1-i;
				if(neg[j]*neg[j]<=m){
					c--;
				}
			}
			c/=2;
		}
		else {
			LL i=0;
			for(LL j=0;j<ps;j++){
				while(i<ns&&neg[i]*pos[j]<=m){
					i++;
				}
				c+=i;
			}
		}
		//cerr << m << ": " << c << endl;
		if(c>=K){
			h=m;
		}
		else{
			l=m;
		}
	}
	cout << h << endl;


    return 0;
}


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

#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i,a) for (auto i = rbegin(a); i != rend(a); ++i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
using namespace std;
using ll = long long;
using ld = long double;
template<class T> using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-10;
ll mod = static_cast<ll>(1e9 + 7);
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr void mins(T& a, Args... args) { a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr void maxs(T& a, Args... args) { a = max<T>({ a,args... }); }
template<class A, int N, class T>
void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

int n;
void solve() {
    cin >> n;
    ll ans = 0;
    reps(i, n) {
        if (i % 3 != 0 && i % 5 != 0) ans += i;
    }
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 3596
import collections


class Solution:
    def solve(self, N: int, M: int) -> int:

        return abs((N-2)*(M-2))


if __name__ == '__main__':

    # standard input
    N, M = map(int, input().split())

    # solve
    solution = Solution()
    ans = solution.solve(N, M)

    print(ans)


Measured memory_bytes: 3316
package main

import "fmt"

func main() {
	var n, y int
	fmt.Scan(&n, &y)

	for i := 0; i <= n; i++ {
		for j := 0; j <= n-i; j++ {
			if 10000*i+5000*j+1000*(n-i-j) == y {
				fmt.Println(i, j, (n - i - j))
				return
			}
		}
	}
	fmt.Println(-1, -1, -1)
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>

using namespace std;

#define Int int64_t

void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}




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

	vector<string> arare(n);

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

	sort(arare.begin(), arare.end());
	arare.erase(unique(arare.begin(), arare.end()), arare.end());
	if (arare.size() == 3) cout << "Three" << endl;
	else cout << "Four" << endl;

	return 0;
}

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

using namespace std;

int main () {
    int N, P, odd = 0, even = 0;
    cin >> N >> P;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
      cin >> A[i];
      if (A[i] % 2) odd++;
      else even++;
    }
    long long ans = 1;
    if (even == N) {
      for (int i = 0; i < N; i++) {
        ans *= 2;
      }
      if (P) cout << 0 << endl;
      else cout << ans << endl;
    } else {
      for (int i = 0; i < N-1; i++) {
        ans *= 2;
      }
      cout << ans << endl;
    }
}


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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;

int main(){
    int N;
    cin >> N;
    long long h[100010];
    long long dp[100010];
    for(int i = 0; i < N; i++){
        cin >> h[i];
        //dp[i] = INF;
    }
    for(int i = 0; i < 100010; i++){
        dp[i] = INF;
    }


    dp[0] = 0;

    for(int i = 1; i < N; i++){
        chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]));

        if(i > 1){
            chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
        }
    }

    cout << dp[N-1] << endl;


}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cassert>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

int main() {
    string s;
    cin >> s;
    
    s = "0" + s;
    string t = s;
    reverse(ALL(t));
    if (s != t) {
        cout << -1 << "\n";
    } else {
        if (s[1] == '0') {
            cout << -1 << "\n";
        } else {
            int k = 0;
            for (int i = 1; i < SZ(s) - 1; ++i) {
                if (s[i] == '0') {
                    cout << k + 1 << " " << i + 1 << "\n";
                } else {
                    cout << k + 1 << " " << i + 1 << "\n";
                    k = i;
                }
            }
        }
    }
    
    return 0;
}


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

using namespace std;

bool is_parindrome(int x)
{
	string s = to_string(x);
	return equal(s.begin(), s.end(), s.rbegin());
}

int main()
{
	int A, B;
	cin >> A >> B;
	int ans = 0;
	for (int x = A; x <= B; ++x) {
		if (is_parindrome(x)) {
			++ans;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
//18:48

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        int ans = 0;
        List<Integer> b = new LinkedList<Integer>();
        int tag = 0;
        for (int i = 0; i < n; i++) {
            if (tag != a[i]) {
                tag = a[i];
                ans++;
            } else {
                // 同じ場合
                tag = 0;
                ans--;
            }
        }
        System.out.println(ans);

    }
}

Measured memory_bytes: 49860
import java.util.*;
public class Main{
  public static void main(String[] arg) {

		Scanner sc = new Scanner(System.in);//文字の入力
		String S = sc.next();
		String T = sc.next();
		int count = S.length();//何文字かをcountに代入

		for (int i = 0; i < S.length(); i++) {
			//Objects.equals(a,b);で文字列の比較
			if (Objects.equals(S.substring(i, i + 1), T.substring(i, i + 1))) {
				count -= 1;
			}
		}
		System.out.println(count);
	}
}

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

int main() {

	string S;
	cin >> S;

	int a = 0;

	for (int i = 1; i < S.size(); i++) {
		if (S[i - 1] == S[i]) {
			a = 1;
		}
	}

	if (a == 1) {
		cout << "Bad" << endl;
	}
	else {
		cout << "Good" << endl;
	}

	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll k,n;
cin>>k>>n;
if(k*n==15){cout <<"*"<<endl;}
else if(k+n==15){cout << "+" << endl;}
else{
cout << "x" << endl;}}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x; cin >> x;
  if(x >= 30) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define int long long
#define F first
#define S second
const ll INF = 1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000;
const int inf = 1000 * 1000 * 1000 + 1000;

// Man Hamishe bazande bodam royye kaqaz
// vali hamishe jolo raftam toyye karam
// BAHRAM

const int N = 2100,
	  MOD = 1000 * 1000 * 1000 + 7;

int f[N * N],
	rf[N * N],
	dp[N][N];

int add(int a, int b){
	a %= MOD;
	b %= MOD;
	return (a + b) % MOD;
}
int mu(int a, int b){
	a %= MOD;
	b %= MOD;
	return (a * b) % MOD;
}

int Pow(int a, int b){
	int ans = 1,
		t = a;
	while(b){
		if(b & 1)
			ans = mu(ans, t);
		t = mu(t, t);
		b >>= 1;
	}
	return ans;
}

int choose(int a, int b){
	return mu(f[a], mu(rf[b], rf[a - b]));
}

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	f[0] = 1;
	f[1] = 1;
	rf[1] = 1;
	rf[0] = 1;
	for(int i = 2; i < N * N; i++){
		f[i] = mu(i, f[i - 1]);
		rf[i] = mu(Pow(i, MOD - 2), rf[i - 1]);
	}

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

	if(k == 1){
		cout << 1 << '\n';
		return 0;
	}

	dp[1][0] = dp[1][1] = 1;
	for(int i = 2; i <= n; i++){
		int sum = dp[i - 1][i - 1];
		dp[i][i] = mu(choose((i - 1) * (k - 1) + k - 2, (i - 1) * (k - 1)),
				sum);
//		cout << dp[i][i] << ' ' ;
		for(int j = i - 1; j > 0; j--){
			if(j != 1)
				sum = add(sum, dp[i - 1][j - 1]);
			int sorat = i * k - j - 1,
				makhraj = (i - 1) * k + 1 - j;
	//		cout << f[sorat] << ' ';
			dp[i][j] = mu(choose(sorat, makhraj),
				sum);
	//		cout << i << ' ' << j << ' ' << dp[i][j] << '\n';
		}
		dp[i][0] = dp[i][1];
	}

	int ans = 0;
	for(int i = 1; i <= n; i++)
		ans = add(ans, dp[n][i]);
	cout << mu(ans, f[n]) << '\n';
	return 0;
}

Measured memory_bytes: 92160
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	cout<<(n*3+m)/2;
} 

Measured memory_bytes: 256
import sys
from heapq import heapify, heappop, heappush

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    Type = [False] * (3 * N)
    Front, Back = [], []
    heapify(Front)
    heapify(Back)
    sumA = 0
    sumB = 0
    for i in range(N):
        heappush(Front, A[i])
        sumA += A[i]
    for i in range(N, 3*N):
        heappush(Back, (A[i], i))
    for i in range(N):
        bV, bI = heappop(Back)
        Type[bI] = True
        sumB += bV
    ans = sumA - sumB
    for i in range(N, 2*N):
        heappush(Front, A[i]) #前半の処理
        sumA += A[i]
        sumA -= heappop(Front)
        #後半の処理、境界条件
        newBack, newBackI = heappop(Back)
        if Type[i]:
            sumB -= A[i]
            while newBackI <= i: newBack, newBackI = heappop(Back)
            sumB += newBack
            Type[newBackI] = True
        elif newBackI > i: heappush(Back, (newBack, newBackI))
        ans = max(ans, sumA - sumB)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 39204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=3005,INF=1<<29;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,H,W;cin>>N>>W>>H;
    
    vector<int> cntx(2*W+2,0),cnty(2*H+2,0);
    
    for(int i=0;i<N;i++){
        int a,b,c;cin>>a>>b>>c;
        cntx[max(0,2*(a-c))]++;
        cntx[min(2*W+1,2*(a+c)+1)]--;
        
        cnty[max(0,2*(b-c))]++;
        cnty[min(2*H+1,2*(b+c)+1)]--;
    }
    
    for(int i=1;i<=2*W;i++) cntx[i]+=cntx[i-1];
    for(int i=1;i<=2*H;i++) cnty[i]+=cnty[i-1];
    
    bool ok=true;
    
    for(int i=0;i<=2*W;i++) if(cntx[i]==0) ok=false;
    
    if(ok){
        cout<<"Yes"<<endl;
        return 0;
    }
    
    ok=true;
    for(int i=0;i<=2*H;i++) if(cnty[i]==0) ok=false;
    
    
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    //for(int i=0;i<=W;i++) cout<<i<<" "<<cntx[i]<<endl;
}



Measured memory_bytes: 4420
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(x) x.begin(), x.end()
#define pb(x) push_back(x)
#define INF 1000000000000000000
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define x first 
#define y second
const int maxx = 1000006;
const int maxlog = 20;
const ll mod = 1000000007;
int arr[maxx];

int main() {
    IOS
    int N;
    cin >> N;
    vector<pair<int, int>> v;
    for (int i = 1; i <= N; i++) {
        int x; cin >> x;
        v.push_back({x, i});
    }
    sort(all(v));
    for (auto to : v) cout << to.second << ' ';
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

ll N,K;
ll A[500];
vector<ll> v;

bool check(ll e){
    vector<ll> M;
    M.push_back(0);
    for(int i=0;i<N;i++) M.push_back(A[i]%e);
    sort(M.begin(),M.end());
    for(int i=1;i<=N;i++) M[i] += M[i-1];
    ll D = 1e18;
    for(int i=0;i<=N;i++){
        D = min(D, max(M[i],(N-i)*e-(M[N]-M[i])));
    }
    return D <= K;
}

int main(){
    cin >> N >> K;
    for(int i=0;i<N;i++) cin >> A[i];
    ll sum = 0;
    for(int i=0;i<N;i++) sum += A[i];
    v.push_back(1);
    for(int i=1;i*i<=sum;i++){
        if(sum % i == 0){
            v.push_back(i);
            if(i * i != sum) v.push_back(sum / i);
        }
    }
    sort(v.rbegin(),v.rend());
    for(auto &e : v){
        if(check(e)){
            cout << e << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3672
#include <stdio.h>
#include <limits.h>

int main(void)
{
    int e, y, y2, z, z3, t, min;

    while(scanf("%d", &e), e)
    {
        min = INT_MAX;
        for(z = z3 = 0; z3 <= e; z++, z3 = z * z * z)
            for(y = y2 = 0; y2 + z3 <= e; y++, y2 = y * y)
            {
                t = e - y2 - z3 + y + z;
                if(t < min) min = t;
            }
        printf("%d\n", min);
    }

    return 0;
}

Measured memory_bytes: 600
#include <complex>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
typedef complex<double> Point;
bool intersect(Point p1, double r1, Point p2, double r2) {
	double d = abs(p1 - p2);
	if (d < abs(r1 - r2)) return false;
	if (d > r1 + r2) return false;
	return true;
}
Point crosspoint(Point p1, double r1, Point p2, double r2) {
	double c = (r1 * r1 + norm(p1 - p2) - r2 * r2) / (2.0 * r1 * abs(p1 - p2));
	return p1 + (p2 - p1) / abs(p1 - p2) * r1 * Point(c, sqrt(1.0 - c * c));
}
int n; double x[15], y[15], p[15], e[15];
int main() {
	while (cin >> n, n) {
		for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> p[i];
		double l = 0.0, r = *min_element(p, p + n);
		for (int i = 0; i < 70; i++) {
			double m = (l + r) * 0.5;
			for (int i = 0; i < n; i++) e[i] = sqrt(p[i] * p[i] - m * m);
			bool flag = false;
			for (int j = 0; j < n; j++) {
				bool ok = true;
				for (int k = 0; k < n; k++) {
					if (abs(Point(x[j] - x[k], y[j] - y[k])) > e[k] + 1.0e-7) ok = false;
				}
				if (ok) flag = true;
			}
			for (int j = 0; j < n; j++) {
				for (int k = j + 1; k < n; k++) {
					if (intersect(Point(x[j], y[j]), e[j], Point(x[k], y[k]), e[k])) {
						Point p1 = crosspoint(Point(x[j], y[j]), e[j], Point(x[k], y[k]), e[k]);
						Point p2 = crosspoint(Point(x[k], y[k]), e[k], Point(x[j], y[j]), e[j]);
						bool ok1 = true, ok2 = true;
						for (int t = 0; t < n; t++) {
							if (abs(Point(x[t], y[t]) - p1) > e[t] + 1.0e-7) ok1 = false;
							if (abs(Point(x[t], y[t]) - p2) > e[t] + 1.0e-7) ok2 = false;
						}
						if (ok1 || ok2) flag = true;
					}
				}
			}
			if (flag) l = m;
			else r = m;
		}
		cout << fixed << setprecision(10) << l << endl;
	}
	return 0;
}

Measured memory_bytes: 3344
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;



int main() {
  int N, lim = pow(10, 5), a;
  cin >> N;
  vector<int> frqs(lim+3, 0);
  for (int i = 0; i < N; ++i) {
    scanf("%d", &a);
    a++;
    frqs[a-1] += 1;
    frqs[a+2] -= 1;
  }

  int ans = frqs[0];
  for (int i = 1; i <= lim; ++i) {
    frqs[i] += frqs[i-1];
    ans = max(ans, frqs[i]);
  }

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



Measured memory_bytes: 640
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    N = int(input())
    S = list(input())
    bl = [0]*N
    wh = [0]*N

    from itertools import accumulate

    wh_num = 0
    for i in range(N):
        if S[i] == '#':
            bl[i] = 1
        else:
            wh[i] = 1

    bl = [0] + bl
    wh = [0]+wh

    # 累積和を格納したリスト．A[l:r]の総和はB[r] - B[l]
    bl = list(accumulate(bl))
    wh = list(accumulate(wh))

    # この問題は長さが1-Nの連続部分の和の最大値を出せというものなので以下の通り
    ans = N
    for i in range(N + 1):
        ans = min(ans, bl[i]+(wh[N]-wh[i]))
    print(ans)


resolve()

Measured memory_bytes: 81356
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args)throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    int a = 0;
    int b = 0;
    if(n==2){
    a = Integer.parseInt(in.readLine());
    b = Integer.parseInt(in.readLine());
    }
    System.out.println(n==1?"Hello World":(a+b));
  }
}

Measured memory_bytes: 21072
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		for(int i=0;i<3;i++){
			String[] str=sc.nextLine().split("");
			System.out.print(str[i]);
		}
		System.out.println();
	}
}

Measured memory_bytes: 21200
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	readln.chomp.replace(".", "").replace(",", "").split.filter!(a=> a.length >= 3 && a.length <= 6).join(" ").writeln;
}

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


void solve(long long N, long long A, long long B){
  if(abs(A-B) % 2 == 0) {
    cout << "Alice" << endl;
  }
  else {
    cout << "Borys" << endl;
  }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
    solve(N, A, B);
    return 0;
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define FORalld(it, a) for (__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
template<class T> inline T isqrt(T k) {T r = sqrt(k) + 1; while (r * r > k) r--; return r;}
template<class T> inline T icbrt(T k) {T r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}

const int maxn = 1e5 + 5;
int n;
int a[maxn];

void solve() {
    cin >> n;
    FOR(i, 0, n) cin >> a[i];
    int ans = 1, tot = 0, sub = 0;
    queue<int> que;
    FOR(i, 0, n) {
        while (sz(que) && que.front() - sub <= 0) {
            que.pop();
            tot++;
        }
        if (i && a[i] <= a[i - 1] - sub + 1) {
            sub++;
        }
        ans = mult(ans, n - tot - (n - 1 - i));
        if (i) {
            a[i] = a[i - 1] + 2;
        }
        que.push(a[i]);
    }
    cout << ans << "\n";
}

int main() {
#ifdef _LOCAL_
    freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0); cin.tie(0);
#endif
    solve();
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
    return 0;
}


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

using namespace std;
constexpr int NMAX = 200010;
using ll = long long;

char strng[NMAX];

int main() {
	int n, p; scanf("%d %d", &n, &p);
	scanf("%s", strng);
	if (p == 2 || p == 5) {
		ll ans = 0;
		for (int i = 0; i < n; ++i) {
			if ((strng[i] - '0') * (7 - p) % 10 == 0) ans += i + 1;
		}
		printf("%lld\n", ans);
		return 0;
	}
	// the value of string [i, j) is ((i, n) - V(j, n)) / 10^smth
	// so we just check how many j are there per i
	vector<int> pow10at(n, 1);
	for (int i = n - 2; i >= 0; --i) {
		pow10at[i] = (pow10at[i + 1] * 10) % p;
	}
	vector<int> valStartAt(n);
	for (int i = n - 1; i >= 0; --i) {
		valStartAt[i] = ((strng[i] - '0') * pow10at[i]) % p;
		if (i < n - 1) valStartAt[i] = (valStartAt[i] + valStartAt[i+1]) % p;
	}
	map<int, int> occt;
	occt[0] = 1;
	ll ans = 0;
	for (int i = n - 1; i >= 0; --i) {
		ans += occt[valStartAt[i]];
		++occt[valStartAt[i]];
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 2432
#-*-coding:utf-8-*-

def main():
    a, b, c, d, e, f = map(int, input().split())

    ans_list = []

    for i in range(50):
        for j in range(50):
            for k in range(50):
                for l in range(50):
                    water = 100 * a * i + 100 * b * j
                    sugar = c * k + d * l
                    if water + sugar <= f and water > 0:
                        consentration = (100 * sugar) / (water + sugar)
                        if consentration <= (100 * e) / (100 + e):
                            ans_list.append([consentration, water, sugar])
    ans_list.sort(key=lambda x:x[0])
    print(ans_list[-1][1] + ans_list[-1][2], ans_list[-1][2])

if __name__ == '__main__':
    main()

Measured memory_bytes: 14708
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
typedef long double ld;
using ll=long long;
using namespace std;
const int mod=1e9+7;
const ll inf = 1LL << 60;
const ld pi = (acos(-1));
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; }


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  
  ll x; cin >> x;
  ld s=100.0;
  int p=0; 
  while(s<x){
    p++;
    s+=floor(0.01*s);
  }
  cout << p << endl;
}

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

const u_int N = 3;

int main() {
    string S, op;
    cin >> S;
    bitset<N> b;
    int s;
    for (int i = 0; i < 1 << N; i++) {
        s = S[0] - '0';
        b = i;
        for (int j = 0; j < N; j++) {
            s = b.test(j) ? s+(S[j+1]-'0') : s-(S[j+1]-'0');
        }
        if (s == 7) break;
    }
    cout << S[0];
    for (int i = 0; i < N; i++) {
        op = b.test(i) ? "+" : "-";
        cout << op << S[i+1];
    }
    cout << "=7" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
long long p  = 998244353;
//long long p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n) {
	if (n == 0) { return 1; }
	int x = rui(a, n / 2);
	x *= x; x %= p;
	if (n % 2 == 1) { x *= a; x %= p; }
	return x;
}
int inv(int a) { return rui(a, p - 2); }
void make_kai() {
	for (int i = 1; i < max_kai; i++) { kai[i] = kai[i - 1] * i; kai[i] %= p; }
	inv_kai = kai;
	rep(i, max_kai) { inv_kai[i] = inv(kai[i]); }
}
int nCr(int n, int r) {
	int a = kai[n] * inv_kai[r]; a %= p;
	a *= inv_kai[n - r]; a %= p;
	return a;
}
vel pa;
int root(int x) {
	if (pa[x] == -1) { return x; }
	int ans = root(pa[x]); pa[x] = ans;
	return ans;
}
void marge(int x, int y) {
	x = root(x);
	y = root(y);
	if (x != y) {pa[x] = y;}
}
#define end_s(a) cout <<a<<endl;return 0
int sol(int val, vel &a) {
	int m = a.size();
	vel b(m + 2);
	b[0] = a[0]; b[m + 1] = a[m - 1];
	rep(i, m) { b[i + 1] = a[i]; }
	m += 2;
	rep(i,m){
		if (b[i] <= val) { b[i] = 0; }
		else { b[i] = 1; }
	}
	int n = m / 2;
	if (b[n - 1] == b[n] || b[n + 1] == b[n]) { return b[n]; }
	pin lef;
	rep(i, n) {
		if (b[i] == b[i + 1]) { lef = mkp(i, b[i]); }
	}
	pin ri;
	for (int i = m - 1; i > n; i--) {
		if (b[i] == b[i - 1]) { ri = mkp(i, b[i]); }
	}
	if (lef.first + ri.first >= 2 * n) { return lef.second; }
	else { return ri.second; }
}
signed main(){
	int n; cin >> n;
	vel a(2 * n - 1);
	rep(i, 2 * n - 1) { cin >> a[i]; }
	int ng = 0; int ok = 2 * n;//(ng,ok]
	while (ok - ng > 1) {
		int mid = (ok + ng) / 2;
		int fl = sol(mid, a);//解がmid以下か
		if (fl==0) { ok = mid; }
		else { ng = mid; }
	}
	cout << ok << endl;
	return 0;
}

Measured memory_bytes: 4608
oldMoney, hateNumberLength = map(list, input().split())
hateLines = list(str(input()).rsplit(" "))
okLines = []
FirstBigList = []
newMoney = list(oldMoney)


def FindFirstBig(okLines, m, FirstBig):
    for i in okLines:
        if i > m:
            FirstBig.append(i)
    return FirstBig


for i in range(10):
    if str(i) not in hateLines:
        okLines.append(str(i))

FirstFlag = -1
ProblemFlag = -1
for index, m in enumerate(oldMoney):
    if FirstFlag == -1:
        if m in hateLines:
            FirstBigList = FindFirstBig(okLines, m, FirstBigList)
            if len(FirstBigList) > 0:
                newMoney[index] = FirstBigList[0]
                FirstFlag = index
            ProblemFlag = index
    elif FirstFlag != -1:
        newMoney[index] = okLines[0]

if oldMoney == newMoney:
    if ProblemFlag is not 0 and ProblemFlag is not -1:
        FirstBigList.clear()
        while ProblemFlag:
            FirstBigList = FindFirstBig(okLines, newMoney[ProblemFlag - 1], FirstBigList)
            if len(FirstBigList) > 0:
                newMoney[ProblemFlag - 1] = FirstBigList[0]
                for i in range(ProblemFlag, len(newMoney), 1):
                    newMoney[i] = okLines[0]
            if oldMoney == newMoney:
                ProblemFlag -= 1
    if ProblemFlag is 0:
        if okLines[0] != '0':
            newMoney.insert(0, okLines[0])
        else:
            newMoney.insert(0, okLines[1])
        for i in range(ProblemFlag + 1, len(newMoney), 1):
            newMoney[i] = okLines[0]
resultnew = "".join(newMoney)
print(resultnew)

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

#define mp make_pair
#define X first
#define Y second
#define pb push_back
#define CL(x) (x << 1)
#define CR(x) ((x << 1) + 1)
#define sqr(x) ((x) * (x))
#define Task ""

const bool OnLineJudge = 1;

typedef long long cc;
typedef long double ld;
typedef pair <int, int> pii;
cc N;

int main()
{
    if (!OnLineJudge)
    {
        freopen("input.inp", "r", stdin);
        //freopen(Task".inp", "r",  stdin);
        //freopen(Task".out", "w", stdout);
    }
    //-------------------------------------------------------------------------------------------------------
    std :: ios_base :: sync_with_stdio(false); cin.tie(NULL);
    //-------------------------------------------------------------------------------------------------------
    cin >> N;
    for (int n = 1; n <= 3500; n++)
    for (int h = 1; h <= 3500; h++) {
        cc tu = 1ll * N * h * n;
        cc mau = 4ll * h * n - 1ll * N * (n + h);
        if (mau > 0 && tu % mau == 0) {
            cout << n << " " << h << " " << (tu / mau) << "\n";
            return 0;
        }
    }
    //-------------------------------------------------------------------------------------------------------
    return 0;
}


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

from pprint import pprint
from collections import deque, defaultdict
import itertools
import math
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')


N = int(input())
A = list(map(int, input().split()))

ans = 0
prev = None
for a in A:
    if prev is None:
        prev = a
        continue
    if prev > a:
        diff = prev - a
    else:
        diff = 0
    ans += diff
    prev = a + diff

print(ans)


Measured memory_bytes: 102300
a = [input().split() for l in range(3)]
N=int(input())
b = [input() for i in range(N)]
if((b.count(a[0][0])==1 and b.count(a[0][1])==1 and b.count(a[0][2])==1) or 
   (b.count(a[1][0])==1 and b.count(a[1][1])==1 and b.count(a[1][2])==1) or
   (b.count(a[2][0])==1 and b.count(a[2][1])==1 and b.count(a[2][2])==1) or
   (b.count(a[0][0])==1 and b.count(a[1][0])==1 and b.count(a[2][0])==1) or
   (b.count(a[0][1])==1 and b.count(a[1][1])==1 and b.count(a[2][1])==1) or
   (b.count(a[0][2])==1 and b.count(a[1][2])==1 and b.count(a[2][2])==1) or
   (b.count(a[0][0])==1 and b.count(a[1][1])==1 and b.count(a[2][2])==1) or
   (b.count(a[2][0])==1 and b.count(a[1][1])==1 and b.count(a[0][2])==1) ):
  print("Yes")
else:
  print("No")

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

#define ub        upper_bound            // first element >  val(itr)
#define lb        lower_bound            // first element >= val(itr)

#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 
#define mem(a,b) memset( a, b, sizeof(a) )

#define bitcount(a) __builtin_popcount(a)   // count set bits
#define lzcount(x) __builtin_clz(x)        // count leading zeros in binary representation of number
#define tzcount(x) __builtin_ctz(x)        // count trailing zeros in binary representation of number

#define FAST ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

typedef long long int ll;
const ll MOD = 1e9+7;

template<typename T> T gcd(T a,T b){ if(b>a) return gcd(b,a);return b==0?a:gcd(b,a%b); }
template<typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }
template<typename T> T fast_power(T x,T y,ll m=MOD){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
/*
inline ll mod(ll x,ll n) {if (x < n) return x; if (x >= n) return x - n;}
string IntToString(ll a){ ostringstream temp; temp << a; return temp.str();}
ll findMMI_fermat(ll n,ll M) {ll ans= fast_power(n,M-2,M);return ans;}//i.e In (a/b)%M..it calculates MMI of b wrt M,only if M is prime
ll add(ll a,ll b,ll M)  { return mod(( mod(a,M ) + mod(b,M )),M);     }
ll sub(ll a, ll b,ll M) { return mod((mod(a,M ) + M - mod(b,M )),M);   }
ll mult(ll a,ll b,ll M) { return  mod(( mod(a,M)*mod(b,M) ),M) ; }
bool isprime(ll a){ if(a==2) {return 1;}if(!(a&1) ) {return 0;}for(ll i=3;i*i<=a;i+=2){if(a%i==0) {return 0;} } return 1;} 

  
               /* -------------------------------Main Code------------------------------- */		


int main(){
	FAST
	string s;cin>>s;
	string t;cin>>t;int cnt =0;
	for(int i=0;i<sz(t);i++){
		if(s[i]==t[i]) cnt++;
	}
	cout<<cnt<<endl;
    return 0;
}
	

 	




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }

int main(){
    int x,y,r,sum;
    while(scanf("%d %d %d",&x,&y,&r)!=EOF){
        if(x==-1&&y==-1&&r==-1)break;
        if(x==-1||y==-1){
            out("F");
            continue;
        }
        sum=x+y;
        if(sum>=80)out("A");
        else if(sum>=65)out("B");
        else if(sum>=50)out("C");
        else if(sum>=30){
            if(r>=50)out("C");
            else out("D");
        }else out("F");
    }
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define test int t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopr(i,a,b) for(int i=a;i>=b;i--)
#define loops(i,a,b,step) for(int i=a;i<b;i+=step)
#define looprs(i,a,b,step) for(int i=a;i>=b;i-=step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define all(a) a.begin(),a.end()
#define ld long double
using namespace std;
// For ordered_set
using namespace __gnu_pbds;
template <typename T>
using ord_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
const double pi = acos(-1);
char A[1001][1001];
ll cache[1001][1001];
int main(){
    FAST
    init(cache,0);
    ll h,w;
    cin>>h>>w;
    loop(i,0,h){
        loop(j,0,w){
            cin>>A[i][j];
        }
    }
    // ll ans = 0;
    cache[h][w] = 1;
    loopr(i,h+1,1){
        loopr(j,w+1,1){
            if(i==h+1 && j==w+1){
                continue;
            }
            if(i<=h){
                if(A[i][j-1]=='.'){
                    cache[i][j] = cache[i][j] + cache[i+1][j]%MOD;
                }
            }
            if(j<=w){
                if(A[i-1][j]=='.'){
                    cache[i][j] = (cache[i][j]%MOD + cache[i][j+1]%MOD)%MOD;
                }
            }
        }
    }
    // loop(i,1,h+1){
    //     loop(j,1,w+1){
    //         cout<<cache[i][j]<<" ";
    //     }
    //     cout<<"\n";
    // }
    ll ans = cache[1][1]%MOD;
    cout<<ans<<endl;
   return 0;
}

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(obj) obj.begin(), obj.end()
#define fcout cout << setprecision(10)

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

const int iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

int main() { 
    int A, B;
    cin >> A >> B;
    if (A != 1 && B != 1) {
        cout << 1 << endl;
    } else if ( A != 2 && B != 2) {
        cout << 2 << endl;
    } else {
        cout << 3 << endl;
    }

    return 0; 
}

Measured memory_bytes: 256
// #include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
int main(void) {
	int j = 0;
    string s,t;
//	char s[200000], t[200000];
	// scanf("%s", &s);
	// scanf("%s", &t);
    cin >> s >> t;

	for (int i = 0; i <s.size(); i++){
		if (s[i] != t[i]){
			j++;
        }
    }

	// printf("%d", j);
    cout << j << endl;
	return 0;
}

Measured memory_bytes: 3840