akhauriyash/Code-Regression huggingface dataset:
#include <array>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

int main()
{
    LL x;
    cin >> x;
    LL quotient = x / 11;
    LL mod = x % 11;
    LL ans = quotient * 2 + ((mod > 6) ? 2 : (mod != 0) ? 1 : 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i, c) for(long long i=0; i<(long long)c; i++)
const ll INF=1000000000000001;
int main() {
	int a,b,c,k;
	string ans;
	cin >>a>>b>>c;
	cin >>k;
	for(int i=1;i<=k;i++){
		if (b<=a) b*=2;
		else if(c<=b)c*=2;
		if (b>a && c>b) break;
	}
	ans="No";
	if (b>a && c>b) ans="Yes";
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>
#include <cassert>

using ll = long long;
using ull = unsigned long long;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

constexpr ll NOT_SPECIFIED_VALUE_MIN = INT64_MIN;
constexpr ll NOT_SPECIFIED_VALUE_MAX = INT64_MAX;

ll modN(ll n, ll mod) {
	if (n % mod == 0) {
		return mod;
	}
	else {
		return n % mod;
	}
}

int main() {
	ll n;
	cin >> n;
	vector<ll> dam(n + 1), mt(n + 1);
	for (ll i = 1; i <= n; i++) {
		cin >> dam[i];
	}
	ll all = 0;
	for (ll i = 1; i <= n; i++) {
		all += dam[i];
	}
	all /= 2;
	for (ll i = 1; i <= n; i++) {
		mt[i] = all;
	}
	
	for (ll j = 1; j < n; j += 2) {
		mt[1] -= (dam[modN(1 + j, n)]);
	}
	for (ll i = 2; i <= n; i++) {
		mt[i] = dam[i - 1] - mt[i - 1];
	}
	assert(mt[1] + mt[n] == dam[n]);
	for (ll i = 1; i <= n; i++) {
		if (i != 1) {
			cout << " ";
		}
		cout << mt[i] * 2;
	}
	cout << endl;
	
}


Measured memory_bytes: 4756
def main():
    while True:
        n = int(input())
        if not n:
            return
        ls = False
        rs = False
        ns = True
        c = 0
        for f in input().split():
            if f == "lu":
                ls = True
            elif f == "ru":
                rs = True
            elif f == "ld":
                ls = False
            elif f == "rd":
                rs = False
            if ls == ns and rs == ns:
                c += 1
                ns = not ns
        print(c)
        

if __name__ == '__main__':
    main()


Measured memory_bytes: 5612
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  ll n,m;
  ll a[100050],b[100050],c[100050];
  pair<ll,ll> d[100050];
  cin>>n>>m;
  rep(i,n) cin>>a[i];
  rep(i,m){
    cin>>b[i]>>c[i];
    d[i]=make_pair(c[i],b[i]);
  }
  sort(a,a+n);
  sort(d,d+m);
  ll cnt=0;
  repn(i,m-1){
    rep(j,d[i].second){
      a[cnt]=max(a[cnt],d[i].first);
      cnt++;
      if(cnt==n) break;
    }
    if(cnt==n) break;
  }
  ll ans=0;
  rep(i,n){
    ans+=a[i];
  }
  cout<<ans<<endl;
      
  return 0;
}

Measured memory_bytes: 4096
#include<iostream>
void unite(int, int, int*, int*);
int same(int, int, int*);

int main() 
{
  int n,q,cmd,x,y,i;
  int* U_num;
  int* temp;
  std:: cin >> n >> q;
  U_num = new int[n];
  temp = new int[n];
  for(i = 0; i < n; i++)  
    {
      U_num[i] = i;
      temp[i] = 0;
    }
  for(i = 0; i < q; i++) 
    {
      std::cin >> cmd >> x >> y;
      if (cmd) std::cout << same(x, y, U_num) << std::endl;
      else unite(x, y, U_num, temp);
    }
  return 0;
}

void unite(int x, int y, int *U_num, int *temp) 
{
  while (U_num[x] != x) 
    x = U_num[x];
  while (U_num[y] != y) 
    y = U_num[y];
  if(temp[x] < temp[y]) 
    U_num[x] = y;
  else if(temp[x] == temp[y]) 
    {
      U_num[y] = x;
      temp[x]++;
    }
  else  
    U_num[y] = x;
} 

int same(int x, int y, int *U_num) 
{
  while (U_num[x] != x) 
    x = U_num[x];
  while (U_num[y] != y) 
    y = U_num[y];
    return (x==y);
}


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

struct TXY{
    int t;
    int x;
    int y;
};

int distance(const struct TXY& lhs, const struct TXY& rhs){
    int dx = abs(lhs.x - rhs.x);
    int dy = abs(lhs.y - rhs.y);
    return dx + dy;
}

int main(){
    int N; cin >> N; N++;
    vector<struct TXY> vecTxy(N);
    vecTxy[0].t = 0;
    vecTxy[0].x = 0;
    vecTxy[0].y = 0;
    for(int i=1; i<vecTxy.size(); ++i){
        cin >> vecTxy[i].t;
        cin >> vecTxy[i].x;
        cin >> vecTxy[i].y;
    }
    
    for(int i=1; i<vecTxy.size(); ++i){
        int t = vecTxy[i].t - vecTxy[i-1].t;
        int d = distance(vecTxy[i-1], vecTxy[i]);
        if(t<d || t%d!=0){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    
    return 0;
}

Measured memory_bytes: 1408
def main():
    import sys
    def MI():
        return map(int, sys.stdin.readline().rstrip().split())
    def LI():
        return list(map(int, sys.stdin.readline().rstrip().split()))  # 空白あり

    N,Q = MI()
    c = [0] + LI()
    lr = []
    for i in range(Q):
        l,r = MI()
        lr.append(i+l*(10**6)+r*(10**12))

    lr.sort()  # 右端rでソート
    d = {}  # d[i] = 玉iが現れた最も右の位置
    ANS = [0]*Q


    class BIT():
        def __init__(self, init_value):
            self.n = len(init_value)
            self.tree = [0] * (self.n + 1)
            for i in range(1, self.n + 1):
                x = init_value[i - 1]
                while i <= self.n:
                    self.tree[i] += x
                    i += i & (-i)

        def update(self, i, x):  # i(1-index)番目の値を+x
            while i <= self.n:
                self.tree[i] += x
                i += i & (-i)
            return

        def query(self, i):  # 1番目からi(1-index)番目までの和を返す
            res = 0
            while i > 0:
                res += self.tree[i]
                i -= i & (-i)
            return res


    bit = BIT([0]*N)  # 最も右に現れた玉の位置を管理
    a = 0  # lr のどこまで見たか
    for i in range(1,N+1):
        if not c[i] in d.keys():
            d[c[i]] = i
            bit.update(i,1)
        else:
            bit.update(d[c[i]],-1)
            d[c[i]] = i
            bit.update(i, 1)
        while a <= Q-1:
            x = lr[a]
            r = x//(10**12)
            x %= 10**12
            l = x//(10**6)
            j = x % (10**6)
            if r == i:
                ANS[j] = bit.query(r)-bit.query(l-1)
                a += 1
            else:
                break

    print(*ANS,sep='\n')


if __name__ == '__main__':
    main()


Measured memory_bytes: 223628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++) 
#define fs first
#define sc second
#define _GLIBCXX_DEBUG

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}

template <class S>
void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){
		cerr << v[i] << ' ';
	}
	cerr << endl;
}
template <class S>
void print(vector<vector<S>> &v) {
  	for (ll i = 0; i < (ll)v.size(); i++) {
    	for (ll j = 0; j < (ll)v[i].size(); j++) {
      		cerr << v[i][j] << ' ';
    	}
    	cerr << endl;
  	}
}

int ans = 0;
int n, m, q;
void dfs(int i, int j, vector<int> A, vector<tuple<int,int,int,int>> &data){
	if(i == n){
		//print(A);
		int asw  = 0;
		for(auto [a,b,c,d]: data){
			if(A[b-1] - A[a-1] == c){
				asw += d;
			}
		}
		ans = max(ans, asw);
		return;
	}
	for(int k=j; k<=m; k++){
		A[i]=k;
		dfs(i+1, k, A, data);
	}
}


int main(void){
	cin >> n >> m >> q;
	vector<tuple<int,int,int,int>> data;
	Rep(q){
		int a,b,c,d;
		cin >> a >> b >> c >> d;
		data.push_back(make_tuple(a,b,c,d));
	}
	dfs(0, 1, vector<int>(n,0), data);
	cout << ans << endl;
}

Measured memory_bytes: 3620
import sys
#s
s=[]
s=input()

i=0
nagasa=len(s)

while i <= (len(s)/2):
    if s[i] != s[len(s)-1-i]:
        print("No")
        sys.exit()
    i+=1

i=0
len2 = int(len(s)/2 -1)
while i <= len2/2:
    if s[i] != s[len2-i]:
        print("No")
        sys.exit()
    i+=1

i=(len(s)+3)/2
j=0
while i <= len(s)/2:
    if s[i] != s[len(s)-j]:
        print("No")
        sys.exit()
    i+=1
    j+=1

print("Yes")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    cin>>N;
    vector<char> march = {'M', 'A', 'R', 'C', 'H'};
    vec memo(5,0);
    rep(i,N){
        cin>>S;
        rep(j,5) if(S[0] == march[j]) ++memo[j];
    }
    ll ans = 0;
    /*rep(i,5) cout<<memo[i]<<' ';
    cout<<endl;*/
    rep(i,5) reps(j,i+1,5) reps(k,j+1,5) ans += memo[i]*memo[j]*memo[k];
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define ll long long
#include<bits/stdc++.h>
int main(){
  ll i,ans=1e10+5;
  ll a,b,m;
  cin>>a>>b>>m;
  vector<ll>p(a);
  vector<ll>q(b);
  vector<ll>r(m);
  for(i=0;i<a;i++)
    cin>>p[i];
  for(i=0;i<b;i++)
    cin>>q[i];
  ll min1=*min_element(p.begin(),p.end());
  ll min2=*min_element(q.begin(),q.end());
  for(i=0;i<m;i++){
    ll x;cin>>x;
    ll y;cin>>y;
    cin>>r[i];
    ans=min(ans,p[x-1]+q[y-1]-r[i]);
  }
  ans=min(ans,min1+min2);
  cout<<ans;
  return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <queue>

int main()
{
    int H, W;
    std::cin >> H >> W;
    std::vector<std::string> s(H);
    int black_count = 0;
    for (int i = 0; i < H; i++) {
        std::cin >> s[i];
        for (int j = 0; j < W; j++)
            if (s[i][j] == '#')
                black_count++;
    }

    const auto pos = [&](int x, int y) {
        return y * W + x;
    };

    std::queue<int> que;
    que.emplace(pos(0, 0));

    const int INF = H * W;
    std::vector<int> d(H * W, INF);
    d[pos(0, 0)] = 0;

    while (!que.empty()) {
        int curr = que.front(); que.pop();
        int x = curr % W;
        int y = curr / W;

        const int dx[] = {-1, 0, 1, 0};
        const int dy[] = {0, -1, 0, 1};
        for (int i = 0; i < 4; i++) {
            int nx = x + dx[i];
            int ny = y + dy[i];
            int next = pos(nx, ny);

            if (nx < 0 || nx >= W || ny < 0 || ny >= H) continue;
            if (s[ny][nx] == '#') continue;

            if (d[curr] + 1 < d[next]) {
                d[next] = d[curr] + 1;
                que.emplace(next);
            }
        }
    }

    if (d[pos(W - 1, H - 1)] == INF)
        std::cout << -1 << std::endl;
    else
        std::cout << H * W - (d[pos(W - 1, H - 1)] + black_count + 1) << std::endl;
        
    return 0;
}

Measured memory_bytes: 3624
sx,sy,tx,ty = map(int,input().split())

ans = ""
ans += "U"*(ty-sy)
ans += "R"*(tx-sx)
ans += "D"*(ty-sy)
ans += "L"*(tx-sx)
ans += "L"
ans += "U"*(ty-sy+1)
ans += "R"*(tx-sx+1)
ans += "D"
ans += "R"
ans += "D"*(ty-sy+1)
ans += "L"*(tx-sx+1)
ans += "U"
print(ans)


Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
std::random_device rd;
std::mt19937 mt(rd());
constexpr int MOD = 1e9+7; constexpr int MAX = 200020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;

bool comp(const P &p1, const P &p2) {
	int c1 = p1.first + 1, c2 = p2.first + 1;
	int d1 = p1.first + p1.second + 1, d2 = p2.first + p2.second + 1;
	if ((c2 - 1)*d1 == (c1 - 1)*d2) {
		if (p1.first == p2.first)return p1.second < p2.second;
		else p1.first < p2.first;
	}
	else return (c2 - 1)*d1 < (c1 - 1)*d2;
}
vector<P>v1, v0;

ll dp[200020][50];//i番目まででj個買った時の時間のmin

void solve() {
	int N, T; cin >> N >> T;
	vector<int>A(N), B(N);

	REP(i, N) {
		cin >> A[i] >> B[i];
		if (A[i] > 0)v1.push_back({ A[i],B[i] });
		else v0.push_back({ A[i],B[i] });
	}
	//print("input");
	if(v1.size()>0)sort(v1.begin(),v1.end(), comp);
	//print("sorted");
	//exit(0);
	VSORT(v0);
	int M = v1.size();
	REP(i, M + 1) {
		REP(j, 50) {
			dp[i][j] = 1e12;
		}
	}
	dp[0][0] = 0;
	REP(i, M) {
		REP(j, 49) {
			ll t = dp[i][j];
			if (t > T)continue;
			chmin(dp[i + 1][j], dp[i][j]);
			//買う
			ll nt = (t + 1)*v1[i].first + v1[i].second + t + 1;;
			if (nt > T)continue;
			chmin(dp[i + 1][j + 1], nt);
		}
	}
	ll ans = 0;
	//print("a");
	REP(k, 50) {
		if (dp[M][k] > T)continue;
		int cnt = k;
		int rem = T - dp[M][k];
		int mm = v0.size();
		REP(i, mm) {
			if (v0[i].second + 1 <= rem) {
				cnt++;
				rem -= (v0[i].second + 1);
			}
		}
		ans = max(ans, cnt);
	}
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 85228
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef vector<pii> vpii;
typedef tree<pii, null_type, less<pii>, rb_tree_tag,
    tree_order_statistics_node_update> ost;

const int N =810;
char f[N][N];
int qi[N*N], qj[N*N], qd[N*N];
int di[]={0, 1, 0, -1}, dj[]={1, 0, -1, 0};

int main() {
    int i, j, b, e, h, w, k, d, best;
    scanf("%d%d%d", &h, &w, &k);
    for(i=1; i<=h; i++) scanf("%s", f[i]+1);
    for(i=1; i<=h; i++) for(j=1; j<=w; j++)
        if(f[i][j]=='S') qi[0]=i, qj[0]=j, qd[0]=0;
    best=h+w;
    for(b=e=0; b<=e; b++) {
        if(qd[b]<=k) {
            best=min(best, qi[b]-1);
            best=min(best, h-qi[b]);
            best=min(best, qj[b]-1);
            best=min(best, w-qj[b]);
        }
        for(d=0; d<4; d++) {
            i=qi[b]+di[d];
            j=qj[b]+dj[d];
            if(f[i][j]=='.') {
                f[i][j]='V';
                e++;
                qi[e]=i, qj[e]=j, qd[e]=qd[b]+1;
            }
        }
    }
    printf("%d\n", 1+(best+k-1)/k);
    return 0;
}

Measured memory_bytes: 8576
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        // long startTime = System.currentTimeMillis();

        Scanner scanner = new Scanner(System.in);

        int a = scanner.nextInt();
        int b = scanner.nextInt();

        scanner.close();

        if (a > 8 || b > 8) {
            System.out.println(":(");
        } else {
            System.out.println("Yay!");
        }

        // System.out.println(System.currentTimeMillis() - startTime);
    }
}

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

ll n;

int main() { // claudio van
  cin >> n;
  ll mn = LLONG_MAX;
  for (ll i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      ll sum = i;
      sum += n / i;
      mn = min(mn, sum);
    }
  }
  cout << mn - 2 << "\n";
  return 0;
}

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

int main(void){
    int c[3][3];
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            cin >> c[i][j];
        }
    }
    vector<int> a(3), b(3);
    string ans = "No";
    for(int i=0; i<=c[0][0]; i++){
        a[0] = i;
        b[0] = c[0][0] - i;
        if(c[1][0] - b[0] < 0 || c[2][0] - b[0] < 0){
            continue;
        }else{
            a[1] = c[1][0] - b[0];
            a[2] = c[2][0] - b[0];
        }
        b[1] = c[0][1] - a[0];
        if(c[1][1] - b[1] != a[1] || c[2][1] - b[1] != a[2]){
            continue;
        }
        b[2] = c[0][2] - a[0];
        if(c[1][2] - b[2] != a[1] || c[2][2] - b[2] != a[2]){
            continue;
        }
        ans = "Yes";
        break;
    }
    cout << ans << endl;
    return 0;
}

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

int N;
int a[100005], b[100005], c[100005];
long long int dp[100005][3];

int main(void) {

	cin >> N;

	for (int i = 1; i <= N; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	dp[1][0] = a[1];
	dp[1][1] = b[1];
	dp[1][2] = c[1];

	for (int i = 2; i <= N; i++) {
		dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]);
		dp[i][1] = max(dp[i - 1][0] + b[i], dp[i - 1][2] + b[i]);
		dp[i][2] = max(dp[i - 1][0] + c[i], dp[i - 1][1] + c[i]);
	}

	long long int ans = 0;
	for (int j = 0; j <= 2; j++) {
		ans = max(ans, dp[N][j]);
	}

	/*for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= 2; j++) {
			cout << "dp[" << i << "][" << j << "]= " << dp[i][j] << endl;
		}
	}*/

	cout << ans << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 3712
import numpy as np

H,N = map(int,input().split())
S=[None for i in range(N)]
for i in range(N):
  S[i] = list(map(int,input().split()))
S = np.array(S)

dp = np.zeros(H+1)
for i in range(1,H+1):
  dp[i] = min(dp[np.maximum(0, i-S[:,0])]+S[:,1])

print(int(dp[-1]))

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

 int main(){
 string S, T;
 cin >> S >> T;
 int N = S.size(), ans = 0;
 for(int i = 0; i < N; ++i){
if(S[i] != T[i]) ++ans;
 }
 cout << ans << endl;
 }


Measured memory_bytes: 3928
#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n) ;i++)

using namespace std;
using p=pair<int,int>;
typedef long long ll;
const double pi=3.1415926535;

int main(void) {
  double a,b,h,m;
  cin >> a >> b >> h >> m;
  double n=m/60;
  double x=(60*h+m)/720;
  double c = 2*pi*n;
  double d = 2*pi*x;
  double w = fabs(c-d);
  double ans;
  double r=cos(w);
  ans=a*a+b*b-2*a*b*r;
  double s=sqrt(ans);
  cout << setprecision(20) << s << endl;
  

  return 0;

}



Measured memory_bytes: 4212
package main

import (
	"fmt"
)

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)
	sum := 0
	for i := 1; i < n; i++ {
		if s[i] == 'E' {
			sum++
		}
	}
	ans := sum
	for i := 1; i < n; i++ {
		if s[i-1] == 'W' {
			sum++
		}
		if s[i] == 'E' {
			sum--
		}
		if sum < ans {
			ans = sum
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2304
#include <iostream>

using namespace std;

int main() {
	string s, t;
	bool ok = true;
	cin >> s;
	cin >> t;
	if ((s.size() + 1) == t.size()) {
		for (int i = 0; i < s.size(); i++) {
			if (s[i] != t[i]) {
				ok = false;
			}

		}
	}
	else {
		ok = false;
	}

	if (ok == true) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(void){
    int M, D, i, j, c;
    scanf("%d%d", &M, &D);
    c=0;
    for (i=1; i<=M; i++) {
        for (j=1; j<=D; j++) {
            if (i==(j/10)*(j%10) && (j/10)>=2 && (j%10)>=2) c++;
        }
    }
    printf("%d", c);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main(int argc, char *argv[])
{
    int n,m;
    cin >> n >>m ;
    vector<int> v;
    LL total = 0;
    while(n--)
    {
        int x;
        cin >> x;
        v.push_back(x);
        total += x;
    }

    int cnt = 0;
    for(auto i : v)
    {
        if(i * 4 * m >= total) cnt++;
    }
    if(cnt < m)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;
    return 0;
}


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

int main() {
  int n,m;
  
  cin >> n >> m;
  vector<int> vec(n,0);

  int tmpNum;
  for(int i = 0; i < m; i++){
    for(int j = 0; j < 2; j++){
      cin >> tmpNum;
      vec.at(tmpNum-1) += 1;
    }    
  }
  
  for(int i = 0; i < n; i++) cout << vec.at(i) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX_N 100100
using namespace std;
struct point {
  int t, x, y;
}p[MAX_N];

int N;

bool cmp(point a, point b) {return a.t < b.t;}
int main () {
  scanf("%d", &N);
  for (int i = 1;i <= N; ++i) scanf("%d%d%d", &p[i].t, &p[i].x, &p[i].y);

  sort(p + 1, p + N + 1, cmp);

  for (int i = 1;i <= N; ++i) {
    int r = p[i].t - p[i].x - p[i].y;
    if (r < 0) {printf("No\n");return 0;}
    if (r % 2 == 1) {printf("No\n");return 0;}
  }
  printf("Yes\n");
  return 0 ;
}



Measured memory_bytes: 1408
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toLong() }
    if(a.contains(0L)) {
        println(0); return
    }
    var ans = 1L
    var d = 1.0
    a.forEach {
        d *= it.toDouble()
        ans *= it
        if(d > 2e18){
            println(-1); return
        }
    }
    if(ans > 1e18.toLong()) println(-1) else println(ans)
}

Measured memory_bytes: 61624
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    double w, h, x, y;
    double ans;

    cin >> w >> h >> x >> y;

    ans = w * h / 2;

    cout << ans << endl;

    if (x == w / 2 && y == h / 2)
    {
        cout << 1 << endl;
    }
    else
    {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
# encoding: utf-8
 
import sys
from collections import deque
 
input_ = sys.stdin.readlines()
 
 
def message_queue():
    # write your code here
    n, shard = map(int, input_[0].split())
 
    task_deque = deque(map(lambda x: x.split(), input_[1:]))
    t_accu = 0
 
    while task_deque:
        t_name, t_time = task_deque.popleft()
        t_time = int(t_time)
        if t_time <= shard:
            t_accu += t_time
            print(t_name, t_accu)
        else:
            t_time -= shard
            t_accu += shard
            task_deque.append([t_name, t_time])
 
 
message_queue()

Measured memory_bytes: 23820
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,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 mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long 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())
vector<pair<string,P> >vec;

const long long MAX_P = 200001;


// 入力はすべて正とする
// 素数判定O(√n)
bool is_prime(long long n) {
	for (long long i = 2; i * i <= n; i++) {
		if (n % i == 0) return false;
	}
	return n != 1; // 1の場合は例外
}
// 約数の列挙O(√n)
vector<long long> divisor(long long n) {
	vector<long long> res;
	for (long long i = 1; i * i <= n; i++) {
  	if (n % i == 0) {
			res.push_back(i);
			if (i != n / i) res.push_back(n / i);
		}
	}
	return res;
}
// 素因数分解O(√n)
map<long long, long long> prime_factor(long long n) {
	map<long long, long long> res;
	for (long long i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			++res[i];
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

long long extgcd(long long a, long long b, long long& x, long long& y) {
	long long d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	} else {
		x = 1; y = 0;
	}
	return d;
}

long long mod_inverse(long long a, long long m) {
	long long x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}

long long fact[MAX_P+1];
// n! mod pのテーブルを作る O(p)
void mod_fact(long long n, long long m) {
	fact[0] = 1;
	for (long long i = 1; i <= n; i++) fact[i] = fact[i-1]*i%m;
}

// n!=a p^e としたときのa mod pを求める。O(log_p n)
long long mod_fact(long long n, long long p, long long& e) {
	e = 0;
	if (n == 0) return 1;
	// pの倍数の部分を計算
	long long res = mod_fact(n / p, p, e);
	e += n / p;
	// (p-1)!≡-1なので(p-1)!^(n/p)はn/pの偶奇だけで計算できる
	if (n / p % 2 != 0) return res * (p - fact[n % p]) % p;
	return res * fact[n % p] % p;
}

// nCk mod pを求める。O(log_p n)
long long mod_comb(long long n, long long k, long long p) {
	if (n < 0 || k < 0 || n < k) return 0;
	long long e1, e2, e3;
	long long a1 = mod_fact(n, p, e1), a2 = mod_fact(k, p, e2), a3 = mod_fact(n - k, p, e3);
	//if (a1 * mod_inverse(a2 * a3 % p, p) % p == 0) printf("%lld, %lld, %lld,%lld, %lld, %lld\n",n, p, e1,a1, a2, a3);
	if (e1 > e2 + e3) return 0;
	return a1 * mod_inverse(a2 * a3 % p, p) % p;
}

int main(){	
	long long A;
	long long H;
	long long W;
	long long B;
	scanf("%lld",&H);
	scanf("%lld",&W);
	scanf("%lld",&A);
	scanf("%lld",&B);
    mod_fact(MAX_P,mod);
	ll res = 0;
	rep(i, H-A) {
		res = (res + mod_comb(i+B-1,i,mod)*mod_comb(W-1-B+H-1-i,H-1-i,mod)%mod)%mod;
	}
	cout << res << endl;

	return 0;
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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 h,w;cin >> h >>w;
    vvl g(h,vl(w));
    rep(i,h){
        rep(j,w){
            cin >> g[i][j];
            g[i][j]%=2;
        }
    }
    vector<pair<pl,pl>> ans;
    rep(i,h){
        if(i%2==0){
            rep(j,w-1){
                if(g[i][j]){
                    ans.pb({{i,j},{i,j+1}});
                    g[i][j+1]++;
                    g[i][j+1]%=2;
                }
            }
            if(g[i][w-1]){
                if(i+1<h){
                    ans.pb({{i,w-1},{i+1,w-1}});
                    g[i+1][w-1]++;
                    g[i+1][w-1]%=2;
                }
            }
        }
        else{
            per(j,w-1){
                if(g[i][j+1]){
                    ans.pb({{i,j+1},{i,j}});
                    g[i][j]++;
                    g[i][j]%=2;
                }
            }
            if(g[i][0]){
                if(i+1<h){
                    ans.pb({{i,0},{i+1,0}});
                    g[i+1][0]++;
                    g[i+1][0]%=2;
                }
            }
        }
    }
    cout << ans.size() <<endl;
    for(auto p:ans){
        cout << p.fi.fi+1 <<" " << p.fi.se+1 <<" "<<p.se.fi+1 << " " << p.se.se+1 <<endl;
    }
}

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

#define int long long int
#define ff first
#define ss second
#define pb push_back


int bexp(int a, int b)
{
	int res = 1;

	while (b)
	{
		if (b & 1) res = (res * a);

		a = (a * a); 
		b >>= 1;
	}
	return res;
}

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

#define N 500010
#define MOD 1000000007

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(10);

	string s;
	cin >> s;

	if (s[0] == s[1] && s[1] == s[2])
		cout << "No\n";
	else
		cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

const int MAX = 100 + 5;
const int INF = (int) 1e9;
int memo[MAX][MAX];
char grid[MAX][MAX];
int n, m;

int cost(int x, int y, int a, int b) {
    return grid[x][y] == '.' && grid[a][b] == '#';
}

int roll(int x, int y) {
    if (x == n && y == m) {
        return 0;
    }
    int &ans = memo[x][y];
    if (~ans) {
        return ans;
    }
    ans = INF;
    if (x + 1 <= n) {
        ans = min(ans, roll(x + 1, y) + cost(x, y, x + 1, y));
    }
    if (y + 1 <= m) {
        ans = min(ans, roll(x, y + 1) + cost(x, y, x, y + 1));
    }
    return ans;
}

void solve() {
    cin >> n >> m;
    fori (i, 1, n + 1) {
        fori (j, 1, m + 1) {
            cin >> grid[i][j];
        }
    }
    memset(memo, -1, sizeof memo);
    cout << roll(1, 1) + (grid[1][1] == '#') << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}



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

const int nm = 2e5;
int n, ans = 0;
ll d, x, y;

int main() {
	cin >> n >> d;
	for (int i = 0; i < n; ++i) {
		cin >> x >> y;
		if (x * x + y * y <= d * d)
			++ans;
	}

	cout << ans << endl;

}


Measured memory_bytes: 3592
import Text.Printf
solv' :: [Float] -> [Float]
solv' (a:b:c:d:e:f:_) = map (\(x:y:_)-> x * c + f * y) . map (map (*(1 / (a*e-b*d)))) $ [[e, -b], [-d, a]]

solv :: String -> String
solv l = printf "%.3f %.3f" x y
    where (x:y:_) = solv' . map read . words $ l

main = interact (unlines . map solv . lines)

Measured memory_bytes: 4340
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n, k, x, y;
  cin >> n >> k >> x >> y;
  if (n < k)
    cout << n * x << endl;
  else
    cout << k * x + (n - k) * y << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main(void){
    string s;
    int a0 = 0, a1 = 0;
    int b0 = 0, b1 = 0;

    cin >> s;

    for(int i = 0; i < s.length(); i += 2){
        if(s[i] == '0'){
            a0++;
        }
        else{
            a1++;
        }
    }

    for(int i = 1; i < s.length(); i += 2){
        if(s[i] == '0'){
            b0++;
        }
        else{
            b1++;
        }
    }

    int ans = 0;
    int ans1 = 0; // 奇数0
    int ans2 = 0; // 奇数1

    for(int i = 0; i < s.length(); i += 2){
        if(s[i] != '0'){
            ans1++;
        }
    }

    for(int i = 1; i < s.length(); i += 2){
        if(s[i] == '0'){
            ans1++;
        }
    }

    for(int i = 0; i < s.length(); i += 2){
        if(s[i] != '1'){
            ans2++;
        }
    }

    for(int i = 1; i < s.length(); i += 2){
        if(s[i] == '1'){
            ans2++;
        }
    }

    cout << min(ans1, ans2) << endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main()
{
	int rect_cnt = 0;
	int lzng_cnt = 0;
	int a, b, c;
	char dummy;
	
	while ( cin >> a >> dummy >> b >> dummy >> c ) {
		if (a==b) {
			lzng_cnt++; continue;
		}
		if ( a*a + b*b == c*c ) rect_cnt++;
	}
	
	cout << rect_cnt << endl << lzng_cnt << endl;
	
	return 0;
}

Measured memory_bytes: 3028
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from functools import reduce
from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
def lcm(a, b):
  return a*b//gcd(a, b)


def main():
  n = int(input())
  head_tail = [[0]*10 for _ in range(10)]
  for i in range(1, n+1):
    s = str(i)
    h = int(s[0])
    t = int(s[-1])
    head_tail[h][t] += 1
  ans = 0
  for h in range(1,10):
    for t in range(1,10):
      ans += head_tail[h][t] * head_tail[t][h]
  print(ans)
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 14544
N = gets.to_i
L = gets.split.map(&:to_i).sort
SZ = L.size

ans = 0
(0...SZ-2).each do |i|
  (i+1...SZ-1).each do |j|
    (j+1...SZ).each do |k|
      a,b,c = L[i], L[j], L[k]
      next if a == b || a == c || b == c
      next if a + b <= c
      ans += 1
    end
  end
end
puts ans


Measured memory_bytes: 14300
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<double > a(n);
	rep(i,n) cin >> a.at(i);
	double ans = 0;
	rep(i,n) ans += 1 / a.at(i);
	cout << setprecision(20) << fixed << 1 / ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define low lower_bound
#define upp upper_bound
#define inf 1000000007 //10^9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort(all(vec));
#define rever(vec) reverse(all(vec));
#define unsort(vec) sort(vec); rever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
signed main() {
  int a,b;
  cin>>a>>b;
  if(b%a==0) cout<<a+b<<endl;
  else cout<<b-a<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int pos[1000001],p[100000],size;

bool isPrime(int x){
	for(int i=0;i<size && p[i]<=sqrt(x);i++){
		if(x % p[i] == 0) return false;
	}
	return true;
}

void mkPrime(void){
	memset(pos,-1,sizeof(pos));
	p[0] = 2;
	pos[0] = pos[1] = pos[2] = 0;
	size = 1;

	for(int i=3;i<=999983;i++){
		if(isPrime(i)){
			p[size] = i;
			for(int j=i;pos[j]==-1;j--) pos[j] = size;
			size++;
		}
	}

	for(int i=999984;i<=1000000;i++){
		pos[i] = size;
	}
}

int calX(int from,int to){
	int res = 0;
	for(int i=pos[from];i < size && p[i]<=to;i++,res++);
	return res;
}

int main(void){
	int n;

	mkPrime();

	while(scanf("%d",&n) && n){
		int ans = 0;
		while(n--){
			int p,m;
			scanf("%d%d",&p,&m);
			int count = calX(p-m<0?0:p-m, p+m>1000000?1000000:p+m);
			if(count > 0) ans += count - 1;
			else if(count == 0) ans--;
		}

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

	return 0;
}

Measured memory_bytes: 4984
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"

using namespace std;

//constexpr long long int MOD = 1000000007;
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

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

	cin >> N >> K;
	for (int i = 4; i <= N; i++) {
		for (int j = 22; j <= K; j++) {
			int a = j % 10;
			int b = j / 10;
			if (a < 2)continue;
			if (a*b == i)M++;
		}
	}
	cout << M << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Phuong ios_base::sync_with_stdio(0); cin.tie(0);
#define mpp make_pair
#define pb push_back

typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<int,int> pii;

/// problem's variable


///--------------------



int main()
{
    Phuong;
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0; i<n; ++i) cin >> a[i];
    for(int i=1; i<n; ++i) a[i]+=a[i-1];
    int maxx=0;
    for(int i=k-1; i<n; ++i)
    {
        int sum = a[i];
        if (i>k-1) sum -= a[i-k];
        maxx=max(maxx,sum);
    }
    cout << setprecision(10) << fixed << double(k+maxx)/2 ;
    return 0;
}


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

int n;
vector<int> g[8];

int dfs(int v,int x) {
    if (x==(1<<n)-1)
        return 1;
    int c=0;
    for (int u:g[v]) {
        if (~x&1<<u)
            c+=dfs(u,x|1<<u);
    }
    return c;
}

int main() {
    int m;
    cin>>n>>m;
    while (m--) {
        int v,u;
        cin>>v>>u;
        v--,u--;
        g[v].push_back(u);
        g[u].push_back(v);
    }
    cout<<dfs(0,1)<<endl;
    return 0;
}

Measured memory_bytes: 256
INFTY = 10**5+10
N,M = map(int,input().split())
L = [list(map(int,input().split())) for _ in range(M)]
G = {i:[] for i in range(1,N+1)}
dist = [[INFTY for _ in range(N+1)] for _ in range(N+1)]
for j in range(M):
    a,b,c = L[j]
    G[a].append(b)
    G[b].append(a)
    dist[a][b] = c
    dist[b][a] = c
for k in range(1,N+1):
    for i in range(1,N+1):
        for j in range(1,N+1):
            dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j])
cnt = 0
for j in range(M):
    a,b,c = L[j]
    if dist[a][b]<c:
        cnt += 1
print(cnt)

Measured memory_bytes: 68168
M1,D1 = map(int,input().split())
M2,D2 = map(int,input().split())

if (D2 == 1):
  #偶数,奇数
  print(1)
else:
  print(0)

#print(M1)
#print(D1)
#print(M2)
#print(D2)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
//#define int   long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int>
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >
#define vpl vector< pair<ll,ll> >
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define cd complex<double>
#define PI 4*atan(1)
#define mod %1000000007
#define pi 3.14159265358979323846//20 decimals
#define ld long double
#define M 100000008

int main()
{
	FAST;
	ll n, m, i, j;
	cin >> n >> m;
	pair <ll ,ll> p[m];
	fr(i,0,m)
		cin >> p[i].ss >> p[i].ff;
	sort(p, p+m);
	ll t1 = p[0].ff;
	ll z = 0, mx = -1;
	fr(i,0,m)
		if(p[i].ss > mx)
			mx = p[i].ss;
	if(mx > t1)
		cout << "0";
	else
		cout << t1 - mx + 1;	
	
}


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

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


Measured memory_bytes: 256
#include <stdio.h>

int SelectioSort(int A[], int N){
  int i,j,t,sw = 0,minj;
  
  for( i = 0; i < N -1; i++){
    minj = i;
    for( j = i; j < N; j++){
      if( A[j] < A[minj])
	minj = j;
    }
    t = A[i]; A[i] = A[minj];
    A[minj] = t;
    if(i != minj)
      sw++;
	}
  return sw;
    }

int main(){
  int A[100],N,i,sw;

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

  sw = SelectioSort(A,N);

  for( i = 0; i < N; i++){
    if( i > 0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",sw);

  return 0;
}



Measured memory_bytes: 2044
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <map>
#include <string.h>

using namespace std;

int main()
{
    int n;
    char str[10];
    int cnt[5] = {0};

    scanf("%d", &n);
    while(n--){
        scanf("%s", str);
        if(strcmp(str, "AC") == 0){
            cnt[0]++;
        }
        else if(strcmp(str, "WA") == 0){
            cnt[1]++;
        }
        else if(strcmp(str, "TLE") == 0){
            cnt[2]++;
        }
        else if(strcmp(str, "RE") == 0){
            cnt[3]++;
        }
    }
    printf("AC x %d\n", cnt[0]);
    printf("WA x %d\n", cnt[1]);
    printf("TLE x %d\n", cnt[2]);
    printf("RE x %d\n", cnt[3]);
}


Measured memory_bytes: 1736
#include <iostream>
#include <string>

#include <math.h>

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

using namespace std;

int main() {
	int A, B,H,M;
	cin >> A >> B >> H >> M;

	double ar = (H * 60 + M) * 360.0 / (12 * 60);
	double br = M * 360 / 60;

	double r = abs(ar - br);

	if (r > 180) {
		r = 360 - r;
	}
	double PI = acos(-1);

	//cout << double(r) / 180.0 * PI;

	double ans = sqrt(A * A + B * B - 2 * A*B*cos(r / 180.0 * PI));

	//cout << ans;
	printf("%.10f",ans);
	//cin >> A;

	return 0;

}

Measured memory_bytes: 4144
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int N;
vector<int> A;

int main(){
  cin>> N;
  A.resize(N);
  rep(i,0,N - 1) cin >> A[i];

  int ans = 0;
  rep(i,0,N - 1){
    int a = A[i];
    while(a % 2 == 0){
      a /= 2;
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using  namespace std;
#define ll    long long int
#define pai     pair<int,int>
#define vi      vector<int>
#define vd      vector<double>
#define mpi     map<int,int>
#define mps     map<string,int>
#define sti     stack<int>
#define stc     stack<char>
#define sei     set<int>
#define ses     set<string>
#define multii  multiset<int>

 int main()
{
  /*#ifndef ONLINE_JUDGE
  freopen("tin.txt","r",stdin);
  freopen("tout.txt","w",stdout);
  #endif*/
  ll t;
  cin>>t;

  while(t--){
  ll a,b,c;
  cin>>a>>b>>c;
  if(((a*a)+(b*b)==(c*c))||((a*a)+(c*c)==(b*b))||((b*b)+(c*c)==(a*a))){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }

  }

}







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

int main()
{
    string s;
    cin>>s;
    int cnt=0;
    int ans=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='R')
            cnt++;
        else cnt=0;
        ans=max(ans,cnt);
    }
    printf("%d\n",ans);
    return 0;
}


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

using namespace std;
int n,a[100005],x,y,ans; 
int main()
{
 //freopen(".in","r",stdin);
 //freopen(".out","w",stdout);
 cin>>n;
 for(int i=1;i<=n;i++){
 	cin>>x>>y;
 	for(int j=x;j<=y;j++){
 		a[j]++;
 	}
 }
 for(int i=1;i<=100000;i++){
 	if(a[i]!=0) ans++;
 }
 cout<<ans;
 
 return 0;
}


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

#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define all(x) (x).begin(),(x).end()

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

int main() {
	int n;
	cin >> n;

	int ans = 0;
	int cnt = 0;
	int x;
	for(int i = 1; i <= n; i++){
		x = i;
		cnt = 0;
		while(x!=0){
			x = x / 10;
			cnt++;
		}
		if(cnt % 2 == 1){
			ans ++;
		}
	}
	cout << ans << endl;


    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  char table[5][6];
  char c='a';
  for(int j=0;j<5;j++){
    for(int i=0;i<5;i++){
      table[i][j]=c;
      c++;
    }
  }
  table[0][5]='z';table[1][5]='.';table[2][5]='?';table[3][5]='!';table[4][5]=' ';
 
  string s;
  while(cin>>s){
    int flag=0;
    for(int i=0;i<s.size();i+=2){
      if(s[i]>'6' || s[i]<'1' || s[i+1]>'5' || s[i+1]<'1'){
	flag=1;
      }
    }
    if(s.size()%2==0 && flag==0){
      //cout<<s.size()<<endl;
      for(int i=0;i<s.size();i+=2){
	cout<<table[s[i+1]-'0'-1][s[i]-'0'-1];
      }
      cout<<endl;
    }else{
      cout<<"NA"<<endl;
    }
  }
}
  

Measured memory_bytes: 1176