akhauriyash/Code-Regression huggingface dataset:
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

template <class T>
ostream &operator<<(ostream &os, const set<T> &st) {
	for (const auto &e : st) os << e << " ";
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
	for (const auto &e : mp) os << e << " ";
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T = lint>
struct Edge {
	int to;
	T cost;
	int tank;
	Edge() {}
	Edge(int to, T cost, int tank = 0) : to(to), cost(cost), tank(tank) {}
	bool operator>(const Edge &r) const { return this->cost > r.cost; }
};

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, M, L;
	cin >> N >> M >> L;

	vector<vector<Edge<int>>> edges(N);
	for (int i = 0; i < M; i++) {
		int u, v, len;
		cin >> u >> v >> len;
		u--, v--;
		if (len > L) continue;
		edges[u].emplace_back(v, len);
		edges[v].emplace_back(u, len);
	}

	auto dijkstra = [&](int st) {
		vector<pair<int, int>> dp(N, { INF, 0 });
		dp[st] = { 0, -L };
		using ppi = pair<pair<int, int>,int> ;
		priority_queue<ppi, vector<ppi>, greater<ppi>> que;
		que.emplace(dp[st], st);
		while (!que.empty()) {
			auto now = que.top();
			que.pop();

			if (now.first > dp[now.second]) continue;

			for (const auto &e : edges[now.second]) {

				auto tmp = now.first;
				if (e.cost > -tmp.second) {
					tmp.first++;
					tmp.second = -L + e.cost;
				}
				else tmp.second += e.cost;

				if (tmp < dp[e.to]) {
					dp[e.to] = tmp;
					que.emplace(tmp, e.to);
				}

			}
		}
		return dp;
	};

	vector<vector<pair<int, int>>> memo(N);
	for (int i = 0; i < N; i++) memo[i] = dijkstra(i);

	int Q;
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		int s, t;
		cin >> s >> t;
		s--, t--;
		auto tmp = memo[s][t].first;
		if (tmp != INF) cout << tmp << "\n";
		else cout << -1 << "\n";
	}

	return 0;
}

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

int main(){
  int R,C,K;
  cin>>R>>C>>K;
  vector<vector<int64_t>> p(R,vector<int64_t>(C));
  for(int i=0;i<K;i++){
    int a,b;
    int64_t c;
    cin>>a>>b>>c;
    a--,b--;
    p[a][b]=c;
  }
  vector<vector<vector<int64_t>>> dp(R,vector<vector<int64_t>>(C,vector<int64_t>(4)));
  dp[0][0][1]=p[0][0];
  for(int a=1;a<R+C-1;a++){
    for(int b=max(0,a-R+1);b<min(C,a+1);b++){
      int i=a-b,j=b;
      for(int k=0;k<4;k++){
        int64_t A=0;
        if(j!=0){
          A=dp[i][j-1][k];
          if(k!=0){
            A=max(A,dp[i][j-1][k-1]+p[i][j]);
          }
        }
        if(i!=0&&k<2){
          for(int l=0;l<4;l++){
            A=max(A,dp[i-1][j][l]+p[i][j]*k);
          }
        }
        dp[i][j][k]=A;
      }
    }
  }
  int64_t Z=0;
  for(int k=0;k<4;k++){
    Z=max(Z,dp[R-1][C-1][k]);
  }
  cout<<Z<<endl;
}

Measured memory_bytes: 706624
#include<stdio.h>
int main(void) {

	int N, K, X, Y;
	scanf("%d%d%d%d", &N, &K, &X, &Y);
	if(N<K){
		printf("%d\n", N*X);
	}
	else {
		printf("%d\n", K*X + (N - K)*Y);
	}



	return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> v;
    for (int i = 0; i < 10; i++) v.emplace_back(i * 111);
    cout << *lower_bound(begin(v), end(v), n) << endl;
    return 0;
}


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


int main() {
  int n;
  cin >>n;
  int a[n];
  int ans =0;
  int memo = 0;
  int x;
  fr(i,n){
    cin >>a[i];
  }
  sort(a, a+n);
  for(x=a[1];x>=0;x--){
    memo = 0;
    fr(j,n){
      if(a[j]%x!=0){
        memo+=1;
      }
    }
    if(memo <=1)break;
  }
  cout << x << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
vector<pi> G[MAX_N];
int ans[MAX_N];

void loop(int v, int p, int cur) {
	ans[v] = cur;
	rep(i, 0, sz(G[v])) {
		pi pp = G[v][i];
		int n = pp.fst;
		if(n == p) continue;
		loop(n, v, (cur + pp.sec) % 2);
	}
}


void solve() {
	cin >> N;
	rep(i, 0, N - 1) {
		int a, b, c; cin >> a  >> b >> c; a--; b--;
		G[a].pb(pi(b, c));
		G[b].pb(pi(a, c));
	}
	loop(0, -1, 0);
	rep(i, 0, N) cout << ans[i] << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 14592
def floor(a,b,x)
  ((a*x/b).to_i)- ((x/b).to_i * a).to_i
 end
 
 nums=gets.strip.split(" ").map do |i|
   i.to_i
 end
 a=nums[0]
 b=nums[1]
 n=nums[2]
 n_x=1
 max = 0
 x = n<b ? n : b-1
 
 puts floor(a,b,x)

Measured memory_bytes: 14256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>
#define MAX 200002

typedef long long ll;

ll max(ll a,ll b){
    if(a>b) return a;
    else return b;
}

ll min(ll a,ll b){
    if(a<b) return a;
    else return b;
}

/*qsort(array,num_of_index,sizeof(ll),compare_int); */
 ll compare_int(const void *a,const void *b){
     return *(ll*) a - *(ll *) b; 
 } 
 
ll b_search(ll* array,ll left,ll right,ll key){
    ll mid = left / 2 + right / 2;
     if( right - left == 1){
         if(array[mid]==key)
             return mid;
          else
               return -1;
     }
     if(array[mid]==key)
         return mid;
     else if(array[mid]>key)
         b_search(array,left,mid,key);
     else if(array[mid]<key)
         b_search(array,mid,right,key);
}

/*lower_bound(key以上のイテレータを返す)*/
 /*例えば,2,2,5,5,9でkey=2なら(2),2,5,5,9を返す*/
 ll lower_bound(ll  *array,ll left,ll right,ll key){
     if(right-left==1)
         return left;
     ll mid=(left+right)/2;
     if(array[mid]<=key)
         return lower_bound(array,mid,right,key);
     else
         return lower_bound(array,left,mid,key);
 }

ll main(){
    ll N,M,K;
    ll A[MAX],B[MAX];
    ll A_sum[MAX],B_sum[MAX];
    A_sum[0] = 0,B_sum[0] = 0;
    scanf("%lld %lld %lld",&N,&M,&K);

    for(ll i=1;i<=N;i++){
        scanf("%lld",A+i);
        A_sum[i] = A_sum[i-1] + A[i];
    }
    for(ll i=1;i<=M;i++){
        scanf("%lld",B+i);
        B_sum[i] = B_sum[i-1] + B[i];
    }
    ll ans = 0;
    for(ll i=0;i<=N && A_sum[i]<=K;i++){
       ans  = max(ans,i + (ll)lower_bound(B_sum,0,M+1,K - A_sum[i]));
    }
    printf("%lld",ans);
}


Measured memory_bytes: 7948
//解説AC

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;


const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

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, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()


int main(){
    int N,b1,b2,b4;
    b1=b2=b4=0;
    cin>>N;
    string ANS;
    rep(i,N){
        ll A;
        cin>>A;
        if(A%4==0)b4++;
        else if(A%2==0)b2++;
        else b1++;
    }
    if(b2==0){
        if(b1<=b4+1)ANS="Yes";
        else ANS="No";
    }else{
        if(b1<=b4)ANS="Yes";
        else ANS="No";
    }
    cout<<ANS<<endl;

    return 0;
}

//a=97,z=122

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

using namespace std;


int main() {
	int n;
	cin >> n;
	int y;
	cin >> y;
	for (int i = 0; i < n+1; i++) {
		for (int j = 0; j + i < n + 1; j++) {
			if (y - i * 10000 - j * 5000 == (n - j - i) * 1000) {
				cout << i << " " << j << " " << n - i - j;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1";
}

Measured memory_bytes: 256
from fractions import gcd
a, b, c, d = map(int, input().split())

def cnt_num(n, ok):
    cnt = 0
    # print(n, cnt)
    cnt += n // c
    # print(n, cnt)
    cnt += n // d
    # print(n, cnt)
    cnt -= n // ((c*d) // gcd(c, d))
    # print(n, cnt)
    if ((n % c == 0 or n % d == 0) or n % ((c*d) // gcd(c, d)) == 0) and ok:
        cnt -= 1
        
    return cnt

ans = cnt_num(b, False) - cnt_num(a, True)
# print(cnt_num(b, 0))
# print(cnt_num(a, 1))
ans = b - a - ans + 1
print(ans)

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

map<int, int> g;

int n, x;
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		g[x]++;
	}
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		g[x]--;
	}
	bool flag = true;
	for (pair<int, int> i: g) {
		if (i.second < 0) {
			flag = false;
			break;
		}
	}
	printf("%s\n", flag ? "YES" : "NO");
}

Measured memory_bytes: 9600
#include<stdio.h>
int main()
{
  long int W,H;
  if (scanf("%ld %ld",&H,&W) != 2)
    return (0);
  if (!(H >= 1 && H <= 1000000000) || !(W >= 1 && W <= 1000000000))
    return (0);
  if (H == 1 || W == 1)
  {
    printf("1");
    return (0);
  }
  if (H*W%2 == 0)
  {
    printf("%ld",H*W/2);
  }
  else
  {
    printf("%ld",(H*W/2) + 1);
  }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define fi first
#define se second
const int maxn=1e5+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
long double dp[maxn];
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
    int n,k;
    cin>>n>>k;
    int up=max(n,k);
    for(int i=up;i>=1;i--)
    {
        if(i>=k) dp[i]=1;
        else if(2*i>=k) dp[i]=0.5;
        else dp[i]=dp[i*2]/2; 
    }
    long double ans=0;
    for(int i=1;i<=n;i++) ans+=dp[i];
    ans/=n;
    cout<<fixed<<setprecision(12)<<ans<<'\n';
    return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define for0(n) for(i=0; i<(n); i++)
#define for1(n) for(i=1; i<=(n); i++)


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll _,i,j,n,a,b,e,k,u,t,x=1,m,y,q,f=1,c=0,d=0,l,p,z,o,r,g;
    string ss,s;
    cin>>s;
    cout<<s.substr(0,3)<<endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

const double PI = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    double a, b, x;
    cin >> a >> b >> x;
    double fil = x / a;
    double emp = a * b - fil;
    
    if (emp < fil) {
        double h = emp * 2.0 / a;
        double deg = atan(h / a) * 180.0 / PI;
        printf("%.10f\n", deg);
    }
    else {
        double w = fil * 2.0 / b;
        double deg = atan(b / w) * 180.0 / PI;
        printf("%.10f\n", deg);
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

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

int main() {
	int N;
	cin>>N;
	vector<P> v(N);
	rep(i,N){
		int a,b;
		cin>>a>>b;
		v[i] = {b,a};
	}
	sort(all(v));
	printpair(v);
	ll a = 0;
	string ans = "Yes";
	rep(i,N){
		a+=v[i].second;
		if(a<=v[i].first){
			continue;
		}
		else{
			ans = "No";
		}
	}	
	cout<<ans<<endl;
}

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

int main(){
	
	int h;
	while(cin >> h,h){
		int i,m[10000]={};
		long long ka=0,t=0;
		
		for(i=0;i<h;i++){
			cin >> m[i];
		}
		
		sort(m,m+h);
		
		for(i=0;i<h;i++){
			ka += t;
			t += m[i];
		}
		cout << ka <<endl;
	}
	return 0;
}

Measured memory_bytes: 0
use std::io;

#[cfg(test)]
mod tests;

fn main() {
    a();
    b();
    c();
    d();
}

fn a() {
    let mut buf = String::new();
    let handle = io::stdin();
    handle.read_line(&mut buf).unwrap();
    let n: isize = buf.trim().parse().unwrap();
    match n {
        3 | 5 | 7 => {
            println!("{}", "YES");
        },
        _ => {
            println!("{}", "NO");
        },
    }
}

fn b() { 
}

fn c() { 
}
fn d() { 
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<pi, int> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sandybridge __attribute__((optimize("Ofast"), target("arch=sandybridge")))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss

int n, a[200005], b[200005], val, l, r;
pi same = pi(INF, -INF);
vi v;

int main() {
	fastio; cin >> n;
	FOR(i, 1, n) cin >> a[i];
	FOR(i, 1, n) cin >> b[i];
	reverse(b+1, b+n+1);
	FOR(i, 1, n) if (a[i] == b[i]) same.f = min(same.f, i), same.s = max(same.s, i);
	if (same.f == INF) {
		cout << "Yes\n";
		FOR(i, 1, n) cout << b[i] << " ";
		return 0;
	}
	FOR(i, 1, n) if (a[i] != a[same.f] and b[i] != a[same.f]) v.pb(i);
	if (v.size() < same.s - same.f + 1) {
		cout << "No";
		return 0;
	}
	FOR(i, 0, same.s-same.f) swap(b[v[i]], b[same.f+i]);
	cout << "Yes\n";
	FOR(i, 1, n) cout << b[i] << " ";
	
}


Measured memory_bytes: 5928
#include <iostream>

using namespace std;

struct Card {
    char suit, value;
};

void bubble(struct Card A[], int N) {
    for (int i = 0; i < N; i++) {
        for (int j = N - 1; j >= i + 1; j--) {
            if (A[j].value < A[j - 1].value) {
                Card t = A[j];
                A[j] = A[j - 1];
                A[j - 1] = t;
            }
        }
    }
}

void selection(struct Card A[], int N) {
    for (int i = 0; i < N; i++) {
        int minj = i;
        for (int j = i; j < N; j++) {
            if (A[j].value < A[minj].value) {
                minj = j;
            }
        }
        Card t = A[i];
        A[i] = A[minj];
        A[minj] = t;
    }
}

void print(struct Card A[], int N) {
    for (int i = 0; i < N; i++) {
        if (i > 0) {
            cout << " ";
        }
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int N) {
    for (int i = 0; i < N; i++) {
        if (C1[i].suit != C2[i].suit) {
            return false;
        }
    }
    return true;
}

int main() {
    Card C1[100], C2[100];
    int N;
    char ch;

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> C1[i].suit >> C1[i].value;
    }

    for (int i = 0; i < N; i++) {
        C2[i] = C1[i];
    }

    bubble(C1, N);
    selection(C2, N);
    print(C1, N);
    cout << "Stable" << endl;
    print(C2, N);
    if (isStable(C1, C2, N)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }


}

Measured memory_bytes: 3096
# B - ss
def main():
    s = list(input())

    for _ in range(len(s)):
        s.pop()
        if len(s) % 2 == 0:
            p = len(s)//2
            if s[0:p] == s[p:]:
                print(len(s))
                exit()


if __name__ ==  "__main__":
    main()

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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#else
#define db(...) true
#endif
template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c; return o;
}
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;


int main() {
	#ifdef LOCAL
	auto stTime = clock();
	#endif
//	freopen("in.txt", "r", stdin);
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	int M, D, ans = 0;
	cin >> M >> D;
	for (int m = 1; m <= M; ++m) {
		for (int d = 1; d <= D; ++d) {
			int d1 = d % 10, d10 = d / 10;
			if (d1 * d10 == m && d1 >= 2 && d10 >= 2)
				++ans;
		}
	}
	cout << ans << '\n';
	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
    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 repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//#define int long long

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

  cout << a*b/2 << endl;
  
}



Measured memory_bytes: 256
#include <stdio.h>
#include <memory.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define N 100

int queue[N],len[N],col[N],M[N][N];
int n;


void bfs(void){
    int s,top,end,i;
    memset(len,-1,sizeof(len));
    len[0]=0;
    for(top=0,end=1;end != top;){
        s=queue[top];
        top++;
        for(i=0;i<n;i++){
          if(M[s][i] != 0 && col[i] == WHITE){
            queue[end++] = i;
            len[i] = len[s] + 1;
            col[i]=GRAY;
          }
      }
      col[s]=BLACK;
    }
    for(i=0;i<n;i++){
     printf("%d %d\n",i+1,len[i]);
   }
}

int main(){
  int u,k,v,i,o;

  scanf("%d",&n);

  for(i=0;i<n;i++){
   scanf("%d %d",&u,&k);
   u--;
   for(o=0;o<k;o++){
    scanf("%d",&v);
    v--;
    M[u][v]=1;
    }
  }

  col[0]=BLACK;
  bfs();

  return 0;
}



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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << 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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  string s;cin>>s;
  ll q;cin>>q;

  ll count=0;
  bool e=false;
  rep(i,0,q){
    ll a;cin>>a;
    if(a==1){
      e=(e?false:true);
      count++;
    }else{
      ll b;cin>>b;
      string c;cin>>c;
      if(e){
        if(b==2){
          s.insert(0,c);
        }else{
          s.insert(s.size(),c);
        }
      }else{
        if(b==1){
          s.insert(0,c);
        }else{
          s.insert(s.size(),c);
        }
      }
    }
  }

  if(count%2)reverse(all(s));

  out(s);

  return 0;
}


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

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

using i64 = int_fast64_t;
using u64 = uint_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;

i64 n;
vector<i64> a;
vector<vector<i64>> dp;

i64 dfs(i64 l, i64 r) {
    if (l < 0 || l > n || r < 0 || r > n) return 0;
    if (l == r) return 0;
    if (dp[l][r] != -1) return dp[l][r];

    return dp[l][r] = (n - (r - l)) % 2
        ? min(dfs(l + 1, r) - a[l], dfs(l, r - 1) - a[r - 1])
        : max(dfs(l + 1, r) + a[l], dfs(l, r - 1) + a[r - 1]);
}

void solve() {
    cin >> n;
    a.resize(n);
    for (auto& e : a) cin >> e;

    dp.resize(n + 1, vector<i64>(n + 1, -1));
    cout << dfs(0, n) << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


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

vector<int> forintinput(int n) {
	vector<int> x(100000);
	for(int i = 0;i < n;i++) cin >> x[i];
	return x;
}
int main(){
	string n;
	cin >> n;
	int cnt = 0;
	for(int i = 0;i < 3;i++){
		if(n[i] == '7'){
			cnt++;
		}
	}
	if(cnt != 0){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

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

	int a, b, x;
	cin >> a >> b >> x;

	double rad = 0;
	if (a * a * b < 2 * x) {
		rad = atan2(2 * (a * a * b - x), a * a * a);
	} else {
		rad = atan2(a * b * b, 2 * x);
	}
	double deg = rad * 180.0 / M_PI;

	cout << fixed << setprecision(7) << deg << endl;
	return 0;
}


Measured memory_bytes: 256
def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]
ans = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}

n = i_in()
s = r_in(n, str)
for k in s:
    ans[k] += 1

for key in ans:
    print(f'{key} x {ans[key]}')

Measured memory_bytes: 16296
#include <bits/stdc++.h>
using namespace std;
 
#define ff first
#define ss second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define check(x) cout << #x << " : " << (x) << endl
#define all(v) v.begin(),v.end() 
#define show(a) for(auto i:a) cout<<i<<" ";cout<<endl
// #define endl '\n'  
typedef long long ll; 
typedef unsigned long long ull; 
typedef long double ld;
typedef pair< int , int > mypair;
typedef priority_queue <int> max_heap;
typedef priority_queue <mypair, vector<mypair>, greater<mypair> > min_heap;
const int mod=1000000007;
const int inf=1e9;
const int N=2e6+10;


int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin.exceptions(cin.failbit);
    ll a;
    cin>>a;
    cout<<a+a*a+a*a*a;
    

    return 0;
} 

Measured memory_bytes: 3640
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cmath>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <complex>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <unordered_map>

using namespace std;

int main() {
	int A, B, C;
	cin >> A;
	cin >> B;
	cin >> C;
	int value = B + C;

	int poison = C;
	int cure = A + B;
	int life = poison - cure;

	if (life <= 1) cout << value << endl;
	else
	{
		value -= (life-1);
		cout << value << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
#diverta2019 programming contest D

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

n = I()
lst = make_divisors(n)
ans = 0
for i in lst:
    if i == 1:
        continue
    a,b = divmod(n,i-1)
    if a == b:
        ans += i-1
print(ans)

Measured memory_bytes: 39280
import numpy as np
n, w = map(int, input().split())
wv = [tuple(map(int, input().split())) for _ in range(n)]

INF = 10**9 + 100
MAX_V = 10 ** 6

dp = np.full((n+1, MAX_V), INF, np.int64)
dp[0][0] = 0

for i, (wi, vi) in enumerate(wv):
    dp[i+1] = dp[i]
    np.minimum(dp[i][vi:], dp[i][:-vi] + wi, out=dp[i+1][vi:])

ans = np.where(dp[n] <= w)[0][-1]
print(ans)


Measured memory_bytes: 811312
def slove():
    import sys
    import itertools
    input = sys.stdin.readline
    a = list(map(int, list(str(input().rstrip('\n')))))
    ls = ["+", "-"]
    for v in itertools.product(ls, repeat=3):
        t = a[0]
        s = [str(a[0])]
        for i in range(len(v)):
            if v[i] == "+":
                t += a[i + 1]
                s.append("+")
            else:
                t -= a[i + 1]
                s.append("-")
            s.append(str(a[i + 1]))
        if t == 7:
            s.append("=7")
            print("".join(s))
            exit()


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38384
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
//prototype declaration

//gloval variable
double PI = 3.1415926535897932384626433;
int MOD = 10007;

int main(void){
    char s[100];
    scanf("%s", &s);
    int l = strlen(s);
    printf("%c%d%c\n", s[0], l-2, s[l-1]);
    return 0;
}


Measured memory_bytes: 1720
#include<bits/stdc++.h>
using namespace std;
using LL=long long;
int main(){
  LL N,P;
  cin>>N>>P;
  for(LL i=pow(P,1.0/N)+1;i>=1;i--){
    if(P%LL(pow(i,N))==0){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<1<<endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, y int
	fmt.Scan(&n, &y)

	for i := 0; i <= n; i++ {
		for j := 0; i+j <= n; j++ {
			if 10000*i+5000*j+1000*(n-i-j) == y {
				fmt.Println(i, j, (n - i - j))
				return
			}
		}
	}
	fmt.Println(-1, -1, -1)
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
char s[20],t[20];
int main(){
	int i,len;
	scanf("%s%s",s,t);
	len=strlen(s);
	for(i=0;i<len;i++)
		if(s[i]!=t[i])return 0*printf("No\n");
	return 0*printf("Yes\n");
}

Measured memory_bytes: 1600
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pii;
typedef vector<pii> vii;
typedef vector<ll> vi;
typedef queue<ll> qi;
typedef queue<char> qc;
typedef queue<string> qs;
typedef vector<char> vc;
typedef vector<string> vs;
typedef map<char,ll> mpci;
typedef map<ll,ll> mpii;
typedef map<string,ll> mpsi;
typedef set<ll> sei;
typedef set<char> sec;
typedef set<string> ses;
typedef stack<ll> si;
typedef stack<char> sc;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pll> vpll;
typedef vector<pdd> vdd;
typedef unsigned int uint;
typedef long double ld;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vii> vvii;
/*=====================================================================*/
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define sz(a) (int)(a.size())
#define len(a) (int)(a.length())
#define all(s) (s).begin(),(s).end()
#define fi first
#define se second
#define be begin
#define en end
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define forn(i,p,n) for(int i=p;i<n;i++)
#define ford(i,p,n) for(int i=n-1;i>=p;i--)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();++i)
#define zero(a) memset(a,0,sizeof(a))
#define number(a,num) memeset(a,num,sizeof(a))

/*=====================================================================*/

inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
inline void write(long long x) {
  static long long sta[35];
  long long top = 0;
  do {
    sta[top++] = x % 10, x /= 10;
  } while (x);
  while (top) putchar(sta[--top] + 48);
  puts("");
}
/*======================================================================*/
bool prime(int n)
{
	if(n==0||n==1)
	  return false;
	for(int i=2;i*i<=n;i++)
	  if(n%i==0)
	    return false;
	return true;
}
/*======================================================================*/
const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};
/*======================================================================*/
int main()
{
  /*
	ios_base::sync_with_stdio(0);
	cin(tie);
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
  */
  /*====================================================================*/
  string s;
  cin>>s;
  if(s=="Sunny")
    cout<<"Cloudy";
  if(s=="Cloudy")
    cout<<"Rainy";
  if(s=="Rainy")
    cout<<"Sunny";
  return 0;
}


Measured memory_bytes: 256
import sys
from random import choice,randint
inp=sys.stdin.readline
out=sys.stdout.write
flsh=sys.stdout.flush
 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()]
def LF(): return [float(x) for x in inp().strip().split()]
def LS(): return inp().strip().split()
def I(): return int(inp().strip())
def F(): return float(inp().strip())
def S(): return inp().strip()
def pf(s): return out(s+'\n')
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    H=I()
    W=I()
    N=I()
    if H>=W:
        c,s=0,0
        while W>0:
            s+=H
            c+=1
            # print(c,s)
            if s>=N:
                break
            W-=1
        print(c)
    else:
        c,s=0,0
        while H>0:
            s+=W
            c+=1
            # print(c,s)
            if s>=N:
                break
            H-=1
        print(c)

if __name__ == "__main__":
    main()

Measured memory_bytes: 4208
use std::io;
use std::str;

pub struct Scanner<R> {
    reader: R,
    buffer: Vec<String>,
}

impl<R: io::BufRead> Scanner<R> {
    pub fn new(reader: R) -> Self {
        Scanner {
            reader: reader,
            buffer: Vec::new(),
        }
    }

    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("failed to parse token");
            }
            let mut input = String::new();
            self.reader.read_line(&mut input).expect("failed to read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

use io::Write;
fn main() {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut stdout = io::BufWriter::new(stdout);
    let mut scanner = Scanner::new(stdin.lock());

    let s: Vec<char> = scanner.token::<String>().chars().collect();
    if s[2] == s[3] && s[4] == s[5] {
        writeln!(stdout, "Yes");
    } else {
        writeln!(stdout, "No");
    }
}


Measured memory_bytes: 4352
n,k=map(int,input().split())
d = []
a_list = []
for i in range(k):
    d.append(int(input()))
    a_list.append(list(map(int,input().split())))

sunu = [1 for i in range(n)]
for i in range(k):
    for a in a_list[i]:
        sunu[a-1] = 0
print(sum(sunu))

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

int main() {
  ll x; cin >> x;
  ll y = 100;

  int a = 0;
  while (y < x) {
    a++;
    y += y/100;
  }

  cout << a << endl;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	double n,k;
	double sumRate = 0.00000000;
	double tempRate;

	scanf("%lf %lf",&n,&k);
	for (double i = 1.00; i <= n; i += 1.00)
	{
		if(i < k)	tempRate = pow(0.50000000, ceil(log2(k / i))) / n;
		else tempRate += 1.0000000000 / n;
		sumRate += tempRate;
		tempRate = 0.00000000;
	}
	printf("%.10f\n", sumRate);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <cmath>
#include <vector>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
#define PI 3.141592653589793
using ll = long long ;
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}
template< int id > struct CompTupleBy
{
  template<class T> 
  bool operator()( const T& a, const T& b ) const {
    return std::get<id>(a) < std::get<id>(b);
  }
};


using namespace std;
using Graph = vector< vector<int> > ;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<vector<int>> G;
    rep(i,n+1){
        vector<int> tmp;
        G.push_back(tmp);
    }
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> dist(n+1,-1);
    queue<int> que;
    dist[1] = 0;
    que.push(1);
    vector<int> sirube(n+1,-1);

    while(!que.empty()){
        int v = que.front();
        que.pop();
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            que.push(nv);
            if (sirube[nv] == -1){
                sirube[nv] = v;
            }
        }
    }
    for( int i=2;i<=n;i++){
        if (dist[i] == -1) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for (int v = 2; v <=n; ++v) cout << sirube[v] << endl;



        
}

Measured memory_bytes: 10468
# coding: utf-8
# Your code here!

def main():
    number_of_human = int(input())
    position_list = list(map(int,input().split()))
    
    start_position = min(position_list)
    end_position = max(position_list)
    max_answear = sum([(item - start_position)**2 for item in position_list])
    while True:
        answear = sum([(item - start_position)**2 for item in position_list])
        if start_position == end_position:
            break
        start_position += 1
        if answear < max_answear:
            max_answear = answear
    
    print(max_answear)
if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
S = gets.chomp
T = gets.chomp

ans = (0 .. S.size - T.size).reverse_each.map do |offset|
  found = T.size.times.all? do |i| 
    S[offset + i] == '?' || S[offset + i] == T[i]
  end
  if found
    z = S.tr('?','a')
    z[offset,T.size] = T
    z
  else
    nil
  end
end.compact

if ans.empty?
  puts "UNRESTORABLE"
else
  puts ans.min
end

Measured memory_bytes: 1916
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, M, C;
	cin >> N >> M >> C;

	vector<int> A(M), B(M);
	for (int i = 0; i < M; i++) cin >> B[i];

	int ans = 0, tmp;
	for (int i = 0; i < N; i++) {

		tmp = 0;

		for (int i = 0; i < M; i++) cin >> A[i];
		for (int i = 0; i < M; i++) tmp += A[i] * B[i];
		if (tmp + C > 0) ans++;

	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,n,s;
int main(){
	scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&n);
	s=min(min(a*8,b*4),min(c*2,d))*(n/2);
	if(n&1) s+=min(min(a*4,b*2),c);
	printf("%lld\n",s);
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProCon
{
    class Program
    {
        static void Main(string[] args)
        {
            AC141C();
        }

        static void AC141C()
        {
            //https://atcoder.jp/contests/abc141/tasks
            var list = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int n = list[0]; //参加者数
            int k = list[1]; //初期ポイント数
            int q = list[2]; //出題数

            int p = k - q;

            int[] people = new int[n];

            int correcter;

            for (int i = 0; i < q; i++)
            {
                correcter = int.Parse(Console.ReadLine());
                people[correcter - 1]++;
            }

            foreach(var a in people)
            {
                if(p + a > 0)
                {
                    Console.WriteLine("Yes");
                    continue;
                }
                Console.WriteLine("No");
            }
            Console.ReadKey();
        }
    }
}


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

int main() {
 int n,x,sum=0,cnt;
  cin >> n >> x;
 vector<int> m(n);
 for(int i=0;i<n;i++){
   cin >> m[i];
   sum+=m[i];
 }
  x=x-sum;
  sort(m.begin(),m.end());
  cnt=x/m[0];
  cout << cnt+n << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll n;
    cin>>n;
    vector<ll> a(n);
    multiset<ll> st;
    rep(i,n){
        cin>>a[i];
        st.insert(-a[i]);
    }
    ll ans=0;
    while(!st.empty()){
        ll x=*st.begin();
        st.erase(st.begin());
        ll nm=-x;
        ll beki=2;
        while(beki<=nm) beki*=2;
        ll tgt=beki-nm;
        auto ite=st.find(-tgt);
        if(ite!=st.end()){
            ans++;
            st.erase(ite);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 11264
// spnauT
//
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int _b=(b),i=(a);i<_b;++i)
#define ROF(i,b,a) for(int _a=(a),i=(b);i>_a;--i)
#define REP(n) for(int _n=(n);_n--;)
#define _1 first
#define _2 second
#define PB(x) push_back(x)
#define SZ(x) int((x).size())
#define ALL(x) (x).begin(),(x).end()
#define MSET(m,v) memset(m,v,sizeof(m))
#define MAX_PQ(T) priority_queue<T>
#define MIN_PQ(T) priority_queue<T,vector<T>,greater<T>>
#define IO(){ios_base::sync_with_stdio(0);cin.tie(0);}
#define nl '\n'
#define cint1(a) int a;cin>>a
#define cint2(a,b) int a,b;cin>>a>>b
#define cint3(a,b,c) int a,b,c;cin>>a>>b>>c
typedef long long LL;typedef pair<int,int> PII;
typedef vector<int>VI;typedef vector<LL>VL;typedef vector<PII>VP;
template<class A,class B>inline bool mina(A &x,const B &y){return(y<x)?(x=y,1):0;}
template<class A,class B>inline bool maxa(A &x,const B &y){return(x<y)?(x=y,1):0;}

#define MAXN (100004)

int A[MAXN];

int main()
{
	IO();
	cint2(N,L);
	FOR(i,0,N) cin >> A[i];

	int ma = 0;
	int j = 0;
	FOR(i,1,N) if(maxa(ma,A[i-1]+A[i])) j = i;

	if(ma < L) cout << "Impossible" << nl;
	else
	{
		cout << "Possible" << nl;
		FOR(i,1,j) cout << i << nl;
		ROF(i,N-1,j-1) cout << i << nl;
	}

	return 0;
}

Measured memory_bytes: 1280
import java.util.*;

public class Main {
	String[] deta = new String[1000];
	int[] Count = new int[1000];
	int maxIndex = 0;
	
	public boolean check( int count , String in ) {
		for ( int i = 0; i < count; i++ ) {
			if ( deta[i].equals(in) ) {
				Count[i]++;
				if ( Count[maxIndex] < Count[i] )
					maxIndex = i;
				return false;
			}
		}
		return true;
	}
	
	public static void main ( String args[] ) {
		Main m = new Main();
		Scanner sc = new Scanner(System.in);
		String in = sc.nextLine() , maxstr = "";
		sc = new Scanner(in);
		int count = 0;
		while ( sc.hasNext() ) {
			in = sc.next();
			if ( maxstr.length() < in.length() )
				maxstr = in;
			if ( m.check(count, in) ) {
				m.deta[count] = in;
				count++;
			}
		}
		System.out.println(m.deta[m.maxIndex]+" "+maxstr);
	}
}

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


int main() {
  string s;
  cin >> s;
  
  bool a = false;
  
  if(s.at(2) == s.at(3) && s.at(4) == s.at(5)){
    a = true;
  }
  
  if(a){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
  
}

Measured memory_bytes: 256
#include<stdio.h>
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <functional>
#include <stdio.h>
#include <array>
#include <algorithm>
#include <string>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <queue>
#include<iomanip>
#include<bitset>
#include<stack>
#include<set>
#include<limits>
#include <complex>
using namespace std;


vector<int>nums;
vector<int>oddnums;

vector<short>memo(1000001,-1);
vector<short>oddmemo(1000001,-1);

int getans(const int num,const int atime) {
	if (memo[num] != -1) {
		return memo[num];
	}
	else {
		if (num == 0)return memo[num] = 0;
		int ans = num;
		for (int i = 0; i <nums.size(); ++i) {
			int minusnum = nums[i];
			if (minusnum > num) {
				break;
			}
			else if (num / minusnum > 10) {
				continue;
			}
			ans = min(ans, getans(num - minusnum, atime + 1)+1);
		}

		return memo[num] = ans;
	}
}
int getoddans(const int num, const int atime) {
	if (oddmemo[num] != -1) {
		return oddmemo[num];
	}
	else {
		if (num == 0)return oddmemo[num] = 0;
		int ans = num;
		for (int i = 0; i < oddnums.size(); ++i) {
			int minusnum = oddnums[i];
			if (minusnum > num) {
				break;
			}
			else if (num / minusnum > 100) {
				continue;
			}
			ans = min(ans, getoddans(num - minusnum, atime + 1) + 1);
		}
		return oddmemo[num] = ans;
	}

}
int main() {
	for (int i = 1; i < 190; ++i) {
		nums.push_back(i*(i + 1)*(i + 2) / 6);
		if (((i*(i + 1)*(i + 2)) / 6) % 2) {

		
			oddnums.push_back((i*(i + 1)*(i + 2)) / 6);
		}
	}

	while (1) {
		int n; cin >> n;
		if (!n)break;
		int normalans = getans(n, 0);;
		int oddans = getoddans(n, 0);

		cout << normalans << " " << oddans << endl;
	}
	return 0;
}

Measured memory_bytes: 6532
class Odd:
    def __init__(self,s:str):
        self.s=s

    def odd_str(self):
        m=[]
        l=int(len(self.s))
        for i in range(0,l,2):
            m.append(self.s[i])
        print(''.join(m))

odd1=Odd(input())
odd1.odd_str()

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

main(){
  int a,b,c,d,e,k;
  string s;
  cin >> a >> b >> c >> d >> e >> k;
  
  if (e-a <= k){
    s = "Yay!";
  }else{
    s = ":(";
  }
  
  cout << s << endl;
}

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

int main()
{
    long long int n, sum=0;
    cin >> n;

    for (int i=1; i<=n; i++) {
        if (i % 15 != 0 && i % 5 != 0 && i % 3 != 0) sum += i;
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3600