akhauriyash/Code-Regression huggingface dataset:
while 1:
	exps=raw_input().split("|")
	if exps[0]=="#":break
	for exp in exps:
		v=1
		lit=exp[1:-1].split("&")
		for i in range(2):
			for j in range(i+1,3):
				if (lit[i]=="~"+lit[j]) or ("~"+lit[i]==lit[j]):
					v=0
		if v:
			print "yes"
			break
	else:
		print "no"
		

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long n, x, d; cin >> n >> x >> d;
	using pll = pair<long long, long long>;
	map<int, vector<pll>> in;
	long long total = 0;
	for(int i = 0; i < n; i++) total += i;
	long long big = 0, small = 0;
	if(d == 0){
		if(x == 0){
			cout << 1 << endl;
		} else {
			cout << n + 1 << endl;
		}
		return 0;
	}
	for(int i = 0; i <= n; i++){
		long long base = 2 * i - n;
		base *= x;
		for(int j = max(i - 1, 0); j < i; j++){
			small += j;
			big += (n - 1) - j;
		}
		long long fac = 2 * small - total;
		long long from = base + fac * d;
		long long to = base + (fac + 2 * (big - small)) * d;
		if(from > to) swap(from, to);
		in[(abs(2 * d) + (from % abs(2 * d))) % (abs(2 * d))].push_back({from, to});
	}	
	long long ans = 0;
	for(auto e : in){
		vector<pll> res, now = e.second;
		sort(now.begin(), now.end(), [](pll a, pll b){
				if(a.first != b.first) return a.first < b.first;
				return a.second > b.second;
		});
		for(auto val : now){
			if(res.empty() || val.first > res.back().second) res.push_back(val);
			else{
				pll bk = res.back(); res.pop_back();
				bk.second = max(bk.second, val.second);
				res.push_back(bk);	
			}
		}
		for(auto val : res){
			ans += ((val.second - val.first + 1) + 2 * abs(d) - 1) / (2 * abs(d));
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 22144
'use strict';
(function(stdin) {
  var inputs  = stdin.toString().trim().split(' ');
  var a = parseInt(inputs[0]);
  var b = parseInt(inputs[1]);

function f(a,b){
if(a === b){
  return 'a == b'
}else{
  return a > b ? 'a > b' : 'a < b' 
}
 }
  console.log(f(a,b));

}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15460
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)
#define REPO(i, n) for (ll i = 1; i <= n; i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(), n.end()
#define MOD 1000000007
#define P pair<ll, ll>


int main() {
    string s;
    cin >> s;
    cout << s.substr(0, 3) << endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,b,a) for (ll i = b - 1; i >= a; i--)
#define all(v) v.begin(), v.end()
#define maxe(v) *max_element(v.begin(), v.end())
#define mine(v) *min_element(v.begin(), v.end())
#define pb push_back
#define pf push_front
#define rem 1000000007
#define cont continue
const ll INF=(1ll<<60)-1;
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b%a, a);
}
ll modulo(ll a, ll b)
{
    ll r = a % b;
    return r < 0 ? r + b : r;
}
//ncr
ull ncr(ull n, ull r)
{
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    ull ans = 1;
    ull i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
class abc
{
    public:
    ll val;
    ll ind;
};
bool fun1(abc x,abc y)
{
    return x.val>y.val;
}
ll power(ll x, ll y, ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
ll modInverse(ll n, ll p)
{
    return power(n, p-2, p);
}
ll fact[100000+2];
ll ncrfast(ll n, ll r, ll p)
{
   if (r==0)
      return 1;
    return (fact[n]* modInverse(fact[r], p) % p *
            modInverse(fact[n-r], p) % p) % p;
}
///////////////////////////////////////////////////////

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    /*ll tc;
    cin>>tc;
    while(tc--)
    {}*/
    ll n;
    cin>>n;
    ll ans=0;
    rep(i,1,n+1)
    {
        if( i%3==0 && i%5==0 )
        {

        }
        else if( i%3==0 )
        {

        }
        else if( i%5==0 )
        {

        }
        else
        {
            ans+=i;
        }
    }
    cout<<ans<<'\n';
}
// 1. "\"D:\\\\mingw\\\\mingw32\\\\lib\\\\gcc\\\\i686-w64-mingw32\\\\8.1.0\\\\include\\\\c++\""
// 2.  "D:\\mingw\\mingw32\\lib\\gcc\\i686-w64-mingw32\\8.1.0\\include\\c++"

Measured memory_bytes: 3644
n, m, l = map(int, input().split())
n_Matrix = [list(map(int, input().split())) for i in range(n)]
m_Matrix = [list(map(int, input().split())) for i in range(m)]
ans = []
for i in n_Matrix:
  count = 0
  result = []
  for j in range(l):
    total = 0
    for k in range(len(i)):
      total += i[k] * m_Matrix[k][count]
    result.append(total)
    count += 1
  ans.append(result)
for a in ans:
  out = ""
  for b in a:
    out += str(b) + " "
  
  print(out[:-1])


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

int main(void){
    ll n, m;
    cin >> n >> m;

    ll time = (n - m) * 100 + m * 1900;

    double ans = 0;

    ans = time * pow(2, m);
    cout << ceil(ans) << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
lists = []
T,A = map(int,input().split())
H = list(map(int,input().split()))
titen = 1
min = abs((T - H[0] * 0.006) - A)
for i in range(N):
    tmp = T - H[i] * 0.006
    if min > abs(tmp - A):
        titen = i+1
        min = abs(tmp-A)
print(titen)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
typedef long long li;


struct ShortestPath {
    struct edge { int to, cost; };
    const int inf = 1 << 28;
    int v;
    vector<vector<edge> > g;
    ShortestPath(int _v): v(_v), g(v) {}
    void add_edge (int from, int to, int cost) {
        g[from].push_back((edge){to, cost});
    }
    vector<int> shortest_path(int init) {
        vector<int> min_cost(v, inf);
        priority_queue<pair<int, int> > q;
        min_cost[init] = 0;
        q.push(make_pair(0, init));
        while (not q.empty()) {
            int cost = -q.top().first;
            int pos = q.top().second;
            q.pop();

            for (int i = 0; i < g[pos].size(); ++i) {
                int npos = g[pos][i].to;
                int ncost = cost + g[pos][i].cost;
                if (ncost < min_cost[npos]) {
                    min_cost[npos] = ncost;
                    q.push(make_pair(-ncost, npos));
                }
            }
        }
        return min_cost;
    }

    int shortest_path(int s, int t) {
        return shortest_path(s)[t];
    }
};

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

    li n;
    cin >> n;
    vector<vector<li>> g(n);
    ShortestPath sp(n);
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < n; ++j) {
            if (s[j] == '1') {
                g[i].push_back(j);
                g[j].push_back(i);
                sp.add_edge(i, j, 1);
                sp.add_edge(j, i, 1);
            }
        }
    }

    vector<li> color(n, -1);
    queue<li> q;
    q.emplace(0);
    color[0] = 0;
    while (not q.empty()) {
        const li pos = q.front();
        q.pop();
        const li curc = color[pos];
        const li nextc = 1 - curc;
        for (auto &next: g[pos]) {
            if (color[next] == curc) {
                cout << -1 << endl;
                return 0;
            } else if (color[next] == -1) {
                q.push(next);
                color[next] = nextc;
            }
        }
    }

    li d = 0;
    for (int i = 0; i < n; ++i) {
        vector<int> dists = sp.shortest_path(i);
        d = max<li>(d, *max_element(dists.begin(), dists.end()));
    }
    cout << d + 1 << endl;
    return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>
#include <stdlib.h>

#define UND_NODE -1
#define UND_HEIGHT -1

typedef struct {
//    int id;
    int right;
    int left;
    int parent;
    int height;
} BinaryNode;

int nodeDepthFromId(BinaryNode nodes[], int length, int id) {
    int i = 0;
    while (nodes[id].parent != UND_NODE) {
        i++;
        id = nodes[id].parent;
    }
    return i;
}

int nodeSiblingFromId(BinaryNode nodes[], int length, int id) {
    if (nodes[id].parent == UND_NODE)
        return UND_NODE;
    
    BinaryNode parentNode = nodes[nodes[id].parent];
    
    if (parentNode.left == id && parentNode.right != UND_NODE)
        return parentNode.right;
    
    if (parentNode.right == id && parentNode.left != UND_NODE)
        return parentNode.left;
    
    return UND_NODE;
}

void constructHeights(BinaryNode nodes[], int length) {
    int i, parentId, heightCount;
    
    for (i = 0; i < length; i++) {
        if (nodes[i].left == UND_NODE && nodes[i].right == UND_NODE) {
            nodes[i].height = 0;

            parentId = nodes[i].parent;
            heightCount = 1;
            while (1) {
                if (parentId == UND_NODE) break;
                if (nodes[parentId].height < heightCount)
                    nodes[parentId].height = heightCount;

                heightCount++;
                parentId = nodes[parentId].parent;
            }
        }
    }
}

void printArray(int array[], int length) {
    for (int i = 0; i < length; i++) {
        if (i) printf(", ");
        printf("%d", array[i]);
    }
}


int main(int argc, char** argv) {
    int nNodes;
    scanf("%d", &nNodes);
    
    BinaryNode nodes[nNodes]; // Binary tree
    int i, j, nodeId, left, right;
    
    for (i = 0; i < nNodes; i++) {
        nodes[i].parent = nodes[i].left = nodes[i].right = UND_NODE;
        nodes[i].height = UND_HEIGHT;
    }
    
    for (i = 0; i < nNodes; i++) {
        scanf("%d", &(nodeId)); // id
        scanf("%d", &(left)); // 
        scanf("%d", &(right)); // 

        nodes[nodeId].left = left;
        nodes[nodeId].right = right;
        nodes[left].parent = nodes[right].parent = nodeId;
    }
    
    // for height
    constructHeights(nodes, nNodes);
    
    int deg = 0;
    
    for (i = 0; i < nNodes; i++) {
        
        // degree
        deg = 0;
        if (nodes[i].left != UND_NODE) deg++;
        if (nodes[i].right != UND_NODE) deg++;
        
        printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ", 
                i, 
                nodes[i].parent, 
                nodeSiblingFromId(nodes, nNodes, i), 
                deg,
                nodeDepthFromId(nodes, nNodes, i),
                nodes[i].height
            );
        
        
        // node types
        if (nodes[i].parent == UND_NODE)
            printf("root");
        else if (nodes[i].height == 0)
            printf("leaf");
        else 
            printf("internal node");
        
        printf("\n");
    }
    

    return (EXIT_SUCCESS);
}




Measured memory_bytes: 2104
using System;

class Program
{
 static void Main( string[] args )
 {
   int cnt =0;
   int z = 0;
   int one = 0;
   String str = Console.ReadLine();
   
   for( cnt = 0; cnt < str.Length; cnt++ )
   {
     if( str[cnt] == '0' )
     {
       z++;
     }
     else
     {
       one++;
     }
   }
   
   Console.WriteLine(((Math.Min(z,one))*2));
 }
}


Measured memory_bytes: 13140
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
	long double a, b, h, m;
	cin >> a >> b >> h >> m;


	long double kat = abs((30.0 * h + m / 2.0) - (6.0 * m));

	

	if (kat > 180.0) {
		kat = 360.0 - kat;
	}

	long double rd = kat * 3.141592653589793238462643383279 / 180.0;
	long double w = a * a + b * b - (2.0 * a * b * cos(rd));

	cout << setprecision(50) << sqrt(w);
	
	
	return 0;
}

Measured memory_bytes: 4168
#include <bits/stdc++.h>
#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;

#define FOR(i,n) for(ll i=0;i<n;i++)

struct edge{ll to,cost;};

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0); 
   int N;
   cin >> N;
   vector<bool> Num(55556,true);
   Num[0] = Num[1] = 0;
   for(int i=2;i<=55555;i++){
      if(Num[i]){
         for(int j=i+i;j<=55555;j+=i){
            Num[j]=false;
         }
      }
   }
   ll ans=0;
   for(int i=0;i<=55555;i++){
      if(Num[i]&&i%5==1){
         cout << i;
         ans++;
         if(ans >= N){
            cout << endl;
            break;
         }
         else cout << " ";
      }
   }
   return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define Yes()           printf("Yes\n")
#define No()            printf("No\n")
#define YES()           printf("YES\n")
#define NO()            printf("NO\n")
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int x, y; cin >> x >> y;
  int s1 = x <= 3 ? (4-x) * 100000 : 0;
  int s2 = y <= 3 ? (4-y) * 100000 : 0;
  if (x == 1 && y == 1) {
    outl(s1 + s2 + 400000);
  } else {
    outl(s1 + s2);
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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

__attribute__ ((constructor))
void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(10);
}

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  cout << min({a, b, n}) << " " << max({a + b - n, 0}) << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<n;++i)
#define repe(i,k,n) for(int i=k;i<=n;++i)

using namespace std;

int main()
{
    cin.tie(0);cout.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;

    deque<char> v;

    for (int i=0;i<s.size();++i){
        if (s[i]== '0') {
                v.push_back('0');}
        else if (s[i]== '1') {
                v.push_back('1');}
        else if (s[i]== 'B'){
            if (!v.empty()) v.pop_back();
        }
    }

    for (auto i=v.begin();i!=v.end();++i){
        cout << *i;
    }

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,0,n) cin >> a[i];
    map<int,int> m;
    REP(i,0,n) m[a[i]]++;
    if (m.size() == 1 && a[0] == 0) {
        cout << "Yes" << endl;
        return;
    } 
    if (n % 3 != 0 || m.size() > 3) {
        cout << "No" << endl;
        return;
    }
    if (m.size() == 3) {
        int z = 0;
        for (auto it = m.begin(); it != m.end(); ++it) {
            if (it->second * 3 != n) {
                cout << "No" << endl;
                return;
            }
            z ^= it->first;
        }
        if (z != 0) {
            cout << "No" << endl;
            return;
        }
        cout << "Yes" << endl;
    }
    if (m.size() == 2) {
        if (m.begin()->second * 3 != n || m.begin()->first != 0) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    if (m.size() == 1) {
        cout << "No" << endl;
    }
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
	
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    cout.tie(NULL);
	
	ll d,t,s;
	cin>>d>>t>>s;

	if(((double)(d)/s)<=t)
	{
	    cout<<"Yes"<<endl;
	}
	else
	{
	    cout<<"No"<<endl;
	}
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int X;
    cin >> X;

    int ans = X / 500 * 1000;
    X %= 500;
    ans += X / 5 * 5;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
   int N;
   std::cin >> N;

   bool flag = false;
   for(int i=0; i<26; ++i){
      for(int j=0; j<15; ++j){
	 if(4*i + 7*j == N) flag = true;
      }
   }
   if(flag) std::cout << "Yes" << std::endl;
   else std::cout << "No" << std::endl;

   return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
A = []
for i in range(N):
    a, b = map(int, input().split())
    A.append([a, b])
A.sort()
cost = 0
num = 0
idx = 0
for i in range(N-1):
    if num + A[i][1] <= M:
        num += A[i][1]
        cost += A[i][0]*A[i][1]
        idx += 1
    else:
        break
num_left = M-num
cost += A[idx][0] * num_left
print(cost)

Measured memory_bytes: 20072
import java.util.Scanner;

public class Main{
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		
		int X,A,B;
		
		X = sc.nextInt();
		A = sc.nextInt();
		B = sc.nextInt();
		
		sc.close();
		
		if(A >= B ) System.out.println("delicious");
		else if(B - A <= X) System.out.println("safe");
		else System.out.println("dangerous");
		
	}
}

Measured memory_bytes: 23764
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

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

    rep(i, (int)s.length()){
        if(i % w == 0){
            cout << s[i];
        }
    }
    cout << endl;

    return 0;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var N = ReadInt();
            var S = Read();
            var s = new List<int>[N+1];
            s[0] = new List<int> { 0, 0 };

            for (var i = 0; i < N; i++)
            {
                var l = new List<int> { s[i][0], s[i][1] };
                if (S[i] == 'W')
                    l[0] += 1;
                else
                    l[1] += 1;

                s[i + 1] = l;
            }

            var min = int.MaxValue;
            for (var i = 0; i < N; i++)
            {
                // 東向く必要あるWの数
                var W = s[i][0] - s[0][0];
                var E = s[N][1] - s[i+1][1];
                min = Min(W + E, min);
            }
            Println(min);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 47396
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>
#include <bitset>
#include <sstream>
#include <cassert>
#include <time.h>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}
void printvec (vec &v) {
    Rep (i, (ll)v.size()) {
        cout << v[i] << " \n"[i+1 == (ll)v.size()];
    }
}

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

    ll N;
    cin >> N;

    auto convert = [&](ll r, ll c) -> ll {
        return r * N + c;
    };
    vector<bool> sit(N*N, true);
    vec P(N*N), cost(N*N);
    Rep (i, N*N) {
        cin >> P[i];
        P[i]--;
    }
    Rep (i, N) {
        Rep (j, N) {
            cost[convert(i, j)] = min({i, N-1-i, j, N-1-j});
        }
    }

    ll ans = 0;

    vec d = {1, -1, N, -N};

    Rep (i, N*N) {
        ans += cost[P[i]];

        queue<ll> q;
        q.push(P[i]);
        sit[P[i]] = false;
        while (q.size()) {
            ll now = q.front(); q.pop();
            Rep (k, 4) {
                ll next = now + d[k];
                if (next < 0 or next >= N*N) continue;
                if (cost[next] > cost[now] + sit[now]) {
                    cost[next] = cost[now] + sit[now];
                    q.push(next);
                }
            }
        }

        // Rep (i, N*N) {
        //     cout << cost[i] << " \n"[i%N == N-1];
        // }
        // cout << ans << "\n";
    }

    cout << ans << endl;
}

Measured memory_bytes: 7116
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  ll n, k;
  cin >> n >> k;
  vll a(n);
  rep(i,n) cin >> a[i];
  rep(i,min(k,42LL)) {
    vector<ll> v(n);
    rep(i,n) {
      v[max(0LL,i-a[i])]++;
      ll m = min(n-1,i+a[i]);
      if(m<n-1) v[m+1]--;
    }
    ll cnt = 0;
    rep(i,n) {
      cnt += v[i];
      a[i] = cnt;
    }
  }
  rep(i,n) cout << a[i] << endl;
  return 0;
}


Measured memory_bytes: 6372
#include <stdio.h>
int main(){
    char a[10];
    gets(a);
  
    if(a[1]=='B'){
        a[1]='R';
      printf("%s",a);
        return 0;
    }else{
        a[1]='B';
      printf("%s",a);
     return 0;
    }
  
    
}




Measured memory_bytes: 1600
#include<stdio.h>
int main(){
    int a,i,b;
    scanf("%d",&a);
    for (i=0; i<10; i++){
        if (a - (i+1)*1000 <= 0 ){
            b = (i+1)*1000-a;
            printf("%d\n",b);
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 1732
#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int a[n]  = {0};
    for(int i = 0 ; i < n -1 ; i++){
        int id;
        cin >> id;
        a[id - 1]++;
    }
    for(int i = 0 ; i < n ; i++){
        cout << a[i] << endl;
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define in inline
#define re register
in ll read(){
   ll s=0;bool w=1;char ch=getchar();while(ch<'0' || ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0' && ch<='9')s=s*10+ch-'0',ch=getchar();return s*w;
}
void write(ll x){
    if(x<0)putchar('-'),x=-x;
    if(x>9)write(x/10);putchar(x%10+'0');
}
unordered_set<string> S;
int main() {
    int n=read();
    for(re int i=0;i<n;i++){
        string s;
        cin>>s;
        S.insert(s);
    }
    write(S.size());
    return 0;
}

Measured memory_bytes: 17800
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  ll ans;
  cin>>ans;
  repo(i,n){
    ll x;
    cin>>x;
    ans=gcd(ans,x);
  }

  cout << ans << endl;
}

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

int main() {
	int N;
	cin >> N;
	cout << N * (N + 1) / 2;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

等差数列の和の公式より、初項a、等差dの数列の1～n項の和はn(2a+(n-1)d)/2で求まるので
今回の場合はn(2+(n-1)1)/2=n(n+1)/2で求まるよ
*/

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

int main() {
  vector< vector<int> > A(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3;j++) {
      cin >> A[i][j];
    }
  }
  int N;
  cin >> N;
  vector<int> b(N);
  for (int i = 0; i < N; i++) cin >> b[i];


  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < N; k++) {
        if (b[k] == A[i][j]) A[i][j] = 100;
      }
    }
  }

  bool is_bingo = false;
  if (A[0][0] + A[0][1] + A[0][2] == 300) is_bingo = true;
  if (A[1][0] + A[1][1] + A[1][2] == 300) is_bingo = true;
  if (A[2][0] + A[2][1] + A[2][2] == 300) is_bingo = true;
  if (A[0][0] + A[1][0] + A[2][0] == 300) is_bingo = true;
  if (A[0][1] + A[1][1] + A[2][1] == 300) is_bingo = true;
  if (A[0][2] + A[1][2] + A[2][2] == 300) is_bingo = true;
  if (A[0][0] + A[1][1] + A[2][2] == 300) is_bingo = true;
  if (A[0][2] + A[1][1] + A[2][0] == 300) is_bingo = true;
  
  if (is_bingo) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
from math import *

if __name__ == '__main__':
    s = input().rstrip().split(' ')
    A, B, H, M = int(s[0]), int(s[1]), int(s[2]), int(s[3])
    theta = abs(2*pi*(M/60.0) - (2*pi*(H/12.0)+(pi/6.0)*(M/60.0)))
    print(sqrt(A**2 + B**2 - 2*A*B*cos(theta)))


Measured memory_bytes: 9448
#include<bits/stdc++.h>
using namespace std;
vector<int> nei[100005];
unsigned long long dp[100005][2];
const unsigned long long MOD=1e9+7; 
void dfs(int v,int pa){
	dp[v][0]=dp[v][1]=1;
	for(int i=0;i<nei[v].size();i++){
		int u=nei[v][i];
		if(u==pa) continue;
		dfs(u,v);
		dp[v][1]=dp[v][1]*dp[u][0]%MOD;
		dp[v][0]=dp[v][0]*(dp[u][0]+dp[u][1])%MOD;
	}
	return;
}
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n-1;i++){
		int x,y;
		scanf("%d %d",&x,&y);
		x--,y--;
		nei[x].push_back(y);
		nei[y].push_back(x);
	}
	dfs(0,-1);
	cout<<(dp[0][0]+dp[0][1])%MOD;
} 

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


li a[111];

int main() {
    li n;
    cin >> n;
    rin{cin >> a[i];}

    li res = 0;
    repp(i, 1, n) {
        if (a[i] == a[i - 1]) {
            a[i] = -1;
            res++;
        }
    }
    cout << res << endl;

    return 0;
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;


int N, L;
int main(){

    cin >> N >> L;
    int sum = 0;
    for(int i = 1; i <= N; i++){
        sum += L + i - 1;
    }

    int val = 1 << 29;
    int cand = 0;
    for(int i = 1; i <= N; i++){
        int sum2 = (sum - (L + i - 1));
        if(abs(sum - sum2) < val){
            val = abs(sum - sum2);
            cand = sum2;
        }
    }
    cout << cand << endl;

    return 0;
}


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

int main(){
    int N, C; cin >> N >> C;
    vector<int> s(N), t(N), c(N);
    rep(i, N) cin >> s[i] >> t[i]  >> c[i], c[i]--;
    //cout << "yesea" << endl;
/*     vector<P> B, E;
    rep(i, N){
        B.push_back({s[i], c[i]});
        E.push_back({t[i], c[i]});
    } */

    multiset<P> S[31];
    rep(i, N){
        int chanel = c[i];
        //cout << "yye" << endl;
        // 存在した時
        if(S[chanel].find(make_pair(s[i], 2)) != S[chanel].end()){
            auto it = S[chanel].find(make_pair(s[i], 2));
            //cout << "hey";
            S[chanel].erase(it);
        }else{
            //cout << "x" << endl;
            S[c[i]].insert({s[i], 1});
        }
        //cout << "t";
        if(S[c[i]].find({t[i], 1}) != S[c[i]].end()) S[c[i]].erase(S[c[i]].find({t[i], 1}));
        else S[c[i]].insert({t[i], 2});
    }
    //cout << "yes" << endl;

    priority_queue<P, vector<P>, greater<P> > T;
    rep(i, C){
        for(auto e: S[i]){
            T.push(e);
        }
    }
    //for(auto e: T) cout << e.first << " " << e.second << endl;

    int ans = 0, cnt = 0;
    while(!T.empty()){
        auto e = T.top(); T.pop();
        if(e.second == 1) cnt++;
        else cnt--;
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 12920
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int x, y, z;
  x = y = z = 0;
  for (int i = 0; i < N; i++) {
    int p;
    cin >> p;
    if (p <= A) x++;
    else if (p <= B) y++;
    else z++;
  }
  int ans;
  ans = min({x, y, z});
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
M,N=map(int,input().split())
def fact(n):
	s=1
	for i in range(2,n+1):
		s=s*i
	return s

def conb(n,r):
	return fact(n)//(fact(r)*fact(n-r))

if (N==1 or N==0) and (M==1 or M==0):
	print(0)
elif N==1 or N==0:
	print(conb(M,2))
elif M==1 or M==0:
	print(conb(N,2))
else:
	print(conb(M,2)+conb(N,2))


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll INF = 1001001001001;
int main() {
    ll n;
    cin >> n;
    vector<ll> p(n);
    for(int i=0; i<n;i++) {
        cin >> p[i];
    }
    ll ans = 0;
    ll min_p = INF;
    for(int i =0;i<n;i++) {
        min_p = min(min_p, p[i]);
        if(p[i] <= min_p) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
var [a,b]=arr.shift().split(" ").map(Number);
var [p,q,r]=arr.shift().split(" ").map(Number);
var hanareta=b*p;
var tikaduita=(b-a)*q;
var d=hanareta-tikaduita;
console.log((d/(q+r)+b).toFixed(12));


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


int main()
{
	int N = 0;
	int res = 0;
	int data[210];

	cin >> N;

	for (int i = 0; i <= (N - 1); i++)
	{
		cin >> data[i];
	}
	
	while (true)
	{
		bool exist_odd = false;

		for (int i = 0; i <= (N - 1); i++)
		{

			if (data[i] % 2 != 0)
			{
				exist_odd = true;
			}
		}

		if (exist_odd)
		{
			break;
		}


		for (int i = 0; i <= (N - 1); i++)
		{

			data[i] /= 2;

		}

		res++;
	}

			

	cout << res << endl;
	
}


Measured memory_bytes: 256
import math, string, fractions, heapq, re, array, bisect, sys, random, time, copy
import itertools as it
import collections as cl
import functools as ft


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 I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


a = LI()
print(max(a) - min(a))

Measured memory_bytes: 7756
#include <iostream>
#include <sstream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#define boostup ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long int ll;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
using namespace std;
int main()
{
    boostup;
    string s;
    cin>>s;
    ll tot=0;
    ll i,j;
    vector <ll> dp(2019);
    reverse(s.begin(),s.end());
    ll x=1;
    ll ans=0;
    ll n=s.size();
    dp[0]=1;
    for(i=0;i<n;i++)
    {
        ll num=s[i]-'0';
        tot=(tot+(num*x))%2019;
        dp[tot]+=1;
        x=x*10%2019;
    }
    for(auto it:dp)
    {
        ans+=(it*(it-1))/2;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

void input() {
  ;
  ;
  cin >> N;
  cin >> S;
}
char conv(char c) { return (char)('A' + ((c - 'A') + N) % 26); }
void solve() {
  for (auto x : S) {
    cout << conv(x);
  }
  cout << endl;
  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

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

int main(){
 	int N,M;
  cin>>N>>M;
  double* A = new double[N];
  double total = 0;
  
  int count = M;
  for(int i = 0; i < N;i++){
  	cin>>A[i];
    total += A[i];
  }
  double shresh = 1.0/(4.0*M);
  shresh *= total;
  for(int i = 0; i<N;i++){
	if(!count){
      cout<<"Yes";
      return 0;
    }
    if(A[i] >= shresh) count--;   
    if(!count){
      cout<<"Yes";
      return 0;
    }
  }	
  cout<<"No";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll h, n;
    cin >> h >> n;
    ll a, sum = 0;
    REP(i, n) {
        cin >> a;
        sum += a;
    }
    if (sum >= h) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
  int n;
  string s;
  cin >> n >> s;
  int count = 0;
  size_t pos=s.find("ABC");
  while (pos < s.length()) {
    count++;
    pos = s.find("ABC", pos+1);
  }
  cout << count;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

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

    int ans=B/A;
    if(ans>=C){
        ans=C;
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,m,a,b,edge[707][707],cnt[2],col[707],vis[707];
set <int> s;
int dfs(int u,int cl){
	if(vis[u]!=0){
		if(col[u]!=cl){
			cout<<"-1";
			exit(0);
		}
		return true;
	}
	vis[u]=1;
	cnt[cl]++;
	col[u]=cl;
	for(int v=1;v<=n;v++){
		if(edge[u][v]==0 && v!=u) dfs(v,cl^1);
	}
}
int main(){
	ios_base::sync_with_stdio(0);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>a>>b;
		edge[a][b]=1;
		edge[b][a]=1;
	}
	s.insert(0);
	for(int i=1;i<=n;i++){
		if(vis[i]) continue;
		cnt[0]=cnt[1]=0;
		dfs(i,0);
		set<int> save;
		for(int x:s){
			save.insert(x+cnt[0]);
			save.insert(x+cnt[1]);
		}
		s=save;
	}
	int ans=2e9;
	for(int x:s){
		ans=min(ans,x*(x-1)/2+(n-x)*(n-x-1)/2);
	}
	cout<<ans;
}


Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main(){
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	vector<ll> b(n);
	ll res = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i];
		if((a[i] | k) == k) res += b[i];
	}
	for(int i = 0; i < 30; i++){
		if(k < (1 << i)) break;
		int num = (k - (1 << i)) | ((1 << i) - 1);
		ll sum = 0;
		for(int j = 0; j < n; j++){
			if((a[j] | num) == num) sum += b[j];
		}
		res = max(res, sum);
	}
	cout << res << endl;
	return 0;
}

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

int main() {
    int n, a, b; cin >> n >> a >> b;
    string s; cin >> s;
    int r = a+b;
    int u = b;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'a' && r) {
            r--;
            cout << "Yes" << endl;
        } else if (s[i] == 'b' && r && u) {
            r--; u--;
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<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>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define 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 };

int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	ll sum = a + b + c;
	int i;
	for (i = 0; i < 80000000; i++) {
		ll a2, b2, c2;
		a2 = b / 2 + c / 2;
		b2 = c / 2 + a / 2;
		c2 = a / 2 + b / 2;
		a = a2; b = b2; c = c2;
		if (sum != a + b + c) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 384
#include <fstream>
#include <iostream>
#include <vector>
#include <cstring>
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define Nmax 1000005
#define INF 1000000000
#define MOD 1000000007
 
using namespace std;

int main()
{
    
    // #ifndef ONLINE_JUDGE
    //     freopen ("data.in","r",stdin);
    //     freopen ("E.out","w",stdout);
    // #endif
    cin.sync_with_stdio( false );

    int tests=1;
    // cin>>tests;
    while(tests--)
    {
   		string t;
   		ll i;
   		cin>>t;
   		for(i=0;i<t.length();i++)
   		{
   			if(t[i]=='?')
   			{
   				if(i>0 && t[i-1]=='P') t[i]='D';
   				else if(i<t.length()-1 && t[i+1]=='D') t[i]='P';
   				else t[i]='D';
   			}
   		}
   		cout<<t;

   	}
    	return 0;
    
}

Measured memory_bytes: 3784
import math
a,b=map(int,input().split())

A=math.ceil(a*12.5)
B=math.ceil(b*10)

x=math.floor(B*0.08)
y=math.floor(A*0.1)

if x==a and y==b :
    if A>B :
        print(B)
    else :
        print(A)

elif x==a :
    print(B)
elif y==b :
    print(A)
else :
    print(-1)

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

using namespace std;

int main()
{
	int N;
	int ans = 0;
	cin >> N;
	N *= 2;
	vector<int> L(N);
	for (int i = 0;i < N;i++)
		cin >> L[i];

	sort(L.begin(), L.end());

	for (int i = 0;i < N;i += 2)
		ans += min(L[i], L[i + 1]);

	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define inf 1000000000000000000
#define pii pair<int, int>
const double pi = acos(-1);
const int sz = 200002;
ll n, m, q, k;
int main() {
	io
	int t = 1;
	//cin>>t;
	while(t--) {
		cin>>n;
		vector<string>a(n);
		int ac = 0, tle = 0, wa = 0, re = 0;
		for(int i = 0; i  <n; i++) {
			cin>>a[i];
			if(a[i] == "AC") ac++;
			else if(a[i] == "TLE") tle++;
			else if(a[i] == "WA") wa++;
			else if(a[i] == "RE") re++;
		}
		cout<<"AC x "<<ac<<endl<<"WA x "<<wa<<endl<<"TLE x "<<tle<<endl<<"RE x "<<re;
	}
}


Measured memory_bytes: 6364