akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A = list(map(int,input().split()))
B = []
for i in range(N):
    B.append(A[i]-(i+1))

B.sort()
if (N % 2 == 1):
    b = B[N//2]
else:
    b = round((B[N//2]+B[N//2-1])/2)

ans = 0
for i in range(N):
    ans += abs(B[i] - b)

print(ans) 

Measured memory_bytes: 25196
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define FOR(i,a,n) for(int i=a,i##_len=(int)(n);i<i##_len;++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i=(int)(n);i>=0;--i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : "\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

struct union_find {
	vector<int> data;
	union_find(int size) : data(size, -1) { }
    void unite(int x, int y) {
	    x = root(x); y = root(y);
        if(x != y) {
            if(data[y] < data[x]) swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
	}
	bool same(int x, int y) {
	    return root(x) == root(y);
    }
	int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};
signed main() {
    int N,M;
    cin>>N>>M;
    union_find uf(N+M+1); // 0~N-1:人 N~N+M-1:言語
    REP(i,N) {
        int K;
        cin>>K;
        REP(j,K) {
            int L;
            cin>>L;
            L--;
            uf.unite(i,N+L);
        }
    }
    int r=uf.root(0);
    REP(i,N) {
        if(uf.root(i)!=r) {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x7f7f7f7f7f7f7f;
const int N = 2e5 + 5;
int x[N] = {};
inline long long __abs(long long x) {
    return (x ^ (x >> 63)) - (x >> 63);
}
struct Tree {
    long long val[N << 2] = {}, tag = 0;
    inline void add_tag(long long x) {
        tag += x;
    }
    inline void pull(int idx) {
        val[idx] = min(val[idx << 1], val[idx << 1 | 1]);
    }
    void build(int l, int r, int idx) {
        if (l == r) {
            val[idx] = INF;
            return;
        }
        int L = (idx << 1), R = (idx << 1 | 1), mid = (l + r) >> 1;
        build(l, mid, L);
        build(mid + 1, r, R);
        pull(idx);
    }
    long long query(int ql, int qr, int l, int r, int idx) {
        if (ql == l && qr == r) return val[idx] + tag;
        int L = (idx << 1), R = (idx << 1 | 1), mid = (l + r) >> 1;
        if (qr <= mid) return query(ql, qr, l, mid, L);
        else if (mid + 1 <= ql) return query(ql, qr, mid + 1, r, R);
        else return min(query(ql, mid, l, mid, L), query(mid + 1, qr, mid + 1, r, R));
    }
    void modify(int m, int l, int r, int idx, long long v) {
        if (l == m && r == m) {
            if (val[idx] + tag > v)
                val[idx] = v - tag;
            return;
        }
        int L = (idx << 1), R = (idx << 1 | 1), mid = (l + r) >> 1;
        if (m <= mid) modify(m, l, mid, L, v);
        else if (mid + 1 <= m) modify(m, mid + 1, r, R, v);
        pull(idx);
    }
} t1, t2;
int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, q, a, b;
    cin >> n >> q >> a >> b;
    x[0] = a;
    for (int i = 1; i <= q; i++)
        cin >> x[i];
    t1.build(1, n, 1);
    t2.build(1, n, 1);
    t1.modify(b, 1, n, 1, -b);
    t2.modify(b, 1, n, 1, b);
    long long cost, dp;
    for (int i = 1; i <= q; i++) {
        cost = __abs(x[i] - x[i - 1]);
        dp = min(t1.query(1, x[i], 1, n, 1) + x[i], t2.query(x[i], n, 1, n, 1) - x[i]);
        t1.add_tag(cost), t2.add_tag(cost);
        t1.modify(x[i - 1], 1, n, 1, dp - x[i - 1]);
        t2.modify(x[i - 1], 1, n, 1, dp + x[i - 1]);
    }
    long long ans = INF;
    for (int i = 1; i <= n; i++)
        ans = min(ans, t1.query(i, i, 1, n, 1) + i);
    cout << ans << '\n';
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    map<string,double> m;
    for(int i=0;i<n;i++){
        double x;
        string u;
        cin >> x >> u;
        m[u] += x;
    }
    cout << fixed << setprecision(4) << m["BTC"] *380000.0 + m["JPY"] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
*/

int main(){
cout<<fixed<<setprecision(10);
//cin.tie(0); ios::sync_with_stdio(false);

int H,W;cin>>H>>W;
  vector<vector<char>> vec(H,vector<char>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>vec[i][j];
    }
  }
  
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cout<<vec[i][j];
    }
    cout<<endl;
    for(int j=0;j<W;j++){
      cout<<vec[i][j];
    }
    cout<<endl;
  }
  
  
  
}




Measured memory_bytes: 256
#include<functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <string>
#include <math.h>
#include <time.h>
#include <vector>
#include <queue>
#include<stack>
#include <map>
#include <set>
#include <list>
using namespace std;
typedef long long ll;
int gcd(int a, int b) {
	if (a == 0)
		return b;
	return gcd(b%a, a);
}
int main() {
	int n;
	cin >> n;
	int lcm = (n * 2) / gcd(2, n);
	cout << lcm << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>
#include <math.h>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

#define pi 3.141592653589793
#define mod 1000000007

int main() {
	int n, m;
	cin >> n >> m;
	vector<int>a(m), b(m);
	for (int i = 0; i < m; i++)cin >> a[i] >> b[i];
	for (int i = 1; i <= n; i++) {
		int res = 0;
		for (int j = 0; j < m; j++) {
			if (a[j] == i)res++;
			if (b[j] == i)res++;
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N , Ma, Mb = map(int, input().split())

a = [0] * N
b = [0] * N
c = [0] * N

for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())

# TLEになってしまうためinfを5000とかで設定する
INF = 5000

# 最小値を求める問題なのでinfで初期化
# dp[i][sun_a][sum_b]で考えていく
dp = [[[INF for _ in range(10 * N + 1)] for _ in range(10 * N + 1)] for _ in range(N+1)]

# 初期選択状態を0とする

dp[0][0][0] = 0
for i in range(N):
    for j in range(10*N+1):
        for k in range(10*N+1):
            if dp[i][j][k] == INF:
                continue
            
            # 選ばなかった場合
            dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k])
            # 選んだ場合
            dp[i+1][j+a[i]][k+b[i]] = min(dp[i+1][j+a[i]][k+b[i]], dp[i][j][k] + c[i])


ans = INF
# 0スタートは何を選んでいない状態となり最小値が0になってしまうため1から開始する

# TLEになったため変更
#for i in range(1,10 * N + 1):
#    for j in range(1,10 * N + 1):
#        if i * Mb != j * Ma:
#            continue
#        ans = min(ans, dp[N][i][j])
#

for i in range(1, 10*N+1):
        if i*Ma>10*N or i*Mb>10*N:
            break
        ans = min(ans, dp[N][i*Ma][i*Mb])

if ans == INF:
    print(-1)
else:
    print(ans)

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

#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define F0R(i, n) for (int i = 0; i < (n); i++)
#define print(x) cout << x << '\n'
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;

const int INF = 1e9 + 5;

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> h(n);
  for (int& i : h)
    cin >> i ;

  vector<int> dp(n, INF);
  dp[0] = 0;

  for (int i = 0; i < n; ++i){
    for (int j : {i  + 1, i + 2}) {
      if (j < n) {
        dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
      }
    }
  }
  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
int main() {
    int n;
    ll m;
    cin>>n>>m;
    vector<ll> a(n);
    for(int i=0; i<n; i++) cin>>a[i];
    for(int i=0; i<n; i++) a[i]*=0.5;
    ll lcm=a[0];
    for(int i=1; i<n; i++) lcm=lcm/GCD(lcm,a[i])*a[i];
    int ans=0;
    int b=1;
    while(lcm*b<=m){
        ans++;
        b+=2;
    }
    
    for(int i=0; i<n; i++){
        if((lcm/a[i])%2==0){
            cout<<"0"<<endl;
            return 0;
        }
    }
    cout<<ans<<endl;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

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

void Main(){
    int n, k; cin >> n >> k;
    vll v(n), l(k, 0), r(k, 0); 

    rep(i, n){
        cin >> v[i];
    }
    
    ll ans = 0;
    rep3(l, 0, min(n - 1, k)){
        rep3(r, 0, min(n - l, k - l)){
            int x = k - (l + r);
            ll tot = 0;
            vll vtmp;
            rep(i, l) {
                vtmp.pb(v[i]);
                tot += v[i];
            }
            rep(i, r) {
                vtmp.pb(v[n - i - 1]);
                tot += v[n - i - 1];
            }
            sort(all(vtmp));
            int sz = vtmp.size();
            rep(i, min(sz, x)) {
                if(vtmp[i] < 0) tot -= vtmp[i];
            }
            chmax(ans, tot);            
        }    
    }
    cout << ans << endl;
    return;
}

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

Measured memory_bytes: 3640
n, k = list(map(int, input().strip().split(' ')))
r, s, p = list(map(int, input().strip().split(' ')))
t = input().strip()

dp = [None for _ in range(n)]

map_ = {
        's': 'r',
        'r': 'p',
        'p': 's'
    }
for play in range(n):
    c_play = t[play] 
    dp[play] = map_.get(c_play)

for play in range(k, n):
    if dp[play] == dp[play-k]:
        dp[play] = None

ans = 0
map_2 = {
    None: 0,
    'r': r,
    's': s,
    'p': p        
}
for play in dp:
    ans += map_2.get(play)

print(ans)


Measured memory_bytes: 45296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef pair<l_l,ll> lll;
typedef vector<string> vs;
const ll dx[4]={1,-1,0,0};
const ll dy[4]={0,0,1,-1};
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
int main(){
    ll n,q;cin>>n>>q;
    vl a(n);rep(i,n)cin>>a[i];
    vl sum(n+1),esum(n+1);
    sort(a.rbegin(),a.rend());
    for(int i=0;i<n;i++){
        sum[i+1]=sum[i]+a[i];
        esum[i+1]=esum[i]+(i%2==0?a[i]:0);
    }
    vl bords,vals;
    for(int i=0;i<(n-1)/2;i++){
        ll bord=(a[i+1]+a[2*i+2])/2+1;
        ll val=(sum[i+1]-sum[0])+(esum[n]-esum[i*2+2]);
        bords.pb(bord);vals.pb(val);
    }
    reverse(bords.begin(),bords.end());reverse(vals.begin(),vals.end());
    rep(i,q){
        ll x;cin>>x;
        auto it=upper_bound(bords.begin(),bords.end(),x)-bords.begin();
        if(it==0)cout<<sum[(n+1)/2]-sum[0]<<endl;
        else cout<<vals[it-1]<<endl;
    }
    return 0;
}

Measured memory_bytes: 6676
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 998244353;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };

ll fac[300001];
ll inv[300001];
ll nCr(int n, int r)
{
	if(r>n)return 0;
	ll c = fac[n];
	c = (c*inv[r]) % MOD;
	c = (c*inv[n - r]) % MOD;
	return c;
}
int main() {
	fac[0] = inv[0] = 1;
	fup(i, 1, 300000, 1)
		fac[i] = (fac[i - 1] * i) % MOD;
	inv[300000] = POW(fac[300000], MOD - 2);
	fdn(i, 299999, 1, 1)
		inv[i] = (inv[i + 1] * (i+1)) % MOD;
	int n;
	ll a,b,k;
	scanf("%d%lld%lld%lld",&n,&a,&b,&k);
	ll ans=0;
	for(int i=0;a*i<=k;i++)
	{
		ll t=k-a*i;
		if(t%b==0)
		{
			int j=t/b;
			ans=(ans+nCr(n,i)*nCr(n,j))%MOD;
		}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 4992
#pragma region

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;
using vvb = vector<vector<bool>>;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

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

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

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int main() {
  init();

  int K, A, B;
  cin >> K >> A >> B;
  bool ok = false;
  for (int i = 0; i < 10000; i++) {
    if (K * i >= A && K * i <= B) ok = true;
  }
  out(ok ? "OK" : "NG");
}

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

#define rep(i, n) for(long long i=0;i<n;i++)
using ll = long long;
const ll INF = (1LL<<60);

int main(){

    ll s, w; cin >> s >> w;

    if(s<=w) cout << "unsafe" << endl;
    else cout << "safe" << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <ctype.h>
#include <numeric>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int dx4[4] = { 0, -1, 1, 0 };
int dy4[4] = { -1, 0, 0, 1 };
int dx8[8] = { 0, -1, 1, 0, -1, 1, -1, 1 };
int dy8[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };

int main() {
  int tmp, ans = 0;
  int n, m, c; cin >> n >> m >> c;
  vector<int> b(m); for (int i = 0; i < m; ++i) cin >> b[i];
  for (int i = 0; i < n; ++i) {
    int num = 0;
    for (int k = 0; k < m; ++k) {
      cin >> tmp;
      num += tmp * b[k];
    }
    if (num + c > 0) ++ans;
  }

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


Measured memory_bytes: 256
a,b,deg = gets.chomp.split(" ").map{|item| item.to_f}
h = b * Math.sin(deg*Math::PI/180.0)
s = a * h / 2.0
c = Math::sqrt(a**2+b**2-2*a*b*Math.cos(deg*Math::PI/180.0))
puts s,a+b+c,h

Measured memory_bytes: 9000
#include<iostream>

using namespace std;

int main(){
	
	unsigned long long a, b;
	unsigned long long x;

	cin >> a >> b >> x;

	unsigned long long num = 0;
	/*
	for(unsigned long long i = a; i <= b;){
		if((i%x) == 0){
			num++;
			i += x;
			continue;
		}
		i++;
	}
	*/

	unsigned long long ans1, ans2;
	if(a == 0){
		ans1 = 1;
	}else{
		ans1 = a / x + 1;
	}

	if(b == 0){
		ans2 = 1;
	}else{
		ans2 = b / x + 1;
	}

	num = ans2 - ans1 + 1;

	if(a%x != 0){
		num -=1;
	}

	cout << num;

	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }
    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out){
            int n = in.nextInt();
            int[] a = new int[n];
            int[] b = new int[n];
            int[] c = new int[n];
            for (int i = 0; i <n; i++) {
                a[i]=in.nextInt();
                b[i]=in.nextInt();
                c[i]=in.nextInt();
            }
            int[][] dp = new int[n][3];
            dp[n-1][0]=Math.max(b[n-1],c[n-1]);
            dp[n-1][1]= Math.max(a[n-1],c[n-1]);
            dp[n-1][2]=Math.max(a[n-1],b[n-1]);
            for (int i =n-2; i >=0 ; i--){
                for (int j = 0; j <3; j++){
                    if (j==0)dp[i][j]=Math.max(b[i]+dp[i+1][1] , c[i]+dp[i+1][2]);
                    else if (j==1)dp[i][j]=Math.max(a[i]+dp[i+1][0] , c[i]+dp[i+1][2]);
                    else dp[i][j]=Math.max(b[i]+dp[i+1][1] , a[i]+dp[i+1][0]);
                }
            }
            System.out.println(Math.max(dp[0][0] , Math.max(dp[0][1],dp[0][2])));
        }




    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt(){return  Integer.parseInt(next());}
        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

Measured memory_bytes: 48856
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
#define mod 1000000007
//#define mod 998244353
#define inf 1000000000
#define pr1(a) cout << a << endl
#define pr2(a,b)cout << a <<  " " <<b<< endl
#define pr3(a,b,c) cout << a <<" " << b << " " << c << endl

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

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


void solve(){
    char c[7];
    bool flag = true;
    for(int i = 1;i<=6;i++){
        cin >> c[i];
        if(i==4){
            if(c[i]!=c[i-1])flag = false;

        }
        if(i==6 && c[i]!=c[i-1])flag = false;
    }

    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;   
 
} 

signed main() 
{   
    IOS;
    int t = 1;
    //cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    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++)

int main(){
    int n;
    cin >> n;
    priority_queue<double, vector<double>, greater<double>> q;
    rep(i,n){
        double v; cin >> v;
        q.push(v);
    }
    while(q.size() >= 2){
        double u = q.top(); q.pop();
        double v = q.top(); q.pop();
        q.push((u+v)/2.0);
    }
    printf("%lf\n", q.top());
}

Measured memory_bytes: 256
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/g.inp"
exit $?
'''
import sys

def _ia(): return [ int(x) for x in sys.stdin.readline().strip().split() ]


def main():
    n, a, b = _ia()
    #
    ab = n//(a+b)
    cnt = a * ab
    print(cnt + min(n-(a+b)*ab, a))


if __name__=="__main__":
    main()


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

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

	vector<int> p(n);

	for(int i=0;i<n;i++){
		cin>>p[i];
	}
	
	for(int i=1;i<n-1;i++){
		if((p[i-1]<p[i] && p[i]<p[i+1]) || (p[i-1]>p[i] && p[i]>p[i+1])){
			count++;
		}
	}

	cout <<count;
	return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N 200005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcount
#define PI acos(-1)
//#define endl "\n"

const int inf = (int)1e18 + 10;

int h[100005];
signed main(){
  fast;
  
  int n ;
  cin >> n;
  int preh = 0;
  bool g = true;
  for(int i = 1 ; i <=n ; i++){
  	  cin >> h[i];
  	  if(h[i] - preh < -1){
  	  	g = false;
  	  }
  	  preh = max(h[i] , preh);
  }
  if(g){
  	cout << "Yes\n";
  }
  else
  	cout << "No\n";

  
}	

Measured memory_bytes: 1024
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<string>
#include<cstdio>
#include<vector>
#include<cassert>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,a,b) for (int i=a; i<=b; i++)
#define per(i,a,b) for (int i=a; i>=b; i--)
#define debug(x) {cout<<(#x)<<" "<<x<<endl;}
using namespace std;
typedef long long LL;

inline int read() {
    int x=0,f=1; char ch=getchar();
    while (!(ch>='0'&&ch<='9')) {if (ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9') {x=x*10+(ch-'0'); ch=getchar();}
    return x*f;
}

const int N = 100005;
const int M = 500005;

struct Point {
	int x,y,id;
} p[N];
inline bool cmp1(const Point &a,const Point &b) {return a.x<b.x;}
inline bool cmp2(const Point &a,const Point &b) {return a.y<b.y;}

int n;
int fa[N];
LL ans=0;

int tot=0;
struct edge{
	int u,v,w;
} e[M];
inline bool cmp3(const edge &a,const edge &b) {return a.w<b.w;}

int getfather(int x) {return (fa[x]==x)?x:(fa[x]=getfather(fa[x]));}

int main() {

	#ifndef ONLINE_JUDGE
	//	freopen("data.in","r",stdin);
	//	freopen("data.out","w",stdout);
	#endif

	n=read(); rep(i,1,n) p[i].x=read(),p[i].y=read(),p[i].id=i;
	sort(p+1,p+n+1,cmp1);
	rep(i,2,n) ++tot,e[tot].u=p[i-1].id,e[tot].v=p[i].id,e[tot].w=p[i].x-p[i-1].x;
	sort(p+1,p+n+1,cmp2);
	rep(i,2,n) ++tot,e[tot].u=p[i-1].id,e[tot].v=p[i].id,e[tot].w=p[i].y-p[i-1].y;
	sort(e+1,e+tot+1,cmp3);
	rep(i,1,n) fa[i]=i;
	int num=0;
	rep(i,1,tot) {
		int x=getfather(e[i].u),y=getfather(e[i].v);
		if (x!=y) {
			fa[x]=y; num++;
			ans+=e[i].w;
		}
	}
	assert(num==n-1);
	printf("%lld\n",ans);


	return 0;
}


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

int main(){
    long long N;
    long long a[5];
    cin >> N;
    for(int i=0; i<5; i++)
        cin >> a[i];
    long long mn = *min_element(a, a+5);
    long long ans = 4 + (N+mn-1)/mn;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};
vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll t;cin>>t;
  while(t--){
    ll n;cin>>n;
    vector<ll>a(n);
    rep(i,0,n)cin>>a[i];
    string s;cin>>s;
    vector<ll>basis;
    judge=true;
    rrep(i,0,n){
      if(s[i]=='0'){
        for(auto b:basis)chmin(a[i],a[i]^b);
        if(a[i])basis.PB(a[i]);
      }
      else{
        for(auto b:basis)chmin(a[i],a[i]^b);
        if(a[i])judge=false;
      }
    }
    ans(judge,0,1);
  }
  return 0;
}

Measured memory_bytes: 3648
N = int(input())
A = list(map(int, input().split()))
num_negative = 0
zero_flag = False
for a in A:
    if zero_flag:
        zero_flag = True
    if a < 0:
        num_negative += 1
total = sum([abs(a) for a in A])
if num_negative % 2 == 0 or zero_flag:
    print(total)
else:
    print(total - 2 * min([abs(a) for a in A]))

Measured memory_bytes: 66260
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll a,b,c,N; cin>>a>>b>>c>>N;
  ll ans = 0;
  if(a >= N){
    cout << N << endl;
    return 0;
  }
  else if(a + b >= N){
    cout << a << endl;
    return 0;
  }
  else cout << a - (N - a - b) << endl;


}


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

using namespace std;
typedef long long int ll;

int main()
{
    int n;
    cin >> n;
    vector<int>p(n),q(n);
    for(int i = 0; i < n; i++) cin >> p[i];
    for(int i = 0; i < n; i++) cin >> q[i];
    if(p == q) 
    {
        cout << 0 << endl;
        return 0;
    }
    int k = 0;
    int r;
    while(1)
    {
        if(p[k] == q[k]) k++;
        if(p[k] > q[k]) 
        {
            r = 0; //pの方が辞書順では大きい
            break;
        }
        if(p[k] < q[k]) 
        {
            r = 1; //qの方が辞書順では大きい
            break;
        }
    }
    int ans = 0;
    if(r == 0)
    {
        do
        {
            bool f = true;
            for(int i = 0; i < n; i++) if(p[i] != q[i]) f = false;
            if(!f) ans++;
            else break;
        }while(next_permutation(q.begin(),q.end()));
    }
    if(r == 1)
    {
        do
        {
            bool f = true;
            for(int i = 0; i < n; i++) if(p[i] != q[i]) f = false;
            if(!f) ans++;
            else break;
        }while(next_permutation(p.begin(),p.end()));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main() {
    int n; cin >> n;
    vector<long long> a(n);
    for (int i = 0;i < n; i++) cin >> a.at(i);
    sort(a.begin(), a.end());

    int ans = 0 , a_first = 0;
    
    for (int i = 0;i < n; i++) {
        if (a.at(i) != a_first) {
            ans++;
            a_first = a.at(i);
        }
        else {
            ans--;
            a_first = 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in);) {
			double x1 = sc.nextDouble();
			double x2 = sc.nextDouble();
			double y1 = sc.nextDouble();
			double y2 = sc.nextDouble();
			
			double dis = Math.sqrt(Math.pow(y1 - x1, 2) + Math.pow(y2 - x2, 2));
			System.out.println(dis);
		}
	}
}


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

int main(){
  int a, b;
  cin>>a>>b;
  
  if(a>=1 && a<=9 && b>=1 && b<=9){
    	cout<<a*b<<endl;
  }
  else{
    cout<<"-1"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
import sys
N = int(input())
t, x, y = 0, 0, 0
for i in range(N):
    T, X, Y = map(int, input().split())
    if abs(X-x)+abs(Y-y) <= T-t and ((T-t)-(abs(X-x)+abs(Y-y)))%2 == 0:
        t, x, y = T, X, Y
    else:
        print('No')
        sys.exit()
print('Yes')

Measured memory_bytes: 3064
require 'prime'
a, b, c, d = gets.split.map(&:to_i)

def m(a, b, x)
  s = (a-1)/x + 1
  e = b/x
  e-s+1
end

cs = m(a, b, c)
ds = m(a, b, d)
cds = m(a, b, c.lcm(d))

puts (b - a + 1) - (cs + ds) + cds


Measured memory_bytes: 2044
#include <iostream>
#include <string>
#include <cctype>

using namespace std;

bool isValid(string s) {
	bool num, lower, upper;
	num = lower = upper = false;
	if (s.length() < 6) {
		return false;
	}
	
	for (int i = 0; i < (int)s.length(); i++) {
		if (isdigit(s.at(i))) {
			num = true;
		} else if (islower(s.at(i))) {
			lower = true;
		} else if (isupper(s.at(i))) {
			upper = true;
		}
	}
	if (num && lower && upper) {
		return true;
	} else {
		return false;
	}
}

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

	if (isValid(s)) {
		cout << "VALID" << endl;
	} else {
		cout << "INVALID" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1184
N = int(input())
a = [int(x) for x in input().split()]
C = max(a)
ans = ""

if C - min(a) > 1:
	ans = "No"
elif C == min(a):
	if N >= 2 * C or N == C + 1:
		ans = "Yes"
	else:
		ans = "No"
else:
	if C - a.count(C - 1) > 0 and N - a.count(C - 1) >= 2 * (C - a.count(C - 1)):
		ans = "Yes"
	else:
		ans = "No"
print(ans)

Measured memory_bytes: 13964
n = int(input())
W = []
K = []
ans = "Yes"
for i in range(n):
    W.append(input())



for i in range(n-1):
    if W[i] in K:
        ans = "No"
        break

    K.append(W[i])

    if W[i][-1] != W[i+1][0]:
        ans = "No"
        break

if W[-1] in K:
    ans = "No"

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define debug(a) cout << #a ": " << a << endl
using namespace std;
typedef long long ll;
const int N = 3e5 + 1;
bitset<N> tmp, res, zero;
int n, m, k, cnt[2][N];
int ans_row, ans_col;
vector<int> g[N], mx_row, mx_col;
int main(void){
    IOS;
    cin >> n >> m >> k;
    for (int i = 1; i <= k; ++i){
        int x, y; cin >> x >> y;
        cnt[0][x]++, cnt[1][y]++;
        g[y].push_back(x);
    }
    for (int i = 1; i <= n; ++i){
        if (ans_row < cnt[0][i]){
            ans_row = cnt[0][i];
            mx_row.clear();
            mx_row.push_back(i);
        }else if (ans_row == cnt[0][i]){
            mx_row.push_back(i);
        }
    }
    for (int i = 1; i <= m; ++i){
        if (ans_col < cnt[1][i]){
            ans_col = cnt[1][i];
            mx_col.clear();
            mx_col.push_back(i);
        }else if (ans_col == cnt[1][i]){
            mx_col.push_back(i);
        }
    }
    for (int i = 0; i < mx_col.size(); ++i){
        int c = mx_col[i];
        tmp = zero;
        for (int& p : g[c]) tmp[p] = 1;
        if (!i) res = tmp;
        else res &= tmp;
    }
    int f = 1;
    for (int i = 0; i < mx_row.size() && f; ++i){
        int r = mx_row[i];
        if (res[r] == 0) f = 0;
    }
    cout << ans_row+ans_col-f << endl;
    return 0;
}

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

using namespace std;

int main(){
	int n, ans = 0;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
		ans += a[i];
	}
	sort(a.begin(), a.end());
	if(ans % 10 == 0){
		for(int i = 0; i < n; i++){
			if(a[i] % 10 != 0){
				ans -= a[i];
				break;
			}
		}
	}
	cout << ((ans % 10)? ans : 0) << endl;
	return 0;
}


Measured memory_bytes: 256
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
outp="War"
for z in range(X+1,Y+1):
    for X in x:
        if(X>=z):break
    else:
        for Y in y:
            if(Y<z):break
        else:
            outp="No War"
            break
            
print(outp)

Measured memory_bytes: 3064
N = int(input())
List = list(map(int,input().split()))
Ans = [0]*N
for i in range(N):
  if i % 2 == 0:
    Ans[0] += List[i]
  else:
    Ans[0] -= List[i]
for i in range(1,N):
  Ans[i] = 2*List[i-1] - Ans[i-1]
print(*Ans)

Measured memory_bytes: 14092
using System;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int a = inputs[0];
            int b = inputs[1];

            if (a <= 5)
            {
                Console.WriteLine(0);
            }
            else if (a <= 12)
            {
                Console.WriteLine(b / 2);
            }
            else
            {
                Console.WriteLine(b);
            }
        }
    }
}


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

int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  s[k - 1] = 'a' + s[k - 1] - 'A';

  cout << s << endl;
  return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
// #define mod 1000000007LL
#define fi first
#define se second
const ll p = 1000000007;
const ll mod = 1000000007;
int main()
{
    int a,b;
    cin>>a>>b;
    cout<<a*b;
}   


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
ll MOD = 1000000007;
ll INF =1<<30;



int main(){
   int n;
   cin >> n;
   vector<int>a(n);
   rrep(i,n) cin >> a[i];
   int cnt = 0;
   rrep(i,n){
       if(i==a[a[i]]) cnt++;
   }
   cout << cnt/2 <<endl;
   }

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

using namespace std;



int main() {
	
	ios_base :: sync_with_stdio(0); cin.tie(NULL);

	int a, b, c;
	cin >> a >> b >> c;

	bool ok = false;

	if (a == b && a != c) ok = true;
	if (a == c && a != b) ok = true;
	if (b == c && b != a) ok = true;


	cout << (ok ? "Yes": "No") << '\n';

	return 0;	
}

Measured memory_bytes: 256
using System;
using System.Linq;

class D
{
	static void Main()
	{
		Console.ReadLine();
		var a = Console.ReadLine().Split().Select(long.Parse).ToArray();

		var p2 = new long[60];
		p2[0] = 1;
		for (int i = 1; i < 60; i++) p2[i] = 2 * p2[i - 1];

		var f = new long[60];
		foreach (var x in a)
			for (int i = 0; i < 60; i++)
				if ((x & p2[i]) > 0) f[i]++;

		var s = a.Aggregate((x, y) => (x + y) % M) * (a.Length - 1) % M;
		var fs = f.Select((x, i) => x * (x - 1) / 2 % M * (p2[i] % M) % M).Aggregate((x, y) => (x + y) % M);
		Console.WriteLine(MInt(s - 2 * fs));
	}

	const int M = 1000000007;
	static long MInt(long x) => (x %= M) < 0 ? x + M : x;
}


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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 2e5 + 5;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);


int n , m;

ll a[N];
ll odd [N];
ll even[N];
ll mem[N][4];
int vis[N][4];
int color = 0;

ll dp(int i , int f){
    if(i > n){
            if(n&1){
                    if(f) return 0;
                    else return -INF;
            }
            else {
                    return 0;
            }
    }

    ll &ret = mem[i][f];
    if(vis[i][f] == color) return ret;
    vis[i][f] = color;

    ret = a[i] + dp(i + 2 , f);
    if(n&1){
            if(f < 2){
                    ret = max(ret , dp(i + 1 , f + 1));
            }
    }
    else {
            if(f < 1){
                    ret = max(ret , dp(i + 1 , f + 1));
            }
    }

    return ret;
}

void solve(int testCase){

    scanf("%d" , &n);

    for(int i = 1 ; i <= n ; i ++){
            scanf("%lld" , &a[i]);
    }

    color = 1;
    ll ans = dp(1 , 0);
    color = 2;
    ans = max(ans , dp(1 , 0));

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

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


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

int main(){

    int N;
    cin >> N;

    int t = N % 10;
    string res;

    switch(t){
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            res = "hon";
            break;

        case 0:
        case 1:
        case 6:
        case 8:
            res = "pon";
            break;
        
        case 3:
            res = "bon";
            break;
    }

    cout << res;
    return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
const long long inf=1ll<<40;
// from http://drken1215.hatenablog.com/entry/2019/05/15/002400
int main(){
    long long  n,k;
    scanf("%lld %lld",&n,&k);
    vector<vector<long long>> s(n);
    for (int i=0;i<n;++i) {
        long long t,d;
        scanf("%lld %lld",&t,&d);
        t--;
        s[t].push_back(d);
    }
    for (auto &v : s) {
        sort(v.begin(),v.end(),greater<long long>());
        if (v.empty()) v.push_back(-inf);
    }
    sort(s.begin(),s.end(), [&](vector<long long> a, vector<long long> b){ return a[0]>b[0];});
    long long cur=0;
    priority_queue<long long> que;
    for (int i=0;i<k;i++) {
        cur+=s[i][0];
        for (int j=1;j<s[i].size();++j) que.push(s[i][j]);
    }

    for (int i=k;i<n;++i) for (int j=0;j<s[i].size();++j) {
        que.push(s[i][j]);
    }
    long long res=cur+k*k;
    for (long long x=k-1;x>=1;--x) {
        long long v=s[x][0];
        long long w=que.top();
        if (v<w) {
            que.pop();
            cur+=w;
            que.push(v);
            cur-=v;
        }
        res=max(res,cur+x*x);
    }

    printf("%lld\n",res);
    return 0;
}


Measured memory_bytes: 8696
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
int MOD = 1000000007;
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;

	int cnt = 26;
	int cnt_1 = 1;
	while(1) {
		if(n<=cnt) {
			break;
		} else {
			n -= cnt;
			cnt *= 26;
			cnt_1 += 1;
		}
	}

	n -= 1;
	int x = n;
	int d = n;
	string s;
	for(int i=0;i<cnt_1;i++){
		x = d % 26;
		if(x<0) x += 26;
		d = (d-x) / 26;
		char m = 'a'+x;
		s.push_back(m);
	}
	reverse(s.begin(), s.end());

	cout << s << endl;
	
}


Measured memory_bytes: 3608
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <utility>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

int main() {
    long n, k;
    cin >> n >> k;
    long ans = 0;
    if (k % 2 == 0) {
        long half = 0;
        for (int i = 1; i <= n; i++) {
            if (i % k == k / 2) {
                half++;
            }
        }
        ans += half * half * half;
    }
    long mult = 0;
    for (int i = 1; i <= n; i++) {
        if (i % k == 0) {
            mult++;
        }
    }
    ans += mult * mult * mult;
    cout << ans << endl;
}


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

#define llint long long int

using namespace std;

int main(){
    int N, M;

    cin >> N >> M;

    vector<vector<int>> room(N + 1, vector<int>());

    for(int i = 0; i < M; i ++){
        int A, B;

        cin >> A >> B;

        room[A].push_back(B);
        room[B].push_back(A);
    }
    vector<int> ans(N + 1, -1);
    queue<pair<int, int>> que;

    ans[1] = 0;

    for(int i = 0; i < room[1].size(); i ++){
        que.push(make_pair(room[1][i], 1));
    }
    while(!que.empty()){
        int num = que.front().first;

        if(ans[num] == -1){
            ans[num] = que.front().second;

            for(int i = 0; i < room[num].size(); i ++){
                que.push(make_pair(room[num][i], num));
            }
        }
        que.pop();
    }
    bool OK = true;

    for(int i = 2; i <= N; i ++){
        if(ans[i] == -1){
            OK = false;

            break;
        }
    }
    if(OK){
        cout << "Yes" << endl;

        for(int i = 2; i <= N; i ++){
            cout << ans[i] << endl;
        }
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 12188
#include<bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
// greater<int>()
typedef long long ll;
ll GCD(ll x, ll y) { return y ? GCD(y, x % y) : x; }
ll LCM(ll x, ll y) { return x * y / GCD(x, y); }

using namespace std;
int main() {
	int s;
	cin >> s;

	//vector<int> vec(10000001);
	ll ans = 1;
	map<int, int> m;
	while (true) {
		m[s]++;

		if (m[s] > 1) {
			break;
		}
		ans++;
		if (s % 2 == 0) {
			s = s / 2;
		}
		else {
			s = 3 * s + 1;
		}
		

		
	}


	cout << ans << endl;

}


Measured memory_bytes: 256