akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<ll,pll> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;

int main(){
	cin>>n;
	int t=0;
	for(int i=1;i<=n;i++) t+=to_string(i).size()%2;
	cout<<t<<endl;
}

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

int main(){
  int H, W;
  cin >> H >> W;
  while(H != 0 || W != 0){
    for(int i = 0;i < W;i++){
      cout << "#";
    }
    cout << endl;
    for(int i = 0;i < H-2;i++){
      cout << "#";
      for(int j = 0;j < W-2;j++){
        cout << ".";
      }
      cout << "#" << endl;
    }
    for(int i = 0;i < W;i++){
      cout << "#";
    }
    cout << endl << endl;

    cin >> H >> W;
  }
  return 0;
}


Measured memory_bytes: 3036
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1e9;
const int MOD = 1e9+7;

const int MINT = 1000000;
int dp[MINT]; // 正四面体の番号、正整数
int dpodd[MINT]; // 正四面体の番号、正整数

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

    int n = 200;
    vector<int> a(n);
    rep(i, n) a[i] = (i+1)*(i+2)*(i+3)/6;

    rep(j, MINT) { dp[j]=INF; dpodd[j]=INF; }
    dp[0] = 0; dpodd[0] = 0;

    rep(i, n) {
        ll num = a[i];
        rep(j, MINT) {
            if (j>=num) dp[j] = min(dp[j-num]+1, dp[j]);
            else dp[j] = dp[j];
            if (num%2) {
                if (j>=num) dpodd[j] = min(dpodd[j-num]+1, dpodd[j]);
                else dpodd[j] = dpodd[j];
            } else {
                dpodd[j] = dpodd[j];
            }
        }
    }

    while (true) {
        int x; cin >> x;
        if (!x) break;
        cout << dp[x] << " " << dpodd[x] << endl;
    }
}


Measured memory_bytes: 10880
#include <bits/stdc++.h>
using namespace std ;
int n ;
int a[10] , b[10] , c[10] ;
int main()
{
	scanf("%d" , &n) ;
	for(int i = 1 ; i <= n ; i ++)
	  scanf("%d" , &a[i]) ;
	for(int i = 1 ; i <= n ; i ++)
	  scanf("%d" , &b[i]) ;
	int ans_a = 0 , ans_b = 0 ;
	for(int i = 1 ; i <= n ; i ++)
	  c[i] = i ;
	bool flag ;
	do
	{
		flag = 1 ;
		for(int i = 1 ; i <= n ; i ++)
		 if(c[i] != a[i]) flag = 0 ;
		if(flag)  break ;
		ans_a ++ ; 
	}while(next_permutation(c + 1 , c + n + 1)) ;
	
	for(int i = 1 ; i <= n ; i ++)
	  c[i] = i ;
	do
	{
		flag = 1 ;
		for(int i = 1 ; i <= n ; i ++)
		 if(c[i] != b[i]) flag = 0 ;
		if(flag)  break ;
		ans_b ++ ; 
	}while(next_permutation(c + 1 , c + n + 1)) ;
	printf("%d\n" , abs(ans_a - ans_b)) ;
	return 0 ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<int, P > PP;
#define MAX 10000000
int cc=1;
int A,B,C,N;
set< PP > s;
vector< PP > t;
   
map< P , set< P > > xy,yz,zx;
   
int par[MAX],rak[MAX];
   
void init(){
  for(int i=0;i<MAX;i++)
    par[i]=i,rak[i]=1;
}
   
int find(int x){
  if(par[x]==x)return x;
  return par[x]=find(par[x]);
}
   
void unite(int x,int y){
  x=find(x),y=find(y);
  if(x==y)return;
  if(rak[x]<rak[y])swap(x,y);
  par[y]=x;
  rak[x]+=rak[y];
}
   
void calc(map< P , set<P> > &mp){
  map< P , set<P> > :: iterator it;
  for(it=mp.begin();it!=mp.end();it++){
    set<P> :: iterator si=it->second.begin();
    set<P> :: iterator ti=it->second.end();
    set<P> :: iterator A=si,B;
    while(1){
      B=A;
      B++;
      if(B==ti)break;
      if(A->second>0&&B->second>0){
        unite(A->second,B->second);
      }
      A=B;
    }
  }
}
   
void add(int nx,int ny,int nz){
  if(nx<0||A<=nx||ny<0||B<=ny||nz<0||C<=nz)return;
  if(s.count(PP(nx,P(ny,nz))))return;
  s.insert( PP(nx,P(ny,nz)) );
  xy[ P(nx,ny) ].insert( P(nz,cc) );
  yz[ P(ny,nz) ].insert( P(nx,cc) );
  zx[ P(nz,nx) ].insert( P(ny,cc) );     
  cc++;
}
   
int main(){
  init();
  scanf("%d %d %d %d",&A,&B,&C,&N);
  t.resize(N);
  
  for(int i=0;i<N;i++){
    int x,y,z;
    scanf("%d %d %d",&x,&y,&z);
    s.insert( PP(x,P(y,z)) );
    t[i]=PP(x,P(y,z));
  
    xy[ P(x,y) ].insert( P(z,0) );
    yz[ P(y,z) ].insert( P(x,0) );
    zx[ P(z,x) ].insert( P(y,0) );     
  }
  
  
  add(0,0,0);
  
   
  for(int i=0;i<(int)t.size();i++){
    int x=t[i].first;
    int y=t[i].second.first;
    int z=t[i].second.second;
       
    for(int dx=-1;dx<=1;dx++){
      for(int dy=-1;dy<=1;dy++){
        for(int dz=-1;dz<=1;dz++){
          add(x+dx,y+dy,z+dz);
   
          add(x+dx,0,0);
          add(0,y+dy,0);
          add(0,0,z+dz);
   
          //          add(x+dx,B-1,C-1);
          //          add(A-1,y+dy,C-1);
          //          add(A-1,B-1,z+dz);
   
          //          add(x+dx,B-1,0);
          //          add(A-1,y+dy,0);
          //          add(A-1,0,z+dz);
   
          //          add(x+dx,0,C-1);
          //          add(0,y+dy,C-1);
          //          add(0,B-1,z+dz);
   
          add(x+dx,y+dy,0);
          add(0,y+dy,z+dz);
          add(x+dx,0,z+dz);
   
          //          add(x+dx,y+dy,C-1);
          //          add(A-1,y+dy,z+dz);
          //          add(x+dx,B-1,z+dz);
        }
      }
    }
  }
     
   
  calc(xy);
  calc(yz);
  calc(zx);
   
  int ans=0;
  for(int i=1;i<cc;i++)
    if(find(i)==i)ans++;
   
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 416708
n = int(input())
s = list(input())
ans = 0
for i in range(1000):
    pin = list(str(i).zfill(3))
    idx = 0
    for c in s:
        if c == pin[idx]:
            idx += 1
        if idx == 3:
            ans += 1
            break
print(ans)

Measured memory_bytes: 74928
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

template <typename T> struct Compress{
	vector<T> comp;

	Compress(vector<T> v) : comp(v){
		sort(comp.begin(), comp.end());
		comp.erase(unique(comp.begin(), comp.end()), comp.end());
	}

	ll get(T x){
		return lower_bound(comp.begin(), comp.end(), x) - comp.begin();
	}

	T operator[](int id){
		return comp[id];
	}

	ll siz(){
		return comp.size();
	}
};

bool in(ll y, ll x, ll h, ll w){
	return 0 <= y && y < h && 0 <= x && x < w;
}


int main(){
	ll n,m; cin >> n >> m;
	vl y,x;
	y.push_back(0); x.push_back(0);
	vl a(n),b(n),c(n);
	vl d(m),e(m),f(m);
	rep(i,n){
		cin >> a[i] >> b[i] >> c[i];
		y.push_back(a[i]); y.push_back(b[i]);
		x.push_back(c[i]);
	}
	rep(i,m){
		cin >> d[i] >> e[i] >> f[i];
		x.push_back(e[i]); x.push_back(f[i]);
		y.push_back(d[i]);
	}
	Compress<ll> cmpy(y), cmpx(x);
	ll h = cmpy.siz()*2;
	ll w = cmpx.siz()*2;
	vvl v(h,vl(w,1));
	rep(i,n){
		ll X = cmpx.get(c[i]) * 2;
		for(ll j=cmpy.get(a[i]) * 2; j<=cmpy.get(b[i]) * 2; j++){
			v[j][X] = 0;
		}
	}
	rep(i,m){
		ll Y = cmpy.get(d[i]) * 2;
		for(ll j=cmpx.get(e[i]) * 2; j<=cmpx.get(f[i]) * 2; j++){
			v[Y][j] = 0;
		}
	}
	ll ans = 0;
	queue<P> q;
	q.emplace(cmpy.get(0)*2,cmpx.get(0)*2);
	v[cmpy.get(0)*2][cmpx.get(0)*2] = 0;
	vpl as;
	while(!q.empty()){
		auto p = q.front(); q.pop();
		ll y = p.first;
		ll x = p.second;
		rep(i,4){
			ll ny = y + dy[i];
			ll nx = x + dx[i];
			if(!in(ny,nx,h,w)){
				cout << "INF" << "\n";
				return 0;
			}
			if(v[ny][nx]){
				q.emplace(ny,nx);
				as.emplace_back(ny,nx);
				v[ny][nx] = 0;
			}
		}
	}
	for(auto i : as){
		ll Y = i.first, X = i.second;
		if((Y & 1) && (X & 1)){
			ans += (cmpy[Y/2+1] - cmpy[Y/2]) * (cmpx[X/2+1] - cmpx[X/2]);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 809380
//ITP1_3_C
#include<iostream>
using namespace std;

int main()
{

	while(1){
	int x,y;
	
	cin>>x>>y;
	
	if(x == 0&&y == 0)
	break;
	
	if(y<x)
	cout<<y<<" "<<x<<endl;
	
	else
	cout<<x<<" "<<y<<endl;
	
	}
	
	return 0;
}

Measured memory_bytes: 1160
from operator import attrgetter


class Data:
    def __init__(self, s, t, c):
        self.s = s
        self.t = t
        self.c = c


N, C = map(int, input().split())
data_list = []
for _ in range(N):
    s, t, c = map(int, input().split())
    data_list.append(Data(s, t, c))

ch_map = {}
for data in data_list:
    if data.c in ch_map:
        ch_map[data.c].append(data)
    else:
        ch_map[data.c] = [data]
data_list = []

m = {}
for key, val in ch_map.items():
    ch_list = sorted(val, key=attrgetter("s"))
    # m = {}
    ch_m = {}
    end = 0
    for ch in ch_list:
        if end <= ch.s:
            for i in range(ch.s-1, ch.t):
                if i in m:
                    if i not in ch_m:
                        m[i] += 1
                else:
                    m[i] = 1
                ch_m[i] = 1
                # m[i] = 1
            end = ch.t
        elif end > ch.t:
            for i in range((end+1, ch.t)):
                if i in m:
                    if i not in ch_m:
                        m[i] += 1
                else:
                    m[i] = 1
                ch_m[i] = 1
                # m[i] = 1
            end = ch.t
    # ch_map[key] = m


max = 0
for key, val in m.items():
    if max < val:
        max = val

# print(ch_map)
'''
for i in range(100001):
    cnt = 0
    for key, val in ch_map.items():
        if i in val:
            cnt += 1
    if cnt > max:
        max = cnt
    cnt = 0
'''
print(max)


Measured memory_bytes: 51764
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextInt();
    long total = 0;
    for(long i=1 ; i<=n ; i++){
      if(i%3 != 0 && i%5 != 0){
        total = total + i;
      }
    }
    System.out.println(total);
  }
}


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

using namespace std;

#define fore(i, s, e) for(int i = s; i < e; i++)
#define pb push_back

typedef long long ll;

const int N = 105;
const int K = 1e5 + 5;

int n, k;

int dp[K];

vector<int> a;

set<int> s;

void grundy(int i) {
    if(i > k) return;
    fore(k, 0, n) if(i - a[k] >= 0) { s.insert(dp[i - a[k]]); }
    if(s.size() == 0) dp[i] = 0;
    else {
        int m = 0;
        while(s.count(m)) m++;
        dp[i] = m;
    }
    s.clear();
    grundy(i + 1);
}
int main() {
    cin >> n >> k;
    fore(i, 0, n) { int b; cin >> b; a.pb(b);}
    sort(a.begin(), a.end());
    grundy(0);
    if (dp[k]) cout << "First" << endl;
    else cout << "Second" << endl;
}

Measured memory_bytes: 640
//
// Created on 2020/06/03.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    string b;
    cin>>b;
    string a = "";
    for (int i = 0; i < b.size(); ++i) {
        if(b[i] == 'A'){
            a += 'T';
        }else if(b[i] == 'T'){
            a += 'A';
        }else if(b[i] == 'C'){
            a += 'G';
        }else{
            a += 'C';
        }
    }
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 256
def resolve():
    S = input()
    s = len(S) - 7
    if S == "keyence":
        print("YES")
    else:
        for i in range(len(S)-s-1):
            if S[:i+1]+S[i+s+1:] == "keyence":
                print("YES")
                exit()
        print("NO")
resolve()

Measured memory_bytes: 9056
import sys
from collections import Counter

input = sys.stdin.readline


def main():
    K, T = map(int, input().split())
    a = list(map(int, input().split()))

    ans = 0
    prev_j = -1
    for i in range(K):
        j_max = 0
        n_max = 0
        for j in range(T):
            if j == prev_j:
                continue
            if a[j] > n_max:
                n_max = a[j]
                j_max = j
        if n_max == 0:
            ans += 1
        else:
            prev_j = j_max
            a[j_max] -= 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n) 

int main(void){  
  double a[10];
  while(cin >> a[0]){
    double s=a[0];
    for(int i=1; i<10; i++){
      if(i%2==1) a[i] = a[i-1] * 2;
      else a[i] = a[i-1] / 3;
      s += a[i];
    }
    printf("%.8f\n",s);
  }
}

Measured memory_bytes: 0
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    let input: Vec<i32> = buf
        .trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    println!("{}", (input[0] + input[1] + 1) / 2)
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P = pair<int,int>;
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; }

signed main(){
  int a,b;
  cin >> a >> b;
  if(a - b > 0) cout << a - b << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int dp[1000][1000];

int main(){

  int h, w;
  cin >> h >> w;

  string s[1000];
  REP(i,h){
    cin >> s[i];
  }

  dp[0][0] = 1;
  REP(i,h){
    REP(j,w){
      if(s[i][j] == '.'){
        if(i+1 < h)
          dp[i+1][j] = (dp[i+1][j] + dp[i][j]) % MOD;
        if(j+1 < w)
          dp[i][j+1] = (dp[i][j+1] + dp[i][j]) % MOD;
      }
    }
  }

  cout << dp[h-1][w-1] << endl;
  return 0;
}



Measured memory_bytes: 5760
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#define fr first
#define sc second
using namespace std;
#define INF 10000000
typedef pair<int,int> iiP;
typedef pair<int,iiP> P;
struct edge{
  int to,cost;
  edge(){}
  edge(int to,int cost):to(to),cost(cost){};
};
int n,m;
int S,G;
int min_cost[101][2];
bool used[101][2];
vector< vector<edge> > info;
int solve();
int main(){

  while(cin >> n >> m && (n||m)){
    for(int i=0;i<=n;i++){
      for(int j=0;j<2;j++){
        used[i][j] = false;
        min_cost[i][j] = INF;
      }
    }
    info.resize(n + 1);
    for(int i=0,a,b,c;i<m;i++){
      cin >> a >> b >> c;
      info[a].push_back(edge(b,c));
      info[b].push_back(edge(a,c));
    }
    cout << solve() << endl;

    for(int i=0;i<=n;i++) info[i].clear();
  }
}
int solve(){
  min_cost[1][0] = 0;
  priority_queue< P,vector<P>,greater<P> > que;

  que.push(P(0,iiP(1,0)));

  while(!que.empty()){
    P p = que.top();
    int cost = p.fr,now = p.sc.fr,KIPPU = p.sc.sc;
    que.pop();

    if( now == n ) return cost;

    if( used[now][KIPPU] ) continue;
    used[now][KIPPU] = true;

    for(int i = 0,l = info[now].size();i < l;i++){
      edge e = info[now][i];
      if(cost + e.cost < min_cost[e.to][KIPPU]){
        min_cost[e.to][KIPPU] = cost + e.cost;
        que.push(P(min_cost[e.to][KIPPU],iiP(e.to,KIPPU)));
      }
      if(KIPPU == 0){
        for(int j=0,ll=info[e.to].size();j < ll;j++){
          edge ee = info[e.to][j];
          if(cost < min_cost[ee.to][1]){
            min_cost[ee.to][1] = cost;
            que.push(P(min_cost[ee.to][1],iiP(ee.to,1)));
          }
        }
      }
    }
  }
}

Measured memory_bytes: 1212
#include<iostream>
#include<vector>

using std::cout;
using std::endl;
using std::cin;
using std::vector;

int main(void) {
    int n;
    cin >> n;
    vector<int> v(n);

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

    for (int i = n - 1; i >= 0; i--) {
        cout << v[i];
        if (i != 0) {
            cout << " ";
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3096
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    A, B = map(int, input().split())

    print((B-1+A-2)//(A-1))


# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc139","b",main)

Measured memory_bytes: 2940
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>
#include <unordered_map>
#include <set>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main()
{
  string s;
  cin >> s;
  ll count = 0;
  for (auto c : s) if (c == 'o')
      count++;


  cout << ((15 - s.size() + count) >= 8 ? "YES" : "NO") << endl;

  return 0;
}


Measured memory_bytes: 256
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <complex>
typedef long long int LL;
using namespace std;

// 插入此處

vector<vector<char>> ans;
int n;

char max_char(vector<char> &s) {
    char ret = 'a';
    for (char c : s) {
        ret = ret < c ? c : ret;
    }
    return ret;
}

void sol(int k) {
    if (k == 1) {
        return;
    }
    sol(k - 1);
    vector<vector<char>> tmp;
    for (auto s: ans) {
        char ma = max_char(s);
        for (char c = 'a'; c <= ma + 1; c++) {
            auto t = s;
            t.push_back(c);
            tmp.push_back(t);
        }
    }
    ans = tmp;
}

int main() {
    scanf("%d", &n);
    ans.push_back(vector<char>{'a'});
    sol(n);
    for (auto s : ans) {
        for (auto c: s) {
            printf("%c", c);
        }
        printf("\n");
    }
}


Measured memory_bytes: 14116
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();

            var prevent = S[0];
            var count = 0;
            foreach (var c in S)
            {
                if (prevent != c)
                {
                    prevent = c;
                    count++;
                }
            }

            Console.Write(count);
        }
    }
}


Measured memory_bytes: 3032
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
int visited[51][51] = {0};
vector<string> s;
int h, w;
bool ok;
void rec (int y, int x) {
    visited[y][x] = 1;
    rep(i, 4) {
        int nx = x + dx[i];
        int ny = y + dy[i];
        if(nx<0||nx>=w||ny<0||ny>=h) continue;
        if(s[ny][nx]=='.'||visited[ny][nx]) continue;
        rec(ny, nx);
        ok = true;
    }
}
int main() {
    cin >> h >> w;
    s.resize(h);
    rep(i, h) cin >> s[i];
    rep(i, h) rep(j, w) {
        if(visited[i][j]) continue;
        if(s[i][j] == '.') continue;
        ok = false;
        rec(i, j);
        if(!ok) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}


Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
   int i,n,a[100],max,min;

   scanf("%d",&n);

   for(i=0;i<n;i++)
      scanf("%d",&a[i]);

   max=min=a[0];

   for(i=0;i<n;i++){
      if(a[i]>max)      max=a[i];
      else if(a[i]<min) min=a[i];
   }

   printf("%d",max-min);

   return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define Imposter ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
#define f(n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(i=a;i<b;i++)
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define vll vector<ll>
#define vlll vector<vll>
#define all(x) x.begin(),x.end()
ll power(ll x, ll y, ll p) { 
    ll res = 1;    x = x % p;  
    while(y > 0) {
        if(y & 1) res = (res*x) % p; 
        y = y>>1;    x = (x*x) % p; 
    } return res; 
}
int main()
{
    Imposter
    
    int T=1;
    //cin>>T;
    while(T--)
    {
        ll n;
        cin>>n;
        set<string>s;string syr;
        f(n)
        {
            cin>>syr;
            s.insert(syr);
        }
        cout<<s.size()<<endl;
    }
    return 0;
}

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

long long n,m,modu,s1,s2,s;

long long gt(long long n)
{
    long long t,i;
    t=1;
    for (i=1;i<=n;i++)
    {
        t=t*i%modu;
    }
    return t;
}
int main()
{
 //   freopen("76C.inp","r",stdin);
  //  freopen("76C.out","w",stdout);
    scanf("%lld %lld",&n,&m);
    if (n-m>1 || m-n>1)
    {
        printf("0");
        return 0;
    }
    modu=1000000007;
    s1=gt(n);
    s2=gt(m);
    s=(s1*s2) % modu;
    if (n==m) {s=s*2%modu;}
    printf("%lld",s);
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;

int dp[82];


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

	int N; cin >> N;
	VI A(N);
	REP(i, N)cin >> A[i];
	dp[0] = 1000;
	eFOR(i, 1, N) {
		int tmp = -INF;
		REP(j, i) {
			chmax(tmp, dp[j] / A[j] * A[i - 1] + dp[j] % A[j]);
		}
		dp[i] = tmp;
	}
	cout << dp[N] << endl;




	return 0;
}



Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll INFL = 1e18+100;
const ll MOD = 1e9+7;
const bool debug = 0;
//-----------------------------------------------//

struct UnionFind {
	vector<int> par, rank;
	
	UnionFind(int n) {
		par.resize(n);
		rank.resize(n);
		REP(i, n) {
			par[i] = i;
			rank[i] = 0;
		}
	}
	
	int operator[] (int x) {
		return find(x);
	}
	
	int find(int x) {
		if (x == par[x]) return x;
		return par[x] = find(par[x]);
	}
	
	void unite(int x, int y) {
		x = find(x); y = find(y);
		
		if (rank[x] < rank[y]) swap(x, y);
		par[y] = x;
		if (rank[x] == rank[y]) rank[x]++;
	}
};

int N, M;
int p[112345];

int main() {
	cin >> N >> M;
	REP(i, N) scanf("%d", p + i);
	
	UnionFind uf(N);
	
	REP(i, M) {
		int x, y;
		scanf("%d %d", &x, &y);
		uf.unite(x - 1, y - 1);
	}
	
	int ans = 0;
	int pos[112345] = {};
	REP(i, N) pos[p[i] - 1] = i;
	REP(i, N) if (uf[i] == uf[pos[i]]) ans++;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1920
package main

import (
	"fmt"
)

func main() {
	var a, b, k int
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&k)

	fromA := min(a, k)
	a = a - fromA
	k = k - fromA
	fromB := min(b, k)
	b = b - fromB
	fmt.Printf("%d %d\n", a, b)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
using namespace std;
#define INF (1 << 29)

	int N, M, R;
	int d[201][201] = {};
	int r[9];
	int A, B, C;
	int res;
	bool used[9];

void dfs(int c, int las, int dist)
{
	if (c == R + 1)
	{
 		if (res > dist) {
 			res = dist;
 		}
 		return;
 	}
 	for (int i = 1; i <= R; i++) {
		if (!used[i]) {
			used[i] = true;
			if (las == -1) {
				dfs(c + 1, i, 0);
			}
			else {
				dfs(c + 1, i, dist + d[r[las]][r[i]]);
			}
			used[i] = false;
		}
	}
}
int main()
{
	cin >> N >> M >> R;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			if (i != j) {
				d[i][j] = INF;
			}
		}
	}
	for (int i = 1; i <= R; i++) {
		cin >> r[i];
	}
	for (int i = 1; i <= M; i++) {
		cin >> A >> B >> C;

		if (d[A][B] > C) {
			d[A][B] = d[B][A] = C;
		}
	}
	for (int k = 1; k <= N; k++) {
		for (int i = 1; i <= N; i++) {
			for (int j = 1; j <= N; j++) {
				if (d[i][j] > d[i][k] + d[k][j]) {
					d[i][j] = d[i][k] + d[k][j];
				}
			}
		}
	}

	res = INF;
	dfs(1, -1, 0);
	cout << res << endl;
}

Measured memory_bytes: 512
rows = int(input())
x = [input() for i in range(rows)]
print("AC x"+ " " + str(x.count("AC")))
print("WA x"+ " " +  str(x.count("WA")))
print("TLE x"+ " " +  str(x.count("TLE")))
print("RE x"+ " " +  str(x.count("RE")))

Measured memory_bytes: 16300
#include<iostream>
using namespace std;
     
int main() {
    string s;
    cin >> s;
    if (s.c_str()[2] == s.c_str()[3] && s.c_str()[4] == s.c_str()[5]) {
        cout << "Yes";
    } else {
        cout << "No";
    }
}

Measured memory_bytes: 256
#include<iostream>
 using namespace std;
 
 int main()
 {
    int n,a,b;
    while(cin>>n>>a>>b)
    {
    	int dis=(b-a);
    	if(dis%2==1) cout<<"Borys"<<endl;
    	else cout<<"Alice"<<endl;
	}
 	return 0;
 }

Measured memory_bytes: 256
n,w=map(int,input().split())
A=[list(map(int,input().split())) for i in range(n)]

dp=[float("inf")]*(10**5+1)
dp[0]=0
for i in range(n):
  for j in range(10**5,A[i][1]-1,-1):
    dp[j]=min(dp[j],dp[j-A[i][1]]+A[i][0])
ans=0
for v,e in enumerate(dp):
  if e<=w:
    ans=v
print(ans)

Measured memory_bytes: 93132
#include <iostream>
#include <vector>

using namespace std;

int main(){
	vector<int> v;
	int n; cin >> n;
	cout << n << ":";
	for(int i = 2; i*i <= n; i++){
		while(n % i == 0){
			v.push_back(i);
			n /= i;
		}
	}
	if(n != 1) v.push_back(n);
	for(auto x: v) cout << " "<<  x;
	cout << endl;
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<double> A(N);
  double sum_A = 0;
  
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  
  sort(A.begin(),A.end());
  
  sum_A += (A.at(0) + A.at(1))/2;
  
  for(int i=2;i<N;i++){
    sum_A = (sum_A + A.at(i))/2;
  }
  
  cout << sum_A << endl;
  
  return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()

m = S[1:].count("E")
a = [m]

for i in range(N- 1):
  if(S[i] == "E" and S[i+ 1] == "E"):
    m-= 1
    a.append(m)
  if(S[i] == "W" and S[i+ 1] == "W"):
    m+= 1
    a.append(m)
    
print(min(a))

Measured memory_bytes: 15564
import sys
from sys import stdin,stdout
import math
import random
import heapq
from collections import Counter
from functools import lru_cache
#@lru_cache(maxsize=None) #for optimizing the execution time of callable objects/functions(placed above callable functions)
try:
    m=(10**9+7)
    for _ in range(1):
        n=int(input())
        if n==1:
            print(0)
        elif n==2:
            print(2)
        else:
            print((((pow(10,n,m)-(2*pow(9,n,m)))%m)+pow(8,n,m))%m)
            
            


    
except EOFError as e:
    print(e)


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

vector<string> split(string s, char delim){
  int startIdx=0;
  int len = 0;
  vector<string> ret;
  for (int i = 0; i < (int)s.size(); i++) {
    if(s[i]==delim){
      if (len != 0) ret.push_back(s.substr(startIdx, len));
      startIdx=i+1;
      len=0;
    }
    len++;
  }
  if (len!=0) ret.push_back(s.substr(startIdx, len));
  return ret;
}

int main() {
  long long A;
  string B;
  cin >> A >> B;

  long long llB = (long long)stoi(split(B,'.')[0]+split(B,'.')[1]);
  
  cout << A*llB/100LL << endl;

  return 0;
}


Measured memory_bytes: 3640
n = int(input())
lis = list(map(int,input().split()))
lis.sort(reverse=True)
a = lis[:n//2+n%2]
b = lis[n//2+n%2:]
ans = sum(a)-min(a)
if n % 2 == 0:
    ans += sum(a)-max(a)
    ans += min(a)
else:
    ans += sum(a)-max(a)
print(ans)

Measured memory_bytes: 31436
N,M,C = map(int, input().split())
B = list(map(int,input().split()))
cnt = 0
for i in range(N):
    A = list(map(int,input().split()))
    ans = 0
    for j in range(M):
        ans += A[j]*B[j]
    ans += C
    if ans > 0:
        cnt += 1
print(cnt)        

Measured memory_bytes: 38256
#include<iostream>

int main(void){
	std::string s;
	std::cin >> s;
	int count = 0;
	if(s.size() % 2 == 0){
		for(int i = 0; i < s.size() / 2; i++)
			if(s[i] - s[s.size() - 1 - i] != 0) count++;
	}else{
		for(int i = 0; i < s.size() / 2; i++){
			if(i == (s.size() - 1) / 2)continue;
			if(s[i] - s[s.size() - 1 - i] != 0) count++;
		}
	}
	std::cout << count << std::endl;
}


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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define sz(x) (int)(x.size())
#define bit(n, k) (((n) >> (k)) & 1)

using namespace std;

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

const int maxn = 1e5 + 10, mod = 1e9 + 7, inf = 1e9 + 10;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie();
	char alpha;
	cin >> alpha;
	cout << (alpha < 'a' ? 'A' : 'a') << endl;
	return 0;
}


Measured memory_bytes: 3644
<?php
$arr=[];

function solve($S) {
        global $arr;

        if(is_numeric($S))return [$S=>true];
        if($S[0]==='$'&&is_numeric(substr($S, 1)))return $arr[substr($S,1)];
        for($i = 0; $i < strlen($S); $i++) {
                if($S[$i] === '(') {
                        $count = 1;
                        for($j = $i+1; $j < strlen($S); $j++){
                                if($S[$j] === '(')$count++;
                                if($S[$j] === ')')$count--;
                                if($count===0){
                                        $arr[]=solve(substr($S, $i + 1 , $j - $i - 1));
                                        $S = substr_replace($S, '$'.(sizeof($arr)-1), $i, $j - $i+1);
                                        break;
                                }
                        }
                }
        }
        $f = false;
        $ans=[];
        for($i = 0; $i < strlen($S); $i++){
                if($S[$i] === '+' || $S[$i] === '-' || $S[$i] === '*' || $S[$i] === '/') {
                        $f = true;
                        $right = solve(substr($S, $i+1, strlen($S) - $i));
                        $left = solve(substr($S, 0, $i));
                        foreach($left as $lk => $lv){
                                foreach($right as $rk => $rv){
                                        if($S[$i]==='+'){
                                                $ans[$lk+$rk]=true;
                                        }
                                        if($S[$i]==='-'){
                                                $ans[$lk-$rk]=true;
                                        }
                                        if($S[$i]==='*'){
                                                $ans[$lk*$rk]=true;
                                        }
                                        if($S[$i]==='/'&& $rk != 0){
                                                $ans[(int)($lk*1.0/$rk)]=true;
                                        }
                                }
                        }
                }
        }
        if(!$f)return solve($S);
        return $ans;
}


while(true){
        $S = trim(fgets(STDIN));
        if($S === "#") break;
        echo count(solve($S)).PHP_EOL;
}

Measured memory_bytes: 15696
#include<bits/stdc++.h>
const long long INF = INT_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, cnt = 0, w, h;
string s;
vector<ll> v;
vector < pair<ll, ll > > vp;
vector<vector<ll> > vv(50, vector<ll>(50, INF));
vector<string> vs;
vector<char> vc;
set<ll> st;
map<char, ll> mp;

/*--------------------template--------------------*/

int main()
{
	REP1(i,10)
	{
		REP1(j,10)
		{
			cout << i << 'x' << j << '=' << i*j << endl;
		}
	}
}

Measured memory_bytes: 2992
#include<bits/stdc++.h>
using namespace std;
double n,k,pro,point,sum;
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		pro=1.0/n;
		point=i;
		while(point<k)
		{
			point*=2;
			pro/=2;
		}
		sum+=pro;
	}
	printf("%.15f\n",sum);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<N;i++)
using namespace std;
long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;

vector<vector<int>>node(100010);//

bool reached[100010][3]={};
long long ans=INF;
int s,t;

queue<int>nex;//次に探索するnode
queue<int>nowc;//現在のcount

//幅優先探索で最短経路を求める
void ken()
{
    
    while(!nex.empty())
    {
        

        int now=nex.front();nex.pop();
        int cnt=nowc.front();nowc.pop();
        int step=cnt%3;
        if(reached[now][step])continue;
        reached[now][step]=true;
        
        if(reached[t][0]){
                ans=cnt/3;
                return;
        }
        rep(i,node[now].size())
        {
            if(reached[node[now][i]][(cnt+1)%3])continue;

            nex.push(node[now][i]);
            nowc.push(cnt+1);
        }
    }


    return;
}
int main(){

long long N,M;
cin>>N>>M;

rep(i,M){
    int u,v;
    cin>>u>>v;
    node[u].push_back(v);
}

cin>>s>>t;
nex.push(s);
nowc.push(0);

ken();

if(reached[t][0]){
    cout<<ans<<endl;
}
else{
    cout<<"-1"<<endl;
}


 return 0;
}
/*
4 4
1 2
2 3
3 4
4 1
1 3

2

3 3
1 2
2 3
3 1
1 2

-1

2 0
1 2

-1


6 8
1 2
2 3
3 4
4 5
5 1
1 4
1 5
4 6
1 6

2

*/


Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
#define IL inline
IL int read() {
	char ch = getchar(); int u = 0, f = 1;
	while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
	while (isdigit(ch)) { u = (u << 1) + (u << 3) + ch - 48; ch = getchar(); }
	return u * f;
}
typedef long long ll;
const int maxn = 1e5 + 10;
char s[maxn];
int main() {
	scanf("%s", s);
	int n = strlen(s);
	int nowp = 0, nowg = 0, ans = 0;
	for (int i = 0; i < n; ++i) {
		int t = (s[i] == 'p');
		if (t) { // dui mian shi p
			if (nowp < nowg) nowp++;
			else ans--, nowg++;
		}
		else { // p must not greater then g
			if (nowp < nowg) nowp++, ans++; 
			else nowg++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void){
    unsigned long long int a[100001] = {0},b[100001],c[100001];
    unsigned long long int buf;
    unsigned long long int n,q;
    unsigned long long int sum = 0;
    
    scanf("%llu",&n);
    for(int i= 0;i < n;i++){
        scanf("%llu",&buf);
        a[buf] ++;
        sum += buf;
    }
    
    scanf("%llu",&q);
    for(int i = 0;i<q;i ++)scanf("%llu %llu",&b[i],&c[i]);

    for(int j = 0;j<q;j++){
        sum = sum + a[b[j]] * (c[j] - b[j]);

        a[c[j]] += a[b[j]];
        a[b[j]] = 0;

        printf("%llu\n",sum);
    }
    return 0;
}

Measured memory_bytes: 4076
while True:
    s = input().split()
    m = int(s[0])
    f = int(s[1])
    r = int(s[2])
    
    if m==-1 and f==-1 and r==-1:
        break
    
    sum = m+f
    if m==-1 or f ==-1:
        print("F")
    elif sum>=80:
        print("A")
    elif sum>=65 and sum<80:
        print("B")
    elif sum>=50 and sum<65:
        print("C")
    elif sum>=30 and sum<50 and r>=50:
        print("C")
    elif sum>=30 and sum<50:
        print("D")
    elif sum<30:
        print("F")
    


Measured memory_bytes: 5596
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int n, m, c, b[1000], a[1000][1000];
    int sum[1000], ans=0;
    
    scanf("%d%d%d", &n, &m, &c);
    rep(i, m){
        scanf("%d", &b[i]);
    }
    
    rep(i, n){
        rep(j, m){
            scanf("%d", &a[i][j]);
            sum[i]+=a[i][j]*b[j];
        }
    }
    
    rep(i, n){
        if (sum[i]+c>0) {
            ans++;
        }
    }
    
    printf("%d", ans);
    
    return 0;
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll n;cin>>n;
    vvl f(n,vl(10)),p(n,vl(11));
    rep(i,n)rep(j,10)cin>>f[i][j];
    rep(i,n)rep(j,11)cin>>p[i][j];

    ll res = -L_INF;
    //一つ以上選ぶのでiは１から
    for(int i=1;i<(1<<10);i++){
        ll ans = 0;
        //nの店
        rep(j,n){
            ll cnt = 0;
            rep(k,10){
                 if(i & (1<<k)) if(f[j][k])cnt++;
            }
            ans += p[j][cnt];
        }
        res = max(res,ans);
    }
    out(res);
}


Measured memory_bytes: 256
/*BINH :))*/
#include<bits/stdc++.h>
#include <iostream>
#include <queue>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long llu;
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define f  first
#define s  second
#define mp make_pair
#define pb push_back
#define ep emplace_back
#define sz(a) (int) a.size()
#define FOR(cc,a,b) for (int cc=a,x,y,z;cc<=b;cc++)
#define FOD(x,a,b) for (int x=a;x>=b;x--)
#define REP(x,a,b) for (int x=a;x<b;x++)
#define RED(x,a,b) for (int x=a;x>b;x--)
#define EL cout<<endl
#define maxn 1005
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#pragma GCC optimize("Ofast")
int n,m,k,kc,xa;
int a[100000],f[100000],b[100000],c[100000];
int main(){
    IO
    cin>>n;
    FOR(i,1,n){
        cin>>x>>y>>z;
        a[i] = x + max(b[i-1],c[i-1]);
        b[i] = y + max(a[i-1],c[i-1]);
        c[i] = z + max(b[i-1],a[i-1]);

    }
    cout<<max(a[n],max(b[n],c[n]));
}
    

Measured memory_bytes: 1536
#include<stdio.h>
#include<string.h>

int main()
{
    char a[12];
    scanf("%s",a);
    int l=strlen(a);
    int c=0,k=0,n=0;
    if(a[0]=='A')
    {
        c++;
    }
    for(int i=2;i<l-1;i++)
    {
        if(a[i]=='C')
        {
            k++;
        }
    }
    if(k>0)
    {
        c++;
    }
    for(int i=0;i<l;i++)
    {
        if(a[i]>='A' && a[i]<='Z')
        {
            n++;
        }
    }
    if(n==2)
    {
        c++;
    }
    if(c==3)
    {
        printf("AC\n");
    }
    else
    {
        printf("WA\n");

    }

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
#define pb push_back
using pii = pair<int, pair<int,int>>;
#define fi first
#define se second
int n, m, k;
int main() {
    string s1, s2;
    while (cin >> s1 >> s2) {
        bool ok = true;
        for (int i = 0; i < 3; i++) {
            ok &= s1[i] == s2[2 - i];
        }
        puts(ok ? "YES" : "NO");
    }

    return 0;
}


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

#ifdef loc
    #include "loc_debug.h"
#else
    #define pr(...)
    #define pra(a,n)
    #define praa(a,n,m)
    #define prl()
#endif

typedef long long ll;
typedef long double ld;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i, s, n)  for(int i = s; i <= n; ++i)
#define rev(i, n, s)  for(int i = n; i >= s; --i)
#define fore(x, a) for(auto &&x : a)
#define fill(a, x) memset((a), (x), sizeof(a))
#define tcase int __t; cin >> __t; rep(tc, 1, __t)
#define F first
#define S second
#define gc getchar

const int mod = 1000000007;
#define _ %mod
const int N = 100005;



int main() {
    fast_io;
    int n, a, b;
    cin >> n >> a >> b;
    if((b - a) & 1) {
        cout << "Borys";
    } else {
        cout << "Alice";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
package main

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

func evenChecker(checker []int) bool {
	nums := len(checker)
	flag := true
	for i := 0; i < nums; i++ {
		if checker[i]%2 != 0 {
			flag = false
		}
	}
	return flag
}

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	nextLine()
	inputs := strings.Split(nextLine(), " ")
	var nums []int
	for i := 0; i < len(inputs); i++ {
		num, _ := strconv.Atoi(inputs[i])
		nums = append(nums, num)
	}
	count := 0
	for evenChecker(nums) {
		count++
		for i := 0; i < len(nums); i++ {
			nums[i] = nums[i] / 2
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 640
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#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>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

int main() {

    LL N, C, K;
    cin >> N >> C >> K;

    vector<LL> T(N);
    for (int i = 0; i < N; i++)cin >> T[i];
    sort(T.begin(), T.end());

    LL ans = 1;
    LL time = T[0];
    LL count = 1;

    for (int i = 1; i < N; i++) {
        if (count == C || time + K < T[i]) {
            count = 1;
            time = T[i];
            ans++;
        } else {
            count++;
        }
    }

    cout << ans << endl;

}




























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

int main(){
    int w,h,r,x,y;
    cin >> w >> h >> x >> y >> r;
    if(x>=r && y>=r && (w-x)>=r && (h-y)>=r)
        cout <<"Yes\n";
    else
        cout <<"No\n";
    return 0;
}


Measured memory_bytes: 3104