akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <cassert>
#include <sstream>
#include <bitset>
#include <numeric>
#include <climits>
#include <string>
#include <cctype>
#include <ctime>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <list>
#include <map>
#include <set>

#define mm(a, b) memset(a, b, sizeof(a))
#define mp make_pair
#define pb push_back

using namespace std;

const int maxn = 111;
const int maxm = 111;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;

int n, m;

void solve(){}

struct Y{
    int base, tim;
    char name[100];

    void load(){
        scanf("%s%d%d", name, &base, &tim);
    }

    int at(int x){
        if (x > tim) return -1;
        if (x <= tim - base) return -1;
        return x - (tim - base);
    }
}year[1111];

int main(){
    while (1){
        scanf("%d%d", &n, &m);
        if(n == 0 && m == 0) return 0;
        for (int i = 1; i <= n; ++i){
            year[i].load();
        }
        for (int i = 1; i <= m; ++i){
            int a;
            scanf("%d", &a);
            bool flag = 0;
            int t;
            for (int j = 1; j <= n; ++j)
                if ((t = year[j].at(a)) != -1){
                    printf("%s %d\n", year[j].name, t);
                    flag = 1;
                    break;
                }
            if (!flag)
                printf("Unknown\n");
        }
    }
}

Measured memory_bytes: 1308
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <stack>

using namespace std;

#define INFint (1<<30)
#define BOUND 27182818284
#define MAT 2

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

ll MOD = 1000000007;
const ll INF = (1ll<<60);
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i=int(a);i<int(b);++i)

template<class T>
bool umax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(vector<int> arr) {
    int result = arr[0];
    for (auto a: arr) {
        result = gcd(a, result);
    }
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
int main() {
    int N; cin >> N;
    ll K; cin >> K;
    vector<ll>A(N), F(N);

    rep(i,N){
        cin >> A[i];
    }

    rep(i,N){
        cin >> F[i];
    }

    sort(A.begin(), A.end());
    sort(F.begin(), F.end(), greater<>());

    ll high=1200000000000, mid=0, low=-1;

    while (abs(high-low)>1){
        ll temp_K=0;
        mid = (high+low)/2;

        for(int i=0; i<N; i++){
            if(A[i]*F[i]>mid){
                temp_K+=(A[i] * F[i] - mid + F[i] - 1) / F[i];
            }
        }

        if(temp_K>K){
            low = mid;
        }else{
            high = mid;
        }
    }

    cout << high << endl;
    return 0;
}


Measured memory_bytes: 3456
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>

bool valid(std::string const& s, std::string const& t) {
  size_t k = 0;
  for (auto c: s) {
    if (t[k] == c) ++k;
  }
  return k == 3;
}

int main() {
  size_t n;
  scanf("%zu", &n);

  char buf[32768];
  scanf("%s", buf);
  std::string s = buf;

  int res = 0;
  for (char a = '0'; a <= '9'; ++a)
    for (char b = '0'; b <= '9'; ++b)
      for (char c = '0'; c <= '9'; ++c) {
        std::string t{a, b, c};
        if (valid(s, t)) ++res;
      }

  printf("%d\n", res);
}


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

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

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

int l[200010];
int r[200010];

int main(){
    int N,K,C; cin >> N >> K >> C;
    string s; cin >> s;
    vector<int> ind;
    for(int i=0;i<N;i++){
        if(s[i]=='o') ind.push_back(i+1);
    }
    int l[K+1];
    int r[K+1];
    int len=ind.size();
    l[0]=ind[0];
    int cur=0;
    for(int i=1;i<K;i++){
        while(ind[cur]<=l[i-1]+C){
            cur++;
        }
        l[i]=ind[cur];
    }
    r[K-1]=ind[len-1];
    cur=len-1;
    for(int i=K-2;i>=0;i--){
        while(r[i+1]<=ind[cur]+C) cur--;
        r[i]=ind[cur];
    }
    for(int i=0;i<K;i++){
        if(l[i]==r[i]){
            cout << l[i] << endl;
        }
    }
}

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

int main() {
  string S,T;
  int t = 0;
  cin >> S >> T;
  for (int i = 0;i<S.size();i++) {
    if (S.at(i) == T.at(i)) {
      t++;
    }
  }
  if (S.size()+1 == T.size() && t == S.size() ) {
    cout << "Yes" << endl;
  }
  else {cout << "No" << endl;}
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)
char tmp[200];

bool check(int x){
    bool flag = true;
    REP(i, x){
        if(tmp[0]!=tmp[i]) flag = false;
    }
    return flag;
}

int main(){
    string s;
    cin >> s;
    int N = s.size();
    int res = 200;
    for(int i=0;i<26;i++){
        REP(j, N) tmp[j] = s[j];
        char c = 97+i;
        for(int j=0;j<N;j++){
            for(int k=0;k<N;k++){
                if(s[min(k+j, N-1)]==c) tmp[k] = c;
            }
            if(check(N-j)){
                res = min(res, j);
                break;
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#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<iomanip>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define MOD 1000000007


int main() {
	int n, k, ans = 0;
	cin >> n >> k;
	vector<int> h(n);
	rep(i, n) cin >> h.at(i);
	sort(h.begin(), h.end());
	rep(i, n) {
		if (h.at(n - 1 - i) >= k) ans++;
		else break;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 640
# UnionFind
class UnionFind:

    def __init__(self, n):
        self.par =  [-1] * n
        self.rank = [0] * n
    
    def root(self,x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if x == y:
            return
        else:
            if self.rank[x] <self.rank[y]:
                self.par[y] += self.par[x] # 負+負でsize管理 
                self.par[x] = y
            else:
                self.par[x] += self.par[y]
                self.par[y] = x
                if self.rank[x] == self.rank[y]: # 負+負でsize管理 
                    self.rank[x] += 1
    
    def is_same(self, x, y):
        return self.root(x) == self.root(y)

    def size(self, x):
        return -self.par[self.root(x)]

N,M = map(int,input().split())
Tree = UnionFind(N)
for i in range(M):
    a,b = map(int,input().split())
    Tree.union(a-1,b-1)
c = 0
for i in range(N):
    if Tree.par[i] < 0:
        c += 1
print(c-1)

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

#define sc(x) scanf("%d",&x);
#define sc2(x,y) scanf("%d%d",&x,&y);
#define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z);
#define scl(x) scanf("%lld",&x);
#define scl2(x,y) scanf("%lld%lld",&x,&y);
#define scl3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z);

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

#define M 1000000007
#define inf 99999999999999999LL	//long long inf

#define debug(x) cerr<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define debug4(x,y,z,a) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#a<<" :: "<<a<<"\n";

#define LIM 100020

int n ,a[1003];

int main()
{
	int i,j,t;
	sc(n) ;
	int answer = 0 ;
	for(i=1;i<=n;i++)
	{
		sc(a[i]) ;
		if( a[i]==a[i-1])
		{
			debug(i);
			a[i] = 32442 ;
			answer++;
		}
	}	
	cout<<answer<<endl;


	return 0;
}

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

using namespace std;

#define REP(var, n)  for (decltype(n) var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<decltype(var)>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define all(c) begin(c),end(c)

template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

bool valid(int v) {
    bool prev_on = false;
    while (v > 0) {
        if (v % 2 == 1) {
            if (prev_on) return false;
            prev_on = true;
        } else {
            prev_on = false;
        }
        v >>= 1;
    }
    return true;
}

vector<bool> decompose(int v, int w) {
    vector<bool> dec(w);
    REP(i, w) {
        dec[w-i-1] = v % 2;
        v >>= 1;
    }
    return dec;
}

auto solve() {
    int H, W, K;
    cin >> H >> W >> K;

    auto dp = vector<vll>(H + 1, vll(W, 0));
    dp[0][0] = 1;

    const int MOD = 1000000007;

    REP(r, H) {
        REP(v, pow(2, (W - 1))) {
            if (valid(v)) {
                vector<bool> d = decompose(v, W-1);
                REP(c, W) {
                    if (c != 0 && d[c - 1])
                        dp[r + 1][c - 1] = (dp[r + 1][c - 1] + dp[r][c]) % MOD;
                    else if (c != W - 1 && d[c])
                        dp[r + 1][c + 1] = (dp[r + 1][c + 1] + dp[r][c]) % MOD;
                    else
                        dp[r + 1][c] = (dp[r + 1][c] + dp[r][c]) % MOD;
                }
            }
        }
    }

    return dp[H][K - 1];
}

int main() {
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 256
N, M=map(int, input().split())
a=list(map(int, input().split()))
a.sort()

card=[]

for i in range(M):
    b, c=map(int, input().split())
    card.append((c, b))

card.sort(reverse=True)
k=0
for c, b in card:
    while k < N and b > 0:
        if a[k]<c:
            a[k]=c
            b-=1
        k+=1

print(sum(a))

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

typedef long long ll;

ll gcd(ll a, ll b){
	if(b==0)return a;
	else return gcd(b, a%b);
}

ll lcm(ll a, ll b){
	ll g = gcd(a, b);
	return a/g*b;
}

int main(){
	ll N;
	cin>>N;
	ll ans=1;
	for(int i=0;i<N;i++){
		ll t;
		cin>>t;
		ans=lcm(ans, t);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
n,k = [int(i) for i in input().split()]

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)


m = Base_10_to_n(n,k)


print(len(m))


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

int main()
{
    int N, Q;
    cin >> N >> Q;

    string S;
    cin >> S;

    int count[N + 1] = {};
    for (int i = 2; i <= N; i++)
    {
        if (S[i - 2] == 'A' && S[i - 1] == 'C')
        {
            count[i] = count[i - 1] + 1;
        }
        else
        {
            count[i] = count[i - 1];
        }
    }

    int l, r;
    int ans;
    for (int i = 0; i < Q; i++)
    {
        cin >> l >> r;
        ans = count[r] - count[l - 1];
        if (S[l - 2] == 'A' && S[l - 1] == 'C')
        {
            ans--;
        }
        cout << ans << endl;
    }
    // for (int i = 0; i < N + 1; i++)
    // {
    //     cout << count[i] << " ";
    // }
    // cout << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
using namespace std;

#define ll long long int

const int MOD = 1000000007;

int main() {

	string A, B;
	int a, b;
	
	cin >> A >> B;

	if (A.size() > B.size()) {

		cout << "GREATER" << endl;

	}
	else if (A.size() < B.size()) {

		cout << "LESS" << endl;

	}
	else {

		for (int i = 0; i < A.size(); i++) {

			if (A[i] != B[i]) {

				if (A[i] == '0')a = 0;
				if (A[i] == '1')a = 1;
				if (A[i] == '2')a = 2;
				if (A[i] == '3')a = 3;
				if (A[i] == '4')a = 4;
				if (A[i] == '5')a = 5;
				if (A[i] == '6')a = 6;
				if (A[i] == '7')a = 7;
				if (A[i] == '8')a = 8;
				if (A[i] == '9')a = 9;
				if (B[i] == '0')b = 0;
				if (B[i] == '1')b = 1;
				if (B[i] == '2')b = 2;
				if (B[i] == '3')b = 3;
				if (B[i] == '4')b = 4;
				if (B[i] == '5')b = 5;
				if (B[i] == '6')b = 6;
				if (B[i] == '7')b = 7;
				if (B[i] == '8')b = 8;
				if (B[i] == '9')b = 9;
				if (a > b) {

					cout << "GREATER" << endl;
					goto qwe;

				}
				else {

					cout << "LESS" << endl;
					goto qwe;

				}

			}

		}

		cout << "EQUAL" << endl;

	}

	qwe:

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>

using std::string;

int main(void)
{
    std::map<string, int> coin;
    int n, m;
    std::cin >> n;
    for (int i = 0; i < n; ++i)
    {
        std::string str;
        std::cin >> str;
        auto it = coin.find(str);
        if (it == coin.end())
        {
            coin[str] = 0;
            it = coin.find(str);
        }
        ++(it->second);
    }
    std::cin >> m;
    for (int i = 0; i < m; ++i)
    {
        std::string str;
        std::cin >> str;
        auto it = coin.find(str);
        if (it == coin.end())
        {
            coin[str] = 0;
            it = coin.find(str);
        }
        --(it->second);
    }
    int ret = 0;
    for (const auto& it : coin)
    {
        ret = std::max<int>(ret, it.second);
    }
    std::cout << ret << std::endl;
    return 0;
}


Measured memory_bytes: 504
#include <stdio.h>
#define N 52

int main(void) {
    int h, w;
    char s[N][N] = {{0}};

    scanf("%d %d", &h, &w);

    for (int i = 1; i <= h; i++) {
        scanf("%s", s[i] + 1);
    }

    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            if (s[i][j] == '#') {
                printf("#");
            } else {
                int nbd_no = 0;

                for (int k = -1; k <= 1; k++) {
                    for (int l = -1; l <= 1; l++) {
                        if (s[i+k][j+l] == '#') {
                            nbd_no++;
                        }
                    }
                }

                printf("%d", nbd_no);
            }
        }
        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 128
import sys

def solve(f, i, j):
    if 0<=i<12 and 0<=j<12 and f[j][i] == 1:
        f[j][i] = 0
        for dx, dy in [[0,1],[0,-1],[1,0],[-1,0]]: solve(f, i+dx, j+dy)

while True:
    field = [[int(c) for c in sys.stdin.readline().strip()] for _ in range(12)]
    ans = 0
    for i in range(12):
        for j in range(12):
            if field[j][i] == 1:
                solve(field,i,j)
                ans += 1
    print(ans)
    if not sys.stdin.readline(): break

Measured memory_bytes: 7716
import bisect
n = int(input())
list1 = [list(map(int,input().split())) for i in range(3) ]

for i in range(3):
	list1[i].sort()

count = 0

for i in range(n):
	a = bisect.bisect_left(list1[0],list1[1][i])
	c = bisect.bisect_right(list1[2],list1[1][i])
	count += a*(n-c)
print(count)

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

using namespace std;

int main(){
    int N, L;
    cin >> N >> L;
    vector<string> S(N);
    string ans;
    for(int i=0; i < N; i++){
        cin >> S[i];
    }

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

    for(int i=0; i < N; i++){
        ans += S[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define fo(i,v,e) for(v=i;v<e;v++)
#define rfo(i,v,e) for(v=i;v>e;v--)
#define pb(x) push_back(x)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fi first 
#define se second
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vl vector<ll>
#define sz(x) (int)x.size()
#define ull unsigned long long
#define vvi vector<vi>
#define vvl vector<vl>
#define vpi vector<pii>
#define vpl vector<pll>
ll mod = 1000000007;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define openfile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x);
#define fastio
#else
#define openfile
#define deb(x...)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#endif
void init()
{
    
}
void solve()
{
    ll n,i,j,ans = 0;cin>>n;
    fo(0,i,n)
    {
        cin>>j;
        ans+=(j%2 and i%2==0);
    }
    cout<<ans<<endl;
}
int main()
{
    init();
    // openfile;fastio;
    int T = 1;
    // cin>>T;
    while(T--)
    {
        solve();
    }
}

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

int main() {
    int N , ok = 0;
    cin >> N;
    vector <ll> A(N);
    for(int i = 0; i < N; i++){
        cin >> A[i];
        if(A[i] == 0){
            ok++;
        }
    }
    if(ok != 0){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1;
    for(int i = 0; i < N; i++){
        if(A[i] <= 1000000000000000000 / ans){
            ans *= A[i];
        }
        else{
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4048
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define mod 1000000007
 
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
 
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main(){
	ll n, k;
	cin >> n >> k;
	ll h[n];
	for (ll i = 0; i < n; i++) cin >> h[i];

	ll ans = 0;
	for (ll i = 0; i < n; i++){
		if (h[i] >= k) ans++;
	}
	cout << ans << endl;
	return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, n, 0)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1e9 + 7

using namespace std;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main(void)
{
    string s;
    cin >> s;
    cout << count(all(s), '+') - count(all(s), '-') << endl;
    return 0;
}

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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
// typedef vector<pll> vp;
typedef vector<ll> vll;

typedef complex<int> P;
typedef vector<P> vp;

int cross(P p1, P p2) {
    return p1.real() * p2.imag() - p1.imag() * p2.real();
}

vi setDist(vp points) {
    vi ret;
    rep(i, points.size() - 1) {
        ret.emplace_back(abs(points[i + 1] - points[i]));
    }
    return ret;
}

vi setClock(vp points) {
    vi ret;
    rep(i, points.size() - 2) {
        ret.emplace_back((cross(points[i + 1] - points[i], points[i + 2] - points[i + 1]) > 0) ? 1 : -1);
    }
    return ret;
}

bool same(vi a, vi b) {
    rep(i, a.size()) {
        if (a[i] != b[i]) return false;
    }
    return true;
}

bool check(vi a, vi a0, vi b, vi b0) {
    if (same(a, a0) && same(b, b0)) return true;
    reverse(all(a));
    reverse(all(b));
    rep(i, b.size()) b[i] = -b[i];  //?????????????????¨?????¢?????????????????????
    if (same(a, a0) && same(b, b0)) return true;
    return false;
}

vp in(int size) {
    vp ret;
    rep(i, size) {
        int x, y;
        cin >> x >> y;
        ret.emplace_back(P(x, y));
    }
    return ret;
}

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

    int n;
    while (cin >> n && n) {
        int m0;
        cin >> m0;

        vp a0 = in(m0);
        vi L0 = setDist(a0);
        vi C0 = setClock(a0);
        rep(i, n) {
            int m;
            cin >> m;
            vp a = in(m);
            if (m != m0) continue;
            vi L = setDist(a);
            vi C = setClock(a);
            if (check(L, L0, C, C0)) {
                cout << i + 1 << endl;
            }
        }
        cout << "+++++" << endl;
    }
}

Measured memory_bytes: 3140
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------
struct SegmentTree {
public:
    int n;
    vi node;

    SegmentTree(vi v) {
        int sz = v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);
        REP(i,sz) node[i+n-1] = v[i];
        REPN(i,n-2) node[i] = max(node[2*i+1], node[2*i+2]);
    }
    void update(int k, int x){
        k += n-1;
        node[k] = x;
        while(k){
            k = (k-1)/2;
            node[k] = max(abs(node[2*k+1]),abs(node[2*k+2]));
        }
    }
    int getmax(int a, int b, int k=0, int l=0, int r=-1){
        if(r<0) r=n;
        if(r<=a || b<=l) return 0;
        if(a<=l && r<=b) return abs(node[k]);
        return max( getmax(a,b,2*k+1,l,(l+r)/2),getmax(a,b,2*k+2,(l+r)/2,r) );
    }

    int get(int k){ return node[k+n-1]; }
};

int n,a[100010];
map<int,int> zaatu;
signed main(){
    I(n);
    vi s(n+1);
    SegmentTree st(s);
    int zr = 1;
    REP(i,n) {
        I(a[i]);
        if(!zaatu[a[i]]) zaatu[a[i]] = zr++;
    }

    int r = n-1;
    bool init = true;
    REP(i,n){
        int vl = st.get(zaatu[a[i]]);
        st.update(zaatu[a[i]], vl + 1);
        int vr = st.get(zaatu[a[r-i]]);
        st.update(zaatu[a[r-i]], vr - 1);

        int cand = st.getmax(0,n);
        if(!cand){
            if(!init) printf(" ");
            init = false;
            printf("%lld", i+1);
        }
    }
    printf("\n");
}


Measured memory_bytes: 9572
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n;
  ans = 1;
  while (1) {
    if (ans * ans <= n)
      ans++;
    else {
      ans--;
      break;
    }
  }
  Cout(ans * ans);
  return 0;
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;
struct Edge{ll from, to, cost;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  string S;
  cin >> S;

  ll N=S.size();
  llvec ans(N, 0);
  ll last=-1e3;
  rep(i, N){
    if(S[i]=='L' and last >=0){
      if(abs(i-last)%2==0){
        ans[last]+=1;
      }else{
        ans[last-1]+=1;
      }
    }else if(S[i]=='L'){
      last = i;
      ans[i]+=1;
    }else{
      last = -1e3;
    }
  }
  last=-1e-3;
  rep(j, N){
    ll i = N - 1 - j;
    if(S[i]=='R' and last >=0){
      if(abs(i-last)%2==0){
        ans[last]+=1;
      }else{
        ans[last+1]+=1;
      }
    }else if(S[i]=='R'){
      last = i;
      ans[i]+=1;
    }else{
      last = -1e3;
    }
  }

  rep(i, N){
    cout << ans[i] << " ";
  }
  
  return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i,n) cin >> l[i];
  sort(all(l));
  ll ans = 0;
  rep(i, n) for (int j = i + 1; j < n; j++) {
    int k = lower_bound(all(l), l[i] + l[j]) - l.begin();
    ans += k - (j + 1);
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main()
{   
    int N;
    cin >> N;
    if(N/10 == 9 || N%10 == 9) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import scala.io.StdIn.readLine

object Main {
  def main(args:Array[String]) = {
    val s1 = readLine
    val s2 = readLine
    for(i<-0 to s1.length-s2.length)
      if(s1(i)==s2(0))
        if(s1.slice(i,i+s2.length)==s2)
          println(i)
  }
}

Measured memory_bytes: 43920
#include<stdio.h>
int main(void)
{
int a,b,c,i,j,x=0;
scanf("%d %d %d",&a,&b,&c);
for(i=a;i<=b;i++){
	if(c%i==0)
		x++;
	}
	printf("%d\n",x);
return 0;
}

Measured memory_bytes: 1852
use proconio::input;

fn main() {
    input! {
        n: i64,
        m: i64,
    }

    if n % 2 == 1 {
        for i in 0..m {
            let l = 1 + i;
            let r = n - 1 - i;
            println!("{} {}", l, r);
        }
    } else {
        for i in 0..m {
            let l = 1 + i;
            let r = n - 1 - i;
            let r = if r - l > n / 2 { r } else { r - 1 };
            println!("{} {}", l, r);
        }
    }
}


Measured memory_bytes: 2076
#include <iostream>
#include <queue>
#include <stack>
#include <vector>

using namespace std;

struct Vec2 {
  int x;
  int y;
};

int min_dist(vector<vector<char>> &m, Vec2 &msize, Vec2 src, Vec2 dest) {
  if (m[src.y][src.x] == '#' || m[dest.y][dest.x] == '#') {
    return -1;
  }

  vector<vector<bool>> visited(msize.y, vector<bool>(msize.x, false));
  queue<pair<Vec2, int>> q;
  q.push({{src.x, src.y}, 0});

  int dist = -1;
  while (!q.empty()) {
    auto front = q.front();
    auto pos = front.first;
    q.pop();
    if (pos.x == dest.x && pos.y == dest.y) {
      dist = front.second;
      break;
    }

    if (visited[pos.y][pos.x]) {
      continue;
    }
    visited[pos.y][pos.x] = true;

    // up, down, left, right
    if (pos.y > 0 && m[pos.y - 1][pos.x] == '.') {
      q.push({{pos.x, pos.y - 1}, front.second + 1});
    }
    if (pos.y < m.size() - 1 && m[pos.y + 1][pos.x] == '.') {
      q.push({{pos.x, pos.y + 1}, front.second + 1});
    }
    if (pos.x > 0 && m[pos.y][pos.x - 1] == '.') {
      q.push({{pos.x - 1, pos.y}, front.second + 1});
    }
    if (pos.x < m[0].size() - 1 && m[pos.y][pos.x + 1] == '.') {
      q.push({{pos.x + 1, pos.y}, front.second + 1});
    }
  }

  return dist;
}

int main(int argc, const char *argv[]) {
  int h, w;
  cin >> h >> w;

  vector<vector<char>> m(h, vector<char>(w));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> m[i][j];
    }
  }

  int ans = 0;
  Vec2 msize{w, h};
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      for (int k = 0; k < h; k++) {
        for (int l = 0; l < w; l++) {
          ans = max(ans, min_dist(m, msize, {j, i}, {l, k}));
        }
      }
    }
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;

int main(void) {
    Int n;
    cin >> n;
    VI p(n);
    for (Int i = 0; i < n; ++i) {
        cin >> p[i];
    }

    Int result = 0;
    Int min_left = LLONG_MAX;
    for (Int i = 0; i < n; ++i) {
        if (p[i] <= min_left) {
            ++result;
            min_left = p[i];
        }
    }
    cout << result << endl;
    return 0;
}



Measured memory_bytes: 4780
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

std::pair<int,int> vp[1001];

int main(void){
    
    int n;
    cin >> n;
    
    for(int i = 0; i < n; i++){
        cin >> vp[i].first >> vp[i].second;
    }
    
    sort(vp,vp+n);
    
    int answer = 0;
    int right = 0;
    
    for(int i = 0; i < n; i++){
        if(vp[i].first >= right){
            answer += vp[i].second - vp[i].first + 1;
        }else{
            answer += vp[i].second - right + 1;
        }
        right = vp[i].second;
    }
    
    cout << answer << endl;
    
}


Measured memory_bytes: 256
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    if input() == '1':
        print('Hello World')
    else:
        a = int(input())
        b = int(input())
        print(a+b)
if __name__ == '__main__':
  main()


Measured memory_bytes: 2940
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

double acot(double x) {
	return PI / 2 - atan(x);
}

map< int64_t, int > prime_factor(int64_t n) {//素因数分解
	map< int64_t, int > ret;
	for (int64_t i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}


/*-----------------------------------------ここからコード-----------------------------------------*/

int main() {

	int n;
	scanf("%d", &n);
	map< int64_t, int > a = prime_factor(n);
	printf("%d:", n);
	for (auto aa : a) {
		rep(i, aa.second) {
			printf(" %d", aa.first);
		}
	}
    printf("\n");
	return 0;
}



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

int max = 1e6;
int max_sqrt = std::sqrt(1e6);
int mod = 1e9 + 7;

long long modinv(long long dividend, long long divisor, long long modnum){
    long long b = modnum, u = 1, v = 0;
    while (b) {
        long long t = divisor / b;
        divisor -= t * b; std::swap(divisor, b);
        u -= t * v; std::swap(u, v);
    }
    u %= modnum; 
    if (u < 0) u += modnum;
    long long ans = dividend * u % modnum;
    return ans;
}

int main(){
    int N;
    std::cin >> N;
    std::vector< int > A(N);
    for(int i=0; i<N; i++){
        std::cin >> A[i];
    }
    std::vector< int > A_copy;
    A_copy = A;
    
    std::vector< int > Pn;
    std::vector< bool > Pn_list(max_sqrt + 1, true);
    for(int i=2; i<max_sqrt + 1; i++){
        if(Pn_list[i]){
            Pn.push_back(i);
            for(int j=i+i; j<max_sqrt + 1; j+=i){
                Pn_list[j] = false;
            }
        }
    }
    
    std::map< int, int > Pn_cnt;
    for(int i=0; i<N; i++){
        for(int j=0; j<Pn.size(); j++){
            int cnt = 0;
            while(A_copy[i] % Pn[j] == 0){
                cnt++;
                A_copy[i] /= Pn[j];
            }
            if(cnt){
                auto itr = Pn_cnt.find(Pn[j]);
                if(itr != Pn_cnt.end()){
                    if(cnt > itr->second){
                        itr->second = cnt;
                    }
                }else{
                    Pn_cnt[Pn[j]] = cnt;
                }
            }
        }
        if(A_copy[i] != 1){
            Pn_cnt[A_copy[i]] = 1;
        }
    }
    
    long long target = 1;
    for(auto itr = Pn_cnt.begin(); itr != Pn_cnt.end(); ++itr) {
        while(itr->second){
            target = (target * itr->first) % mod;
            itr->second = itr->second - 1;
        }
    }
    
    long long ans = 0;
    for(int i=0; i<N; i++){
        long long tmp = modinv(target, A[i], mod);
        ans = (ans + tmp) % mod;
    }
    
    std::cout << ans << std::endl;
    
    return 0;
}



Measured memory_bytes: 768
#include<iostream>
#include<string.h>

int main()
{
	char str[1001];
	
	std::cin >> str;
	
	for( int i = 0; i < strlen( str ); i++ ){
		str[i] -= 3;
		
		if( str[i] < 'A' ) str[i] += 26;
	}

	std::cout << str << std::endl;

 	return 0;
}

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

int main() {
	int n; cin >> n;
	int flag = 0;
	for (int i = 0; i < n; i ++) {
		int t; cin >> t;
		if (t % 2) flag = 1; 
	}
	if (flag) cout << "first" << endl;
	else cout << "second" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch CanYouSolveThis | diff CanYouSolveThis.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address CanYouSolveThis.cpp && ./a.out

/*
 
 3/16/2019
 
 11:14-
 
 */

const int MAX_N=1e2+1;
LL A[MAX_N][MAX_N],B[MAX_N];
int N,M,C;

void solve() {
  int res=0;
  REP(i,N) {
    LL x=C;
    REP(j,M) x+=A[i][j]*B[j];
    if(x>0) ++res;
  }
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>M>>C;
  REP(i,M) cin>>B[i];
  REP(i,N)REP(j,M) cin>>A[i][j];
  solve();
  
  return 0;
}


Measured memory_bytes: 256
{
  const main = (input: string) => {
    const r = reader(input)
    const N = r.n()
    const A = r.ns()
    let a = 0
    let b = 0
    let c = 0
    let res = 1
    A.forEach(v => {
      const l = Number(a === v) + Number(b === v) + Number(c === v)
      if (a === v) {
        a++
      } else if (b === v) {
        b++
      } else if (c === v) {
        c++
      }
      res = (res * l) % 1000000007
    })
    console.log(res)
  }

  // const values = obj => Object.keys(obj).map(e => obj[e]);

  const reader = (str: string) => {
    const lines = str.trim().split('\n')
    const s = () => lines.shift() || ''
    const line = s
    const n = () => Number(s())

    const ss = () => s().split(' ')
    const ns = () => ss().map(Number)
    return { lines, line, s, n, ss, ns }
  }

  const getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')
  main(getInput())
}


Measured memory_bytes: 31740
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <tuple>

#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;

long long dp[101][4][4][4];

int main(){

	long long mod = 1000000007;

	int N;
	cin >> N;

	dp[0][3][3][3] = 1;
	for(int x = 0; x < N; x++){
		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 4; j++){
				for(int k = 0; k  < 4; k++){
					if(dp[x][i][j][k] == 0) continue;
					for(int a = 0; a < 4; a++){
						if(j == 0 && k == 1 && a == 2) continue;
						if(j == 1 && k == 0 && a == 2) continue;
						if(j == 0 && k == 2 && a == 1) continue;
						if(i == 0 && j == 1 && a == 2) continue;
						if(i == 0 && k == 1 && a == 2) continue;
						dp[x+1][j][k][a] += dp[x][i][j][k];
						dp[x+1][j][k][a] %= mod;
					}
				}
			}
		}
	}

	long long ans = 0;
	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 4; j++){
			for(int k = 0; k  < 4; k++){
				ans += dp[N][i][j][k];
				ans %= mod;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define CLR(array) memset( array, 0, sizeof array )
typedef long long int ll;
 
#define MAXN 100010
 
ll n,m;
ll A[MAXN];
 
ll gcd( ll a, ll b ){
	if( b == 0 )	return a;
	return gcd( b, a%b );
}
 
int main(){
	std::cin >> n >> m;
	for( int i = 1; i <= n; i++ )
		std::cin >> A[i];
 
	m *= 2;
 
	ll LCM = 1;
	int flag = 1;
	std::sort( A+1, A+1+n );
	for( int i = n; i >= 1; i-- ){
		LCM = LCM / gcd( LCM, A[i] );
		LCM *= A[i];
		if( LCM > m ){
			flag = 0;
			break;
		}
	}
 
	if( !flag ){
		printf("0\n");
		return 0;
	}
 
	flag = 1;
	for( int i = 1; i <= n; i++ ){
		if( ((LCM / A[i]) & 1) == 0 ){
			flag = 0;
			break;
		}
	}
 
	if( !flag ){
		printf("0\n");
		return 0;
	}
 
	printf("%lld\n", ((m/LCM)+1)/2 );
}

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

int wa(int x) {
  	int ret = 0;
  	while(1) {
      	if (x / 10 == 0) {
          	ret += x;
          	break;
        } else {
          	ret += (x % 10);
          	x /= 10;
        }
    }
  	return ret;
}

int main(){
  	cin.tie(0);
  	ios::sync_with_stdio(false);
	int n, a, b;
	cin >> n >> a >> b;
  	int ans = 0;
  	for (int i = 1; i <= n; i++) {
      	int y = wa(i);
      	if (a <= y && y <= b) {
          	ans += i;
        }
    }
  	cout << ans << endl;
  	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN];
int head,tail,n;

void enqueue(P x){
    Q[tail] = x;
    tail = (tail+1)%LEN;
}

P dequeue(){
    P x = Q[head];
    head = (head+1)%LEN;
    return x;
}

int min(int a,int b){
    return a<b?a:b;
}

int main(){
    int elaps = 0,c;
    int i,q;
    P u;
    scanf("%d %d",&n,&q);
    
    for(i = 1;i<=n;i++){
        scanf("%s",Q[i].name);
        scanf("%d",&Q[i].t);
    }
    head =1;tail =n+1;
    
    while(head!=tail){
        u =dequeue();
        c=min(q,u.t);
        u.t -=c;
        elaps +=c;
        if(u.t > 0) enqueue(u);
        else{
            printf("%s %d\n",u.name,elaps);
        }
    }
    return 0;
    
}


Measured memory_bytes: 11848
N = int(input())
T = list(map(int,input().split()))

M= int(input())
PX = [list(map(int,input().split())) for _ in range(M)]

S = sum(T)
for i in range(M):
    print(S - T[PX[i][0]-1] + PX[i][1])
    

Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 998244353;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {  
    ll a; string b; cin >> a >> b;
    ll num = (b[0]-'0')*100 + (b[2]-'0')*10 + (b[3]-'0');
    ll res = a * num / 100;
    cout << res << ln;
}




Measured memory_bytes: 3636