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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

    int N;
    cin >> N;

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

    int ans = 0;
    for (int i = 0; i < N - 1; i++) {
        if (a[i] == a[i+1]) {
            ans++;
            i++;
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <ctime>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>
#include <fstream>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <numeric>
#include <cassert>
using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SS stringstream
#define DBG1(a) rep(_X,sz(a)){printf("%d ",a[_X]);}puts("");
#define DBG2(a) rep(_X,sz(a)){rep(_Y,sz(a[_X]))printf("%d ",a[_X][_Y]);puts("");}
#define bitcount(b) __builtin_popcount(b)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)

#define delete(a,n) a.erase(remove(all(a),n),a.end())
template<typename T, typename S> vector<T>& operator<<(vector<T>& a, S b) { a.push_back(b); return a; }
template<typename T> void operator>>(vector<T>& a, int b) {while(b--)if(!a.empty())a.pop_back();}
bool isprime(int n){ if(n<2)return false;  for(int i=2;i*i<=n;i++)if(n%i==0)return false;  return true;} 
ll b_pow(ll x,ll n){return n ? b_pow(x*x,n/2)*(n%2?x:1) : 1ll;}
string itos(int n){stringstream ss;ss << n;return ss.str();}

int main(){
	int A,B;
	int N;
	cin >> N >> A >> B;
	int ans = 0;
	rep(i,N){
		int t;
		cin >> t;
		if( A <= t and t < B ){

		}else ans++;
	}
	cout << ans << endl;
}





























Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  string MARCH = "MARCH";
  ll c[5] = {0LL};

  int N; cin >> N;
  REP(i,N) {
    string S; cin >> S;
    REP(j,5) {
      if (S[0]==MARCH[j]) {
        c[j]++;
      }
    }
  }

  ll ans = 0;
  FOR(i,0,5) {
    FOR(j,i+1,5) {
      FOR(k,j+1,5) {
        ans += c[i]*c[j]*c[k];
      }
    }
  }

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

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int N, num, i, flag=0;
	scanf("%d", &N);
	for(i=0; i<N; i++){
		scanf("%d", &num);
		if(num%2==0 && (num%3!=0 && num%5!=0)){
			flag=1;
			break;
		}		
	}
	if(flag==1)
		printf("DENIED");
	else
		printf("APPROVED");	
	return 0;
}

Measured memory_bytes: 128
n = int(input())
a = list(map(int,input().split()))

b = []
c = []
for i in a:
    if i % 2 == 0:
        b.append(i)
x = len(b)
for j in b:
    if j % 3 == 0 or j % 5 == 0:
       c.append(j) 
y = len(c)


if x == y:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <iostream>
#include <set>
#include <utility>
#include <vector>

using namespace std;

int main(){
  int N;
  scanf("%d", &N);
  vector<long long int> A(N+1, 0);
  for (int i = 1; i <= N; i++){
    scanf("%lld", &(A[i]));
  }
  long long int result = 0;
  for (int i = 1; i < N; i++){
    if ((A[i] % 2) ==  1){
      if (A[i+1] >= 1){
        result += 1;
        A[i+1] -= 1;
        A[i] -= 1;
      }
    }
  }
  for (int i = 1; i <= N; i++){
    result += A[i]/2;
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 1024
n=input()
kk=int(input())

l=len(n)

dp=[[[0]*2 for _ in range(101)] for _ in range(l+1)]
dp[0][0][0]=1

for i,dig in enumerate(n):
    dig=int(dig)

    for j in range(10):
        for k in range(100):
            nk=k if j==0 else k+1
            if j<dig:
                dp[i+1][nk][1]+=dp[i][k][0]+dp[i][k][1]
            elif j==dig:
                dp[i+1][nk][1]+=dp[i][k][1]
                dp[i+1][nk][0]+=dp[i][k][0]
            else:
                dp[i+1][nk][1]+=dp[i][k][1]

print(dp[l][kk][0]+dp[l][kk][1])

Measured memory_bytes: 75300
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;
			int[][] t = new int[n][n + 1];
			for (int i = 0; i < n; i++)
				for (int j = 0; j < n + 1; j++)
					t[i][j] = sc.nextInt();
			int[] dp = new int[1 << n];
			for (int i = 0; i < dp.length; i++)
				dp[i] = Integer.MAX_VALUE;
			dp[0] = 0;
			for (int i = 0; i < dp.length; i++)
				for (int j = 0; j < n; j++) {
					if ((i & (1 << j)) == 0) {
						dp[i + (1 << j)] = Math.min(dp[i + (1 << j)], dp[i]
								+ t[j][0]);
						for (int k = 0; k < n; k++)
							if ((i & (1 << k)) != 0)
								dp[i + (1 << j)] = Math.min(dp[i + (1 << j)],
										dp[i] + t[j][k + 1]);
					}
				}
			System.out.println(dp[dp.length - 1]);
		}
		sc.close();
	}
}

Measured memory_bytes: 35436
n = int(input())
A = list(map(int, input().split()))
b = min(A)
s = A.index(b)
while True:
	c = 0
	for i in range(len(A)):
		if i == s: continue
		else: 
			A[i] %= b
			if A[i] == 0:
				c += 1
			elif A[i] < b:
				b = A[i]
				s = A.index(b)
	if c == n-1:
		print(max(A))
		break


Measured memory_bytes: 14224
import sys
n, m = map(int, sys.stdin.readline().split())
req = [ list(sorted(map(int, sys.stdin.readline().split())))
        for _ in range(m) ]
req.sort(reverse=True)
lastcut = None
c = 0
for a, b in req:
    if lastcut is None or a > lastcut or lastcut >= b:
        lastcut = a
        c += 1
print(c)


Measured memory_bytes: 27096
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

int main(){

    string s;
    cin >> s;
    if(s == "SUN")cout << 7 << endl;
    if(s == "MON")cout << 6 << endl;
    if(s == "TUE")cout << 5 << endl;
    if(s == "WED")cout << 4 << endl;
    if(s == "THU")cout << 3 << endl;
    if(s == "FRI")cout << 2 << endl;
    if(s == "SAT")cout << 1 << endl;
    

    return 0;
}

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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

int x, y;
bool dx[16010][4010], dy[16010][4010];
string s;

int main(){
	cin >> s >> x >> y;
	int h = 0;//x,y
	int len = 0;//length
	int dpx = 0;//dpの遷移位置
	int dpy = 0;//::
	int flx = 0;
	int fly = 0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='F'){
			len++;
		}
		if(s[i]=='T'||s.size()-1==i){
			if(flx == 0){
				flx = 1;
				dx[8000+len][0]=true;
			}else if(fly == 0){
				fly = 1;
				dy[8000+len][0]=true;
				dy[8000-len][0]=true;
			}else if(h == 0){
				for(int j = 0;j < 16010;j++){
					if(dx[j][dpx]==true){
						if(j+len<16010)dx[j+len][dpx+1] = true;
						if(j-len>=0)dx[j-len][dpx+1] = true;
					}
				}
				dpx++;
			}else if(h == 1){
				for(int j = 0;j < 16010;j++){
					if(dy[j][dpy]==true){
						if(j+len<16010)dy[j+len][dpy+1] = true;
						if(j-len>=0)dy[j-len][dpy+1] = true;
					}
				}
				dpy++;
			}
			len = 0;
			h = 1-h;
		}
	}
	if(h==1&&fly == 0){
		fly = 1;
		dy[8000+len][0]=true;
		dy[8000-len][0]=true;
	}
	if(h==0&&flx == 0){
		flx = 1;
		dx[8000+len][0]=true;
		dx[8000-len][0]=true;
	}
	/*
	for(int i = -10;i <= 10;i++){
		cout << (i==-10?"":" ") <<dx[8000+i][dpx];
	}
	cout << endl;
	for(int i = -10;i <= 10;i++){
		cout << (i==-10?"":" ") <<dy[8000+i][dpy];
	}
	cout << endl;
	cout << dpx << " " << dpy << endl;
	*/
	if(dx[8000+x][dpx]&&dy[8000+y][dpy]){
		cout <<	"Yes" << endl;
	}else{
		cout << "No" << endl;		
	}
	return 0;
}

Measured memory_bytes: 65792
//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
//Using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> Ordered_set;

#define ll              long long
#define int             long long
#define ld             long double
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<vi>
#define vip            vector<pii>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define lb(x)           (x&(-x))
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define itr(it,v)          for(auto it:v)
#define show(arr,n)     for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fir(i,k,n)       for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ff               first 
#define ss               second
#define deb(x) cout << #x << "=" << x << endl
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define check(x) (x && cout<<"Yes\n")||(cout<<"No\n");
#define fin(s)          freopen(s,"r",stdin);  
#define fout(s)         freopen(s,"w",stdout);

const ld pi = 3.141592653589793238462643383279502884;
const int xd[]={-1,0,1,0};
const int yd[]={0,-1,0,1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0,  1, -1, 1, -1, 0, 1 };

int expo(int a,int b,int m);
int mmi(int a,int m);
void ipgraph(int m);

const int N=5*(1e5)+10;
vii adj(N);
int a[N];

void  solve(){

}
int32_t main()
{
    FIO
    int n,x; cin>>x>>n;
    mii m;
    fi(i,n) {
        cin>>a[i];
        m[a[i]]=1;
    }
    int minz=INT_MAX;
    int num=-1;
    fi(i,105){
        if(m.find(i)==m.end()){
            if(minz>abs(i-x)){
                minz=abs(i-x);
                num=i;
            }
        }
    }
    cout<<num<<"\n";
    return 0;

}

void ipgraph(int m){
    int i, u, v;
    while(m--){
          cin>>u>>v;
         u--, v--;
    adj[u].pb(v);
    adj[v].pb(u);
    }
}
int expo(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return a;
    int val=(expo(a,b/2,m)*expo(a,b/2,m))%m;
    if(b & 1) return (val*a)%m;
    else return val;
}
int mmi(int a,int m){
    return expo(a,m-2,m);
}

Measured memory_bytes: 15060
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

VL prime_factor(LL n) {
  VL primeFactor;
  LL now = 0;
  for(LL i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      if(now != i){
          primeFactor.PB(i);
      }
      n /= i;
      now = i;
    }
  }
  if(n != 1) primeFactor.PB(n);
  return primeFactor;
}


void Main()
{
    LL n;cin>>n;
    VL a(n);
    REP(i,n){
        cin>>a[i];
    }

    vector<bool> pf(1e6+100, false);
    {
        VL p = prime_factor(a[n-1]);
        for(auto x : p){
            pf[x] = true;
        }
    }
    
    bool pairwise = true;
    PER(i,n-1){
        VL p = prime_factor(a[i]);
        for(auto x : p){
            if(pf[x]){
                pairwise = false;
                break;
            }
            pf[x] = true;
        }
        if(!pairwise){
            break;
        }
    }

    if(pairwise){
        cout<<"pairwise coprime"<<endl;
        return;
    }

    LL now = a[0];
    FOR(i,1,n){
        now = gcd(now,a[i]);
    }

    if(now == 1){
        cout<<"setwise coprime"<<endl;
    }
    else{
        cout<<"not coprime"<<endl;
    }



    
    
	return;
}

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

Measured memory_bytes: 11344
import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int data1 = sc.nextInt();
		int data2 = sc.nextInt();
		
		data1 = data1 * data2;
		//偶数
		if(data1 % 2==0){
		    System.out.println("Even");
		}
		//偶数
		else{
		    System.out.println("Odd");
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define append push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int d;
  cin >> d;
  cout << "Christmas";
  rep(i,0,25-d) cout << " Eve";
  cout << endl;
  return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
ll q_pow(ll a, ll b)
{
    ll ans = 1;
    while(b) {

        if(b&1)
            ans = (ans*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return ans;
}
int main()
{
    int i, j, k;
    int n, t, m;
    int r, c;
    cin >> r >> c;
    cin >> n;
    cout << (n+max(r, c)-1) / max(r, c) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int llint
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


int N;
MII mem;


int search(int S = N){
	if(mem[S]) return mem[S];
	if(S == 0) return mem[0] = 1LL;
	if(S == 1) return mem[1] = 2LL;
	return mem[S] = ADD(search(S/2), ADD(search((S-1)/2), search((S-2)/2)));
}


signed main(){
	cin >> N;

	cout << search() << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
txy = [list(map(int,input().split())) for i in range(n)]
for i in range(n):
         if i != 0:
                  if not (txy[i][0] - txy[i-1][0] >= abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) and (txy[i][0] - txy[i-1][0]) % 2 == (abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2])) % 2):
                           print("No")
                           exit()
         else:
                  if not (txy[i][0]  >= txy[i][1]  + txy[i][2]  and txy[i][0]  % 2 == (txy[i][1] + txy[i][2]) % 2):
                           print("No")
                           exit()
print("Yes")
         
                                                                                      



Measured memory_bytes: 27300
import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
a = set([I() for _ in range(M)])
dp = [0]*(N+1) #1_indexed
dp[0] = 1
dp[1] = 1
for i in range(N+1):
    if i in a:
        dp[i] = 0
        continue
    if i-2>=0:
        dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
print(dp[-1])


Measured memory_bytes: 13212
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int, int>;

string s[110], t[110];

int main()
{
    int n, m;
    cin >> n;
    rep(i, n) cin >> s[i];
    cin >> m;
    rep(i, m) cin >> t[i];
    int ans = 0;
    rep(i, n) {
        int score = 0;
        rep(j, n) {
            if(s[j] == s[i]) score++;
        }
        rep(j, m) {
            if(t[j] == s[i]) score--;
        }
        ans = max(ans, score);
    }
    cout << ans << endl;
    return 0;
}


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

const int MAX_N=2*100000;
long long n,a[MAX_N],s=0,sum=0,MIN=2*1000000000;

int main(){
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
		sum += a[i];
	}
	
	for(int i=0;i<n-1;i++){
		s+=a[i];
		MIN=min(MIN,abs(s-(sum-s)));
	}
	
	cout << MIN << endl;
	return 0;
}


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

struct Node{
  int key;
  Node *right, *left, *parent;
};
//property
Node *root, *NIL;

void Insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z= new Node;
  z ->key = k;
  z ->left = NIL;
  z ->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key) x= x->left;
    else x = x-> right;
  }
  z->parent =y;
  if(y == NIL) root = z;
  else {
    if(z->key < y->key) y->left = z;
    else y->right = z;
  }
}

void Find(int k){
  Node *x = root;
  while (x != NIL){
    if (x->key == k){
      cout << "yes" ;
      return;
    }
    if(k < x->key) x = x->left;
    else x= x->right;
  }
  cout << "no" ;
  return;
}

void Inorder(Node *r){
  if(r == NIL) return;
  Inorder(r->left);
  cout << " " << r->key;
  Inorder(r->right);
}

void Preorder(Node *r){
  if(r == NIL) return;
  cout << " " << r->key;
  Preorder(r->left);
  Preorder(r->right);
}


int main(){

  int m, k;
  string com;
  cin >> m;
  rep(i,m){
    cin >> com;
    if (com == "insert"){
      cin >> k;
      Insert(k);  
    }else if(com == "find"){
      cin >> k;
      Find(k);
      cout << endl;
    }
    else {
      Inorder(root);
      cout << endl;
      Preorder(root);
      cout << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 21908
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    h,w,k = inpm()
    s = [[] for _ in range(h)]
    for i in range(h):
        a = list(input())
        for j in range(w):
            s[i].append(int(a[j]))
    dp = [[0 for _ in range(w+1)] for _ in range(h)]
    for i in range(h):
        for j in range(w):
            dp[i][j+1] = dp[i][j] + s[i][j]
    ans = (h-1)+(w-1)
    for e in range(pow(2,h-1)):
        cut = []
        for _ in range(h-1):
            cut.append(e%2)
            e //= 2
        NUM = sum(cut)+1
        DP = [[0 for _ in range(w)] for _ in range(NUM)]
        index = [0 for _ in range(h)]
        for i in range(h-1):
            index[i+1] = index[i] + cut[i]
        for i in range(h):
            for j in range(w):
                DP[index[i]][j] += s[i][j]
        ANS = sum(cut)
        cnt = [0 for _ in range(NUM)]
        for j in range(w):
            for i in range(NUM):
                if cnt[i]+DP[i][j] <= k:
                    cnt[i] += DP[i][j]
                else:
                    ANS += 1
                    for d in range(NUM):
                        cnt[d] = DP[d][j]
                    break
            if j == w-1:
                if max(cnt)>k:
                    ANS = (h-1)+(w-1)
        ans = min(ans,ANS)
    print(ans)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 73560
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vs vector<string>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
//#define endl "\n"
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 

vector<int> dig(ll n)
{
    vector<int> res;
    while(n)
    {
        res.push_back(n%10);
        n /= 10;
    }
    reverse(all(res));
    return res;
}

ll exp(ll a, ll b)
{
    ll res = 1;
    for(int i = 0; i<b; ++i)
        res *= a;
    return res;
}

ll conv(vector<int>& vec)
{
    ll res = 0;
    for(int i = vec.size()-1, j = 0; i>=0; --i, j++)
    {
        res += vec[i]*exp(10, j);
    }
    return res;
}

int main() 
{ 
    fastio
    int n;
    cin>>n;
    ll dp[n+1] = {0};

    for(int i = 1; i<=12; ++i)
        dp[i] = i;

    for(int i = 13; i<=n; ++i)
    {
        ll last = dp[i-1];
        vector<int> dig1 = dig(last);
        bool isnine = true;
        for(int j = 0; j<dig1.size(); ++j)
        {
            if(dig1[j]!=9) 
            {
                isnine = false;
                break;
            }
        }

        if(isnine)
        {
            dp[i] = powl(10, dig1.size());
            continue;
        }

        bool done = false;
        for(int j = dig1.size()-1; j>0; --j)
        {
            int first = dig1[j];
            int sec = dig1[j-1];
            if(first==9) continue;
            if(abs(first-sec+1)<=1)
            {
                done = true;
                dig1[j] += 1;
                for(int k = j+1; k<dig1.size(); ++k)
                {
                    if(k==j+1)
                        dig1[k] = dig1[k-1]-1;
                    else
                        dig1[k] = max(dig1[k-1]-1, 0);
                }
                break;
            }
        }

        if(done)
            dp[i] = conv(dig1);
        else
        {
            dig1[0] = dig1[0]+1;
            dig1[1] = dig1[0]-1;
            for(int j = 2; j<dig1.size(); ++j)
                dig1[j] = max(dig1[j-1]-1, 0);

            dp[i] = conv(dig1); 
        }
    }

    cout<<dp[n]<<endl;
}


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

int Decoding(char c,int key){
  
  int num;
  
  if(c >= 'A' && c <= 'Z'){
    num=c-65;
  }else{
    num=c-71;
  }
  
  num=(num+51*key)%52;
  
  return num;
  
}
int main(){

  char list[52];
  string str;
  int n;
  int key[100];
  
  for(int i=0 ; i+65 <= 90 ; i++)list[i]=i+65;
  for(int j=0 ; j+97 <= 122 ; j++)list[j+26]=j+97;
  
  while(1){
    
    cin >>n;
    if(n == 0)break;
    
    for(int i=0 ; i < n ; i++)cin >>key[i];
    
    cin >>str;
    
    for(int i=0 ; i < (int)str.size() ; i++){
      cout <<list[Decoding(str[i],key[i%n])];
    }
    
    cout <<endl;
    
  }
  
  return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

vector<bool> visit;
void dfs(int x, vector<vector<int> > &vec){
    visit[x] = true;
    rep(i,vec[x].size() ){
        if (visit[vec[x][i]]) continue;
        dfs(vec[x][i], vec);
    }
}

int main(){
    int N,M;
    cin >> N >> M;
    int count = 0;
    vector<pair<int,int> > vec(M);
    rep(i,M){
        cin >> vec[i].first >> vec[i].second;
        vec[i].first--;
        vec[i].second--;
    }
    vector<vector<int> > connection(N,vector<int>(0));
    rep(i,M){
        rep(j,M){
            if (i == j) continue;
            connection[vec[j].first].push_back(vec[j].second);
            connection[vec[j].second].push_back(vec[j].first);
        }
        visit.assign(N,false);
        dfs(0,connection);
        rep(j,N){
            if (!(visit[j])){
                count++;
                break;
            }
        }
        rep(j,N){
            connection[j].clear();
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#include <assert.h>
#include <numeric>
#define fast ios_base::sync_with_stdio(false)
#define mxn (ll)(1e5)
#define mod (ll)(1e9+7)
#define mod1 (ll)(998244353)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){fast;
	int a;cin>>a;cout<<a*(1+a*(1+a))<<endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
typedef  vector<int> vi; typedef  vector<ll> vl; typedef  vector<bool> vb;
typedef  vector<double> vd;
typedef  vector<vd> vvd;

#define REP(i,n) for(ll i = 0; i < (n); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,e) for (ll i = s; i < (ll)e; i++)
#define TEN(x) ((ll)1e##x)

template<typename F>
ld bsearch(ld lower, ld upper, ld k, ll max_loop, F f) {
	if (upper < lower) swap(upper, lower);
	ld nu = upper - lower, nl = 0;
	if (k < f(0)) swap(nl, nu); // ??????????°??????´???
	REP(_, max_loop) {
		ld mid = (nl + nu) / 2;
		(f(mid + lower) > k ? nu : nl) = mid;
	}
	return (nl + nu) / 2 + lower;
}

// ?????°
#define EPS (1e-10)

// ?????????
#define X real()
#define Y imag()
#define SZ size()
#define PB(x) push_back(x)
#define PREV(x, i) (x[(i+x.SZ-1) % x.SZ])
#define NEXT(x, i) (x[(i + 1) % x.SZ])

// ??????????????£??????
using ld = long double;
template<class T> using CR = const T &;

// ?¬??????¢??°
int sgn(ld a, ld b = 0) {
	if (a > b + EPS) return 1;
	if (a < b - EPS) return -1;
	return 0;
}

///////////////////////

// ???
using P = complex<ld>;
using G = vector<P>; // ???????¨???????
struct L : public vector<P> {
	L(P a, P b) { PB(a); PB(b); }
};

// ????????¢??°
namespace std {
	bool operator < (P a, P b) { return sgn(a.X, b.X) ? a.X < b.X : a.Y < b.Y; }
}

ld dot  (P a, P b) { return (conj(a)*b).X; }
ld cross(P a, P b) { return (conj(a)*b).Y; }

int ccw(P a, P b, P c) { // Verified : AOJCGL1C
	b -= a;
	c -= a;
	if (sgn(cross(b, c))) return sgn(cross(b, c)); // clockwise(-1) or counter clockwise(1)
	if (sgn(dot(b, c)) == -1) return 2;            // c--a--b
	if (sgn(norm(b), norm(c)) == -1) return -2;    // a--b--c
	return 0;                                      // a--c--b
}

bool iLS(CR<L> l, CR<L> s, bool strict = false) {
	int a = sgn(cross(l[1] - l[0], s[0] - l[0]))
	      * sgn(cross(l[1] - l[0], s[1] - l[0]));
	return strict ? a == -1 // strict
	              : a <= 0; // not strict
}
P pLL(CR<L> l, CR<L> m) {
	ld a = cross(l[1] - l[0], m[1] - m[0]);
	ld b = cross(l[1] - l[0], l[1] - m[0]);
	assert(sgn(a)); // parallel or same line
	return m[0] + b / a * (m[1] - m[0]);
}
G convex_cut(CR<G> g, CR<L> l) {
	G q;
	REP(i, g.size()) {
		if (ccw(l[0], l[1], g[i]) != -1) q.PB(g[i]);
		L s = { g[i], NEXT(g,i) };
		if (iLS(l, s, true)) q.PB(pLL(l, s));
	}
	return q;
}
ld area2(CR<G> g) {
	ld s = 0;
	REP(i, g.size()) s += cross(g[i], NEXT(g, i));
	return s;
}
L half_convex(CR<G> g, P p, ll max_loop) {
	ld ans = bsearch(0, acos(-1), area2(g) / 2, max_loop, [&](ld x){
	    return area2(convex_cut(g, {p, p + polar<ld>(1, x)}));
	});
	return {p, p + polar<ld>(1, ans)};
}

int main() {
#ifdef _WIN32
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	cin.tie(0); // cin??¨cout?????£????????????
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);

	while (true) {
		int n;
		cin >> n;
		if (n == 0) break;
		G g(n);
		REP (i, n) {
			ld x,y; cin >> x >> y;
			g[i].real(x);
			g[i].imag(y);
		}

		L l = half_convex(g, 0, 100);
		cout << l[1].X << " " << l[1].Y << endl;
	}
	return 0;
}

Measured memory_bytes: 3652
use std::io::{self,Read};
use std::str::Chars;
use std::iter::FromIterator;

struct Source<'a> { chars: Chars<'a> }

#[allow(dead_code)]
impl<'a> Source<'a> {
    fn next_chr(&mut self) -> char {
        self.chars.by_ref()
            .skip_while(|c| char::is_whitespace(*c))
            .next()
            .expect("eof")
    }

    fn next_str(&mut self) -> String {
        let it = self.chars.by_ref()
            .skip_while(|c| char::is_whitespace(*c))
            .take_while(|c| !char::is_whitespace(*c));
        let s = String::from_iter(it);
        if s.len() == 0 {
            panic!("eof")
        } else {
            s
        }
    }
}

#[allow(unused_macros)]
macro_rules! input {
    (src = $str:expr; $($elem:tt)*) => {
        let mut src = Source {
            chars: $str.chars(),
        };

        input_inner!(src, $($elem)*)
    };
    ($($elem:tt)*) => {
        let mut data = String::new();
        io::stdin().read_to_string(&mut data).expect("Input error");
        let mut src = Source {
            chars: data.chars(),
        };

        input_inner!(src, $($elem)*)
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($src:expr) => {};
    ($src:expr,) => {};
    ($src:expr, $var:ident : mut $ty:tt $($rest:tt)*) => {
        let mut $var = parse!($src, $ty);
        input_inner!($src $($rest)*)
    };
    ($src:expr, $var:ident : $ty:tt $($rest:tt)*) => {
        let $var = parse!($src, $ty);
        input_inner!($src $($rest)*)
    };
}

#[allow(unused_macros)]
macro_rules! parse {
    ($src:expr, ( $($ty:tt),* )) => {
        ( $(parse!($src,$ty)),* )
    };
    ($src:expr, char) => {
        $src.next_chr()
    };
    ($src:expr, [ $ty:tt; $len:expr ]) => {
        (0..$len).map(|_| parse!($src,$ty)).collect::<Vec<_>>()
    };
    ($src:expr, $ty:tt) => {
        parse_str!($src,$ty)
    };
}

#[allow(unused_macros)]
macro_rules! parse_str {
    ($src:expr, chars) => {
        $src.next_str().chars().collect::<Vec<char>>()
    };
    ($src:expr, $ty:ty) => {
        $src.next_str().parse::<$ty>().expect("Parse error")
    };
}

const MOD: i64 = 1000_000_007;

fn mod_pow(a: i64, b: i64) -> i64 {
    if b == 0 {
        1
    } else {
        mod_pow(a*a%MOD,b/2) * if b & 1 == 1 { a } else { 1 } % MOD
    }
}

fn f(i: usize, s: &Vec<i32>, x:i32, dp: &mut Vec<Vec<i64>>) -> i64 {
    if i >= s.len() {
        x as i64
    } else {
        let n = s.len() as i64;
        if dp[i][x as usize] < 0 {
            let res = (f(i+1,s,x,dp)*(n-i as i64-1)%MOD + f(i+1,s,x%s[i],dp)) % MOD;
            dp[i][x as usize] = res * mod_pow(n-i as i64, MOD-2) % MOD;
        }

        dp[i][x as usize]
    }
}

fn main() {
    input! {
        n: usize, x: i32, s: mut [i32; n]
    }

    s.sort_by(|a, b| b.partial_cmp(a).unwrap());

    let mut dp: Vec<Vec<i64>> = vec![vec![-1; x as usize+1]; n];
    let mut res = f(0,&s,x,&mut dp);

    for i in 1..n+1 {
        res = res * i as i64 % MOD;
    }

    println!("{}", res);
}


Measured memory_bytes: 209148
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define all(x) (x).begin(),(x).end()

using ll = long long;

int main()
{
    int N;
    string S, T;
    cin >> N >> S >> T;

    rep(i, N) 
    {
        cout << S[i] << T[i];
    }
    cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll,ll> pll;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define MOD 1000000007
#define ARRAY_MAX 100005

const int INF = 1e9+7;


int main(){

    int n,a,b,c;
    cin >> n >> a >> b >> c;
    vector<int> vec(n);

    for(int i = 0;i < n;i++){
        cin >> vec[i];
    }
    sort(vec.begin(),vec.end());

    int mini = INF;
    do{
        for(int i = 1;i <= n;i++){//Aはi本
            for(int j = 1;j <= n;j++){//Bはj本
                for(int k = 1;k <= n;k++){//Cはk本使う
                    if(i+j+k > n){
                        //使う竹がn本を超える場合は飛ばす
                        continue;
                    }
                    int cost = 0;
                    int cnt_a = 0,cnt_b = 0,cnt_c = 0;
                    for(int x = 0;x < i;x++){
                        //竹を合わせた時の合計の長さ
                        cnt_a += vec[x];
                    }
                    cost += (10*(i-1) + abs(a-cnt_a));//竹を合わせるコスト
                    
                    for(int y = i;y < i+j ;y++){
                        cnt_b += vec[y];
                    }
                    cost += (10*(j-1) + abs(b-cnt_b));

                    for(int z = i+j;z < i+j+k ; z++){
                        cnt_c += vec[z];
                    }
                    cost += (10*(k-1) + abs(c-cnt_c));

                    mini = min(mini,cost);
                }
            }
        }
    }while(next_permutation(vec.begin(),vec.end()));

    cout << mini << endl;

    return 0;
}

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

// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


int main()
{
    string s;
    cin >> s;
    int a = 0, b = 0;
    rep(i,s.size()) {
        if(i%2==0) {
            if(s[i]=='p') b++;
        }
        else if(i%2==1) {
            if(s[i]=='g') a++;
        }
    }
    P(a-b);
    return 0;
}



Measured memory_bytes: 512
import sys
fin = sys.stdin.readline
from heapq import heapify, heappop, heappush


class UnionFind(object):
    def __init__(self, N):
        self.__root = list(range(N))
    

    def root(self, x):
        if self.__root[x] == x:
            return x
        else:
            # root abbreviation
            self.__root[x] = self.root(self.__root[x])
            return self.__root[x]

    
    def same(self, x, y):
        return self.root(x) == self.root(y)


    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if (x == y):
            return
        self.__root[y] = x
        return


# assuming that the vertices are 0, 1, ..., N - 1
# time complexity: O(ElgE)
# space complexity: O(E)
def prim(adj, w):
    num_vertices = len(adj)
    # initialize
    min_cost = [float('inf')] * num_vertices
    min_cost[0] = 0
    used = [False] * num_vertices
    priority_queue = [(0, 0)]
    total_cost = 0

    while priority_queue:
        cost, vertex = heappop(priority_queue)
        if cost > min_cost[vertex] or used[vertex]:
            continue
        used[vertex] = True
        total_cost += cost

        for neighbor in adj[vertex]:
            cost_v_to_n = w[vertex][neighbor]
            if min_cost[neighbor] > cost_v_to_n:
                min_cost[neighbor] = cost_v_to_n
                heappush(priority_queue, (cost_v_to_n, neighbor))

    return total_cost


# input should be [(s1, t1, cost1), (s2, t2, cost2), ...]
# time complexity: O(ElgV)
# space complexity: O(V)
def kruskal(edges_with_cost, num_vertices):
    # num_edges = len(edges_with_cost)
    edges_with_cost.sort(key=lambda x: x[-1])
    uf = UnionFind(num_vertices)
    total_cost = 0
    for source, target, cost in edges_with_cost:
        if not uf.same(source, target):
            uf.unite(source, target)
            total_cost += cost
    
    return total_cost



V, E = [int(elem) for elem in fin().split()]
edges_with_cost = []
for _ in range(E):
    s, t, w = [int(elem) for elem in fin().split()]
    edges_with_cost.append((s, t, w))

print(kruskal(edges_with_cost, V))



Measured memory_bytes: 24304
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
template <class T>
void chmin(T &a, T b) { a = min(a, b); }
template <class T>
void chmax(T &a, T b) { a = max(a, b); }
void debug() { cerr << "ok" << endl; }
template <class T>
void printv(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void readv(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
int n, m, q, res;
V<int> a, b, c, d;
void dfs(int i, int p, V<int> v) {
    if (i == n) {
        int s = 0;
        for (int j = 0; j < q; j++) {
            if (v[b[j]] - v[a[j]] == c[j]) {
                s += d[j];
            }
        }
        chmax(res, s);
        return;
    }
    for (int j = p; j <= m; j++) {
        V<int> nv = v;
        nv.eb(j);
        dfs(i + 1, j, nv);
    }
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m >> q;
    a.resize(q);
    b.resize(q);
    c.resize(q);
    d.resize(q);
    for (int i = 0; i < q; i++) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        --a[i];
        --b[i];
    }
    dfs(0, 1, V<int>());
    cout << res << '\n';
}

Measured memory_bytes: 3652
#include <stdio.h>

int checkcolor(int rating) {
    if (rating < 400)
        return 0;
    else if (rating < 800)
        return 1;
    else if (rating < 1200)
        return 2;
    else if (rating < 1600)
        return 3;
    else if (rating < 2000)
        return 4;
    else if (rating < 2400)
        return 5;
    else if (rating < 2800)
        return 6;
    else if (rating < 3200)
        return 7;
    else 
        return 8;
}

int main() {
    int colors[9], n, i, sugoihito, ans, s=0;
    for (i=0; i<9; i++)
        colors[i] = 0;
    scanf("%d", &n);
    for (i=0; i<n; i++) {
        int tmp;
        scanf("%d", &tmp);
        colors[checkcolor(tmp)] += 1;
    }
    for (i=0; i<8; i++)
        if (colors[i] != 0)
            s++;
    sugoihito = colors[8];
    //saishou
    printf("%d ", s == 0 ? 1 : s);
    //saidai
    ans = s + sugoihito;
    printf("%d\n", ans);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long INF = 1e15;
using namespace std;
typedef long long ll;
int main() {
  ll n;
  cin >> n;
  vector<ll> b(n);
  REP(i, n - 1) cin >> b[i];
  ll ans = b[0] + b[n - 2];
  FOR(i, 1, n - 1) { ans += min(b[i - 1], b[i]); }
  cout << ans << endl;
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  char S[N];
  for(int i = 0; i < N; i++){
    cin >> S[i];
  }
  int K;
  cin >> K;
  
  for(int i = 0; i < N; i++){
    if(S[i] != S[K-1]){
      cout << "*";
    }
    else{
      cout << S[i];
    }
  }
  cout << endl;
  return 0;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iomanip>
#include <map>
using namespace std;


signed main(){
    int n, v;
    std::vector<int> value_list;

    std::cin >> n;

    for(auto i = 0; i < n; i++){
        std::cin >> v;
        value_list.push_back(v);
    }

    std::reverse(value_list.begin(), value_list.end());

    int index = 0;

    for(auto first = value_list.begin(); first != value_list.end(); first++){
        index++;
        if(index == n){
            std::cout << *first;
        }
        else{
            std::cout << *first << " ";
        }
    }

    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 3124
from collections import deque
s=deque(input().split())
f=False
for i in range(int(input())):
  _=input().split()
  if _[0]=='1':
    f=not f
  elif _[1]=='1':
    if f:
      s.append(_[2])
    else:
      s.appendleft(_[2])
  else:
    if f:
      s.appendleft(_[2])
    else:
      s.append(_[2])
print("".join(s)[::-1] if f else "".join(s))

Measured memory_bytes: 6900