akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const double pi = acos(-1.0);
const double EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    ll X, Y;
    cin >> X >> Y;
    cout << (abs(X-Y) > 1? "Alice" : "Brown") << endl;
}

Measured memory_bytes: 3588
n = int(input())

ans = 0
for _ in range(n):
    x, u = input().split()
    if u == 'JPY':
        ans += int(x)
    else:
        ind = x.index('.')
        ans += int(x[:ind]) * 380000
        ans += int(x[ind+1:]) * 38 / 10000

print(ans)

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

void prians(bool answer) {
  if(answer)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
string s;
vector<int> xy[2];
int goal[2];

void make();
bool solve();

int main() {
  cin >> s >> goal[0] >> goal[1];
  goal[0] += 8000;
  goal[1] += 8000;
  make();
  prians(solve());
  return 0;
}

void make() {
  int cnt = 0, now = 0;
  for(int i = 0; i < s.size(); ++i) {
    if(s[i] == 'F') ++cnt;
    if(s[i] == 'T' || i == s.size() - 1) {
      xy[now].push_back(cnt);
      now = 1 - now;
      cnt = 0;
    }
  }
}

bool solve() {
  bitset<16005> bt[2];
  bt[0][8000 + xy[0][0]] = 1;
  bt[1][8000] = 1;
  for(int t = 0; t < 2; ++t) {
    for(int i = 0; i < xy[t].size(); ++i) {
      if(t == i && i == 0) continue;
      bt[t] = (bt[t] << xy[t][i]) | (bt[t] >> xy[t][i]);
    }
    if(!bt[t][goal[t]]) return 0;
  }
  return 1;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
	int n;
	cin >> n;
	vector <int> a(n);
	double sum =0;
	for (int i =0;i<n;i++) {
		cin >> a[i];
		sum += (double) 1/a[i];
	}
	cout << (double) 1/ sum << endl;
	return 0;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, C = MAP()

if A == B:
	print(C)
else:
	print(max(0, C-(A-B)))

Measured memory_bytes: 5972
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

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


int main(){
    int N;
    int L[11];
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> L[i];
    }

    sort(L, L+N);
    int s = 0;
    for(int i = 0; i < N-1; i++) {
        s += L[i];
    }

    if(L[N-1] < s){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;

}


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

using namespace std;

const int N = 100005;

int a[N];
int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    cout << a[n] << " ";
    int cl = 2e9+1; double x = a[n] / 2.0;
    for (int i = 1; i <= n; i++) {
        if (abs(x - a[i]) < abs(x - cl)) {
            cl = a[i];
        }
    }
    cout << cl << endl;
    return 0;
}


Measured memory_bytes: 640
from fractions import gcd

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

dp=[[[float("inf") for i in range(0,401)] for j in range(0,401)] for k in range(0,N)]

for i in range(0,401):
    for j in range(0,401):
        if not (i==0 and j==0):
            g=gcd(i,j)
            I=i//g
            J=j//g
            if I==ma and J==mb:
                dp[0][i][j]=0
            else:
                g=gcd(i+med[0][0],j+med[0][1])
                I=(i+med[0][0])//g
                J=(j+med[0][1])//g
                if I==ma and J==mb:
                    dp[0][i][j]=med[0][2]

for i in range(1,N):
    a,b,c=med[i]
    for j in range(0,401-a):
        for k in range(0,401-b):
            dp[i][j][k]=min(dp[i-1][j][k],c+dp[i-1][j+a][k+b])

if dp[N-1][0][0]==float("inf"):
    print(-1)
else:
    print(dp[N-1][0][0])


Measured memory_bytes: 199148
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<ll> A(N);
	vector<vector<ll>> B(N);
	rep(i,N)cin >> A[i];
	for(int i=0;i<N;i++){
		for(int j=-1;j<2;j++){
			B[i].push_back(A[i]+j);
		}
	}
	int ans = 0;
	for(int i=0;i<(int)pow(3,N);i++){
		int now = i;
		vector<ll> t;
		for(int j=0;j<N;j++){
			int next = now%3;
			now /= 3;
			t.push_back(B[j][next]);
		}
		ll v = 1;
		for(auto x:t){
			v*=x;
		}
		if(v%2==0){
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T, class T2> void smin(T& a, T2 val) {if (a > val) a = val;}template<class T, class T2> void smax(T& a, T2 val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

void yes(){
   cout<<"Yes"<<endl;
   //exit (0);
}
void no(){
   cout<<"No"<<endl;
   //exit (0);   
}

int n, k, a[N];
string s, t;
vector<int> v[N];

bool seen[N];
vector<int> cycles;

int till = 1;
void dfs(int s){
   if (seen[s]){
      till = s;
      return ;
   }
   cycles.push_back(s);
   seen[s] = 1;
   for(auto i: v[s]){
      dfs(i);
   }
}

int32_t main(){_

   cin >> n >> k;
      
   for (int i = 1; i <= n; ++i)
   {
      int x;
      cin >> x;
      if (i == 1 and x == 1){
         cout<<1;
         exit(0);
      }
      v[i].push_back(x);
   }
   
   dfs(1);

   tr(cycles);
   int sz = (int)(cycles.size());
   if (sz == 1){
      assert(cycles[0] == 1);
      cout<<1;
      exit(0);
   }

   int pos = 0;
   for (int i = 0; i < (int)(cycles.size()); ++i)
   {
      if (k == 0){
         cout<<cycles[i];
         exit(0);
      }
      if (cycles[i] == till){
         pos = i;
         break;
      }
      --k;
   }

   vector<int> v;
   for (int i = pos; i < (int)(cycles.size()); ++i)
   {
      v.push_back(cycles[i]);
   }

   sz = (int)(v.size());
   k %= sz;
   cout<<v[k];

   return 0;
}

Measured memory_bytes: 33248
#include<iostream>
#include<set>
#include<map>
#define fi        first
#define se        second
#define pb        push_back
#define PI        acos(-1)
#define LC(a)     ((a<<1))
#define RC(a)     ((a<<1)+1)
#define MID(a,b)  ((a+b)>>1)
#define mem(a, b) memset(a, b, sizeof(a))
#define IOS()     std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef pair<ll,ll>   PLL;
typedef pair<ll,int>  PLI;
const int INF = 0X3F3F3F3F;
const int MIN = -(1<<30);
const ll N = 2e5+7;
ll a[N];
inline void solve()
{
	int n;
	cin>>n;
	set<ll> s,ss;
	map<ll,ll> mp,mpp;
	for(int i=1; i<=n; i++)
	{
		cin>>a[i];
		ss.insert(a[i]);
		mp[a[i]]++;
		if(mp[a[i]]>=2) s.insert(a[i]);
	}
	ll sum = 0;
	for(auto it:s)
		sum += mp[it]*(mp[it]-1)/2;

	for(int i=1; i<=n; i++)
		cout<<sum-mp[a[i]]+1<<endl;

}
int main()
{
	IOS();
	solve();
	return 0;
}




Measured memory_bytes: 21248
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    vector<int> num(8);
    int x=0,y=0;
    for(int i=0; i<8; i++) scanf("%1d",&num[i]);
    sort(num.begin(),num.end());
    for(int i=0; i<8; i++) x = x*10+num[i];
    for(int i=7; i>=0; i--) y = y*10+num[i];
    cout <<y-x<<endl;
  }
  return 0;
}

Measured memory_bytes: 1264
#include<bits/stdc++.h>
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
int input() {
	int r;
	cin >> r;
	//scanf("%lld", &r);
	return r;
}
int n, a10, a50, a100, a500, s10, s50, s100, s500;
int f(int p10, int p50, int p100, int p500) {
	int t = p10 * 10 + p50 * 50 + p100 * 100 + p500 * 500 - n;
	int r = a10 + a50 + a100 + a500 - p10 - p50 - p100 - p500;
	r += t % 50 / 10; t = t / 50 * 50;
	r += t % 100 / 50; t = t / 100 * 100;
	r += t % 500 / 100; t = t / 500 * 500;
	r += t / 500;
	return r;
}
signed main() {
	while (cin >> n, n) {
		if (s10 + s50 + s100 + s500)printf("\n");
		s10 = -1;
		cin >> a10 >> a50 >> a100 >> a500;
		for0(i, a10 + 1)for0(j, a50 + 1)for0(k, a100 + 1)for0(l, a500 + 1) {
			if (i * 10 + j * 50 + k * 100 + l * 500 < n)continue;
			if (s10 == -1) {
				s10 = i; s50 = j; s100 = k; s500 = l;
			}
			else if (f(i, j, k, l) < f(s10, s50, s100, s500)) {
				s10 = i; s50 = j; s100 = k; s500 = l;
			}
		}
		if (s10)printf("10 %d\n", s10);
		if (s50)printf("50 %d\n", s50);
		if (s100)printf("100 %d\n", s100);
		if (s500)printf("500 %d\n", s500);
	}
}


Measured memory_bytes: 3140
n, W = map(int, input().split())
ab = [tuple(map(int, input().split()))for _ in range(n)]
ab.sort()

dp = [[0]*W for _ in range(n+1)]
for i in range(1, n+1):
    w, v = ab[i-1]
    for j in range(W):
        if dp[i][j] < dp[i-1][j]:
            dp[i][j] = dp[i-1][j]

        if 0 <= j-w and dp[i][j] < dp[i-1][j-w]+v:
            dp[i][j] = dp[i-1][j-w]+v


ans = 0
for i in range(n):
    a, b = ab[i]
    if ans < dp[i][W-1]+b:
        ans = dp[i][W-1]+b
print(ans)


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

int main() {
 int A, P;
  cin >> A >> P ;
  
  if (A == 0 && P < 2) {
    cout << 0 << endl;
  }
    else {
      cout <<  ( 3 * A + P ) / 2 << endl;
    }
    
  
}


Measured memory_bytes: 256
import scala.collection.mutable.{HashSet => MSet}
import scala.io.StdIn._
object Main extends App {
  val Dirs = Seq((-1, 0), (1, 0), (0, -1), (0, 1))
  val checked = MSet[(Int, Int)]()

  val Array(h, w) = readLine.split(" ").map{_.toInt}
  val field: Array[String] = (1 to h).map{i => readLine}.toArray
  val Blacks = field.map{_.count(_ == '#')}.sum

  def valid(x: Int, y: Int): Boolean =
    0 < x && x <= w && 0 < y && y <= h && field(y - 1).charAt(x - 1) == '.' && !checked(x, y)

  @scala.annotation.tailrec
  def check(pos: Set[(Int, Int)], step: Int = 1): Int = {
    val valids = (for {
      (x, y) <- pos
      (dx, dy) <- Dirs if (valid(x + dx, y + dy))
    } yield (x + dx, y + dy)).toSet
    checked ++= valids
    if (checked(w, h)) w * h - (Blacks + step + 1)
    else if (valids.size == 0) -1
    else check(valids, step + 1)
  }

  println(check(Set((1, 1))))
}

Measured memory_bytes: 29132
#include <iostream>
using namespace std;
int main() {
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;
  if (x+r<=W && y+r<=H && x-r>=0 && y-r>=0) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}


Measured memory_bytes: 3072
#include <cstdio>
#include <queue> 
using namespace std;
const int MAXN=1e5+7;
char nam[MAXN][15];
int tim[MAXN];
queue<int> qu;
int main () {
	int n,q,cnt=0;
	scanf ("%d%d",&n,&q);
	for (int i=0;i<n;i++) {
		scanf ("%s%d",nam[i],&tim[i]);
		qu.push(i);
	}
	while (!qu.empty()) {
		int cur=qu.front();
		qu.pop();
		if (tim[cur]>q) {
			qu.push(cur);
			tim[cur]-=q;
			cnt+=q;
		} else {
			cnt+=tim[cur];
			printf ("%s %d\n",nam[cur],cnt);
		}
	}
    return 0;
}


Measured memory_bytes: 3820
N = int(input())
A = list(map(int,input().split()))
As = sorted(A, reverse=True)
ct = 0
if (N-1)%2 == 0:
    n = (N-2) // 2
    for i in range(n+2):
        if i == 0:
            ct += As[i]
        elif i == n+1:
            ct += As[i]
        else:
            ct +=2*As[i]
elif (N-1)%2 == 1:
    n = (N-2) // 2
    for i in range(n+1):
        if i == 0:
            ct += As[i]
        else:
            ct += 2*As[i]
print(ct)

Measured memory_bytes: 31460
//no print start
#pragma region Header
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <complex>
#include <bitset>
#include <random>
#include <ctime>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

typedef long long ll, lint;
typedef long double ldouble;

#define sz(v) ((int) (v).size())
#define FOR(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define For(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()

#ifdef ALEX
#define eprintf(...) fprintf(stdout, __VA_ARGS__)
#define print_var(x) cout << #x << " = " << x << endl
#define print_array(arr, len) {cout << #arr << " = "; for(int i = 0; i < len; ++i) cout << arr[i] << ' '; cout << endl;}
#define print_iterable(it) {cout << #it << " = "; for(const auto& e : it) cout << e << ' '; cout << endl << endl;}
#define print_2d_array(arr, len1, len2) {\
		cout << #arr << ':' << endl;\
		for(int i = 0; i < len1; ++i, cout << endl) \
			for(int j = 0; j < len2; ++j)\
				cout << arr[i][j] << ' '; \
		cout << endl;\
	}
#define print_endl() cout << endl
#else
#define eprintf(...) (void)0
#define print_var(x) (void)0
#define print_array(arr, len) (void)0;
#define print_iterable(it) (void)0;
#define print_2d_array(arr, len1, len2) (void)0;
#define print_endl() (void)0
#endif

#define forn(var, count) for (int var = 0; var < count; var++)

template<class T>
string to_string(T arr, int len = 1e9) {
	stringstream ss;
	int i = 0;
	for (auto item : arr) {
		ss << item << ' ';
		if (++i == len)
			break;
	}
	return ss.str();
}

#ifdef ALEX
#define dbg(expr) cout << "[line " << __LINE__ << "] " << (#expr) << ": " << (expr) << endl;
#else
#define dbg(expr) (void) 0;
#endif

#pragma endregion
//no print end

void solve() {
	int n;
	scanf("%d", &n);
	vector<int> arr(n);
	map<int, int> counts[2];
	for (int i = 0; i < n; i++) {
		scanf("%d", &arr[i]);
		counts[i % 2][arr[i]]++;
	}
	set<pair<int, int> > first, second;
	for (auto e : counts[0])
		first.insert({ e.second, e.first });
	for (auto e : counts[1])
		second.insert({ e.second, e.first });
	int ans = n;
	for (auto e : first) {
		int cur = n - e.first;
		if (second.rbegin()->second != e.second)
			cur -= second.rbegin()->first;
		else if (second.size() > 1)
			cur -= (++second.rbegin())->first;
		ans = min(ans, cur);
	}
	printf("%d", ans);
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
#ifdef ALEX
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	solve();
	eprintf("\n\ntime: %.3lf\n", (double)clock() / CLOCKS_PER_SEC);
}

Measured memory_bytes: 9984
#include <iostream>
#include <cmath>
#include <cassert>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
#include <type_traits>
//#include <bits/stdc++.h>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// print(x, y, z);
// printVec(va.begin(), va.end());
void print(){ std::cout << std::endl; }
template <typename Head> void print(Head&& head) { std::cout << head << std::endl; }
template <typename Head, typename... Tail> void print(Head&& head, Tail&&... tail)
{
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...); // or print(tail...);
}
template<typename Iterator> void printVec(Iterator begin, Iterator end)
{
  for (Iterator it = begin; it != end; it++) {
    std::cout << "[" << std::distance(begin, it) << "] " << *it << " ";
    if (std::distance(begin, it) % 20 == 19) { std::cout << std::endl; }
  }
  std::cout << std::endl;
}

template<typename T> T lminimum(const std::vector< T >& v) {return *std::min_element(v.begin(), v.end());}
template<typename T> T lmaximum(const std::vector< T >& v) {return *std::max_element(v.begin(), v.end());}
template<typename T> void lunique(std::vector< T >& v) {v.erase(std::unique(v.begin(), v.end()), v.end());}
template<typename T> void lsort(std::vector< T >& v) {std::sort(v.begin(), v.end());}
template<typename T> void lgreatersort(std::vector< T >& v) {std::sort(v.begin(), v.end(), std::greater<>());}
template<typename T> bool lnext_permutation(std::vector< T >& v) {return std::next_permutation(v.begin(), v.end());}

int main(int argc, char* argv[])
{
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  ll N, C;
  std::cin >> N >> C;

  // ある色からある色への距離
  std::vector< std::vector<ll> > dist(C, std::vector<ll>(C, 0LL));
  for (ll y = 0; y < C; y++) {
    for (ll x = 0; x < C; x++) {
      std::cin >> dist[y][x];
    }
  }

  std::vector< std::vector<ll> > grid(N, std::vector<ll>(N, 0LL));
  for (ll y = 0; y < N; y++) {
    for (ll x = 0; x < N; x++) {
      ll c;
      std::cin >> c;
      grid[y][x] = c - 1;
    }
  }

  // グループ毎に色を変えるコストを算出
  std::vector< std::vector<ll> > cost(3, std::vector<ll>(C, 0LL));
  for (ll y = 0; y < N; y++) {
    for (ll x = 0; x < N; x++) {
      ll type = (y + x) % 3;
      for (ll color = 0; color < C; color++) {
	cost[type][color] += dist[grid[y][x]][color];
      }
    }
  }

  ll ans = INF;
  for (ll i = 0; i < C; i++) {
    for (ll j = 0; j < C; j++) {
      for (ll k = 0; k < C; k++) {
	if (i == j || j == k || k == i) continue;
	ll all_cost = cost[0][i] + cost[1][j] + cost[2][k];
	ans = std::min(ans, all_cost);
      }
    }
  }

  print(ans);

  return 0;
}


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

int main()
{
    int m;
    cin >> m;
    cout << 48 - m << endl;
}

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

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

  set<ll> s;
  auto dfs = [&](auto&& dfs, ll a) {
    if (a > MAX) return;
    s.insert(a);
    for (ll d = max(0ll, a % 10 - 1); d <= min(9ll, a % 10 + 1); d++) dfs(dfs, 10 * a + d);
  };
  for (ll i = 1; i <= 9; i++) dfs(dfs, i);

  vector<ll> r(s.begin(), s.end());
  cout << r[k - 1] << endl;
}


Measured memory_bytes: 5760
def solve_e(n, a_list):
    days = 0
    ind_list = [0] * n
    match_count = 0
    queue = list(range(n))
    stack = dict()
    while len(queue) > 0:
        days += 1
        new_queue = []
        for p in queue:
            if ind_list[p] < n - 1:
                q = a_list[p][ind_list[p]] - 1
                k = str(min(p, q)) + "_" + str(max(p, q))
                if k in stack.keys():
                    ind_list[p] += 1
                    ind_list[q] += 1
                    # print(days, p, q)
                    new_queue.append(p)
                    new_queue.append(q)
                    match_count += 1
                else:
                    stack[k] = 1
        queue = new_queue
    if match_count == n * (n - 1) // 2:
        return days - 1
    else:
        return -1


def test():
    N = 1000
    A_list = []
    for i in range(N):
        A_list.append(list(range(1, i + 1)) + list(range(i + 2, N + 1)))
    print(solve_e(N, A_list))


def main():
    N = int(input())
    A_list = []
    for _ in range(N):
        A_list.append(list(map(int, input().split())))
    print(solve_e(N, A_list))


if __name__ == "__main__":
    main()


Measured memory_bytes: 91424
#include<stdio.h>

int main(){
  int n;
  scanf("%d", &n);
  int y;
  scanf("%d", &y);
  y /= 1000;
  
  for (int i=0; i<=n; i++)
  {
    for (int j=0; j<=n-i; j++)
    {
      int k = n - i - j;
      if (i*10+j*5+k==y)
      {
        printf("%d %d %d", i, j, k);
        return 0;
      }
    }
  }
    
  printf("-1 -1 -1");
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#define N 100
#define INF 100000
#define origin 0
#define discover 1
#define death 2
int n,A[N][N];
int prim(void);
int main(){
  int x,i,j,z;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&x);
      if(x==-1)
	A[i][j]=INF;
      else
	A[i][j]=x;
    }
  }
  z=prim();
  printf("%d\n",z);
  return 0;
    }

int prim(void){
  int condition[N],a[N],b[N];
  int i,v,mincost,u,z;
  for(i=0;i<n;i++){
    a[i]=INF;
    b[i]=-1;
    condition[i]=origin;
  }
  a[0]=0;
  while(1){
    mincost=INF;
    u=-1;
    for(i=0;i<n;i++){
      if(condition[i]!=death&&a[i]<mincost){
	u=i;
	mincost=a[i];
      }
    }
    if(u==-1)
      break;
    condition[u]=death;
    for(v=0;v<n;v++){
      if(condition[v]!=death&&A[u][v]!=INF){
	if(a[v]>A[u][v]){
	  a[v]=A[u][v];
	  b[v]=u;
	  condition[v]=discover;
	}
      }
    }
  }
 
  z=0;
  for(i=0;i<n;i++){
    if(b[i]!=-1)
      z+=A[i][b[i]];
  }
  return z;
}



Measured memory_bytes: 2112
n = int(input())
h = list(map(int, input().split()))
l = [0]*(n-1)
for i in range(n-1):
    if (h[i]>=h[i+1]):
        l[i] = 1

ans = []
a = 0
for i in range(n-1):
    if (l[i]==1):
        a += 1
    else:
        ans.append(a)
        a = 0
ans.append(a)
print(max(ans))
        

Measured memory_bytes: 14252
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
#define MIN(a,b) ((a) < (b) ? (a) : (b))
struct node {
  int id;
  int cap;
  struct node *next;
};
struct node **list;
int **flow, *visit;
void Insert(int, int);
int Maxflow(int, int, int, int);
int main(void)
{
  int i, x, y, v, e, s, t, maxflow = 0;
  scanf("%d %d %d", &x, &y, &e);
  v = x + y + 2;
  list = (struct node**)malloc(sizeof(struct node*) * v);
  flow = (int**)malloc(sizeof(int*) * v);
  visit = (int*)malloc(sizeof(int) * v);
  for (i = 0; i < v; i++) {
    list[i] = NULL;
    flow[i] = (int*)calloc(v, sizeof(int));
  }
  for (i = 0; i < e; i++) {
    scanf("%d %d", &s, &t);
    Insert(0, s + 1);
    Insert(x + t + 1, v - 1);
    Insert(s + 1, x + t + 1);
  }
  while (1) {
    int f;
    for (i = 0; i < v; i++) visit[i] = 0;
    f = Maxflow(0, v - 1, v, INT_MAX);
    if (!f) break;
    maxflow += f;
  }
  printf("%d\n", maxflow);
  for (i = 0; i < v; i++) {
    free(list[i]);
    free(flow[i]);
  }
  free(list);
  free(flow);
  free(visit);
}
void Insert(int a, int b)
{
  struct node *p = (struct node*)malloc(sizeof(struct node));
  p->id = b;
  p->cap = 1;
  p->next = list[a];
  list[a] = p;
  p = (struct node*)malloc(sizeof(struct node));
  p->id = a;
  p->cap = 0;
  p->next = list[b];
  list[b] = p;
}
int Maxflow(int s, int t, int size, int f)
{
  struct node *n;
  visit[s] = 1;
  if (s == t) return f;
  for (n = list[s]; n != NULL; n = n->next) {
    int v = n->id;
    if (!visit[v] && flow[s][v] < n->cap) {
      int d = Maxflow(v, size - 1, size, MIN(f, n->cap - flow[s][v]));
      if (d > 0) {
        flow[s][v] += d;
        flow[v][s] -= d;
        return d;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3744
#include <iostream>
using namespace std;
int main() {
    int cnt=0;
    string S,T;
    cin >> S >> T;
    for (int i=0; i<3; i++) {
        if (S[i] == T[i]) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())

max_count = 0
for i in range(1, N+1):
  n = i
  count = 0
  while n > 0 and n % 2 == 0:
    n = n//2
    count += 1
  if count == max(max_count, count):
    res = i
    max_count = count
print(res)    

Measured memory_bytes: 3060
#include <iostream>
#include <cstring> 
#include <cstdlib>
#include <stack>
using namespace std;
int main(){
	stack<int> s;
	string x;
	int a,b;
	while (cin>>x){
		if (x[0]=='+'){
			a=s.top();s.pop();
			b=s.top();s.pop();
			s.push(a+b);
		}
		else if (x[0]=='-'){
			a=s.top();s.pop();
			b=s.top();s.pop();
			s.push(b-a);
		}
		else if (x[0]=='*'){
			a=s.top();s.pop();
			b=s.top();s.pop();
			s.push(a*b);
		}
		else s.push(atoi(x.c_str()));
	}
	cout<<s.top()<<endl;
	return 0;
} 

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

int main(){
  int N,L;
  cin >> N >> L;

  int n;

  if(L >= 0){
    n = 1;
  }else if(L <= -N + 1){
    n = N;
  }else{
    n = 1 - L;
  }

  int Ans=0;

  for(int i = 1; i <= N; i++){
    Ans += L + i - 1;
  }

  Ans = Ans - (L + n - 1);

  cout << Ans << endl;
}

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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 2e3+5;
ll n , a[N] , cnt[N] , pre[N] , ans;

ll nCr(ll nn , ll r)
{
    if (nn < 3) return 0;
    ll res = nn*(nn-1)*(nn-2) / 6;
    return res;
}

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

    cin >> n;
    for(int i=1; i<=n; i++)
        cin >> a[i] , cnt[a[i]]++;

    for(int i=1; i<N; i++)
        pre[i] = cnt[i]+pre[i-1];

    for(int i=1; i<=1000; i++)
    {
        for(int j=i; j<=1000; j++)
        {
            ll idx = i+j-1 , tmp = pre[idx] - pre[j];

            if (i==j)
            {
                ans += (cnt[i]*(cnt[i]-1)/2) * tmp; //first two sides are same
                ans += nCr(cnt[i],3); //all three sides are the same
            }
            else
            {
                ans += (cnt[i]*cnt[j]*tmp); //all three sides are different
                ans += (cnt[i]*(cnt[j]*(cnt[j]-1)/2)); //second and third sides are same
            }
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
a,b = map(int,input().split())
cost = [[int(i) for i in input().split()] for j in range(10)]
ans = 0
for k in range(10):
    for i in range(10):
        for j in range(10):
            if cost[i][k] < 10000 and cost[k][j] < 10000:
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j])
for i in range(a):
  for j in input().split():
    j = int(j)
    if j == 0 or 2 <= j <= 9:
      ans += cost[j][1]
print(ans)

Measured memory_bytes: 3064
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 s = cin.Read;
            var k = cin.ReadInt;

            var _s = s[k-1];
            var ans = string.Empty;
            foreach (var w in s) {
                if (w == _s) {
                    ans += w.ToString();
                } else {
                    ans += "*";
                }
            }
            WriteLine(ans);
        }

        private double MultipleCeil(double value, double multiple) {return Math.Ceiling(value / multiple) * multiple;}

    }

    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: 11220
import sys
import random

sys.setrecursionlimit(500000)
def input():
    return sys.stdin.readline()[:-1]

D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(D)]
#t = [int(input()) for i in range(D)]
#M = int(input())
#Q = [list(map(int,input().split())) for i in range(M)]

def init():
    cont = 0
    last = [0]*26
    t = []
    for i in range(D):
        max_c = 0
        max_i = -1
        for j in range(26):
            if max_c < s[i][j] + c[j]*(i+1-last[j]):
                max_i = j
                max_c = s[i][j] + c[j]*(i+1-last[j])
        t.append(max_i+1)        
        cont += s[i][t[i]-1]
        last[t[i]-1] = i+1
    return t,cont

def content(t):
    cont = 0
    last = [0]*26
    for i in range(D):
        cont += s[i][t[i]-1]
        last[t[i]-1] = i+1
        for j in range(26):
            cont -= c[j]*(i+1-last[j])
    return cont

def main():
    t,prev = init()
    for i in range(7777):
        d,q = random.randint(0,D-1), random.randint(1,26)
        prev_t = t[d]
        t[d] = q
        now = content(t)
        if prev>content(t):
            t[d] = prev_t
        else:
            prev=now
    for a in t:
        print(a)


if __name__ == '__main__':
    main()





Measured memory_bytes: 81816
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<int, int>;
template <class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

// debug
template <class T> ostream& operator<<(ostream &s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream &s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream &s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }

struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
constexpr int MOD = 1000000007;
// *************** TEMPLATE END *************** 

signed main() {
  int n; cin >> n;
  string ss; cin >> ss;
  vector<int> s(n); REP (i, n) s[i] = ss[i] - '1';
  vector<vector<int>> a(9, vector<int>(9));
  REP (i, n - 1) {
    int x = s[i], y = s[i + 1];
    if (x > y) swap(x, y);
    a[x][y]++;
  }
  vector<int> va;
  int ans = 1e18;
  vector<int> t(9); REP (i, 9) t[i] = i;
  do {
    int acc = 0;
    REP (i, 9) {
      REPI (j, i + 1, 9) {
        int x = t[i], y = t[j];
        if (x > y) swap(x, y);
        int dis = abs(i % 3 - j % 3) + abs(i / 3 - j / 3);
        acc += a[x][y] * dis;
      }
    }
    if (chmin(ans, acc)) {
      va = t;
    }
  } while (next_permutation(ALL(t)));
  REP (i, 3) {
    REP (j, 3) {
      cout << va[3 * i + j] + 1;
    }
    cout << endl;
  }
}



Measured memory_bytes: 4084
#include <stdio.h>

int main(){
	int n,a = 0,w=0,t = 0,r = 0;
	scanf("%d",&n);
	char s[10];
	for(int i = 0;i<n;i++){
		scanf("%s",&s);
		if(s[0] == 'A'){
			a++;
		}
		else if(s[0] == 'W'){
			w++;
		}
		else if(s[0] == 'T'){
			t++;
		}
		else if(s[0] == 'R'){
			r++;
		}
	}
	printf("AC x %d\n",a);
	printf("WA x %d\n",w);
	printf("TLE x %d\n",t);
	printf("RE x %d\n",r);
	
	return 0;
}


Measured memory_bytes: 1736
from bisect import bisect_left

a, b, q = map(int, input().split())
dummy = 10 ** 18 + 1
s = [-dummy] + [int(input()) for _ in range(a)] + [dummy]
t = [-dummy] + [int(input()) for _ in range(b)] + [dummy]
x = [int(input()) for _ in range(q)]

for i in x:
    # 神社から先に行くパターン
    idx_s, idx_t = bisect_left(s, i), bisect_left(t, i)
    ans = dummy
    for j in [s[idx_s-1], s[idx_s]]:
        for k in [t[idx_t-1], t[idx_t]]:
            res1, res2 = abs(j - i) + abs(k - j), abs(k - i) + abs(j - k)
            ans = min(ans, res1, res2)
    print(ans)


Measured memory_bytes: 20964
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int h[] = new int[n];
        for(int i=0;i<n;i++)h[i]=sc.nextInt();

        long dp[]= new long[n];
        dp[0]=0;
        dp[1]=Math.abs(h[1]-h[0]);

        for(int i=2;i<n;i++){
            dp[i]=Math.min(dp[i-2]+Math.abs(h[i-2]-h[i]),dp[i-1]+Math.abs(h[i-1]-h[i]));
        }
        System.out.println(dp[n-1]);
    }
}


Measured memory_bytes: 50132
n = int(input())
h = list(map(int, input().split()))

dp = [0]*n
dp[1] = abs(h[1] - h[0])

for i in range(2, n):
    dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]),
                dp[i-2] + abs(h[i-2] - h[i]))

print(dp[-1])


Measured memory_bytes: 13980
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
#define vpll vector<pair<ll,ll> >
using namespace std;
const int maxn = 1000100;
ll spf[maxn];
ll n, arr[maxn];

bool occurs[maxn];

ll gcd(ll a, ll b) {
	if(a < b) swap(a, b);

	while(b > 0) {
		ll tmp = a % b;
		a = b;
		b = tmp;

		if(a < b) swap(a, b);
	}
	return a;
}

// Function that generates the smallest prime factor of a number
// Can be used to factorize a number in O(logN)
void generate_spf() {
	spf[1] = 1;
	for(ll i=2LL;i<maxn;i++) {
		if(spf[i] == 0) {
			spf[i] = i;
			for(ll j=1LL*i*i;j<maxn;j+=i) {
				if(spf[j] == 0) { 
					spf[j] = i;
				}
			}
		}
	}
}

// Factorizes a number in O(log N) assuming x <= maxn
// Product(result[i].first ^ result[i].second) = x
vector<pair<ll,ll> > factorize_lg(ll x) {
	vector<pair<ll, ll> > result;
	while(x > 1) {
		result.pb(mp(spf[x], 0));

		while(spf[x] == result.back().first) {
			result.back().second++;
			x /= spf[x];
		}
	}
	return result;
}

int main() {
	generate_spf();

	cin>>n;

	bool check = true;
	ll total_gcd;
	for(int i=1;i<=n;i++) {
		cin>>arr[i];

		if(i == 1) total_gcd = arr[i];
		else total_gcd = gcd(total_gcd, arr[i]);

		vpll curr = factorize_lg(arr[i]);

		for(auto i:curr) {
			if(occurs[i.first]) {
				check = false;
			}
			occurs[i.first] = true;
		}
	}

	if(check) {
		cout<<"pairwise coprime\n";
	}
	else {
		if(total_gcd == 1) {
			cout<<"setwise coprime\n";
		}
		else {
			cout<<"not coprime\n";
		}
	}
}

Measured memory_bytes: 20232
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin)-1;i>=(end);i--)
#define IREP(i, n) IFOR(i,n,0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" << v[0]; FOR(i_debug, 1, v.size()){ cout << "," << v[i_debug]; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;


template<typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) { REP(i, a.size()) {cin >> a[i]; a[i]--;} }

ll mod = 1000000007;

int main()
{
	// 入力
	ll A, B;
	cin >> A >> B;

	ll ans = 0;
	B -= 1;
	while (B > 0) {
		ans++;
		B -= A - 1;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
	public static void main(String args[]){
		Scanner s=new Scanner(System.in);
		int a;
		while(true){
			a=s.nextInt();
			if(a==0)System.exit(0);
			int ret=1;
			int B=5;
			int U=1;
			int R=3;
			int L=4;
			int F=2;
			int D=6;
			for(int i=0;i<a;i++){
				String str=s.next();
				if(str.equals("North")){
					int newB=U;
					int newU=F;
					int newD=B;
					int newF=D;
					B=newB;
					U=newU;
					F=newF;
					D=newD;
				}
				if(str.equals("East")){
					int newU=L;
					int newL=D;
					int newR=U;
					int newD=R;
					U=newU;
					L=newL;
					R=newR;
					D=newD;
				}
				if(str.equals("South")){
					int newB=D;
					int newU=B;
					int newD=F;
					int newF=U;
					B=newB;
					U=newU;
					F=newF;
					D=newD;
				}
				if(str.equals("West")){
					int newU=R;
					int newL=U;
					int newR=D;
					int newD=L;
					U=newU;
					L=newL;
					R=newR;
					D=newD;
				}
				if(str.equals("Right")){
					int newF=R;
					int newB=L;
					int newR=B;
					int newL=F;
					F=newF;
					B=newB;
					R=newR;
					L=newL;
				}
				if(str.equals("Left")){
					int newF=L;
					int newB=R;
					int newR=F;
					int newL=B;
					F=newF;
					B=newB;
					R=newR;
					L=newL;
				}
				ret+=U;
			}
			System.out.println(ret);
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define int long long
#define sz(x) (int)x.size()
#define mp make_pair
#define fi first
#define se second
#define io ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;

int dfs(vi v[],vector<bool>& visited,int src)
{
	int sz = 1;
	visited[src]=1;
	for(auto it:v[src])
	{
		if(!visited[it])
		{
			sz=sz+dfs(v,visited,it);
		}
	} 
	return sz;
}

signed main()
{
	int n,m;
	cin >> n >> m;
	vi v[n];

	rep(i,0,m)
	{
		int a,b;
		cin >> a >> b;
		a--;
		b--;
		v[a].pb(b);
		v[b].pb(a);

	}
	vector<bool> visited(n,false);

	int ans = 0;
	rep(i,0,n)
	{
		if(!visited[i])
		{
			int x = dfs(v,visited,i);
			ans = max(ans,x);
		}
	}
	cout << ans <<endl;

}
 
	
		



Measured memory_bytes: 27016
#include<stdio.h>

int main()
{
	int d;
	int d1,d10;
	int m;
	int cnt=0;
	int mon,day;
	
	scanf("%d%d",&m,&d);
	for(mon=1;mon<=m;mon++)
	{
		for(day=1;day<=d;day++)
		{
			d1=day%10;
			d10=day/10;
			if(d1>=2&&d10>=2&&d1*d10==mon)
			{
				cnt++;
			}
		}
	}
	printf("%d",cnt);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int h,w;
    cin>>h>>w;
    char s[h][w];
    rep(i,h){
        rep(j,w) cin>>s[i][j];
    }
    rep(i,h){
        rep(j,w){
            if(s[i][j]=='#'&&s[i][j]!=s[i][j-1]&&s[i][j]!=s[i][j+1]&&s[i][j]!=s[i-1][j]&&s[i][j]!=s[i+1][j]){
                cout<<"No"; return 0;
            }
        }
    }
    cout<<"Yes";
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s,t,l,m;
  cin>>s;
  t=s;
  size_t size = s.length();
  reverse(s.begin(), s.end());
  if(s==t)
  {
    int n;
    n=size/2;
    l=s;
    std::string substr=l.substr(0, n);
    m=substr;
    reverse(substr.begin(), substr.end());
    if(substr==m)
    {
      cout<<"Yes"<<endl;
    }
    else
    {
       cout<<"No"<<endl;
    }
  }
  else
  {
     cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 100001
int s[N][3], f[N][3], n;
int main() {
    scanf("%d", &n);
    for (int k = 1; k <= n; k++)
        for (int i = 0; i < 3; i++) scanf("%d", &s[k][i]);
    for (int k = 1; k <= n; k++)
        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
                if (i != j) f[k][i] = max(f[k][i], f[k - 1][j] + s[k][i]);
    printf("%d\n", max(max(f[n][0], f[n][1]), f[n][2]));
    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    string ans ="";
    while (1) {
        C -= B;
        if (C <= 0) {
            ans = "Yes";
            break;
        }
        A -= D;
        if (A <= 0) {
            ans = "No";
            break;
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <deque>
#include <cassert>
#define For(i, a, b) for (int i = a; i < b; ++i)
#define Out(i, a, b) for (int i = a - 1; i >= b; --i)
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define files(FileName) read(FileName); write(FileName)
#define read(FileName) freopen((FileName + ".in").c_str(), "r", stdin)
#define write(FileName) freopen((FileName + ".out").c_str(), "w", stdout)
using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }

using namespace std;

typedef long long base;

const string FILENAME = "input";
const int MAXN = 1e7 + 1, RAME = 10;

long long a, b, c;
set <pair <pair <base, base>, base>> que;

int main() {
    //read(FILENAME);
    ios::sync_with_stdio(0);
    cin >> a >> b >> c;
    while (que.count(mp(mp(a, b), c)) == 0) {
        if ((a & 1) || (b & 1) || (c & 1)) {
            cout << que.size() << endl;
            return 0;
        }
        que.insert({{a, b}, c});
        auto s = a + b + c;
        a = (s - a) / 2;
        b = (s - b) / 2;
        c = (s - c) / 2;
    }
    cout << -1 << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
#include<deque>
#include<queue>
#include<string>
#include<iostream>
#include<tuple>
#include<utility>
#include<set>
#include<queue>
//#include<chrono>
//#include<mt19937>
using namespace std;
typedef long long int llint;
const llint big=2e8;
const int mod=10000000;
#define mt make_tuple
#define mp make_pair
#define fir first
#define sec second
#define pub push_back
#define res resize
#define ins insert
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
class SCC{
/*
	使い方
	roadに辺を、rroadにその逆を突っ込んでください
	メンバ関数のdo_sccしてください
	unite_sccでまとめることができます
	*/
public:
	vector<vector<int>>road;
	vector<vector<int>>rroad;
	vector<int>ban;//帰りがけ順の場所
	vector<bool>sir;//調べたらtrue
	vector<int>uni;//同じ連結成分かどうか
	int n,num,kyonum;
	void dfs_scc(int town){
		if(sir[town]){return;}
		sir[town]=true;//cout<<"de "<<town<<endl;
		for(int i=0;i<road[town].size();i++){dfs_scc(road[town][i]);}
		ban.pub(town);
		return;
	}
	void rdfs_scc(int town){
		if(uni[town]!=0){return;}
		uni[town]=kyonum;//cout<<"rde "<<town<<endl;
		for(int i=0;i<rroad[town].size();i++){rdfs_scc(rroad[town][i]);}
		return;
	}
	void do_scc(void){
		//同じ連結成分を同じ組にしたvectorを返す
		//chain_sccにそれをかますと頂点をまとめてDAGにしてくれる
		n=road.size();
		num=1;
		sir.res(n);
		uni.res(n);
		int i,j;
		for(i=0;i<n;i++){dfs_scc(i);}
		kyonum=1;
		for(i=0;i<n;i++){if(uni[ban[n-i-1]]==0){rdfs_scc(ban[n-i-1]);kyonum++;}}
		return;
	}//kyonumの数だけ成分がある
	vector<vector<int>>Croad;
	vector<vector<int>>Crroad;
	void chain_scc(void){
		//uni番目の街に対応させる
		//uniは1-beginに注意
		int i,j;
		Croad.res(kyonum);
		Crroad.res(kyonum);
		for(i=0;i<n;i++){
			for(j=0;j<road[i].size();j++){if(uni[i]!=uni[road[i][j]]){Croad[uni[i]].pub(uni[road[i][j]]);}}
			for(j=0;j<rroad[i].size();j++){if(uni[i]!=uni[rroad[i][j]]){Crroad[uni[i]].pub(uni[rroad[i][j]]);}}
		}
		for(i=1;i<kyonum;i++){
			sort(Croad[i].begin(),Croad[i].end());
			unique(Croad[i].begin(),Croad[i].end());
			sort(Crroad[i].begin(),Crroad[i].end());
			unique(Crroad[i].begin(),Crroad[i].end());
		}
		return;
	}
};

int main(void){
	static int b_zi[201]={0};//入り次数
	static int p_zi[201]={0};
	static int uses[401]={0};
	uses[200]++;
	class SCC gla;
	gla.road.res(401);
	gla.rroad.res(401);
	int n,h,i,j,a,b,c,d;cin>>n>>h;
	for(i=0;i<n;i++){
		cin>>a>>b>>c>>d;
		int x,y;
		if(c==0){p_zi[a]--;x=-a;}else{b_zi[c]--;x=c;}
		if(d==0){b_zi[b]++;y=b;}else{p_zi[d]++;y=-d;}
		uses[x+200]++;uses[y+200]++;
		gla.road[200+x].pub(200+y);
		gla.rroad[200+y].pub(200+x);
	}
	for(i=1;i<=200;i++){
		if(b_zi[i]<0){cout<<"NO"<<endl;return 0;}
		for(j=0;j<b_zi[i];j++){gla.road[200+i].pub(200);gla.rroad[200].pub(200+i);}
	}
	for(i=1;i<=200;i++){
		if(p_zi[i]>0){cout<<"NO"<<endl;return 0;}
		for(j=0;j<-p_zi[i];j++){gla.road[200].pub(200-i);gla.rroad[200-i].pub(200);}
	}
	gla.do_scc();
	int it=0;
	for(i=0;i<401;i++){
		if(uses[i]==0){it++;}
	}
	if(gla.kyonum<=2+it){cout<<"YES"<<endl;}
	else{cout<<"NO"<<endl;}
	return 0;
	//b_zi -> dbTdb P⊥q
	//pが少なく、bが多いほどいい
	//0を含む路が連結ならよい
}

Measured memory_bytes: 2688