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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int h, n;
  cin >> h >> n;
  vi a(n);
  rep(i, n) cin >> a[i];
  ll sm = 0;
  rep(i, n) sm += a[i];
  if (sm >= h)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

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

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

#define fr first
#define sc second
#define pb push_back
#define mpr make_pair
#define ppb pop_back()
#define ins insert
#define sz(s) int(s.size())
#define all(x) x.begin(), x.end()
#define lb lower_bound
#define ub upper_bound
int n, a[1000000];
ll ans;
int main()
{
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for(int i = 1;i <= n * 3; ++ i){
		cin >> a[i];
	}
	sort(a + 1,a + 3 * n + 1);
	for(int i = 1; i <= 2 * n; ++ i){
		if(i % 2 == 1)ans += a[i + n];
	}
	cout << ans;
	return 0;
}

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

using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 27
#endif

#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(v) (int)(v.size())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ar array
#define forn(i, n) for(int i = 0; i < n ; ++i)
#define for1(i, n) for(int i = 1; i <=n ; ++i)
#define ford(i, n) for(int i = n-1; i>= 0;--i)
#define UNQ(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mem(X,val) memset(X, val, sizeof((X)))

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>>  vvi ;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpi ;

const db PI = acos(-1);
const ll mod = 1e9+7;
template <class T>void smax(T& x,T y){ if(x<y)x=y;}
template <class T>void smin(T& x,T y){ if(x>y)x=y;}
template<typename T1, typename T2> T1 powz(T1 A, T2 B);
/***************************************************main code**************************************************************/
const int MXN=1e6+5;
const ll INF = 9e18+200;
const int inf = 1e9+100;
const int mxn = 2e5+20;

ll dp[3005][3005];
void test_case()
{	
	int n; cin >> n;
	vi a(n); forn(i, n) cin >> a[i];
	for(int L = n-1; L>=0;--L){
		for(int R = L ; R < n ; ++R){
			if(L == R)
				dp[L][R] = a[L];
			else	
			dp[L][R] = max(a[L] - dp[L+1][R],a[R]-dp[L][R-1]);
		}
	}
	cout << dp[0][n-1];
}
/*************----------------------------******************/
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
#ifdef VIJY_DEFINE
    freopen("input.txt","r",stdin);
#endif
//  freopen("output.txt","w",stdout);
    int Tests = 1;
//  cin >> Tests;
    
    for(int tc = 1; tc <= Tests; ++tc){
        //cout <<"Case #"<<tc<<": ";
        test_case();
        cout<<'\n';
    }
#ifdef VIJY_DEFINE
    cerr << "Time elapsed: "<< 1.0*clock() / CLOCKS_PER_SEC <<"s.\n";
#endif   
}
template<typename T1, typename T2>
T1 powz(T1 X,T2 B)
{
    ll A = X;
    ll res=1;
        A%=mod; 
        assert(B>=0); 
    for( ; B ; B>>=1){
        if(B&1)res=res*A%mod;
        A= A*A%mod;
    }
    return res;
}


Measured memory_bytes: 49784
def make_guide():
    num = int(input())
    lst = [(i + 1, input().split()) for i in range(num)]
    # TODO fix
    # 同じものが存在したら、っていう条件のもとでないとダメ
    # あと数字は降順
    lst = sorted(lst, key=lambda t: int(t[1][1]), reverse=True)
    lst = sorted(lst, key=lambda t: t[1][0])
    return lst


def test_display():
    lst = make_guide()
    for i, guides in lst:
        print(str(i) + " " + guides[0] + " " + guides[1])


def display():
    lst = make_guide()
    for i, guides in lst:
        print(i)


if __name__ == "__main__":
    display()


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

int main() {
  int N;
  long long Y;
  cin >> N >> Y;
  
  for (int a = 0; a <= N; a++) {
    for (int b = 0; b <= N; b++) {
      int c = N - a - b;
      long long T = 10000 * a + 5000 * b + 1000 * c;
      
      if (c >= 0 && Y == T) {
        cout << a << " " << b << " " << c << endl;
        return 0;
      }
    }
  }
  
  cout << -1 << " " << -1 << " "<< -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math
import collections


N,M = map(int, sys.stdin.readline().rstrip().split(" "))
switches = []
for _ in range(M):
    k, *s = map(int, sys.stdin.readline().rstrip().split(" "))
    # switches.append(s)
    switch_bit = sum(2**(v-1) for v in s)
    # print(bin(switch_bit))
    switches.append(switch_bit)
ps = list(map(int, sys.stdin.readline().rstrip().split(" ")))



result = 0
for i in range(2**N):
    # print(bin(i))
    for j,switch in enumerate(switches):
        pattern = switch & i
        # print(bin(switch), bin(i), bin(switch & i), ps[j], bin(pattern).count("1") % 2 == ps[j])
        if not bin(pattern).count("1") % 2 == ps[j]:
            break
    else:
        result += 1
print(result)


exit(0)

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define all(v) (v).begin(),(v).end() 
#define endl "\n"
#define int long long int
#define ll long long
#define ld long double
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
const int mod = 1000000007;
const int N=200005;
const int inf=1e18;
vector<vector<int>>adj(N);


bool isPrime(ll n){if(n<2)return false;for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}

void fun(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}


signed main(){
    flash;
    fun();
    int t=1;
    //cin>>t;
    while(t--){
        int n,k;
        cin>>n>>k;
        int ans=((n*3)+k)/2;
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 7860
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
using namespace std;
int main()
{
	int a;
	cin >> a;
  	if(a<1200){
		cout << "ABC" << endl;
    }else if(a<2800){
		cout << "ARC" << endl;
    }else{
		cout << "AGC" << endl;
    }
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define make_pair mp
#define pii pair<int,int>
using namespace std;
typedef long long ll;
const int maxn=100007;
const int inf=(1LL<<29);
int fa[maxn],sz[maxn];
int find(int x){
    return x==fa[x]?x:fa[x]=find(fa[x]);
}
int u[maxn],v[maxn];
ll tot[maxn];
int main(){
    int n,m;cin>>n>>m;
    for(int i=1;i<=n;i++) fa[i]=i,sz[i]=1;
    for(int i=1;i<=m;i++) cin>>u[i]>>v[i];
    ll ans=1LL*n*(n-1)/2;
    for(int i=m;i;i--){
            tot[i]=ans;
        if(find(u[i])!=find(v[i])){
            ans-=1LL*sz[find(u[i])]*sz[find(v[i])];
            sz[find(v[i])]+=sz[find(u[i])];
            fa[find(u[i])]=find(v[i]);
        }
    }
    for(int i=1;i<=m;i++) cout<<tot[i]<<"\n";
    return 0;
}


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

struct card{
  char suit;
  int value;
};

int BubbleSort(vector<card> &A, int N){
  int flag = 1;
  while(flag == 1){
    flag = 0;
    for(int j = N-1; j >= 1; j--){
      if(A[j].value < A[j-1].value){
        swap(A[j], A[j-1]);
        flag = 1;
      }
    }
  }
}

int SelectionSort(vector<card> &A, int N){
  for(int i = 0; i < N; i++){
    int minj = i;
    for(int j = i; j < N; j++){
      if(A[j].value < A[minj].value){
        minj = j;
      }
    }
    if(minj != i){
      swap(A[i], A[minj]);
    }
  }
}

int main(){
	int N;
  cin >> N;
  vector<card> Bubble(N), Selection(N);

  for(int i = 0; i < N; i++){
    cin >> Bubble[i].suit >> Bubble[i].value;
    Selection[i] = Bubble[i];
  }

  BubbleSort(Bubble, N);
  SelectionSort(Selection, N);

  for(int i = 0; i < N; i++){
    if(i > 0) cout << " ";
    cout << Bubble[i].suit << Bubble[i].value;
  }
  cout << endl;
  cout << "Stable" << endl;

  int flag = 1;
  for(int i = 0; i < N; i++){
    if(i > 0) cout << " ";
    cout << Selection[i].suit << Selection[i].value;
    if(!(Selection[i].suit == Bubble[i].suit && Selection[i].value == Bubble[i].value)){
      flag = 0;
    }
  }
  cout << endl;
  if(flag) cout << "Stable" << endl;
  else cout << "Not stable" << endl;

}



Measured memory_bytes: 3112
s = str(input())
s_0,s_1 = 0,0
for i in range(len(s)):
    if(s[i] == "0"):
        s_0 += 1
    else:
        s_1 += 1
c = len(s)-(max(s_0,s_1)-min(s_0,s_1))
print(c)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 3 == 0) continue;
        if (i % 5 == 0) continue;
        ans += i;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint factorial(ll n) {
  mint answer = 1;
  while (n > 1) {
    answer *= n;
    n--;
  }
  return answer;
}

mint combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

mint permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

// setprecision(8) 桁数指定
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

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

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  s[k - 1] = tolower(s[k - 1]);
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
//#include "debug.h"
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

#define MAXN 200000

int n;
int a[MAXN];

int input() {
	if (scanf("%d", &n) < 0) return 0;
	for (int i=0; i<n; i++) scanf("%d", &a[i]);
	return 1;
}

void init() {
}

int get_max(map<int,int> &m, int &k, int &v) {
	v = INT_MIN;
	for(auto x: m) {
		if (x.second > v) {
			k = x.first;
			v = x.second;
		}
	}
	return m.size()>0;
}

int solve() {
	map<int,int> m[2];
	for (int i=0; i<n; i++) {
		int k = i%2;
		if (m[k].count(a[i])) m[k][a[i]]++;
		else m[k][a[i]] = 1;
	}
	int r = 0, k[2] = {0}, v[2];
	for (int i=0; i<2; i++) {
		get_max(m[i], k[i], v[i]);
	}
	if (k[0] == k[1]) {
		r = INT_MAX;
		for (int i=0; i<2; i++) {
			if (m[i].size()>1) {
				m[i].erase(k[i]);
				int kk[2], vv[2];
				for (int j=0; j<2; j++)
					get_max(m[j], kk[j], vv[j]);
				r = min(r, n-vv[0]-vv[1]);
				m[i][k[i]] = v[i];
			}
		}
		if (r==INT_MAX) r = n/2;
	}
	else {
		r = n - v[0] - v[1];
	}
	return r;
}

void output(int ans) {
	printf("%d\n", ans);
}

void cleanup() {
}

int main() {
	//int ca; scanf("%d", &ca);
	while (input()) {
		init();
		output(solve());
		cleanup();
		//break;
	}
}





Measured memory_bytes: 5376
import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;
public class Main {
	static private int Q ;
	static private int q_cnt=0;
	static private int X,Y,W,H;
	static private int N;
	static private int[] neko_x;
	static private int[] neko_y;
	static private int neko_cnt = 0;
	
	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		Q = sc.nextInt();

		while (read())
			solve();
	}
	
	static boolean read() {
		neko_cnt = 0;
		if(q_cnt == Q) { return false; }
		X = sc.nextInt();
		Y = sc.nextInt();
		W = sc.nextInt();
		H = sc.nextInt();
		N = sc.nextInt();
		neko_x = new int[N];			
		neko_y = new int[N];
		for(int j=0; j < N; j++) {
			neko_x[j] = sc.nextInt();
			neko_y[j] = sc.nextInt();
		}
		return true;
	}

	static void solve() {
		for(int i = 0; i < N; i++) {
			if(X <= neko_x[i] && X + W >= neko_x[i] && Y <= neko_y[i] && Y+H >= neko_y[i]) {
				neko_cnt++;
			}			
		}
		System.out.println(neko_cnt);
		q_cnt++;
	}	
}

Measured memory_bytes: 12000
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int[] a = new int[n+1];

        for(int i=0; i<m; i++) {
            a[Integer.parseInt(sc.next())]++;
        }
        int ton = 0;
        int to0 = 0;
        for(int i=x+1; i<=n; i++) {
            if(a[i] != 0) ton++;  
        }
        for(int i=x-1; i>=0; i--) {
            if(a[i] != 0) to0++;  
        }
        System.out.println(min(ton, to0));
    }
    public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    }
}


Measured memory_bytes: 21588
#pragma GCC optimize (2)
#pragma G++ optimize (2)
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define mod 1000000007
#define MAX 5005
using namespace std;
//char nc()
//{
//	static char buf[100000],*p1=buf,*p2=buf;
//	return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
//}
char nc(){return getchar();}
int read()
{
	int x=0,y=1;
	char c=nc();
	while(!isdigit(c))
	{
		if(c=='-')y=-1;
		c=nc();
	}
	while(isdigit(c))
	{
		x=(x<<1)+(x<<3)+(c^48);
		c=nc();
	}
	return x*y;
}
int n,head[MAX],cnt=0;
struct edge{
	int next,to;
}a[MAX<<1];
void add(int x,int y)
{
	a[++cnt].next=head[x];
	a[cnt].to=y;
	head[x]=cnt;
}
long long f[MAX][MAX],g[MAX],tp[MAX];
int sz[MAX];
long long mo(long long x)
{
	return x<mod?x:x-mod;
}
void dfs(int x,int fa)
{
	sz[x]=1;f[x][1]=1;
	for(int i=head[x];i;i=a[i].next)
	{
		int t=a[i].to;
		if(t==fa) continue;
		dfs(t,x);
		for(int j=0;j<=sz[x]+sz[t];j++)
			tp[j]=0;
		for(int j=0;j<=sz[x];j++)
			for(int k=0;k<=sz[t];k++)
				tp[j+k]=(tp[j+k]+f[x][j]*f[t][k])%mod;
		sz[x]+=sz[t];
		for(int j=0;j<=sz[x];j++)
			f[x][j]=tp[j];
	}
	long long tmp=0;
	for(int i=0;i<=sz[x];i+=2)
		tmp=mo(tmp-f[x][i]*g[i]%mod+mod);
	f[x][0]=tmp;
}
int main()
{
	n=read();
	int x,y;
	for(int i=1;i<n;i++)
		x=read(),y=read(),add(x,y),add(y,x);
	g[0]=1;
	for(int i=2;i<=n;i+=2)
		g[i]=g[i-2]*(i-1)%mod;
	dfs(1,0);
	printf("%lld",mo(mod-f[1][0]));
	return 0;
}

Measured memory_bytes: 92548
#include<bits/stdc++.h>
using namespace std;
#define ALL(A) A.begin(), A.end()
#define MEM(a, b) memset(a, b, sizeof(a))
#define FOR(n) for (int i = 0; i < n; ++i)
#define FOR_(n) for (int i = 1; i <= n; ++i)
#define FOR_J(n) for (int j = 0; j < n; ++j)
#define FOR_J_(n) for (int j = 1; j <= n; ++j)
#define IT_FOR(A) for (auto i = A.begin(); i != A.end(); ++i)
#define INF 0x3f3f3f3f
#define N ((int)1e6)
//#define max(_a,_b) (((_a) > (_b)) ? (_a) : (_b))
//#define min(_a,_b) (((_a) < (_b)) ? (_a) : (_b))
const int mod = 1000000007;
typedef long long ll;

inline int read() {
	int x = 0, w = 1;
	char ch = 0;
	while (ch < '0' || ch > '9') {
		if (ch == '-') w = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + (ch - '0');
		ch = getchar();
	}
	return x * w;
}

void re(ll n) {
	if (!n)
		return;
	n--;
	re(n / 26);
	printf("%c", 'a' + n % 26);
}
int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("wa4.txt","w",stdout);
	int _ = 1;
	//_ = read();	
	while (_--) {
		ll n;
		cin >> n;
		
		re(n);
	}
	return 0;
}

Measured memory_bytes: 3772
/*
  Problem:AT2691
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#define line cout << endl
using namespace std;

int a, b, c, d;

int main () {
	cin >> a >> b >> c >> d;
	if (b < c || d < a) {
		cout << "0" << endl;
		return 0;
	}
	int ans = abs (b - a) + abs (d - c);
	ans -= abs (c - a);
	ans -= abs (b - d);
	ans /= 2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define fcout cout << fixed << setprecision(15)
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};



signed main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    int h, w;
    cin >> h >> w;
    int n;
    cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];
    vector<int> ans;
    rep(i, n) {
        rep(j, a[i]) ans.push_back(i+1);
    }

    // rep(i, ans.size()) cout << ans[i] << " ";
    // cout << endl;

    rep(i, h) {
        if(i % 2 == 0) {
            rep(j, w) cout << ans[w * i + j] << " ";
            cout << endl;
        } else {
            rep(j, w) cout << ans[w * i + w - 1 - j] << " ";
            cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 640
a, b, c = list(map(int, input().split()))

if a == b and b == c and a % 2 == 0:
    print(-1)
    exit()

OK = True
count = 0

while OK:
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        OK = False
        break
    diva = a / 2
    divb = b / 2
    divc = c / 2
    a = divb + divc
    b = divc + diva
    c = diva + divb
    count += 1

print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
//////////////////////////////////

int main() {
  int n; cin >> n;
  vector<int> ans(n+1, 0);
  for(int x=1; x*x<n; x++) {
    for(int y=1; y*y<n; y++) {
      for(int z=1; z*z<n; z++) {
        int s = x*x + y*y + z*z + x*y + y*z + z*x;
        if (s <= n) {
          ans[s]++;
        }
      }
    }
  }
  
  for(int i=1; i<=n; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}

// EOF

Measured memory_bytes: 3480
a = int (input())
b = int (input())
c = int (input())
x = int (input())

cnt = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            
            if i*500 + j*100 + k*50 == x:
                cnt += 1
                
                
print(cnt)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e15;

int main() {
  ll n;
  cin >> n;
  mat a(n,vec(n));
  for(ll i=0;i<n;i++) for(ll j=0;j<n;j++) cin >> a[i][j];
  vec dp(1<<n);
  dp[0]=1;
  for(ll s=1;s<(1<<n);s++) {
    bitset<22> bit(s);
    ll i=bit.count();
    for(ll j=0;j<n;j++) {
      if(bit.test(j)&&a[i-1][j]) {
        (dp[s]+=dp[s^(1<<j)])%=mod;
      }
    }
  }
  cout << dp[(1<<n)-1] << endl;
}

Measured memory_bytes: 16768
//二色問題
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using Graph = vector<vector<int>>;

// 二部グラフ判定
vector<int> color;
bool dfs(const Graph &G, int v, int cur = 0) {
    color[v] = cur;
    for (auto next_v : G[v]) {
        // 隣接頂点がすでに色確定していた場合
        if (color[next_v] != -1) {
            if (color[next_v] == cur) return false; // 同じ色が隣接したらダメ
            continue;
        }
        // 隣接頂点の色を変えて、再帰的に探索 (一回でも false が返ってきたら false)
        if (!dfs(G, next_v , 1 - cur)) return false;
    }
    return true;
}

int main() {
    // 頂点数と辺数
    int N; cin >> N;

    ll dp[205][205];
    rep(i,N) rep(j,N) {
        if(i == j) dp[i][j] = 0;
        else dp[i][j] = INF;
    }

    // グラフ入力受取
    Graph G(N);
    for (int i = 0; i < N; ++i) {
        string s; cin >> s;
        rep(j,N){
            if(s[j] == '1') {
                G[i].pub(j);
                dp[i][j] = 1;
            }
        }
    }

    // 探索
    color.assign(N, -1);
    bool is_bipartite = true;
    for (int v = 0; v < N; ++v) {
        if (color[v] != -1) continue; // v が探索済みだったらスルー
        if (!dfs(G, v)) is_bipartite = false;
    }

    if (!is_bipartite) dame
    rep(k,N) rep(i,N) rep(j,N) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
    ll ans = 0;
    rep(i,N) repk(j,i+1,N) chmax(ans, dp[i][j]);
    cout << ans + 1 << endl;
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}



signed main(){

  int n,a,b;
  string str;

  int r, g;
  cin >> r >> g;
  cout << 2*g - r fin;

  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
# Problem C - Unification

# input
S = list(input())

# initialization
zero_num = 0
one_num = 0

# count
for s in S:
    if s=='0':
        zero_num += 1
    else:
        one_num += 1

# output
if not zero_num>0 or not one_num>0:
    print(0)
else:
    min_ans = min(zero_num, one_num)
    print(min_ans * 2)


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

int main()
{
  string S;
  cin >> S;
  
  int s_len = S.length();
  int sub_len_front = (s_len - 1) / 2;
  int sub_len_back = (s_len + 3) / 2;
  bool flag = true;
  rep(i, sub_len_front / 2)
  {
    if (S[i] != S[sub_len_front -1 - i])
    {
      flag = false;
    }
    
    if (S[sub_len_back - 1 + i] != S[s_len -1 - i])
    {
      flag = false;
    }
  }
  
  rep(i, sub_len_front)
  { 
    if (S[i] != S[s_len -1 - i])
    {
      flag = false;
    }
  }
  
  if (flag)
  {
    printf("Yes");
  }
  else
  {
    printf("No");
  }

  return 0;
}


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

dp = [float('inf') for i in range(N)]
dp[0] = 0

for i, h in enumerate(heights[1:]):
    index = i + 1
    for back in [-1, -2]:
        if index + back >= 0:
            dp[index] = min(dp[index], dp[index + back] +
                            abs(heights[index] - heights[index + back]))


print(dp[-1])


Measured memory_bytes: 54520
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define ed "\n"
void YN(bool flg){cout<<(flg?"YES":"NO")<<endl;}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<endl;}
void yn(bool flg){cout<<(flg?"yes":"no")<<endl;}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#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 out(n) cout << n << endl;
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int64_t, int >prime_factor(int64_t n){map< int64_t, int > ret;for(int64_t i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int a,b; cin >> a >> b;
    if(a>9||b>9) cout << -1 << ed;
    else cout << a*b << ed;

    return 0;
}

Measured memory_bytes: 256
n,m = [int(i) for i in input().split()]

l = [[int(i) for i in input().split()] for _ in range(m)]

start = [i[1] for i in l if i[0] == 1]
end = [i[0] for i in l if i[1] == n]

if set(start) & set(end):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 48616
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int cnt[101010];

void out(ll x){
	string ret="";
	rep(i,12){
		ret+=('0'+(x%10));
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	cout<<ret<<"\n";
}
int main(){
	int n,m;
	cin>>n>>m;
	pint p[m];
	int x[m];
	rep(i,m){
		int y;
		cin>>x[i]>>y;
		p[i]=pint(y,i);
	}
	sort(p,p+m);
	ll ans[m];
	rep(i,m){
		ans[p[i].second]=++cnt[x[p[i].second]];
		ans[p[i].second]+=1e6*x[p[i].second];
	}
	rep(i,m)out(ans[i]);
	return 0;
}


Measured memory_bytes: 3840
A, B, C = map(int, input().split())

N = A * B * C
ans1 = (A//2) * B * C
ans2 = A * (B//2) * C
ans3 = A * B * (C//2)

ans = min(abs(N-2*ans1),abs(N-2*ans2),abs(N-2*ans3))
print(ans)

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

int main(){
    long long s;
    cin >> s;
    int ok = 1e9;
    int ng = 0;
    while (abs(ok - ng) > 1){
        int mid = (ok + ng) / 2;
        if ((long long)1e9 * mid >= s) ok = mid;
        else ng = mid;
    }
    int a = ok;
    ok = 1e9;
    ng = - 1;
    while (abs(ok - ng) > 1){
        int mid = (ok + ng) / 2;
        if ((long long)1e9 * a - mid <= s) ok = mid;
        else ng = mid;
    }
    cout << "0 0 " << a << " 1 " << ok << " 1000000000" << endl;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	int n;
	int a[12];
	scanf("%d",&n);
	rep(i,n)scanf("%d",&a[i]);
	
	int b = 1 , c = 1;
	rep(i,n){
		b *= 3;
		if(a[i]%2 == 0)c *= 2;
	}
	cout << b-c << endl;
}



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

using namespace std;

#pragma GCC optimize("O3")
static const auto __ = [] {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  return nullptr;
}();

bool solve(int N) {
  int sum {0};
  string num {std::to_string(N)};
  for (char d : num) {
    sum += d - '0';
  }
  return N % sum == 0;
}

int main(int argc, char* argv[]) {
  int N;
  cin >> N;
  cout << (solve(N) ? "Yes" : "No") << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
    }
    sort(A.begin(), A.end());
    if(A.at(N / 2) - A.at(N / 2 -1) > 0){
        cout << A.at(N / 2) - A.at(N / 2 -1) << endl;
    }
    else{
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;
 
int main() {
  int n, m, xmax, ymin;
  bool flag = false;
  cin >> n >> m >> xmax >> ymin;
  vector<int> x(n); vector<int> y(m);
  r(i,n){
    cin >> x.at(i);
    if(x.at(i) > xmax) xmax = x.at(i);
  }
    r(i,m){
      cin >> y.at(i);
      if(y.at(i) < ymin) ymin = y.at(i);
    }
  
  if(ymin>xmax) cout << "No War" << endl;
  else cout << "War" << endl;
  
}

Measured memory_bytes: 256
MOD = 1000000007
S = input()
memo = [[0] * 13 for i in range(len(S)+1)]
memo[0][0] = 1

for idx in range(len(S)):
	ch = S[idx]
	if(ch == '?'):
		for num in range(10):
			for i in range(13):
				if(memo[idx][i] > 0):
					memo[idx+1][(i*10+num)%13] += memo[idx][i] 
	else:
		num = int(ch)
		for i in range(13):
			if(memo[idx][i] > 0):
				memo[idx+1][(i*10+num)%13] += memo[idx][i] 
	
	for i in range(13):
		memo[idx+1][i] %= MOD

print(memo[len(S)][5]%MOD)

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

int main() {
	int N, x;
	bool finished = false;
	cin >> N;
	vector<int> vec(N);
	for (int i = 0; i < N; i++) {
		cin >> vec.at(i);
		x = vec.at(i);
		if (x % 2 == 0) {
			if (x % 3 != 0 && x % 5 != 0) {
				finished = true;
				break;
			}
		}
	}
	if (finished == true)
		cout << "DENIED" << endl;
	else
		cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
N, X = gets.split.map(&:to_i)
l_list = gets.split.map(&:to_i)
ans = 1
d = 0
(1..N).each do |i|
  new_d = d + l_list[i - 1]
  ans += 1 if new_d <= X
  d = new_d
end
puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <stack>
#include <map>
#include <iomanip>
using namespace std;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}

const int MAX = 510000;
const int MOD = 1000000007;

int64_t fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(){
    int n,k ;
    cin >> n >> k ;
    vector<int> a(n,0) ;
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i) ;
    }
    for (int i = 0; i < n-k; i++)
    {
        if (a.at(i) < a.at(k+i) )
        {
            cout << "Yes" << endl ;
        }else
        {
            cout << "No" << endl ;
        }
        
        
    }
    
}

Measured memory_bytes: 4044
#include <iostream>

using namespace std;

long long int s(long long int n) {
	long long int ans = 0;
	while (n != 0) {
		ans += n % 10;
		n /= 10;
	}
	return ans;
}

int main() {
	long long int n;
	cin >> n;
	if (n%s(n) == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    string s,t;
    cin>>s>>t;
    int cnt=0;
    int n=s.size();
    rep(i,n) if(s[i]!=t[i]) cnt ++;
    cout<<cnt<<endl;;
}/*
./problem.exe
*/

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

int main(){
    string s;
    cin >> s;

    string t;
    for(long long i = 0; i < s.size(); i++){
        if(i % 2 == 0) t.push_back('g');
        else t.push_back('p');
    }

    long long point = 0;
    for(long long i = 0; i < s.size(); i++){
        if(t[i] == 'p' and s[i] == 'g') point++;
        else if(t[i] == 'g' and s[i] == 'p') point--;
    }

    cout << point << endl;
    return 0;
}

Measured memory_bytes: 3732
#!/usr/bin/env python
# coding: utf-8

# In[1]:


N,A,B,C,D = map(int, input().split())
S = input()


# In[3]:


if C < D:
    if S[B-1:D].count("##") == 0 and S[A-1:C].count("##") == 0:
        print("Yes")
    else:
        print("No")
else:
    if S[B-2:D+1].count("...") >= 1 and S[A-1:C].count("##") == 0:
        print("Yes")
    else:
        print("No")


# In[ ]:






Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9+7;
 
int main(){
  int x, a;
  cin >> x >> a;
  if(x<a) cout << 0 << endl;
  else if(x>=a) cout << 10 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
void Swap(long int x[ ], int i, int j)
{
    int temp;
    
    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

void QSort(long int x[ ], int left, int right)
{
    int i, j;
    int pivot;
    
    i = left;
    j = right;
    
    pivot = x[(left + right) / 2];
    
    while (1) {
        
        while (x[i] > pivot)
            i++;
        
        while (pivot > x[j])
            j--;
        if (i >= j)
            break;
        
        Swap(x, i, j);
        i++;
        j--;
    }
    
    
    if (left < i - 1)
        QSort(x, left, i - 1);
    if (j + 1 <  right)
        QSort(x, j + 1, right);
}

int main(){
    int N,K;
    long int h[100000];
    scanf("%d %d",&N,&K);
    for (int i=0; i<N; i++) {
        scanf("%ld",&h[i]);
    }
    QSort(h,0,N-1);
    long int min=1000000000;
    for (int i=0; i+K-1<N; i++) {
        int s=h[i]-h[i+K-1];
        if (min>s) {
            min=s;
        }
    }
    
    printf("%ld\n",min);
  
    return 0;
}

Measured memory_bytes: 896
/**
*   @author: Kshitiz Srivastava (Pirate_ksh) @ MNNIT Allahabad
*/
#include<bits/stdc++.h>
using namespace std;
 
// General
#define ll long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define mod_ 998244353 
#define endl "\n"
#define debug(x) cout<<x<<endl
#define REP(i,n) for(i=0;i<n;++i)
#define FOR(i,x,n) for(i=x;i<n;++i)
 
// Bounds
#define lb(a, x) a.lower_bound(x)
#define ub(a, x) a.upper_bound(x)
#define all(a) a.begin(),a.end()
 
// Vector
#define vi vector <int>
#define pb(v, x) v.push_back(x)
#define vsi vector <set <int> >
 
// Map
#define mii map <int, int>
 
// Set
#define si set <int>
 
// Pair
#define vpii vector<pair < int, int > >
#define pii pair < int, int >
#define F first
#define S second

ll t, i, j, k, n;
int a[3005];

ll dp[3005][3005][2];
ll DP(int front, int last, int plr) {
    if(front == last) {
        if(!plr) return dp[front][last][plr] = a[front]; // Taro
        else return dp[front][last][plr] = -a[front]; // Jiro
    }
    if(dp[front][last][plr] != -1) return dp[front][last][plr];
    // Taro
    if(plr==0) return dp[front][last][plr] = max(a[front] + DP(front+1, last, 1), a[last] + DP(front, last-1, 1));
    // Jiro
    else return dp[front][last][plr] = min(-a[front] + DP(front+1, last, 0), -a[last] + DP(front, last-1, 0));
}

int main(){
    io;
    t=1;
    while(t--) { 
        cin >> n;
        REP(i,n) cin >> a[i];
        memset(dp, -1, sizeof(dp));
        cout << DP(0,n-1,0) << endl;
    }
    return 0;
}


Measured memory_bytes: 141568
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kishan Sairam Adapa
 */

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define ll long long int
#define MOD ((int)(1e9) + 7)

using namespace std;

class BBeautifulStrings {
public:
    void solve(istream& cin, ostream& cout) {
        string w;
        cin >> w;
        vector<int> a(27, 0);
        for(auto k: w) a[k-'a']++;
        bool flag = true;
        for(auto k: a) if(k%2 == 1) flag = false;
        cout << ((flag) ? "Yes" : "No") << '\n';
    }
};


int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    BBeautifulStrings solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 504
#include<iostream>
#include<cstdio>
using namespace std;
const int MAX = 100005;
struct Node {
	int key;
	Node *parent, *left, *right;
};
Node *root, *NIL;

//????????????
void PreorderTreeWalk(Node *u) {
	if (u == NIL)
		return;
	printf(" %d", u->key);
	PreorderTreeWalk(u->left);
	PreorderTreeWalk(u->right);
}
//????????????
void InorderTreeWalk(Node *u) {
	if (u == NIL)
		return;
	InorderTreeWalk(u->left);
	printf(" %d", u->key);
	InorderTreeWalk(u->right);
}


void insert(int value) {
	Node *y = NIL, *x = root;
	Node *z = new Node();
	z->key = value;
	z->left = z->right = NIL;

	while (x != NIL) {
		y = x;
		// z ??? x ?°???? ??????x????????§??????
		// z ??? x ??§??? ??????x????????§??????
		if (z->key < x->key)
			x = x->left;
		else
			x = x->right;
	}

	z->parent = y;

	// ????????¶????????????root
	if (y == NIL) {
		root = z;
	}else {
		// z ??? y ?°???? ?????¨y????????§
		// z ??? y ??§??? ?????¨y????????§
		if (z->key < y->key)
			y->left = z;
		else
			y->right = z;
	}
}


int main() {
	int n, value;
	char s[200];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s", s);
		if (s[0] == 'i') {
			scanf("%d", &value);
			insert(value);
		}else {
			InorderTreeWalk(root);
			printf("\n");
			PreorderTreeWalk(root);
			printf("\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 26644
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;


public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    long h = scanner.nextLong();
    long pow = 1;
    long count = 0;

    while(h != 0){
        count += pow;
        h /= 2;
        pow *= 2;
    }
    System.out.println(count);

  }
}


Measured memory_bytes: 23764
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		int a = 0;
		int max = 0;
		for(int i=0; i<S.length(); i++) {
			if(S.charAt(i) == 'A' || S.charAt(i) == 'C'
				|| S.charAt(i) == 'G' || S.charAt(i) == 'T') {
				a++;
				max = Math.max(max, a);
			}else {
				a = 0;
			}
		}
		System.out.println(max);
	}

}

Measured memory_bytes: 35564
#include <bits/stdc++.h>
#define ll long long
#define li long int
#define ld long double
#define pl pair<long long, long long>
#define pi pair<int, int>
#define ppl pair<pl, ll>
#define ppi pair<int, pi>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LLFOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define MOD 1000000007
#define M2 998244353
//std::cout <<setprecision(30) << av << endl;
using namespace std;

char a[200][200];
int dp[200][200];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int h, w;
    cin >> h >> w;
    FOR(i, 0, h){
        FOR(j, 0, w){
            cin >> a[i][j];
            //dp[i][j]=1e5;
        }
    }
    if(a[0][0]=='#')dp[0][0]=1;
    else dp[0][0]=0;
    FOR(i, 1, w){
        if(a[0][i-1]=='.'&&a[0][i]=='#'){
            dp[0][i]=dp[0][i-1]+1;
        }else dp[0][i]=dp[0][i-1];
    }
    FOR(i, 1, h){
        if(a[i-1][0]=='.'&&a[i][0]=='#'){
            dp[i][0]=dp[i-1][0]+1;
        }else dp[i][0]=dp[i-1][0];
    }
    FOR(i, 1, h){
        FOR(j, 1, w){
            if(a[i][j-1]=='.'&&a[i][j]=='#'){
                dp[i][j]=dp[i][j-1]+1;
            }else dp[i][j]=dp[i][j-1];

            if(a[i-1][j]=='.'&&a[i][j]=='#'){
                dp[i][j]=min(dp[i][j], dp[i-1][j]+1);
            }else dp[i][j]=min(dp[i][j], dp[i-1][j]);
        }
    }
    cout << dp[h-1][w-1] << endl;
}



Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){ 
    double t, x; cin >> t >> x;
    cout << fixed << setprecision(10);
    cout << t / x << ln;
}

Measured memory_bytes: 256