akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 10;
const ll inf = 1e9 + 7;
ll a[N],sp[N],n,k,sl = 0;
int main(){
    cin >> n >> k;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
        if (a[i] == 0) sl++;
    }
    sort(a + 1,a + 1 + n);
    for (int i = 1; i <= n; i++) sp[i] = (a[i] < 0) ? sp[i - 1] + 1 : sp[i - 1];
    //for (int i = 1; i <= n; i++) cout << sp[i] << " " ; cout << "\n";
    int getmax = 0 , q = ((sp[n] - sp[n - k]) % 2 == 0) ? 1 : -1;
    long double fr = 1 , nr = 1;
    for (int i = 1 , j = n - k + 2; i <= k; i++ , j++){
        int temp = ((sp[i] + sp[n] - sp[j - 1]) % 2 == 0) ? 1 : -1;
        ll c = (ll)2e18 / fr , d = (ll)2e18 / nr;
        if (c >= abs(a[i]) && d >= abs(a[j - 1])) fr = fr * abs(a[i]) , nr = nr * abs(a[j - 1]);
        else fr = fr / abs(a[j - 1]) , nr = nr / abs(a[i]);
        //cout << fr << " " << nr << "\n";
        if (temp > q){
            getmax = i;
            q = temp;
        }
        else 
        if (temp == q && temp == 1){
            if (fr > nr) getmax =  i;
            fr = 1; nr = 1;
        }
        else
        if (temp == q && temp == -1){
            if (fr < nr) getmax = i;
            fr = 1; nr = 1;
        }
        //cout << i << " " << j << "\n";
    }
    long long  ans = 1;
    for (int i = 1; i <= getmax; i++) ans = (ans * abs(a[i])) % inf; 
    for (int i = n - k + getmax + 1; i <= n; i++) ans = (ans * abs(a[i])) % inf;
    if ((sp[getmax] + sp[n] - sp[n - k + getmax]) % 2 == 0) cout << ans;
    else
    if (sl > 0) cout << 0; else cout << (-ans + inf + inf) % inf;
    return 0;
}

Measured memory_bytes: 6588
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
#include <cassert>
#include <memory>
using namespace std;
typedef long long ll;
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int main ()
{
    ll N;
    cin >> N;

    set<ll> div;
    for (ll i = 1LL; i * i <= N; i++) {
        if (N % i == 0) {
            div.insert(i);
            div.insert(N / i);
        }    
    }

    ll ans = 0;
    for (auto x: div) {
        if (x == 1) continue;
        ll xt = N;
        while (xt % x == 0) {
            xt /= x;
        }
        if (xt % x == 1) {
            ans++;
        }
    }

    set<ll> div2;
    for (ll i = 1LL; i * i <= (N - 1); i++) {
        if ((N - 1) % i == 0) {
            div2.insert(i);
            div2.insert((N - 1) / i);
        }
    }

    ans += (div2.size() - 1);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)n; i++)
#define PI 3.14159265359
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

    cout << r * 2 * PI << endl;
    return 0;
}

Measured memory_bytes: 3764
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<stack>
#include<queue>

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

using namespace std;

int main() {
    long long N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;

    long long min_ = A;
    long long max_ = A;

    //printf("A = %d\n", A);
    //printf("min\tmax\n");

    //A *= 2;
    //B *= 2;
    rep(i, N - 1) {
        long long delta = B - A;
        if (delta > 0){
            min_ += C;
            max_ += D;
        } else {
            min_ -= D;
            max_ -= C;
        }
        A = (min_ + max_) / 2;
        //printf("%d\t%d\n",min_, max_);
    }

    if (min_ <= B && B <= max_) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }
}


Measured memory_bytes: 256
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from collections import deque
 
H, W, K = map(int,readline().split())
x1, y1, x2, y2 = map(int,readline().split())
x1 -= 1; y1 -= 1; x2 -= 1; y2 -= 1
C = read().split()

dist = [[-1]*W for i in range(H)]
dist[x1][y1] = 0
d = deque([[x1, y1]])
dxy= [[1, 0], [0, 1], [-1, 0], [0, -1]]
while d:
  x, y = d.popleft()
  if (x, y) == (x2, y2):
    print(dist[x][y])
    quit()
  for dx, dy in dxy:
    xx = x; yy = y
    for i in range(K):
      xx += dx; yy += dy
      if 0<=xx<H and 0<=yy<W and C[xx][yy]!='@':
        if 0 <= dist[xx][yy] <= dist[x][y]:
          break
        if dist[xx][yy] == -1:
           d.append([xx, yy])
        dist[xx][yy] = dist[x][y] + 1
      else:
        break

print(-1)


Measured memory_bytes: 118844
#include<stdio.h>
int N, M, a, b, A[51], i;
int main(){
  scanf("%d%d", &N, &M);
  for(i=0; i<M; i++){
    scanf("%d%d", &a, &b);
    A[a]++;
    A[b]++;
  }
  for(i=1; i<=N; i++){
    printf("%d\n", A[i]);
  }
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
struct edge
{
	int x,y;
}e[200010];
int n,dep[200010],d[200010],sx,sy,fa[200010];
bool used[200010],vis[200010];
int cnt,head[200010],to[400010],nxt[400010];
vector<int> v[200010];
queue<int> q;
void add(int x,int y)
{
	cnt++;
	to[cnt]=y;
	nxt[cnt]=head[x];
	head[x]=cnt;
}
void dfs(int x)
{
	for (int i=head[x];i;i=nxt[i])
	{
		int y=to[i];
		if (y==fa[x])
		{
			continue;
		}
		fa[y]=x;
		dep[y]=dep[x]+1;
		dfs(y);
	}
}
bool check(int x,int y)
{
	if (dep[x]>dep[y])
	{
		swap(x,y);
	}
	if (x==fa[y] || x==fa[fa[y]])
	{
		return true;
	}
	if (fa[x]==fa[y])
	{
		return true;
	}
	return false;
}
int main()
{
	scanf("%d%d%d",&n,&sy,&sx);
	for (int i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&e[i].x,&e[i].y);
	}
	for (int i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	dep[sx]=1;
	dfs(sx);
	for (int i=1;i<n;i++)
	{
		int x,y;
		x=e[i].x;
		y=e[i].y;
		if (!check(x,y))
		{
			used[x]=used[y]=true;
		}
		else
		{
			v[x].push_back(y);
			v[y].push_back(x);
		}
	}
	memset(d,-1,sizeof(d));
	d[sy]=1;
	vis[sy]=true;
	q.push(sy);
	while (!q.empty())
	{
		int x=q.front();
		q.pop();
		for (int i=0;i<v[x].size();i++)
		{
			int y=v[x][i];
			if (d[y]!=-1)
			{
				continue;
			}
			d[y]=d[x]+1;
			if (d[y]<dep[y])
			{
				vis[y]=true;
				q.push(y);
			}
		}
	}
	int mx=0;
	for (int i=1;i<=n;i++)
	{
		if (used[i] && vis[i])
		{
			puts("-1");
			return 0;
		}
		if (vis[i])
		{
			mx=max(mx,dep[i]);
		}
	}
	cout<<(mx-1)*2<<endl;
	return 0;
}
//初见你时你给我你的心，里面是一个春天的早晨。
//再见你时你给我你的话，说不出的是炽烈的火夏。
//三次见你你给我你的手，里面藏着个叶落的深秋。
//最后见你是我做的短梦，梦里有你还有一群冬风。
//——《季候》

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

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            int k = Integer.parseInt(br.readLine());
            int sum = 0;
            String str[] = br.readLine().split(" ");
            for (int i = 0; i < n; i++) {
                int x = Integer.parseInt(str[i]);
                int tmp = Math.abs(x - k);
                if (x < tmp) {
                    sum += x * 2;
                } else {
                    sum += tmp * 2;
                }
            }
            System.out.println(sum);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second

typedef long long int Double;
typedef pair<Double,Double> Punto;

Double dist(const Punto &a, const Punto &b) {
    Double dx = llabs(a.x - b.x);
    Double dy = llabs(a.y - b.y);
    return dx + dy;
}
 
Double ccw(const Punto &o, const Punto &a, const Punto &b) {
    return (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
}

Double puntosMasLejanos(vector<Punto> &p) {
    int n = p.size(), i, j = 0, k = 0;
    vector<Punto> U(2 * n), L(2 * n);
    sort(p.begin(), p.end());
    for (i = 0; i < n; i++) {
        while (j >= 2 and ccw(L[j - 2], L[j - 1], p[i]) <= 0) --j;
        while (k >= 2 and ccw(U[k - 2], U[k - 1], p[i]) >= 0) --k;
        L[j++] = p[i];
        U[k++] = p[i];
    }
    L.resize(j);
    U.resize(k);
    
    i = 0;
    j = L.size() - 1;
    Double d = -1;
    while (i < U.size() or j > 0) {
        d = max(d, dist(U[i], L[j]));
        if (i == U.size())
            j--;
        else if (j == 0)
            i++;
        else if ((U[i+1].y - U[i].y) * (L[j].x - L[j-1].x)
         > (U[i+1].x - U[i].x) * (L[j].y - L[j-1].y))
            i++;
        else
            j--;
    }
    return d;
}
 
int main() {
 
    int n;
    vector<Punto> P;
    
    cin >> n;
	P.assign(n, Punto(0,0));
	for (int i = 0; i < n; i++) {
		cin >> P[i].x >> P[i].y;
	}
	if (n == 1)
		cout << "0\n";
	else if (n == 2)
		cout << dist(P[0], P[1]) << "\n";
	else
		cout << puntosMasLejanos(P) << "\n";
    return 0;
}

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

int main()
{
    string s;
    cin >> s;
    vector<char> a;
    int ans = 0;
    a.push_back(s[0]);
    for(int i=1;i<s.size();i++){
        if(a[0] != s[i]){
            a[0] = s[i];
        }
        else{
            a[0] = ' ';
            ans++;
            if(i < s.size()-2){
                i++;
            }
            else{
                break;
            }
        }
    }
    cout << s.size()-ans << endl;
    return 0;
}

Measured memory_bytes: 640
# 両方の数列から同じ部分列がいくつあるか？
MOD = 10**9+7
N, M = map(int, input().split())
S = [0] + list(map(int, input().split()))
T = [0] + list(map(int, input().split()))
# 最後に(n,m)でとる
dp = [[0]*(M+1) for _ in range(N+1)]
# 2次元累積和、(n,m) inclusive. 
dp_cum = [[0]*(M+1) for _ in range(N+1)]

# empty
dp[0][0] = 1
dp_cum[0][0] = 1
for n in range(N+1):
  dp_cum[n][0] = 1
for m in range(M+1):
  dp_cum[0][m] = 1  

for n in range(1, N+1):
  for m in range(1, M+1):
    if S[n] != T[m]:
      dp[n][m] = 0
    else:
      # (n-1, m-1)までで作れてるやつから飛んでくる
      dp[n][m] = dp_cum[n-1][m-1]
    dp_cum[n][m] = dp_cum[n-1][m] + dp_cum[n][m-1] - dp_cum[n-1][m-1] + dp[n][m]
    dp_cum[n][m] %= MOD

answer = dp_cum[N][M]
print(answer)    
      
    
  

Measured memory_bytes: 104540
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    int k,x;
    cin >> k >> x;
    if (500*k >= x) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
const ll MOD = 1000000007;
long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}

string tmp="";
void maker(ll N) {
    char a = ((N-1)%26) + 97;
    tmp = a + tmp;
    N--;
    if((N/26)>0)maker(N/26);
    else return;
}

int main(){
    ll N;cin >>N;
    tmp = ((N-1)%26) + 97;
    N--;
    N /= 26;
    if(N>0)maker(N);
    cout << tmp << endl;
    return 0;
}

Measured memory_bytes: 3604
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)

N = getN()
nums = [int(e) for e in input().split()]
nums.sort()
checker = nums[0]
count = 1
for i in range(1,N):
    if(checker != nums[i]):
        count+=1
        checker = nums[i]
if(N - count)%2==0:
    print(count)
else:
    print(count-1)

Measured memory_bytes: 56560
from collections import deque

N = int(input())

a = list(map(int,input().split()))

l = [N - 1 - i for i in range(N)]

st = deque([])

for i in range(N):


    while len(st) > 0 and st[-1][0] > a[i]:

        p = st.pop()
        l[p[1]] = i - p[1] - 1

    st.append([a[i],i])


a.reverse()
r = [N - 1 - i for i in range(N)]

st = deque([])

for i in range(N):


    while len(st) > 0 and st[-1][0] > a[i]:

        p = st.pop()
        r[p[1]] = i - p[1] - 1

    st.append([a[i],i])

r.reverse()
a.reverse()


ans = 0

for i in range(N):

    ans += (1 + (l[i]+r[i]) + (l[i] * r[i])) * a[i]

print (ans)    


Measured memory_bytes: 104888
#include<iostream>
#include <numeric>
// #include<string>
#include<vector>
#include <algorithm>
#include <cmath>
// #include <functional>
#include <iomanip>

using namespace std;

int main()
{
    // std::cout<<std::fixed<<std::setprecision(10);

    // Input
    string in;
    cin >> in;

    if (in[2]==in[3] && in[4]==in[5]) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define int ll
using pint = pair<int,int>;
using Graph = vector<vector<int>>;
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 1e10; //10^10
const double PI = acos(-1.0L);
/*mod逆元*/long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}
template< typename T >T mod_pow(T x, T n, T p=MOD) {T ret = 1;while(n > 0) {if(n & 1) (ret *= x) %= p;(x *= x) %= p;n >>= 1;}return ret;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}

//----------------ライブラリとか----------------

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

    int n; cin >> n;
    VI a(26,INF);
    while(n--){
        string s; cin >> s;
        VI b(26,0);
        for(char c : s) b[c-'a']++;
        REP(i,26) chmin(a[i],b[i]);
    }
    REP(i,26) REP(j,a[i]) cout << (char)('a'+i);
    cout << '\n';

    return 0;
}

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

long DIV = 1000000007;

std::vector<std::vector<long long>> comb(int n, int r) {
  std::vector<std::vector<long long>> v(n + 1,std::vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k])%DIV;
    }
  }
  return v;
}

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

   auto v = comb(K-1,K-1);
   auto v2 = comb(N-K+1,N-K+1);
   for (int i = 0; i < K;i++) {
      // cout<<v[K-1][i]<<endl;
      // cout<<v2[N-K+1][i+1]<<endl;
      if (i+1 > N-K+1) cout<<0<<endl;
      else cout<<(v[K-1][i]*v2[N-K+1][i+1])%DIV<<endl;
   }


   return 0;
}

Measured memory_bytes: 31616
n, a, b = map(int, input().split())
s = input()
sum_ = 0
b_cnt = 0
for i in range(n):
    #print(sum_, b_cnt)
    if s[i] != 'c' and sum_ < a + b:
        if s[i] == 'a':
            print('Yes')
            sum_ += 1
            continue
        elif s[i] == 'b' and b_cnt < b:
            print('Yes')
            b_cnt += 1
            sum_ += 1
            continue
    
    print('No')

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

public class Main {

	public static void main(String[] args) {
		
		String CMD = null ;
		BufferedReader BR = null;
		BR = new BufferedReader(new InputStreamReader(System.in));
		try {CMD = BR.readLine();
		} 
		catch (IOException e) {e.printStackTrace();
		}
		String[] str = CMD.split(" "); 
		
		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int c = Integer.parseInt(str[2]);
		
		if(a<b && b<c){
			System.out.println("Yes");
		}else{
			System.out.println("No");			
		}

	}

}

Measured memory_bytes: 24112
W,H,N=map(int,input().split())
sq=[[1 for i in range(W)] for j in range(H)]

for i in range(N):
    x,y,a=map(int,input().split())
    if a==1:
        for X in range(0,x):
            for Y in range(H):
                sq[Y][X]=0
    if a==2:
        for X in range(x,W):
            for Y in range(H):
                sq[Y][X]=0
    if a==3:
        for X in range(W):
            for Y in range(0,y):
                sq[Y][X]=0
    if a==4:
        for X in range(W):
            for Y in range(y,H):
                sq[Y][X]=0

ans=0
for k in range(H):
    ans+=sum(sq[k])
print(ans)


Measured memory_bytes: 9260
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long int lo;
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define inf (lo)1e10 + 7
#define FOR for(lo i = 0 ; i < n ; i++)
#define FORV for(lo i = 0 ; i < (lo)v.size() ; i++)
#define ii pair<lo,lo>
#define iii pair<lo, pair<lo,lo> >
#define si pair<string,lo>
lo a,b,c,d,e,n,m,k,t,h,x,y,a1[300005],a2[300005];
char c1,c2,c3,c4;
string s1,s2,s3,s4;
double d1,d2,d3;
vector <lo> v;
map <lo,lo> mp1;
map <lo,lo> mp2;
set <lo> stt;
queue <lo> q;
priority_queue <lo> pq;
lo vis [10000];
lo ans[100005];
int main() {
    // freopen("gir.gir", "r", stdin);
    // freopen("cik.cik", "w", stdout);
    cin >> n >> x >> y;
    for(lo i = 1 ; i <= n ; i++){
        for(lo j = i + 1 ; j <= n ; j++){
            ans[min(j-i, min((lo)abs(x-i)+(lo)abs(y-j)+1, (lo)abs(x-j)+(lo)abs(y-i)+1))]++;
        }
    }
    for(lo i = 1 ; i <= n - 1 ; i++){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

class UnionFind:
    def __init__(self, size, tb):
        self.table = tb

    def find(self, x):
        if self.table[x] < 0:
            return x
        else:
            self.table[x] = self.find(self.table[x])
            return self.table[x]

    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 != s2:
            if self.table[s1] <= self.table[s2]:
                self.table[s1] += self.table[s2]
                self.table[s2] = s1
            else:
                self.table[s2] += self.table[s1]
                self.table[s1] = s2
            return True
        return False

    def subsetall(self):
        a = []
        for i in range(len(self.table)):
            if self.table[i] < 0:
                a.append((i, -self.table[i]))
        return a

def main():
    n,m = LI()
    x = LI()
    s = sum(x)
    t = []
    e = collections.defaultdict(list)
    for _ in range(m):
        a,b,y = LI()
        a -= 1
        b -= 1
        t.append((y,a,b))
        e[a].append((b,y))
        e[b].append((a,y))

    t = sorted(t)

    uf = UnionFind(n,[-c for c in x])
    ba = [None] * m
    for i in range(m):
        y,a,b = t[i]
        uf.union(a,b)
        k = -uf.table[uf.find(a)]
        if k >= y:
            ba[i] = 1


    uf2 = UnionFind(n,[-c for c in x])
    for i in range(m-1,-1,-1):
        if ba[i] is None:
            continue
        y,a,b = t[i]
        if not uf2.union(a,b):
            continue
        al = set([a,b])
        q = set([a,b])
        while q:
            nq = set()
            for o in q:
                for c,cy in e[o]:
                    if cy > y:
                        continue
                    if uf2.union(o,c):
                        nq.add(c)
            q = nq

    r = m
    for i in range(m):
        y,a,b = t[i]
        k = -uf2.table[uf2.find(a)]
        if k >= y:
            r -= 1

    return r



print(main())




Measured memory_bytes: 64604
import java.util.*;
import java.util.Arrays;

public class Main {
    public static long a = (long)Math.pow(2, 60);
    public static long[] lst;
    public static long[] height;
    public static int K;
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        //System.out.println(a);
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        K = sc.nextInt();
        
        lst = new long[N];
        
        Arrays.fill(lst, a);
        
        lst[0] = 0;
        
        //System.out.println(lst[0]);
        
        height = new long[N];
        
        for (int i=0; i<N; i++) {
            height[i] = sc.nextInt();
        }
        
        //System.out.println(height[1]);
        
        //System.out.println(tilAns(N));
        System.out.println(tilAns(N-1));
    }
    static long tilAns(int n){
        if (lst[n] != a) {
            return lst[n];
        }
        
        if (n < K) {
            long mini = a;
            for (int i = 0; i<n; i++){
                if (mini > tilAns(i) + Math.abs(height[n] - height[i])) {
                    mini = tilAns(i) + Math.abs(height[n] - height[i]);
                }
            }
            lst[n] = mini;
            return lst[n];
        }
        long mini = a;
        for (int i = 1; i<=K; i++){
            if (mini > tilAns(n-i) + Math.abs(height[n] - height[n-i])) {
                mini = tilAns(n-i) + Math.abs(height[n] - height[n-i]);
            }
            
        }
        lst[n] = mini;
        return lst[n];
    }
}


Measured memory_bytes: 78588
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
int N,K;
bool f[10];
int ch(int a)
{
	for(;a>0;a/=10)
		if(f[a%10])return 0;
	return 1;
}
int main()
{
	cin>>N>>K;
	for(int i=0;i<K;i++)
	{
		int t;
		cin>>t;
		f[t]=1;
	}
	for(int i=N;i<=1000000;i++)
		if(ch(i))
		{
			cout<<i<<endl;
			return 0;
		}
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.lang.System.*;

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;
  private boolean hasNextByte() {
      if (ptr < buflen) {
          return true;
      }else{
          ptr = 0;
          try {
              buflen = in.read(buffer);
          } catch (IOException e) {
              e.printStackTrace();
          }
          if (buflen <= 0) {
              return false;
          }
      }
      return true;
  }
  private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
  private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
  public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
  public String next() {
      if (!hasNext()) throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while(isPrintableChar(b)) {
          sb.appendCodePoint(b);
          b = readByte();
      }
      return sb.toString();
  }
  public long nextLong() {
      if (!hasNext()) throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
          minus = true;
          b = readByte();
      }
      if (b < '0' || '9' < b) {
          throw new NumberFormatException();
      }
      while(true){
          if ('0' <= b && b <= '9') {
              n *= 10;
              n += b - '0';
          }else if(b == -1 || !isPrintableChar(b)){
              return minus ? -n : n;
          }else{
              throw new NumberFormatException();
          }
          b = readByte();
      }
  }
  public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
      return (int) nl;
  }
  public double nextDouble() { return Double.parseDouble(next());}
}

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();
    String S = sc.next();
    String T = sc.next();
    int ans = 0;
    for(int i=0; i<3; i++){
      if(S.charAt(i) == T.charAt(i) ) ans++;
    }
    out.println(ans);
  }
}

Measured memory_bytes: 21204
#include<stdio.h>
int main ()
{
    int i,a,b;
    scanf("%d %d", &a, &b);
    int arr[b];
    for(i=1;i<=b;i++)scanf("%d",&arr[i]);
    for(i=1;i<=b;i++)a=a-arr[i];
    if(a<=0)
    printf("Yes\n");
    else printf("No\n");
}


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

int main() {
  int A,B;
  cin >> A >> B;
  
  int cp1,cp2 = 0;
  int ans = 0;
  cp1 = max(A + B,A - B);
  cp2 = max(A * B,cp1);
  
  ans = cp2;
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	ans := make([]int, n)
	for i := 0; i < m; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		ans[a-1]++
		ans[b-1]++
	}
	for _, x := range ans {
		fmt.Println(x)
	}
}


Measured memory_bytes: 512
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i + 100*j + 50*k == x:
                count += 1
print(int(count))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
long long n;
int memo[200001];
string s;
long long f(long long x){
    if (x==0) return 0;
    if (memo[x]!=-1) return memo[x];
    long long num=0;
    for (int i=0;i<19;i++){
        if (x&(1<<i)) num++;
    }
    return memo[x]=f(x%num)+1;
}
long long power(long long a,long long b,long long p){
    a%=p;
    long long res=1;
    while (b>0){
        if (b%2==1) res=(res*a)%p;
        b/=2;
        a=(a*a)%p;
    }
    return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    memset(memo,-1,sizeof(memo));
    cin>>n>>s;
    long long num=0;
    for (int i=0;i<n;i++){
        if (s[i]=='1') num++;
    }
    long long up=0,down=0;
    for (int i=0;i<n;i++){
        if (s[i]=='1'){
            up+=power(2,n-i-1,num+1);
            if (num>1) down+=power(2,n-i-1,num-1);
            up%=(num+1);
            if (num>1) down%=(num-1);
        }
    }
    for (int i=0;i<n;i++){
        if (num==1 && s[i]=='1'){
            cout<<0<<'\n';
            continue;
        }
        long long curnum;
        if (s[i]=='1'){
            curnum=down;
            curnum-=power(2,n-i-1,num-1);
            curnum%=(num-1);
            if (curnum<0) curnum+=num-1;
        }
        else {
            curnum=up;
            curnum+=power(2,n-i-1,num+1);
            curnum%=(num+1);
            if (curnum<0) curnum+=num+1;
        }
        cout<<f(curnum)+1<<'\n';
    }
}

Measured memory_bytes: 4580
X,Y = map(int, input().split())

if X * 2 > Y:
  print('No')
elif X * 4 < Y:
  print('No')
else:
  for i in range(0,X+1):
    if Y == (X * 2) + (i * 2):
      print('Yes')
      break
  else:
    print('No')
      



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


int main() {

    string s; cin >> s;
    char c = 'a';
    vector<int> a(26,0);
    vector<int> m(26,-1);
    bool flag = false;


    rep(j,s.length()) {
        rep(i, 26) {
            if(s[j] != (char)(c+i)) a[i] ++;
            else{
                m[i] = max(m[i],a[i]);
                a[i] = 0;
            }
        }
    }

    rep(i, 26) {
        m[i] = max(m[i],a[i]);
        a[i] = 0;
    }

 
    sort(m.begin(),m.end());

    rep(i,26){
        if(m[i] != -1) {
            cout << m[i];
            break;
        }
    }

    return 0;
}











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

int main() {
    string S, T, U;
    int A, B;
    cin >> S >> T;
    cin >> A >> B;
    cin >> U;
    
    int a, b;
    if (U == S) {
        a = A - 1;
        b = B;
    } else {
        a = A;
        b = B -1;
    }

    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 888
#include <array>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <tuple>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

int main()
{
    int N, M, C;
    cin >> N >> M >> C;
    vector<int> B(M);
    REP(i, M) cin >> B[i];
    int ans = 0;
    REP(i, N)
    {
        vector<int> A(M);
        REP(i, M) cin >> A[i];
        int x = C;
        REP(i, M)
        {
            x += A[i] * B[i];
        }
        if (x > 0)
        {
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

# refered to
# rank : http://at274.hatenablog.com/entry/2018/02/02/173000
# size : abc120 kaisetsu
class UnionFind:
    def __init__(self, n):
        # par = Parent Number or NoV
        self.par = [-1] * (n+1)
        # rank = Tree Height
        self.rank = [0] * (n+1)
    
    # 自分が所属する集合の数を返す
    def size(self, x):
        return -1*self.par[self.find(x)]

    # 根なら番号を返す
    def find(self, x):
        
        if(self.par[x] < 1):
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    # 親が同じか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def union(self, x, y):
        # 根を探す
        x = self.find(x)
        y = self.find(y)

        # もう繋がれている
        if(x == y):
            return False

        # つなぎ替える
        if(self.size(x) < self.size(y)):
            x,y = y,x
        
        # xのサイズを更新
        self.par[x] += self.par[y]
        # yのサイズ(おやばんごう)をxに
        self.par[y] = x

        return True 


def solve(N: int, M: int, A: "List[int]", B: "List[int]"):
    ans = [0] * (M)
    uf = UnionFind(N)

    ans[M-1] = int(N*(N-1)/2)
    for i in reversed(range(1,M)):
        if(not uf.same_check(A[i], B[i])):
            ans[i-1] = ans[i] - uf.size(A[i])*uf.size(B[i])
        else:
            ans[i-1] = ans[i] 
        uf.union(A[i], B[i])

        
    for i in ans:
        print(i)
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int()] * (M)  # type: "List[int]" 
    B = [int()] * (M)  # type: "List[int]" 
    for i in range(M):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, M, A, B)

if __name__ == '__main__':
    main()


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main()
{
	FIO;
	map<string, int> cnt;
	w(n)
	{
		string s; cin >> s;
		cnt[s]++;
	}
	cout << cnt.size() << '\n';
	return 0;
}

Measured memory_bytes: 19208
#include <bits/stdc++.h>
#include <math.h>
#include <float.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

const int MOD = 1000000007;

int main(){
    ll N, K; cin >> N >> K;
    map<int, ll> counter;
    rep(i,N){
        ll a, b; cin >> a >> b;
        counter[a] += b;
    }

    ll now = 0;
    int ans = 0;
    for (auto c : counter){
        now += c.second;
        if (now >= K){
            ans = c.first;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 7520
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	ll res1 = 0;
	ll sum = 0;
	rep(i, n) {
		sum += a[i];
		if (i % 2 == 0) {
			if (sum <= 0) {
				res1 += 1 - sum;
				sum = 1;
			}
		}
		else {
			if (sum >= 0) {
				res1 += sum + 1;
				sum = -1;
			}
		}
	}
	ll res2 = 0;
	sum = 0;
	rep(i, n) {
		sum += a[i];
		if (i % 2 == 1) {
			if (sum <= 0) {
				res2 += 1 - sum;
				sum = 1;
			}
		}
		else {
			if (sum >= 0) {
				res2 += sum + 1;
				sum = -1;
			}
		}
	}
	ll ans = min(res1, res2);
	cout << ans << endl;
	return 0;
}

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

int div(int n){
  if(n%2==1){
    return 0;
  }else{
    return div(int(n/2))+1;
  }
}
    
int main(){
  int N;
  cin >> N;
  vector<int>a(N);
  for(int i=0;i<N;i++){
    cin >> a.at(i);
  }
 int min=div(a.at(0));
  for(int i=1;i<N;i++){
    int d=div(a.at(i));
    if(d<min){
      min=d;
    }
  }
  cout << min <<endl;
}
  


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define zoom ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define precise cout.precision(8); cout << fixed;
#define seed srand(chrono::steady_clock::now().time_since_epoch().count());
const double PI = acos(-1);
using namespace std;

ll power(ll x, ll y, ll p) { 
    ll res = 1LL;
    x = x % p;
    while (y > 0) {  
        if (y & 1LL) {
            res = (res * x) % p; 
        }
        y = y >> 1LL; 
        x = (x * x) % p; 
    } 
    return res; 
} 
   
ll modInverse(ll n, ll p) { 
    return power(n, p - 2, p); 
} 
  
void solve() {
    ll N, M; cin >> N >> M;
    ll i, j;
    vector<ll> look(N + 1, 1);
    look[N - 1] = M - N + 1;
    for(i = N - 2; i >= 0; i -= 1) {
        look[i] = (look[i + 1] * (M - i)) % MOD;
    }
    ll one = (look[0] * look[0]) % MOD;
    vector<ll> C(N + 1, 1), fact(N + 1, 1);
    for(i = 1; i <= N; i += 1) {
        fact[i] = (fact[i - 1] * i) % MOD;
    }
    for(i = 0; i <= N; i += 1) {
        C[i] = (fact[N] * ((modInverse(fact[i], MOD) * modInverse(fact[N - i], MOD)) % MOD)) % MOD;
    }
    /*
    vector<ll> C{1};
    for(i = 1; i <= N; i += 1) {
        vector<ll> temp(i + 1);
        temp[0] = 1; temp[i] = 1;
        for(j = 1; j < i; j += 1) {
            temp[j] = (C[j - 1] + C[j]) % MOD;
        }
        C = temp;
    }
    */
    ll two = 0;
    for(i = 1; i <= N; i += 1) {
        ll x = (C[i] * ((look[0] * look[i]) % MOD)) % MOD;
        if((i % 2) == 0) {
            two = (two + x) % MOD;
        }
        else {
            two = (two - x + MOD) % MOD;
        }
    }
    ll ans = (one + two + MOD) % MOD;
    cout << ans;
}

int main() {
    int t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

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


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

class ARingring {
public:
	void solve(std::istream& cin, std::ostream& cout) {
	    vector<int> vec(3, 0);
        for (int i = 0; i < 3; ++i) {
            cin >>vec[i];
        }
        sort(vec.begin(), vec.end());
        cout << vec[0]+vec[1] << endl;
	}
};


int main() {
	ARingring solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);


int main() {
  int n;
  cin >> n;
  
  vector<int> p={};

  repo(i,10) {
    for(int j=i; j<10; j++) {
    p.pb(i*j);
    }
  }
  
  for(int x : p) {
    if (x==n)  {
    cout << "Yes" << endl;
    return 0;
    }
  }
  
  cout << "No" << endl;
  
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

ll dp[100001];
ll inv[201];

//ａをbで割る
long long mod_div(long long a,long long b){
	long long tmp = MOD - 2,c = b,ret = 1;
	while(tmp > 0){
		if(tmp & 1){
			ret *= c;ret %= MOD;
		}
		c *= c;c %= MOD;tmp >>= 1;
	}
	return a*ret%MOD;
}

void mod_add(ll &a, ll b){
	a +=b; a%= MOD;
}

int main(){
	REP(i, 201)inv[i] = mod_div(1, i);

	ll n, x;scanf("%d %d",&n, &x);
	vector<ll> v(n);
	REP(i, n)scanf("%d", &v[i]);
	sort(ALL(v));

	dp[x] = 1;
	REV(i, 100001){
		if(dp[i] == 0)continue;
		int cou = 0;
		while(cou < n && v[cou] <= i)cou++;
		if(cou == 0)continue;
		ll rate = inv[cou];
		REP(j, cou)mod_add(dp[i % v[j]], dp[i] * rate);
		dp[i] = 0;
	}

	ll ans = 0;
	REP(i, 100001)mod_add(ans, dp[i] * i % MOD);
	REP(i, n)ans = (ans * (i + 1)) % MOD;
	printf("%d\n", ans);

	return 0;
}


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

int main(){
	string s;
	cin >> s;
	if(s == "SAT") cout << 1 << endl;
	if(s == "SUN") cout << 7 << endl;
	if(s == "MON") cout << 6 << endl;
	if(s == "TUE") cout << 5 << endl;
	if(s == "WED") cout << 4 << endl;
	if(s == "THU") cout << 3 << endl;
	if(s == "FRI") cout << 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int x,a,b;
cin >> x >> a >> b;
if (abs(x-a) < abs(x-b)) cout << 'A' << endl;
else cout << 'B' << endl;

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <list>
#include <deque>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#define ll long long
#define INF 0x3f3f3f3f
#define SIS std::ios::sync_with_stdio(false)
using namespace std;
ll fast_pow(ll a,ll b,ll mod)
{
    ll c=1;
    while(b>=2)
    {
        if(b%2==0)
            a*=a,b/=2;
        else
            c*=a,a*=a,b--,b/=2;
        a%=mod,c%=mod;
    }
    return (a*c)%mod;
}

int main()
{
    SIS;
    ll n,m;
    while(cin>>n>>m)
    {
        vector <ll> s;
        ll num,sum=0,x;
        for(int i=0;i<n;i++)
        {
            cin>>num;
            sum+=num;
            s.push_back(num);
        }
        if(sum%(4*m)==0)
            x=sum/(4*m);
        else
        {
            x=sum/(4*m);
            x++;
        }
        ll cnt=0;
        for(int i=0;i<n;i++)
        {
            if(s[i]>=x)
                cnt++;
        }
        if(cnt>=m)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
n=gets.to_i
w=gets.split.map &:to_i
min=1000000
suma,sumb=0,0
(1..n).each do |i|
  (0..i-1).each do |j|
    suma+=w[j]
  end
  (i..n-1).each do |k|
    sumb+=w[k]
  end
  min=[(suma-sumb).abs,min].min
  suma,sumb=0,0
end
puts min


Measured memory_bytes: 1788
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
 
const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

int main(){
    ll n;
    cin >> n;
    
    ll a[n];
    rep(i, n)cin >> a[i];

    vector<ll> dp(n);
    rep(i, n)dp[i] = INF;

    rep(i, n){
        ll pos = lower_bound(ALL(dp), a[i]) - dp.begin();

        dp[pos] = a[i];
    }

    ll ans = lower_bound(ALL(dp), INF) - dp.begin();

    cout << ans << endl;
}


Measured memory_bytes: 4416
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
struct P : IEquatable<P>
{
	public readonly int Player, Left, Card;
	public P(int p, int q, int r) { Player = p; Left = q; Card = r; }
	public bool Equals(P p) => Player == p.Player && Left == p.Left && Card == p.Card;
}
class K
{
	int[] G() => ReadLine().Split().Select(int.Parse).ToArray();
	public K()
	{
		a = G();
		N = a[0];
		Y = a[2];
		a = G();
		WriteLine(Calc(0, 0, Y));
	}
	int N, Y;
	readonly int[] a;
	readonly Dictionary<P, int> memo = new Dictionary<P, int>();
	readonly Func<int, int, int>[] c = { Max, Min };
	int Calc(int p, int q, int r)
	{
		var k = new P(p, q, r);
		if (!memo.ContainsKey(k))
		{
			memo[k] = Abs(a[N - 1] - r);
			for (var i = q; i < N - 1; i++) memo[k] = c[k.Player](memo[k], Calc(1 - p, i + 1, a[i]));
		}
		return memo[k];
	}
}


Measured memory_bytes: 20388
#include <iostream>

using namespace std;

//global variances
int N, K;
int result = 0;
char* s;

//prototype
void input();
int count();
int main()
{
    input();
    
    cout << count();
    
    delete s;
    return 0;
}
//definition
void input()
{
    cin >> N >> K;
    s = new char[N];
    for(int i = 0; i < N; ++i)
    {
        cin >> s[i];
        if (i > 0 && s[i] == s[i-1]) ++result;
    }
}

int count()
{
    return min(N-1, result + 2 * K);
}

Measured memory_bytes: 384
n, k = gets.chomp.split.map(&:to_i)
ary1 = gets.chomp.split.map(&:to_i)
ary1.sort!
if k>=ary1.length 
  puts 0
else
  hps = ary1[0..n-1-k]
  sum1 = hps.inject(&:+)
  puts sum1
end


Measured memory_bytes: 19980
import sys
from math import sqrt
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    s = input().rstrip()
    t = input().rstrip()
    if s == t[:-1]:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 9416