akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K; cin >> N >> K;
  char S[55];
  rep(i, N) cin >> S[i];
  if(S[K - 1] == 'A') S[K - 1] = 'a';
  if(S[K - 1] == 'B') S[K - 1] = 'b';
  if(S[K - 1] == 'C') S[K - 1] = 'c';
  rep(i, N) cout << S[i];
  return 0;
}

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

void solve(long long N, std::string S) {
int B = count(S.begin(), S.end(), '#');
int W = count(S.begin(), S.end(), '.');
int ans = min(B, W);
  int b = 0;
  int w = 0;
  for(int i = 0 ; i < N ; i++){
  	if(S[i] == '#' ) b++;
    else w++;
    ans = min(ans, b + W - w);
  }
  cout << ans << 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);
  std::string S;
  std::cin >> S;
  solve(N, S);
  return 0;
}


Measured memory_bytes: 772
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll dp[100][3];

int main() {
	ll n;
  cin>>n;
  ll n1 = n;
  vector<ll> v;
  rep(i,0,100){
    if(n1%2==1)v.pb(1);
    else v.pb(0);
    n1 = n1>>1;
  }
  /*
  set<pair<ll,ll> > se;
  rep(i,0,n+1){
    rep(j,0,n+1){
      if(i+j<=n)se.insert(mp(i+j,i^j));
    }
  }
  print(se.sz);
  */
  reverse(all(v));
  clr(dp,0);
  dp[0][0] = 1;
  rep(i,1,100){
      // 0
      if(v[i]==0){
        dp[i][0] += dp[i-1][0];
        dp[i][0] += dp[i-1][1];
        dp[i][1] += dp[i-1][1];
        dp[i][2] += dp[i-1][1];
        dp[i][2] += dp[i-1][2]*3;
      }
      // 1
      else{
        dp[i][0] += dp[i-1][0];
        dp[i][1] += dp[i-1][0];
        dp[i][1] += dp[i-1][1];
        dp[i][2] += dp[i-1][1]*2;
        dp[i][2] += dp[i-1][2]*3;
      }
      dp[i][0] %= MOD;
      dp[i][1] %= MOD;
      dp[i][2] %= MOD;
  }
  cout << (dp[99][0]+dp[99][1]+dp[99][2])%MOD << endl;
	return 0;
}

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

int n;
int A[20];

int func(int i,int m)
{
	if(m==0) return 1;
	if(i>=n) return 0;
	if(m<0) return 0;
	return (func(i+1,m)|| func(i+1,m-A[i]));
}


int main()
{
	int m;
	int S[200];

	cin>>n;
	for(int i=0;i<n;i++) cin>>A[i];
	cin>>m;
	for(int i=0;i<m;i++) cin>>S[i];

	for(int j=0;j<m;j++){
		if(func(0,S[j])) cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}

	return 0;
}



Measured memory_bytes: 3100
//パターン２
#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    long long a[100100];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        // 一つでも0があれば答えは0。
        if (a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }

    long long ans = a[0];
    for (int i = 1; i < n; i++) { //一つ目をansに入れたので、i = 0ではなくi = 1から。
        if (a[i] <= 1000000000000000000 / ans) {
            ans *= a[i];
        }
        else {
            cout << -1 << endl;
            return 0;
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4408
/*
    Created by vasu090 on 21 Apr, 2020
*/
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

#define rep(i, a, b) for(auto (i)=a;i<b;i++)
#define list(i, N) for(auto (i)=0;i<N;i++)

typedef long long ll;
typedef vector <ll> vi;
typedef pair <ll, ll> pi;
#define mp make_pair
#define pb push_back
#define eb emplace_back

#define int ll
#define INF 1e18+5
#define mod 1000000007

template<class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int A,B,M; cin >> A >> B >> M;
    vi a(A); list(i,A) cin >> a[i];
    vi b(B); list(i,B) cin >> b[i];
    vi x(M); vi y(M); vi c(M);
    list(i,M){
        int d,e,f; cin >> d >> e >> f;
        --d; --e;
        x[i]=d; y[i]=e; c[i]=f;
    }

    int ans = INF;
    //first find the answer without using the ticket
    int mina = *min_element(a.begin(),a.end());
    int minb = *min_element(b.begin(),b.end());
    ans = mina + minb;
    list(i,M){
        int curPrice = a[x[i]] + b[y[i]] - c[i];
//        cout << "a[x[i]] = " << a[x[i]] << "\nb[y[i]] = " << b[y[i]] << '\n';
        ans = min(curPrice,ans);
    }

    cout << ans << '\n';

    return 0;
}

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

using ll =long long;
const ll INFll = 0x7F7F7F7F7F7F7F7F;
const int INFint = 100100100;

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n,flag=0,ans=0, la=0, fb=0;
    cin >> n;
    int ssize=0;
    string s;
    //vector<string> s(n);

    for (int i=0;i<n;i++){
        cin >> s;
        ssize=s.size();
        for (int j=0;j+1<ssize;j++){
            if (s[j]=='A'  && s[j+1]=='B') ans++;
        }
        if (s[(ssize-1)]=='A') la++;
        if (s[0]=='B') fb++;
        if (s[(ssize-1)]=='A' && s[0]=='B') flag++;
    }
    ans = ans+min(fb, la);
    if (flag > 1 && la==fb && flag == la) ans--;
    cout << ans << endl;
    return 0;
}


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

typedef long long i64;
int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N, L; cin >> N >> L;
    vector<i64> a(N);
    rep(i, N) cin >> a[i];
    int aim = -1; i64 len = 0;
    rep(i, N - 1) {
        i64 tlen = a[i] + a[i + 1];
        if(tlen > len) {
            len = tlen;
            aim = i;
        }
    }
    if(len < L) {
        cout << "Impossible" << '\n';
        return 0;
    }
    cout << "Possible" << '\n';
    rep(i, aim) cout << i + 1 << '\n';
    for(int i = N - 2; i > aim; --i) cout << i + 1 << '\n';
    cout << aim + 1 << '\n';
    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstring>
#include <cmath>

using namespace std;


int main()
{
    unsigned int n;
    while( cin >> n )
    {
        bool *prime = new bool[n+2];
        unsigned int k, allprime = 0;

        memset( prime, false, n+2 );
        prime[2] = true;
        for( int i = 3; i <= n; i++ )
        {
            if( i % 2 == 0 )
            {
                prime[i] = false;
            }
            else
            {
                prime[i] = true;
            }
        }
        k = sqrt( n );
        for( int i = 3; i <= k; i++ )
        {
            for( int j = i + i; j <= n; j += i )
            {
                prime[j] = false;
            }
        }
        for( int i = 2; i <= n; i++ )
        {
            if( prime[i] )
            {
                allprime++;
            }
        }
        cout << allprime << '\n';
    }
    return 0;
}

Measured memory_bytes: 15460
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
const int N=3005;
const int mod=1e9+7;
void add(int &a, int b)
{ a+=b;if(a>=mod) a-=mod;}
void sub(int &a, int b)
{ a-=b;if(a<0) a+=mod;}
void mul(int &a, int b)
{ a=(ll)a*b%mod;}
struct matrix
{
int a[N][N];
matrix()
{
for(int i=0;i<N;i++)
for(int j=0;j<N;j++)
a[i][j]=0;
}
};
matrix operator * (matrix a, matrix b)
{
matrix c;
for(int i=0;i<N;i++)
for(int j=0;j<N;j++)
for(int k=0;k<N;k++)
add(c.a[i][j],(ll)a.a[i][k]*b.a[k][j]%mod);
return c;
}
int dp[N][N];
char s[N];
int main()
{
int n;
scanf("%i",&n);n--;
scanf("%s",s+1);
dp[0][1]=1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i+1;j++)
add(dp[i-1][j],dp[i-1][j-1]);
for(int j=1;j<=i+1;j++)
{
if(s[i]=='<')
{
add(dp[i][j],dp[i-1][j-1]);
}
else
{
add(dp[i][j],dp[i-1][i+1]);
sub(dp[i][j],dp[i-1][j-1]);
}
}
}
int ans=0;
for(int i=1;i<=n+1;i++) add(ans,dp[n][i]);
printf("%i",ans);
return 0;
}

Measured memory_bytes: 34176
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
#include <iomanip>
using namespace std;

typedef long long ll;

#define INF 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  // cin.tie(0);
  // ios::sync_with_stdio(false);

  cout << fixed;
  cout << setprecision(11);
  int n;
  cin >> n;
  vector<ll> v(n);
  rep(i, n) cin >> v[i];
  sorti(v);
  // cout << v[0] + v[1] << endl;
  double p = (v[0] + v[1]) / 2.0;
  for (int i = 2; i < n; ++i) {
    p = (p + v[i]) / 2.0;
    // cout << p << endl;
  }

  cout << p << endl;
}


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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  vector<int> mam;
  mam={a,b,c};
  sort(mam.begin(),mam.end());
  cout<<mam.at(2)*10+mam.at(1)+mam.at(0)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define id first.first
#define res first.second
#define pref second.first
#define year second.second
#define ppi pair<pair<int,int>,pair<int,int>>
int main(){
  int n,m,j=1;
  cin>>n>>m;
  vector<ppi> d(m);
  for(int i=0;i<m;++i){
    d[i].id=i;
    cin>>d[i].pref>>d[i].year;
  }
  sort(d.begin(),d.end(),[=](ppi a, ppi b){
    return a.pref!=b.pref?a.pref<b.pref:a.year<b.year;
  });
  d[0].res=1;
  for(int i=1;i<m;++i){
    d[i].res=(d[i-1].pref==d[i].pref?++j:j=1);
  }
  sort(d.begin(),d.end(),[=](ppi a, ppi b){return a.id<b.id;});
  for(int i=0;i<m;++i){
    printf("%06d%06d\n",d[i].pref,d[i].res);
  }
  return 0;
}

Measured memory_bytes: 3072
import cmath
import math
n=int(input())
a=[]
b=[]
#偏角ソートの方が楽
for i in range(n):
    x,y=map(int,input().split())
    a.append(complex(x,y))
    b.append(cmath.phase(a[i]))
#a.sort(key=cmath.phase)
ma=0
#math.piに注意
for i in range(n):
    z=a[i]
    c=b[i]-math.pi/2
    d=b[i]+math.pi/2
    l=max([c,-math.pi])
    r=min([d,math.pi])
    #(0,0)の時は偏角が0になってしまうし、除く
    #あとは-piとpiどっちになるか→piになる
    if a[i]!=complex(0,0):
        for j in range(n):
            if j!=i:
                #境界条件の場合分けがむずい
                if l<=b[j]<=r or (c<=-math.pi and c+2*math.pi<=b[j]<=math.pi) or (d>=math.pi and -math.pi<=b[j]<=d-2*math.pi):
                    z+=a[j]
    ma=max([abs(z),ma])
m=0
#math.piに注意
for i in range(n):
    if a[i]!=complex(0,0):
        za,zb=complex(0,0),complex(0,0)
        for j in range(n):
            p=cmath.phase(a[j]/a[i])
            if -math.pi<=p<=0:
                za+=a[j]
            if 0<=p<=math.pi:
                zb+=a[j]
        m=max([m,abs(za),abs(zb)])
        if i!=n-1 and a[i]+a[i+1]!=0:
            zc,zd=complex(0,0),complex(0,0)
            for j in range(n):
                p=cmath.phase(a[j]/((a[i]+a[i+1])/2))
                if -math.pi<=p<=0:
                    zc+=a[j]
                if 0<=p<=math.pi:
                    zd+=a[j]
            m=max([m,abs(zc),abs(zd)])

print(max([m,ma]))


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

int main(void){
    int n, m;
    std::cin >> n >> m;
    std::vector<int> sw(n);
    std::vector<std::vector<int>> ls;
    ls.resize(m);
    int k;
    for(int i = 0; i < m; i++){
	std::cin >> k;
	ls[i].resize(k);
	for(int j = 0; j < k; j++){
	    int s;
	    std::cin >> s;
	    s--;
	    ls[i][j] = s;
	}
    }
    std::vector<int> p(m);
    for(int i = 0; i < m; i++){
	std::cin >> p[i];
    }

    int ans = 0;
    bool flag;
    for(int i = 0; i < 1<<n; i++){
	flag = 0;
        for(int j = 0; j < n; j++){
            if(i>>j & 1) sw[j] = 1;
            else sw[j] = 0;
        }
        for(int j = 0; j < m; j++){
            int cnt = 0;
            // int x = ls[j].size();
            for(int l = 0; l < ls[j].size(); l++){
		 int swn = ls[j][l];
                 cnt += sw[swn];	
            }
            if(cnt % 2 != p[j]){
                flag = 1;
                break;
            }
        }
        if(!flag) ans++;
    }
    std::cout << ans << std::endl;
    return 0;
}



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

int main(){
  string s;
  cin >> s;
  
  s[5] = s[13] = ' ';
  
  cout << s << endl;
  
  
  
}

Measured memory_bytes: 256
def WhoTurn(name):
	next = ''
	last = ''
	end = False
	if name == 'a':
		global nA
		nA = nA + 1
		if nA > maxA:
			end = True
			last = 'A'
		if not end :
			next = SA[nA]
	elif name == 'b':
		global nB
		nB = nB + 1
		if nB > maxB:
			end = True
			last = 'B'
		if not end:
			next = SB[nB]
	elif name == 'c':
		global nC
		nC = nC + 1
		if nC > maxC:
			end = True
			last = 'C'
		if not end:
			next = SC[nC]
	
	#print(str(nA))
	#print(str(nC))
	#print(next)
	#print(str(end))
	if end:
		print(last)
		#return last
	else:
		WhoTurn(next)
		
if __name__ == '__main__':
	SA = list(input())
	SB = list(input())
	SC = list(input())
	nA = -1
	nB = -1
	nC = -1
	maxA = len(SA) - 1
	maxB = len(SB) - 1
	maxC = len(SC) - 1
	#winner = WhoTurn('a')
	#print(winner)
	#print(WhoTurn('a'))
	WhoTurn('a')



Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    //freopen("in.txt", "r", stdin);
    ll n,m;
    cin>>n>>m;
    if(n==1 && m==2){
        cout<<3<<endl;
    }
    else if(n==2 && m==3){
        cout<<1<<endl;
    }
    else if(n==3 && m==1){
        cout<<2<<endl;
    }
    else if(n==2 && m==1){
        cout<<3<<endl;
    }
    else if(n==3 && m==2){
        cout<<1<<endl;
    }
    else{
        cout<<2<<endl;
    }
}



Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class B
{
	public static void Main()
	{
		int N = GetInt();
		int M = GetInt();

		int[] num = Enumerable.Repeat(1, N).ToArray();
		bool[] canContainRed = new bool[N];
		canContainRed[0] = true;
		for(int i = 0; i < M; i++)
		{
			int x = GetInt() - 1;
			int y = GetInt() - 1;
			
			if(canContainRed[x])
				canContainRed[y] = true;
			
			num[x]--;
			num[y]++;

			if(num[x] == 0)
				canContainRed[x] = false;
		}

		Console.WriteLine(canContainRed.Count(x => (x == true)));
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> ans(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b, a--, b--;
        ans[a]++, ans[b]++;
    }
    for (auto& e : ans) cout << e << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    int w,h,x,y;
    cin >> w >> h >> x >> y;
    cout << to_string(double(w) * double(h) / 2) << " " <<  bool(x + x == w && y + y == h) << endl; 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
  int N;
  cin >> N;
  vector <long long> a(5,0);
  for( int i=0;i<N;i++ )
    {
      string s;
      cin >> s;
      if( s[0]=='M' )
	a[0]++;
      else if(s[0]=='A')
	a[1]++;
      else if(s[0]=='R')
	a[2]++;
      else if(s[0]=='C')
	a[3]++;
      else if(s[0]=='H')
	a[4]++;
    }

  long long out=0;
  for( int i=0;i<3;i++ )
    for( int j=i+1;j<4;j++ )
      for( int k=j+1;k<5;k++ )
	{
	  if( a[i]==0||a[j]==0||a[k]==0 )
	    continue;
	  out += a[i]*a[j]*a[k];
	}

  cout << out << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    static String z;
    static long sum=0;


    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt(),b=s.nextInt(),c=s.nextInt();
        int arr[] = {a,b,c};
        Arrays.sort(arr);
        if(arr[0]+arr[1]==arr[2]) System.out.println("Yes");
        else System.out.println("No");

    }



}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

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

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

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25416
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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

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

int main(void) {
    int N, A, B;
    cin >> N >> A >> B;

    cout << min(N * A, B) << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  lint R,G,B,N;
  cin>>R>>G>>B>>N;
  int ans=0;
  REP(r,3001)REP(g,3001){
    int b=N-(R*r+G*g);
    if(b>=0 and b%B==0)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


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

bool	is_palindromic(int n)
{
	int div;
	
	div = 10000;
	for (int i = 0; i < 2; i++)
	{
		if (n / div == n % 10)
		{
			n = (n - div * (n / div)) / 10;
			div /= 100;
		}
		else
			return (false);
	}
	return (true);
}

int		main() {
	int A;
	int B;
	int r;

	r = 0;
	cin >> A >> B;
	while (A <= B)
	{
		if (is_palindromic(A))
			r++;
		A++;
	}
	cout << r << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;

inline int getIdx(char c) {
    if (c == 'R') return 0;
    if (c == 'G') return 1;
    return 2;
}

struct S {
    vector<int> a;
    int m[4001];
};

void work() {
    int n; string s; cin>>n>>s;
    vector<vector<S>> v(n, vector<S>(3));
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            if (s[i] != s[j]) {
                int idx = getIdx(s[j]);
                v[i][idx].a.push_back(j);
                v[i][idx].m[j-i]++;
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int k = 0; k < 3; ++k) {
            if (getIdx(s[i]) == k) continue;
            for (int j : v[i][k].a) {
                for (int l = 0; l < 3; ++l) {
                    if (l == getIdx(s[i]) || l == k) continue;
                    int d = j - i;
                    ans += (int)(v[j][l].a.size()) - v[j][l].m[d];
                }
            }
        }
    }
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //int nt; cin>>nt; while (nt--) work();
    work();
    return 0;
}


Measured memory_bytes: 223156
#include <stdio.h>
int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a==b)
		printf("%d\n",c);
	else if(a==c)
		printf("%d\n",b);
	else
		printf("%d\n",a);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_temp>
using smaller_queue = priority_queue<Q_temp, vector<Q_temp>, greater<Q_temp>>;

const ll MOD = (ll)(1e9 + 7);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  string s;
  cin >> s;
  bool can = false;
  for (int i = 0; i <= 7; ++i)
  {
    string t = s.substr(0, i) + s.substr(s.length() - (7 - i));
    if (t == "keyence")
    {
      can = true;
      break;
    }
  }
  YES(can);
  return 0;
}


Measured memory_bytes: 256
n = open(0)
n = n.read()
l1 = "abcdefghijklmnopqrstuvwxyz"
l2 = [0]*26

for i in n:
   for j in range(len(l1)):
      if i == l1[j] or i == l1[j].upper():
         l2[j] += 1

for i in range(len(l1)):
   print(l1[i], ":", l2[i])


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

int main() {
	int n,x;

	cin >> n >> x ;
	
	vector<int> l;

	for (int i = 0; i < n; i++)
	{
		int num;
		cin >> num;
		l.push_back(num);
	}

	int cnt = 1;
	int now = 0;

	for (int i = 1; i <= n; i++)
	{
		now += l.at(i - 1);
		if (now > x) {
			break;
		}
		else
		{
			cnt++;
		}
	}

	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int X, Y;
int main() {
  cin >> X >> Y;
  int t = (4 * X) - Y;

  if (t % 2 == 0 && t / 2 <= X && t >= 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int main(){
  int height,width;
  while(1){
    cin >> height >> width;
    if(height == 0 && width == 0)break;
    for(int i = 0; i < height; i++){
      for(int j = 0; j < width; j++){
        if(i % 2 == j % 2)cout << '#';
        else cout << '.';
      }
      cout << '\n';
    }
    cout << '\n';
  }
  return 0;
}


Measured memory_bytes: 3084
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), math.MaxInt32)
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		return []byte(f1())
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	S := readString()
	T := readString()

	var ans int
	for i := range S {
		if T[i] == S[i] {
			ans++
		}
	}
	println(ans)
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main()
{
  ll h,w,n;
  cin>>h>>w>>n;
  map<ll,set<ll>> table;
  for(ll i:irange(0l,n)) {
    int a,b;
    cin>>a>>b;
    table[a].insert(b);
  }
  vecll cnt(10, 0);
  for(auto itr = begin(table); itr != end(table); ++itr) {
    ll r = itr->first;
    if (r < 3) continue;
    vecint sc;
    auto itr2 = itr;
    while (itr2 != begin(table) && itr2->first >= r-2) --itr2;
    if (itr2->first < r-2) ++itr2;
    auto last = next(itr);
    for (auto itr3 = itr2; itr3 != last; ++itr3) {
      for (auto& c : itr3->second) {
        sc.push_back(max(1l,c-2));
        sc.push_back(max(1l,c-1));
        sc.push_back(c);
        sc.push_back(min(w,c+1));
        sc.push_back(min(w,c+2));
      }
    }
    boost::sort(sc);
    sc.erase(unique(begin(sc),end(sc)), end(sc));
    int mw = sc.size();
    map<int,int> mi;
    for(int i:irange(0,mw)) {
      mi[sc[i]] = i;
    }
    ll lastr = min(r+2, h);
    if (last != end(table)) {
      lastr = min(lastr, last->first-1);
    }
    int mh = lastr - (r-2) + 1;
    vector<vector<bool>> pmat(mh, vector<bool>(mw));
    for (auto itr3 = itr2; itr3 != last; ++itr3) {
      int mr = itr3->first - (r-2);
      for (auto& c: itr3->second) {
        pmat[mr][mi[c]] = true;
      }
    }
    for (int i:irange(0,mh-2)) {
      for (int j:irange(0,mw-2)) {
        int num = 0;
        for (int ki:irange(0,3)) {
          for (int kj:irange(0,3)) {
            if (pmat[i+ki][j+kj]) ++num;
          }
        }
        ++cnt[num];
      }
    }
  }
  ll total = (h-2)*(w-2);
  ll rem = 0;
  for(int i:irange(1,10)) rem += cnt[i];
  cnt[0] = total - rem;
  for(auto ans:cnt) {
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 30576
import java.util.Scanner;
import java.util.regex.*;


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

        int cnt = 0;

        String wr = sc.next();
        String w = sc.next();
        //分割
        String[] wr_list = wr.split("");
        String[] w_list = w.split("");

        for (int i = 0; i < wr.length(); i++) {
            if (wr_list[i].equals(w_list[i])) {
                cnt++;
            }
        }

        System.out.println(cnt);

    }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
#define __lcm(a,b) ((a)/__gcd(a,b)*(b))
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288419716939937510582097;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}
const int MAX_N=105;
const int mod=1e9+7;
LL dp[MAX_N][MAX_N];
int H,W,K;
int main()
{
	cin>>H>>W>>K;
	dp[0][0]=1;
	rep(i,0,H)
	{
		rep(S,0,(1<<(W-1)))
		{
			bool ok=true;
			rep(j,0,W-2)
			{
				if(((S>>j)&1) && ((S>>(j+1))&1))ok=false;
			}
			if(!ok)continue;
			rep(j,0,W)
			{
				if(j>0 && ((S>>(j-1))&1))dp[i+1][j]+=dp[i][j-1];
				else if(j<W-1 && ((S>>j)&1))dp[i+1][j]+=dp[i][j+1];
				else dp[i+1][j]+=dp[i][j];
				dp[i+1][j]%=mod;
			}
		}
	}
	cout<<dp[H][K-1]<<endl;
	return 0;
}



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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

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

    if(n%2==0) cout << n << endl;
    else cout << 2*n << endl;
    
    return 0;
}



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


int main() {
  int n, ans = 0;
  cin >> n;
  vector<int> v(n), c(n);
  rep(i,n) cin >> v[i];
  rep(i,n) cin >> c[i];
  for(int i = 0; i < (1<<n); ++i) {
    int x = 0, y = 0;
    rep(j,n) {
      if(i&(1<<j)) {
        x += v[j];
        y += c[j];
      }
    }
    ans = max(ans,x-y);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3576
#include<iostream>
using namespace std;
long long  arr[100000];
long long  arr2[100000];
int main()
{
    long long a=0,b=0,k=0,j=1;
    cin>>a>>b>>k;
    //if(a==1&&b==1&&k==1)
      //  cout<<"1"<<endl;
//    else
    {
        for(int i=max(a,b); i>=1; i--)
        {
            if(a%i==0&&b%i==0)
            {
                arr[j]=i;
                j++;
            }
        }
        cout<<arr[k]<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
def judge():
    cnt = 0  # 今何連続でゾロ目が出ているか記録しておきます

    for _ in range(N):
        x, y = map(int, input().split())
        if x == y:
            # ゾロ目ストリークが1増えました
            cnt += 1
        else:
            # ゾロ目ストリークが切れました
            cnt = 0

        if cnt == 3:
            # 3連続になった瞬間、return True していいです
            return True
    
    # ダメでした
    return False

N = int(input())

if judge():
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9124
#include<bits/stdc++.h>
#define ll long long
#define pii pair<ll int,ll int>
#define PI 2*acos(0)
//#define mx 1000000
#define INF LONG_LONG_MAX
using namespace std;
const ll int p=998244353;
//vector<ll > prime;
//bool mark[mx];
ll int mod(ll int a,ll int b)
{
    ll int m=a%b;
    if(m<0) m=(b<0)?(m-b):(m+b);
    return m;
}
ll maxpow(ll n)
{
    return (n & (~(n-1)));
}
bool isPrime(ll n)
{
    if(n<2) return false;
    if(n==2) return true;
    if(n%2==0) return false;
    for(ll i=3;i*i<=n;i+=2){
        if(n%i==0) return false;
    }
    return true;
}
/*void init()
{
    mark[1]=1;
    int i,j,limit=sqrt(mx*1.0)+2;
    prime.push_back(2);
    for(i=4;i<mx;i+=2) mark[i]=1;
    mark[2]=0;
    for(i=3;i<mx;i+=2){
        if(!mark[i]){
            prime.push_back(i);
            if(i<=limit){
                for(j=i*i;j<mx;j+=2*i){
                    mark[j]=1;
                }
            }
        }
    }
}*/
/*
ll maxdiv(ll n)
{
    ll i,ans=1;
    for(i=0;i<prime.size();i++){
        if(n%prime[i]==0){
            ans=n/prime[i];break;
            //return ans;
        }
    }
    return ans;
}*/
ll lcm(ll a,ll b)
{
    ll ans=a*b;
    return (ans/__gcd(a,b));
}
// ax+by and a>b
ll gcd(ll a,ll b,ll &x,ll &y)
{
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1,y1;
    ll d=gcd(b,mod(a,b),x1,y1);
    x=y1;
    y=x1-y1*(a/b);
    return d;
}
ll abso(ll a)
{
    if(a>=0) return a;
    return -a;
}
ll div_count(ll n)
{
    bool flag[n+1];
    memset(flag,1,sizeof(flag));
    for(int p=2;p*p<n;p++){
        if(flag[p]){
            for(int i=p*2;i<n;i+=p) flag[i]=false;
        }
    }
    ll total=1;
    for(int p=2;p<=n;p++){
        if(flag[p]){
            int cnt=0;
            while(n%p==0){
                n/=p;
                cnt++;
            }
            total*=(cnt+1);
        }
    }
    return total;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    int cnt=0,a,b;
    for(a=1;a<=n-1;a++){
        cnt+=(n-1)/a;
    }
    cout<<cnt;
    return 0;
}
//1028C


Measured memory_bytes: 3688
from math import sqrt, floor, ceil
from itertools import combinations


N = int(input())

# O(num^(1/2))
def is_prime_num(num):
    num_sqrted = floor(sqrt(num))
    for i in range(2, num_sqrted + 1):
        if num % i == 0:
            return False
    else:
        return True

a_set = set()
while len(a_set) < N:
    for i in range(11, 55555, 10):
        if i in a_set:
            continue
        elif not is_prime_num(i):
            continue
        else:
            a_set.add(i)
            break

print(' '.join(map(str, a_set)))

Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

bool change_max(ll& a, ll b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

const int N_MAX = 110;
const int W_MAX = 100010;
ll dp[N_MAX][W_MAX];

int main() {
  ll N, W;
  cin >> N >> W;
  vector<ll> w(N), v(N);
  for (int i = 0; i < N; i++) {
    cin >> w[i] >> v[i];
  }
  ll INF = 1LL << 60;
  for (int i = 0; i < N_MAX; i++) {
    for (int j = 0; j < W_MAX; j++) {
      dp[i][j] = 0;
    }
  }
  for (int i = 0; i < N; i++) {
    for (int next_total_w = 0; next_total_w <= W; next_total_w++) {
      if (next_total_w - w[i] >= 0) {
        change_max(dp[i + 1][next_total_w], dp[i][next_total_w - w[i]] + v[i]);
      }
      change_max(dp[i + 1][next_total_w], dp[i][next_total_w]);
    }
  }
  cout << dp[N][W] << endl;
  return 0;
}

Measured memory_bytes: 86272
// In the name of Allah the Most Merciful.

#include<bits/stdc++.h>
using namespace std;

int main(void)
{
    string ar;
    cin >> ar;
    int si = ar.size();

    string temp = "";

    string a = "dream" , b = "dreamer" , c = "erase" , d = "eraser";

    for(int i=0;i<si;i++){

        temp+=ar[i];

        if(temp.size()==5){

            if(temp==a){

                if(i+3<si){

                    if(ar[i+1]=='e'&&ar[i+2]=='r'&&ar[i+3]!='a')i+=2;
                }

                else if(i+2<si){

                    if(ar[i+1]=='e'&&ar[i+2]=='r')i+=2;
                }
                temp="";
            }

            if(temp==c){

                if(i+1<si){

                    if(ar[i+1]=='r')i++;
                }

                temp = "";
            }
        }

        if(temp.size()==6){

            if(temp==d){

                temp="";
            }
        }

        if(temp.size()==7){

            if(temp==b){

                temp = "";
            }
        }
    }

    if(temp=="")cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 640
N = int(input())
meal = list(map(int, input().split()))
satis = list(map(int, input().split()))
adds = list(map(int, input().split()))
total = sum(satis)

for i in range(N-1):
    if (meal[i]+1 == meal[i+1]):
        total += adds[meal[i]-1]

print(total)

Measured memory_bytes: 3064
# coding: utf-8

MOD = 998244353

def getInv(N):
    inv = [0] * (N + 1)
    inv[1] = 1
    inv[1] = 1
    for i in range(2, N + 1):
        inv[i] = (-(MOD // i) * inv[MOD % i]) % MOD

    return inv

def getCmb(N):
    inv = getInv(N)
    nCr = [0] * (N + 1)
    nCr[0] = 1
    nCr[0] = 1
    
    for i in range(1, N + 1):
        nCr[i] = (nCr[i - 1] * (N - i + 1) * inv[i]) % MOD
    
    return nCr

def solve(N, A, B, K):
    ans = 0
    nCr = getCmb(N)
    for a in range(N + 1):
        b = (K - A * a) // B
        if (A * a + B * b == K) and (0 <= b <= N):
            ans += (nCr[a] * nCr[b]) % MOD
            ans %= MOD
    return ans
    

if __name__ == "__main__":
    N, A, B, K = map(int, input().split())
    print(solve(N,A,B,K))


Measured memory_bytes: 26720
#include<iostream>
#include<algorithm>
using namespace std;
int n,W,weight[200],value[200];
long long dp[200][100005];
int main()
{
   cin>>n>>W;
   for (int i=1;i<=n;i++)
    cin>>weight[i]>>value[i];
    for (int i=1;i<=n ;i++)
    for (int w=1;w<=W ;w++)
      if (weight[i]<=w)
    dp[i][w]=max(dp[i-1][w],(dp[i-1][w-weight[i]]+value[i]));
    else
        dp[i][w]=dp[i-1][w];
   cout<<dp[n][W]<<endl;
}


Measured memory_bytes: 79360
fun main(args: Array<String>) {
    var (X, Y) = readLine()!!.split(" ").map{ it.toInt() }
    
    if (Y % 2 != 0) {
        print("No")
    } else if (((X * 2) <= Y) && (Y <= (X * 4))) {
        print("Yes")
    } else {
        print("No")
    }
}


Measured memory_bytes: 36328
S,f=__import__('collections').deque(input()),0
for _ in range(int(input())):
	T=input()
	if'2'>T:f=1-f
	else:(S.appendleft if(T[2]<'2')^f else S.append)(T[4])
if f:S.reverse()
print(*S,sep='')

Measured memory_bytes: 12272
#include <iostream>
using namespace std;
int main(void){
  int N;
  cin >> N;
  int flag = 0;
  for(int i = 0; i <= N/4; i++){
    for(int j = 0; j <= N/4; j++){
      if(N == i*4+j*7) flag = 1;
    }
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int main () {
    LL a, b, c; cin >> a >> b >> c;
    if (4 * a * b < (c - a - b) * (c - a - b) && c - a - b >= 0) cout << "Yes";
    else cout << "No";
	
	return 0;
}


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

using namespace std;

int main(){
  int n;
  set<int> a;
  cin >> n;
  for(int i=0;i<n;i++){
    int k=0;
    cin >> k;
    a.insert(k);
  }

  if(n==a.size()){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPP(i, n) for(int i = 1; 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 ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const ll MOD = 1000000007;

ll gcd(ll x, ll y) {
    if(x<y) gcd(y,x);
    while(y>0) {
        ll tmp = x%y;
        x = y;
        y = tmp;
    }
    return x;
}

int main() {
    ll x,y; cin >> x >> y;
    cout << gcd(x,y) << endl;
    return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0,(i##_len)=(n);(i)<(i##_len);(i)++)
#define rep2(i,a,b) for(ll (i)=(a),(i##_len)=(b);(i)<=(i##_len);(i++))
#define Yes(n) cout<<((n)?"Yes\n":"No\n")
#define vll vector<ll>
#define pb push_back
using namespace std;
using ll = long long;

template<class T> bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> T abs(T x){return max(x,-x);}
template<class T> T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> T lcm(T m,T n) {return m*n/gcd(m,n);}
template<class T> T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm<T>(r,v.at(i));return r;}
template<class T> T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> T nCr(T n,T k){return factorial<T>(n)/(factorial<T>(k)*factorial<T>(n-k));}
template<class T> T dot_product(vector<T>u,vector<T>v){T r=0;for(T i=0;i<u.size();i++)r+=u.at(i)*v.at(i);return r;}
template<class T> T sum(vector<T>v){return reduce(all(v),0LL);}

// Template ends here

void solve(ll N, vector<ll> A){
    vll R(N); rep(i, N) R.at(A.at(i) - 1) = i + 1;
    rep(i, N) cout << R.at(i) << " ";
}

int main() {
    ll N;
    scanf("%lld",&N);
    vector<ll> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, move(A));
    return 0;
}

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


int main(){


    long long n, i;

    long long k = 0;

    vector<long long> a;

 
    cin >> n;


    for( i = 1 ; i * i <= n ; i = i + 1 ){

         if( n % i == 0 ){

             a.push_back(i - 1);

             a.push_back( ( n / i ) - 1 );

             }

         }


    for( i = 1 ; i < a.size() && a.at(i) != 0 ; i = i + 1 ){

         if( n / a.at(i) == n % a.at(i) ) k += a.at(i);

         }


    cout << k << endl;


    return 0;


    }

Measured memory_bytes: 384
#include <cstdio>
#include <vector>

using namespace std;

int main(){
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    vector<bool> mask(b, false);

    int i=1;
    while(true){
        int d = (i*a)%b;
        if(d==c){
            printf("YES\n");
            break;
        }else{
            if(mask[d]==true){
                printf("NO\n");
                break;
            }
            mask[d]=true;
        }
        i++;
    }
    return 0;
}

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

#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define vpii vector<pair<ll,ll>>
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1000000000+7;
ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
	if(n==2)ans.pb(2);
	else
    {for(ll i=2;i*i<=n;i++){if(n%i==0 && n%i!=i){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}ans.pb(n);}
    return ans;
}
ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i; 
    return res; } 
  
ll nCr(ll n, ll r){ return fact(n) / (fact(r) * fact(n - r)); } 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 

ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
bool bserch(vector<string> a, string s){
	ll l=0,r=a.sz-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==s)return true;
		if(a[mid]<s){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return false;
}

bool sortcol(const vector<int>& v1, 
               const vector<int>& v2){ 
 return v1[0] < v2[0]; } 

 ll degit(ll n)
 {
 	ll t=0;
 	while(n>0)
 	{
 		t++;
 		n/=10; 	}
 		return t;
 }

void solve()
{	
string s,t;
cin>>s>>t;
ll c=0;
for(ll i=0;i<s.sz;i++)
	if(s[i]!=t[i])
		c++;
cout<<c;
	return;
}

int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3796
# coding: utf-8
# Your code here!

sl = list(input())
n = len(sl)

ans_l = []
r_n = 0
l_n = 0
for s in sl:
    if s == "R":
        if l_n > 0:
            ans_l += [0] * (r_n - 1)
            ans_l += [l_n // 2 + (r_n + 1) // 2]
            ans_l += [r_n // 2 + (l_n + 1) // 2]
            ans_l += [0] * (l_n - 1)
            r_n = 0
            l_n = 0
        r_n += 1
    else:
        l_n += 1
ans_l += [0] * (r_n - 1)
ans_l += [l_n // 2 + (r_n + 1) // 2]
ans_l += [r_n // 2 + (l_n + 1) // 2]
ans_l += [0] * (l_n - 1)
for i in ans_l:
    print(i)

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

int main(void){
    int x, y;
    cin >> x >> y;

    if(x == 1 && y == 1){
        cout << 1000000 << endl;
        return 0;
    }
    else if((x == 1 && y == 2) || (x == 2 && y == 1)){
        cout << 500000 << endl;
        return 0;
    }
    else if((x == 1 && y == 3) || (x == 2 && y == 2) || (x == 3 && y == 1)){
        cout << 400000 << endl;
        return 0;
    }
    else if((x == 2 && y == 3) || (x == 3 && y == 2)){
        cout << 300000 << endl;
        return 0;
    }
    else if(x == 3 && y == 3){
        cout << 200000 << endl;
        return 0;
    }
    else if(x == 1 || y == 1){
        cout << 300000 << endl;
        return 0;
    }
    else if(x == 2 || y == 2){
        cout << 200000 << endl;
        return 0;
    }
    else if(x == 3 || y == 3){
        cout << 100000 << endl;
        return 0;
    }
    else{
        cout << 0 << endl;
        return 0;
    }
}

Measured memory_bytes: 256