akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define td(v) v.begin(),v.end()
#define sz(v) (int)v.size()
//#define M   1000000007 // 1e9 + 7
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline ll mod(ll n, ll m){ ll ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0LL ? a : gcd(b, a%b));}
ll exp(ll a,ll b,ll m){
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}

const int N = 200100;
vector<int> g[N];
int vis[N];
int pai[N];

int in[N];
int tam=0;
vector<int> cic;
void dfs(int v,int t){
  if(vis[v]){
    // ciclo
    int cur = pai[v];
    while(cur!=v){
      cic.pb(cur);
      in[cur] = 1;
      cur = pai[cur];
    }
    cic.pb(v);
    in[v] = 1;
    tam = cic.size();
    reverse(cic.begin(),cic.end());
    return;
  }
  vis[v] = t;
  pai[g[v][0]] = v;
  dfs(g[v][0],t + 1);
}

int k;
int res;
int ini;
int dfs2(int v,int t){
  if(t==k){
    cout << v << endl;
    exit(0);
  }
  if(in[v]){
    ini = v;
    return t;
  }
  return dfs2(g[v][0],t+1);
}

int32_t main(){
  fastio;
  int n;
  cin>>n>>k;
  for(int i=1;i<=n;i++){
    int x;
    cin>>x;
    g[i].pb(x);
  }

  dfs(1,1);
  memset(vis,0,sizeof(vis));
  int dist = dfs2(1,0);

  k-=dist;
  k%=tam;
  vector<int> c;
  for(int i=0;i<cic.size();i++){
    if(cic[i]== ini){
      for(int j=i;;j = (j+1)%tam){
        if(c.size() == cic.size())break;
        c.pb(cic[j]);
      }

        break;
    }
  }
  
  cout << c[k] << endl;

  // Math -> gcd it all
  // Did u check N=1? Did you switch N,M?
}

Measured memory_bytes: 33284
N = int(input())
A = list(map(int, input().split())) 
B = "APPROVED"

for i in range(N):
  if A[i] % 2 == 0:
    if (A[i] % 3 != 0) and (A[i] % 5 != 0):
      B = "DENIED"
print(B)
    

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
#define forn(a, e) for (int a = 0; a < (int)(e); a++)
#define forr(a, s, e) for (int a = s; a < (int)(e); a++)
#define fore(e, a) for (auto& e : a)
 
#ifdef LOCAL
#define logv(a) {cerr << #a << " = "; fore(e, a) {cerr << e << " ";} cerr << "\n";}
#define logvp(a) {cerr << #a << " = "; fore(e, a) {cerr << "(" << e.first << ", " << e.second << ") ";} cerr << "\n";}
#define logvv(a) {cerr << #a << " = \n"; fore(r, a) { fore(e, r) {cerr << e << " ";} cerr << "\n";} }
#define logvf(a, field) {cerr << #a"."#field << " = \n"; fore(e, a) { cerr << e.field << " ";} cerr << "\n"; }
#define logvff(a, f1, f2) {cerr << #a".{"#f1 << ", "#f2 << "} = \n"; fore(e, a) { cerr << "(" << e.f1 <<", " << e.f2 << ") ";} cerr << "\n"; }
#define logs(a) cerr << #a << " = " << (a) << "\n";
#define logss(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << "\n";
#define logp(a) cerr << #a << " = " << "(" << a.first << ", " << a.second << ")" << "\n";
#define cond(pred, stmt) if (pred) { stmt }
#else
#define logv(a)
#define logvp(a)
#define logvv(a)
#define logvf(a, field)
#define logvff(a, f1, f2)
#define logs(a)
#define logss(a, b)
#define logp(a)
#define cond(pred, stmt)
#endif
 
using i64 = long long;
using iip = pair<i64, i64>;
using ivec = vector<int>;
using llvec = vector<i64>;
using svec = vector<string>;
template<typename T> using vec = vector<T>;
 
template<typename T, typename Dim>
auto make_vec(T value, Dim dim) { return vector<T>(dim, value); }
template<typename T, typename Dim1, typename... Dim>
auto make_vec(T value, Dim1 dim1, Dim... dims) { return make_vec(make_vec(value, dims...), dim1); }
 
template<typename T>
bool uax(T& v, const T& newv) { if (v < newv) { v = newv; return true; } else return false; }
template<typename T>
bool uin(T& v, const T& newv) { if (v > newv) { v = newv; return true; } else return false; }
 
template<typename T>
istream& operator>>(istream& is, vector<T>& c) { for (auto& e : c) is >> e; return is; }
 
// template<typename ...T>
// istream& read(T&... args) { return (cin >> ... >> args); }
 
static mt19937 rande(123123);
template<typename T>
T rand_int(T from, T to) { uniform_int_distribution<T> distr(from, to); return distr(rande); }
i64 gcd (i64 a, i64 b) {
	if (b == 0)
		return a;
	else
		return gcd (b, a % b);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
 
  int n;
  while (cin >> n) {
    ivec a(n);
    forn(i, n) {
      cin >> a[i];
    }

    int c = 0;
    int last = 0;
    forn(i, n) {
      if (a[i] == last + 1) {
        last = a[i];
        c++;
      }
    }
    if (c == 0) {
      cout << -1 << endl;
    } else {
      cout << n - c << endl;
    }
  }
}

Measured memory_bytes: 1024
fun main(args: Array<String>) {
    fun minDistance(i: Int, j: Int, x: Int, y: Int): Int {
        return Math.min(j - i, Math.min(Math.abs(x - i) + 1 + Math.abs(j - y), Math.abs(y - i) + 1 + Math.abs(j - x)))
    }
    val (n, x, y) = readLine()?.split(" ")?.map(String::toInt) ?: return

    val distances = hashMapOf<Int, Int>()
    0.until(n - 1).forEach { i ->
        (i + 1).until(n).forEach { j ->
            val distance = minDistance(i + 1, j + 1, x, y)
            distances[distance] = distances[distance]?.let { it + 1 } ?: 1
        }
    }
    1.until(n).forEach { i ->
        println(distances[i] ?: 0)
    }
}

Measured memory_bytes: 66964
import java.util.Arrays;
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int N=sc.nextInt();
		int[] origin=new int[N];
		for(int i=0; i<N; i++) {
			origin[i]=sc.nextInt();
		}

		int res=selection_sort(origin,N);
		Arrays.sort(origin);
		String a="";
		for(int i=0; i<N*2-1; i++) {
			if(i%2==0) {
				a=a+origin[i/2];
			}
			else {
				a=a+" ";
			}
		}
		System.out.println(a);
		System.out.println(res);

	}

	public static int selection_sort(int[] array,int N) {
		int vol=array.length;
		int mini=0;
		int tmp1=0; int tmp2=0;
		int counter=0;
		for(int i=0; i<N; i++) {
			mini=i;
			for(int j=i; j<N; j++) {
				if(array[j]<array[mini]) {
					mini=j;
				}
			}
			if(i!=mini) {
				counter++;
				tmp1=array[i];
				tmp2=array[mini];
				array[i]=tmp2;
				array[mini]=tmp1;
			}
		}
		return counter;
	}
}


Measured memory_bytes: 26440
def factorization(n):
    res = set()
    tmp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if tmp % i == 0:
            while tmp % i == 0:
                tmp //= i
            res.add(i)
    if tmp != 1:
        res.add(tmp)
    if not res:
        res.add(n)
    return res

a, b = map(int,input().split())
ans = factorization(a) & factorization(b) | {1}
print(len(ans))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
using ll = long long;
ll inf = 100000000007ll;

class RollingHash {
  const int n;
  static const ll moda = 1000000000000037LL;
  static const ll modb = 1000000000000091LL;
  static const ll pa = 17LL;
  static const ll pb = 19LL;
  std::vector<ll> a, b, p, q;

public:
  template <typename string_t>
  RollingHash(const string_t &str) :
    n(str.size()), a(n + 1, 0), b(n + 1, 0), p(n + 1, 1), q(n + 1, 1) {
    for (int i = 0; i < n; ++i) {
      a[i + 1] = (a[i] * pa + ll(str[i])) % moda;
      b[i + 1] = (b[i] * pb + ll(str[i])) % modb;
      p[i + 1] = p[i] * pa % moda;
      q[i + 1] = q[i] * pb % modb;
    }
  }
  std::pair<ll, ll> query(int l, int r) {
    return std::make_pair(((__int128)p[r - l] * a[l] - a[r] + moda) % moda,
                          ((__int128)q[r - l] * b[l] - b[r] + modb) % modb);
  }
};

int main(void)
{
  int n;
  string s;
  cin >> n >> s;
  RollingHash rh(s);
  ll l = 0;
  ll r = n+1;
  while(r-l>1) {
    ll piv = (l+r)/2;
    bool flag = false;
    map<pair<ll,ll>, ll> pos;
    REP(i,n-piv+1) {
      auto ha = rh.query(i,i+piv);
      if(pos.count(ha)) {
        if(pos[ha] <= i - piv) flag = true;
      } else {
        pos[ha] = i;
      }
    }
    if(flag) l = piv;
    else r = piv;
  }
  cout << l << endl;
  return 0;
}


Measured memory_bytes: 768
N,M = list(map(int,input().split()))
higher = list(map(int,input().split()))
safety = [0] * (N)
for i in range(M):
    B = list(map(int,input().split()))
    if higher[B[0]-1] > higher[B[1]-1]:
        safety[B[1]-1] = 1
    elif higher[B[1]-1] > higher[B[0]-1]:
        safety[B[0]-1] = 1
    elif higher[B[1]-1] == higher[B[0]-1]:
        safety[B[0]-1] = 1
        safety[B[1]-1] = 1
print(N-sum(safety))

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

int main() {
  ios::sync_with_stdio(false); 
  cin.tie(0);
  long long k;
  cin >> k;
  const int MAXN = 1e8;
  long long cur = 0;
  for (int i = 1; i <= MAXN; i++) {
    cur = (cur * 10 + 7) % k;
    if (cur == 0) 
      return cout << i << endl, 0;
  }
  cout << "-1\n";
  return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve();
        }

        void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            Console.WriteLine(n > 999 ? "ABD" : "ABC");
        }

    }
}


Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int K=sc.nextInt();
        int A=sc.nextInt();
        int B=sc.nextInt();
        for(int i=0; i<2000; i++){
            int tmp = K * (i+1);
            if( tmp >= A && tmp <= B){
                p("OK");
                System.exit(0);
            }
        }
        p("NG");

    }
    public static void p(Object o){
        System.out.println(o);
    }
}


Measured memory_bytes: 35844
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int main(){
	int n;
	scanf("%d",&n);
	int ans=0;
	rep(i,0,n){
		int t;
		scanf("%d",&t);
		if(t==ans+1)ans++;
	}
	printf("%d",ans?n-ans:-1);
}

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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n;
  cin >> n;
  vector<P> p(n);
  rep(i, n) {
    cin >> p[i].first >> p[i].second;
  }

  ll ans = 0;

  vll v(n);
  rep(i, n) {
    v[i] = p[i].first + p[i].second;
  }
  sort(all(v));

  chmax(ans, v[n - 1] - v[0]);

  rep(i, n) {
    p[i].first = mod - p[i].first;
  }

  rep(i, n) {
    v[i] = p[i].first + p[i].second;
  }
  sort(all(v));

  chmax(ans, v[n - 1] - v[0]);

  cout << ans << endl;

  return 0;
}


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


//c++ templte for help............................................................................................................................................
typedef long long ll;

//template<typename... T>
//void print1(T... t){
	//((cout<<t<<" "),...);
//}

//template<typename... T>
//void print2(T... t){
		//vector<vector<ll>> ans={t...};
		//for(ll i=0;i<(ll)ans.size();i++){
			//if(i!=0) cout<<"\t\t";
			//else cout<<"\t";
			//for(ll j=0;j<(ll)ans[i].size();j++){
				//cout<<ans[i][j]<<" ";
			//}
			//if(i!=(ll)ans.size()-1)
			//cout<<endl;
		//}
//}	
//#define deb(...) cout<<" [ "#__VA_ARGS__<<" : "; print1(__VA_ARGS__); cout<<"]"<<endl; 
//#define vdeb(...) cout<<" [ "#__VA_ARGS__<<" : "; print2(__VA_ARGS__); cout<<"]"<<endl;





	
 
//for loop
//#define fo(i,n) for(int i=0;i<(ll)n;i++)
//#define Fo(i,k,n) for(int i=k;i<n;i++)
 
 
//to print vector element 
//template<typename T>
//void printV(T vec){
	//fo(i,vec.size()) cout<<vec[i]<<" "<<flush;
	//cout<<endl;
	//}
	
 
#define M int(1e9+7)
const int INF=1e9+5;
 
//iterate map
//template<typename T>
//void itR(T map){
	 //for(auto itr=map.begin();itr!=map.end();itr++){
				//deb(itr->first,itr->second);
			//}
	//cout<<endl;
//}


 
 
 
//c++ template for help...........................................................................................................................................


void solve(){
	ll n;
	cin>>n;
	map<string,ll> mp;
	mp["AC"]=0;
	mp["TLE"]=0;
	mp["RE"]=0;
	mp["WA"]=0;
	for(int i=0;i<n;i++){
		string a;
		cin>>a;
		
		mp[a]++;
	}
	
	vector<string> s={"AC","WA","TLE","RE"};
	for(string x:s){
		cout<<x<<" x "<<mp[x]<<endl;
	}
}

int main() {
	//stringstream ss;
	//ss<<"akhil";
	//cout<<ss.str()<<endl;
	cout<<setprecision(10);
	ios::sync_with_stdio(0);
	cin.tie(0);
	

	//ll testCase;
	//cin>>testCase;
	//for(ll tt=0;tt<testCase;tt++){
		solve();
		//ll ans=solve();
		//cout<<ans<<endl;
	//}
	return 0;
}


Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(void){
    int table[200][200]={{0}};    
    int r,c;
    cin >> r >> c;
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            cin >> table[i][j];
        }
    }
    
    for(int i=0;i<r+1;i++){
        int sum=0;
        for(int j=0;j<c;j++){
            sum+=table[i][j];   //sum=sum+table[i][j]
        }
        table[i][c]=sum;
    }
    
    for(int i=0;i<c+1;i++){
        int sum=0;
        for(int j=0;j<r;j++){
            sum+=table[j][i];   //sum=sum+table[j][i]
        }
        table[r][i]=sum;
    }
    
    for(int i=0;i<r+1;i++){
        for(int j=0;j<c;j++){
            cout << table[i][j] << " ";
        }
        cout << table[i][c] << endl;
    }
}


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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, b, e) for (i64 i = (b); i <= (e); ++i)
#define repr(i, b, e) for (i64 i = (b); i >= (e); --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

#ifdef DEBUG
#define dump(...) dump_(#__VA_ARGS__, __VA_ARGS__);
#else
#define dump(...)
#endif

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// input
void input() {}
template <class Head, class... Tail>
void input(Head&& head, Tail&&... tail) {
  cin >> head;
  input(forward<Tail>(tail)...);
}

// outs
void outs() {}
template <class Head, class... Tail>
void outs(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  outs(forward<Tail>(tail)...);
}

template <class T>
void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void outs(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// outl
void outl() {}
template <class Head, class... Tail>
void outl(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  outl(forward<Tail>(tail)...);
}

template <class T>
void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// outn
void outn() {}
template <class Head, class... Tail>
void outn(Head&& head, Tail&&... tail) {
  cout << head;
  outn(forward<Tail>(tail)...);
}

template <class T>
void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

// dump
template <class T>
void dump_(const char *s, T&& x) {
  clog << '{';
  while(*s != '\0') clog << *(s++);
  clog << ": " << x << '}' << "\n";
}

template <class Head, class... Tail>
void dump_(const char *s, Head&& head, Tail&&... tail) {
  clog << '{';
  while(*s != ',') clog << *(s++);
  clog << ": " << head << "}, ";
  for (++s; !isgraph(*s); ++s);
  dump_(s, forward<Tail>(tail)...);
}
// }}} End

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

  var(int, H, W, h, w);
  outl((H - h) * (W - w));

  return 0;
}


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

int main(){
    int n;
    cin>> n;
    string s;
    cin >> s;
    int w=0,b=0;
    int flag = 0;
    for(int i = 0; i < n; i++)
    {
        if(s[i]=='#'){
            b++;
        }else{
            w++;
        }
    }
    int ans = n;

    for(int i = 0,wt=0,bt=0; i < n+1; i++)
    {
        ans = min(ans,bt+w-wt);
        if(i<n){
            if(s[i]=='#'){
                bt++;
            }else{
                wt++;
            }
        }
    }
    
    
    cout << ans <<endl;
    return(0);
}

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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-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 N;
int A[200005];

map<int,int> mp;
int dp[200005];

signed main(){
    cin>>N;
    for(int i=1;i<=N;++i){
        cin>>A[i];
        dp[i]=dp[i-1]+mp[i-A[i]];
        mp[A[i]+i]++;
    }
    cout<<dp[N]<<endl;
}

Measured memory_bytes: 29396
from collections import defaultdict
def main():
    n = int(input())
    A = list(map(int, input().split()))
    d = defaultdict(int)
    for a in A:
        B = list(f'{a:030b}')
        for i, b in enumerate(B):
            if b == '1':
                d[i] += 1
    ANS = []
    for a in A:
        B = list(f'{a:030b}')
        ans = 0
        for i, b in enumerate(B):
            if b == '1':
                k = d[i] - 1
            else:
                k = d[i]
            if k % 2 == 1:
                ans += pow(2, 29 - i)
        ANS.append(str(ans))
    print(' '.join(ANS))





if __name__ == '__main__':
    main()


Measured memory_bytes: 112340
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  int N;
  in(N);
  vector<int>d(N);
  ins(d);
  ull ans=0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      ans+=d[i]*d[j];
    }
  }
  out(ans);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#pragma warning(disable:4996)
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
using mint = boost::multiprecision::cpp_int; //int1024_t etc...
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;

TPL<TNM T> inline bool chmin(T&a, T&b) { if (a > b) { a = b; return true; } return false; }
TPL<TNM T> inline bool chmax(T&a, T&b) { if (a < b) { a = b; return true; } return false; }
TPL<TNM V, TNM H> void resize(vector<V>& _v, const H _h) { _v.resize(_h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& _v, const H& _h, const T& ... _t) { _v.resize(_h); for (auto& __v : _v) resize(__v, _t ...); }
TPL<TNM V, TNM T> TNM enable_if<!is_class<V>::value, void>::type fill(vector<V>& _v, const T &_t) { std::fill(ALL(_v), _t); }
TPL<TNM V, TNM T> TNM enable_if<is_class<V>::value, void>::type fill(vector<V>& _v, const T &_t) { for (auto &_e : _v) fill(_e, _t); }
TPL<TNM T> inline void UNIQUE(vector<T>& _v) { sort(ALL(_v)); _v.erase(unique(ALL(_v)), _v.end()); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

int main(void) {
	int N;
	cin >> N;
	vec<int> V(N), C(N);
	for (int i = 0; i < N; ++i) {
		cin >> V[i];
	}
	for (int i = 0; i < N; ++i) {
		cin >> C[i];
	}
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		if (V[i] > C[i]) {
			ans += V[i] - C[i];
		}
	}
	cout << ans << endl;

	return 0;
}


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

flag = 0
y = 1000

for i in range(1,N):
    if A[i-1] < A[i] and flag == 0:
        x = y//A[i-1]
        y = y % A[i-1]
        flag = 1
    if (A[i-1] > A[i]) and flag == 1:
        y = y + A[i-1]*x
        flag = 0
    if flag == 1 and i == N-1:
        y = y + A[i]*x

print(y)

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

int main() { 
  int N;
  cin >> N;
  
  vector<int> p(N);
   for (int i = 0; i < N; i++) {
    cin >> p.at(i);
  }  
  int NIBAN=0;
  for (int i = 0; i < N-2; i++) {
     if (p.at(i) > p.at(i+1) && p.at(i+1) > p.at(i+2)) {
     NIBAN++;
    } 
     else if (p.at(i) < p.at(i+1) && p.at(i+1) < p.at(i+2)) {
     NIBAN++;   
    }
  } 
  cout << NIBAN << endl;  
} 

Measured memory_bytes: 256
from collections import Counter


def main():
    """
    Aの空でない連続する部分列であって、
    その総和が 0になるものの個数を求めてください。
    ただし、ここで数えるのは 部分列の取り出し方 であることに注意してください。
    つまり、ある2つの部分列が列として同じでも、
    取り出した位置が異なるならば、それらは別々に数えるものとします。

    制約
        1 ≤ N ≤ 2×10^5
        −10^9 ≤ Ai ≤ 10^9
    """
    N = int(input())
    *A, = map(int, input().split())

    # f2(N, A)
    editorial(N, A)


def editorial(N, A):
    """
    部分列の和が0: 累積和の両端が同じ数であること
    """
    s = [0]
    for i in range(N):
        s.append(A[i] + s[-1])

    def ncr(n, r):
        if n < r:
            return 0
        from math import factorial as f
        # rまでの並べ方について,組合せなので1/r
        return f(n) // f(n - r) // f(r)

    c = Counter(s)
    ans = 0
    for v in c.values():
        ans += ncr(v, 2)

    print(ans)


if __name__ == '__main__':
    main()


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll n,k;
vll a;

bool isOk(ll mid){
  ll cnt=0;
  
  rep(i,n-1){
    if(a[i]>0){
      if(a[i]*a[i+1]>mid) continue;
      ll ok=i+1, ng=n;
      while(abs(ok-ng)>1){
        ll m=(ok+ng)/2;
        if(a[i]*a[m]<=mid) ok=m;
        else ng=m;
      }
      cnt+=ok-i;
    }else if(a[i]<0){
      if(a[i]*a[n-1]>mid) continue;
      ll ok=n-1, ng=i;
      while(abs(ok-ng)>1){
        ll m=(ok+ng)/2;
        if(a[i]*a[m]<=mid) ok=m;
        else ng=m;
      }
      cnt+=n-ok;
    }else{
      if(mid>=0){
        cnt+=n-i-1;
      }
    }
  }
  
  return cnt>=k;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  cin>>n>>k;
  a.resize(n);
  rep(i,n) cin>>a[i];
  vsort(a);
  
  ll ok=1e18, ng=-1e18-1;
  while(abs(ok-ng)>1){
    ll mid=(ok+ng)/2;
    if(isOk(mid)) ok=mid;
    else ng=mid;
  }
  cout<<ok<<endl;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<iostream>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<stack>
#include<set>
using namespace std;
#define pb push_back
#define POP pop_back()
#define ll long long
#define db double
#define POP pop_back()
#define endl '\n'
const int maxn = 5e2 + 5;
const int inf = 0x3f3f3f3f;
const int inF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const db eps = 1e-8;
ll a[maxn] , dp[maxn][maxn][2];
int main(){
	int n;cin >> n;
	memset(dp, inf , sizeof dp);
	for(int i = 1;i <= n;i++)cin >> a[i] , dp[i][i][1] = a[i] , dp[i][i][0] = 0;
	for(int i = 2;i <= n;i++){
		for(int j = 1;j+i-1 <= n;j++){
			int k = j+i-1;
			for(int m = j;m < k;m++){
				dp[j][k][0] = min(dp[j][k][0] , dp[j][m][0]+dp[m+1][k][0]+dp[j][m][1] + dp[m+1][k][1]);
			}
			dp[j][k][1] = dp[j][k-1][1]+a[k];
		}
	}
	/*for(int i = 1;i <= n;i++){
		for(int j = 1;j <= n;j++)cout << dp[j][i][0] << " " ;
		cout << endl;
	}*/
	cout << dp[1][n][0] << endl;
	return 0;
}

Measured memory_bytes: 7568
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

struct Vect {
  double w;
  double v;
  double t;
  Vect() {;}
  Vect(double w, double v, double t) : w(w), v(v), t(t) {;}
  bool operator<(const Vect &rhs) const {
    return t > rhs.t;
  }
};

int N, W;
int main() {
  while (scanf("%d %d", &N, &W) > 0) {
    double ans = 0.0;
    vector<Vect> plus;
    vector<Vect> minus;
    REP(i, N) {
      double w, v;
      scanf("%lf %lf", &w, &v);
      if (w >= 0 && v <= 0) {
        continue;
      } else if (w <= 0 && v >= 0) {
        ans += v;
        W -= w;
      } else if (w > 0 && v > 0) {
        plus.push_back(Vect(w, v, v / w));
      } else if (w < 0 && v < 0) {
        minus.push_back(Vect(w, v, w / v));
      } else {
        assert(false);
      }
    }
    sort(plus.begin(), plus.end());
    sort(minus.begin(), minus.end());
    multimap<double, double> event;
    {
      double t = 0.0;
      FORIT(it, plus) {
        event.insert(make_pair(t, it->v / it->w));
        t += fabs(it->w);
      }
      event.insert(make_pair(t, 1e-30));
      t = W;
      FORIT(it, minus) {
        event.insert(make_pair(t, -it->v / it->w));
        t += fabs(it->w);
      }
      event.insert(make_pair(t, -1e-30));
    }
    double pt = 0.0;
    double pGrad = 0.0;
    double mGrad = 0.0;
    double sum = 0.0;
    double best = 0.0;
    FORIT(it, event) {
      double nt = it->first;
      sum += (pGrad + mGrad) * (nt - pt);
      best = max(best, sum);
      if (it->second > 0) { pGrad = it->second; }
      if (it->second < 0) { mGrad = it->second; }
      if (mGrad == -1e-30) { break; }
      pt = nt;
    }
    ans += best;
    printf("%.8lf\n", ans);
  }
}

Measured memory_bytes: 0
import java.util.*;
//Keyword: bfs
class Main{
    static List<Integer>[] path;
    static int n;
    static boolean[] seen;
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        int m = scanner.nextInt();
        path = new ArrayList[n+1];
        for (int x=0; x<=n; x++) {
            path[x] = new ArrayList<Integer>();
        }
        for(int i = 0; i < m; i++){
            int one = scanner.nextInt();
            int two = scanner.nextInt();
            path[one].add(two);
            path[two].add(one);
        }
        int count = 0;
        for(int i = 1; i <= n; i++){
            for(int j = i+1; j <= n; j++){
                if(path[i].contains(j)){
                    seen = new boolean[n+1];
                    dfs(i,j,1);
                    boolean flag = true;
                    for(int k = 1; k <= n; k++){
                        if(seen[k] == false){flag = false;}
                    }
                    if(!flag){count++;}
                }
            }
        }
        System.out.println(count);
    }

    public static void dfs(int a, int b, int cur){
        seen[cur] = true;
        for(int i = 0; i < path[cur].size(); i++){
            int next = path[cur].get(i);
            if(!seen[next] && !(a == Math.min(cur, next) && b == Math.max(cur,next))){
                dfs(a,b,next);
            }
        }
    }
}



Measured memory_bytes: 21844
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N, M = map(int, input().split())

ad = [set() for i in range(N+1)]
for i in range(M):
    a, b = map(int, input().split())
    ad[a].add(b)
    ad[b].add(a)

visited = [0 for i in range(N+1)]
seen = [0 for i in range(N+1)]

def bfs(u):
    stack = deque([u])
    seen[u] = 1
    cl = 0

    while len(stack) > 0:
        v = stack.popleft()
        visited[v] = 1
        cl += 1

        for w in ad[v]:
            if seen[w] == 0:
                stack.append(w)
                seen[w] = 1

    return cl

m = 0
for i in range(1,N+1):
    if visited[i] == 0:
        count = bfs(i)
        m = max(m, count)

print(m)



Measured memory_bytes: 173676
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
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 K,A,B;
    cin>>K>>A>>B;
    ll Ans=0;
    if(B-A<3){
        cout<<K+1<<endl;
    }else if(K<=A){
        cout<<K+1<<endl;
        }else{
            ll a=K-A+1;
            Ans=a/2*(B-A)+A;
            if(a%2==1){
                Ans+=1;
            }
            cout<<Ans<<endl;
        }
    }


Measured memory_bytes: 256
#include <string>
#include <cstdio>
#include <unordered_map>
#include <deque>
#include <algorithm>
using namespace std;
typedef string key;

char b1[99],b2[99];
void main2(int n){
	unordered_map<key,deque<pair<key,long long>>>m;
	for(;n;n--){
		int d;
		scanf(" 1 %s = 10^%d %s",b1,&d,b2);
		string s1=b1,s2=b2;
		m[s1].emplace_back(s2,d);
		m[s2].emplace_back(s1,-d);
	}
	for(;!m.empty();){
		auto s=m.begin()->first;
		deque<pair<key,long long>>st={{s,0}};
		unordered_map<key,long long>memo={{s,0}};
		for(;!st.empty();){
			auto p=*st.rbegin();st.pop_back();
			auto cur=p.first;long long d=p.second;
			for(auto &e:m[cur]){
				if(memo.find(e.first)==memo.end()){
					st.emplace_back(e.first,d+e.second);
					memo[e.first]=d+e.second;
				}else if(memo[e.first]!=d+e.second){
					puts("No");
					return;
				}
			}
		}
		for(auto &e:memo)m.erase(m.find(e.first));
	}
	puts("Yes");
}
int main(){int n;for(;~scanf("%d",&n)&&n;)main2(n);}

Measured memory_bytes: 2872
// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007

#define read(type) readInt<type>()
#define max1 1000008
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
typedef long int li;

typedef unsigned long int uli;

typedef long long int ll;

typedef unsigned long long int  ull;


void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}

int main() {
    ll n,k,x,y;
    cin>>n>>k>>x>>y;
    if(k>=n){out(n*x);}
    else{
        out(k*x+(n-k)*y);
    }
}





Measured memory_bytes: 256
#include <iostream>

int H, M;
int map[102][102];
char scan;
int count;

void search(int kind,int x,int y)
{
	map[x][y] = 0;
	if (map[x+1][y]==kind)search(kind,x+1, y);
	if (map[x][y+1]==kind)search(kind,x, y+1);
	if (map[x-1][y]==kind)search(kind,x-1, y);
	if (map[x][y-1]==kind)search(kind,x, y-1);
}

int main()
{

	while (true)
	{
		std::cin >> H;
		std::cin >> M;
		if (H + M == 0)break;
		count = 0;
		for (int j = 1; j <= H; j++)
		{
			for (int i = 1; i <= M; i++)
			{
				std::cin >> scan;
				switch (scan)
				{
				case '#':
					scan = 1;
					break;
				case '*':
					scan = 2;
					break;
				case '@':
					scan = 3;
					break;
				default:
					scan = 0;
				}
				map[j][i] = scan;
			}
		}
		for (int j = 1; j <= H; j++)
		{
			for (int i = 1; i <= M; i++)
			{
				if (map[j][i])
				{
					search(map[j][i],j,i);
					count++; 
				}
			}
		}
		std::cout << count << std::endl;
	}
}

/*
for (int j = 0; j < H; j++)
{
for (int i = 0; i < M; i++)
{
if (map[j][i])
{
}
}
}*/

Measured memory_bytes: 1972
#include <iostream>
using namespace std;
int main()
{
	int a=0, b=0;
	int totalA;
	double t;
	double k = 0.5;

	cin >> a >> b >>t;
	totalA = a;
	t += k;
	
	int s = 0;
	while(1) {
		if (t < totalA) {
			break;
		}
	
		totalA = totalA + a;
		s = s + b;
	}
	cout << s << endl;
	return 0;
}


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

int main(){
    int r,c;
    cin>>r>>c;
    int ans[r+1][c+1]={};
    int ans_1[r+1]={},ans_2[c+1]={};
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            int tmp;
            cin>>tmp;
            ans[i][j]=tmp;
            ans_1[i]+=tmp;
            ans_2[j]+=tmp;
            ans_1[r]+=tmp;
            ans_2[c]+=tmp;
        }
    }
    
    for(int i=0;i<r+1;i++){
        for(int j=0;j<c+1;j++){
            if(i==r){
                if(j==c)cout<<ans_2[j];
                else{cout<<ans_2[j]<<' ';}
            }
            else if(j==c){
                cout<<ans_1[i];
            }
            else{
                cout<<ans[i][j]<<' ';
            }
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  if(S.size() >= 4 && S.substr(0, 4) == "YAKI") cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


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

int main() {
  int X;
  cin >> X;
  int ans;
  if(X < 600){
    ans = 8;
  }
  else if(X < 800){
    ans = 7;
  }
  else if(X < 1000){
    ans = 6;
  }
  else if(X < 1200){
    ans = 5;
  }
  else if(X < 1400){
    ans = 4;
  }
  else if(X < 1600){
    ans = 3;
  }
  else if(X < 1800){
    ans = 2;
  }
  else{
    ans = 1;
  }
  cout << ans << endl;

  /*int N = 3;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }*/

  /*for (int i = 0; i < vec.size(); i ++){
    cout << vec.at(i) << endl;
  }

  for (int i = 0; i < vec.size()-1; i ++){
    cout << vec.at(i) << " ";
  }
  cout << vec.at(vec.size() - 1) << endl;*/
}


Measured memory_bytes: 3568
M, D = map(int, input().split())
count = 0
for m in range(1, M+1):
    for d in range(1, D+1):
        d10 = d // 10
        d1 = d - (d10*10)
        if d10 >= 2 and d1 >= 2 and d1*d10 == m:
            count += 1
print(count)


Measured memory_bytes: 39408
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		char[] s = sc.next().toCharArray();
		ArrayList<Character> list = new ArrayList<>();
		for(int i = 0; i < s.length; i++) {
			if(s[i] != 'B') {
				list.add(s[i]);
			}else {
				if(list.size() > 0) {
					list.remove(list.size()-1);
				}
			}
		}
		for(Character c : list) {
			System.out.print(c);
		}
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 32704
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using namespace std;

int main() {
    fastIO;
    string s;
    cin >> s;
    // 0123456789
    // 2019/04/30
    if (s[6] >= '5' || s[5] == '1') {
        cout << "TBD";
    } else {
        cout << "Heisei";
    }
}

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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_N 200000
ll N, T;
ll t[MAX_N];
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N >> T;
	rep(i, 0, N) cin >> t[i];

	ll res = 0;
	rep(i, 1, N) {
		if(t[i] - t[i - 1] > T) res += T;
		else res += t[i] - t[i - 1];
	}

	res += T;
	cout << res << endl;



}


Measured memory_bytes: 1792
const Main = (input) => {
  input = input.split("\n");
  const N = Number(input[0]);
  let cnt = 0;
  let boolean = false;

  for(let i =1; i <= N; i++) {
    const nums = input[i].split(' ');
    const first = Number(nums[0]);
    const second = Number(nums[1]);
    
    if(first === second) {
      cnt++;
      if(cnt >= 3) {
        boolean = true;
      }
    } else {
      cnt = 0;
    }
  }
  if(boolean) {
    console.log('Yes');
  } else {
    console.log('No');
  }
 
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(``);

Measured memory_bytes: 29600
n = int(input())
arr = list(map(int, input().split()))
l = [e for e in arr if e % 2 == 0]
ans = ''
for e in l:
  if e % 3 == 0 or e % 5 == 0:
    next
  else:
    ans = 'DENIED'
if ans == '':
  ans = 'APPROVED'
print(ans)

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

class UnionFind{
public:
    vector<int> tree;

    void init(){
        for(int i = 0;i < tree.size();i++){
            tree[i] = i;
        }
    }

    UnionFind(int n){
        n++;
        tree.resize(n);
        init();
        return;
    }

    int root(int i){
        if(tree[i] == i) return i;
        return tree[i] = root(tree[i]);
    }

    bool unite(int i, int j){
        i = root(i);
        j = root(j);
        if(i == j) return false;
        tree[j] = i;
        return true;
    }

    bool same(int i, int j){
        return root(i) == root(j);
    }
};

int main(){
    int n, k, l;
    cin >> n >> k >> l;
    UnionFind uf1(n);
    UnionFind uf2(n);

    int a, b;
    for(int i = 0;i < k;i++){
        cin >> a >> b;
        uf1.unite(a, b);
    }

    for(int i = 0;i < l;i++){
        cin >> a >> b;
        uf2.unite(a, b);
    }

    map<int, int> mp[200010];
    for(int i = 0;i < n;i++){
        mp[uf1.root(i+1)][uf2.root(i+1)]++;
    }

    for(int i = 0;i < n;i++){
        cout << mp[uf1.root(i+1)][uf2.root(i+1)];
        if(i < n-1){
            cout << " ";
        }else{
            cout << endl;
        }
    }
}


Measured memory_bytes: 20096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
  
int main(){
    int a,p;
    cin>>a>>p;
    cout<<(a*3+p)/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll ; 
typedef long double ld ;
typedef pair<ll , ll> pll ;

const ll N = 2e5 + 30 , Mod = 1e9 + 7 ;
const ll SQ = 330 ;

ll p[N] , M[N];
vector<ll> G[N] ;

int main () {
    ios::sync_with_stdio(0), cin.tie(0) ;
    ll n , m ;
    cin >> n >> m ;
    deque<ll> q ;
    while (m --) {
    	ll v,  u ;
    	cin >> v >> u ;
    	G[v].pb(u) ;
    	G[u].pb(v) ;
    	if (!m) {
    		q.pb(v) ;
    		q.pb(u) ;
    		M[v] = M[u] = 1 ;
		}
	}
	while (true) {
		ll v = q.front() ;
		ll u = q.back() ;
		ll ok = 0 ;
		for (auto k : G[v]) {
			if (!M[k]) {
				M[k] = 1; 
				q.push_front(k) ;
				ok ++ ;
				break;
			}
		}
		for (auto k : G[u]){
			if (!M[k]) {
				M[k ] = 1 ;
				q.pb(k); 
				ok ++ ;
				break;
			}
			
		}
		if (!ok) break;
		
	}
	cout << q.size() << '\n' ;
	for (int i = 0 ; i < q.size() ; i ++) cout << q[i] << ' ' ;
    return (0) ;
}

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

int main() {
	bool prime[100000];
	fill(prime, prime + 100000, 1);
	prime[0] = prime[1] = false;
	for (int i = 2; i * i < 100000; i++) {
		for (int j = 2; i * j < 100000; j++) {
			if (!prime[i * j]) continue;
			prime[i * j] = false;
		}
	}

	int n;
	while (cin >> n) {
		int i = 0;
		for (int i = n - 1; i >= 0; i--) {
			if (prime[i]) {
				cout << i << " ";
				break;
			}
		}
		for (int i = n + 1; i < 100000; i++) {
			if (prime[i]) {
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    double a,b;
    cin>>a>>b;
    cout<<ketasuu(10)<<a/b<<endl;
}

Measured memory_bytes: 256