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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

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

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)1e3+11;

void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        
        cin>>n;
        map<ll,ll> mp;
        for(i=2;i*i<=n;i++){
                ll c=0;
                while(n%i==0){
                        n/=i;
                        c++;
                }
                if(c){
                        mp[i]=c;
                }
        }
        if(n>1){
                mp[n]=1;
        }
        ll ans=0;
        for(auto x:mp){
                ll tt=1;
                while(((tt+1)*(tt+2))/2<=x.ss){
                        tt++;
                }
                ans+=tt;
        }
        cout<<ans<<endl;
        
        
      
       
}
int main(){
        FS;
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

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; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(ll i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j); 
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout<<a<<" "<<b<<" "<<c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 
#define gre(n) greater<n>()

typedef long long ll;
//
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 1000000000;
const double dINF = 1000000000;
const ll INF64 = 922337203685477580ll;
//const ll MOD = 1000000007ll;
const ll MOD = 998244353ll;
const dou pi=3.141592653589793;

//メモ
//二次元配列のresizeのしかた
//vv.resize(n);
//for(size_t i=0; i<n; i++){
// vv[i].resize(n);
//}

//メモ
//負の辺を持つ最短経路問題では到達不可経路でも初期化値より小さくなりうるので注意しよう
int main(){
    int n;
    std::cin >> n;
    VEC(ll,a,n);
    int c=0;
    rep(i,n){
        if(a[i]<0){
            c++;        
            a[i]*=-1;
        }
    }
    sort(all(a));
    if(c%2==1){
        std::cout << sum(a)-a[0]*2 << std::endl;
    }
    else std::cout << sum(a) << std::endl;
}



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

using ll = long long;

int n;
ll a[200010];
ll s[200010];

bool cond(ll x)
{
	int p0 = 0, p1 = 0, p2 = 0;
	for (int i = 0; i < n; i++){
		p2 = i + n;
		while (p0 < p2 && s[p0] - s[i] < x) p0++;
		while (p1 < p2 && s[p1] - s[p0] < x) p1++;
		ll s0 = s[p0] - s[i];
		ll s1 = s[p1] - s[p0];
		ll s2 = s[p2] - s[p1];
		if (min({s0, s1, s2}) >= x) return true;
	}
	return false;
}

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%lld", a + i);
		a[i + n] = a[i];
	}

	for (int i = 0; i < 2 * n; i++){
		s[i + 1] = s[i] + a[i];
	}

	ll lb = 0, ub = 1e15;
	while (ub - lb > 1){
		ll md = (lb + ub) / 2;
		(cond(md) ? lb : ub) = md;
	}

	printf("%lld\n", lb);
}

Measured memory_bytes: 6344
from sys import exit

def sfn(a):
    return a[1]
    

n=int(input())
ab=[]
for i in range(n):
    a,b=map(int,input().split())
    ab.append((a,b))
ab.sort(key=sfn)

time=0

for i in range(n):
    time+=ab[i][0]
    if(time>ab[i][1]):
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 73216
//sjq
#include <cstdio>
#include <algorithm>
#include <stack>
#include <cstring>
#include <vector>
using namespace std;

typedef long long LL;

const int N = 100000;

int n;
LL a[N+5];
int C[N+5];
vector<LL> V;

int main()
{
//	freopen("circle.in", "r", stdin);
//	freopen("circle.out", "w", stdout);
	
	int T;
	//scanf("%d", &T);
	T=1;
	while(T--)
	{
		V.clear();C[0] = 0;
		
		scanf("%d", &n);
		for(register int i=1; i<=n; i++)
		{
			scanf("%lld", &a[i]);
			C[i] = 0;
		}
		
		
		bool p = 1;
		for(register int i=1; i<=n; i++)
		{
			int f = -1;
			for(register int j=V.size()-1; j>=0; j--)
				if(V[j] == a[i])
					f = j;
			if(!~f)
			{
				V.push_back(a[i]);
				C[ V.size()-1 ] = 1;
				if(V.size() > 3)
				{
					p = 0;
					break;
				}
			}
			else C[f]++;
		}
		if(!p)
		{
			printf("No\n");
			continue;
		}
		if(V.size() == 1)
		{
			if(V[0] == 0)
				printf("Yes\n");
			else
				printf("No\n");
			continue;
		}
		if(n % 3)
		{
			if(V.size() == 1 &&V[0] == 0)
				printf("Yes\n");
			printf("No\n");
			continue;
		}
		
		
		
		if(V.size() > 3)
		{
			printf("No\n");
			continue;
		}
		
		if(V.size() == 2)
		{
			if(V[0] == 0 && C[0] == n/3)
				printf("Yes\n");
			else if(V[1] == 0 && C[1] == n/3)
				printf("Yes\n");
			else
				printf("No\n");
			continue;
		}
		
		if(V.size() == 3)
		{
			if(V[0]^V[1]^V[2])
				printf("No\n");
			else if(C[0] == C[1] && C[1] == C[2])
				printf("Yes\n");
			else
				printf("No\n");
			continue;
		}
	}
	return 0;
}


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

def solve():
    import sys
    from collections import deque

    N, M = list(map(int, sys.stdin.readline().split()))
    rooms = [None]*(N+1)
    for _ in range(M):
        A, B = list(map(int, sys.stdin.readline().split()))
        # A, B = A-1, B-1
        if rooms[A] is None:
            rooms[A] = []
        if rooms[B] is None:
            rooms[B] = []
        rooms[A].append(B)
        rooms[B].append(A)

    ans = [None] * (N+1)
    ans[0] = -1
    ans[1] = -1

    # 幅優先探索
    que = deque([1])
    while que:
        room = que.popleft()
        nrooms = rooms[room]
        # print(nrooms)
        # input()

        for nroom in nrooms:
            if ans[nroom] == None:
                ans[nroom] = room
                que.append(nroom)
            else:
                pass

    if None in ans:
        print("No")
        return
    print("Yes")
    for v in ans[2:]:
        print(v)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 34676
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	N, A := nextInt(), nextInt()

	if (N % 500) <= A {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

bool isNumber(string s)
{
	rep(i, s.size())
		if (!('0'<=s[i] && s[i]<='9')) return false;
	return true;
}

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	stack<ll> st;
	string token;
	while(cin>>token){
		if (isNumber(token)){
			st.push(stoll(token));
		}else{
			ll b = st.top(); st.pop();
			ll a = st.top(); st.pop();
			if (token=="+") st.push(a+b);
			if (token=="-") st.push(a-b);
			if (token=="*") st.push(a*b);
		}
	}
	ll ans = st.top(); st.pop();
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3188
from fractions import gcd
from random import randint

def brent(N):
   # brent returns a divisor not guaranteed to be prime, returns n if n prime
   if N%2==0: return 2
   y,c,m = randint(1, N-1),randint(1, N-1),randint(1, N-1)
   g,r,q = 1,1,1
   while g==1:             
       x = y
       for i in range(r):
          y = ((y*y)%N+c)%N
       k = 0
       while (k<r and g==1):
          ys = y
          for i in range(min(m,r-k)):
             y = ((y*y)%N+c)%N
             q = q*(abs(x-y))%N
          g = gcd(q,N)
          k = k + m
       r = r*2
   if g==N:
       while True:
          ys = ((ys*ys)%N+c)%N
          g = gcd(abs(x-ys),N)
          if g>1:  break
   return g

def factorize(n1):
    if n1<=0: return []
    if n1==1: return [1]
    n=n1
    t = {}
    p=0
    mx=1000000
    if n%2 == 0: 
        t[2]=0
    if n%3 == 0:
        t[3]=0
    while n % 2 ==0 :
        t[2] += 1
        n//=2
    
    while n % 3 ==0 : 
        t[3] += 1;n//=3
        
    
    i=5
    inc=2
    # print(n)
    #use trial division for factors below 1M
    while i <=mx:
       while n % i ==0 : 
           if i not in t.keys():
               t[i] = 0
           t[i] += 1
           n//=i
       i+=inc
       inc=6-inc
    #use brent for factors >1M  
    # print(t)
    while n>mx:
      p1=n
      #iterate until n=brent(n) => n is prime
      while p1!=p:
          p=p1
          p1=brent(p)
      # print(p1)
      if p1 not in t.keys():
          t[p1] = 0
      t[p1] += 1;n//=p1 
    # print(n)
    if n!=1:
        t[n] = 1
    return t


from functools import reduce
from sys import argv
def main():
    n, p = tuple(map(int, input().strip().split()))
    if p==1:
        print(1)
        return
    q = factorize(p)
    # print(q)
    ans = 1
    for a in q.keys():
        q[a] //= n
        ans = ans * (a**q[a])
    print(ans)     
    


if __name__ == "__main__":
   main()

Measured memory_bytes: 66904
#include <string>
#include <iostream>
#include <cstdio>
using namespace std;
string a,b,c,d,e,f,g,h;
int main() {
cin >> f;
for(int i=0;i<f.length();i++){
if (f[i]==f[i+1]) return printf("%d %d\n",i+1,i+2), 0;
}
for (int i = 0; i + 2 < f.length(); i++) {
if(f[i]==f[i+2]) return printf("%d %d\n",i+1,i+3), 0;
}
printf("-1 -1\n");
}

Measured memory_bytes: 888
n=int(input(""))
aa=input("").split(" ")
lista=[]
for i in range(n):
    lista+=[int(aa[i])]
lista.sort()
listtf=[]
s=0
for i in range(lista[n-1]):
    listtf+=[True]
for i in range(n):
    
    if(listtf[lista[i]-1]):
        if(i<n-1 and lista[i]==lista[i+1]):
            s-=1
        s+=1
        t=1
        while(t*lista[i]<=lista[n-1]):
            listtf[lista[i]*t-1]=False
            t+=1
print(s)
            
            
        
        
    


Measured memory_bytes: 41212
#include<stdio.h>
#include<string.h>
int main()
{
	int k,i,len;
	char s[101];
	scanf("%d %s",&k,s);
	len=strlen(s);
	if(len>k){
		for(i=0;i<k;i++){
			printf("%c",s[i]);
		}
		printf("...\n");
	}
	else printf("%s",s); 
	return 0;
}

Measured memory_bytes: 1688
N=int(input())
E=[[] for _ in range(N)]
for _ in range(N-1):
    A,B=map(int,input().split())
    E[A-1].append(B-1)
    E[B-1].append(A-1)
MOD=10**9+7

#dp=子ノードの数+1(自分)
dp=[1]*N

root=0
parent=[0]*N
order=[]
def dfs():
    parent[root]=root
    stack=[root]
    while stack:
        node=stack.pop()
        order.append(node)
        for ss in E[node]:
            if parent[node]!=ss:
                stack.append(ss)
                parent[ss]=node

pow2=[1]*(N+1)
for i in range(1,len(pow2)):
    pow2[i]=pow2[i-1]*2%MOD

def solve():
    ans=0
    inv2=pow(2,MOD-2,MOD)
    #p0=すべての部分木に黒頂点が1つも含まれない確率
    p0=pow(pow2[N-1],MOD-2,MOD)
    for i in reversed(order):
        if root!=i:
            dp[parent[i]]+=dp[i]
        p=0
        if len(E[i])>=2:
            #p0*(p1-1)=どれか1つの各部分木に黒頂点が1つ以上含まれる確率
            p1=1
            for s in E[i]:
                size=0
                if parent[i]!=s:
                    size=dp[s]
                elif i!=root:
                    size=N-dp[i]
                else:
                    continue
                p1+=pow2[size]-1
            p=1-(p0*p1)
            p%=MOD
        ans+=p
        ans%=MOD
    #頂点iが白の確率
    ans=ans*inv2%MOD
    print(ans)

dfs()
solve()


Measured memory_bytes: 57788
package main
 
import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)
 
func run() {

	var A int;
    A = nextInt();
    var B int;
    B = nextInt();
	solve(A, B);

}

func solve(A int, B int){
	if A <= B*2 {
		Println(0)
	}else{
		Println(A-B*2)
	}
}


// --- template ---
// Thanks https://gist.github.com/halllllll/853ab587fd82ee3ffe6f7fb7fb499695
 
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
 
// Caution: You will get unexpected result if a single token is larger than this size.
const BufferSize = 64 * 1024 * 1024
 
func Print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(out, a...)
}
 
func Printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, format, a...)
}
 
func Println(a ...interface{}) (n int, err error) {
	return fmt.Fprintln(out, a...)
}
 
func next() string {
	sc.Scan()
	return sc.Text()
}
 
func nextInt() int {
	a, err := strconv.Atoi(next())
	if err != nil {
		log.Fatal(err)
	}
	return a
}

func nextFloat() float64 {
	a, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}


type IntHeap []int
func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

/////数字と文字
// 基本クラス
type NS struct {
    Num int
    Str string
}

//////　数字と数字
// 基本クラス
type NN struct {
    Num1 int
    Num2 int
}

 
func main() {
	sc.Buffer(make([]byte, 0, BufferSize), BufferSize)
	sc.Split(bufio.ScanWords)
	run()
	out.Flush()
}



Measured memory_bytes: 2688
#include <stdio.h>
int main() {
  int n;
  char s[101],t[101];
  scanf("%d %s %s",&n,s,t);
  for (int i=0; i<n; i++) {
    printf("%c%c",s[i],t[i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 128
// G++ MACRO.CPP -STD=C++17
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair



int main(){
  
  CIN(a,b);
  if(a==b)EN(Draw);
  if(a==1)EN(Alice);
  if(b==1)EN(Bob);
  SANKOU(a>b,Alice,Bob);

  return 0;
}

Measured memory_bytes: 384
s = input()

length = len(s)

if len(s) ==1:
    flag1, flag2= True, True
else:
    flag1, flag2= False, False

odds = "RUD"
evens ="LUD"

for x in range (0,len(s),2):
    if s[x] in odds:
        flag1 = True        
    else:
        flag1= False
        break
        

for x in range (1,len(s),2):
    if s[x] in evens:
        flag2 = True
    else:
        flag2 = False
        break

if flag1 ==True and flag2 == True:
    print ("Yes")
else:
    print ("No")



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, s, e) for(int i = s; i < e; i++)
#define rrep(i, s, e) for(int i = s; i > (s)-(e); i--)
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;



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


  int n;
  cin >> n;

  if (n/100 == n%10) pr("Yes");
  else pr("No");


  return 0;
}


Measured memory_bytes: 256
from sys import stdin
import numpy as np

N = int(stdin.readline())
W = [int(x) for x in stdin.readline().rstrip().split()]

min_sum = 100 * 100
for i in range(N):
    tmp = abs(np.sum(W[:i]) - np.sum(W[i:]))
    if tmp < min_sum:
        min_sum = tmp


print(min_sum)

Measured memory_bytes: 21672
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;

    cout << (a + b + 1) / 2 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define mod 1000000007

int main() {
	string s;
	cin >> s;
	if (s[0] == '7' || s[1] == '7' || s[2] == '7')
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 3596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; i < 10; i++)
                for (int j = 1; j < 10; j++)
                    Console.WriteLine(i + "x" + j+"="+i * j);
        }
    }
}

Measured memory_bytes: 5548
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
using namespace std;

int ary[100000] = { 0 };

signed main()
{
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++)
	{
		int a, b;
		cin >> a >> b;
		ary[a]++;
		ary[b]++;
	}
	for (int i = 0; i < N; i++)
	{
		if (ary[i] % 2 == 1)
		{
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	int n=s.size();
	int ans=100000,cur=0,cnt=0;
	for(char c='a';c<='z';++c){
		rep(i,n){
			if(s.at(i)!=c) cnt++;
			else{
				cur=max(cur,cnt);
				cnt=0;
			}
		}
		cur=max(cur,cnt);
		ans=min(ans,cur);
		cnt=0;
		cur=0;
	}
	cout << ans << endl;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(ll)(n);i>0;i--)
#define REP(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 2e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);


int main () {
  int n;
  cin >> n;
  vl a(n);
  vl sum(n + 1);
  rep (i, n) {
    cin >> a[i];
    sum[i + 1] = sum[i] + a[i];
  }
  ll ans = INF;
  for (int i = 2; i <= n - 2; i++) {
    ll sum1 = sum[i] - sum[0], sum2 = sum[n] - sum[i];
    int l = 1, r = i;
    while (l + 1 < r) {
      int m1 = (2*l + r) / 3, m2 = (l + 2*r) / 3;
      ll diff1 = abs(sum[m1] - (sum1 - sum[m1])), diff2 = abs(sum[m2] - (sum1 - sum[m2]));
      if (diff1 >= diff2) {
        l = m1 + 1;
      }
      else {
        r = m2;
      }
    }
    ll s1 = sum[l], s2 = sum[i] - sum[l];
    l = i + 1; r = n;
    while (l + 1 < r) {
      //DEBUG(l); DEBUG(r);

      int m1 = (2*l + r) / 3, m2 = (l + 2*r) / 3;
      //DEBUG(m1); DEBUG(m2);
      ll s1 = sum[m1] - sum[i], s2 = sum[m2] - sum[i];
      ll diff1 = abs(s1 - (sum2 - s1)), diff2 = abs(s2 - (sum2 - s2));
      //DEBUG(diff1); DEBUG(diff2);

      if (diff1 >= diff2) {
        l = m1 + 1;
      }
      else {
        r = m2;
      }
    }
    ll s3 = sum[l] - sum[i], s4 = sum[n] - sum[l];
    //DEBUG(s1); DEBUG(s2); DEBUG(s3); DEBUG(s4);
    ll mi = min(s1, min(s2, min(s3, s4)));
    ll ma = max(s1, max(s2, max(s3, s4)));
    chmin(ans, ma - mi);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3328
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:500000000") 
#include <functional>
#include <algorithm>
#include <iostream> 
#include <string.h> 
#include <stdlib.h>
#include <complex>
#include <sstream> 
#include <numeric>
#include <ctype.h> 
#include <stdio.h> 
#include <bitset>
#include <vector> 
#include <string> 
#include <math.h> 
#include <time.h> 
#include <queue> 
#include <stack> 
#include <list>
#include <map> 
#include <set> 
#define Int long long 
#define INF 0x3F3F3F3F 
#define eps 1e-9
using namespace std;


#pragma comment(linker, "/STACK:500000000") 
#include <functional>
#include <algorithm> 
#include <iostream> 
#include <string.h> 
#include <stdlib.h>
#include <limits.h>
#include <numeric>
#include <sstream> 
#include <fstream>
#include <ctype.h> 
#include <stdio.h> 
#include <bitset>
#include <vector> 
#include <string> 
#include <math.h> 
#include <time.h> 
#include <queue> 
#include <stack> 
#include <list>
#include <map> 
#include <set> 
#define Int long long 
#define eps 1e-9
using namespace std;
typedef pair<int, int> pii;

#define MAXN 11111

int N;
string mark[MAXN];
int used[MAXN], nex[MAXN];
map<string, int> M;
vector<int> ans;

void read(int cur)
{
	while (!used[cur])
	{
		ans.push_back(cur);
		used[cur] = 1;
		if (nex[cur] == -1)
			break;
		cur = nex[cur];
	}
}

int main()
{
	while (cin >> N && N)
	{
		for (int i = 0; i < N; i++)
			cin >> mark[i];
		fill(used, used + 10010, 0);
		fill(nex, nex + 10010, -1);
		M.clear();
		ans.clear();

		for (int i = 0; i < N; i++)
		{
			if (mark[i] == "-")
				read(i);
			else if (mark[i] == "v")
				nex[i + 1] = i;
			else
			{
				string type;
				int number = 0;
				int x = 0;
				while (islower(mark[i][x]))
				{
					type += mark[i][x];
					x++;
				}
				while (x<mark[i].size() && isdigit(mark[i][x]))
				{
					number = number * 10 + mark[i][x] - '0';
					x++;
				}
				if (M.find(type) != M.end())
					nex[i] = M[type];
				
				if (number > 1)
					M[type] = i;
				else 
					M.erase(type);

				if (x < mark[i].size())
					nex[i + 1] = i;
				else if (number == 1)
					read(i);
			}
		}
		for (int i = 0; i < N; i++)
			cout << ans[i] + 1 << endl;
	}
}

Measured memory_bytes: 2860
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}


void solve()
{
	bool ok = 1;
	int n;
	cin >> n;
	for(int i = 0; i < n; ++i){
		int x;
		cin >> x;
		if(x % 2 == 0 && (x % 3 != 0 && x % 5 != 0)) ok = 0;
	}
	cout << (ok ? "APPROVED" : "DENIED");
}
 
 
 
 
int main()
{
    Red;
  	//int T; cin >> T; while(T--)
    solve();
    return 0;
}


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

dp = [[0.0 for i in range(N+1)] for j in range(N+1)]
dp[0][0] = 1.0
for i in range(N):
    for j in range(i+1):
        dp[i+1][j+1] += dp[i][j] * p[i]
        dp[i+1][j] += dp[i][j] * (1 - p[i])

ans = 0.0
for i in range(int((N+1) / 2), N+1):
    ans += dp[N][i]

print(ans)

Measured memory_bytes: 120156
#include <iostream>
#include <algorithm>
using namespace std;
int main () {
	int n;
	cin >> n;
	int a[n];
	for (int i=0; i<n; i++) {
		cin >> a[i];
	}
	sort(a, a+n, greater<int>());
	long long ans = a[0];
	int cnt = n-2;
	for (int i=1; i<n; i++) {
		ans += a[i]*min(2, cnt);
		cnt -= 2;
		if (cnt <= 0) break;
	}
	cout << ans << endl;
}

Measured memory_bytes: 4368
#include <stdio.h>

int main(void)
{
    char a[4];
    scanf("%s", a);
    char b[4];
    scanf("%s", b);
    if (a[0] == b[2] && a[1] == b[1] && a[2] == b[0])
        puts("YES");
    else
        puts("NO");
    return 0;
}

Measured memory_bytes: 128
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int[] a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
		
		// 計算
		int result = 0;
		result = a[n-1];
		
		// 出力
		System.out.println(result);
	}
}





Measured memory_bytes: 23764
#include <stdio.h>
 
int main(){
	long long int x,i,j,rem=0;
	scanf("%lld",&x);
	i = x/11;
	j = x%11;
	if(j>6){
	rem = rem + 2; 
	}else{
	rem = rem + 1;
	}
	if(j == 0){
	rem = 0;
	}
	x = i*2 + rem;
	printf("%lld",x);
	return 0;
	}

Measured memory_bytes: 128
#include <stdio.h>

int main(void){
    int a, b;
    scanf("%d %d", &a, &b);
    if(a == 1) a = 236;
    if(b == 1) b = 236;
    
    printf("%s\n", (a > b)? "Alice" : (a == b)? "Draw" : "Bob");
    return 0;
}

Measured memory_bytes: 128
const main = (inputs) => {
  var N = inputs[0] - 0;
  var obj = new Object();

  for (var i = 1; i <= N; i++) {
    var word = inputs[i];
    obj[word] = 1;
  }

  console.log(Object.keys(obj).length);
}
main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));

Measured memory_bytes: 83212
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
#include <queue>
#include <string>

using namespace std;
using P=tuple<int, int>;

class Solver {
};

int solve(int p, int q, int r, string s) {
	int val = 0;
	if (s[0] == '(') {
		int nest = 0;
		string now = "";
		bool plus = false;
		int val1 = 0;
		for (int i = 1; i < s.size()-1; i++) {
			if (nest == 0 && s[i] == '+') {
				plus = true;
				val1 = solve(p, q, r, now);
				now = "";
			}
			else if (nest == 0 && s[i] == '*') {
				plus = false;
				val1 = solve(p, q, r, now);
				now = "";
			}
			else {
				now += s[i];
				if (s[i] == '(')nest++;
				if (s[i] == ')')nest--;
			}
		}
		int val2 = solve(p, q, r, now);
		if (plus) {
			val = max(val1, val2);
		}
		else {
			val= min(val1, val2);
		}
	}
	else {
		if (s[0] == '-') {
			val= 2 - solve(p, q, r, s.substr(1));
		}
		else {
			if (s[0] == '0')val= 0;
			if (s[0] == '1')val = 1;
			if (s[0] == '2')val = 2;
			if (s[0] == 'P')val = p;
			if (s[0] == 'Q')val = q;
			if (s[0] == 'R')val = r;
		}
	}
	return val;
}

string replace_all(string s, string before, string after) {
	string now = "";
	vector<bool> replacable(s.size(), false);
	for (int i = 0; i < s.size() - before.size() + 1; i++) {
		bool valid = true;
		for (int j = 0; j < before.size(); j++) {
			if (s[i + j] == before[j])continue;

			valid = false;
			break;
		}
		if (valid) {
			for (int j = 0; j < before.size(); j++) {
				replacable[i + j] = true;
			}
			i += before.size();
		}
	}

	string ret = "";
	for (int i = 0; i < s.size(); i++) {
		if (replacable[i]) {
			ret += after;
			i += before.size() - 1;
		}
		else {
			ret += s[i];
		}
	}
	return ret;
}

int main() {
	while (true) {
		string s;
		cin >> s;
		if (s[0] == '.')break;

		s = replace_all(s, "--", "");

		int res = 0;
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 3; k++) {
					if (solve(i, j, k, s) == 2)res++;
				}
			}
		}

		cout << res << endl;
	}
}


Measured memory_bytes: 3048
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#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 RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n,m;
  cin >> n >> m;

  int e[8][8] = {};
  REP(_,m){
    int x,y;
    cin >> x >> y; x--; y--;
    e[x][y] = e[y][x] = 1;
  }

  vec a(n); REP(i,n) a[i] = i;

  int ans=0;
  do{
    bool flag = true;
    REP(i,n-1){
      if(e[a[i]][a[i+1]]==0) flag = false;
    }
    if(flag) ans++;
  }while(next_permutation(a.begin()+1,a.end()));

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

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <cstdio>
#include <cstring>

#define ll long long

// 処理内容
int main() {

    ll k; scanf("%lld", &k);
    unsigned ll dp[100000];
    memset(dp, 0xFF, sizeof(unsigned ll) * k);
    dp[1] = 1;

    // deque
    ll qv[100000] = {1};
    ll qbeg = 0, qend = 1;

    while (qbeg != qend) {

        ll v = qv[qbeg];
        ll c = dp[v];
        qbeg++; if (qbeg == k) qbeg = 0; // pop_front

        ll n1 = -~v; if (n1 == k) n1 = 0;
        ll n2 = v * 10; while (n2 >= k) n2 -= k;
        if (dp[n1] > -~c) {
            dp[n1] = -~c;
            // push_back
            qv[qend] = n1;
            qend++; if (qend == k) qend = 0;
        }
        if (dp[n2] > c) {
            dp[n2] = c;
            // push_front
            qbeg--; if (qbeg == -1) qbeg = ~-k;
            qv[qbeg] = n2;
        }
        
    }

    printf("%llu", dp[0]);
    
}

Measured memory_bytes: 1664
from itertools import accumulate
import sys
input = sys.stdin.readline

def solve():
    N = int(input())
    Sss = [input().rstrip() for _ in range(N)]

    numL = numR = 0
    Pluss, Evens, Minuss = [], [], []
    for Ss in Sss:
        nums = [0] + [1 if S == '(' else -1 for S in Ss]
        nums = list(accumulate(nums))
        x = min(nums)
        y = nums[-1] - x
        x, y = abs(x), abs(y)
        if x == 0:
            numL += y
        elif y == 0:
            numR += x
        else:
            if x > y:
                Minuss.append((x, y))
            elif x < y:
                Pluss.append((x, y))
            else:
                Evens.append((x, y))

    Pluss.sort(key=lambda x: x[0])
    Minuss.sort(key=lambda x: x[1], reverse=True)

    v = numL
    for x, y in Pluss:
        v -= x
        if v < 0:
            return False
        v += y
    for x, y in Evens:
        v -= x
        if v < 0:
            return False
        v += y
    for x, y in Minuss:
        v -= x
        if v < 0:
            return False
        v += y
    v -= numR
    return v == 0


if solve():
    print('Yes')
else:
    print('No')


Measured memory_bytes: 50572
#include <iostream>
    #include <cstdio>
    #include <algorithm>
    #include <vector>
    #include <string>
    #include <string.h>
     
    typedef long long ll;
    using namespace std;
    const ll INF = 1000000000000000000ll;
    const ll MOD = 1000000007ll;
     
    const double EPS = 1e-8;
     
    int main()
    {
    	char s[3][10];

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

		cout << (char)toupper(s[0][0]) << (char)toupper(s[1][0]) << (char)toupper(s[2][0]) << endl;

    	return 0;
    }

Measured memory_bytes: 256
col = { 
    7 => 1,
    4 => 1,
    1 => 1,
    8 => 2,
    2 => 2,
    9 => 3,
    6 => 3,
    3 => 3,
}

loop do
    seq = gets.chomp.split("").map(&:to_i)
    break if seq == [0] 
    hash = {}
    ((1..9).to_a - [5]).permutation(2) do |i, j|
        next if col[i] > col[j]
        hash[[i, j, nil]] = 0 
    end 

    seq.each do |k| 
        hash2 = Hash.new(Float::INFINITY)
        hash.each do |(i, j, prev_foot), v|
            if col[k] <= col[j]
                v2 = (prev_foot == :left ? v + 1 : v)
                key = [k, j, :left]
                hash2[key] = v2 if v2 < hash2[key]
            end
            if col[i] <= col[k]
                v2 = (prev_foot == :right ? v + 1 : v)
                key = [i, k, :right]
                hash2[key] = v2 if v2 < hash2[key]
            end
        end
        hash = hash2
    end 
    p hash.values.min
end

Measured memory_bytes: 21056
#include <iostream>
#include <algorithm>
#include <string>
#define all(x) (x).begin(),x.end()
using namespace std;
int dp[3005][3005];

int main(){
  cin.tie(0);ios::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  for(int i = 0; i < s.size(); i++){
    for(int j = 0; j < t.size(); j++){
      if(s[i] == t[j]) dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
      dp[i + 1][j + 1] = max({dp[i][j + 1], dp[i + 1][j], dp[i + 1][j + 1]});
    }
  }

  string ans = "";
  int x = s.size(), y = t.size();
  while(dp[x][y]){
    while(dp[x][y] == dp[x - 1][y]) x--;
    while(dp[x][y] == dp[x][y - 1]) y--;
    x--, y--;
    ans += s[x];
  }
  
  reverse(all(ans));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define endl "\n"
#define pi 3.14159265358979323846264338327950288
#define MOD 1000000007
#define INF -100000000000000
#define ordered_set tree<pair< ll int ,ll  int>, null_type,less<pair<ll int, ll int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
using namespace std;
#define lld long double
using namespace __gnu_pbds;
ll int f[200005]={0};
ll int dp[200005][2]={0};
//dp[i][0]=no of configs in which the ith node can be coloured white in its subtree
void dfs(ll int start,vector<ll int> v[],ll int parent)
{
	f[start]=-1;
	for(ll int i=0;i<v[start].size();i++)
	{
		if(f[v[start][i]]!=-1)
			dfs(v[start][i],v,start);
	}
	if(v[start].size()==1 && start!=1)
	{//cout<<start<<" "<<parent<<endl;
		dp[start][0]=dp[start][1]=1;
		dp[parent][0]=((dp[parent][0])%MOD*(dp[start][0]+dp[start][1])%MOD)%MOD;
		dp[parent][1]=(dp[parent][1]%MOD*dp[start][0]%MOD)%MOD;
	}
	else
	{//cout<<start<<" "<<parent<<endl;
		dp[parent][0]=((dp[parent][0])%MOD*(dp[start][0]+dp[start][1])%MOD)%MOD;
		dp[parent][1]=(dp[parent][1]%MOD*dp[start][0]%MOD)%MOD;
	}
}
int main()
{
    fast;
    ll int n;
    cin>>n;ll int i,x,y;
    vector<ll int> v[n+1];
    for(i=1;i<n;i++)
    {
    	cin>>x>>y;
    	v[x].PB(y);
    	v[y].PB(x);
    }
    if(n==1)
    {
    	cout<<2<<endl;
    	exit(0);
    }
    for(i=1;i<=n;i++)
    	dp[i][0]=dp[i][1]=1;
    dfs(1,v,0);
    cout<<(dp[1][0]+dp[1][1])%MOD<<endl;
    //cout<<dp[1][0]<<" "<<dp[1][1]<<endl;
   // for(i=1;i<=n;i++)
    //	cout<<dp[i][0]<<" "<<dp[i][1]<<endl;
}

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

int main() {
    int a, b;
    char op;
    cin >> a >> op >> b;
    
    if(op == '+'){
        cout << a + b << endl;
    }else cout << a - b << endl;
}

Measured memory_bytes: 3644
#include <algorithm>
#include <iostream>
#include <vector>
#include <numeric>
#include <string>
#include <stdio.h>
#include <set>
#include <iomanip>
using namespace std;
 
int main(){
    // 'r' : Red
    int H, W, K;
    int ans = 0;
    cin >> H >> W >> K;
    vector<int> p(H);
    vector<int> q(W);
    char c[H][W];
    char f[H][W];
    for (int i=0; i<H; i++) p[i] = i;
    for (int i=0; i<W; i++) q[i] = i;
    for (int i=0; i<H; i++){
        for (int j=0; j<W; j++){
            cin >> c[i][j];
        }
    }
    vector<vector<int>> A, B;
    for (int bit = 0; bit < (1<<H); ++bit) {
        vector<int> S;
        for (int i = 0; i < H; ++i) {
            if (bit & (1<<i)) { // 列挙に i が含まれるか
                S.push_back(i);
            }
        }
        A.push_back(S);
    }
    for (int bit = 0; bit < (1<<W); ++bit) {
        vector<int> S;
        for (int i = 0; i < W; ++i) {
            if (bit & (1<<i)) { // 列挙に i が含まれるか
                S.push_back(i);
            }
        }
        B.push_back(S);
    }
    for (auto x : A){
        for (auto y : B){
            // initialize
            for (int i=0; i<H; i++){
                for (int j=0; j<W; j++){
                    f[i][j] = c[i][j];
                }
            }
            for (auto i : x){
                for (int j=0; j<W; j++) f[i][j] = 'r';
            }
            for (auto j : y){
                for (int i=0; i<H; i++) f[i][j] = 'r';
            }
            // count black
            int black = 0;
            for (int i=0; i<H; i++){
                for (int j=0; j<W; j++){
                    if (f[i][j] == '#'){
                        black += 1;
                    }
                }
            }
            if (black == K) ans += 1;
        }
    }

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

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define IOS   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define mp    make_pair
#define pb    push_back
#define F     first
#define pi 	  3.14159265358979323846
#define S     second
#define ll    long long
#define ld    long double
#define sz(s) (ll)s.size() 
#define vl    vector < ll >
#define pll   pair < ll, ll >
#define ml    map < ll, ll >
#define mod   1000000007
#define qe	  998244353
#define MAXN  100005
#define mx    10000005
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define inv(i,a,b)  for(i=a;i>=b;i--)
#define all(a)  (a).begin(),(a).end()
using namespace std;
int main(){
//	#ifndef ONLINE_JUDGE
//    if (fopen("input.txt", "r"))
//    {
//        freopen("input.txt", "r", stdin);
//        freopen("output.txt", "w", stdout);
//    }
//	#endif
	IOS;
	ll t,n,l,l1;
	ll i,j,m,mn,q,d,x,y,sum=0,r,p,k,c;
	string s,s1;
//	cin>>t;
//	while(t--){
    cin>>n;
	ll a[n],ans=0;
//	for(i=0;i<n;i++)cin>>a[i];
	j=1;
	ll dp[n+1][3]={0};
	for(i=1;i<=n;i++){
		cin>>p>>k>>c;
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+p;
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+k;
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c;
	}
	ans=max(dp[n][0],max(dp[n][1],dp[n][2]));
	cout<<ans;
//	}
}

Measured memory_bytes: 5928