akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

int main() {
    int n;
    cin >> n;
    bool ok = true;
    vector<int> t(n+1), x(n+1), y(n+1);
    for(int i = 1; i <= n; ++i) cin >> t[i] >> x[i] >> y[i];
    int time = 0;
    for(int i = 0; i < n; ++i) {
        time += abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        if(time > t[i+1]) {
            ok = false;
            break;
        }
        if(time < t[i+1]) {
            int temp = t[i+1]-time;
            if(temp%2){
                ok = false;
                break;
            }
        }
    }
    if(!ok) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 4180
using System;
 
class Program
{
  static void Main(string[] args)
  {
    string s = Console.ReadLine();
    char x = s[0];
    char y = s[2];
    
    if(x < y) Console.WriteLine("<");
    else if(x == y) Console.WriteLine("=");
    else Console.WriteLine(">");
  }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
	
#define ll long long int
#define pb push_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define per(i , j , n) for(ll i = j ; i >= n ; i--)
 
 
 
int main(){
	ll n,m;
    cin >> n >> m;
    ll a[m],sum = 0;

    rep(i,0,m){
        cin >> a[i];
        sum += a[i];
    }
    if(n >= sum) cout << n - sum;
    else cout << -1;
    
    
}

Measured memory_bytes: 3704
N = int(input())
s = list(str(input()))

x = [0]*N
v = ["S","W"]

for x[0],x[1] in [["S","S"],["S","W"],["W","S"],["W","W"]]:
    for i in range(2,N):
        if (x[i-1] =="S" and s[i-1] == "o") or (x[i-1] =="W" and s[i-1] == "x"):
            x[i] = x[i-2]
        else:
            if x[i-2] == "S":
                x[i] = "W"
            else:
                x[i] = "S"
    #print(x)
    det = 0
    if (x[N-1] == "S" and s[N-1] == "o" and x[N-2] != x[0]):
        det = -1
    elif (x[N-1] == "S" and s[N-1] == "x" and x[N-2] == x[0]):
        det = -1
    elif (x[N-1] == "W" and s[N-1] == "o" and x[N-2] == x[0]):
        det = -1
    elif (x[N-1] == "W" and s[N-1] == "x" and x[N-2] != x[0]):
        det = -1
    elif (x[0] == "S" and s[0] == "o" and x[N-1] != x[1]):
        det = -1
    elif (x[0] == "S" and s[0] == "x" and x[N-1] == x[1]):
        det = -1
    elif (x[0] == "W" and s[0] == "o" and x[N-1] == x[1]):
        det = -1
    elif (x[0] == "W" and s[0] == "x" and x[N-1] != x[1]):
        det = -1
    
    if det == 0:
        print("".join(x))
        break

if det == -1:
    print(-1)


Measured memory_bytes: 5032
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    double a, b, c, d, e, f;
    double x, y;
    double det;

    while (cin >> a >> b >> c >> d >> e >> f) {
        det = a * e - b * d;
        det = 1.0 / det;
        x = det * (e * c - b * f);
        y = det * (a * f - c * d);

        if (x == 0)
            x = 0;
        if (y == 0)
            y = 0;
        cout << setprecision(3);
        cout << fixed;
        cout << x << ' ' << y << endl;
    }

    return 0;
}

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

int main(){
  vector<vector<int>> A(3, vector<int>(3));
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      cin >> A[i][j];
    }
  }
  int N;
  cin >> N;
  vector<int> b(N);
  for(int i=0; i<N; i++){
    cin >> b[i];
  }
  
  vector<vector<bool>> X(3, vector<bool>(3,false));
  for(int i=0; i<N; i++){
    
    for(int j=0; j<3; j++){
      for(int k=0; k<3; k++){
        if (b[i]==A[j][k]) X[j][k]=true;
      }
    }
    
  }
  
  for(int i=0; i<3; i++){
    int h=0;
    int w=0;
    for(int j=0; j<3; j++){
      if (X[i][j]) w++;
      if (X[j][i]) h++;
    }
    if (w==3 || h==3){
      cout << "Yes" <<endl;
      return 0;
    }
  }
  int x=0;
  int y=0;
  for(int i=0; i<3; i++){
    if (X[i][i]) x++;
    if (X[2-i][i]) y++;
  }
  if (x==3 || y==3){
    cout << "Yes" <<endl;
    return 0;
  }

  cout << "No" <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  vector<int> A, B;
  int sumA=0, sumB=0;
  for(int i=0; i<10; i++){
    cin >> n;
    A.push_back(n);
  }
  sort(A.begin(), A.end(), greater<int>());
  sumA += A[0]+A[1]+A[2];
  for(int i=0; i<10; i++){
    cin >> n;
    B.push_back(n);
  }
  sort(B.begin(), B.end(), greater<int>());
  sumB += B[0]+B[1]+B[2];
  
  cout << sumA << " " << sumB << endl;
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
// 最小非負剰余
// void divmod (vector<int>& vi, int a, int b) {
void divmod (int* vi, int a, int b) {
    int q;
    int r;
    if (b < 0) {
        b = -b;
        a = -a;
    }
    q = 0;
    r = a;
    if (r > 0) {
        while (r - b >= 0) {
            q += 1;
            r -= b;
        }
    } else if (r < 0) {
        do {
            q -= 1;
            r += b;
        } while (r < 0);
    }
    vi[0] = q;
    vi[1] = r;
}
int main() {
    // vector<int> vi (2);
    int vi[2];
    int N;
    cin >> N;
    string S    = "";
    int    base = 2;
    while (N) {
        // base = 3 でうまくいかない
        // 例えば 7
        // base = 2 は OK
        // S = to_string (abs (N % base)) + S;
        // N -= abs (N % base);
        // N = N / -base;

        // base = 3 でもうまくいく
        divmod (vi, N, base);
        S = to_string (vi[1]) + S;
        N -= vi[1];
        divmod (vi, N, -base);
        N = vi[0];
    }
    if (S != "") cout << S << endl;
    else
        cout << "0" << endl;
    return 0;
}

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

#define all(x)        (x).begin(),(x).end()
#define eb            emplace_back
#define mp            make_pair
#define pb            push_back
#define fi            first
#define se            second
#define sz(x)         ((int)(x).size())
#define rep(x,y,z)    for(int x=y;x<z;x++)
#define per(x,z,y)    for(int x=z-1;x>=y;x--)
#define trav(y,x)     for(auto& y:x)
#define pii           pair<int, int>
#define pll           pair<ll, ll>
#define vi            vector<int>
#define vpi           vector<pii>

int dbg = 0;
#define cri           if(0)
#define shame         cri cerr<<(++dbg)<<"\n\n";

// aaaaaaaaaaaaaaaa
void solve() {
  int M, K, N;
  scanf("%d%d", &M, &K);
  N = (1 << M);
  if (N <= K || (M == 1 && K == 1)) {
    puts("-1");
    return;
  }
  if (!K) {
    rep(i, 0, N)
      printf("%d %d ", i, i);
    puts("");
    return;
  }

  vpi xork;
  vector<bool> mk(N, 0);
  mk[K] = 1;
  rep(i, 1, N) if (!mk[i]) {
    int j = i ^ K;
    xork.eb(i, j);
    mk[i] = 1;
    mk[j] = 1;
  }

  vi ans;
  ans.pb(0);
  int SZ = sz(xork);
  rep(i, 0, SZ) {
    ans.pb(xork[i].fi);
    ans.pb(xork[i].se);
  }
  ans.pb(0);
  ans.pb(K);
  per(i, SZ, 0) {
    ans.pb(xork[i].se);
    ans.pb(xork[i].fi);
  }
  ans.pb(K);

  trav(a, ans)
    printf("%d ", a);
  puts("");
}

int main() {
  // int _; scanf("%d", &_); while (_--)
  solve();
	return 0;
}



Measured memory_bytes: 3448
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define x first
#define y second
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define endl '\n'


int main()
{
	int arr[1000]={0};
	int n,k;
	cin>>n>>k;
	for(int i=0;i<k;i++){
		int d;
		cin>>d;
		while(d--){
			int a;
			cin>>a;
			arr[a]++;
		}
	}
	int c=0;
	for(int i=1;i<=n;i++)if(!arr[i])c++;
		cout<<c<<endl;
	return 0;
}

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

inline void f(int *a, int *b){
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if(a > b) f(&a, &b);
	if(b > c) f(&b, &c);
	if(a > b) f(&a, &b);
	cout << a << " " << b << " " << c << endl;
	return 0;
}

Measured memory_bytes: 3092
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <tuple>

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

int main() {
  int N, K;
  cin >> N >> K;
  double ans = 0.0;
  rep(i, N){
    // サイコロの目がi+1の時
    ll l = i+1;
    int j = 0; // 表の回数
    while(l < K){
      j++;
      l *= 2;
    }
    // cout << 1.0/N * pow(1.0/2.0, j) << endl;
    ans += 1.0/N * pow(1./2., j);
  }
  
  cout << setprecision(10) << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

constexpr int inf = 1e9;
template<class T> struct edge { int to; T cap; int rev; edge(int t, T c, int r) : to(t), cap(c), rev(r) {} };

void add_edge(int from, int to, auto cap, auto& g) {
  g[from].emplace_back(to, cap, g[to].size());
  g[to].emplace_back(from, 0, g[from].size() - 1);
}

template<class T> T dinic(int s, int t, VV< edge<T> > g) {
  int n = g.size();
  V<> dist, i;

  auto bfs = [&]() {
    dist.assign(n, -1);
    queue<int> q;
    dist[s] = 0; q.push(s);
    while (!q.empty()) {
      int v = q.front(); q.pop();
      for (auto&& e : g[v]) if (dist[e.to] == -1 and e.cap > 0) {
        dist[e.to] = dist[v] + 1; q.push(e.to);
      }
    }
  };

  function<T(int, T)> dfs = [&](int v, T f) {
    if (v == s) return f;
    for (; i[v] < g[v].size(); i[v]++) {
      edge<T>& e = g[v][i[v]];
      if (dist[e.to] < dist[v] and g[e.to][e.rev].cap > 0) {
        T d = dfs(e.to, min(f, g[e.to][e.rev].cap));
        if (d > 0) {
          g[e.to][e.rev].cap -= d;
          e.cap += d;
          return d;
        }
      }
    }
    return (T) 0;
  };

  T res = 0;
  while (true) {
    bfs();
    if (dist[t] == -1) return res;
    i.assign(n, 0);
    while (true) {
      T f = dfs(t, inf);
      if (f == 0) break;
      res += f; 
    }
  }
}

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int h, w; cin >> h >> w;
  V<string> a(h); for (int i = 0; i < h; i++) cin >> a[i];
  int s, t;
  for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) {
    if (a[i][j] == 'S') s = 2 * (i * w + j) + 1;
    if (a[i][j] == 'T') t = 2 * (i * w + j);
  }
  VV< edge<int> > g(2 * h * w);
  for (int i = 0; i < h; i++) {
    for (int jl = 0; jl < w; jl++) for (int jr = 0; jr < w; jr++) {
      if (jl != jr and a[i][jl] != '.' and a[i][jr] != '.') add_edge(2 * (i * w + jl) + 1, 2 * (i * w + jr), inf, g);
    }
  }
  for (int j = 0; j < w; j++) {
    for (int il = 0; il < h; il++) for (int ir = 0; ir < h; ir++) {
      if (il != ir and a[il][j] != '.' and a[ir][j] != '.') add_edge(2 * (il * w + j) + 1, 2 * (ir * w + j), inf, g);
    }
  }
  for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) add_edge(2 * (i * w + j), 2 * (i * w + j) + 1, 1, g);
  int res = dinic<int>(s, t, g);
  cout << (res >= inf ? -1 : res) << '\n';
}


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

if N == 0:
    print(0)
else:
    m = 2
    s = ""
    sgn = 1
    while N!=0:
        r = N % m
        s += "1" if r != 0 else "0"
        m *= -2
        N = N -r 
    print(s[::-1])



Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ft first
#define sd second
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

struct modint{
    ll a;
    const ll MOD=998244353;
    modint(ll a_=0){
        a=((a_%MOD)+MOD)%MOD;
    }
    modint inv()const{
        ll n=1,m=MOD-2,A=a;
        while(m){
            if(m&1)(n*=A)%=MOD;
            (A*=A)%=MOD;
            m>>=1;
        }
        modint y(n);
        return y;
    }
    bool operator==(const modint& x){
        return a==x.a;
    }
    bool operator!=(const modint& x){
        return a!=x.a;
    }
    modint& operator=(const modint& x){
        a=x.a;
        return *this;
    }
    modint operator+(const modint& x){
        modint y(a+x.a);
        return y;
    }
    modint operator-(const modint& x){
        modint y(a-x.a);
        return y;
    }
    modint operator*(const modint& x){
        modint y(a*x.a);
        return y;
    }
    modint operator/(const modint& x){
        return *this * x.inv();
    }
    modint& operator+=(const modint& x){
        *this=*this+x;
        return *this;
    }
    modint& operator-=(const modint& x){
        *this=*this-x;
        return *this;
    }
    modint& operator*=(const modint& x){
        *this=*this*x;
        return *this;
    }
    modint& operator/=(const modint& x){
        *this=*this/x;
        return *this;
    }
};
istream& operator>>(istream &in,modint& x){
    ll a_;
    in>>a_;
    modint y(a_);
    x=y;
    return in;
}
ostream& operator<<(ostream &out,const modint& x){
    out<<x.a;
    return out;
}
modint pwr(ll a,ll b){
    modint n(1),A(a);
    while(b){
        if(b&1) n*=A;
        A*=A;
        b>>=1;
    }
    return n;
}

vector<modint> fc(2000010);
modint fct(ll x){
    if(x==0) return 1;
    if(fc[x]==0) fc[x]=fct(x - 1)*x;
    return fc[x];
}

vector<modint> ifc(2000010);
modint ifct(ll x){
    if(x==2000010-1) return ifc[x]=fct(x).inv();
    if(ifc[x] == 0) ifc[x]=ifct(x+1)*(x+1);
    return ifc[x];
}

modint comb(ll n, ll r) {
    if (n < 0 || r < 0 || n < r) return 0;
    return fct(n)*ifct(r)*ifct(n-r);
}


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m,u;
    cin>>n>>m;
    modint ans;
    fr(t,m+1) if((3*m-t)%2==0) u=(3*m-t)/2,ans+=comb(u+n-1,u)*comb(n,t);
    cout<<ans-(comb(n+m-1,m)-comb(n+m-2,m))*n<<endl;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int a, b, h; std::cin >> a >> b >> h;
  std::cout << a * h + (b-a) * h / 2 << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main(void) {
    map<long long int, long long int> num_count;
    long long int n;
    cin >> n;
    vector<long long int> num_list(n);
    for (auto &nl : num_list) {
        cin >> nl;
        num_count[nl]++;
    }

    long long int sum = 0;
    for (auto nc: num_count) {
        sum += (nc.second * (nc.second - 1) / 2LL);
    }

    for (auto nl: num_list) {
        long long int mr = ((num_count[nl] - 1) * (num_count[nl] - 2) / 2LL);
        long long int ans = sum + mr - (num_count[nl] * (num_count[nl] - 1) / 2LL);
        cout << ans << endl;
    }
}

Measured memory_bytes: 11008
def main():
    N, M = map(int, input().split())
    tl, tr = map(int, input().split())
    for i in range(M-1):
        L, R = map(int, input().split())
        if tl < L:
            tl = L
        if tr > R:
            tr = R
    if tr >= tl:
        print(tr - tl + 1)
    else:
        print(0)
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <cstdint>
#include <cstdio>
using namespace std;
#define rep(i, n) for (register uint_fast32_t i = 0; i < (n); ++i)
inline char tc() {
    static char fl[100], *A = fl, *B = fl;
    return A == B && (B = (A = fl) + fread(fl, 1, 100, stdin), A == B) ? EOF
                                                                       : *A++;
}
inline uint_fast32_t read() {
    uint_fast32_t a = 0;
    static char c;
    c = tc();
    while (c & 16) a = a * 10 + c - 48, c = tc();
    return a;
}
uint_fast32_t h[100001];
int main() {
    register uint_fast32_t n, a, b, left, right;
    register int_fast64_t temp, cnt, mid;
    register double a_;
    n = read(), a = read(), b = read();
    a -= b;
    a_             = 1.0 / a;
    rep(i, n) h[i] = read();
    left = 0, right = 1000000000;
    cnt = 0;
    while (right > left + 1) {
        mid = (right + left) >> 1;
        cnt = 0;
        rep(i, n) {
            temp = h[i] - b * mid + a - 1;
            if (temp > 0) cnt += temp * a_;
        }
        if (cnt <= mid)
            right = mid;
        else
            left = mid;
    }
    printf("%u\n", right);
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using vi  = vector<int>;
int main(){
    int n,m,x,y;
    cin >>n>>m>>x>>y;
    int xmax=-200, ymin=200;
    rep(i,n){
      int a;
      cin>>a;
      xmax = max(xmax, a);
    }
    rep(i,m){
      int a;
      cin>>a;
      ymin = min(ymin, a);
    }
    int z = min(ymin, y);
    if(x<z && xmax<z)
        cout << "No War" << endl;
    else
        cout << "War" << endl;
    return 0;
}

Measured memory_bytes: 3608
// https://atcoder.jp/contests/abc134/tasks/abc134_c

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define print(x) cout << x << endl;

int main() {
    int N; cin >> N;
    int A[N]; rep(i, N) cin >> A[i];
    vector<int> B(A, A+N);

    sort(B.rbegin(), B.rend());
    // reverse(B.begin(), B.end());

    rep (i, N) {
        if (A[i] == B[0]) {
            cout << B[1];
        } else {
            cout << B[0];
        }
        cout << endl;
    }

    return 0;
}

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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int n;
	cin >> n;
	int k;
	cin >> k;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (a >= k) {
			sum++;
		}
	}
	cout << sum;
}

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

int main(){
    int N;cin>>N;
    vector<int>v(N);
    for(register int i=0;i<N;i++)cin>>v[i];
    int dp[N+1];
    memset(dp,0,sizeof dp);
    for(register int i=0;i<N;i++){
        if(i == 0){
            dp[i] = 0;
        }
        else if(i == 1){
            dp[i] = abs(v[i]-v[i-1]);
        }
        else {
            dp[i] = min(abs(v[i]-v[i-1])+dp[i-1],
                        abs(v[i] - v[i-2])+dp[i-2]);
        }
     //   cout<<i<< " "<<dp[i]<<endl;
    }
    cout<<dp[N-1]<<endl;
	return 0 ;
}


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

using namespace std;

#define long long long
#define INF 2e18
#define MOD (long) (998244353)
#define umap unordered_map

int main()
{
    long t = 1;
    //cin >> t;

    while (t--) {
        string s, t;
        cin >> s >> t;

        long ans = 0;
        for (long i = 0; i < s.size(); i++) {
            ans += s[i] != t[i];
        }
        printf("%lld\n", ans);
    }
}


Measured memory_bytes: 3904
<?php
fscanf(STDIN, "%d", $N);
$array = explode(" ",trim(fgets(STDIN)));
$sum = 0;
for($i=0; $i<$N; $i++){
    for($s=$i+1; $s<$N; $s++){
        $sum = $sum + ($array[$i] * $array[$s]);
    }
}
echo $sum;
?>

Measured memory_bytes: 4728
using System;

namespace B___ISU
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var x = int.Parse(input[0]);
            var y = int.Parse(input[1]);
            var z = int.Parse(input[2]);
            var a = 0;
            for (var i = 1; i < int.MaxValue; i++)
            {
                if (z * (i + 1) + y * i <= x)
                {
                    a++;
                }
                else
                {
                    break;
                }
            }
            Console.WriteLine(a);
        }
    }
}

Measured memory_bytes: 11092
#include <vector>
#include <list>
#include <map>
#include <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>

using namespace std;

typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PI;
const double EPS = 1e-9;
#define rep(i,s,n) for(int i=(s); i < int(n); ++i)

const int N = 101;
const int V = 1e5 + 1;
int v[N], w[N];
int n, wlim;
int tv[N];

int dp[N][V];
const int INF = 0x2fffffff;
const int DEBUG = 0;

int solve(void) {
  dp[0][0] = 0;
  int total_v = 1;
  rep(i, 0, n) {
    total_v += v[i];
  }
  rep(j, 1, total_v) {
    dp[0][j] = INF;
  }
  rep(i, 1, n + 1) {
    rep(j, 0, total_v) {
      int res = dp[i-1][j];
      int val = v[i-1];
      int wei = w[i-1];
      if (val <= j) {
	res = min(res, dp[i - 1][j - val] + wei);
      } else {
	res = min(res, wei);
      }
      if(DEBUG) {
	cout << "dp[" << i << "][" << j << "] = " << res << endl;
      }
      dp[i][j] = res;
    }
  }
  int q = 0;
  rep(i,0,total_v) {
    if (dp[n][i] <= wlim) {
      q = i;
    }
  }
  if(DEBUG) {
    cout << "q = " << q << endl;
  }
  int rem = q;
  int sum = 0;
  for (int i = n; i > 0; --i) {
    int val = v[i-1];
    int wei = w[i-1];
    if (val <= rem && dp[i][rem] - wei == dp[i - 1][rem - val]) {
      // output (i - 1)
      sum += tv[i - 1];
      rem -= val;
    }
  }
  return sum;
}


int main(void) {
  cin >> n >> wlim;
  double max_v = 0.0;
  rep(i, 0, n) {
    cin >> tv[i] >> w[i];
    max_v = max(max_v, (double) tv[i]);
  }
  double k = 37;
  double scale = max(1.0, max_v / (k + 1) / n);
  rep(i, 0, n) {
    v[i] = (int) floor(tv[i] / scale);
  }
  cout << solve() << endl;
}

Measured memory_bytes: 40612
#include <stdio.h>
#include <iostream>
using namespace std;

#define MAX_N 100000
#define NIL -1

struct Node {
  int parent;
  int left;
  int right;
};

void print_node(Node nodes[], int i, int depth[]) {
  printf("node %d: parent = %d, depth = %d, ", i, nodes[i].parent, depth[i]);

  if(nodes[i].parent == NIL) {
    printf("root, ");
  } else if(nodes[i].left == NIL) {
    printf("leaf, []");
    return;
  } else {
    printf("internal node, ");
  }

  printf("[");
  for(int n=nodes[i].left; n!=NIL; n=nodes[n].right) {
    printf("%d", n);
    if(nodes[n].right != NIL) {
      printf(", ");
    }
  }
  printf("]");
}

void walk_depth(Node nodes[], int depth[], int p, int d) {
  depth[p] = d;
  for(int n=nodes[p].left; n!=NIL; n=nodes[n].right) {
    walk_depth(nodes, depth, n, d+1);
  }
}

int main() {
  Node nodes[MAX_N];
  int depth[MAX_N];
  int cs[MAX_N];


  int n;
  cin >> n;

  for(int i=0; i<n; i++) {
    nodes[i].parent = NIL;
  }

  for(int i=0; i<n; i++) {
    int id, k;
    cin >> id >> k;

    cs[0] = NIL;
    for(int j=0; j<k; j++) {
      cin >> cs[j];
      nodes[cs[j]].parent = id;
    }
    cs[k] = NIL;
    for(int j=0; j<k; j++) {
      nodes[cs[j]].right = cs[j+1];
    }
    nodes[id].left = cs[0];
  }

  int root = 0;
  for(int i=0; i<n; i++) {
    if(nodes[i].parent == NIL)
      root = i;
  }
  walk_depth(nodes, depth, root, 0);

  for(int i=0; i<n; i++) {
    print_node(nodes, i, depth);
    printf("\n");
  }
}

Measured memory_bytes: 5096
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<string>
#include<vector>
using namespace std;

int main(void){
	int a, b;
	cin >> a >> b;
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
		cout << "Possible";
	}
	else {
		cout << "Impossible";
	}
	return 0;
}

Measured memory_bytes: 256
import math
 
def div(m):
  d = {}
  temp = int(math.sqrt(m))+1
  for i in range(2, temp):
    while m%i== 0:
      m //= i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
  if d == {}:
    d[m] = 1
  else:
    if m in d:
      d[m] += 1
    elif m != 1:
      d[m] =1
  return d

n, m = map(int, input().split())
if m == 1:
  print(1)
  exit()
#print(div(m))
from math import factorial
d = div(m)
#print(d)
ans = 1
for i in d.values():
  #ans *= int(factorial(i+n-1)) // int(factorial(n-1)) // int(factorial(i))
  ans *= factorial(i+n-1) // factorial(n-1) // factorial(i)
  ans %= 10**9+7
print(ans)

Measured memory_bytes: 115036
fn main() {
    let n: usize = read();
    let ps: Vec<i32> = read_lines(n as u32);

    let mut es: Vec<usize> = vec![0; n as usize];

    for (i, &p) in ps.iter().enumerate() {
        es[p as usize - 1] = i;
    }

    let mut vs: Vec<Vec<i32>> = Vec::new();
    let mut a: i32 = 0;

    for i in 0..n-1 {
        if es[i] > es[i+1] {
            vs.push((a..i as i32 + 1).collect());
            a = i as i32 + 1;
        }
    }
    vs.push((a..n as i32).collect());

    let mut result = 0;

    for i in vs {
        if result < i.len() {
            result = i.len();
        }
    }

    println!("{}", n - result);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_lines<T: std::str::FromStr>(n: u32) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

Measured memory_bytes: 15992
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
 
const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;
 
int main() {
    ll l, r;
    cin >> l >> r;

    if (r - l >= 2019) cout << 0 << endl;
    else {
        ll m = 2019;
        for (ll i = l; i < r; i++) {
            for (ll j = i + 1; j <= r; j++) {
                m = min(m, (i * j) % 2019);
            }
        }
        cout << m << endl;
    }
    return 0;
}

Measured memory_bytes: 256
H,W=map(int,input().split())
a=[]
dp=[[0 for i in range(W)] for j in range(H)]
dp[0][0]=1
for i  in range(H):
    a.append(list(input()))
for i in range(H):
    for j in range(W):
        u=0
        l=0
        if j>0 and a[i][j-1]!='#':
            l=dp[i][j-1]
        if i>0 and a[i-1][j]!='#':
            u=dp[i-1][j]
        dp[i][j]+=u+l
print(dp[H-1][W-1]%(10**9+7))

Measured memory_bytes: 166264
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define endl '\n'
int mod=1e9+7;
int mod2=998244353;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define nl cout<<"\n"
#define dbg(x) cout<<x<<" ";
#define fi(a,b) for(int i=a;i<b;i++)
#define fj(a,b) for(int j=a;j<b;j++)
#define UM unordered_map<int,int>
#define ULL unordered_map<ll,int>
void fun(){
    int a[3];   cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    ll ans=0;
    int b=a[1],c=a[2];
    while(b!=a[0]||c!=a[0]){
        ans++;
        if(b==a[0]+1)
            b-=1;
        else if(c==a[0]+1)
            c-=1;
        else if(b!=a[0]&&c!=a[0]){
            b-=2;
            c-=2;
        }
        else if(b!=a[0])
            b-=1;
        else if(c!=a[0])
            c-=1;
    }
    cout<<ans<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    fun();
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

d = 'APPROVED'
for i in a:
  if i % 2 == 0:
    if i % 3 == 0:
      continue
    elif i % 5 == 0:
      continue
    else:
      d = 'DENIED'
      break

print(d)

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

int main(void){
	int sw[1500001],sum, n, m, i, j, k, count, w[1500], h[1500];
	while(1){
		scanf("%d%d",&n,&m);
		if(n == 0 && m == 0)
			break;
		for(i = 0;i < n;i++)
			scanf("%d",&h[i]);
		for(i = 0;i < m;i++)
			scanf("%d",&w[i]);
		memset(sw,0,sizeof(sw));
		for(i = 0;i < m;i++){
			for(j = i;j < m;j++){
				sum = 0;
				for(k = i;k <= j;k++)
					sum += w[k];
				sw[sum]++;
			}
		}
		count = 0;
		for(i = 0;i < n;i++){
			for(j = i;j < n;j++){
				sum = 0;
				for(k = i;k <= j;k++)
					sum += h[k];
				if(sw[sum])
					count += sw[sum];
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

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


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
b = [0]*N

for i in range(N, 0, -1):
    if i > N // 2:
        b[i-1] = a[i-1]
    else:
        si = 0
        for j in range(i+i, N+1, i):
            si += b[j-1]
        if si % 2 == a[i-1]:
            b[i-1] = 0
        else:
            b[i-1] = 1

print(sum(b))
for i in range(N):
    if b[i] == 1:
        print(i+1 ,end=' ')


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

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REP1(i, n) for(ll i = 1;i < n;i++)
#define REPR(i, n) for(ll i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)

#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())

#define ll long long
#define ALL(a)  (a).begin(),(a).end()

#define pb(a) push_back(a)

int a,b;
string s;

int main(){
  cin>>s;
  a=s.length();
  REP(i,a){
    if (s[i]=='x')b++;
  }

  if (b>=8){
    cout<<"NO"<<endl;
  }else{
    cout<<"YES"<<endl;
  }

  return 0;
}


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

int main(){
  
  //N,M,Cを入力
  int N,M,C;
  cin >> N >> M >> C;
  
  //要素数Mの一次元配列を生成
  vector<int> B(M);
  
  for(int i = 0; i < M; i++){
     //M個の整数Bを入力
     cin >> B[i];
  }
  
  //N × Mの要素を持つ2次元配列を生成
  vector<vector<int>> A(N,vector<int>(M));
  
  for(int i = 0; i < N; i++){
    for(int j = 0; j < M ;j++){
      cin >> A[i][j];
    }
  }
  
  // numは正答したソースコードの数
  int num = 0;
 
  for(int i = 0; i < N; i++){
     // sumはsigma_{j=M}AB
     int sum = 0;
    for(int j = 0; j < M; j++){
      sum += A[i][j]*B[j];
    }
    	if(sum + C > 0){
      		num++;
    	}	
  }
   
  cout << num << endl;
}
  
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;

using namespace std;

int main(){
    ll l,r;
    cin >> l >> r;
    int tmp1,tmp2;
    tmp1 = l%2019;
    tmp2 = r % 2019;
    if ((r/(ll)2019 - l/(ll)2019) > 0) {
        cout << 0 << endl;

    }else{
        ll ans = INF;
        for(ll i=l;i<r;i++){
            for(int j=l+1;j<=r;j++){
                ll tmp= i%2019;
                tmp *= (j%2019);
                tmp %= 2019;
                ans = min(ans,tmp);
            }
        }
        cout << ans << endl;
    }
    
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define forn(i,b) for(int i=0 ; i< b ;i++)
#define for1(i,b) for(int i=1 ; i<=b ;i++)
#define reps(i,a,b) for(int i=a ; i< b.length() ;i++)
typedef long long ll;
#define MOD 1000000007

using namespace std;




int main()
{
  string tab[]={"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  int pos=0;
  string str;
  cin >> str;
  for(int i=0; i<7 ; i++){
    if(str == tab[i] ){
      pos = i;
      break ;
    }
  }
  cout << 7 - pos ;


  return 0 ;
}


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

using namespace std;

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

void j_inv(string& s) {
    s = s.back() + s.substr(0, s.size()-1);
}

void c_inv(string& s) {
    s = s.substr(1, s.size()-1) + s[0];
}

void e_inv(string& s) {
    if(s.size()%2 == 0)
        s = s.substr(s.size()/2, s.size()/2) + s.substr(0, s.size()/2);
    else
        s = s.substr(s.size()/2+1, s.size()/2) + s[s.size()/2] + s.substr(0, s.size()/2);
}

void a_inv(string& s) {
    reverse(s.begin(), s.end());
}

void p_inv(string& s) {
    rep(i, s.size())
        if(isdigit(s[i])) s[i] = (s[i]=='0'? '9':s[i]-1);
}

void m_inv(string& s) {
    rep(i, s.size())
        if(isdigit(s[i])) s[i] = (s[i]=='9'? '0':s[i]+1); 
}

int main() {
    int n; cin >> n;
    rep(_, n) {
        string m; cin >> m;
        string s; cin >> s;
        for(int j=m.size()-1; j>=0; j--) {
            switch(m[j]) {
                case 'J': j_inv(s); break;
                case 'C': c_inv(s); break;
                case 'E': e_inv(s); break;
                case 'A': a_inv(s); break;
                case 'P': p_inv(s); break;
                case 'M': m_inv(s); break;
            }
        }
        cout << s << endl;
    }
}



Measured memory_bytes: 3052
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>> vec(200020);
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		vec[a].emplace_back(b);
		vec[b].emplace_back(a);
	}
	for (int i = 0; i < vec[1].size(); i++) {
		for (int j = 0; j < vec[vec[1][i]].size(); j++) {
			if (vec[vec[1][i]][j] == n) {
				cout << "POSSIBLE" << endl;
				return 0;
			}
		}
	}
	cout << "IMPOSSIBLE" << endl;
	return 0;
}

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

constexpr int MOD = 2019;

int main() {
  string s; cin>>s;
  vector<long long> v(2020, 0);
  v[0] = 1;

  int cur = 0, p = 1;
  for (int i = s.size() - 1; i >= 0; i--) {
    cur = (cur + (s[i] - '0') * p) % MOD;
    p = (p * 10) % MOD;
    ++v[cur];
  }

  long long ans = 0;
  for (int i = 0; i < 2020; i++) {
    ans += v[i] * (v[i] - 1) / 2;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3744
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;



int main() {
    int i[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
    int a;
    cin >> a;

    cout << i[a - 1];

    return 0;
}

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

const int N = 200010;
const int mod = 1e9 + 7;
const int inv2 = (mod + 1) / 2;

typedef long long LL;

inline int Pow(int x, int y) {
    int res = 1;
    for (; y; y >>= 1, x = (LL)x * x % mod) if (y & 1) res = (LL)res * x % mod;
    return res;
}

int n;

struct FUCK {
	
int tree[N];
    
inline void update(int x, int y) {
    for (; x <= n; x += x & -x) tree[x] = (tree[x] + y) % mod;
}

inline int query(int x) {
    int res = 0;
    for (; x; x -= x & -x) res = (res + tree[x]) % mod;
    return res;
}

inline int query(int l, int r) {
    return (query(r) - query(l - 1) + mod) % mod;
}

} X, Y, Z;

int A[N], num[N], pre[N], lst[N], nxt[N], ct[N];
bool fuck[N];

int main() {
	scanf("%d", &n);
	for (int i = 1, a; i <= n; i++) scanf("%d", &a), A[a]++, num[i] = a;
	for (int i = n; i >= 0; i--) A[i] += A[i + 1];
	int tot = 1; pre[0] = 1;
	for (int i = 1; i <= n; i++) {
		A[i] -= n - i, tot = (LL)tot * A[i] % mod;
		if (A[i] <= 0) return puts("0"), 0;
		int t = (LL)(A[i] - 1) * Pow(A[i], mod - 2) % mod;
		if (t) pre[i] = (LL)pre[i - 1] * t % mod;
		else pre[i] = pre[i - 1], fuck[i] = true;
	} 
	nxt[n + 1] = n + 1;
	for (int i = n; i >= 1; i--) {
		nxt[i] = nxt[i + 1];
		if (fuck[i]) nxt[i] = i;
	}
	for (int i = 1; i <= n; i++) {
		lst[i] = lst[i - 1];
		if (fuck[i]) lst[i] = i;
	}
	int res = 0;
	for (int i = 1; i <= n; i++) {
		res = (res + (LL)ct[num[i]] * tot % mod * inv2) % mod;
		if (num[i] != 1) {
			res = (res + (LL)Y.query(max(1, lst[num[i]]), num[i] - 1) * pre[num[i]] % mod
				* tot % mod * inv2) % mod;
		}
		if (num[i] != n) {
			res = (res + (LL)Z.query(num[i] + 1, n) * tot) % mod;
			res = (res - (LL)X.query(num[i] + 1, min(n, nxt[num[i] + 1] - 1)) * Pow(pre[num[i]], mod - 2) % mod
				* tot % mod * inv2 % mod + mod) % mod;
		}
		X.update(num[i], pre[num[i]]), Y.update(num[i], Pow(pre[num[i]], mod - 2)), Z.update(num[i], 1), ct[num[i]]++;
	}
	printf("%d\n", res);
}

Measured memory_bytes: 7424
#include <bits/stdc++.h>
using namespace std;
#define hyperspeed ios::sync_with_stdio(false);cin.tie(NULL);
#define ll long long  
#define ull unsigned long long
#define ui unsigned int
#define li long int
#define uli unsigned long int
#define pb push_back
#define ld long double
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
const int MOD = 1e9+7;

void solve() {
    char ch;
    cin >> ch;
    if(isupper(ch)) {
        cout << "A\n";
    }
    else {
        cout << "a\n";
    }
}

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

//--n1m5


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	vl v;
	range(i,1,n+1){
		v.push_back(n/i);
		chmax(i,(int)(n/(n/i)));
	}
	vvl dp(k,vl(v.size()));
	v.push_back(0);
	rep(i,v.size()-1){
		dp[0][i]=v[i]-v[i+1];
	}
	range(i,1,k){
		ll sum=0;
		rep(j,v.size()-1){
			sum+=dp[i-1][v.size()-2-j];
			dp[i][j]=(sum*(v[j]-v[j+1]))%MOD;
		}
	}
	ll ans=0;
	rep(i,dp[k-1].size())ans+=dp[k-1][i],ans%=MOD;
	cout<<ans<<endl;
}


Measured memory_bytes: 50936
/// 標準入力マクロ
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
    }

    println!("{}", s.match_indices("1").count());
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long ll;

int main(){
  vector<int> a(5);
  rep(i,5)cin >> a.at(i);

  rep(i,5){
    if(a.at(i)==0) cout << i+1;
  }
}

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

using namespace std;

int r,c,n;
bool onside(int a, int b){
	if(a == 0 or a == r) return true;
	if(b == 0 or b == c) return true;
	return false;
}
int conv(int a, int b){
	if(a == 0) return b; // left line
	if(b == c) return c+1+a; // top line
	if(a == r) return c+1+r+1+c-b+1; // rightline
	if(b == 0) return c+1+r+1+c+1+r-a+1; // bottom line
	assert(false);
	return 0;
}
typedef pair<int,int> pi;
vector<pi> v;
int main(){
	//freopen("connected.in","r", stdin);
	cin >> r >> c >> n;
	for(int i = 0; i<n; i++){
		int a, b, c, d; cin >> a >> b >> c >> d;
		if(onside(a,b) and onside(c,d)){
			v.push_back(pi(conv(a,b), i));
			v.push_back(pi(conv(c,d), i));
		}
	}
	sort(v.begin(), v.end());
	stack<int> s;
	for(auto i : v){
		if(s.empty()) s.push(i.second);
		else if(s.top() == i.second) s.pop();
		else s.push(i.second);
	}
	if(s.empty()) cout << "YES";
	else cout << "NO";
}


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

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

count = 0
def swap(a, b):
    t = a
    a = b
    b = t
    return [a, b]

def selection_sort(l):
    global count
    for i in range(0, len(l)):
        mini = i
        for j in range(i, len(l)):
            if l[j] < l[mini]:
                mini = j
        if i != mini:
            count += 1
        l[i], l[mini] = swap(l[i], l[mini])
    return l

l = selection_sort(A)
print(' '.join(str(x) for x in l))
print(count)

Measured memory_bytes: 7756
// Problem : E - Coprime
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

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

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;
const int MAX = 1e6;

bool prime[maxN];
int spf[maxN], ile[maxN];

void sieve() {
	FOR(i, 2, MAX) {
		spf[i] = i;
	}
	FOR(i, 2, MAX) {
		if (spf[i] == i) {
			for (ll j = (ll)i * i; j <= MAX; j += i) {
				spf[j] = i;
			}
		}
	}
}

// sprawdz MODULO!
int main() {
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	sieve();
	int n; cin >> n;
	int g = 0;
	bool pair = true;
	REP(i, n) {
		int a;
		cin >> a;
		g = __gcd(a, g);
		while (a != 1) {
			// cout << a << " " << spf[a] << endl;
			ile[spf[a]]++;
			if (ile[spf[a]] > 1) {
				pair = false;
			}
			int z = spf[a];
			while (a % z == 0) a /= z;
		}
	}
	if (pair) {
		cout << "pairwise coprime\n";
	} else {
		if (g == 1) {
			cout << "setwise coprime\n";
		} else {
			cout << "not coprime\n";
		}
	}
	
	return 0;
}
 


Measured memory_bytes: 11380
#include<bits/stdc++.h>
#define ll long long 
#define tox x+dx[i]
#define toy y+dy[i]
using namespace std;

inline ll read(){
    ll x=0,f=1;
    char ch=getchar();
    for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
    for(;isdigit(ch);ch=getchar())x=(x<<3)+(x<<1)+ch-48;
    return x*f;
}

int main(){
   // freopen("a.in","r",stdin);
    int n=read(),pos;
    long double tem,pe,xxx=99999999999;
    cin>>tem>>pe;
    for(int i=1;i<=n;i++){
        long double nowhigh;
        cin>>nowhigh;
       long double nowtem=tem-nowhigh*0.006;
        if (abs(pe-nowtem)<xxx) pos=i,xxx=abs(pe-nowtem);
    }
    cout<<pos;
    return 0; 
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#define FOR(idx, begin, end) for(int idx = (int)(begin), idx##_sz = (int)(end); idx < idx##_sz; ++idx)

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

using namespace std;
typedef long long lint;

const int MOD = 1000000007, INF = 1111111111;
const double EPS = 1e-9;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int a, b, c;
	cin >> a >> b >> c;

    if(a + b == c || b + c == a || c + a == b) cout << "Yes";
    else cout << "No";

	return 0;
}


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

int main() {
	int n, a = 0, b = 0, c = 0, d = 0;
	string s;
	cin >> n;
	while(n--) {
		cin >> s;
		if(s == "AC") {
			a++;
		}
		if(s == "WA") {
			b++;
		}
		if(s == "TLE") {
			c++;
		}
		if(s == "RE") {
			d++;
		}
	}
	cout << "AC x " << a << endl;
	cout << "WA x " << b << endl;
	cout << "TLE x " << c << endl;
	cout << "RE x " << d << endl; 
	
	return 0; 
}


Measured memory_bytes: 3600