akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
int mabs(int x){
    if(x<0) return x*-1;
    return x;
}
int main() {
    int x,y,n,t,nt,nx,ny;
    while(~scanf("%d",&n)){
        bool flag=1;
        x=0;
        y=0;
        t=0;
        for(int i=0;i<n;i++){
            scanf("%d%d%d",&nt,&nx,&ny);
            if(nt-t<mabs(nx-x)+mabs(ny-y)) flag=0;
            else {
                if(((mabs(nx-x)+mabs(ny-y))+nt-t)%2!=0){
                    flag=0;
                }
            }
            x=nx;y=ny;t=nt;
        }
        if(flag) printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
/*
 *architect034
 *NIT Silchar<36>
 */
#include<bits/stdc++.h>
using namespace std;
#define bhago   ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll   long long
#define ull unsigned long long
#define loop(i,start,end,increment)   for(ll i=start;i<=end;i+=increment)
#define ulta(i,start,end,decrement)   for(ll i=start;i>=end;i-=decrement)
#define pb   push_back
#define popb   pop_back
#define pf   push_front
#define popf   pop_front
#define mp   make_pair
#define FF   first
#define SS   second#FFFFFF
#define all(something)   something.begin(),something.end()
#define vecitr   vector<ll>::iterator
#define setitr   set<ll>::iterator
#define mapitr   map<ll,ll>::iterator
#define mod   1000000007
void debug(string s)
{
    cout<<s<<"\n";
}
const int MAX = 2000007;
bool prime[MAX];
int sp[MAX];
void sieve()
{
    for (int i = 2; i < MAX; i += 2)
    {
        sp[i] = 2;//even numbers have smallest prime factor 2
    }
    for (ll i = 3; i < MAX; i += 2)
    {
        if (!prime[i])
        {
            sp[i] = i;
            for (ll j = i; (j*i) < MAX; j += 2)
            {
                if (!prime[j*i])
                {
                    prime[j*i] = true;
                    sp[j*i] = i;
                }
            }
        }
    }
}
ll GCD(ll a,ll b)
{
    ll c=a%b;
    while(c!=0)
    {
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}
ll power(ll a,ll b)
{
    ll ans=1;
    while(b!=0)
    {
        if(b%2==1)
            ans*=a;
        a*=a;
        b=b>>1;
    }
    return ans;
}
int main()
{
    bhago;
    ll n;
    cin>>n;
    vector<long double> v(n+1);
    for(int i=0;i<n;i++){
        cin>>v[i+1];
    }
    vector<long double> dp(n+1,0);
    dp[0]=1;
    for(int i=1;i<=n;i++){
        for(int j=n;j>=0;j--){
            dp[j]=dp[j]*(1-v[i]);
            if(j>0){
                dp[j]=dp[j]+(v[i]*dp[j-1]);
            }
        }
    }
    // for(int i=0;i<=n;i++){
    //     cout<<dp[i]<<" ";
    // }
    // cout<<"\n";
    long double ans=0;
    for(int i=(n+1)/2;i<=n;i++){
        ans+=dp[i];
    }
    cout<<setprecision(10)<<fixed<<ans;
    return 0;
}


Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;


public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskT solver = new TaskT();
        solver.solve(1, in, out);
        out.close();
    }
    
    

    static class TaskT {
    	static int counter = 0;
        public void solve(int testNumber, InputReader in, PrintWriter out) {

        	int N = in.nextInt();
        	// if N = 1e6 then A*B product shldnt exceed 1e6 => A and B independently cannot exceed 1e3 
        	// c is subtraction of this product from N
        	long cnt = 0;
        	for(int A = 1 ; A < N; A++){
        		for(int B = 1; A * B < N; B++ ){
        			cnt++;
        		}
        	}
        	out.println(cnt);
        	
        }
        
     
        
        

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        
        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 32960
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();
		
		if(W>=2*r && H>=2*r) {
			if(x >= r && x <= W-r) {
				if(y >= r && y <= H-r) {
					System.out.println("Yes");
				} else {
					System.out.println("No");
				}
			} else {
				System.out.println("No");
			}
		} else {
			System.out.println("No");
		}
		sc.close();
	}
	
}


Measured memory_bytes: 26396
#include <iostream>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
int main(void)
{
	long long N; cin >> N;
	vector<long long>hai(N + 2, 0);//0~N+1
	for (long long i = 1; i < N + 1; i++)
	{
		cin >> hai[i];
	}
	long long count = 0;
	for (long long i = 1; i < N + 2; i++)
	{
		count += abs(hai[i] - hai[i - 1]);
	}
	for (long long i = 1; i < N + 1; i++)
	{
		if (hai[i - 1] > hai[i] && hai[i] < hai[i + 1])
		{
			cout << count - abs(hai[i] - hai[i + 1]) - abs(hai[i] - hai[i - 1]) + abs(hai[i - 1] - hai[i + 1])<< "\n";
			continue;
		}
		if (hai[i - 1] < hai[i] && hai[i] > hai[i + 1])
		{
			cout << count - abs(hai[i] - hai[i + 1]) - abs(hai[i] - hai[i - 1]) + abs(hai[i - 1] - hai[i + 1])<< "\n";
			continue;
		}
		cout << count << "\n";
	}
}


Measured memory_bytes: 2048
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
ships = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    ships[a-1].append(b-1)
    ships[b-1].append(a-1)

if set(ships[0]) & set(ships[-1]) == set():
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')


Measured memory_bytes: 51564
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	int l, r;
	int people = 0;
	for (int i = 0; i < n; ++i) {
		cin >> l >> r;
		people += (r - l + 1);
	}

	cout << people << "\n";
	
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const double EPS = 1e-10;
const ll mod=1000000007;
//const ll mod=998244353;
int main(void){
    ll x,k,d;
    cin>>x>>k>>d;
    x=abs(x);
    if(k<=x/d) cout<<x-k*d<<endl;
    else{
        ll amari=x%d;
        ll nokori=abs(k-(x-amari)/d);
        if(nokori%2==0) cout<<amari<<endl;
        else cout<<abs(amari-d)<<endl;
    }
}

Measured memory_bytes: 3632
// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <set>
#include <queue>
#include <cstdio>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define irep(i, n) for(int i=n-1;i>=0;i--)
#define lrep(i, n) for(long long i=0;i<n;i++)
typedef long long ll;
typedef vector<long long> llv;
typedef vector<vector<long long> > llvv;
template <class T> T gcd(T n, T m){return m ? gcd(m, n%m):n;}

int main(){
    int h,w,a,b;
    cin >> h >> w >> a >> b;
    for(int i=0;i<h;i++){
        for (int j=0;j<w;j++){
            int x = (j<a) ^ (i<b);
            cout << x;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1280
def main():
	n, m, c = map(int, input().split())
	b = list(map(int, input().split()))
	total = 0
	for _ in range(n):
		a = list(map(int, input().split()))
		sum = 0
		for i in range(m):
			sum += b[i]*a[i]
		if sum > -c:
			total += 1
	print(total)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
main(){
	int N, K;
	cin >> N >> K;
	vector<int> H(N);
	for(int i = 0; i < N; i++)
		cin >> H.at(i);
	sort(H.begin(), H.end());
	int sum = 0;
	for(int i = 0; i < N-K; i++)
		sum += H.at(i);

	cout << sum << endl;

	return 0;
}

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

class Dice{
public:
	int m_t, m_s, m_e, m_w, m_n, m_b;
	Dice(int a[6]){
		m_t = a[0];
		m_s = a[1];
		m_e = a[2];
		m_w = a[3];
		m_n = a[4];
		m_b = a[5];
	}
	~Dice(){}
	void south(){
		int tmp = m_t;
		m_t = m_n;
		m_n = m_b;
		m_b = m_s;
		m_s = tmp;
	}
	void east(){
		int tmp = m_t;
		m_t = m_w;
		m_w = m_b;
		m_b = m_e;
		m_e = tmp;
	}
	void west(){
		int tmp = m_t;
		m_t = m_e;
		m_e = m_b;
		m_b = m_w;
		m_w = tmp;
	}
	void north(){
		int tmp = m_t;
		m_t = m_s;
		m_s = m_b;
		m_b = m_n;
		m_n = tmp;
	}
};

int main(){
	int a[6];
	for (int i = 0; i < 6; i++) cin >> a[i];
	Dice k(a);
	string op;
	cin >> op;
	for (unsigned int i = 0; i < op.size(); i++){
		if (op[i] == 'S') k.south();
		if (op[i] == 'E') k.east();
		if (op[i] == 'W') k.west();
		if (op[i] == 'N') k.north();
	}
	cout << k.m_t << endl;
}


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

using namespace std;

#define ll long long
#define fix cout << fixed; cout << setprecision(0)





void solve() {

	int n;
	cin >> n;
	ll total = 0;
	total += 1000 * (n / 500);
	n %= 500;
	total += 5 * (n / 5);
	fix;
	cout << total << "\n";
	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	fix;
	solve();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    int t;
    cin >> X >> t;
    cout << max(X - t, 0LL) << endl;
}

Measured memory_bytes: 3584
n,k = map(int,input().split())
s = set()
l = []
ln = [[] for i in range(n)]
for i in range(n):
    t,m = map(int,input().split())
    l.append([m,t-1])
    ln[t-1].append(m)
l.sort(reverse = True)
cand = []

ans = 0
mod = []
for i in range(k):
    ans += l[i][0]
    if l[i][1] in s:
        mod.append(l[i][0])
    else:
        s.add(l[i][1])
x = len(s)
now = ans + x**2

for i in range(n):
    
    if i in s or ln[i] == []:
        continue
    cand.append(max(ln[i]))

cand.sort(reverse = True)

for i in range(min(len(mod),len(cand))):
    ans += cand[i]-mod[-1-i]
    x += 1
    now = max(now,ans+x**2)
print(now)





Measured memory_bytes: 34136
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<iterator>
#include<stack>
#include<queue>
#include<utility>
#include<functional>
#include<bitset>
#include<numeric>
#include<cstring>
#include<tuple>
using namespace std;

long long w, h, x, y;

int main( void )
{
	ios :: sync_with_stdio( 0 );
	cin.tie( 0 );
	
	cin >> w >> h >> x >> y;
	cout << setprecision( 15 ) << fixed << ( double( w ) * h ) / 2 << " " << ( ( 2 * x == w && 2 * y == h ) ? 1 : 0 ) << "\n";
	return 0;
}

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

int main(){
	int N;
	int L;
	int s = 0;
	cin >> N;
	cin >> L;
	int a[N] = {0};
	int k;
	int minn = 10000;
	int maxn = -10000;
	for(int i = 1; i <= N; i++){
		a[i] = L + i - 1;//-101
		s += a[i];//0
	}
	k = s - a[1];
	for(int i = 1; i <= N - 1; i++){
	    if(a[i] == 0){
	    	k = s;
	    	break;
		}
		if(abs(s-a[i])< abs(s - a[i+1]))
		    k = s - a[i+1];
	}
	cout << k;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#define int long long int
void solve()
{
    int k,cnt=0,rem=0,num=7;
   cin>>k;
   if(k%2==0)
    cout<<"-1"<<"\n";
   else
   {
       while(1)
       {
           rem+=(num%k);
           num%=k;
           num*=10;
           cnt++;
           rem%=k;
           if(rem%k==0)
            break;
            if(cnt>1000000)
            {
                cnt=-1;
                break;
            }
       }
       cout<<cnt<<"\n";
   }
}

signed main()
{
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
 cout.tie(NULL);
 int t=1;
//cin>>t;
while(t--)
{
  solve();
}
  return 0;
}


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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int a,b;
    cin>>a>>b;
    
    for(int i=1;i<=10000;++i){
        int e = floor(i*0.08);
        int t = floor(i*0.1);
        if(e ==a and b ==  t){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

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

public class Main{

	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner(System.in);
		int n=sc.nextInt();
		int x = sc.nextInt();
		if(x==1||x==2*n-1) {
			System.out.println("No");
			return;
		}
		System.out.println("Yes");
		if(n==2) {
			System.out.println(1);
			System.out.println(2);
			System.out.println(3);
			return;
		}
		if(x+1!=2*n-1) {
			Queue<Integer> q=new ArrayDeque<>();
			for(int i=2; i<2*n-1;i++) {
				if(i!=x+1&&i!=x)
					q.add(i);
			}
			for(int i=0; i<n-3; i++) {
				int e=q.poll();
				System.out.println(e);
			}
			System.out.println(x+1);
			System.out.println(1);
			System.out.println(x);
			System.out.println(2*n-1);
			for(int i=0; i<n-2; i++) {
				System.out.println(q.poll());
			}	
		} else {
			Queue<Integer> q=new ArrayDeque<>();
			for(int i=2; i<2*n-1;i++) {
				if(i!=x-1&&i!=x)
					q.add(i);
			}
			for(int i=0; i<n-3; i++) {
				int e=q.poll();
				System.out.println(e);
			}
			System.out.println(x-1);
			System.out.println(1);
			System.out.println(x);
			System.out.println(2*n-1);
			for(int i=0; i<n-2; i++) {
				System.out.println(q.poll());
			}	
		}
	}

	static class MyScanner
	{
		BufferedReader br;
		StringTokenizer st;
		public MyScanner(InputStream s) 
		{
			br=new BufferedReader(new InputStreamReader(s));
		}
		public String nextLine() throws IOException
		{
			return br.readLine();
		}
		public String next() throws IOException
		{
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException
		{
			return Integer.parseInt(next());
			
		}
		public double nextDouble() throws IOException
		{
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException
		{
			return br.ready();
		}
		public long nextLong() throws IOException
		{
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 48996
N,K=[int(x) for x in str(input()).split()]
A=[int(x) for x in str(input()).split()]
bA=[]

Am=max(A)

lAm=len(bin(Am))-2

k=bin(K)[2:]
lK=len(bin(K))-2




ANS=[[-1 for i in range(2)] for j in range(41)]




for i in range(N):
  X=bin(A[i])[2:]
  for j in range(max(lAm,lK)-len(X)):
    X="0"+X
  bA.append(X)

for j in range(max(lAm,lK)-len(k)):
  k="0"+k




def opt(a,index,counter):
  if ANS[index][counter]==-1:
    if index<a:
      if counter==1:
        z=0
        o=0
        for i in range(N):
          if bA[i][index]=="1":
            o+=1
          else:
            z+=1

        temp=k[index]
        if temp=="1":
          t1=o*pow(2,a-index-1) + opt(a,index+1,0)

          t2=z*pow(2,a-index-1) + opt(a,index+1,1)
          ANS[index][counter]=max(t1,t2)
        else:
          ANS[index][counter]=o*pow(2,a-index-1) + opt(a,index+1,1)
      elif counter==0:
        z=0
        o=0
        for i in range(N):
          if bA[i][index]=="1":
            o+=1
          else:
            z+=1
        ANS[index][counter]=max(o,z)*pow(2,a-index-1) + opt(a,index+1,0)
    else:
      ANS[index][counter]=0
  
  return ANS[index][counter]


print(opt(max(lAm,lK),0,1))

















Measured memory_bytes: 91812
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

  ll N; cin >> N;
  ll K; cin >> K;
  ll ans = 0;
  ll MOD = 1e9 + 7;
  for (ll i = K; i < N + 2; i++) {
    ll l = i * (i - 1) / 2 - 1;
    ll r = i * (2 * N - i + 1) / 2;
    ans = (ans + r - l) % MOD;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3652
const fs = require('fs');
const input: string = fs.readFileSync('/dev/stdin', 'utf8');

const params: string[][] =
  input.split('\n')
    .map(line => line.split(' '));
const [n, m] = params[0].map(x => parseInt(x));
const a: number[] = params[1].map(x => parseInt(x));

const sum = a.reduce((x, y) => x + y);
const b = a.filter(x => 4 * m * x >= sum);
const msg = (b.length >= m) ? 'Yes' : 'No';

console.log(msg);

Measured memory_bytes: 7372
#include <iostream>
using namespace std;
int main() {
	long x, i = 0, a[10000];
	while (cin >> x) {
		a[i++] = x;
		if (x == 0) break;
	}
	for (i = 1; i<=10000; i++) {
		if (a[i - 1] == 0) break;
		cout << "Case " << i << ": " << a[i - 1] << endl;
	}
	return 0;
}

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

int x[10]={0,2,5,5,4,5,6,3,7,6};
int memo[10][10010];
int path[10][10010];
int n, m, a[10];

int func(int i, int j)
{
    if (i==m)  return j==0 ? 0 : -100000;
    int& res=memo[i][j];
    if (~res) return res;
    res=-10000000;
    int maxk=0;
    for(int k=0; k*x[a[i]]<=j; ++k) {
        int t=func(i+1, j-k*x[a[i]])+k;
        if (res<=t) {
            res=t;
            maxk=k;
        }
    }
    path[i][j]=maxk;
    return res;
}

int main()
{
    memset(memo, -1, sizeof(memo));
    cin>>n>>m;
    for(int i=0; i<m; ++i) cin>>a[i];
    sort(a, a+m, [&](int s, int t){return make_pair(x[s], -s)<make_pair(x[t], -t);});
    m=unique(a, a+m, [&](int s, int t){return x[s]==x[t];})-a;
    sort(a, a+m);
    reverse(a, a+m);

    func(0, n);
    string res;
    for(int i=0; i<m; ++i) {
        int k=path[i][n];
        n-=k*x[a[i]];
        string t(k, '0'+a[i]);
        if (t+res<res+t)
            res+=t;
        else
            res=t+res;
    }
    cout<<res<<endl;
}


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

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

typedef long long lint;

using namespace std;

int main(){
  int N,M,X,Y;
  cin>>N>>M>>X>>Y;
  int Xmax=X;
  int Ymin=Y;
  REP(i,N){
    int x;
    cin>>x;
    if(x>Xmax)Xmax=x;
  }
  REP(i,M){
    int y;
    cin>>y;
    if(y<Ymin)Ymin=y;
  }
  cout<<((Xmax<Ymin)?"No War":"War")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>

const int maxH = 500000;
using array = std::array<int, maxH>;
using iterator = array::iterator;

auto swap = [](iterator a, iterator b)
            {
              auto tmp = *a;
              *a = *b;
              *b = tmp;
            };

void maxHeapify(iterator begin, iterator end, int i)
{
  auto cur = begin + i -1;
  auto left = begin + 2*i -1;
  auto right = left + 1;

  //std::cout << *cur << ' ' << *left << ' ' << *right << std::endl;

  auto largest = cur;
  if (left < end && *left > *largest)
    largest = left;
  if (right < end && *right > *largest)
    largest = right;

  if (largest != cur)
    {
      swap(cur, largest);
      maxHeapify(begin, end, std::distance(begin, largest)+1);
    }
}

void buildMaxHeap(iterator begin, iterator end)
{
  auto H = std::distance(begin, end);
  for (int i=H/2; i>0; --i)
    {
      maxHeapify(begin, end, i);
    }
}

int main ()
{
  int n;
  std::cin >> n;
  std::array<int, maxH> maxheap;

  for (int i=0; i<n; ++i) std::cin >> maxheap[i];

  buildMaxHeap(maxheap.begin(), maxheap.begin()+n);

  for (int i=0; i<n; ++i)
    std::cout << " " << maxheap[i];
  std::cout << std::endl;
}



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

int main() {
    int temp, t = 2, n;
    cin >> n;
    temp = n;
    string ans = "";
    do {
        char ch;
        if(temp % 2) ch = '1';
        else ch = '0';
        ans = ch + ans;
        if(ch == '1') temp--;
        temp /= -2;
    } while(temp);
    cout << ans << endl;
}

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

int main(){
    using namespace std;
    unsigned long X, Y;
    cin >> X >> Y;
    unsigned long a{0};
    a += 100000 * ((4 - min(4UL, X)) + (4 - min(4UL, Y)));
    if(X == Y && X == 1)a += 400000;
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 764
/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>
 
// MACROS SAMPAH
#define Jehian using
#define Norman namespace
#define Saviero std
 
Jehian Norman Saviero;
 
// MACROS TYPE
typedef long l;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
 
// MACROS FOR PRINT
#define nl printf("\n")
 
// MACROS FOR ATTRIBUTE
#define fi first
#define se second
 
// MACROS FOR FUNCTION AND METHOD
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ALL(x) (x).begin(), (x).end()
#define ALLN(x,n) (x), (x)+(n)
#define CUBE(x) (SQR(x)*(x))
#define SET(x,y) for (int _qwe = sizeof(x)/sizeof(x[0]); _qwe; ) x[--_qwe] = (y)
#define SQR(x) ((x)*(x))
#define SSORT(x,sz) sort(ALLN(x,sz))
#define RESET(x) memset((x), 0, sizeof(x))
#define VSORT(x) sort(ALL(x))
 
// MACROS READ INPUT
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scd(x) scanf("%lf", &x)
#define scld(x) scanf("%Lf", &x)
#define scul(x) scl(x)
#define scull(x) scll(x)

const int sz = 1e5+5;
vi adj[sz];
int dp[sz][2];
bool visit[sz][2];

void dfs(int curr, int type, int cost) {
	dp[curr][type] = cost;
	visit[curr][type] = 1;
	for (auto &it : adj[curr]) {
		if (!visit[it][type]) {
			dfs(it, type, cost+1);
		}
	}
}

int main() {
	int N, u, v;
	sci(N), sci(u), sci(v);
	for (int i = 1; i < N; ++i) {
		int A, B;
		sci(A), sci(B);
		adj[A].pb(B);
		adj[B].pb(A);
	}
	dfs(u, 0, 0);
	dfs(v, 1, 0);
	vi canAns;
	for (int i = 1; i <= N; ++i) {
		if (dp[i][0] < dp[i][1]) {
			canAns.pb(dp[i][1] - 1);
		}
 	}
 	printf("%d\n", *max_element(ALL(canAns)));
	return 0;
}

Measured memory_bytes: 11132
n, L = map(int, input().split())
N = 0
G = 999
for i in range(1, n+1):
    N += (i + L - 1)
NN = N
for i in range(1, n+1):
    DD = NN - (L + i - 1)
    if abs(NN-DD)< G :
        G = abs(NN-DD)
        ZZ = DD
print(ZZ)

Measured memory_bytes: 3064
h, w = map(int, input().split())
ans = 10**18
for i in range(1, h):
    S1 = i*w
    # tate
    if h-i >= 2:
        p = (h-i)//2
        q = h-(h-i)//2-i
        S2 = p*w
        S3 = q*w
        M = max([S1, S2, S3])
        m = min([S1, S2, S3])
        ans = min(ans, M-m)
        #if i == 1:
            #print(S1, S2, S3)
    # yoko
    S2 = (h-i)*(w//2)
    S3 = (h-i)*(w-w//2)
    M = max([S1, S2, S3])
    m = min([S1, S2, S3])
    ans = min(ans, M-m)

for i in range(1, w):
    S1 = h*i
    # yoko
    if w-i >= 2:
        p = (w-i)//2
        q = w-(w-i)//2-i
        S2 = h*p
        S3 = h*q
        M = max([S1, S2, S3])
        m = min([S1, S2, S3])
        ans = min(ans, M-m)
    # tate
    S2 = (h//2)*(w-i)
    S3 = (h-h//2)*(w-i)
    M = max([S1, S2, S3])
    m = min([S1, S2, S3])
    ans = min(ans, M-m)
print(ans)


Measured memory_bytes: 73788
#include<iostream>
using namespace std;
int main(){
	int x,y;
	while(cin>>x>>y){
		if(x==0&&y==0)
			break;
		if(x<y){
			int temp=x;
			x=y;
			y=temp;
		}
		cout<<y<<' '<<x<<endl;
	}
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<vector<P>> v;
    rep(i,n){
        int a;
        cin >> a;
        vector<P> t;
        rep(j,a){
            int x,y;
            cin >> x >> y;
            x--;
            t.emplace_back(x,y);
        }
        v.emplace_back(t);
    }
    int ans = 0;
    rep(ia,1<<n){
        bool f = true;
        int count = 0;
        rep(i,n){
            if(!(ia>>i & 1)) continue;
            rep(j,v.at(i).size()){
                int x = v.at(i).at(j).first;
                int y = v.at(i).at(j).second; 
                if((ia>>x & 1) != y){
                    f = false;
                    break;
                }
            }
            if(!f) break;
        }
        if(!f)continue;
        rep(i,n) if(ia>>i & 1) count++;
        ans = max(ans,count);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
    
#define Max 500000
    
typedef struct
{
  int key;
  int p;
  int l[2];
}Node;
    
Node T[Max];
void insert( int ); 
void find( int, int );
int successor( int );
void delete( int );
void Preorder( int );  
void Inorder( int );  
    
    
int main()
{
  int i, n, k;
  char s[7];
    
  scanf("%d", &n);
    
  T[0].key = -1;
    
     
  for(i = 0; i < n; i++)
    {
      T[i].l[0] = -1;
      T[i].l[1] = -1;
    
      scanf("%s", s);
    
      if(strcmp(s, "insert") == 0)
	{
	  scanf("%d", &T[i].key);
	  insert(i);
	}
      else if(strcmp(s, "print") == 0)
	{
	  Inorder(0);
	  printf("\n");
	  Preorder(0);
	  printf("\n");
	}
      else if(strcmp(s, "find") == 0)
	{
	  scanf("%d", &k);
	  find(0, k);
	}
      else if(strcmp(s, "delete") == 0)
	{
	  scanf("%d", &k);
	  delete(k);
	}
    }
  return 0;
}
    
    
void insert(int z)
{
  int x, y;
    
  y = -1;
  x = 0;
    
  if(z != 0)
    while(x != -1)
      {
	y = x;
	if(T[z].key < T[x].key) x = T[x].l[0];
	else x = T[x].l[1];
      }
    
  T[z].p = y;
    
  if(y != -1)
    {
      if(T[z].key < T[y].key) T[y].l[0] = z;
      else T[y].l[1] = z;
    }
}
    
void find(int x, int k)
{    
  if(x == -1) printf("no\n");
  else if(T[x].key == k) printf("yes\n");
  else if(k < T[x].key) find(T[x].l[0], k);
  else find(T[x].l[1], k);
}
    
int successor(int x)
{
  int y;
    
  if(T[x].l[1] != -1)
    {
      x = T[x].l[1];
      while(T[x].l[0] != -1) x = T[x].l[0];
      return x;
    }
      
  else
    {
      y = T[x].p;
      while(y != -1 && x == T[y].l[1])
	{
	  x = y;
	  y = T[y].p;
	}
      return y;
    }
}
    
void delete(int k)
{
  int x, y, z = 0;
    
  while( 1 )
    {
      if(T[z].key == k) break;
      else if(k < T[z].key) z = T[z].l[0];
      else z = T[z].l[1];
    }
    
  if(T[z].l[0] == -1 || T[z].l[1] == -1) y = z;
  else y = successor(z);
    
  if(T[y].l[0] != -1) x = T[y].l[0];
  else x = T[y].l[1];
    
  if(x != -1) T[x].p = T[y].p;
    
  if(T[y].p != -1)
    {
      if(y == T[T[y].p].l[0]) T[T[y].p].l[0] = x;
      else T[T[y].p].l[1] = x;
    }
  if(y !=  z) T[z].key = T[y].key; 
}
    
    
void Preorder(int a)
{
  printf(" %d", T[a].key);
    
  if(T[a].l[0] != -1) Preorder(T[a].l[0]);
  if(T[a].l[1] != -1) Preorder(T[a].l[1]);
}
    
    
void Inorder(int a)
{
  if(T[a].l[0] == -1){
    printf(" %d", T[a].key);
    if(T[a].l[1] != -1) Inorder(T[a].l[1]);
  }
  else
    {
      Inorder(T[a].l[0]);
      printf(" %d", T[a].key);
      if(T[a].l[1] != -1) Inorder(T[a].l[1]);
    }
}

Measured memory_bytes: 8424
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    N = II()
    S = []
    for _ in range(N):
        S.append(SI())
    ans = 0
    BA = 0
    BX = 0
    XA = 0
    for s in S:
        if s[0] == 'B' and s[-1] == 'A':
            BA += 1
        elif s[0] == 'B':
            BX += 1
        elif s[-1] == 'A':
            XA += 1
        for i in range(len(s) - 1):
            if s[i] == 'A' and s[i+1] == 'B':
                ans += 1
    ans += min(BA + BX, BA + XA)
    if BX == 0 and XA == 0 and BA > 0:
        ans -= 1
    return ans

print(main())


Measured memory_bytes: 3700
# include <cstdio>
# include <vector>
# include <queue>
# include <algorithm>

using namespace std;

const int MAX_N = 1e5 + 10;
const int MOD = 1e9 + 7;

int n, m;
int s, t;

vector <pair <int, long long>> v[MAX_N];

long long d[2][MAX_N];
long long dp[2][MAX_N];

void calc (int id, int st)
{
    int i, x;
    long long dist;

    priority_queue <pair <long long, int>> pq;

    while (!pq.empty ())
        pq.pop ();

    for (i = 1; i <= n; i ++)
        d[id][i] = (1LL << 50);
    d[id][st] = 0;

    pq.push ({0, st});

    vector <int> ord;

    while (!pq.empty ())
    {
        pair <long long, int> crr = pq.top ();
        pq.pop ();

        dist = -crr.first;
        x = crr.second;

        if (d[id][x] < dist)
            continue;
        ord.push_back (x);

        for (i = 0; i < (int) v[x].size (); i ++)
        {
            if (d[id][v[x][i].first] > (dist + v[x][i].second))
            {
                d[id][v[x][i].first] = (dist + v[x][i].second);

                pq.push ({-d[id][v[x][i].first], v[x][i].first});
            }
        }
    }

    dp[id][st] = 1;


    for (int j = 0; j < (int) ord.size (); j ++)
    {
        x = ord[j];
        for (i = 0; i < (int) v[x].size (); i ++)
            if (d[id][x] + v[x][i].second == d[id][v[x][i].first])
            {
                dp[id][v[x][i].first] += dp[id][x];
                if (dp[id][v[x][i].first] >= MOD)
                    dp[id][v[x][i].first] -= MOD;
            }
    }

}

int main ()
{
    int i, p, q, c;

    scanf ("%d%d", &n, &m);
    scanf ("%d%d", &s, &t);

    for (i = 1; i <= m; i ++)
    {
        scanf ("%d%d%d", &p, &q, &c);
        v[p].push_back ({q, c});
        v[q].push_back ({p, c});
    }

    calc (0, s);
    calc (1, t);

    long long ans = (dp[0][t] * dp[0][t]) % MOD;

    for (i = 1; i <= n; i ++)
    {
        if ((d[0][i] * 2) == d[0][t] && (d[1][i] * 2) == d[0][t])
        {
            long long f = (long long) (dp[0][i] * dp[1][i]) % MOD;
            ans -= (f * f) % MOD;
            if (ans < 0)
                    ans += MOD;
        }

        for (int j = 0; j < (int) v[i].size (); j ++)
            if ((d[0][i] * 2) < d[0][t] && (d[1][v[i][j].first] * 2) < d[0][t] && (d[0][i] + d[1][v[i][j].first] + v[i][j].second) == d[0][t])
            {
                long long f = (long long) (dp[0][i] * dp[1][v[i][j].first]) % MOD;
                ans -= (f * f) % MOD;
                if (ans < 0)
                        ans += MOD;
            }
    }

    printf ("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 18772
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - 48;}
char myitoc(int N) {return '0' + N;}

vector<vector<pair<int, int>>> G(111111);
vector<bool> visited(111111, false);
vector<int> sd(111111, 0);
void dfs(int V, int dist, int P)
{
  if (visited.at(V)) return;
  visited.at(V) = true;

  sd.at(V) = sd.at(P) + dist;

  for (int i = 0; i < G.at(V).size(); i++)
  {
    dfs(G.at(V).at(i).first, G.at(V).at(i).second, V);
  }
}

signed main()
{
  int N;
  cin >> N;
  for (int i = 0; i < N - 1; i++)
  {
    int a, b, c;
    cin >> a >> b >> c;
    G.at(a).push_back(make_pair(b, c));
    G.at(b).push_back(make_pair(a, c));
  }

  int Q, K;
  cin >> Q >> K;

  dfs(K, 0, 0);
  
  for (int i = 0; i < Q; i++)
  {
    int x, y;
    cin >> x >> y;
    int ans = sd.at(x) + sd.at(y);
    cout << ans << endl;
  }
}

Measured memory_bytes: 14720
#include<iostream>
using namespace std;
int ans;
char room[22][22] = { '0' };

void judge(int x, int y) {
	ans++;
	room[x][y] = '#';
	if (room[x - 1][y] != '#') {
		judge(x - 1, y);
	}
	if (room[x + 1][y] != '#') {
		judge(x + 1, y);
	}
	if (room[x][y - 1] != '#') {
		judge(x, y - 1);
	}
	if (room[x][y + 1] != '#') {
		judge(x, y + 1);
	}
	return;
}

int main(void) {
	while (1) {
		int w, h, human_x, human_y;
		for (int i = 0; i <= 22; i++) {
			for (int j = 0; j <= 22; j++) {
				room[j][i] = { '#' };
			}
		}
		cin >> w >> h;
		if (w == 0) return 0;
		for (int i = 1; i <= h; i++) {
			for (int j = 1; j <= w; j++) {
				cin >> room[j][i];
				if (room[j][i] == '@') {
					human_x = j;
					human_y = i;
				}
			}
		}
		ans = 0;
		judge(human_x, human_y);

		cout << ans << endl;
	}

}

Measured memory_bytes: 1176
#include <iostream>
#include <string>

using namespace std;

int main(){
	int N;
	cin >> N;
	string moji;
	cin >> moji;
	
	int result=0;
	for (int i = 1;i < N; ++i) {
		int cnt = 0;
		
		for (char c = 'a'; c <= 'z'; ++c) {
			bool leftString = false;
            bool rightString = false;
			
			for (int j = 0 ;j < i; ++j) {
				if(moji[j] == c) {
					leftString = true;
                }
            }
			for (int j = i; j < N; ++j) {
				if (moji[j] == c) {
					rightString = true;
                }
            }
			if(leftString && rightString) {
				cnt++;
            }
		}
		
		if(result < cnt) {
			result =cnt;
        }
	}
	
	cout << result;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>

using namespace std;
typedef long long ll;

int main(){

    int cnt[26] = {0};
    
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        cnt[s[i] - 'a'] = 1;
    }

    for(int i = 0; i < 26; i++){
        if(cnt[i] == 0){
            cout << (char)(i + 'a') << endl;
            return 0;
        } 
    }    

    cout << "None" << endl;

}

Measured memory_bytes: 512
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a%b);
}
#endif

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

    int N, X; cin >> N >> X;
    vi x(N); REP(i, N) cin >> x[i];

    vi d(N);
    REP(i, N) d[i] = abs(x[i] - X);

    int ans = d[0];
    FOR(i, 1, N) ans = gcd(ans, d[i]);

    cout << ans << endl;

    return 0;
}

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

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

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

    int dummy = 1e9;
    if (s == 1e9)
        dummy--;

    for (int i = 0; i < n; i++)
    {
        if (i < k)
            cout << s;
        else
            cout << dummy;
        if (i != n - 1)
            cout << " ";
    }
    cout << endl;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repX(i, n ,x) for (int i = x; i < (int)(n); i++)
#define repBack(i, n) for (int i = n; i >= 0; i--)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
    int N,M;
    cin >> N >> M;
    vector<ll> H(N);
    vector<bool> isH(N,true);
    rep(i,N)cin >> H[i];
    vector<p> road(M);
    rep(i,M){
        int A,B;
        cin >> A >> B;
        --A;--B;
        road[i] = p(min(A,B),max(A,B));
    }
    sort(road.begin(),road.end());
    int ans = 0;
    int nR = 0;
    rep(i,N)
    {
        bool flag = true;
        if (!isH[i]) flag = false;
        while(1){
            if(road[nR].first!=i)
            {
                break;
            }
            if(H[i]>H[road[nR].second])
            {
                isH[road[nR].second] = false;
            }
            else
            {
                if (H[i] == H[road[nR].second]){
                    isH[road[nR].second] = false;
                }
                flag = false;
            }
            nR ++;
        }
        if(flag){
            ans ++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4840
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, color, D; vll path;
//***********//
int main() {
	ll A, B, C, K;
	cin >> A >> B >> C >> K;
	if (K > 0) {
		ans += min(K, A);
		K -= min(K, A);
	}
	if (K > 0) {
		K -= min(K, B);
	}
	if (K > 0) {
		ans -= min(K, C);
	}
	cout << ans;
}

Measured memory_bytes: 3640
s = list(input())

odd = ["R","U","D"]
even = ["L", "U", "D"]

for i in range(len(s)):
    if (i+1)%2 == 0:
        if s[i] not in even:
            print("No")
            exit()
    else:
        if s[i] not in odd:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 3060
#include<iostream>

using namespace std;

int main()
{
	double x, a, b;
	cin >> x;
	cin >> a;
	cin >> b;

	if (x <= a)
		a = a - x;
	else
		a = x - a;

	if (x <= b)
		b = b - x;
	else
		b = x - b;

	if (a < b)
		cout << "A" << "\n";
	else if (a > b)
		cout << "B" << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <limits>
#include <numeric>
#include <type_traits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <climits>
#include <queue>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

const ll MOD = 1000000007;

const double PI = 3.1415926535897932;
/******define variable start******/
ll n, k;
vl d;
/*******define variable end*******/
ll solve(){
    cin >> n >> k;
    d.resize(k);
    REP(i, k){
        cin >> d[i];
    }
    for(ll i = n;; i++){
        ll money = i;
        bool flag = false;
        vl money_keta;
        while(money > 0){
            money_keta.push_back(money % 10);
            money /= 10;
        }
        REP(j, money_keta.size()){
            REP(l, k){
                if(money_keta[j] == d[l]){
                    flag = true;
                }
            }
        }
        if(!flag){
            cout << i << endl;
            break;
        }
    }
    /*
    1234 8
    1 3 4 5 6 7 8 9
    1240
    1300
    2000
    */
    return 0;
}
int main(){
    //clock_t start = clock();
    cout << std::fixed << std::setprecision(10);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll end_solve = solve();
    /*
    clock_t end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    printf("time %lf[ms]\n", time);
    */
    return (int)end_solve;
}

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


int main() {
  string s;cin>>s;
  if(s=="hi" || s=="hihi"||s=="hihihi"||s=="hihihihi"||s=="hihihihihi"){cout<<"Yes"<<endl;}
  else cout<<"No"<<endl;

}


Measured memory_bytes: 256
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
 
public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		if(s.equals("ABC"))
		System.out.println("ARC");
		else if(s.equals("ARC"))
			System.out.println("ABC");
	 }
}

Measured memory_bytes: 35672
//日野茜★担当
//的場梨沙★担当
//結城晴★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>

using namespace std;

int main(void) {

    string S;
    cin>>S;

    int A=S.length();



    if(S[A-1]=='s'){
        cout<<S<<"es"<<endl;
    }else{
        cout<<S<<'s'<<endl;
    }



}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main (){
  vector<char> data(3);
  int sum = 0;
  
  //データ入力
  for(int i =0;i < 3; i++ ){
    cin >> data.at(i);
  }
  //カウント機能
  for(int i =0;i < 3; i++ ){
    if(data.at(i) == '1'){
    sum++; 
    }
  }
  
  cout << sum <<endl;
  
  
}


Measured memory_bytes: 3624