akhauriyash/Code-Regression huggingface dataset:
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<algorithm>
#include<iostream>
#include<cstring>
#include<fstream>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#define INF 0X3F3F3F3F
#define N 100005
#define M 200005
#define LL long long
#define ULL unsigned long long
#define FF(i, a, b) for(int i = a; i <= b; ++i)
#define RR(i, a, b) for(int i = a; i >= b; --i)
#define FJ(i, a, b) for(int i = a; i < b; ++i)
#define SC(x) scanf("%d", &x)
#define SCC(x, y) scanf("%d%d", &x, &y)
#define SCCC(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define SS(x) scanf("%s", x)
#define PR(x) printf("%d\n", x)
#define CL(a, x) memset(a, x, sizeof(a))
#define _P fd[rt]
#define _L fd[rt << 1]
#define _R fd[rt << 1 | 1]
#define MID int mid = ((l + r) >> 1)
#define lson rt<<1 ,l, mid
#define rson rt<<1 | 1, mid + 1, r
#define VI vector<int>
#define db double
#define PII pair<int, int>
#define PLL pair<unsigned long long, unsigned long long>
#define MP make_pair
#define PB push_back
#define IN freopen("in.txt", "r", stdin)
#define OUT freopen("out.txt", "w", stdout)
using namespace std;
const int MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-8;
const int dir[4][2] = {{-1, 0}, {0, -1}, {0, 1}, {1, 0}};
inline void II(int &n){char ch = getchar(); n = 0; bool t = 0;
for(; ch < '0'; ch = getchar()) if(ch == '-') t = 1;
for(; ch >= '0'; n = n * 10 + ch - '0', ch = getchar()); if(t) n =- n;}
inline void OO(int a){if(a < 0) {putchar('-'); a = -a;}
if(a >= 10) OO(a / 10); putchar(a % 10 + '0');}
inline int sgn(double x){return (x > EPS) - (x < -EPS);}
struct EE{int v, w, nx;}E[M * 2 + N * 2]; int hd[N], EN;
void init_edge(int num){EN = 0; memset(hd, -1, (num + 2) << 2);}
void add_edge(int u, int v, int w){
    E[EN].w = w; E[EN].v = v; E[EN].nx = hd[u]; hd[u] = EN++;
    E[EN].w = w; E[EN].v = u; E[EN].nx = hd[v]; hd[v] = EN++;
}
int n, a, b, c;
int main(){
    //IN;
    SCCC(a, b, c);
    if(a * b < c) cout << a * b;
    else cout << c;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define f(z) for(int i=1;i<=z;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define vi vector<int>
#define pb push_back
#define si set<int>
#define mod  1000000007
#define cl(n,m) (n-1)/m  + 1 ;
#define T() int TT; cin>>TT; while(TT--)
#define P pair<int,int>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
const int N = 2e6 + 5 ;

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

	for ( int i = 1 ; i<=n ; i++){
		if( i*(i+1) >= 2*n ) cout << i , exit(0) ;
	}
}

Measured memory_bytes: 256
# frozen_string_literal: true

# ABC 140 C - Maximum value

STDIN.gets

input_a = STDIN.gets.split(' ').map(&:to_i)
result = [input_a.first]

input_a[0..(input_a.length - 1)].each_with_index do |a, idx|
  result << a
  result[idx] = a if result[idx] > a
end

puts result.inject(:+)


Measured memory_bytes: 1788
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

template <int64_t MOD>
class Modint {
  using Self = Modint<MOD>;

  int64_t m_value;

 public:
  Modint() : m_value(0) {}
  Modint(int64_t value) : m_value((value % MOD + MOD) % MOD) {}
  Self pow(int64_t e) const {
    if (e == 0) {
      return (Self)1;
    } else if (e % 2 == 0) {
      return ((*this) * (*this)).pow(e / 2);
    } else {
      return (*this).pow(e - 1) * (*this);
    }
  }
  Self inv() const { return pow(MOD - 2); }
  Self& operator=(const Self& rh) {
    m_value = rh.m_value;
    return *this;
  }
  Self operator-() const { return Self(-m_value); }
  Self operator+(const Self& other) const {
    return Self(m_value + other.m_value);
  }
  Self operator-(const Self& other) const {
    return Self(m_value - other.m_value);
  }
  Self operator*(const Self& other) const {
    return Self(m_value * other.m_value);
  }
  Self operator/(const Self& other) const { return (*this) * other.inv(); }
  Self& operator+=(const Self& rh) { return (*this) = (*this) + rh; }
  Self& operator-=(const Self& rh) { return (*this) = (*this) - rh; }
  Self& operator*=(const Self& rh) { return (*this) = (*this) * rh; }
  Self& operator/=(const Self& rh) { return (*this) = (*this) / rh; }
  int64_t value() const { return m_value; }
};

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

  vector<int> pos, neg;
  rep(i, N) {
    int a;
    cin >> a;
    if (a >= 0) {
      pos.push_back(a);
    } else {
      neg.push_back(-a);
    }
  }

  sort(pos.begin(), pos.end(), greater<int>());
  sort(neg.begin(), neg.end(), greater<int>());

  constexpr int64_t MOD = 1'000'000'007;
  using Mint = Modint<MOD>;

  Mint result = 1;
  if (N == K) {
    for (auto a : pos) {
      result *= a;
    }
    for (auto a : neg) {
      result *= -a;
    }
  } else if (N == neg.size()) {
    rep(i, K) { result *= -(K % 2 == 0 ? neg[i] : neg[N - 1 - i]); }
  } else {
    int M = min(K, (int)neg.size()) / 2 * 2;
    rep(i, M) { result *= neg[i]; }
    rep(i, K - M) { result *= pos[i]; }

    int j = M - 2;
    while (j >= 0 && K - j <= pos.size() &&
           (int64_t)pos[K - j - 2] * pos[K - j - 1] >
               (int64_t)neg[j] * neg[j + 1]) {
      result *= (int64_t)pos[K - j - 2] * pos[K - j - 1];
      result /= (int64_t)neg[j] * neg[j + 1];
      j -= 2;
    }
  }
  cout << result.value() << endl;

  return 0;
}

Measured memory_bytes: 4300
n = int(input())
robots = [tuple(map(int,input().split())) for _ in range(n)]
#
robots =[(x+l,x-l) for x,l in robots]
#
robots.sort()
#
cnt = 0
last = -float('inf')
for r,l in robots:
    if last <= l:
        cnt += 1
        last = r
print(cnt)


Measured memory_bytes: 30040
#include<stdio.h>
#include<stdlib.h>
int c=0;

int* Selection(int *A, int N){
  int i, j, minj, num;
  for(i=0 ; i<N ; i++){
    minj=i;
    for(j=i ; j<N ; j++){
      if(A[j]<A[minj]){
        minj=j;
      }
    }
    num=A[i];
    A[i]=A[minj];
    A[minj]=num;
    if(A[i]!=A[minj])c++;
  }
  return A;
}

int main(void){
  int N,i;
  int *A;
  scanf("%d",&N);
  A = (int*)malloc(sizeof(int)*N);
  for(i=0 ; i<N ; i++){
    scanf("%d",&A[i]);
  }
  A=Selection(A,N);
  printf("%d",A[0]);
  for(i=1 ; i<N ; i++){
    printf(" %d",A[i]);
  }
  printf("\n%d\n",c);
  return 0;
}


Measured memory_bytes: 2072
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;

typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)


typedef map<string, int> map_type;
typedef pair<string, int> value_type;

struct second_order {
  bool operator()(const value_type& x, const value_type& y) const {
    if( x.second != y.second) return x.second < y.second;
    return x.first > y.first;
  }
};

typedef priority_queue<value_type, vector<value_type>, second_order> pqueue_type;


pqueue_type map_to_pqueue(map_type m) {
    pqueue_type que;
    for(auto it=m.begin(); it!=m.end(); ++it) {
        que.push(*it);
    }
    return que;
}


int main(void){
    int n;
    cin >> n;
    map<int, int> s;
    REP(i, n-1) {
        int tmp;
        cin >> tmp;
        s[tmp]++;
    }
    FOR(i, 1, n) {
        cout << s[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 12936
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int cnt=0;
cin>>n;
int a[n];
for(int i=1;i<=n;i++)
{
    cin>>a[i];
}
for(int i=1;i<=n;i++)
{
    if(i%2!=0&&a[i]%2!=0)
    {
        cnt++;
    }
}
cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3632
# 2019-11-26 01:21:13(JST)
import sys
import numpy as np 

def main():
    H, W = map(int, sys.stdin.readline().split())
    visited = np.array([sys.stdin.readline().rstrip() for _ in range(H)], dtype='U')

    if np.char.count(visited, '#').sum() == H + W - 1:
        ans = 'Possible'
    else:
        ans = 'Impossible'

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 12500
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		int n;
		double x, y, r;

		while (!(line = br.readLine()).equals("-1")) {
			n = Integer.parseInt(line);
			x = 1;
			y = 0;
			r = Math.PI;
			for (int i = 1; i < n; i++) {
				r -= Math.PI / 2;
				x += Math.cos(r);
				y += Math.sin(r);
				r = Math.atan2(y, x) - Math.PI;
			}
			System.out.println(x + "\n" + y);
		}
	}
}

Measured memory_bytes: 16940
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	ok := true
	tPrev, xPrev, yPrev := 0, 0, 0
	for i := 0; i < n; i++ {
		t, x, y := nextInt(), nextInt(), nextInt()
		dt, dx, dy := t-tPrev, abs(x-xPrev), abs(y-yPrev)
		if dx+dy > dt {
			ok = false
		} else if (dt-dx+dy)%2 == 1 {
			ok = false
		}
		tPrev, xPrev, yPrev = t, x, y
	}
	if ok {
		puts("Yes")
	} else {
		puts("No")
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 1920
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(n)-1,i##_len=(int)(s);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};
//今回の変数
int b[100000];
int l[100000];
int u[100000];
ll d[100000];
ll idx[100000];
ll sum;

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
ll Minl(ll a, ll b) {
	return (a)<(b) ? (a) : (b);
}
ll Maxl(ll a, ll b) {
	return (a)>(b) ? (a) : (b);
}

int main() {
	int n,m;
	scanf("%d%d", &n, &m);

	ll dp[100001] = { 0 };
	dp[0] = 1;
	int a=-1;
	int cnt = 0;
	if (m==0) {
		dp[1] = 1;
	}
	else {
		scanf("%d", &a);
		cnt++;
		if (a != 1) {
			dp[1] = 1;
		}
		else {
			dp[1] = 0;
			scanf("%d", &a);
			cnt++;
		}
	}
	FOR(i, 2, n+1) {
		if (a != i) {
			dp[i] = (dp[i - 1] + dp[i - 2])%MOD;
			//PRINTL(dp[i]);
			continue;
		}

		dp[i] = 0;
		if(cnt<m)scanf("%d", &a);
		//PRINTL(dp[i]);
	}
	PRINTL(dp[n]);
}


Measured memory_bytes: 896
n = int(input())
s = [input() for i in range(n)]
st = [str().join(s_) for s_ in zip(*s)]

cnt = 0

for i in range(n):
    for k in range(n):
        if s[k] != st[k]:
            break
    else:
        cnt += 1
    s = [s_[-1]+s_[:-1] for s_ in s]
    st = [st[-1]] + st[:-1]

print(cnt*n)

Measured memory_bytes: 3316
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

int n;
string s;

void solve() {
    stack<char> q;
    string ans(s);
    rep(i, n) {
        if (s[i] == '(') {
            if (q.empty() || q.top() == '(') q.push('(');
            else if (q.top() == ')') {
                ans = string(q.size(), '(') + ans;
                while (!q.empty()) q.pop();
                q.push('(');
            }
        } else {
            if (q.empty() || q.top() == ')') q.push(')');
            else if (q.top() == '(') q.pop();
        }
    }
    if (!q.empty()) {
        if (q.top() == ')') ans = string(q.size(), '(') + ans;
        else if (q.top() == '(') ans = ans + string(q.size(), ')');
    }
    cout << ans << endl;
}

int main() {
    cin >> n >> s;
    solve();
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))

C = [0] * N
sign = [(-1)**(i+1) for i in range(N)]

C[0] = 2*A[N-1]
for i in range(1,N):
    C[i] = 2*A[i-1] - C[i-1]

ans_n1 = C[N-1] // 2
for i in range(N-1):
    print(C[i] + sign[i] * ans_n1, end=' ')
print(ans_n1)


Measured memory_bytes: 61924
#include<iostream>
#include<algorithm>
#define MAX 1299709
using namespace std;
int main()
{
	int gaps[MAX+1];
	bool used[MAX+1];
	fill(gaps,gaps+MAX+1,0);
	fill(used,used+MAX+1,0);
	int pos=0;
	for(int i = 2; i <= MAX; ++i)
	{
		if(used[i]) continue;
		gaps[pos++]=i;
		for(int j = i*2; j <= MAX; j+=i)
		{
			used[j]=true;
		}
	}

	int k;
	while(cin>>k,k) 
	{
		for(int i = 1; i < pos; ++i)
		{
			if(gaps[i-1]==k||gaps[i]==k)
			{
				cout<<0<<endl;
				break;
			}
			else if(gaps[i-1]<k&&k<gaps[i])
			{
				cout<<gaps[i]-gaps[i-1]<<endl;
				break;
			}
		}
	}
  return 0;
}

Measured memory_bytes: 7504
# PyPy3 (2.4.0)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
S = input().rstrip()
mod = 10**9+7

# dp[i][j] : 上から i 桁までの数字で, 13で割ったあまりが j になる場合の数
dp = [[0 for _ in range(13)] for _ in range(len(S))]

# 初期化
if S[0] == "?":
    for i in range(10):
        dp[0][i] += 1
else:
    dp[0][int(S[0])] = 1

# dp更新
for i in range(1,len(S)):
    if S[i] == "?":
        for j in range(13):
            for k in range(10):
                dp[i][(j*10 + k) % 13] += dp[i-1][j]
                dp[i][(j*10 + k) % 13] %= mod
    else:
        for j in range(13):
            dp[i][(j*10 + int(S[i])) % 13] += dp[i-1][j]
            dp[i][(j*10 + int(S[i])) % 13] %= mod

print(dp[-1][5])

Measured memory_bytes: 66396
#include <stdio.h>

int main(void){
	char s[5];
	scanf("%s",&s);
	
	int i=0,flag=0;
	while(s[i] != '\0'){
		if(s[i] == s[i+1]){
			flag=1;
		}
		i++;
	}
	if(flag == 1){
		printf("Bad\n");
	}else{
		printf("Good\n");
	}
	
	return 0;
}

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

public class Main {

public static void main(String [] args){

        int N;
        int count =0;
        int Max =0;
        Scanner input = new Scanner(System.in);

        N = input.nextInt();
        int [][] arr = new int[2][N+1];
        arr[0][0] =0;
        arr[1][0] =0;

        for (int i=1; i<=N; i++ ) {
                arr[0][i] = input.nextInt();
        }
        for (int i=1; i<=N; i++ ) {
                arr[1][i] = input.nextInt();
                count += arr[1][i];
        }

        for (int i=1; i<=N; i++ ) {
                count = count + arr[0][i] - arr[1][i-1];
                if (count > Max) {
                        Max = count;
                }
        }
        System.out.println(Max);
}
}


Measured memory_bytes: 21716
s = input(); t = input()
c = 0 #無限ループを防ぐためのカウンターを設置
     
while (s != t):
	s = s[-1] + s[:-1]
	c += 1
	if c == len(s):
		print('No')
		break
        
if s == t:
	print('Yes')

Measured memory_bytes: 2940
N, M = map(int, raw_input().split())
a = [0]*N
b = [0]*N
for i in range(N):
  a[i], b[i] = map(int, raw_input().split())
c = [0]*M
d = [0]*M
for j in range(M):
  c[j], d[j] = map(int, raw_input().split())
for i in range(N):
  mj = 0
  md = abs(a[i]-c[0])+abs(b[i]-d[0])
  for j in range(1, M):
    dj = abs(a[i]-c[j])+abs(b[i]-d[j])
    if dj < md:
      mj = j
      md = dj
  print mj+1

Measured memory_bytes: 2696
import sys

import numpy as np


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


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


def get_state(x, y):
    if x > y:
        return "Down"
    if x < y:
        return "Up"
    return "Equal"


N = ii()
A = il()
pre_state = None
c = 1
for i in range(N - 1):
    current_state = get_state(A[i], A[i + 1])
    if current_state == "Equal" or current_state == pre_state:
        continue
    if pre_state is None:
        pre_state = current_state
    else:
        pre_state = None
        c += 1
print(c)


Measured memory_bytes: 23108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    int n,x,y;
    cin >> n >> x >> y;
    x--;
    y--;
    int dist[n-1]={};
    rep(i,n){
        rep(j,i){
            int a=min(abs(x-j)+abs(y-i)+1,i-j);
            a--;
            dist[a]++;
        }
    }
    rep(i,n-1)cout << dist[i] << endl;
    


}

/*



 */



Measured memory_bytes: 256
txt = input().split()

alpha = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

for i in range(len(alpha)):
  if txt[0] == alpha[i]:
    print(alpha[i+1])
    exit

Measured memory_bytes: 2940
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] group = new int[N];
    for (int i = 1; i <= N; i++){
      int j = sc.nextInt();
      group[j - 1] = i;
    }
    for (int k = 0; k < N-1; k++){
      System.out.print(group[k]+" ");
    }
    System.out.println(group[N-1]);
  }
}

Measured memory_bytes: 61108
N = list(input())
N = N[::-1]
n = len(N)
for i in range(n-1):
    if N[i]!="9":
        N[i+1] = str(int(N[i+1])-1)
        N[i] = "9"
N = N[::-1]
ans = 0
for i in N: ans += int(i)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
#define spln(i,n) (i==n?'\n':' ')
using namespace std;
long long n,m,i,j,a,b;
int main()
{
	cin>>n>>a>>b;
	if(a%2==b%2){
		cout<<abs(a-b)/2<<endl;
		return 0;
	}
	if(a>b) swap(a,b);
	cout<<min(a,n-b+1)+(b-a)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
# スペース区切りの整数の入力
d = [int(a) for a in input().split()]
sum = 0
i, j = 0, 0
while i < N:
  j = i+1
  while j < N:
    sum += d[i] * d[j]
    j += 1
  i+= 1
print('{}'.format(sum))

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;
multiset<int> s[100001];

int main(){
  int N,M;
  cin>>N>>M;
  
  REP(i,N){
    int A,B;
    cin>>A>>B;
    s[A].insert(B);
  }
  multiset<int> S;
  lint ans=0;
  FOR(i,1,M+1){
    S.insert(ALL(s[i]));
    if(S.empty())continue;
    auto itr=S.end();
    itr--;
    // cerr<<i<<" "<<*itr<<endl;
    ans+=*itr;
    S.erase(itr);
  }
  cout<<ans<<endl;
  return 0;
}


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

typedef long long int   ll;
#define cases           int t;cin>>t;while(t--)
#define FIO             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl            "\n"
#define scan(n)         scanf("%d",&n)
#define mod             1000000007
#define maxn            200001
#define PI              3.1415926535897932384626433832795
#define int             ll
#define loop0           for(int i=0;i<n;i++)
#define loop1           for(int i=1;i<=n;i++)
#define inpar0(ar)      for(int i=0;i<n;i++)cin>>ar[i];
#define inpar1(ar)      for(int i=1;i<=n;i++)cin>>ar[i];
#define showar0(ar)     for(int i=0;i<n;i++)cout<<ar[i]<<" ";
#define showar1(ar)     for(int i=1;i<=n;i++)cout<<ar[i]<<" ";
#define manu            cout<<(checkerCounter++)<<endl;
static int checkerCounter = 1;
int binpow(int a,int b){int res=1;while(b>0){if(b%2){res=(res*a)%mod;b--;}a=(a*a)%mod;b/=2;}return res%mod;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}

signed main(){
    int n;cin>>n;
    int x=n%10;
    if(x==3)cout<<"bon"<<endl;
    else if(x==0 ||x==1||x==6||x==8)cout<<"pon"<<endl;
    else cout<<"hon"<<endl;
}


Measured memory_bytes: 3632
#include<stdio.h>
int main(){
  int ya,yb;
  int i,a=0,s;
  while(1){
    s=0;
    scanf("%d %d",&ya,&yb);
    if(ya==0&&yb==0)break;
    if(a==1)printf("\n");
    for(i=ya;i<=yb;i++){
      if(i%400==0||(!(i%100==0)&&i%4==0)){
	printf("%d\n",i);
	s=1;
      }
    }
    if(s==0)printf("NA\n");
    a=1;
  }
  return 0;
}

Measured memory_bytes: 616
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> M;

bool compare_by_b(pair<int, double> a, pair<int, double> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main(){
    int h,n;
    cin >> h >> n;
    int a[n],b[n];
  int dekai = -1;
    vector<M> hoge;
    for(int i = 0; i < n; i++){
        int temp1,temp2;
        cin >> temp1 >> temp2;
        a[i] = temp1;
        b[i] = temp2;
      dekai = max(dekai,temp1);
    }
    int dp[h+dekai];
    for(int i = 0; i < h+dekai ; i++){
        dp[i] = MOD;
    }
    dp[0] = 0;
        //hoge.push_back(i,((double)temp1/temp2));
    //sort(hoge.begin(),hoge.end(),compare_by_b);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < h+dekai;j++){
            if(j+a[i] < h+ dekai){
                dp[j+a[i]] = min(dp[j+a[i]],dp[j]+b[i]);
            }
        }
    }
    int ans = MOD;
    for(int i = h; i < h+dekai;i++){
        ans = min(ans,dp[i]);
    }
    cout << ans << endl;




}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>

#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

ll gcd(ll a, ll b) {
  if (a == 0 || b == 0) return a + b;
  if (b > a) return gcd(b, a);
  return gcd(b, a % b);
}




int main(void) {

  int n;
  ll a[100100], l;
  cin >> n >> l;
  rep(i, n) cin >> a[i];

  rep(i, n-1) {
    if (a[i]+a[i+1]>=l) {
      cout << "Possible\n";
      for (int j = 1; j < i + 1; j++) cout << j << endl;
      for (int j = n - 1; j > i + 1; j--) cout << j << endl;
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << "Impossible\n";
  return 0;
  
}


Measured memory_bytes: 1536
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

int main(void) {
    int X, Y;

    scanf("%d %d", &X, &Y);

    int odA = Y - (2 * X);

    if( odA == 0 ) {
        printf("Yes\n");
        return 0;
    }
    if( (odA < 0) || ((odA % 2) != 0) ) {
        printf("No\n");
        return 0;
    }
    if( (odA / 2) <= X ) {
        printf("Yes\n");
        return 0;
    }

    printf("No\n");
    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <bits/stdc++.h>
#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <iostream>
#include <fstream>
#include <numeric>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <iterator>
typedef long long ll;
#define f(i,a,b) for(i=a;i<b;i++)

using namespace std;
int counter[100005];
ll bigmod(ll a, ll b, ll mod)
{
    if(b==0)return 1%mod;
    ll x=bigmod(a,b/2,mod);
    x=(x*x)%mod;
    if(b%2==1)x=(x*a)%mod;
    return x;
}
int main()
{
    int n,i,p;
    cin>>n;
    int a[n];
    f(i,0,n){cin>>a[i];counter[a[i]]++;}
    sort(a,a+n);
    if((n%2 && a[1]==0 )||(n%2==0 && a[0]==0 )){cout<<"0"<<endl; return 0;}
    for(i=1;i<=a[n-1];i++)if(counter[a[i]]!=2){cout<<"0"<<endl; return 0;}
    p=n/2;
    cout<<bigmod(2,p,1000000007);

    return 0;
}

Measured memory_bytes: 1024
using System;

namespace X_Cubic
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = int.Parse(Console.ReadLine());
            MyMath.Cube(x);
        }
    }
    class MyMath
    {
        static public void Cube(int num)
        {
            Console.WriteLine(Math.Pow(num, 3));
        }
    }

}

Measured memory_bytes: 9412
n = int(input())
l = list(i for i in range(n+1))
for i in range(n+1):
  for k in range(7):
    if i+6**k<=n:
      l[i+6**k] = min(l[i+6**k],l[i]+1)
 # print(l)
  for m in range(7):
    if i+9**m<=n:
      l[i+9**m] = min(l[i+9**m],l[i]+1)
  #print(l)
print(l[-1])
      

Measured memory_bytes: 7076
import java.util.*;

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

        String S = sc.next();
        int l = S.length();
        String a = "LR";

        for(int i=0; i<l; i++){
            if(i%2==0){
                if(S.charAt(i)==a.charAt(0)){
                    System.out.println("No");
                    break;
                }
            }
            else{
                if(S.charAt(i)==a.charAt(1)){
                    System.out.println("No");
                    break;
                }
            }
            if(i==l-1){
                System.out.println("Yes");
            }
        }
    }
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn long long

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


int main()
{
  int a, b;
  cin >> a >> b;
  if((a + b) % 2 == 0) cout << (a+b)/2 << endl;
  else cout << (a+b)/2+1 << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
flag = True
if N % 2 == 0:
    if 0 in A or len(set(A)) != N//2:
        flag = False
else:
    if len([0 for a in A if a == 0]) != 1 or len(set(A)) != N//2+1:
        flag = False
if flag:
    print(2**(N//2) % (10**9+7))
else:
    print(0)

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

#define int ll

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second

typedef long long ll;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

const int MOD = 998244353;

int add(int x, int y) {
	x += y;
	if(x >= MOD)
		x -= MOD;
	return x;
}

int mult(int x, int y) {
	return (x * y) % MOD;
}


ll binpow(ll base, ll e, ll mod = MOD) {
	ll ret = 1;
	while(e) {
		if(e & 1)
			ret  = ret * base % mod;
		base = base * base % mod;
		e >>= 1;
	}		
	return ret;
}

int32_t main() {
	int n;
	cin >> n;
	vi tot(n), mn(n);
	string s[n];
	for(int i = 0; i < n; i++) {
		cin >> s[i];
		int sum = 0;
		for(char c : s[i]) {
			if(c == '(')
				sum++;
			else
				sum--;
			mn[i] = min(mn[i], sum);
		}
		tot[i] = sum;
	}
	int cur = 0;
	vi v(n);
	iota(all(v), 0);
	sort(all(v), [&] (int i, int j) {
		if(tot[i] >= 0 && tot[j] < 0)
			return true;
		if(tot[i] < 0 && tot[j] >= 0)
			return false;
		if(tot[i] >= 0 && tot[j] >= 0)
			return mn[i] > mn[j];
		return tot[i] - mn[i] > tot[j] - mn[j];
	});
	for(int pos : v) {
		cur += mn[pos];
		if(cur < 0) {
			cout << "No\n";
			return 0;
		}
		cur = cur - mn[pos] + tot[pos];
	}
	if(cur == 0)
		cout << "Yes\n";
	else
		cout << "No\n";
}


Measured memory_bytes: 57816
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A: Five Antennas
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int N = 5;

/* typedef */

/* global variables */

int as[N];

/* subroutines */

/* main */

int main() {
  for (int i = 0; i < N; i++) scanf("%d", as + i);
  int k;
  scanf("%d", &k);

  if (as[N - 1] - as[0] <= k) puts("Yay!");
  else puts(":(");
  return 0;
}


Measured memory_bytes: 256
# 解説AC
k = gets.to_i
queue = [1, 2, 3, 4, 5, 6, 7, 8, 9]
x = 0
k.times do
  x = queue.shift
  if x % 10 != 0
    queue.push(x * 10 + (x % 10) - 1)
  end
  queue.push(x * 10 + (x % 10))
  if x % 10 != 9
    queue.push(x * 10 + (x % 10) + 1)
  end
end
puts x


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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  vector<int> b(N);
  for(int i =0;i<N;i++){
    cin>>a.at(i);
    b[i] = a[i];
  }
  sort(b.begin(),b.end());
  if(b[N-1]==b[N-2]){
    for(int i=0;i<N;i++){
      cout << b[N-1] << endl;
    }
  }

  else{
    for(int i=0;i<N;i++){
      if(a[i]!=b[N-1]) cout << b[N-1] << endl;
      else cout << b[N-2] << endl;
    }
  }


}


Measured memory_bytes: 3200
def gathering_children(s)
  ans = Array.new(s.size) { 0 }
  offset = 0
  s.each_char.with_index do |c, i|
    if c == 'R'
      offset = 0
    else
      if offset % 2 == 0
        ans[i - offset] += 1
      else
        ans[i - offset - 1] += 1
      end
      offset += 1
    end
  end

  offset = 0
  (s.size - 1).downto(0) do |i|
    c = s[i]
    if c == 'L'
      offset = 0
    else
      if offset % 2 == 0
        ans[i + offset] += 1
      else
        ans[i + offset + 1] += 1
      end
      offset += 1
    end
  end

  ans.join("\s")
end

puts gathering_children(gets.chomp)

Measured memory_bytes: 3196
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const int MOD = 1e9 + 7;
using namespace std;
typedef long long ll;

map<ll, int> mp;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N, L;
	cin >> N >> L;
	vector<int> a(201);
	int sum = 0;
	for (int i = 1; i <= N; i++) {
		sum += L + i - 1;
	}
		int ans = 0;
		for (int i = 1; i <= N; i++) {
			a[i - 1] += L + i - 1;
			if (sum >= 0) {
				if (a[i - 1] > 0) {
					ans = max(sum - a[i - 1], ans);
				}
				else if (a[i - 1] < 0) {
					ans = max(sum + a[i - 1], ans);
				}
				else {
					ans = sum - a[i - 1];
				}
			}
			else {
				if (a[i - 1] > 0) {
					ans = min(sum + a[i - 1], ans);
				}
				else if (a[i - 1] < 0) {
					ans = min(sum - a[i - 1], ans);
				}
				else {
					ans = sum - a[i - 1];
				}
			}
		}
		cout << ans << endl;
	return 0;
}

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

#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define MAXN 10005
#define MAXM 100005
#define pi 3.14159265359

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vpii;
typedef long long ll;
typedef priority_queue<int> pqi;
typedef priority_queue<pii, vpii, greater<pii> > dij;

ll N, x, cont;
ll child[105];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin >> N >> x;

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

	sort(child, child+N);

	for(int i = 0; i < N-1; i++){
		if(child[i] <= x)
			cont ++;
		else
			break;

		x = x - child[i];
	}

	if(child[N-1] == x)
		cont++;

	cout << cont << "\n";


}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
#define mod 1000000007
#define aint(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(int)a;i<(int)b;i++)
#define revrep(i,a,b) for(i=(int)a;i>=(int)b;i--)
#define ii pair<int,int>
#define pb push_back
#define f first
#define s second
#define ll long long int
#define vi vector<int>
#define rs resize
int main()
{  std::ios::sync_with_stdio(false);
   string a;
   cin>>a;
   int ch[26],i;
   rep(i,0,26)
    ch[i] = 0;
   rep(i,0,a.length())
    ch[a[i]-'a']++;
   bool flag = true;
   rep(i,0,26)
    if(ch[i] >=2)
    {
      flag = false;
      break;
    }
   if(!flag)
    cout<<"no";
   else
    cout<<"yes";
   return 0;
}


Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#include <functional>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi   vector<int> 
#define   co(x)  cout << x << '\n' 
#define   dbg(x)  cerr << #x << " = " << x << '\n' 
#define   bitcount(x)  (int)__builtin_popcount(x) 
#define   sz(x)  (int)x.size()
#define   all(a) a.begin(),a.end() 
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

int n,m,query,l,r; 
int train[505][505]; 

signed main()
{
    cin >> n >> m >> query ; 
    for (int  i=0 ; i< m ; i++) { 
    	cin >> l >> r ; 
    	train[l][r]++ ; 
    } 
    // 2D cumulative sum ... 
    for (int i=1;i<=n;i++){
    	for (int j=1;j<=n;j++){
    		train[i][j] += train[i][j-1] + train[i-1][j] - train[i-1][j-1] ; 
    	}
    }
    while (query--){ 
    	cin >> l >> r ; 
    	co ( train[r][r] -  train[l-1][r] ) ; 
    }
    return 0;
}


Measured memory_bytes: 5576
#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long;
const ll mod = 1000000007;
const int INF = INT_MAX / 2;

int N; 

ll dfs(ll num){
    if(num>N){
        return 0;
    }

    bool has_three, has_five, has_seven;
    has_three = has_five = has_seven = false;

    ll t = num;
    while(t!=0)    
    {
        if(t%10==3) has_three = true;
        else if(t%10==5) has_five = true;
        else if(t%10==7) has_seven = true;
        t/=10;
    }
    ll cnt = 0;
    if(has_three&&has_five&&has_seven) cnt++;
    cnt += dfs(num*10+3) + dfs(num*10+5) + dfs(num*10+7);
    return cnt;
}


int main(){
    cin >> N;
    ll ans = 0;
    ans += dfs(3);
    ans += dfs(5);
    ans += dfs(7);
    cout << ans << endl;
}

Measured memory_bytes: 256
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}



int main(){
  
  int a,b;cin>>a>>b;
  cout << 6-a-b <<endl;

}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#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>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#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++)

int main(){
  int n, m, s;
  cin >> n;
  int A[30],B[30],C[30];
  rep(i, n) {
    cin >> A[i];
  }
  rep(i, n) {
    cin >> B[i];
  }
  m = n-1;
  rep(i, m) {
    cin >> C[i];
  }
  rep(i, n) {
    s += B[A[i]-1];
    if (A[i]+1 == A[i+1]) {
      s += C[A[i]-1];
    }
  }
  cout << s << endl;

}

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

int main() {
	int a[4];
	for (int b = 0; b < 4; b++)cin >> a[b];
	sort(a, a + 4);
	if (a[0] == a[1] && a[2] == a[3])puts("yes");
	else puts("no");
}

Measured memory_bytes: 3132
#include<iostream>
#include<queue>
#include<utility>
#include<map>
#define MP make_pair
using namespace std;
typedef pair<int, int> P;

char grid[55][55];
int dist[55][55];
bool is_checked[55][55];

int main() {
    int H, W;
    cin >> H >> W;
    map<P, bool> is_exist;
    int white = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> grid[i][j];
            is_exist[P(i, j)] = true;
            if (grid[i][j] == '.') white++;
        }
    }
    if (grid[0][0] == '#' || grid[H - 1][W - 1] == '#') {
        cout << -1 << endl;
        return 0;
    }
    int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
    queue<pair<P, int> > Q;
    Q.push(MP(P(0, 0), 1));
    while (!Q.empty()) {
        P now_pos = Q.front().first;
        int x = now_pos.first, y = now_pos.second;
        int cost = Q.front().second;
        Q.pop();
        if (is_checked[x][y]) continue;
        is_checked[x][y] = true;
        dist[x][y] = cost;
        for (int i = 0; i < 4; i++) {
            int now_x = x + dx[i], now_y = y + dy[i];
            if (is_exist[P(now_x, now_y)] && !is_checked[now_x][now_y] && grid[now_x][now_y] == '.') {
                Q.push(MP(P(now_x, now_y), cost + 1));
            }
        }
    }
    if (dist[H - 1][W - 1] == 0) {
        cout << -1 << endl;
        return 0;
    }
    cout << white - dist[H - 1][W - 1] << endl;
    return 0;
}

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

using namespace std;

#define ll long long int

ll mod = 1000000007;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    ll s;
    cin>>s;
    ll dp[s+2],cum[s+2];
    dp[0]=0;dp[1]=0;dp[2]=0;dp[3]=1;
    cum[0]=0;cum[1]=0;cum[2]=0;cum[3]=1;
    for(int i=4;i<=s;i++){
        dp[i] = (cum[i-3]+1)%mod;
        cum[i] = (cum[i-1] + dp[i])%mod;
    }
    
    cout<<dp[s]%mod<<endl;
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    int d[n];
    for(int i = 0; i < n; i++){
        cin >> d[i];
    }
    
    int replaceCnt = 0;
    int count = 0;
    bool replaced = true;
    while(replaced){
        replaced = false;
        for(int i = 0; i < n - count - 1; i++){
            if(d[i] > d[i+1]){
                int buf = d[i];
                d[i] = d[i+1];
                d[i+1] = buf;
                replaceCnt++;
                replaced = true;
            }
        }
        count++;
    }
    
    for(int i = 0; i < n; i++){
        cout << (!i ? "" : " ") << d[i];
    }
    cout << endl << replaceCnt << endl;
    
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>

using namespace std;
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

unordered_map<int, int> memo;

int getCash(pair<int,int> p) {
	int count = p.first;
	int x = p.second;
	if (memo.find(x) != memo.end()) {
		if (memo[x] < count) {
			//do nothing
			return 0;
		}

	}
	memo[x] = count;
	if (x >= 6) {
		int n = 6;
		while (n <= x) n *= 6;
		getCash({ count+1,x -n/6 });
	}
	if (x >= 9) {
		int n = 9;
		while (n <= x) n *= 9;
		getCash({ count + 1,x - n / 9 });
	}
	
	return 0;
}


int main() {
	int N;
	cin >> N;
	getCash({ 0,N});
	
	int res=1<<30;
	for (int i = 0; i <= 5; i++) {
		if (memo.find(i) != memo.end())
			res = min(res, memo[i] + i);
	};
	cout << res;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;

namespace ABC106A
{
    class Program
    {
        static void Main(string[] args)
        {
            var A = ReadInt;
            var B = ReadInt;

            int ans = A * B - A - B + 1;
            Console.WriteLine(ans);

        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] ReadLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    static class Debug
    {
        static public void Draw2D(int[,] map, int mode = 1)
        {
#if DEBUG
            int W = map.GetLength(0);
            int H = map.GetLength(1);

            int[,] map2 = new int[W + 1, H + 1];
            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = 0;
                    else if (i == 0) map2[i, j] = j - 1;
                    else if (j == 0) map2[i, j] = i - 1;
                    else map2[i, j] = map[i - 1, j - 1];
                }
            }

            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write(map2[i, j] % 10);
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        public static void Draw1D(int[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


Measured memory_bytes: 13268