akhauriyash/Code-Regression huggingface dataset:
///**Bismillahir Rahmanir Rahim.**

#include <bits/stdc++.h>
#define clr(a, v)             memset(a, v, sizeof a)
#define all(v)                v.begin(), v.end()
#define ast(v)                sort(v.begin(),v.end())
#define dst(v)                sort(v.begin(),v.end(), greater <int> ())
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ass(tmp, v)           tmp.assign(v.begin(), v.end())
#define rep(i, l, r)          for (int i = l; i < r; i++)
#define rep2(i, l, r)         for (int i = l-1; i >= r; i--)
#define sf(n)                 scanf("%d", &n)
#define sff(n, m)             scanf("%d %d",&n,&m)
#define sfl(n)                scanf("%lld", &n)
#define sfu(n)                scanf("%llu", &n)
#define sffl(n, m)            scanf("%lld %lld",&n,&m)
#define sfff(n, m, o)         scanf("%d %d %d",&n,&m, &o)
#define pf(n)                 printf("%d", n)
#define sp                    printf(" ")
#define nl                    printf("\n")
#define prln(n)               printf("%d\n", n)
#define pfl(n)                printf("%lld", n)
#define pfu(n)                printf("%llu", n)
#define pb                    push_back
#define pii                   pair<int,int>
#define mp                    make_pair
#define S                     second
#define F                     first
#define PI                    3.1415926

struct greaters
{
    bool operator()(const long& a, const long& b) const
    {
        return a > b;
    }
};

//-----------------------------------***********************----------------------------------------------//


typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
const int N = 200050;
const int mod = 1e9+7;


int main()
{
    //freopen("test.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    fast;
    int tcase = 1, cas = 0;
    while(tcase--)
    {
        int n;
        cin >> n;
        vector <double> v;
        rep(i, 0, n)
        {
            double a;
            cin >> a;
            v.pb(a);
        }

        rep(i, 0, n-1)
        {
           ast(v);
           double x = v[i];
           v[i] = -1;
           double y = v[i+1];
           v[i+1] = (x+y)/2.0;
        }
        cout << v[n-1] << '\n';

        ///printf("%d : %lld\n", ++cas, ans);
    }
    return 0;

}

//-----------------------------------***********************----------------------------------------------//


Measured memory_bytes: 256
#include <stdio.h> 
int main() {
int n, fish, num, i, max = 0, maxnum = 1;
scanf("%d",&n);
for(i = 0; i < n; i++ ) {
scanf("%d",&num);
scanf("%d",&fish);
if(max < fish) {
max = fish;
maxnum = num;
}
if(max == fish && maxnum > num) {
maxnum = num;
}
}
printf("%d %d\n",maxnum,max);
return 0;
}

Measured memory_bytes: 600
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String str = sc.next();
		String[] input = str.split("");
		int stack=0;
		long answer = 0L;
		boolean isOnlyW = true;
		for (int i=0;i<input.length; i++){
			if (input[i].equals("W")){
				if(!isOnlyW){
					answer += i-stack;
				}
				stack++;
			}else{
				isOnlyW = false;
			}
			
		}
		System.out.println(answer);
	}
}

Measured memory_bytes: 54508
// https://atcoder.jp/contests/abc075/tasks/abc075_b

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int h, w;
  vector<string> s;

  cin >> h >> w;

  REP(i, h)
  {
    string si;
    cin >> si;
    s.push_back(si);
  }

  REP(i, h)
  {
    string r = "";
    REP(j, w)
    {
      if (s[i][j] != '.')
      {
        r += s[i][j];
        continue;
      }
      else
      {
        int cnt = 0;
        if (0 < i)
        {
          if (0 < j && s[i - 1][j - 1] == '#')
            cnt++;
          if (s[i - 1][j] == '#')
            cnt++;
          if (j < w - 1 && s[i - 1][j + 1] == '#')
            cnt++;
        }

        if (i < h - 1)
        {
          if (0 < j && s[i + 1][j - 1] == '#')
            cnt++;
          if (s[i + 1][j] == '#')
            cnt++;
          if (j < w - 1 && s[i + 1][j + 1] == '#')
            cnt++;
        }

        if (0 < j)
        {
          if (s[i][j - 1] == '#')
            cnt++;
        }
        if (j < w - 1)
        {
          if (s[i][j + 1] == '#')
            cnt++;
        }

        r += to_string(cnt);
      }
    }
    s[i] = r;
  }

  REP(i, h)
  {
    cout << s[i] << '\n';
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string A,B,C;
  cin >> A >> B >> C;
  if(A.at(A.length()-1) == B.at(0) && B.at(B.length()-1) == C.at(0)){
  	cout << "YES" << endl;
  }else{
  	cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using lint128 = __int128_t;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void assert_NO(T condition){ if(!condition){ cout << "NO" << endl; exit(0); } }
template<class T> inline void assert_No(T condition){ if(!condition){ cout << "No" << endl; exit(0); } }
template<class T> inline void assert_minus_1(T condition){ if(!condition){ cout << -1 << endl; exit(0); } }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
template<class T> bool chmax(T &a, const T &b){ if(a < b){ a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b){ if(b < a){ a = b; return 1; } return 0; }
inline int at(lint x, int k){ return (x >> k) & 1; }
random_device rnd;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    double L;
    cin >> L;
    fcout << pow(L / 3, 3) << endl;
}


Measured memory_bytes: 512
//abc138_c.cpp
//Sun Aug 18 20:46:27 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	priority_queue<double, vector<double>, greater<double>> v; //小さい順 
	for (int i=0;i<n;i++){
		double temp;
		cin >> temp;
		v.push(temp);
	}

	while (v.size()>1){
		double x = v.top();v.pop();
		double y= v.top();v.pop();
		double z = (x+y)/2;
		v.push(z);
	}

	double ans = v.top();
	printf("%.10f\n",ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;

    ll x = n;
    if(n%2 == 0) {
        x++;
    }
    
    out(n*(n-1)/2 - n/2);
    exrep(i, 1, n-1) {
        exrep(j, i+1, n) {
            if(i+j == x) {
                continue;
            }
            cout << i << " " << j << "\n";
        }
    }
    
    re0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
//using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
using pii=pair<ll,ll>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
#define dcl(...) ll __VA_ARGS__;get(__VA_ARGS__);


int main(){
    ll ans=0;
    string s;get(s);
    rep(i,1<<(s.length()-1)){
        int bit=i;
        auto cp=s;
        while(__builtin_popcount(bit)){
            ans+=stoll(cp.substr(s.length()-__builtin_ffs(bit)));
            cp=cp.substr(0,s.length()-__builtin_ffs(bit));
            bit&=bit-1;
        }
        ans+=stoll(cp);
    }
    cout<<ans<<endl;    
}

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

int main(){
    int a,b,c,n,r;
    while(cin>>a>>b>>c,a){
        cin>>n;
        while(n--){
            cin>>r;
            if(a*a+b*b<4*r*r||c*c+b*b<4*r*r||a*a+c*c<4*r*r)
                cout<<"OK"<<endl;
            else
                cout<<"NA"<<endl;
        }
    }
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
#define LL long long 
#define clr(x,i) memset(x,i,sizeof(x))
using namespace std;
const int N=1005;
int n,m,a[N],op[N],vis[N],tot,cnt,fn=1;
void chkneg()
{
	int mx=-1e9,pos=0;
	for(int i=1;i<=n;i++)
	  if(a[i]>mx) mx=a[i],pos=i;
	printf("%d\n%d\n",mx,n-1);
	for(int i=n;i>pos;i--) printf("%d\n",i);
	for(int i=1;i<pos;i++) printf("%d\n",1);
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		if(a[i]>0) fn=0;
	} 
	if(fn){chkneg();return 0;}
	LL s1=0,s2=0;
	for(int i=1;i<=n;i+=2)
	  if(a[i]>0) s1+=a[i];
	for(int i=2;i<=n;i+=2)
	  if(a[i]>0) s2+=a[i];
	printf("%lld\n",max(s1,s2));
	
	int b = s1>s2 ? 1 : 2;
	for(int i=b;i<=n;i+=2)
	  if(a[i]>0) vis[++cnt]=i;
	int l=vis[1],r=vis[cnt]; m=0;
	for(int i=n;i>r;i--) op[++tot]=i;
	for(int i=1;i<l;i++) op[++tot]=1;
	for(int i=l;i<=r;i++) a[++m]=a[i];
//	for(int i=1;i<=m;i++) cout<<a[i]<<' '; cout<<endl;
//	*.......*.....*...*.*
	for(int i=1;i<cnt;i++)
	{
		int x=(vis[i+1]-vis[i])>>1;
		for(int j=x+1;j>=2;j--)
		  op[++tot]=j;
	}
	printf("%d\n",tot);
	for(int i=1;i<=tot;i++)
	  printf("%d\n",op[i]);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
	int K, X;
  cin >> K >> X;
  
  int x1 = X - (K - 1);
  int x2 = X + (K - 1);
  
  for (int i = x1; i <= x2; i++) {
    if (i != x2) {
      cout << i << " "; 
    } else {
      cout << i << endl; 
    }
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

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

	int a = scan.nextInt();
	int b = scan.nextInt();
	int c = scan.nextInt();
	int x = scan.nextInt();
	int count = 0;
	
	for(int i = 0; i <= a; i++){
	    for(int j = 0; j <= b; j++){
		for(int k = 0; k <= c; k++){
		    if(x == 500*i+100*j+50*k){
			count++;
		    }
		}
	    }
	}
	System.out.println(count);
    }
}
					   


Measured memory_bytes: 23124
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var K = cin.ReadInt;
            var c = new long[4000][];
            var mod = 1000000007;
            for (int i = 0; i < 4000; i++)
            {
                c[i] = new long[i + 1];
                for (int j = 0; j < i + 1; j++)
                {
                    c[i][j] = (j == 0 || j == i) ? 1 : (c[i - 1][j - 1] + c[i - 1][j]) % mod;
                }
            }
            for (int i = 1; i <= K; i++)
            {
                var ans = (N - K + 1 < i) ? 0 : (c[N - K + 1][i] * c[K - 1][i - 1]) % mod;
                Console.WriteLine(ans);
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	string s; cin >> s;
	if(s[0]==s[1]&&s[0]==s[2])cout << "No" << endl;
	else cout << "Yes" << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    ll N,M;
    cin >> N >> M;
    ll ans = 1;
    for(int i = 1;i <= N;i++)ans = ans * i % MOD;
    for(int i = 1;i <= M;i++)ans = ans * i % MOD;

    if(!(N ^ M))ans = ans * 2 % MOD;
    if(abs(N - M) >= 2)ans = 0;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
	long long x, k, d, f, lef;
	cin >> x  >> k >> d;

	x = abs(x);

	if (x / d > k)
	{
		cout << abs(x - k * d) << endl;
	}
	else
	{
		f = floor(x / d);
		lef = k - f;
		x -= d * f;

		cout << (lef % 2 == 0 ? x : abs(x - d)) << endl;
	}

	return 0;
}

Measured memory_bytes: 3620
n,m = map(int,input().split())
s = []

for i in range (m):
    s.append(list(map(int,input().split()))[1:])
p = list(map(int,input().split()))
cnt = 0
for i in range(2**n):
    switch = [0]*n
    
    f = True
    for k in range(n):
        if(i>>k)&1:
            switch[k] = 1
    #print(switch)
    for j in range(m):
        sum = 0
        for k in range(len(s[j])):
            if switch[s[j][k]-1] == 1:
                sum += 1
        if sum % 2 != p[j]:
            f = False
    if f:
        cnt += 1
        



print(cnt)

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

using namespace std;

int main(){
    ll n;
    cin >> n;
    string str = "";
    while (n != 0){
        int r=n%2;
        if (r<0) r += 2;
        n = (n-r)/(-2);
        str += (char)('0'+r);
    }
    reverse(all(str));
    if (str=="") str = "0";
    cout << str << endl;

    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define all(x) begin(x), end(x)
#define range(x) begin(x), begin(x)
#define what(x) cout << #x << ": " << x << '\n'
#define print(x) for (auto &el: x) cout << el << ' '; cout << '\n'
using namespace std;
 
template<typename S, typename T>
ostream& operator <<(ostream &os, pair<S, T> &m) { 
    os << '[' << m.first << " " << m.second << ']'; 
    return os; 
}

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

    int n;
    cin >> n;
    cout << (1000 - n % 1000) % 1000 << endl;
    

    return 0;
}

Measured memory_bytes: 3652
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN = 1e5 + 7;
int a[MAXN], dp[MAXN]; 
int main() {
    int n, len;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
    	scanf("%d", &a[i]);
	}
	dp[0] = a[0];
	len = 1;
	for (int i = 1; i < n; i++) {
		if (dp[len - 1] < a[i]) dp[len++] = a[i];
		else *lower_bound(dp, dp + len, a[i]) = a[i];
	}
	printf("%d\n", len);
	return 0;
}


Measured memory_bytes: 3408
while True:
    L = []
    n = int(input())
    if n == 0:
        break
    for _ in range(n):
        l = [int(x) for x in input().split()]
        l.append(sum(l))
        L.append(l)

    l = []
    for i in range(len(L[0])):
        s = []
        for j in range(len(L)):
            s.append(L[j][i])
        l.append(sum(s))
    L.append(l)

    for l in L:
        for i in l:
            print("{:>5d}".format(i),end="")
        print()



Measured memory_bytes: 5632
from math import factorial

def comb(n, r):
    return factorial(n) // (factorial(n-r) * factorial(r))

n, p = map(int, input().split())
arr = list(map(int, input().split()))

odd = 0
even = 0
for a in arr:
    if a % 2 == 1:
        odd += 1
    else:
        even += 1

ans = 2 ** even
tmp = 0
for i in range(p, odd+1, 2):
    tmp += comb(odd, i)
ans *= tmp

print(ans)


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

using namespace std;

int v[2000010];
int c[2000010];

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


    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        v[x]++;
    }

    long long ans = 0;
    for (int i = 1; i < 2000010; ++i) {
        if(v[i] == 0) continue;
        for (int j = i + i; j < 2000010; j += i) 
            c[j]++;
    }
    
    for (int i = 1; i < 2000010; ++i) {
        if(c[i] == 0 and v[i] == 1) 
            ans++;
    }

    
    cout << ans << "\n";

    return 0;
}


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

int main(){
    int n;
    cin >> n;
    int i = 1;
    int cnt = 0;
    if(3 * 5 * 7 <= n)cnt++;
    if(3 * 5 * 9 <= n)cnt++;
    if(3 * 5 * 11 <= n)cnt++;
    if(3 * 5 * 13 <= n)cnt++;
    if(3 * 7 * 9 <= n)cnt++;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define rep(i,n) for(int i=0;i<n;i++)
int wa[100005];
int main(){
    int n,m,i,ng=0,ac=0,j,p;
    scanf("%d%d",&n,&m);
    char s[5];
    while(m--){
        scanf("%d%s",&p,s);
        if(s[0]=='A'){
            if(wa[p]>=0){
                ++ac;
                ng+=wa[p];
                wa[p]=-1;
            }
        }
        else{
            if(wa[p]>=0)
                ++wa[p];
        }
    }
    printf("%d %d\n",ac,ng);
    return 0;
}

Measured memory_bytes: 512
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=10007
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=list(map(int,input().split()))
lst=ruiseki(a)
asum=sum(a)
# print(asum)
# print(lst)
cnt=bisect.bisect_left(lst,asum/2)
# print(cnt)
if asum//2==lst[cnt]:
    print(0)
else:
    if asum%2==0:
        print(2*min(asum//2-lst[cnt-1],lst[cnt]-asum//2))
    else:
        print(min((asum//2-lst[cnt-1])*2+1,(lst[cnt]-asum//2)*2-1))

Measured memory_bytes: 113476
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;

int main()
{
double x1,x2,y1,y2,x,y,a,b,p;

cin >> x1 >> y1 >> x2 >> y2;
x = x2 - x1;
y = y2 - y1;
a = x * x;
b = y * y;
p = a + b;
double answer = sqrt(p);
cout << fixed << setprecision(8) << answer << endl;



}

Measured memory_bytes: 3280
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll n,k,K,cnt=1,cur=0,to; cin>>n>>k;
    vector<ll> a(n,0);
    vector<vector<ll>> b(200001);
    vector<pair<ll,ll>> m;
    rep(i,n){
        cin>>a[i];
        b[a[i]].push_back(i);
    }
    set<ll> s;
    while(1){
        if(s.count(cur)) break;
        s.insert(cur);
        m.push_back(mk(cnt-1,cur));
        if(b[a[cur]].back()==cur) to=b[a[cur]][0];
        else to=*upper_bound(al(b[a[cur]]),cur);
        if(cur<to) cnt+=to-cur+1;
        else cnt+=n+to-cur+1;
        cur=(to+1)%n;
    }
    K=cnt-1;
    cnt=(n*k)%K;
    ll l=0,r=m.size()-1,c;
    while(l!=r){
        c=(l+r+1)/2;
        if(m[c].first<=cnt) l=c;
        else r=c-1;
    }
    cnt-=m[l].first;
    deque<ll> deq;
    set<ll> t;
    ll st=m[l].second,p;
    rep(i,cnt){
        if(t.count(a[(st+i)%n])){
            while(1){
                p=deq.back();
                deq.pop_back();
                t.erase(p);
                if(p==a[(st+i)%n]) break;
            }
        }
        else{
            t.insert(a[(st+i)%n]);
            deq.push_back(a[(st+i)%n]);
        }
    }
    while(!(deq.empty())){
        printf("%lld ",deq.front());
        deq.pop_front();
    }
    printf("\n");
    //rep(i,m.size()) printf("%lld %lld\n",m[i].first,m[i].second);
}


Measured memory_bytes: 39328
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;

int n, m, t, p, k;
int a[1000][1000];

int main()
{
    while(scanf("%d%d%d%d", &n, &m, &t, &p)){
        if(n == 0){
            return 0;
        }
        memset(a, 0, sizeof(a));
        int nr = n + 500;
        int mr = m + 500;
        int nl = 501;
        int ml = 501;
        for(int i = 501; i <= nr; i++){
            for(int j = 501; j <= mr; j++){
                a[i][j] = 1;
            }
        }
        int d, c;
        for(int i = 0; i < t; i++){
            scanf("%d %d", &d, &c);
            if(d == 1){
                nr -= c;
                for(int j = 0; j < c; j++){
                    for(k = ml; k <= mr; k++){
                        a[nr-j][k] += a[nr+j+1][k];
                        //a[nr+j+1][k] = 0;
                    }
                }
                if(nl > (nr - c)){
                    nl = (nr - c);
                }
                //nl = min(nl, nr - c);
            }
            else{
                mr -= c;
                for(int j = 0; j < c; j++){
                    for(k = nl; k <= nr; k++){
                        a[k][mr-j] += a[k][mr+j+1];
                        //a[k][mr+j+1] = 0;
                    }
                }
                if(ml > (mr - c)){
                    ml = (mr - c);
                }
                //ml = min(ml, mr - c);
            }
        }
        int x, y;
        for(int i = 0; i < p; i++){
            scanf("%d %d", &x, &y);
            printf("%d\n", a[nr-x][mr-y]);
        }
    }
    return 0;
}



Measured memory_bytes: 7084
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e3 + 10;
string a[60], b[60];
int n, m;
void solve() {
    cin >> n >> m;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < m; i++)
        cin >> b[i];
    for (int i = 0; i < n - m + 1; i++) {
        for (int j = 0; j < n - m + 1; j++) {

            bool f = 1;
            for (int x = 0; x < m; x++) {
                for (int y = 0; y < m; y++) {
                    if(a[i + x][j + y] != b[x][y]) {
                        f = 0; break;
                    }
                }
                if(!f) break;
            }
            if(f) {
                cout << "Yes" << endl;
                return;
            }
        }
    }
    cout <<"No" << endl;
}
int main() {
    //freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
from string import*;from itertools import*;b=ascii_lowercase;s=input();t=s[::-1]
if len(s)<26:print(s +sorted(set(b)-set(s))[0])
else:d=-[p*len(list(k))for p,k in groupby([i<j for i,j in zip(t,t[1:])])][0]-2;print(-(d<-26)or s[:d]+sorted(set(s[d+1:])-set(b[:ord(s[d])-97]))[0])

Measured memory_bytes: 3892
#include <math.h>

#include <cmath>
#include <iostream>
using namespace std;
int main() {
    int x;
    cin >> x;
    if (x < 600) {
        cout << 8 << endl;
    } else if (x < 800) {
        cout << 7 << endl;
    } else if (x < 1000) {
        cout << 6 << endl;
    } else if (x <1200) {
        cout << 5 << endl;
    } else if (x < 1400) {
        cout << 4 << endl;
    } else if (x < 1600) {
        cout << 3 << endl;
    } else if (x < 1800) {
        cout << 2 << endl;
    } else
        cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 3576
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  char S;
  cin>>S;
  if(S<='Z') co("A");
  else co("a");
  return 0;
}

Measured memory_bytes: 3524
n,m,L=map(int,input().split(' '))

inf=10**10

d=[[inf]*n for _ in range(n)]
for _ in range(m):
    a,b,c=map(int,input().split(' '))
    d[a-1][b-1]=c
    d[b-1][a-1]=c

for k in range(n):
    for i in range(n):
        for j in range(n):
            if d[i][j] > d[i][k] + d[k][j]:
                d[i][j] = d[i][k] + d[k][j]
                
dl=[[inf]*n for _ in range(n)]
for i in range(n):
    for j in range(n):
        if d[i][j] <= L:
            dl[i][j]=1

for k in range(n):
    for i in range(n):
        for j in range(n):
            if dl[i][j] > dl[i][k] + dl[k][j]:
                dl[i][j] = dl[i][k] + dl[k][j]

q=int(input())
for _ in range(q):
    s,t = map(int,input().split(' '))
    if dl[s-1][t-1]==inf:
        print(-1)
    else:
        print(dl[s-1][t-1]-1)

Measured memory_bytes: 59608
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author rahdirigs
 */

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

template <typename T> void s_max(T& a, T b) {
	if (a < b) {
		a = b;
	}
}

const int mxN = 1010, mxW = 2e4 + 5;
ll dp[mxN][mxW];

class TaskX {
public:
	struct block {
		int w, s, v;

		void input(istream& in) {
			in >> w >> s >> v;
		}

		ll param() const {
			return (s + w);
		}
	};

	block a[mxN];
	int N;

	void solve(std::istream& in, std::ostream& out) {
		in >> N;
		for (int i = 0; i < N; i++) a[i].input(in);
		sort(a, a + N, comp);
		memset(dp, -1, sizeof(dp));
		ll ans = rec(0, 0);
		out << ans;
	}

	static bool comp(const block& b1, const block& b2) {
		return (b1.param() < b2.param());
	}

	ll rec(int n, int wt) {
		if (n == N) {
			return 0;
		}
		if (dp[n][wt] != -1) return dp[n][wt];
		dp[n][wt] = rec(n + 1, wt);
		if (a[n].s >= wt) {
			s_max(dp[n][wt], a[n].v + rec(n + 1, a[n].w + wt));
		}
		return dp[n][wt];
	}
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	TaskX solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 161592
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

int N;
int[][] G;
string C;
int root;

void input() {
    auto n = readln.chomp.to!int;
    auto g = new int[][](n);
    foreach (_; 0..n-1) {
        auto s = readln.split.map!(to!int);
        g[s[0]-1] ~= s[1]-1;
        g[s[1]-1] ~= s[0]-1;
    }
    auto c = readln.chomp;

    root = -1;
    foreach (i; 0..n) if (c[i] == 'W') root = i;
    
    if (root == -1) {
        N = 0;
        return;
    }

    
    auto use = new bool[](n);
    use.fill(true);

    int dfs(int u, int p) {
        int ret = c[u] == 'W';
        foreach (v; g[u]) {
            if (v == p) continue;
            int tmp = dfs(v, u);
            if (tmp == 0) use[v] = false;
            ret += tmp;
        }
        return ret;
    }
    dfs(root, -1);

    N = use.sum;
    G = new int[][](N);
    auto comp = new int[](n);
    comp.fill(-1);

    for (int i = 0, cnt = 0; i < n; ++i) {
        if (use[i]) {
            comp[i] = cnt++;
            C ~= c[i];
        }
    }

    foreach (i; 0..n) {
        if (!use[i]) continue;
        foreach (j; g[i]) {
            if (!use[j]) continue;
            G[comp[i]] ~= comp[j];
        }
    }

    root = comp[root];
}

void main() {
    input();
    auto D = C.map!(c => c == 'W' ? 1 : 0).array;
    
    if (N <= 1) {
        N.writeln;
        return;
    }
    
    void dfs(int n, int p) {
        D[n] ^= 1;
        foreach (m; G[n]) if (m != p) dfs(m, n), D[n] ^= 1;
    }

    Tuple!(int, int) farest(int n, int p, int d) {
        int nd = d + D[n];
        auto ret = tuple(nd, n);
        foreach (m; G[n]) if (m != p) ret = max(ret, farest(m, n, nd));
        return ret;
    }

    D[root] ^= 1;
    dfs(root, -1);

    auto s = farest(root, -1, 0);
    auto t = farest(s[1], -1, 0);
    auto u = s[1];
    auto v = t[1];
    
    int ans = (N - 1) * 2;
    foreach (i; 0..N) if (G[i].length > 1 && D[i]) ans += 1;
    ans -= t[0] * 2;
    
    ans.writeln;
}


Measured memory_bytes: 19096
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val n = sc.nextInt()
        val a = Array(n) { sc.nextInt() }
        val map = mutableMapOf<Int, Int>()
        for (i in 0 until n) {
            map[a[i]] = (map[a[i]] ?: 0) + 1
        }

        println(map.count { it.value % 2 == 1 })
    }
}


class MyScanner() {
    private var index = 0
    private var line = listOf<String>()

    fun next(): String {
        while (line.size <= index) {
            line = readLine()!!.split(' ')
            index = 0
        }
        return line[index++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun strList(): List<String> {
        index = line.size
        return readLine()!!.split(' ')
    }

    fun intList() = strList().map { it.toInt() }
    fun longList() = strList().map { it.toLong() }
    fun doubleList() = strList().map { it.toDouble() }
}

Measured memory_bytes: 55832
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(x) (x).begin(), (x).end()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end());

int main() {
  string S;
  cin >> S;
  int ans = 100000000;
  for (int i = 0; i < S.size() - 2; i++) {
    int tmp =
        (S.at(i) - '0') * 100 + (S.at(i + 1) - '0') * 10 + (S.at(i + 2) - '0');

    ans = min(ans, abs(753 - tmp));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.math.*;
import java.util.*;
import java.lang.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if((a==b&&a!=c)||(a==c&&a!=b)||(b==c&&a!=b)){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

int n,m;
string maze[55];

int fg[110][5],ac[110];

char dir[5]={' ','U','R','D','L'};
int di[5]={0,-1,0,1,0};
int dj[5]={0,0,1,0,-1};

int build(vector<string> pattern){
	memset(fg,-1,sizeof(fg));
	memset(ac,0,sizeof(ac));
	int root=0,size=1;
	fg[root][0]=root;

	rep(i,pattern.size()){
		int cur=root;
		rep(j,pattern[i].size()){
			int tar=1;
			rep(k,5) if(dir[k]==pattern[i][j]) tar=k;
			if(fg[cur][tar]==-1) fg[cur][tar]=size++;
			cur=fg[cur][tar];
		}
		ac[cur]++;
	}

	queue<int> q;
	for(int i=1;i<=4;++i){
		if(fg[root][i]>=0){
			fg[fg[root][i]][0]=root;
			q.push(fg[root][i]);
		}else
			fg[root][i]=root;
	}
	while(!q.empty()){
		int now=q.front();q.pop();
		for(int i=1;i<=4;++i){
			if(fg[now][i]>=0){
				int tar=fg[now][0];
				while(fg[tar][i]==-1) tar=fg[tar][0];
				fg[fg[now][i]][0]=fg[tar][i];
				ac[fg[now][i]]+=ac[fg[tar][i]];
				q.push(fg[now][i]);
			}
		}
	}
	return size;
}

typedef tuple<int,int,int> state;
int dist[55][55][110];

int bfs(int limit){
	memset(dist,-1,sizeof(dist));
	int si,sj,gi,gj;
	rep(i,n)rep(j,m){
		if(maze[i][j]=='S') si=i,sj=j;
		if(maze[i][j]=='G') gi=i,gj=j;
	}

	const int root=0;
	dist[si][sj][root]=0;
	queue<state> q;
	q.push(state(si,sj,root));
	while(!q.empty()){
		int ci,cj,cs;
		tie(ci,cj,cs)=q.front();q.pop();
		for(int i=1;i<=4;++i){
			int ni=ci,nj=cj,ns=cs;
			ni+=di[i],nj+=dj[i];
			while(fg[ns][i]==-1) ns=fg[ns][0];
			ns=fg[ns][i];
			if(ni<0||n<=ni||nj<0||m<=nj) continue;
			if(maze[ni][nj]=='#') continue;
			if(ac[ns]>=1) continue;
			if(dist[ni][nj][ns]==-1){
				dist[ni][nj][ns]=dist[ci][cj][cs]+1;
				q.push(make_tuple(ni,nj,ns));
			}
		}
	}
	int ans=-1;
	rep(gs,limit){
		if(dist[gi][gj][gs]>=0){
			if(ans==-1) ans=dist[gi][gj][gs];
			ans=min(ans,dist[gi][gj][gs]);
		}
	}
	return ans;
}

int main(void){
	while(cin >> n >> m){
		if(n==0) break;
		rep(i,n) cin >> maze[i];
		int p;
		cin >> p;
		vector<string> pattern;
		rep(i,p){
			string in;
			cin >> in;
			pattern.push_back(in);
		}
		cout << bfs(build(pattern)) << endl;
	}
	return 0;
}

Measured memory_bytes: 2580
#include<iostream>

using namespace std;

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

int main() {
  int n, m, r;
  cin >> n >> m;
  r = m;
  rep (i, n) {
    int a, b;
    cin >> a >> b;
    m += a - b;
    if (m < 0) {
      cout << 0 << endl;
      return 0;
    }
    r = max(r, m);
  }
  cout << r << endl;
  return 0;
}

Measured memory_bytes: 1164
#include<stdio.h>
 
int main(void){
  int n,i,flag;
  
  do{
    scanf("%d",&n);
  }while(n<1 || n > 100);
  
  int a[n];
  
  for(i = 0;i < n;i++){
    do{
      scanf("%d",&a[i]);
    }while(a[i] < 1 || a[i] > 1000);
  }
  
  for(i = 0;i < n;i++)
    if(a[i] % 2 == 0)
      if(a[i] % 3 && a[i] % 5)
        flag++;
  
  if(flag)
    printf("DENIED");
  else
    printf("APPROVED");
  
  return 0;
}

Measured memory_bytes: 1708
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N,M;
  cin>>N>>M;
  for(int i=M/N;1<=i;i--){
    if(M%i==0){
      cout<<i<<endl;
      break;
      }
    }
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, start, stop) for (ll i = start; i < stop; i++)
#define FORR(i, start, stop) for (ll i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<ll>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<ll>());
#define REMOVE(v,n) remove(vector<ll> v,v+v.size(),ll n)
#define ERASE(v,n) v.erase(v.begin()+n);
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }

//vector< vector<int> > v (size1, vector<int>(size2) );



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

    int M,D;
    cin>>M>>D;
    int ans=0;
    FOR(m,1,M+1){
        FOR(d,1,D+1){
            if(m==(d/10)*(d%10) && d/10>=2 && d%10>=2)ans++;
        }
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;
#define LL long long
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define lowbit(x) (x&-x)

const int maxn = 1e5 + 5;
const int INF = 0x3f3f3f3f;

int n, c, k, a[maxn];
int check()
{
	int tol = 1, last = a[n], cnt = 1;
	for (int i = n - 1; i; --i)
	{
		if (last - a[i] > k)
		{
			last = a[i];
			cnt++;
			tol = 1;
		}
		else if (tol == c) //man
		{
			cnt++;
			last = a[i];
			tol = 1;
		}
		else
			tol++;
	}
	return cnt;
}

int main()
{
	while (scanf("%d%d%d", &n, &c, &k) != EOF)
	{
		for (int i = 1; i <= n; i++)
			scanf("%d", &a[i]);
		sort(a + 1, a + 1 + n);
		cout << check() << endl;
	}
	return 0;
}

Measured memory_bytes: 640
<?php
$i = 1;
while(true){
$x = trim(fgets(STDIN));
$a = explode(' ',$x);
$b = $a[0];
$s = $a[1];
    if ($b == 0 && $s == 0) break;
	if($b>$s){
		$temp = $b;
		$b = $s;
		$s = $temp;
		echo($b." ".$s). PHP_EOL;
	}else{
		echo($b." ".$s). PHP_EOL;
	}
	$i++;
}
exit;

?>

Measured memory_bytes: 15104
#include <stdio.h>

int main(void) {

	int H = 0;			//??????????????°??????????????°
	int i = 0;
	int W = 0;			//?¨????????????°??????????????°
	int j = 0;

	do{
		scanf("%d",&H);
		scanf("%d",&W);
		for(i = 1 ; i <= H ; i++){
			for(j = 1 ; j <= W ; j++){

				if( i == 1 || i == H || j == 1 || j == W){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}

		if(W || H){			//0,0??????????????????????????????????????????????????¨????????¨???????????????
			printf("\n");
		}

	}while(W || H);

	return 0;
}

Measured memory_bytes: 572
#include <stdio.h>
#include <string.h>

int main() {
	
	char a[11],b[11],c[11];
	
	scanf("%s %s %s",&a,&b,&c);
	
	int p = strlen(a), q = strlen(b);
	
	
	if(a[p-1] == b[0] && b[q-1] == c[0]){
		puts("YES");
	}else{
		puts("NO");
	}
	



	return 0;
}


Measured memory_bytes: 1636
#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
#include <cstdio>
using namespace std;
typedef long long ll;
const int N = 1e4+5;
const ll INF = 0x3f3f3f3f;

ll a[N],b[N],dp[N << 2];

int main(){
	ll h,n,Max = 0;
	scanf("%lld%lld",&h,&n);
	memset(dp,INF,sizeof(dp));
	
	dp[0] = 0;
	for(ll i = 1;i <= n;++i) scanf("%lld%lld",&a[i],&b[i]),Max = max(Max,a[i]);
	for(ll i = 1;i <= n;++i){
		for(ll j = 1;j < a[i];++j) dp[j] = min(dp[j],b[i]);
		for(ll j = a[i];j <= h+Max;++j) dp[j] = min(dp[j],dp[j-a[i]]+b[i]);
	}
	
	printf("%lld\n",dp[h]);
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
 
int main(void) {
  int a[4] [3] [10];
  for (int b=0; b<4; b++)
  for (int f=0; f<3; f++)
  for (int r=0; r<10; r++) {
    a[b][f][r]=0;
  }
 
  int n;
  cin >> n;
 
  for (int i=0; i< n; i++)
  {
    int b, f, r, v;
    cin >> b >> f >> r >>v;
    a[b-1][f-1][r-1] += v;
  }
 
  for (int b=0; b<4; b++)
  {
    for (int f=0; f<3; f++)
    {
      for (int r=0; r<10; r++)
      {
        cout << " " << a[b][f][r];
      }
      cout << endl;
    }
    if (b<3)
    cout << "####################" << endl;
  }
}

Measured memory_bytes: 1168
N,M = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(N)]

if M==0:
    print(0)
    exit()

def dp(type):
    minimize_x = type&1
    minimize_y = (type>>1)&1
    minimize_z = (type>>2)&1
    dp = [0]
    for i,(x,y,z) in enumerate(src):
        if minimize_x: x *= -1
        if minimize_y: y *= -1
        if minimize_z: z *= -1
        v = x+y+z
        dp.append(dp[-1] + v)
        for j in reversed(range(i)):
            dp[j+1] = max(dp[j+1], dp[j] + v)
    return dp[M]

ans = 0
for i in range(8):
    ans = max(ans, dp(i))
print(ans)

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

using namespace std;

int main(void)
{
	int n,A; cin>>n>>A;
	int x[n];
	for(int i = 0; i < n; i++){
		cin>>x[i];
	}
	
	//int dp[n+1][n+2][A*n+1]; 
	//dp[a][b][c] ->a種類までのx[i]で、b個使い、合計cを作成する通り数。 
	long long (*dp)[n+2][n*A+1] = (long long(*)[n+2][n*A+1])malloc((n+1)*(n+2)*(A*n+1)*sizeof(long long));
	memset(dp,0,sizeof(dp));
	for(int i = 0; i < n+1; i++){
		dp[i][0][0] = 1;
		dp[0][i][0] = 0;
	}
	dp[0][0][0] = 1;
	for(int i = 0; i < n; i++){
		for(int s = 1; s <= i+1; s++){
			for(int j = 0; j <= A*n; j++){
				if(j < x[i]) dp[i+1][s][j] = dp[i][s][j];
				else dp[i+1][s][j] = dp[i][s][j]+dp[i][s-1][j-x[i]];
			}
		}
	}
	/*
	cout<<"\n"<<endl;
	for(int i = 0; i <= n; i++){
		for(int s = 1; s <= i; s++){
			for(int j = 0; j < n*A+1; j++){
				cout<<dp[i][s][j]<<" ";
			}
			cout<<endl;
		}
		cout<<"\n"<<endl;
	}
	cout<<"\n"<<endl;
	*/
	long long ans = 0;
	for(int i = 1; i < n+1; i++){
		ans+=dp[n][i][i*A];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 51712
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long ll;
string s;
bool go(int x, int y) {
	while (x <= y) {
		if (s[x] != s[y])return false;
		x += 1; y -= 1;
	}
	return true;
}
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);	
	cin >> s;
	int n = s.size() / 2;

	if (go(0, n - 1) && go(n + 1, s.size() - 1) && go(0,s.size()-1)) {
		cout << "Yes" << '\n';
	}
	else cout << "No" << '\n';



}




Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int n;
vector<vector<int>> v;
vector<int>a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    v.resize(n);
    for (int i = 0; i < n; i++)
    {
        int temp;
        cin >> temp;
        temp--;
        a.push_back(temp);
        if(i<temp){
            v[temp].push_back(i);
        }
    }
    int ans = 0;
    rep(i,n){
        rep(j,v[i].size()){
            if(a[i]==v[i][j])ans++;
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 4600