akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define i_love_u_Phuong ios_base::sync_with_stdio(0); cin.tie(0);

using ll = long long;
using namespace std;
typedef pair<int,ll> pii;
map<int,int> mp;

int main()
{
#ifndef RICARDO
    //freopen("input.txt", "r", stdin);
#endif // ONLINE_JUDGE
    i_love_u_Phuong;
    int n;
    cin >> n;

    vector<int>  k2,k4;
    while (n--)
    {
        int k;
        cin >> k;
        mp[k]++;
        if (mp[k]==2) k2.push_back(k);
        else if (mp[k]==4) k4.push_back(k);
    }
    sort(k2.begin(),k2.end(),greater<int>());
    sort(k4.begin(),k4.end(),greater<int>());
    ll max1=0,max2=0;
    if (k2.size()>=2) max1=int64_t(k2[0]) * int64_t(k2[1]);
    if (k4.size()>=1)
    max2=int64_t(k4[0]) *int64_t(k4[0]);
    cout << max(max2,max1);
    return 0;
}



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

using namespace std;

int main(){

  int n;

  while(cin >> n,n){

    int sheet[n + 1][n + 1];

    memset(sheet, 0, sizeof(sheet));

    for(int i = 0; i < n; ++i){
      for(int j = 0; j < n; ++j){

        cin >> sheet[i][j];
        printf("%5d", sheet[i][j]);
        sheet[i][n] += sheet[i][j];

      }

      printf("%5d\n", sheet[i][n]);

    }

    for(int i = 0; i < n + 1; ++i){
      for(int j = 0; j < n; ++j){

        sheet[n][i] += sheet[j][i];

      }

      printf("%5d", sheet[n][i]);

    }

    cout << endl;

  }

}

Measured memory_bytes: 1196
import fractions
A,B,C,D = map(int,input().split())

icm = int(C*D / fractions.gcd(C,D))
ans = (B - A + 1)
if A != B:
    if A % C == 0:
        ans -= int(B // C - A // C) + 1
    else:
        ans -= int(B // C - A // C)
    if A % D == 0:
        ans -= int(B // D - A // D) + 1
    else:
        ans -= int(B // D - A // D)

    if A % icm == 0:
        ans += int(B // icm - A // icm) + 1
    else:
        ans += int(B // icm - A // icm)
    print(int(ans))
else:
    if A % C == 0 or A % D == 0:
        print(0)
    else:
        print(1)


Measured memory_bytes: 5048
H, W = map(int, input().split())
A = []
for i in range(H):
    l = input()
    if any([c == '#' for c in l]):
        A.append(l)

for j in range(W):
    if all([a[j] == '.' for a in A]):
        for i in range(len(A)):
            A[i] = A[i][:j] + '*' + A[i][j + 1:]
for a in A:
    print(a.replace('*', ''))

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main() {
int N, A, B, res = 0, d;
cin >> N >> A >> B;
for (int i = 1; i <= N; ++i) {
        d = i;
        int tmp = 0;
        while (d > 0) {
                tmp += d % 10; 
                d /= 10; 
        }   
        if (A <= tmp and tmp <= B) {
                res += i;
        }   
} 
cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>

int dp[1001][10001];
int v[1001], w[1001];

int main(){
	int W;

	int k = 1;
	while (std::cin >> W, W){
		int n;

		std::cin >> n;
		char a;
		for (int i = 0; i < n; i++)std::cin >> v[i] >> a >> w[i];

		memset(dp, -1, sizeof(dp));

		dp[1][0] = 0;
		dp[1][w[0]] = v[0];
		for (int i = 1; i < n; i++){
			for (int j = 0; j <= W; j++){

				if (dp[i][j] != -1){
					dp[i + 1][j] = std::max(dp[i + 1][j], dp[i][j]);
					if (j + w[i] <= W)dp[i + 1][j + w[i]] = std::max(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
				}
			}
		}

		int max = 0, id = 0;
		for (int i = 1; i <= W; i++){
			if (max < dp[n][i])max = dp[n][i], id = i;
		}
		std::cout << "Case " << k << ":" << std::endl << max << std::endl << id << std::endl;

		k++;
	}

	return 0;
}

Measured memory_bytes: 40280
import java.util.Scanner;

class Main{
	static long f(long a, long x) {
		if(a == -1) return 0;
		return a / x + 1;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong(), b = sc.nextLong(), x = sc.nextLong();
		System.out.println(f(b, x) - f(a - 1, x));
	}
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define MP make_pair
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define fst first
#define snd second

const int dr[8] = {-1, -1, 1, 1, 1, -1, 0, 0};
const int dc[8] = {-1, 1, -1, 1, 0, 0, -1, 1};
  
int board[8][8];

int count_lock(int r, int c, int k) {
  int cnt = 0;
  
  REP(i, 8) {
    int nr = r+dr[i], nc = c+dc[i];
    while (0 <= nr && nr < 8 && 0 <= nc && nc < 8 && board[nr][nc] == (k^1))
      nr += dr[i], nc += dc[i];
    if (0 <= nr && nr < 8 && 0 <= nc && nc < 8 && board[nr][nc] == k) {
      if (i < 6) {
	cnt += abs(nr-r)-1;
      } else {
	cnt += abs(nc-c)-1;
      }
    }
  }
  return cnt;
}
  
void put_lock(int r, int c, int k){
  board[r][c] = k;
  REP(i, 8) {
    int nr = r+dr[i], nc = c+dc[i];
    while (0 <= nr && nr < 8 && 0 <= nc && nc < 8 && board[nr][nc] == (k^1))
      nr += dr[i], nc += dc[i];
    if (0 <= nr && nr < 8 && 0 <= nc && nc < 8 && board[nr][nc] == k) {
      nr -= dr[i], nc -= dc[i];
      while (0 <= nr && nr < 8 && 0 <= nc && nc < 8 && board[nr][nc] == (k^1)) {
	board[nr][nc] = k;
	nr -= dr[i], nc -= dc[i];
      }
    }
  }
}

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

  REP(i, 8) {
    string row;
    cin >> row;
    REP(j, 8) {
      switch(row[j]) {
      case '.':
	board[i][j] = -1;
	break;
      default:
	board[i][j] = row[j] == 'o' ? 0 : 1;
	break;
      }
    }
  }

  int flag = true;
  while (flag) {
    flag = false;
    REP(k, 2) {
      int f = 0;
      P f_p;
      REP(r, 8) REP(c, 8) {
	if (board[r][c] == -1) {
	  int cnt = count_lock(r, c, k);
	  if ((k == 0 && cnt > f) || (k == 1 && cnt > 0 && cnt >= f)) {
	    f = cnt;
	    f_p = make_pair(r, c);
	  }
	}
      }
      if (f > 0) {
	put_lock(f_p.first, f_p.second, k);
	flag = true;
      }
    }
    
  }
  REP(r, 8) {
    REP(c, 8) {
      switch(board[r][c]) {
      case -1:
	cout << '.';
	break;	
      default:
	cout << (board[r][c] == 0 ? 'o' : 'x');
	break;
      }
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1184
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    a, b, c, d = LI()
    print("Yes" if (c - 1) // b + 1 <= (a - 1) // d + 1 else "No")
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 81420
# coding: utf-8
# Your code here!

N = int(input())

if N % 2 == 0:
    i = 1
    count = 0
    while N // (2 * 5 ** i) > 0:
        count += N // (2 * 5 ** i)
        i += 1
    print(count)
else:
    print(0)
        

Measured memory_bytes: 38256
#include<stdio.h>
#include<string.h>
 
int main(){
  int n,i=0,j=0;
  char s1[100], s2[100];
  scanf("%d",&n);
  while(scanf("%s %s", s1, s2)!=EOF)
  {
  if ( strcmp(s1,s2) == 0 ){
  i=i+1;
  j=j+1;
  }
  else if ( strcmp(s1, s2) > 0 ){
  i=i+3;
  }
  else if ( strcmp(s1, s2) < 0 ){
  j=j+3;
  }
  }
  printf("%d %d\n",i,j);
  return 0;
   
}


Measured memory_bytes: 2056
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <array>
#include <cmath>
#include <queue>
#include <stack>
#include <numeric>

using namespace std;
using ll = long long;

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

	int ans = r * r;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
  int A, B, C;
  std::cin >> A >> B >> C;

  int login = 0;
  while (C > 0)
  {
    C -= A;
    ++login;
    if (login % 7 == 0)
    {
      C -= B;
    }
  }

  std::cout << login << std::endl;

  return 0;
}



Measured memory_bytes: 3112
import sys


def input():
    return sys.stdin.readline().rstrip()


def tc():
    N = int(input())



def main():
    N = int(input())

    dp = [0]*(N+1)
    rt = int(N **0.5) +1
    for i in range(1,rt):
        ii = i**2
        for j in range(1,rt):
            jj = j**2
            ij = i*j
            if ii + jj + 1 + ij + i + j  >N:
                break
            for k in range(1,rt):
                kk = k**2
                case =int( ii + jj + kk + ij + i*k + j*k )
                if case <=N:
                    dp[case] +=1
                else:
                    break

    for l in range(1,N+1):
        print(dp[l])










if __name__ == "__main__":
    main()


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

struct r{ int a,b,c,d; };
int n,m,q;
r R[50];

vector<int> v;

int solve(){
    int res=0;
    for(int i=0; i<q; i++) if(v[R[i].b]-v[R[i].a]==R[i].c) res+=R[i].d;
    return res;
}

int dfs(int i=-1){
    if(i==n-1) return solve();
    int k=1; if(i>=0) k=v[i];
    int res=0;
    for(int l=k; l<=m; l++){
        v[i+1]=l;
        res=max(res, dfs(i+1));
    }
    return res;
}

int main(){
    cin>>n>>m>>q;
    for(int i=0; i<q; i++){
        int a,b,c,d; cin>>a>>b>>c>>d; a--; b--;
        R[i]=r{a,b,c,d};
    }
    v=vector<int>(n);
    cout<<dfs()<<endl;
}

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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var A = input[0];
            var B = input[1];
            var C = input[2];
            var D = input[3];

            while (true)
            {
                C -= B;
                if (C <= 0)
                {
                    Console.WriteLine("Yes");
                    return;
                }

                A -= D;
                if (A <= 0)
                {
                    Console.WriteLine("No");
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 28208
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
template <class _T> static _T tp_pow(int base, int exp)
{
	_T ans = 1;

	for (int i = 0; i < exp; i++) {
		ans *= base;
	}
	return ans;
}

static void B_task();

int main()
{
	B_task();
	fflush(stdout);
	return 0;
}

static void B_task()
{
	int N;
	get1int(N);

	int tmp = N;
	int digit = 0;
	while (tmp > 0) {
		tmp /= 10;
		digit++;
	}

	LLONG ans = 0;
	if (digit % 2) {
		ans += N - (tp_pow<int>(10, digit - 1) - 1);
		digit--;
	}
	while (digit > 0) {
		if (digit % 2) {
			for (int i = 0; i < digit; i++) {
				ans += 9 * tp_pow<int>(10, i);
			}
			ans -= (tp_pow<int>(10, digit - 1) - 1);
		}
		digit--;
	}
	printf("%lld\n", ans);
}


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

#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
// constexpr ll mod = 1e9 + 7;

bool kaibun(string S){
    if(S.size() <2) {
        return true;
    } else if(S.front() == S.back()) {
        return kaibun(S.substr(1, S.size()-2));
    } else {
        return false;
    }
}

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

    int N=S.size();

    string s1=S.substr(0, (N-1)/2);
    string s2=S.substr((N+3)/2-1);

    if(s1!=s2) {
        cout << "No" << endl;
        return 0;
    } else {
        if(kaibun(s1)){
            cout << "Yes" << endl;
            return 0;
        } else {
            cout << "No" << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
long long int h,w;
	cin>>h>>w;
	if(h==1 || w==1)
		cout<<1<<endl;
		else
		cout<<((h*w)+1)/2;
	
}

Measured memory_bytes: 256
#077-D
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
from collections import Counter
mod=10**9+7
n=int(input())
A=list(map(int,input().split()))
factorial=[1]
for i in range(1,n+2):
    factorial.append(factorial[i-1]*i%mod)
inverse=[0]*(n+2)
inverse[n+1]=pow(factorial[n+1],mod-2,mod)
for i in range(n,-1,-1):
    inverse[i]=inverse[i+1]*(i+1)%mod
def comb(n,r):
    if n<r:
        return 0
    return factorial[n]*inverse[r]*inverse[n-r]%mod
C=Counter(A)
i=C.most_common()[0][0]
idx=[k for k, x in enumerate(A) if x==i]
for k in range(1,n+2):
    print((comb(n+1,k)-comb(n+idx[0]-idx[1],k-1))%mod)

Measured memory_bytes: 29980
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

N = ni()

if N==0:
  print(0)

s=''
while N:
  if N%2:
    s = '1' + s
    N -= 1
  else:
    s = '0' + s
  N /= -2

print(s)

Measured memory_bytes: 3316
import java.util.Scanner;

//CamelCase
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			String s = sc.next();
			char ch = sc.next().charAt(0);
			if(ch=='X')break;
			char f = Character.isUpperCase(s.charAt(0))?'U':s.contains("_")?'D':'L';
			StringBuilder sb = new StringBuilder();
			char[] t = s.toCharArray();
			if(f==ch)sb.append(s);
			else if(f=='U'){
				if(ch=='L'){
					t[0] = Character.toLowerCase(t[0]);
					sb.append(t);
				}
				else{
					t[0] = Character.toLowerCase(t[0]);
					for(int i=0;i<t.length;i++){
						if(Character.isUpperCase(t[i]))sb.append('_');
						sb.append(Character.toLowerCase(t[i]));
					}
				}
			}
			else if(f=='L'){
				if(ch=='U'){
					t[0] = Character.toUpperCase(t[0]);
					sb.append(t);
				}
				else{
					for(int i=0;i<t.length;i++){
						if(Character.isUpperCase(t[i]))sb.append('_');
						sb.append(Character.toLowerCase(t[i]));
					}
				}
			}
			else{
				if(ch=='U'){
					sb.append(Character.toUpperCase(t[0]));
					for(int i=1;i<t.length;i++){
						if(t[i]=='_'){
							i++;
							sb.append(Character.toUpperCase(t[i]));
						}
						else sb.append(t[i]);
					}
				}
				else{
					for(int i=0;i<t.length;i++){
						if(t[i]=='_'){
							i++;
							sb.append(Character.toUpperCase(t[i]));
						}
						else sb.append(t[i]);
					}
				}
			}
			System.out.println(sb);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define ALL(v) (v).begin(), (v).end()
#define PUTS(x) cout << (x) << endl;
#define PB push_back

enum Type { TypeA,
            TypeB,
            TypeC };

struct Value {
    Int value;
    Type type;
};

int main() {
    Int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    auto all = vector<Value>();
    auto p = vector<Int>();
    auto q = vector<Int>();
    auto r = vector<Int>();
    rep(i, A) {
        Int a;
        cin >> a;
        auto v = Value{a, TypeA};
        p.PB(a);
        all.PB(v);
    }
    rep(i, B) {
        Int b;
        cin >> b;
        auto v = Value{b, TypeB};
        q.PB(b);
        all.PB(v);
    }
    rep(i, C) {
        Int c;
        cin >> c;
        auto v = Value{c, TypeC};
        r.PB(c);
        all.PB(v);
    }
    sort(ALL(p), greater<Int>());
    sort(ALL(q), greater<Int>());
    sort(ALL(r), greater<Int>());
    sort(ALL(all), [](const auto &x, const auto &y) {
        return x.value > y.value;
    });
    auto sp = vector<Int>(1, 0);
    auto sq = vector<Int>(1, 0);
    auto sr = vector<Int>(1, 0);
    auto t = 0LL;
    for (auto x : p) {
        t += x;
        sp.PB(t);
    }
    t = 0LL;
    for (auto x : q) {
        t += x;
        sq.PB(t);
    }
    t = 0LL;
    for (auto x : r) {
        t += x;
        sr.PB(t);
    }
    auto x = 0LL, y = 0LL, z = 0LL;
    for (auto v : all) {
        switch (v.type) {
        case TypeA:
            x++;
            break;
        case TypeB:
            y++;
            break;
        default:
            z++;
            break;
        }
        x = min(x, X);
        y = min(y, Y);
        auto zx = X - x;
        auto zy = Y - y;
        if (zx + zy <= z) {
            PUTS(sp[x] + sq[y] + sr[zx + zy])
            return 0;
        }
    }
}


Measured memory_bytes: 13028
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
 
int main(){
  int a,b,c;
  cin >> a >> b >>c;
  cout << min(b/a,c) << endl;
return 0;}

Measured memory_bytes: 256
//“Do. Or do not. There is no try.” – Yoda
#include<iostream>
#include<limits.h>
#include<algorithm>
#include<cstring>
#include<math.h>
#include<stdlib.h>
#include<cstdlib>
#include<vector>
#include<stdio.h>
#include<string>
#include<utility>
#include<iomanip>
#include<queue>
#include<map>
#include<set>
#include<fstream>
#include<stack>
#include<unordered_map>
using namespace std;
#define PI 3.14159265
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pf push_front
#define mp make_pair
#define pii pair<int,int>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define pid pair<int,double>
#define vi vector<int>
#define vl vector<ll>
#define ss second
#define ff first
#define ll bigint
#define ld long double
#define ull unsigned long long
#define SIZE 10010
#define MOD 1000000007
#define BIG 999999937
#define pq priority_queue
#define maxpq priority_queue<int>
#define minpq priority_queue<int,vector<int>,greater<int> >
#define endl '\n'
#define FOI(i, a, n) for(int i = int(a); i <= int(n); i++)
#define FOD(i, a, n) for(int i = int(a); i >= int(n); i--)
#define ALL(t) t.begin(),t.end()
#define DBG(c) cout << #c << " = " << c << endl;
#define MSET(tabl,i) memset(tabl, i, sizeof(tabl))


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


    int a,b;
    cin>>a>>b;
    if(a>=13) {
        cout<<b;
    }
    else if(a>=6 && a<=12) {
        cout<<b/2;
    }
    else {
        cout<<"0";
    }


    
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair< int , int > P;
typedef tuple<int, int, int> T;


int ctoi(char c) {
	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}

int main(){
    string n;
    cin>>n;
    int m=0;
    for(ll i=0 ;i<n.size();i++){
        m+=ctoi(n[i]);
        m%=9;
    }
    if(m==0) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 3724
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
 
class Counter {
	int n, m;
	int count[] = null;
	Counter(int n, int m) {
		this.n = n;
		this.m = m;
		this.count = new int[m];
	}

	public void count(String line) {
		StringTokenizer st = new StringTokenizer(line, " ");
		for (int i=0;i<m;i++) {
			if (Integer.parseInt(st.nextToken())==1) {
				count[i]++;
			}
		}
	}

	public void printRanking() {
		String rank = "";
		for (int i=this.n;i>=0;i--) {
			for (int j=0;j<this.m;j++) {
				if (count[j]==i) {
					rank += (Integer.toString(j+1)+" ");
				}
			}
		}
		System.out.println(rank.substring(0, rank.length()-1));
	}

	public void printCounter() {
		for (int i=0;i<this.m-1;i++) {
			System.out.print(count[i]+" ");
		}
		System.out.println(count[this.m-1]);
	}
}

class Main {
    public static void main(String args[]) {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
 
        try {
            String buf = null;
            int n, m;
			Counter cnt = null;
            while (!(buf = br.readLine()).equals("0 0")) {
				StringTokenizer st = new StringTokenizer(buf, " ");
				n = Integer.parseInt(st.nextToken());
				cnt = new Counter(n, Integer.parseInt(st.nextToken()));
				for (int i=0;i<n;i++) {
					cnt.count(br.readLine());
				}
				//cnt.printCounter();
				cnt.printRanking();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 39708
#include <bits/stdc++.h>
 
using namespace std;
 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
 
template <typename T1, typename T2> bool chkmin(T1 &x, T2 y) { return y < x ? (x = y, true) : false; }
template <typename T1, typename T2> bool chkmax(T1 &x, T2 y) { return y > x ? (x = y, true) : false; }

const int N = 100005;
const int LOG = 35;
int a[N];
int v[LOG][N];
int d[LOG][N];
int cur[N];

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
    freopen("in", "r", stdin);
#endif
    
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        for (int j = 0; j < LOG; ++j)
        {
             v[j][i] = a[i] / (1LL << j);
        }
        for (int j = 0; j + 1 < LOG; ++j)
        {
            d[j][i] = v[j][i] - v[j + 1][i];
        }
    }
    multiset<pii> q;
    for (int i = 0; i < n; ++i)
    {
        q.insert(mp(-d[0][i], i));
    }
    ll sum = 0;
    for (int i = 0; i < n; ++i) sum += a[i];
    for (int it = 0; it < m && !q.empty(); ++it)
    {
        int dif = -q.begin()->fi;
        int i = q.begin()->se;
        q.erase(q.begin());
        sum -= dif;
        cur[i]++;
        if (cur[i] < LOG - 1)
            q.insert(mp(-d[cur[i]][i], i));
    }
    cout << sum << '\n';

    return 0;
}

Measured memory_bytes: 33024
#include<iostream>
#include<algorithm>
using namespace std;
int x,y,z;
int swap(){
  z = x;
  x = y;
  y = z;
  return 0;
}

int main(){
  while(true){
    cin>>x>>y;
    if(!x&&!y)break;
    int step = 0;
    if(y>x)swap();
    while(y!=0){
      x = x%y;
      swap();
      step++;
    }
    cout<<x<<" "<<step<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main(){
  int h,n;
  cin >>h>>n;
  int at[n];
  int i =0;
  int total=0;
  for(i=0;i<n;i++){int a; cin >>a; at[i]=a;total=total+a;}
  if(total>=h) cout<<"Yes";
  else cout<<"No";}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

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

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(string, S);
    CIN(string, T);

    int tstart = -1;
    for (int i = S.size()-T.size(); i >= 0; i--) {
        bool check = true;
        for (int j = 0; j < T.size(); j++) {
            if ( S[i+j] != '?' && S[i+j] != T[j] ) {
                check = false;
                break;
            }
        }
        if ( check ) {
            tstart = i;
            break;
        }
    }

    if ( tstart == -1 ) {
        std::cout << "UNRESTORABLE\n";
        return 0;
    }

    string ans = S;
    for (int i = 0; i < ans.size(); i++) {
        if ( ans[i] == '?' ) {
            ans[i] = 'a';
        }
    }

    for (int i = 0; i < T.size(); i++) {
        ans[tstart + i] = T[i];
    }

    std::cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//cervello|Phoenix
using namespace std;
#define ll long long int
#define eb emplace_back
#define mk make_pair
#define pr pair<int,int>
#define all(x) x.begin(),x.end()
#define mod 1000000007

int main(){
  ios_base::sync_with_stdio(false);
    // #ifndef ONLINE_JUDGE
    //   freopen("input.txt", "r", stdin);
    //   freopen("output.txt", "w", stdout);
    // #endif
  int n,w; cin>>n>>w;
  vector<long int> wt(n),v(n);
  for(int i=0;i<n;i++)
    cin>>wt[i]>>v[i];

  vector<vector<long int> > dp(n+1, vector<long int> (w+1,0));

  for(int i=1;i<=n;i++){
    for(int j=1;j<=w;j++){
      dp[i][j]=dp[i-1][j];
      if(j-wt[i-1]>=0)
        dp[i][j]=max(dp[i][j],v[i-1]+dp[i-1][j-wt[i-1]]);
    }
  }
  cout<<dp[n][w]<<"\n";
  return 0;
}

Measured memory_bytes: 80256
X, Y = gets.split.map &:to_i
ans = 0
[X, Y].each{|i|
  case i
  when 1
    ans += 300000
  when 2
    ans += 200000
  when 3
    ans += 100000
  end
}
if X == 1 && Y == 1
  ans += 400000
end
p ans


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  vector<LD> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  vector<vector<LD>> dp(n,vector<LD>(200001,100000000));
  for(int i=1;i<=200000;i++) dp[0][i]=0;
  for(int i=0;i<n-1;i++){
    for(int j=1;j<=200000;j++){
      dp[i][j]=max(dp[i][j],abs(a[i]-j)/a[i]);
      for(int k=j;k<=200000;k+=j){
        dp[i+1][k]=min(dp[i+1][k],dp[i][j]);
      }
    }
  }
  LD ans=1000000000;
  for(int i=1;i<=200000;i++){
    dp[n-1][i]=max(dp[n-1][i],abs(a[n-1]-i)/a[n-1]);
    ans=min(ans,dp[n-1][i]);
  }
  // for(int i=0;i<n;i++){
  //   for(int j=1;j<20;j++){
  //     cout << dp[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  cout << fixed << setprecision(12) << ans << endl;
  return 0;
}



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

int main() {
    int N;
    string S;
    cin >> N >> S;

    set<string> stock;

    for (int i=0; i<1000; i++) {
        string v = to_string(i);
        int len = v.size();
        for (int vi = 0; vi < (3 - len); vi++) {
            v = "0" + v;
        }
        int idx = 0;
        for (int j=0; j<N; j++) {
            if (S.at(j) == v.at(idx)) {
                idx++;
                if (idx == 3) {
                    stock.insert(v);
                    break;
                }
            }
        }
    }
    cout << stock.size() << endl;

    return 0;
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define CEIL(n, m) ceil(n/pow(10.0, m))*pow(10.0, m)
#define FLOOR(n, m) floor(n/pow(10.0, m))*pow(10.0, m)
#define ROUND(n, m) round(n/pow(10.0, m))*pow(10.0, m)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).begin(),(x).end(),greater<int>())
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define llong long long
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) " (L" << __LINE__ << ") " << __FILE__ << endl;

void solve()
{
  int n; cin >> n;
  vector<llong> a(n); REP(i, n) cin >> a[i];
  vector<llong> ans = {0, 0};
  vector<int> signs = {1, -1};

  for (int si=0; si<2; si++) {
    llong sum=0;
    for (int i=0; i<n; i++) {
      sum+=a[i];
      if (i%2==0) {
        if (sum*signs[si] <= 0) {
          ans[si] += abs(sum)+1;
          sum += (abs(sum)+1)*signs[si];
        }
      } else {
        if (sum*signs[si] >= 0) {
          ans[si] += abs(sum)+1;
          sum -= (abs(sum)+1)*signs[si];
        }
      }
    }
  }

  cout << min(ans[0], ans[1]) << endl;
}

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
typedef vector<int> vi;
typedef vector<double> vd;
 
double mypow(double b ,int e){
      if(e == 0) return 1;
      if(e%2==0)
            return mypow( b*b, e/2 );
      else
            return mypow( b*b, e/2 ) * b;
}
 
int main(){
 
 
      int N,M,L; cin >> N >> M >> L ;
      if(N==1){
            cout << 1.0 << endl;
            return 0;
      }
      vector<vd> prob(N,vd(M+1,0.0));
      vector<vd> dist(N,vd(M+1,0.0));
 
      vd p(N),t(N),v(N);
      for(int i=0; i<N; i++) cin >> p[i] >> t[i] >> v[i];
 
      // PRE PROCESS
      for(int i=0; i<N; i++){
            dist[i][0] = (double)L / v[i];
            for(int j=1; j<=M; j++){
                  dist[i][j] = dist[i][j-1] + t[i];
            }
      }
      for(int i=0; i<N; i++)
            prob[i][0] = mypow((100-p[i])/100,M);
      for(int i=0; i<N; i++){
            for(int j=1; j<=M; j++){
                  if(p[i] != 100)
                        prob[i][j] = (prob[i][j-1] * (p[i]/100)) / ((100-p[i])/100);
                  else
                        prob[i][j] = 1.0;
            }
      }
      double comb = 1;
      for(int j=1; j<=M; j++){
            comb = comb * (M - j + 1) / j; 
            for(int i=0; i<N; i++){
                  prob[i][j] *= comb;
            }
      }
       
      vector<vd> sum = prob;
      for(int i=0; i<N; i++){
            for(int j=M-1; j>=0; j--){
                  sum[i][j] += sum[i][j+1];
                  if(sum[i][j] > 1) sum[i][j] = 1;
            }
      }
 
      vector<vd> ans = prob;
      for(int i=0; i<N; i++){
            for(int j=0; j<=M; j++){
                  for(int k=0; k<N; k++){
                        if(i==k) continue;
                        int id = upper_bound(dist[k].begin(),dist[k].end(), dist[i][j]) - dist[k].begin();
                        if(id > M) ans[i][j] = 0.0;
                        else       ans[i][j] *= sum[k][id];
 
                  }
            }
      }
 
      for(int i=0; i<N; i++){
            double tmp = 0.0;
            if(p[i] == 100) tmp = ans[i][M];
            else
                  for(int j=0; j<=M; j++)
                        tmp += ans[i][j];
            if(tmp > 1) tmp = 0;
            printf("%.10f\n",tmp);
      }
                         
}

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

#define SZ(x) (((int)x.size()))
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

using namespace std;

const int maxn = 15;
char c[maxn];
string s;
int ans, n;
map<string, bool> m;

int main()
{
    ios::sync_with_stdio(0);
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%s", c);
        s = c;
        if (!m[s])
        {
            ans++;
            m[s] = 1;
        }
    }
    cout << ans;
	return 0;
}


Measured memory_bytes: 19268
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vl A(N);
  REP(i, N) cin >> A[i];
  ll now = 1;
  ll ans = 0;
  REP(i, N) {
    if (A[i] != now)
      ans++;
    else
      now += 1;
  }
  if (now == 1)
    cout << -1 << endl;
  else
    cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
w,h,n=map(int,input().split())
lis=[]
for i in range(n):
  lis.append(list(map(int,input().split())))
count=0
for i in range(0,w):
  for j in range(0,h):
    keep=0
    for k in range(0,n):
      x=lis[k][0]
      y=lis[k][1]
      a=lis[k][2]
      if a==1:
        if i<x:
          keep=1
      elif a==2:
        if i>=x:
          keep=1
      elif a==3:
        if j<y:
          keep=1
      elif a==4:
        if j>=y:
          keep=1
    if keep==0:
      count+=1
print(count)

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <limits>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <iterator>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned                    ui;
typedef int                         si;
typedef long                        sl;
typedef long long                   ll;
typedef unsigned long long          ull;

#ifdef LOCALHOST
std::ifstream in("input.txt", std::ifstream::in);
#endif // LOCALHOST

#ifdef LOCALHOST
#define is in
#else
#define is cin
#endif // LOCALHOST

int main(int argc, char *argv[])
{
    std::ios_base::sync_with_stdio(false);

    string s, t;
    cin >> s >> t;
    cout << t + s << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <deque>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>
#include <functional>
#include <climits>
#include <numeric>
#include <bitset>
#include <random>
#include <tuple>
#include <initializer_list>
#include <fstream>
#include <cctype>
#include <string>
constexpr long long int MOD = 1000000007LL;
long long int search(const int s, const int t, const std::vector<int>& s_list, const std::vector<int>& t_list, std::vector<std::vector<long long int>> &memo) {
	if (s >= s_list.size() || t >= t_list.size()) return 1;
	else if (memo[s][t] >= 0) return memo[s][t];
	else if (s_list[s] == t_list[t]) return memo[s][t] = (search(s + 1, t, s_list, t_list, memo) + search(s, t + 1, s_list, t_list, memo)) % MOD;
	else return memo[s][t] = (search(s + 1, t, s_list, t_list, memo) + search(s, t + 1, s_list, t_list, memo) - search(s + 1, t + 1, s_list, t_list, memo)) % MOD;
}
int main() {
	int n, m; std::cin >> n >> m;
	std::vector<int> s_list(n), t_list(m);
	for (auto& s : s_list) std::cin >> s;
	for (auto& t : t_list) std::cin >> t;
	std::vector<std::vector<long long int>> memo(n + 1, std::vector<long long int>(m + 1, -1));
	for (auto i = 0; i <= m; ++i) {
		memo[n][i] = 1;
	}
	for (auto i = 0; i <= n; ++i) {
		memo[i][m] = 1;
	}
	for (int i = n - 1; i >= 0; --i) {
		for (int j = m - 1; j >= 0; --j) {
			if (s_list[i] == t_list[j]) {
				memo[i][j] = (memo[i + 1][j] + memo[i][j + 1]) % MOD;
			}
			else {
				memo[i][j] = (memo[i + 1][j] + memo[i][j + 1] - memo[i + 1][j + 1] + MOD) % MOD;
			}
		}
	}
	std::cout << memo[0][0] << std::endl;
}


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

int findSet(vector<int>& a, int i) {
  if (a[i] < 0) return i;
  return a[i] = findSet(a, a[i]);
}

void mergeSets(vector<int>& a, int i, int j) {
  int x = findSet(a, i);
  int y = findSet(a, j);
  if (x == y) {
    return;
  }
  if (a[x] > a[y]) {
    int t = x;
    x = y;
    y = t;
  }
	a[x] += a[y];
	a[y] = x;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    v[i] = -1;
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    mergeSets(v, a, b);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    // cout << v[i] << " " << i << endl;
    ans = min(ans, v[i]);
  }
  ans = abs(ans);
  cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  int result = 0;
  while (true) {
    int cnt = 0;
    for (int i = 0; i < N; ++i) {
      int Ai = A[i];
      if (Ai % 2 == 0) {
        ++cnt;
        A[i] /= 2;
      } else {
        break;
      }
    }
    if (cnt == N) {
      ++result;
    } else {
      break;
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 384
n = gets.to_i
p = gets.split.map(&:to_i)

ans = 0
1.upto(n - 1 - 1) do |i|
  x = [p[i-1], p[i], p[i+1]].sort
  if p[i] == x[1]
    ans += 1
  end
end

puts ans

Measured memory_bytes: 14296
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define prinrynl(a) printf(a ? "yes\n" : "no\n")
#define prinryn(a) printf(a ? "Yes\n" : "No\n")
#define prinrYN(a) printf(a ? "YES\n" : "NO\n")
#define prinrin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a)
#define all(x) (x).begin(), (x).end()

using ll = long long;

const int INF = 2147483647;
const ll LINF = ll(9223372036854775807);

//マクロとかここまで

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>

using namespace std;

int ggd(int number1, int number2) {
	int m = number1;
	int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}

	while (m != n) {
		int temp = n;
		n = m - n;
		m = temp;
	}

	return m;
}

int lcm(int number1, int number2) {
	return number1 * number2 / ggd(number1, number2);
}

bool is_prime(int64_t x) {
	for (int64_t i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

/*-----------------------------------------ここまでライブラリとか-----------------------------------------*/



int main() {

	int m, d;
	ll count = 0;
	scanf("%d%d", &m, &d);
	rep(i, m) {
		for (int j = 22; j <= d; ++j) {
			if ((i + 1) == (j % 10) * (j / 10) && (j % 10) > 1 && j / 10 > 1) {
				++count;
			}
		}
	}
	printf("%d\n", count);

	return 0;
}


Measured memory_bytes: 256
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
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 dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
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; }
// template end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N, max, f = 0;
    in >> N;
    vector<ll> H(N);
    REP(i,N){
        in >> H[i];
    }
 
    max = H[0];
    REP_AB(i,1,N){
        if(max < H[i]){
            max = H[i] - 1;
        }
        else if(max > H[i]){
            f = 1;
            break;
        }
    }
 
 
    if(f == 0){
           out << "Yes" << endl;
    }else if(f == 1){
           out << "No" << endl;
    }

}

Measured memory_bytes: 1024
n,k=gets.chomp.split(" ").map { |e| e.to_i  }
a=gets.chomp.split(" ").map { |e| e.to_i  }

def serchi(a,n)
  n.times do |i|
    if a[i]==1
      return i
    end
  end
end

i=serchi(a,n)+1

if n-i<k || i<k
    puts (n-2)/(k-1) + 1
else
    puts (n-i+k-2)/(k-1) + (i-1)/(k-1)
end


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

using lint = long long;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, d, ret = 0;
	cin >> n >> d;
	while(n > 0) {
		n -= 2*d+1;
		ret++;
	}
	cout << ret << '\n';
}



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

int main()
{
  int a, b;
  cin >> a >> b;
  if (a * b == 0)
  {
    cout << "Even" << endl;
  }
  else if (a * b % 2 == 0)
  {
    cout << "Even" << endl;
  }
  else
  {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
# ABC 103: B – String Rotation
s, t = [input() for _ in range(2)]

is_equal = 'No'

if s == t:
    is_equal = 'Yes'
else:
    for i in range(len(s)):
        s = s[-1] + s[:-1]
        if s == t:
            is_equal = 'Yes'
            break

print(is_equal)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 2048
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
typedef long double ld;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;


const ll mod = 1e9 + 7;
ll X[maxn], Y[maxn];
ll dp[maxn][maxn];
ll n, m;
ll fact[maxn] , inv[maxn], finv[maxn];

void pre_calc()
{
    fact[0] = fact[1] = 1;
    inv[1] = 1;
    finv[0] = finv[1] = 1;

    for(int i = 2; i < maxn; i++){
        fact[i] = i * fact[i - 1] % mod;
        inv[i] = mod - mod/i * inv[mod % i] % mod;
        finv[i] = inv[i] * finv[i - 1] % mod;
    }

}

ll calc(ll n, ll k)
{
    if(n < k || n < 0) return 0;
    return fact[n] * finv[n - k] % mod * finv[k] % mod;
}


ll solve(int i, int j)
{
    if(i == n || j == m) return 0;
        if(dp[i][j] >= 0) return dp[i][j];
    if(X[i] == Y[j])
        dp[i][j] = (1 + solve(i+1, j) + solve(i, j + 1)) % mod;
    else
        dp[i][j] = (solve(i+1, j) + solve(i, j + 1) - solve(i+1, j+1) + mod ) % mod;
    return dp[i][j];
}


int main()
{
    FASTIO
    /*
    //double start_time = clock();
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
//*/
    cin >> n >> m;
    for(ll i = 0; i < n; i++) cin >> X[i];

    for(ll i = 0; i < m; i++) cin >> Y[i];

    memset(dp, -1, sizeof dp);
    cout << (solve(0,0) + 1) % mod << endl;
    //double end_time = clock();
    //prllf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);

    return 0;
}


Measured memory_bytes: 33280
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
#define ceil(a,b) (a+b-1)/b
#define endl "\n"

#define oa(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define o1(a) cout<<" "<<#a<<" : "<<a<<"\n"
#define o2(a,b) cout<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<"\n"
#define o3(a,b,c) cout<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<"\n"
#define o4(a,b,c,d) cout<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<"\n"

 const int N=100005;
 const int inf=1e18;
 const double eps=1e-9;
int pow1(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
        	res=res*a;
		}
        a=a*a;
        b>>=1;
    }
    return res;
}
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	int x,y,z;
    cin>>x>>y>>z;
    cout<<z<<" "<<x<<" "<<y;








	
return 0;
}


Measured memory_bytes: 256