akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
//gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1 << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique(x).begin(),(x).end()),(x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define F first
#define S second
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T> //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T> //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <class T>
bool chmax(T &a, const T &b) //最大値更新 返り値はbool
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) //最小値更新 返り値はbool
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    string s, t;
    cin >> s >> t;

    vector<int> x(26, 0), y(26, 0);

    rep(i, 0, s.size())++ x[s[i] - 'a'];
    rep(i, 0, t.size())++ y[t[i] - 'a'];
    sort(all(x));
    sort(all(y));

    rep(i, 0, 26)
    {
        if (x[i] != y[i])
        {
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 916
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  int H, W, h, w;
  cin >> H >> W;
  cin >> h >> w;
  cout << (H - h) * (W - w);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
long long n;
cin>>n;
long long a[n];
for(long long i=0;i<n;i++){
    cin>>a[i];
}
long long ans=0;
long long m[n]={a[0]};
for(long long i=1;i<n;i++){
    m[i]=min(a[i],m[i-1]);
}
for(long long i=0;i<n;i++){
    if(m[i]==a[i]){
        ans++;
    }
}
cout<<ans<<endl;
    return 0;

}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const ll M = 1e18;
int si[] = {-1, 0, 1, 0};
int sj[] = {0, -1, 0, 1};

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

  cout << n%k << endl;
  return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <algorithm>
#define ld long double
using namespace std;
int main () {
    int N;
    ld cnt=0;
    cin >> N;
    for (int i=0;i<N;i++){
        ld a;
        string b;
        cin >> a >> b;
        if (b=="BTC")
            a*=380000;
        cnt+=a;
    }
    cout << cnt;
    return 0;
}

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

int pow(int n){

        int ans = 1;
        for(int i=0;i<n;i++){
            ans *= 10;
        }
    return ans;

}

int main()
{
    string X;
    int size;
    cin >> X;

    size =X.size();

    rep(i,size) cout << 'x';

    cout << endl;

    return 0;

}

Measured memory_bytes: 256
def ask?(i)
  puts i
  $stdout.flush
  gets[0].to_sym
end

N = gets.to_i
A = Array.new(N + 1)

A[0] = A[N] = ask?(0)
exit if A[0] == :V

l = 0
r = N

20.times do 
  m = (l + r) / 2
  A[m] = ask?(m)
  exit if A[m] == :V
  
  if (l - m).even? ^ (A[l] != A[m])
    l = m 
  else
    r = m
  end
end


Measured memory_bytes: 15172
#include <stdio.h>

int main(void)
{
    while(1){
        int N, Q;
        scanf("%d %d", &N, &Q);
        if(N == 0 && Q == 0)
            break;

        int i;
        int days[101] = {0};
        for(i = 0; i < N; i++){
            int M;
            scanf("%d", &M);
            int j;
            for(j = 0; j < M; j++){
                int day;
                scanf("%d", &day);
                days[day]++;
            }
        }
        int max_d = 0;
        int max_p = 0;
        for(i = 1; i <= 100; i++){
            if(days[i] >= Q && max_p < days[i]){
                max_d = i;
                max_p = days[i];
            }
        }

        printf("%d\n", max_d);
    }

    return 0;
}

Measured memory_bytes: 596
package main

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

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, _ := GCDandLCM(i)
		fmt.Println(g)
	}

}


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

typedef long long ll;
#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define int ll

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define ALL(s) (s).begin(),(s).last()
#define ALLn(s,n) s,s+n
#define F first
#define S second
#define pb push_back
#define tc(t) int t; cin >> t; while(t--)
#define _ ios_base::sync_with_stdio(false); cin.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n"; }

const ll MOD = 1e9 + 7;
const ll MAXN = 1e6 + 7;
const ll INF = INT_MAX;


void solve() {
	int n;
	cin >> n;

	int ans = 0;

	FOR(i, 1, n) {
		ans += (n - 1) / i;
	}

	cout << ans;
}

int32_t main() {
	_

#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif

	// tc(t)
	solve();
	cerr << "[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
}

Measured memory_bytes: 3796
#include <iostream>
#include <bits/stdc++.h>
#include <iomanip>
#include<math.h>
#define ll long long
#define ld long  double
int max(long long int array[],long long int n );
using namespace std;
int  main(){
  ios_base::sync_with_stdio(0);
  	cin.tie(0);
  	cout.tie(0);
int n,m;
cin>>n>>m;
int array[m],sum=0,count,i;
for(i=0;i<m;i++){
  cin>>array[i];
  sum=sum+array[i];
}
count=n-sum;
if(count>=0)
  cout<<count<<endl;
else
  cout<<"-1"<<endl;









  }


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

int main(void)
{
    int n, i, T = 0, H = 0;
    char s1[100], s2[100];
    
    scanf("%d", &n);

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

        scanf("%s %s", s1, s2);

        if(strcmp(s1, s2) == 0)
        {
            T++;
            H++;
        }
        else if(strcmp(s1, s2) > 0)
        {
            T += 3;
        }
        else if(strcmp(s1, s2) < 0)
        {
            H += 3;
        }
    }

    printf("%d %d\n", T, H);
    
    return 0;
}


Measured memory_bytes: 2140
public class Main {

  private static void solve() {
    long n = nl();
    long a = nl();
    long b = nl();

    long ret = n / (a + b) * a;

    long x = n % (a + b);
    ret += Math.min(x, a);
    System.out.println(ret);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



Measured memory_bytes: 23120
#include<iostream>
using namespace std;
int main(){
	int a;
	int b;
	int c;
	int d;
	cin>>a>>b>>c>>d;
	if((a*b)>(c*d))
	cout<<a*b;
	else if((c*d)>(a*b))
	cout<<c*d;
	else if((c*d)==(a*b))
	cout<<c*d;
	
	
	
	return 0;
	
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

L = A[:]
sorted_l = []
un_sorted_l = L[:]
counter = 0
while un_sorted_l:
    n = len(un_sorted_l)
    for i in reversed(range(1, n)):
        if un_sorted_l[i-1] <= un_sorted_l[i]:
            continue
        else:
            counter += 1
            un_sorted_l[i-1], un_sorted_l[i] = un_sorted_l[i], un_sorted_l[i-1]
    sorted_l.append(un_sorted_l[0])
    un_sorted_l = un_sorted_l[1:]


print(' '.join(map(str, sorted_l)))
print(counter)    



Measured memory_bytes: 5600
import * as fs from "fs";

const input = fs.readFileSync("/dev/stdin", "utf8");
const N = +input;

const L: BigInt[] = Array(N + 1);

if (N === 1) {
  L[N] = BigInt(1);
} else {
  L[0] = BigInt(2);
  L[1] = BigInt(1);

  for (let i = 2; i <= N; i++) {
    L[i] = BigInt(L[i - 1]) + BigInt(L[i - 2]);
  }
}

console.log(String(L[N]));


Measured memory_bytes: 29592
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int n,i;
    cin>>n;
    int dp[101]={0};
    dp[4]=dp[7]=1;
    for (i=8;i<=100;i++)
    {
        if (dp[i-4] || dp[i-7])
            dp[i]=1;
    }
    if (dp[n])
        cout<<"Yes\n";
    else
        cout<<"No\n";
}

Measured memory_bytes: 256
#coding:utf-8
x, y = map(int, input().split())

mod = 10**9 + 7
f = [1]
for i in range(10**6):
    f.append(f[-1] * (i+1) % mod)
    
def nCr(n, r):
    return f[n] * pow(f[r], mod-2, mod) * pow(f[n-r], mod-2, mod) % mod

def main():
    if (x + y) % 3 != 0 or (x + y) // 3 < abs(x - y):
        print(0)
        return
    
    n = (x + y) // 3
    r = n // 2 - abs(x-y) // 2
    print(nCr(n, r))
    return
    
main()

Measured memory_bytes: 42668
T = [t for t in input()]
n = len(T)
# dp[i][0]:Dを入れたelse:Pを入れた
dp = [[0]*2 for _ in range(n+1)]
ans = ''
for i in reversed(range(n)):
    if i == n-1:
        if T[i] == 'D':
            dp[i]=[1,1]
            ans = T[i] + ans
        elif T[i] == '?':
            dp[i][0] = 1
            ans='D'+ans
        else:
            ans = 'P'+ans
    else:
        if T[i] == '?':
            dp[i][0] = max(dp[i+1])+1
            dp[i][1] = dp[i+1][0]+1
            if dp[i][0] < dp[i][1]:
                ans = 'P'+ans
            else:
                ans='D'+ans
        elif T[i] == 'D':
            dp[i] = [dp[i+1][0]+1,dp[i+1][1]+1]
            ans = T[i] + ans
        else:
            if T[i+1] == 'D':
                dp[i] = [dp[i+1][0]+1,dp[i+1][1]+1]
            ans = T[i] + ans

print(ans)


Measured memory_bytes: 40772
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const long long N = 3e6 + 17;
ll a[N], b[N], cnt, ans, lnt, n, m, r1, r0, l1, l0, sum, mx, h, c[N], t[N], mn = N, x, y, k;
pair<ll,ll>pr[N];
vector<ll>v,v2;
map<ll,ll>mp;
bool used[N];
char ch[N];
ll prime[N] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n >> k;
    while(n % k != 0)
    {
        n --;
        cnt ++;
    }
    for(ll i = 1; i <= k; i ++)
    {
        v.pb(0ll);
    }
    for(ll i = 0; i < v.size(); i ++)
    {
        v[i] += n / k;
    }
    for(ll i = 0; i < v.size(); i ++)
    {
        if(cnt > 0)
        {
            cnt --;
            v[i] += 1;
        }
    }
    sort(v.begin(), v.end());
    cout << abs(v[0] - v[v.size() - 1]);
}


Measured memory_bytes: 6400
def quicksort(a, lo, hi)
  return if lo >= hi
  j = partition a, lo, hi
  quicksort(a, lo, j-1)
  quicksort(a, j+1, hi)
end

def partition(a, lo, hi)
  p = a[lo]
  j = lo
  (lo+1).upto(hi) do |i|
    if a[i] < p
      j += 1
      a[i],a[j] = a[j],a[i]
    end
  end
  a[lo],a[j] = a[j],a[lo]
  j
end

n = gets.to_i
a = gets.chomp.split(' ').map(&:to_i)
quicksort(a, 0, n-1)

a = a.reverse

alice,bob = 0,0
0.upto(n-1) do |i|
  if i % 2 == 1
    bob += a[i]
  else
    alice += a[i]
  end
end

p alice - bob

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

using namespace std;

int main() {
  long long n, a;
  cin >> n >> a;
  long long ans = n;
  for (int k = 2; k <= 200; k++) {
    long long a1 = 2;
    while (true) {
      long long prod = 1;
      for (int i = 0; i < k; i++) {
        prod *= a1;
        if (prod >= n) {
          break;
        }
      }
      if (prod >= n) {
        long long add = (a1 - 1) * k;
        prod = 1;
        for (int i = 0; i < k; i++) {
          prod *= a1 - 1;
        }
        while (prod < n) {
          prod /= a1 - 1;
          prod *= a1;
          add++;
        }
        ans = min(ans, add + a * (k - 1));
        break;
      }
      a1++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<set>
#include <functional>
#include <limits>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}

//https://atcoder.jp/contests/agc023/tasks/agc023_a


signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, K;
	int res = 0;
	vector<int> a, sum, sum2, v, con;
	
	cin>>N>>K;
	
	if(K == 1){
		cout<<0<<endl;
		return 0;
	}
	
	a.resize(N);
	sum.resize(N+1);
	sum2.resize(N+1);
	
	for(int i = 0; i < N; i++){
		cin>>a[i];
		a[i] = (a[i] - 1 + K)%K;
	}
	
	for(int i = 0; i < N; i++){
		sum[i+1] += (sum[i] + a[i])%K;
		v.push_back(sum[i+1]);
	}
	
	v.push_back(0);
	
	sort(v.begin(), v.end());
	
	v.erase(unique(v.begin(), v.end()), v.end());
	
	con.resize(v.size());
	
	for(int i = 0; i <= N; i++){
		sum2[i] = lower_bound(v.begin(), v.end(), sum[i]) - v.begin();
	}
	
	con[sum2[0]]++;
	
	for(int i = 0; i < N; i++){
		res += con[sum2[i+1]];
		con[sum2[i+1]]++;
		if(i - K + 2 >= 0) con[sum2[i - K + 2]]--;
		
	}
	cout<<res<<endl;
	
	
	return 0;
}

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

int main() {
  int a,b,c; cin>>a>>b>>c;
  if (a==b) cout<<c<<endl;
  if (a==c) cout<<b<<endl;
  if (c==b) cout<<a<<endl;
}


Measured memory_bytes: 256
A, B, M = [int(n) for n in input().split()]
a  = [int(n) for n in input().split()]
b = [int(n) for n in input().split()]
ma = sorted(a)[0]
mb = sorted(b)[0]
XY = {}
ans = ma + mb
for m in range(M):
    x, y, c = [int(n) for n in input().split()]
    dv = a[x-1] + b[y-1] - c
    mv = min((ma+mb), dv)
    if ans > mv:
        ans = mv
print(ans)
        

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

//#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int mini = 1e9;
    int maxi = 0;
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        mini = min(a[i], mini);
        maxi = max(a[i], maxi);
    }
    if (mini == maxi) {
        if (mini == n-1) {
            cout << "Yes\n";
            exit(0);
        }
        if (mini <= n/2) cout << "Yes\n";
        else cout << "No\n";
    } else if (maxi-1 == mini) {
        int cnt = 0;
        for (int i = 0; i < n; i++) if (a[i] == mini) cnt++;
        int rem = n-cnt;
        if (rem == 1) {
            cout << "No\n";
            exit(0);
        }
        if (maxi <= cnt+rem/2 && mini >= cnt) cout << "Yes\n";
        else cout << "No\n";
    } else {
        cout << "No\n";
    }
}
/*

 */

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

inline void show(int n,vector<int>& vi)
{
  for(int i = 0; i < n; ++i){
    cout << "node " << i + 1 << ": key = " << vi[i] << ", " << flush;
    if((i + 1)/2 >= 1) cout << "parent key = " << vi[(i + 1)/2 - 1] << ", " << flush;
    if(2 * (i + 1) <= n) cout << "left key = " << vi[2 * (i + 1) - 1] << ", " << flush;
    if(2 * (i + 1) + 1 <= n) cout << "right key = " << vi[2 * (i + 1)] << ", " << flush;
    cout << endl;
  }
}

int main()
{
  int n;
  cin >> n;
  vector<int> vi(n);
  for(int i = 0; i < n; ++i){
    cin >> vi[i];
  }
  show(n,vi);
}

Measured memory_bytes: 1200
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main(void)
{
    int A, B, C;
    int n;

    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%d", &C);

    n = floor( double(B)/A);

    if(n>=C)
    {
        printf("%d", C);
    }
    else
    {
        printf("%d", n);
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
const int INF=(1<<22);
int dp[1000000];
int d[20];
int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	int n, m; std::cin >> n >> m;
	std::fill(dp, dp + n + 1 , INF);
	for (int i = 0; i < m; ++i) {
		std::cin >> d[i];
	}
	dp[0] = 0;
	for (int i = 0; i < m; ++i) {
		for (int j = d[i]; j <= n; ++j) {
			dp[j] = std::min(dp[j], dp[j - d[i]] + 1);
		}
	}
	std::cout << dp[n] << std::endl;
}

Measured memory_bytes: 1388
#include<bits/stdc++.h>
#define int long long int
#define inf 1000000000000
#define hell (int)(1e9+7)

using namespace std;

void solve(){
    int n,m;
    cin>>n>>m;
    if(n==m)
        cout<<"Yes";
    else
        cout<<"No";
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

#define mod 1000000007

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;

int main()
{
	int n;
	string s;
	cin >> n >> s;
	int e = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'E') {
			e++;
		}
	}

	if (s[0] == 'E') {
		e--;
	}
	int mi = e;

	for (int i = 1; i < n; i++) {
		if (s[i - 1] == 'E' && s[i] == 'E') {
			e--;
		}
		if (s[i - 1] == 'W' && s[i] == 'W'){
			e++;
		}
		mi = min(mi, e);
	}
	cout << mi << endl;
	return 0;
}

Measured memory_bytes: 900
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll a[5];
    for (ll &e : a)
        cin >> e;
    for (ll i = 0; i < 5; i++)
        if (!a[i])
            return cout << i + 1 << ' ', 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define F first
#define S second
#define $ ios::sync_with_stdio(0);
#define endl '\n'
using namespace std;
using ll = long long int;
using ii = pair<ll, ll>;
using vi = vector<ll>;
using vii = vector<ii>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 2123;
ll a[MAXN], b[MAXN], c[MAXN];
int main() {
    int x,y,z,n,k;
    scanf("%d %d %d %d", &x, &y, &z, &k);
    for (int i = 0; i<x; ++i) {
        scanf("%lld", a+i);
        a[i] = -a[i];
    }
    for (int i = 0; i<y; ++i) {
        scanf("%lld", b+i);
        b[i] = -b[i];
    }
    for (int i = 0; i<z; ++i) {
        scanf("%lld", c+i);
        c[i] = -c[i];
    }
    sort(a, a+x);
    sort(b, b+y);
    sort(c, c+z);
    set<pair<ii, ii> > s;
    s.insert({{(a[0]+b[0]+c[0]), 0 },{0, 0}});
    vi output;
    ll m;
    int xx = x, yy = y, zz = z;
    while (k>0) {
        auto it = s.begin();
        m = it->F.F;
        x = it->F.S;
        y = it->S.F;
        z = it->S.S;
        output.push_back(-m);
        if (x+1 < xx) s.insert({{m-a[x]+a[x+1], x+1},{y, z}});
        if (y+1 < yy) s.insert({{m-b[y]+b[y+1], x},{y+1, z}});
        if (z+1 < zz) s.insert({{m-c[z]+c[z+1], x},{y, z+1}});
        k--;
        s.erase(it);
    }
    for (auto i : output) {
        printf("%lld\n", i);
    }
}


Measured memory_bytes: 640
/*

宣告——
汝身在我之下，托付吾之命运于汝之剑，
遵从圣杯之名，若汝遵从此意志此理，回应吧。
在此起誓，吾是成就世间一切行善之人，吾是肃清世间一切罪恶之人，
被狂乱之槛所囚的囚徒。吾是此锁链的操纵者，
汝为身缠三大言灵之七天，从抑止之轮显现吧，天秤之守护者！

*/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cassert>
#define ll long long
using namespace std;
inline int read(){
	int re=0,flag=1;char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') flag=-1;
		ch=getchar();
	}
	while(isdigit(ch)) re=(re<<1)+(re<<3)+ch-'0',ch=getchar();
	return re*flag;
}
int n,a[200010],b[200010];
int main(){
	n=read();int i;
	for(i=1;i<=n;i++) a[i]=read();
	sort(a+1,a+n+1);
	if(n&1){
		ll ans=0;int mid=n/2+1,f=0,l=2,r=n;
		b[mid]=a[1];
		for(i=1;i<=n/2;i++){
			if(f) b[mid+i]=a[l++],b[mid-i]=a[l++];
			else b[mid+i]=a[r--],b[mid-i]=a[r--];
			f^=1;
		}
		for(i=1;i<n;i++) ans+=abs(b[i+1]-b[i]);
		ll tmp=0;l=1;r=n-1;f=1;
		b[mid]=a[n];
		for(i=1;i<=n/2;i++){
			if(f) b[mid+i]=a[l++],b[mid-i]=a[l++];
			else b[mid+i]=a[r--],b[mid-i]=a[r--];
			f^=1;
		}
		for(i=1;i<n;i++) tmp+=abs(b[i+1]-b[i]);
		cout<<max(ans,tmp);
	}
	else{
		ll ans=0;int mid,f,l,r;
		mid=n/2,f=1,l=2,r=n-1;
		b[mid]=a[1];b[mid+1]=a[n];
		for(i=1;i<n/2;i++){
			if(f) b[mid+i+1]=a[l++],b[mid-i]=a[r--];
			else b[mid+i+1]=a[r--],b[mid-i]=a[l++];
			f^=1;
		}
		for(i=1;i<n;i++) ans+=abs(b[i+1]-b[i]);
		cout<<ans<<'\n';
	}
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll  long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vi vector<int>
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define tr(c,i) for(auto i : c)
#define pii pair< int,int >
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
#define er(x) cout << x << " "
#define err(x,y) cout << x << " "<<y
const int M = 200005;
using namespace std;
clock_t time_p=clock();
void dem()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
using namespace std ;
const int N = 1000 ;
int vis[N][N];
int n , m , k ;
const int dx[] = { 1, -1 , 0 , 0  };
const int dy [] = { 0 ,0 , 1 , -1  };
int main (){
 ll  n ;
 cin>> n ;
cout << pow ( n , 3 ) ;

return 0 ;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	double a,s,d,f;
	cin>>a>>s>>d>>f;
	double asd=a*s/2;
	cout<<fixed<<setprecision(6)<<asd<<' ';
	if(d==a/2&&f==s/2)cout<<1;
	else cout<<0;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

const int INF = 0x3f3f3f3f;

const int N = 200000;
int n;
std::vector<int> g[N];
int a[N], ans[N];

int l[N];
void dfs(int v, int pr = -1) 
{
	static int Ans = 0;
	int *p = std::lower_bound(l, l + n, a[v]);
	int prev = *p;
	if (prev == INF) ++Ans;
	*p = a[v];
	ans[v] = Ans;
	for (int i = 0; i < (int)g[v].size(); ++i) if (g[v][i] != pr) dfs(g[v][i], v);
	if (prev == INF) --Ans;
	*p = prev;
}

int main() 
{
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) scanf("%d", a + i);
	for (int i = 0; i < n - 1; ++i) {
		int a, b;
		scanf("%d%d", &a, &b);
		g[a - 1].push_back(b - 1);
		g[b - 1].push_back(a - 1);
	}
	memset(l, 0x3f, 4 * n);
	dfs(0);
	for (int i = 0; i < n; ++i) printf("%d\n", ans[i]);
	return 0;
}


Measured memory_bytes: 27924
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    rep (i, n) {
        rep (j, i + 1, n) {
            cout << ffs(i ^ j) << " \n"[j + 1 == j_len];
        }
    }
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <ctime>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <assert.h>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define SZ(x) x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define pi acos(-1)
#define mod 998244353//1000000007
#define inf 1000000007
#define ll long long
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
#define N 100010
#define _DEBUG
template <class U,class T> void Max(U &x, T y){if(x<y)x=y;}
template <class U,class T> void Min(U &x, T y){if(x>y)x=y;}
template <class T> void add(int &a,T b){a=(a+b)%mod;}
//inline int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}

int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%mod;
        a=1LL*a*a%mod;b>>=1;
    }
    return ans;
}

int pow(int a,int b,int c){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%c;
        a=1LL*a*a%c;b>>=1;
    }
    return ans;
}


char s[N],t[N];
int main(){
    //srand(time(NULL)+clock());
    int ca=0,T,k,i,j,m=0,n,K;
    scanf("%d%d%s%s",&n,&m,s,t);
    int d=gcd(n,m);
    int a=n/d,b=m/d;
    rep(i,0,d){
        if(s[a*i]!=t[b*i]){
            puts("-1");return 0;
        }
    }
    printf("%lld\n",1LL*a*m);
}


Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,a,i,MAX,cnt;
	scanf("%d",&n);
	MAX=1;
	cnt=1;
	for(i=1;i<=n;i++){
		scanf("%d",&a);
		if(a==1){
			cnt++;
		}
		else{
			cnt=1;
		}
		MAX=max(cnt,MAX);
	}
	printf("%d\n",MAX);
}


Measured memory_bytes: 2728
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

const ll INF = 1e18L + 5;
ll values[100001];

ll min(ll a, ll b)
{
    if (a<b) return a;
    return b;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    for (int i=0;i<100001;++i)
    {
        values[i]=INF;
    }
    int n,w,a,b;
    cin>>n>>w;
    values[0]=0;
    while (n--)
    {
        cin>>a>>b;
        for (int i=100000;i-b>=0;--i)
        {
            values[i]=min(values[i],values[i-b]+a);
        }
    }
    for (int i=100000;i+1;--i)
    {
        if (values[i]<=w)
        {
            cout<<i;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 1024
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    int N;
    cin >> N;

    vector<int> A(N);
    for (int i = 0; i < N; i++)cin >> A[i];

    int ans = 0;
    int pos = 0;
    while (true) {
        if (pos == N) break;
        int pos1 = pos;
        int pos2 = pos;
        while (pos1 < N - 1 && A[pos1] <= A[pos1 + 1]) pos1++;
        while (pos2 < N - 1 && A[pos2] >= A[pos2 + 1])pos2++;
        int large = max(pos1, pos2);
        pos = large + 1;
        ans++;
    }

    cout << ans << endl;

}

















































Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   int n;
   cin >> n;
   vector<int> a(n), b(n), c(n);
   rep(i, 0, n) cin >> a[i];
   rep(i, 0, n) cin >> b[i];
   rep(i, 0, n) cin >> c[i];
   sort(a.begin(), a.end());
   sort(c.begin(), c.end());
   ll ans = 0;
   rep(i, 0, n) {
      ll l = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
      ll r = c.end() - upper_bound(c.begin(), c.end(), b[i]);
      ans += l * r;
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}
ll ketawa(ll a){ll r=0;while(a){r+=a%10;a/=10;}return r;}

 
int main(){

  int H,W,K;
  cin >> H >> W >> K;
  vector<string> s(H);
  for(auto &&x:s)cin >> x;

  int ans = (H-1)*(W-1);
  FOR(h,0,1<<(H-1)){
    int cut_count = 0;

    int j = 0;
    vector<int> hight(H,0);
    FOR(i,1,H){
      if( h & (1<<(i-1)) ){
        j++;
        cut_count++;
      }
      hight[i] = j;
    }
    bool cant = false;

    vector<int> white(H,0);
    FOR(w,0,W){
      vector<int> white_count(H,0);
      FOR(y,0,H){
        if(s[y][w]=='1'){
          white_count[hight[y]]++;
          if(white_count[hight[y]] > K)cant = true;
        }
      }
      bool cut = false;
      FOR(y,0,j+1){
        if(white[y]+white_count[y] > K){
          cut = true;
        }
      }
      if(cant)continue;
      if(cut){
        cut_count++;
        FOR(y,0,j+1){
          white[y] = white_count[y];
        }
      }else{
        FOR(y,0,j+1){
          white[y] += white_count[y];
        }
      }
    }
    if(not cant)ans = min(ans,cut_count); ////////////////
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		for (int i=0; i < 3100; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			if (a == 0 && b==0) {
				break;
			}
			if (a > b) {
				System.out.println(b+" "+a);
			}else {
				System.out.println(a+" "+b);
			}

		}


	}
}


Measured memory_bytes: 36640
#include <bits/stdc++.h>
#define mod 100011100011100000000111LL
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
void SieveOfEratosthenes(ll n);
ll fastpowMOD(ll a, ll p,ll MOD);
ll lcm(ll a, ll b);
const int LIM = 1e5+5, MOD =  1e9+7;
ll fastpowMOD(ll a, ll p,ll MOD){ if(p==0) return 1; a %= MOD; ll z = fastpowMOD(a,p/2,MOD); z = (z*z)%MOD; if(p%2) z = (z*a)%MOD; return z; }
bool seive[LIM];
 
void SieveOfEratosthenes(ll n)
{ memset(seive, true, sizeof(seive));
seive[0] = false;
seive[1] = false;
 for (ll p=2; p*p<=n; p++) if (seive[p] == true) for (ll i=p*p; i<=n; i += p) seive[i] = false; }
 
 
 ll combo(ll n, ll k){
 	if(k==0) return 1;
 	ll N=1,D=1;
 	for(ll i = 1;i<=k;i++){
 		N = (((n-i+1)%MOD)*N)%MOD;
 		D = (D*i)%MOD;
	 }
	 
	 return (N*fastpowMOD(D,MOD-2,MOD))%MOD;
 }
 
 
ll lcm(ll a, ll b)  
 {  
    return (a*b)/__gcd(a, b);  
 } 
/*********************************************/

int main(){
	fastio;
	int n;
	cin>>n;
	map<ll , pair<ll,ll> > mp;
	for(int i=0;i<n;i++){
		ll a;
		cin>>a;
		for(ll j=0;j<61;j++){
			if(a%2) mp[j].second++;
			else mp[j].first++;
			a = a/2;
		} 
		
	}

	ll ans = 0;
	for(ll j=0;j<61;j++){
		ll pre = ((mp[j].first)*fastpowMOD(2,j,MOD))%MOD;
		pre = (pre*mp[j].second)%MOD;
		ans += pre ;
		ans %= MOD;
	}
	cout<<ans<<"\n";
	
	
}


















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

int main() {
  int N, M, x, y;
  cin >> N >> M;

  vector<int> a(N * N, 0);

  for (int i = 0; i < M; i++) {
    cin >> x >> y;
    a[(x - 1) * N + y - 1]++;
    a[(y - 1) * N + x - 1]++;
  }

  for (int i = 0; i < N; i++) {
    int count = 0;

    for (int j = 0; j < N; j++) {
      if (a[i * N + j] != 0) {
        count += a[i * N + j];
      }
    }

    cout << count << endl;
  }
}


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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()         

#define bug(...)                                  __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn 
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

inline void INP();
const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int arr[N+2];


vector<int> getdiv(int x)
{
      vector<int> div;
      for(int i = 1; i*i <= x; i++)
      {
            if( x%i == 0 )
            {
                  if(i != 1) div.push_back(i);
                  if(i != x/i)
                  {
                        div.push_back(x/i);
                  }
            }
      }
      return div;
}


void solve()
{
      cin >> n;


      int ans = 1;
      int x = min(n, (int)(1e6)+2);
      lop(i, 2, x)
      {
            int x = n;
            while( x%i == 0 ) x /= i;
            if( x%i ==  1 ) ans++;
      }

      vector<int> v1 = getdiv(n-1);
      
      for(auto i: v1)
      {
            if(i >= x) ans++;
      }
      cout << ans  << endl;
      
}

int32_t main()
{
      ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);
      // INP(); 
      int test = 1;
      // cin >> test;

      // cout << setprecision(9) << fixed;
      // clock_t z = clock();
      while(test--)solve();
      // cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);
}











inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}


// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //






Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
	long double A, B;
cin>>A;
cin>>B;
 
if(A==B) {
cout<<"EQUAL";
} else if(A>B) {
cout<<"GREATER" ;
} else if(A<B) {
cout<<"LESS" ;
}
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
typedef long long ll;

const ll INF = 10000000000000000;

template <typename T>
struct Edge
{
    int to;
    T cost;
};

template <typename T>
struct WeightedGraph
{
    int n;
    vector<vector<Edge<T>>> g;
    
    WeightedGraph(int n) : n(n){
        g.resize(n);
    }
    
    void init(int n_){
        n = n_;
        g.resize(n_);
    }
    
    void add_edge(int from, int to, T cost){
        g[from].push_back((Edge<T>){to, cost});
    }
};

template <typename T>
vector<T> Dijkstra(WeightedGraph<T> &g, int s){
    typedef pair<T, int> P;
    int n = g.n;
    vector<T> d(n);
    fill(d.begin(), d.end(), INF);
    priority_queue<P, vector<P>, greater<P>> que;
    d[s] = 0;
    que.push(P(0, s));
    while(que.size()){
        P nowp = que.top();
        que.pop();
        if(d[nowp.second] < nowp.first) continue;
        for(Edge<T> e : g.g[nowp.second]){
            if(d[e.to] > d[nowp.second] + e.cost){
                d[e.to] = d[nowp.second] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
    return d;
}

int main()
{
    int n, m;
    cin >> n >> m;
    WeightedGraph<ll> g(n);
    int b[100005]{0};
    for(int i = 0; i < m; i++){
        int l, r;
        ll c;
        cin >> l >> r >> c;
        l--; r--;
        g.add_edge(l, r, c);
        b[l]++;
        b[r]--;
    }
    int k = 0;
    for(int i = 0; i < n; i++){
        k += b[i];
        if(k) g.add_edge(i + 1, i, 0);
    }
    vector<ll> d = Dijkstra(g, 0);
    if(d[n - 1] == INF) cout << -1 << endl;
    else cout << d[n - 1] << endl;
}


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

typedef long long ll;
typedef vector<int, int> vi;
typedef pair<int, int> pi;
#define F first;
#define S second;
#define PB push_back;
#define MP make_pair;
#define REP(i, a, b) for(int i = a; i <= b; i++)
ll itr(int *arr, int curr, int size, int value) {
	if(size==curr){
		return value%360;
	}
	ll add = itr(arr, curr+1, size, value + arr[curr]);
	ll sub = itr(arr,curr+1, size, value-arr[curr]);
	if(add == 0){
		return add;
	}
	return sub;
}
int main(){
	string a;
	cin >> a;
	for(int i=0;i<a.size();i++) {
		cout << 'x';
	}
}


Measured memory_bytes: 256
void main() {
	auto ip = readAs!(int[]), N = ip[0], M = ip[1];
	auto A = readMatrix!char(N, N);
	auto B = readMatrix!char(M, M);
	foreach(i; 0..N-M+1) {
		foreach(j; 0..N-M+1) {
			bool tmp = true;
			foreach(x; 0..M) foreach(y; 0..M) {
				if(A[i+x][j+y] == B[x][y]) continue;
				else tmp = false;
			}
			if(tmp) {
				writeln("Yes");
				return;
			}
		}
	}
	writeln("No");
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 364
#include <cstdio>
#include <algorithm>
 
template<int N, typename T, T M>
struct factorial_mod
{
	T mod[N + 1];
	T inv_mod[N + 1];
 
	constexpr factorial_mod() : mod(), inv_mod()
	{
		mod[0] = 1;
		for (int i = 0; i < N; ++i)
		{
			mod[i + 1] = (mod[i] * (i + 1)) % M;
		}
		inv_mod[N] = power(mod[N], M - 2);
		for (int i = N - 1; i >= 0; --i)
		{
			inv_mod[i] = (inv_mod[i + 1] * (i + 1)) % M;
		}
	}
 
	constexpr T power(T a, T b) const
	{
		T r = 1;
		while (b > 0)
		{
			if ((b & 1) != 0) r = (r * a) % M;
			a = (a * a) % M;
			b >>= 1;
		}
		return r;
	}
 
	constexpr T comb(T n, T r) const
	{
		if (r < 0 || r > n || n < 0) return 0;
		return (((mod[n] * inv_mod[r]) % M) * inv_mod[n - r]) % M;
	}
 
	constexpr T H(T n, T r) const
	{
		return comb(n + r - 1, r);
	}
};
 
constexpr long long MOD = 1000000007;
constexpr factorial_mod<500000, long long, MOD> fmod;
 
int main()
{
	long long n, k;
	scanf("%lld%lld", &n, &k);
	long long zeromax = std::min(n, k);
	long long ans = 0;
	for (long long i = 1; i <= zeromax; ++i)
	{
		long long room = n - i;
		long long nn = n - room;
		ans = (ans + fmod.comb(n, room) * fmod.H(room, nn)) % MOD;
	}
	if (k >= 2)
	{
		ans = (ans + 1) % MOD;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

typedef long long ll;

ll n;
ll AC, WA, TLE, RE;

int main() {
	cin >> n;
	while (n--) {
		string s;
		cin >> s;
		if (s == "AC") AC++;
		else if (s == "WA") WA++;
		else if (s == "TLE") TLE++;
		else if (s == "RE") RE++;
	}

	cout << "AC x " << AC << endl;
	cout << "WA x " << WA << endl;
	cout << "TLE x " << TLE << endl;
	cout << "RE x " << RE << endl;

	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  int a[N], flag[9];
 
  int count = 0, max = 0, min = 0;
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  for(int i=0;i<9;i++){
    flag[i] = 0;
  }
  for(int i=0;i<N;i++){
    if(1 <= a[i] && a[i] <= 399){
      flag[0] = 1;
    }else if(400 <= a[i] && a[i] <= 799){
      flag[1] = 1;
    }else if(800 <= a[i] && a[i] <= 1199){
      flag[2] = 1;
    }else if(1200 <= a[i] && a[i] <= 1599){
      flag[3] = 1;
    }else if(1600 <= a[i] && a[i] <= 1999){
      flag[4] = 1;
    }else if(2000 <= a[i] && a[i] <= 2399){
      flag[5] = 1;
    }else if(2400 <= a[i] && a[i] <= 2799){
      flag[6] = 1;
    }else if(2800 <= a[i] && a[i] <= 3199){
      flag[7] = 1;
    }else if(a[i] >= 3200){
      flag[8] = 1;
      count += 1;
    }
  }
  for(int i=0;i<8;i++){
    if(flag[i]==1){
      min += 1;
    }
  }
  if(flag[8]==1){
    max = min + count;
  }else{
    max = min;
  }
  if(min==0){
    min = 1;
  }
  cout << min << " " << max << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,n,art[1000][2];
  while(cin>>n,n!=0){
    art[0][0]=10;art[0][1]=10;
    for(int i=1;i<n;i++){
      cin>>a>>b;
      if(b==0){art[i][0]=art[a][0];art[i][1]=art[a][1]-1;}
      else if(b==1){art[i][0]=art[a][0]-1;art[i][1]=art[a][1];}
      else if(b==2){art[i][0]=art[a][0];art[i][1]=art[a][1]+1;}
      else if(b==3){art[i][0]=art[a][0]+1;art[i][1]=art[a][1];}
    }
    int ymin=22,ymax=0,xmin=22,xmax=0;
    for(int i=0;i<n;i++){
      if(art[i][0]>ymax)ymax=art[i][0];
      if(art[i][0]<ymin)ymin=art[i][0];
      if(art[i][1]>xmax)xmax=art[i][1];
      if(art[i][1]<xmin)xmin=art[i][1]; 
    }
    cout<<xmax-xmin+1<<" "<<ymax-ymin+1<<endl;
  }
  return 0;
}

Measured memory_bytes: 1164