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

int main() {
    int N;
    cin >> N;
    int x = N;
    while (x >= 0) {
        if (x % 4 == 0) {
            cout << "Yes" << endl;
            return 0;
        };
        x -= 7;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1e15
double dist[1010];

struct edge{int to; double cost;};
 
void dijkstra(double* d, vector<vector<edge> > graph){
    d[0] = 0;
    priority_queue<pair<double, int>, vector<pair<double, int> >, greater<pair<double, int> > > q;
    q.push(make_pair(0, 0));
    while (!q.empty()){
        P a = q.top();
        q.pop();
        int now = a.second;
        if(d[now] < a.first) continue;
        REP(i,graph[now].size()){
            edge e = graph[now][i];
            int next = e.to;
            if (d[next] > d[now] + e.cost){
                d[next] = d[now] + e.cost;
                q.push(make_pair(d[next], next));
            }
        }
    }
}

double norm(double x1, double y1, double x2, double y2){
    return sqrt(pow(x1-x2,2) + pow(y1-y2,2));
}

int main() {
    double sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;
    int n;
    cin >> n;
    vector<double> x(n), y(n), r(n);
    REP(i,n) cin >> x[i] >> y[i] >> r[i];
    vector<vector<edge> > e(n+2);
    REP(i,n){
        edge es;
        es.to = i+1;
        es.cost = fmax(0,norm(sx,sy,x[i],y[i]) - r[i]);
        e[0].push_back(es);
    }
    REP(i,n){
        edge es;
        es.to = n+1;
        es.cost = fmax(0,norm(gx,gy,x[i],y[i]) - r[i]);
        e[i+1].push_back(es);
    }
    REP(i,n) REP(j,n) {
        if (i == j) continue;
        edge es;
        es.to = j+1;
        es.cost = fmax(0,norm(x[i],y[i],x[j],y[j]) - r[i] - r[j]);
        e[i+1].push_back(es);
        es.to = i+1;
        e[j+1].push_back(es);
    }
    edge es;
    es.to = n+1;
    es.cost = norm(sx,sy,gx,gy);
    e[0].push_back(es);

    REP(i,n+2) dist[i] = 1e18;

    dijkstra(dist, e);

    printf("%.10f\n", dist[n+1]);

    return 0;
}

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

int main() {
    int k,s;
    cin >> k >> s;
    int ans=0;
    for (int x=0;x<=k;x++) {
        for (int y=0;y<=k;y++) {
            int z=s-x-y;
            if (z>=0 && z<=k) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;
int cnt[6];
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N = 3;

    rep(i,N){
        int a,b;
        cin >> a >> b;
        cnt[a]++;
        cnt[b]++;
    }
    rep(i,5){
        if(cnt[i]>2){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout  << "YES" << endl;
}

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

const int MAXN = 100005;
int n, a[MAXN];
long long dp[MAXN][2];

int main()
{
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	memset(dp, -127/3, sizeof dp);
	dp[0][0] = 0;
	for (int i = 1; i <= n; i++) {
		dp[i][0] = dp[i-1][0]+a[i]/2;
		if (a[i] >= 1) {
			dp[i][0] = max(dp[i][0], dp[i-1][1]+1+(a[i]-1)/2);
			dp[i][1] = dp[i-1][0]+(a[i]-1)/2;
			if (a[i] >= 2) 
				dp[i][1] = max(dp[i][1], dp[i-1][1]+1+(a[i]-2)/2);
		}
	}
	cout << max(dp[n][0], dp[n][1]) << endl;
	return 0;
}


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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,N,j) for(int i = (N-1);i >= (j);i--)
#define _rec(i,N,j) for(int i = (N);i >=(j);i--)
#define ALL(x) x.begin(),x.end()
#define MEM(a,n) memset(a,n,sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

int get_int(){int x;scanf("%d",&x);return x;}
LL get_ll(){LL x;scanf("%lld",&x);return x;}
double get_db(){double x;scanf("%lf",&x);return x;}

template<typename T> int chmin(T &a,T b){if(a > b){a = b;return 1;}else return 0;}
template<typename T> int chmax(T &a,T b){if(a < b){a = b;return 1;}else return 0;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {_for(i,0,v.size()) os << v[i] << " ";return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){for(auto a:v) os << a <<" ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){os << v.fst <<" "<<v.scd << " ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& v){for(auto a:v) cout << a << endl;return os;}

static const int dx[8] = { -1,  0, 1, 0,  1, -1,  1, -1};
static const int dy[8] = {0,  1, 0,  -1,  1, -1, -1,  1};
const double pi  = acos(-1.0);
const double eps = 1e-8;
const LL  INF  = 0x3f3f3f3f3f3f3f3f;
const int inf  = 0x3f3f3f3f;
const int maxn = 1e5+5;
int A,B,C;
LL leizo[maxn];
LL renji[maxn];

int main(){
    cin >> A >> B >> C;
    LL minl = INF;
    LL minr = INF;
    _rep(i,1,A){
        cin >> leizo[i];
        minl = min(minl,leizo[i]);
    }
    _rep(i,1,B){
        cin >> renji[i];
        minr = min(minr,renji[i]);
    }
    LL best = minr + minl;
    _rep(i,1,C){
        int a,b,c;
        cin >> a >> b >> c;
        LL price = max(leizo[a] + renji[b] - c,0LL);
        best = min(price,best);
    }
    cout << best << endl;

    return 0;
}


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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

typedef pair<int, int> ii;

int n, m, sum[3], cnt = 0, dp[705][705], mn = INT_MAX;

bool edge[705][705];
int color[705];

vector<int> graph[705];

void bye() {
    cout << "-1\n";
    exit(0);
}

bool dfs(int u, int co) {
    color[u] = co;
    sum[co]++;
    for(int i = 0; i < graph[u].size(); i++) {
        int v = graph[u][i];
        //cout << u << " " << v << "\n";
        //cout << u << " " << v << " " << color[v] << " " << color[u] << "\n";
        if(color[v] == co) return 0;
        if(!color[v] && !dfs(v, 3 - co)) return 0;
    }
    return 1;
}

int main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> n >> m;
    for(int i = 1; i <= m; i++) {
        int u, v;
        cin >> u >> v;
        edge[u][v] = 1;
        edge[v][u] = 1;
    }
    for(int i = 1; i <= n; i++) {
        for(int j = i + 1; j <= n; j++) {
            if(!edge[i][j]) {
                graph[i].pb(j);
                graph[j].pb(i);
            }
        }
    }
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++) {
        if(!color[i]) {
            if(!dfs(i, 1)) {bye();}
            ++cnt;
            for(int j = 0; j <= n; j++) {
                if(j + sum[1] <= n)
                    dp[cnt][j + sum[1]] |= dp[cnt - 1][j];
                if(j + sum[2] <= n)
                    dp[cnt][j + sum[2]] |= dp[cnt - 1][j];
            }
            sum[1] = 0, sum[2] = 0;
        }
    }
    for(int i = 0; i <= n; i++) {
        if(dp[cnt][i])
            mn = min(mn, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
    }
    cout << mn << "\n";
}


Measured memory_bytes: 3200
s = input()
res = [0] * len(s)

r_count = 0
l_count = 0
r_idx = 0
l_idx = 0
switch = True
for i,m in enumerate(s):
    if switch:
        if m == "R":
            r_count += 1
        else:
            r_idx = i-1
            l_idx = i
            l_count = 1
            switch = False
    else:
        if m == "L":
            l_count += 1
        else:
            res[r_idx] = (r_count+1) // 2 + l_count // 2
            res[l_idx] = (l_count+1) // 2 + r_count // 2
            r_count = 1
            switch = True

res[r_idx] = (r_count+1) // 2 + l_count // 2
res[l_idx] = (l_count+1) // 2 + r_count // 2

print(*res)


Measured memory_bytes: 6400
import itertools
n, m = map(int, input().split())
A = [set(map(int, input().split())) for _ in range(m)]
ans = 0
for p in itertools.permutations(range(2, n+1), n-1):
    q = list(p)+[1]
    for i in range(n-1):
        if not {q[i], q[i+1]} in A:
            break
    else:
        ans += 1
print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    string s;
    int k,i;
    cin>>s;
    cin>>k;
    for (i=0;i<s.size();i++)
    {
        if (s[i]!='1' || i==k-1)
        {
            cout<<s[i]<<endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int in(){int x; scanf("%d",&x); return x;}
static const int MAX = 100000;


int main(){
  int N = in(), x;
  pair<int, int> p[MAX];

  rep(i, N){
    x = in();
    p[i] = make_pair(x, i+1);
  }
  sort(p, p+N);

  rep(i, N){
    cout << p[i].second << " ";
  }
}

Measured memory_bytes: 1536
#include <stdio.h>

int main() {
	int a,b;
	scanf("%d %d", &a, &b);
	char s[255];
	scanf("%s", s);
	int angka = 0;
	for(int i = 0; s[i] != '\0'; i++){
		if(s[a] != '-'){
			puts("No");
			return 0;
		}
		if(s[i] >= '0' && s[i] <= '9'){
			angka++;
		}
	}
	if(angka == a+b){
		puts("Yes");
	}else{
		puts("No");
	}
	return 0;
}


Measured memory_bytes: 1608
import bisect


class Deque:
    def __init__(self, src_arr=[], max_size=300000):
        self.N = max(max_size, len(src_arr)) + 1
        self.buf = list(src_arr) + [None] * (self.N - len(src_arr))
        self.head = 0
        self.tail = len(src_arr)

    def __index(self, i):
        l = len(self)
        if not -l <= i < l: raise IndexError('index out of range: ' + str(i))
        if i < 0:
            i += l
        return (self.head + i) % self.N

    def __extend(self):
        ex = self.N - 1
        self.buf[self.tail + 1: self.tail + 1] = [None] * ex
        self.N = len(self.buf)
        if self.head > 0:
            self.head += ex

    def is_full(self):
        return len(self) >= self.N - 1

    def is_empty(self):
        return len(self) == 0

    def append(self, x):
        if self.is_full(): self.__extend()
        self.buf[self.tail] = x
        self.tail += 1
        self.tail %= self.N

    def appendleft(self, x):
        if self.is_full(): self.__extend()
        self.buf[(self.head - 1) % self.N] = x
        self.head -= 1
        self.head %= self.N

    def pop(self):
        if self.is_empty(): raise IndexError('pop() when buffer is empty')
        ret = self.buf[(self.tail - 1) % self.N]
        self.tail -= 1
        self.tail %= self.N
        return ret

    def popleft(self):
        if self.is_empty(): raise IndexError('popleft() when buffer is empty')
        ret = self.buf[self.head]
        self.head += 1
        self.head %= self.N
        return ret

    def __len__(self):
        return (self.tail - self.head) % self.N

    def __getitem__(self, key):
        return self.buf[self.__index(key)]

    def __setitem__(self, key, value):
        self.buf[self.__index(key)] = value

    def __str__(self):
        return 'Deque({0})'.format(str(list(self)))


N = int(input())
A = [int(input()) for _ in range(N)]

x = Deque()

for i, a in enumerate(A):
    if i == 0:
        x.append(a)
    else:
        r = bisect.bisect_left(x, a)
        if r == 0:
            x.appendleft(a)
        else:
            x[r - 1] = a

print(len(x))


Measured memory_bytes: 11824
N = int(input())
a = []*N
b = []*N
c = []*N
for _ in range(N):
    A, B, C = map(int, input().split())
    a.append(A)
    b.append(B)
    c.append(C)

dp = [[0,0,0] for _ in range(N)]
dp[0] = [a[0],b[0],c[0]]
for i in range(1, N):
    dp[i][0] = max(dp[i-1][1]+a[i], dp[i-1][2]+a[i])
    dp[i][1] = max(dp[i-1][0]+b[i], dp[i-1][2]+b[i])
    dp[i][2] = max(dp[i-1][0]+c[i], dp[i-1][1]+c[i])

print(max(dp[N-1][0],dp[N-1][1],dp[N-1][2]))

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

int main(){
	double x1, y1, x2, y2, x3, y3, xp, yp;
	double X1, Y1, X2, Y2, X, Y, s, t;
	
	while((scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)) != EOF){
		X1 = x2 - x1; Y1 = y2 - y1;
		X2 = x3 - x1; Y2 = y3 - y1;
		X = xp - x1; Y = yp - y1;
		
		s = (X * Y2 - X2 * Y) / (X1 * Y2 - X2 * Y1);
		t = (X * Y1 - X1 * Y) / (X2 * Y1 - X1 * Y2);
		
		if(s > 0 && t > 0 && s + t < 1) printf("YES\n");
		else printf("NO\n");
	}
	
	return 0;
}

Measured memory_bytes: 1040
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef struct Tree{
  int key;
  struct Tree *parent;
  struct Tree *left;
  struct Tree *right;
}Tree;

Tree *t;
void Print1(Tree*);
void Print2(Tree*);
void Insert(int);  

int main(){
  int m,i,key;
  char comma[7];
  scanf("%d",&m);
  t=(Tree*)malloc(sizeof(Tree)*1);
  t->parent=t->left=t->right=NULL;
  t->key=2000000001;
  for(i=0;i<m;i++){
    scanf("%s",&comma);
    if(strcmp(comma,"insert")==0){
      scanf("%d",&key);
      Insert(key);
     }
    else if(strcmp(comma,"print")==0){
      Print1(t);
      printf("\n");
      Print2(t);
      printf("\n");
    }
  }
  free(t);
  return 0;
}

void Insert(int key){
  Tree *y;
  Tree *x;
  Tree *hoge;
  if(t->key==2000000001){
    t->key=key;
    return;
  }
  x=t;
  y=NULL;
  hoge=(Tree*)malloc(sizeof(Tree)*1);
  hoge->key=key;
hoge->parent=hoge->left=hoge->right=NULL;
  while(x!=NULL){
    y=x;
    if(key<x->key)
      x=x->left;
    else
      x=x->right;
    hoge->parent=y;
  }
  if(hoge->key<y->key)
    y->left=hoge;
  else
    y->right=hoge;
}

void Print1(Tree *x){
  if(x==NULL)
    return;
  else{
    Print1(x->left);
    printf(" %d",x->key);
    Print1(x->right);
  }
}

void Print2(Tree *x){
  if(x==NULL)
    return;
  else{
    printf(" %d",x->key);
    Print2(x->left);
    Print2(x->right);
  }
}

Measured memory_bytes: 24040
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<math.h>
#include <cstdio>
#include<iomanip>
#include <stdio.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,m,n) for(int i=m;i<(int)(n);i++)
const int inf = 10e9 + 7;
using namespace std;
int s[4] = {};
signed main() {
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	s[a]++;
	s[b]++;
	s[c]++;
	s[d]++;
	s[e]++;
	s[f]++;
	int ans = 0;
	rep(i, 4) {
		if (s[i] == 2)ans++;
	}
	if (ans == 2)cout << "YES" << endl;
	else cout << "NO" << endl;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

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

    ll M;
    cin >> M;

    ll ans = 0;
    ll digit = 0;
    ll sum = -1;
    REP(i, M) {
        ll d, c;
        cin >> d >> c;

        digit += c;

        // 各操作で和は必ず 9 ずつしか減少しないので、
        // その減少回数分の追加操作が必要
        sum += d * c;
        ans += sum / 9;
        sum %= 9;
    }
    // 加えて桁数 -1 回操作が必要
    ans += (digit - 1);

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

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=2e5+5;
int gcd(int n,int m)
{
    if(n==0)
        return m;
    else
        return gcd(m%n,n);
}
int a[N];
int32_t main()
{
    IOS;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    int cnt=1;
    for(int i=1;i<=n;i++)
    {
        if(a[i]==cnt)
            cnt++;
    }
    cnt--;;
    if(cnt==0)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    cout<<(n-cnt)<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll=int64_t;
int main(){
  int n,i,x,y;
  cin>>n;
  vector<int> z(n),w(n);
  for(i=0;i<n;i++){
    cin>>x>>y;
    z[i]=x+y;
    w[i]=x-y;
  }
  sort(z.begin(),z.end());
  sort(w.begin(),w.end());
  cout<<max(z[n-1]-z[0],w[n-1]-w[0])<<endl;
}

Measured memory_bytes: 4816
#include <iostream>
#include <unordered_map>
#include <vector>
#include <set>
#include <string.h>
#include <algorithm>
#define mod 1000000007
#define inf 1LL<<61
#define ll long long
#define pr pair<int,int>
#define all vec.begin(),vec.end()
#define rep(i,a,b) for (int i = a; i < b; i++)
#define fi first
#define se second
#define pushb push_back
#define makep make_pair

using namespace std;

int main(){
	int size;
	cin >> size;
	int arr[size];
	rep(i,0,size)
		cin >> arr[i];
	int min = *min_element(arr,arr+size);
	int max = *max_element(arr,arr+size);
	cout << max -min;

	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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


void solve(long long N, long long R){
    if(N>=10){
        cout<<R<<endl;
    }
    else{
        cout<<R+100*(10-N)<<endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long R;
    scanf("%lld",&R);
    solve(N, R);
    return 0;
}


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

int main()
{
	int a = 0, b = 0, c = 0, d = 0;
	string s;

	while (cin >> s) {
		int i = 0;

		while (s[i] != ',')
			i++;

		if (s[i + 1] == 'B')
			b++;
		else if (s[i + 1] == 'O')
			d++;
		else if (s.size() == i + 3)
			c++;
		else
			a++;
	}

	cout << a << endl << b << endl << c << endl << d << endl;

	return 0;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=100005;
//i_am_noob
int n;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cout << fixed << setprecision(12);
	cin >> n;
	print1(3*n*n);
	return 0;
}

Measured memory_bytes: 256
INF=1000000007
N,M=map(int,input().split())
A=[]
B=[]
for i in range(N):
  a,b=list(map(int,input().split()))
  A.append([a,b])
for i in range(M):
  c,d=list(map(int,input().split()))
  B.append([c,d])
for i in A:
  m=INF
  p=0
  for j in range(M):
    d=abs(i[0]-B[j][0])+abs(i[1]-B[j][1])
    if m>d:
      m=d
      p=j+1
  print(p)


Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#pragma warning(disable : 4996)

int main()
{
    int i,j;
    long N;
    char s[300010];
    int a[300000];
    long ans = 300000;
    int sum;

    scanf("%ld", &N);
    scanf("%s", s);

    a[0] = (s[0] == 'W') ? 1 : 0;

    //西を向いている人の数
    for (i = 1; i < N; i++) {
        a[i] = a[i - 1] + ((s[i] == 'W') ? 1 : 0);
    }

    for (i = 0; i < N; i++) {

        if(i == 0)
            sum = (N - i - 1 - (a[N - 1] - a[i]));
        else
             sum = a[i - 1] + (N - i -1 - (a[N-1] - a[i]));
         
        if (sum < ans)
            ans = sum;
    }
    
    printf("%ld", ans);

    return 0;
}

Measured memory_bytes: 3568
A,B,H,M = map(int, input().split())

import math

a = 30*H + 30*(M/60)
b =  6*M
sita = math.radians(abs(a-b))
cosh= math.cos(sita)
cc = A**2 + B**2 -2*A*B*cosh
c = cc**(1/2)
print(c)

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

using namespace std;

int main(void)
{
  string str;
  cin >> str;
  int min = 753;
  for(int i = 0; i < str.size() - 2; i++){
    string snum = str.substr(i, 3);
    int num = stoi(snum);
    if(min > abs(753 - num)){
      min = abs(753 - num);
    }
  }
  cout << min << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

constexpr int MAX_N = 100;
constexpr int MAX_W = 10000;

int main(){
    int N, W;
    int dp[MAX_W + 1], v[MAX_N], w[MAX_N];
    
    memset(dp, 0, sizeof(dp));
    
    scanf("%d%d", &N, &W);
    
    dp[0] = 0;
    
    for(int i = 0; i < N; ++i){
        scanf("%d%d", &v[i], &w[i]);
        for(int j = 0; j <= W; ++j){
            if(j >= w[i]){
                dp[j] = std::max(dp[j], dp[j - w[i]] + v[i]);
            }
        }
    }
    
    int ans = 0;
    for(auto x : dp){
        ans = std::max(ans, x);
    }
    
    printf("%d\n", ans);
    
    return 0;
}

Measured memory_bytes: 2768
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }


int main() {
	int n, m; cin >> n >> m;
	if (m <= n) {
		puts("0");
		return 0;
	}
	vector<int> x(m);
	for (auto&& i : x) scanf("%d", &i);
	sort(x.begin(), x.end());

	vector<int> difs;
	rep(i, m - 1) {
		difs.emplace_back(x[i + 1] - x[i]);
	}
	sort(difs.rbegin(), difs.rend());
	ll tot = 0;
	for (auto i : difs) tot += i;

	rep(i, n - 1) tot -= difs[i];
	cout << tot << endl;

}

Measured memory_bytes: 1276
#include<stdio.h>
int n, A[30];

int solve(i, m){
	int res;
	if (m == 0) {
		return 1;
	} else if (i >= n) {
		return 0;
	}
	res = solve(i + 1, m) || solve(i + 1, m - A[i]);
	return res;
}

int main(){
	int q, m, j;
	scanf("%d", &n);
	for (j = 0; j < n; j++) {
		scanf("%d", &A[j]);
	}
	scanf("%d", &q);
	for (j = 0; j < q; j++) {
		scanf("%d", &m);
		if (solve(0, m)) {
			printf("yes\n");
		} else {
			printf("no\n");
		}		
	}
	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main() {
ll N, Ans = 0;cin >> N;
vector<ll> A(N);
rep(i, 0, N)cin >> A[i];

rep(i, 0, N){
if((i + 1)%2 != 0 && A[i]%2 != 0)Ans++;
}
cout << Ans;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define endl "\n"
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 fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
const ll mod=1000000007;
//const ll mod=998244353;
const ld 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(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int d;
  cin>>d;

  vector<ll> p(26);
  rep(i,26) {
    cin>>p[i];
  }


  vector<vector<ll>> q(d,vector<ll>(26));
  rep(i,d) {
    rep(j,26) {
      cin>>q[i][j];
    }
  }

  ll pre=0;
  vector<int> r(26,0);
  rep(i,d-5){
    ll ans=-INF;
    ll memo;
    rep(j,26){
      ll sum=pre;
      auto last=r;
      sum+=q[i][j];
      last[j]=i+1;
      rep(k,26){
        sum-=8*p[k]*(i+1-last[k])/5;
      }
      if(sum>ans) {
        memo=j;
        chmax(ans,sum);
      }
    }
    cout << memo+1 << endl;
    pre=ans;
    r[memo]=i+1;
  }

  ll answer=-INF;
  ll A,B,C,D,E;
  vector<int> zen(5);
  rep(i,26){
    rep(j,26){
      rep(k,26){
        rep(l,26){
          rep(m,26){
            zen[0]=i;
            zen[1]=j;
            zen[2]=k;
            zen[3]=l;
            zen[4]=m;

            ll sum=0;
            auto last=r;
            rep(n,5){
              sum+=q[d-5+n][zen[n]];
              last[zen[n]]=d-5+n+1;
              rep(o,26){
                sum-=p[o]*(d-5+n+1-last[o]);
              }
            }

            if(sum>answer) {
              A=zen[0];
              B=zen[1];
              C=zen[2];
              D=zen[3];
              E=zen[4];
            }
            chmax(answer,sum);

          }
        }
      }
    }
  }

  cout << A+1 << endl;
  cout << B+1 << endl;
  cout << C+1 << endl;
  cout << D+1 << endl;
  cout << E+1 << endl;
  
}

Measured memory_bytes: 3740
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    ll a,b,n; cin>>a>>b>>n;
    ll k=min(b,n);
    ll s=(a*k/b)-a*(k/b);
    ll t=(a*(k-1)/b)-a*((k-1)/b);
    ll ans=max(s,t);
    cout<<ans<<endl;
}





Measured memory_bytes: 3528
import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {
    readln;
	auto S = readln.split[0];
    writeln( S.count('R') > S.count('B') ? "Yes" : "No" );
}





Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,W; cin >> N >> W;
    vector<ll> w(N), v(N);
    rep(i,N) cin >> w[i] >> v[i];
    
    vector<vector<ll>> dp(N+1, vector<ll>(W+1));
    rep(i,N) {
        rep(j,W+1) {
            if (j < w[i]) dp[i+1][j] = dp[i][j];
            else dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
        }
    }

    cout << dp[N][W] << endl;
}


Measured memory_bytes: 80256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
using namespace std;

int main(){
  long long n,ans=1;
  cin>>n;
  for(int i=1;i<=n;i++){
    ans*=i;
    if(ans>1000000007) ans=ans%1000000007;
  }
  cout<<ans<<endl;

}


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

int main() {
  int N; cin >> N;
  vector<int> P(N), Q(N);

  rep(i,N) {
    cin >> P[i];
    P[i]--;
  }
  rep(i,N) Q[P[i]] = i;
  rep(i,N) {
    cout << Q[i]+1 << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1664
'use strict';
(function(input){
  input=input.trim().split(/\s+/).map(x=>x-0);
  const N=input.shift();
  const dish=['zero',0,0,0];
  input.forEach(function(x){
    dish[x]++;
  });
  //console.log(dish);
  const dp=new Array(N+2);
  for(let i=-1;i<N+2;i++){
    dp[i]=new Array(N+2-i);
    for(let j=-1;j<N+2-i;j++){
      dp[i][j]=new Array(N+2-i-j).fill(0);
      dp[i][j][-1]=0;
    }
  }
  
  for(let i=1;i<=N;i++){
    dp[i][0][0]=dp[i-1][0][0]+(N/i);
    for(let j=1;j<=i;j++){
      dp[i-j][j][0]=N/i+dp[i-j+1][j-1][0]*(j/i)+dp[i-j-1][j][0]*((i-j)/i);
      for(let k=1;k<=j;k++){
        dp[i-j][j-k][k]=N/i+dp[i-j][j-k+1][k-1]*(k/i)+dp[i-j+1][j-1-k][k]*((j-k)/i)+dp[i-j-1][j-k][k]*((i-j)/i);
      }
    }
  }
  console.log(dp[dish[1]][dish[2]][dish[3]]);
})(require('fs').readFileSync('/dev/stdin','utf8'));


Measured memory_bytes: 118816
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(){
    int n, k;
    cin >> n >> k;
    vector<vector<int>> g(n);
    rep(i,n-1){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<int> p(n, -2);
    queue<int> q;
    q.push(0);
    p[0] = -1;
    while(!q.empty()){
        int v = q.front(); q.pop();
        for(int d: g[v]){
            if (p[d] != -2) continue;
            p[d] = v;
            q.push(d);
        }
    }
    sort(all(p));
    p.push_back(-2);

    int sz = max(n, k);
    vector<mint> fact(sz+1), ifact(sz+1);
    fact[0] = 1;
    for (int i = 1; i <= sz; ++i) fact[i] = fact[i-1]*i;
    ifact[sz] = fact[sz].inv();
    for (int i = sz; i >= 1; --i) ifact[i-1] = ifact[i]*i;

    int left = 1;
    int cnt = 1;
    mint ans = k;
    while(left < n){
        if (p[left] != p[left+1]){
            if (p[left] == 0){
                if (k - 1 < cnt){
                    ans *= 0;
                }else{
                    ans *= fact[k-1] * ifact[k-1-cnt];
                }
            }else{
                if (k - 2 < cnt){
                    ans *= 0;
                }else{
                    ans *= fact[k-2] * ifact[k-2-cnt];
                }
            }
            cnt = 0;
        }
        left++;
        cnt++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11372
import java.util.HashSet;
import java.util.Scanner;

public class Main{

	int N;
	String[][] strs;
	HashSet<String> visited, groupName, memberName;

	void run(){
		Scanner in = new Scanner(System.in);
		for(;;){
			N = in.nextInt();
			if(N==0) return ;
			strs = new String[N][];
			for(int i=0;i<N; i++){
				String line = in.next();
				strs[i] = line.replace(".","").split("[:,]");
			}
			visited = new  HashSet<String>();
			groupName = new HashSet<String>();
			memberName = new HashSet<String>();
			System.out.println(solve());
		}
	}

	void dfs(String str){
		visited.add(str);
		if(groupName.contains(str)){
			for(int i=0; i<N; i++){
				if(strs[i][0].equals(str)){
					for(int j=1; j<strs[i].length; j++)if(!visited.contains(strs[i][j])){
						dfs(strs[i][j]);
					}
					return ;
				}
			}
		}
		else{
			memberName.add(str);
		}
	}

	int solve(){
		for(int i=0; i<N; i++){
			groupName.add(strs[i][0]);
		}
		dfs(strs[0][0]);
		return memberName.size();
	}

	public static void main(String args[]){
		new Main().run();
	}
}

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

using ll = long long;

int main(){
  int N;
  ll W;
  cin >> N >> W;

  vector<ll> w(N), v(N);
  for (int i = 0; i < N; i++) {
    cin >> w[i] >> v[i];
  }

  vector<vector<ll>> dp(110, vector<ll>(100100, 0));
  dp[0][0]=0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= W; j++) {
      if(j>=w[i]) dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i]);
      else dp[i+1][j] = dp[i][j];
    }
  }
  cout << dp[N][W] << endl;
}


Measured memory_bytes: 87296
import Data.List

g _ (_:[]) = []
g m (a:b) =
  let x = dropWhile (\i -> (a+i)>m) b
      y = a + (head x)
      z = g m b
  in
    if x /= [] then (y:z) else z

f m d =
  let t = g m $ reverse $ sort d
  in
    if t /= []
    then show $ maximum t
    else "NONE"

ans ([0,0]:_) = []
ans ([_,m]:d:r) = (f m d):(ans r)

main = do
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = ans i
  mapM_ putStrLn o
  



Measured memory_bytes: 5604
using System;
using System.Collections.Generic;

namespace ALDS1_1_C
{
    class Program
    {
        static List<int> primes = new List<int>();
        static int tmpMax = 1;
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            primes.Add(2);
            tmpMax = 2;
            int cnt = 0;
            while (n-- != 0)
            {
                var x = int.Parse(Console.ReadLine());
                if (x < tmpMax)
                {
                    if (primes.Contains(x)) cnt++;
                    else continue;
                } 
                var sqrt = (int)Math.Sqrt(x);
                bool isPrime = true;
                foreach (var p in primes)
                {
                    if (p > sqrt) break;
                    if (x % p == 0)
                    {
                        isPrime = false;
                        break;
                    }
                }
                for(int i=primes[primes.Count-1]+1;i<=sqrt; i++)
                {
                    if(x % i == 0)
                    {
                        isPrime = false;
                        break;
                    }
                }
                if (isPrime) cnt++;
            }
            Console.WriteLine(cnt);
        }
    }
}

Measured memory_bytes: 9176
import java.io.*;
import java.util.*;

public class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		while(true){
			String s=reader.readLine();
			int n=Integer.parseInt(s);
			if(n==0){System.exit(0);}
			int[] tensuu=new int[n];
			for(int i=0;i<n;i++){
				tensuu[i]=Integer.parseInt(reader.readLine());
			}
			Arrays.sort(tensuu);
			int sum=0;
			for(int j=1;j<n-1;j++){
				sum+=tensuu[j];
			}
			int ans=sum/(n-2);
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 16996
#include "bits/stdc++.h"
using namespace std;
#define INF 1<<30
typedef long long ll;
typedef pair<ll, ll> pll;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N, D; cin >> N >> D;
	vector<pll> tF(N);
	for (int i = 0; i < N; i++) {
		cin >> tF[i].first >> tF[i].second;
		tF[i].second--;
	}

	ll now_D = 0;
	ll now_F = 0;
	ll now_t = 0;
	ll ans = 0;
	for (int i = 0; i < N;i++){
		ll dif_t = tF[i].first - now_t;
		ll dif_f = abs(now_F - tF[i].second);
		if (dif_f > dif_t) {
			cout << -1 << endl;
			return 0;
		}
		else {
			/* now_F + tF[i].second <= dif_f <= dif_t */
			if (now_F + tF[i].second <= dif_t) {
				ans += now_D*now_F;
				now_D = 0;
				now_D++;
				now_t = tF[i].first;
				now_F = tF[i].second;
			}
			else 
			{
				/* dif_f <= dif_t < now_F + tF[i].secound  */
				ans += now_D*dif_t;
				now_D++;
				if (now_D > D) {
					cout << -1 << endl;
					return 0;
				}
				now_t = tF[i].first;
				now_F = tF[i].second;
			}
		}
		/*cout << now_F << " " << now_D << " " << now_t << endl;
		cout << "ans = " << ans << endl;*/
	}
	ans += now_D*now_F;
	cout << ans << endl;
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  int h[N];
  for (int i=0;i<N;i++) cin >> h[i];
  int count = 0;
  int h_max = h[0];
  for (int i=0;i<N;i++){
    if (h[i] >= h_max) count += 1;
    h_max = max(h_max,h[i]);
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

// ABC062
public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.solveA();
	}

	private void solveA() {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		List<Integer> a = Arrays.asList(0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0);
		if (a.get(x - 1) == a.get(y - 1)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	private void solveB() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	private void solveC() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	private void solveD() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	private void solveE() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	private void solveF() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

}

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

int main() {
  ll n;
  cin>>n;
  map<string,ll> s;
  rep(i,n){
    string S;
    cin>>S;
    sort(S.begin(),S.end());
    s[S]++;
  }
  ll ans=0;
  for(auto x:s){
    if(x.second!=1){
      ans+=x.second*(x.second-1)/2;
    }
  }
  cout<<ans<<endl;
}

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

int main(){
  int64_t A,B,C,D;
  cin >> A >> B >>C >>D;
  while(true){
    C-=B;
    if(C<=0){
      cout<<"Yes"<<endl;
      return 0;
    }
    A-=D;
    if(A<=0){
      cout<<"No"<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3620
N, K = map(int,input().split())
MOD = 10**9+7

# dp[i][j][k]:
# ウサギ1~i, カメ1~i (うちj個は相手が未定)まで見ていて，
# 確定している奇妙さがkであるような場合の数
dp = []
for _ in range(55):
    dp.append([[0] * (55*55) for _ in range(55)])

dp[0][0][0] = 1

for i in range(N+1):
    for j in range(N+1):
        for k in range(N*N+1):
            if k-2*j < 0 or i-1 < 0: continue

            dp[i][j][k] += (2*j+1) * dp[i-1][j][k-2*j] % MOD
            dp[i][j][k] %= MOD

            dp[i][j][k] += (j+1)*(j+1) * dp[i-1][j+1][k-2*j] % MOD
            dp[i][j][k] %= MOD

            if j > 0:
                dp[i][j][k] += dp[i-1][j-1][k-2*j]
                dp[i][j][k] %= MOD
            
print(dp[N][0][K])

Measured memory_bytes: 145552
def is_palindrome(str):
  i, j = 0, len(str)-1
  while i <= j:
    if str[i] != str[j]:
      return False
    i += 1
    j -= 1

  return True

s = input()
n = len(s)
if is_palindrome(s) and is_palindrome(s[0:((n-1)//2)]) and is_palindrome(s[(n+3)//2-1:]):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
S = input()

if S=="SAT":
    print(1)
elif S=="FRI":
    print(2)
elif S=="THU":
    print(3)
elif S=="WED":
    print(4)
elif S=="TUE":
    print(5)
elif S=="MON":
    print(6)
elif S=="SUN":
    print(7)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    if (v.size() > 0) {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

int main() {
    string s;
    cin >> s;
    int sz = s.size();
    if (s[sz - 1] == '1' || s[0] == '0'){
        cout << -1 << endl;
        return 0;
    }
    int sz2 = sz - 1;
    REP(i, sz2 / 2) {
        if (s[i] != s[sz2 - 1 - i]) {
            cout << -1 << endl;
            return 0;
        }
    }
    vint vals;
    int val = 0;
    REP(i, sz-1) {
        if (s[i] == '0') {
            ++val;
        } else {
            ++val;
            vals.push_back(val);
            val = 0;
        }
    }
    vals.push_back(1);
    int prev = 1;
    FOR(i, 1, vals.size()){
        int now = prev + vals[i];
        FOR(j, 1, vals[i]) {
            cout << prev + j << " " << prev + vals[i] << endl;
      }
      cout << prev << " " << prev + vals[i] << endl;
      prev = prev + vals[i];
    }
}

Measured memory_bytes: 2040
#include <iostream>

using namespace std;
const int MAXN = 200010;

int n;
int a[MAXN];
int l[MAXN];
int r[MAXN];

void solve() {
  l[0] = 0;
  for (int i=0;i<n;i++) {
    l[i+1] = max(a[i], l[i]);
  }
  r[n] = 0;
  for (int i=n-1;i>=0;i--) {
    r[i] = max(r[i+1], a[i]);
  }

  for (int i=0;i<n;i++) {
    cout << max(l[i], r[i+1]) << endl;
  }
}

int main() {
  cin >> n;
  for (int i=0;i<n;i++) {
    cin >> a[i];
  }
  solve();
}


Measured memory_bytes: 3968
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T iabs(const T& x) { return max(x, -x); }
// #define abs gabs

template<class F>
i64 bisect(i64 l, i64 r, F f) { // (l, r]
  if (r - l <= 1) return r;
  i64 m = l + (r - l) / 2;
  return f(m) ? bisect(l, m, f) : bisect(m, r, f);
}
int main() {
    i64 n, a, b;
    cin >> n >> a >> b;
    vector<i64> h(n);
    for (int i = 0; i < n; ++i) cin >> h[i];

    i64 ans = bisect(0, 1e9, [&](i64 k) {
        i64 cnt = 0;
        for (int i = 0; i < n; ++i) {
            i64 x = max(i64(0), h[i] - b * k);
            i64 c = a - b;
            cnt += (x + c - 1) / c;
        }
        return cnt <= k;
    });

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

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
ll INF = (1LL << 50) - 1;
int MOD = 1e9+7;
main(){
    int N,M,R;
    cin >> N >> M >> R;
    vector<int> V(R);
    rep(i,0,R)cin >> V[i];
    ll dist[N][N];
    rep(i,0,N)rep(j,0,N)dist[i][j] = INF;
    rep(i,0,N)dist[i][i] = 0;
    rep(i,0,M){
        int a,b,c;
        cin >> a >> b >> c;
        a--,b--;
        dist[a][b] = dist[b][a] = c;
    }
    rep(i,0,N)rep(j,0,N)rep(k,0,N)dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
    sort(V.begin(), V.end());
    ll mini = INF;
    do{
        ll sum = 0;
        rep(i,0,R-1){
            sum += dist[V[i]-1][V[i+1]-1];
        }
        mini = min(mini, sum);

    }while(next_permutation(V.begin(), V.end()));
    cout << mini << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<queue>
#include<cstdio>
#include<vector>
#include<map>
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		cout<<'x';
	}
	return 0;
}

Measured memory_bytes: 256
n = STDIN.gets.to_i

ss = n.times.inject([]) do |s, _|
  s << STDIN.gets.split
  s
end

x = STDIN.gets.chomp

t = 0
ss.reverse.find {|s|
  if s[0] == x
    true
  else
    t += s[1].to_i
    false
  end
}

puts t

Measured memory_bytes: 1788