akhauriyash/Code-Regression huggingface dataset:
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

int main(void){
    ll n;
    cin >> n;

    ll backet[1010] = {0};

    for(int i = 2; i <= n; i++){
        int tmp = i;
        for(int j = 2; j <= i; j++){
            while(tmp % j == 0 && tmp / j >= 0){
                tmp /= j;
                backet[j]++;
            }
        }
    }
    ll ans = 1;
    for(int i = 0; i < 1010; i++){
        if(backet[i] == 0) continue;
        ans *= (backet[i] + 1) % MOD;
        ans %= MOD;
    }
    cout << ans % MOD << endl;
}

Measured memory_bytes: 256
import numpy as np
N = int(input())

row = np.arange(1, N+1)

FizzBuzz = row[row%15==0]
Fizz = row[row%3==0]
Buzz = row[row%5==0]

print(np.sum(row) - (np.sum(Fizz) + np.sum(Buzz) - np.sum(FizzBuzz)))

Measured memory_bytes: 46060
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()

#define MOD 1000000007
#define INF 2147483647
#define NINF (-2147483647-1)
#define LLINF 9223372036854775807
using ll = long long;
using namespace std;


int main() {
    int X, Y, Z, K, s;
    cin >> X >> Y >> Z >> K;
    vector<ll> A(X), B(Y), C(Z), E;
    ll a, b, c;
    a = b = c = 0;
    for (int i = 0; i < X; i++)
    {
        cin >> A[i];
    }
    for (int i = 0; i < Y; i++)
    {
        cin >> B[i];
    }
    for (int i = 0; i < Z; i++)
    {
        cin >> C[i];
    }
    sort(RALL(A));
    sort(RALL(B));
    sort(RALL(C));
    for (int i = 0; i < X; i++)
    {
        for (int j = 0; j < Y; j++)
        {
            for (int k = 0; k < Z; k++)
            {
                if ((i+1)*(j+1)*(k+1)<=K) {
                    E.push_back(A[i] + B[j] + C[k]);
                }
            }
        }
    }
    sort(RALL(E));
    for (int i = 0; i < K; i++)
    {
        cout << E[i] << endl;
    }
    getchar(); getchar();
    getchar(); getchar();
    return 0;
}

Measured memory_bytes: 1404
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;


int main()
{
	int n;
	scanf("%d", &n);
	
	int ans = n / 2 + n % 2;
	
	printf("%d\n", ans);
	
	
			
	return 0;
}


Measured memory_bytes: 128
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  string x, y;
  cin >> x >> y;
  for (int i = 0; i < y.size(); i++) {
    cout << x[i] << y[i];
  }
  if (x.size() != y.size()) cout << x[x.size() - 1] << endl;
  else cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>

//using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

using ll =  long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
template<typename T> void chadd(T& a, T b) { a = a + b; }

namespace {  // 名前なし名前空間
	// gcd, lcm は C++17 でstdに標準入りしたので言語のバージョンに注意
	// 最大公約数
	ll gcd(ll a, ll b) {
		if (b == 0) return a;
		return gcd(b, a % b);
	}

	// 最小公倍数
	ll lcm(ll a, ll b) {
		return a / gcd(a, b) * b;
	}


}


int main() {

	int n;
	std::cin >> n;
	std::string s;
	std::cin >> s;

	int ans = 0;

	rep(i, n - 2) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
			++ans;
		}
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define gc getchar_unlocked()
#define pc(x) putchar_unlocked(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;
using ll = long long;
const int MM = 2e5+5;

int n, a[MM], b[MM], dis[MM];
ll k, len;

int main(){
    scan(n, k);
    for(int i = 1; i <= n ; i++)
        scan(a[i]);
    
    memset(dis, -1, sizeof dis);
    int at = 1, st = -1;
    for(int i = 0;; i++){
        if(k == i){
            print(at);
            return 0;
        }
        b[i] = at;
        dis[at] = i;
        int pre = at;
        at = a[at];
        
        if(dis[at] != -1){
            st = at;
            len = dis[pre]+1-dis[at];
            break;
        }
    }
//    print(len, dis[st]);

    k %= len;
    while(k < dis[st])
        k += len;
    
    print(b[k]);
    
    
    return 0;
}

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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxN = 3e3;

int n;
long double p[maxN];

long double dp[maxN][maxN];

long double res = 0;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for1(i, n)
    {
        cin >> p[i];
    }
    for1(i, n)
    {
        dp[i][0] = 1;
    }
    for1(j, n)
    {
        dp[0][j] = 1;
    }
    dp[0][0] = 1;
    for1(i, n)
    {
        dp[i][0] = dp[i - 1][0] * (1 - p[i]);
        for1(j, i)
        {
            dp[i][j] = dp[i - 1][j - 1] * p[i];
            if (j <= i - 1)
            {
                dp[i][j] += dp[i - 1][j] * (1 - p[i]);
            }
        }
    }
    fore(j, n / 2 + 1, n)
    {
        res += dp[n][j];
    }
    cout << fixed << setprecision(10) << res;
    return 0;
}


Measured memory_bytes: 139136
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 1e5 + 5;
int n, m;
vector<int> g[maxn];
int indeg[maxn];
int root;
bool mark[maxn];
int ans[maxn];
void dfs(int v) {
	mark[v] = true;
	for(int i = 0; i < g[v].size(); i++) {
		if(!mark[g[v][i]]) {
			indeg[g[v][i]]--;
		}
	}
	for(int i = 0; i < g[v].size(); i++) {
		int u = g[v][i];
		if(!mark[u] && !indeg[u]) {
			ans[u] = v;
			dfs(u);
		}
	}
}
int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	for(int i = 0; i < n + m - 1; i++) {
		int u, v;
		cin >> u >> v;
		u--, v--;
		g[u].push_back(v);
		indeg[v]++;
	}
	for(int i = 0; i < n; i++)
		if(indeg[i] == 0)
			root = i;
	dfs(root);
	for(int i = 0; i < n; i++)
		if(i == root)
			cout << 0 << '\n';
		else
			cout << ans[i] + 1 << '\n';
	return 0;
}

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

int main(){
  int n;
  cin>>n;
  
  rep(i,n){  
    string a,b;
    cin>>a>>b;
    
    int dp[1005][1005];
    rep(i,1005)rep(j,1005)dp[i][j] = 0;
    
    rep(j,a.size())rep(k,b.size()){
      if(a[j]==b[k]) dp[j+1][k+1] = max(dp[j+1][k+1],dp[j][k]+1);
      else dp[j+1][k+1] = max(max(dp[j][k+1],dp[j+1][k]),dp[j+1][k+1]);
    }
    
    cout << dp[a.size()][b.size()] << endl;
  }
}


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

int main()
{
int n,m,c;
string arr[1000];
cin>>n>>m;
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
for(int i=0;i<n;i++)
{
    for(int j=0;j<m;j++)
    {c=0;
        if(arr[i][j]=='.')
        {
          if(j-1>=0)
          {
              if(arr[i][j-1]=='#'){c++;}
          }
          if(j+1<=m-1)
          {
              if(arr[i][j+1]=='#'){c++;}
          }
          if(i+1<=n)
          {
              if(arr[i+1][j]=='#'){c++;}

          if(j-1>=0)
          {
              if(arr[i+1][j-1]=='#'){c++;}
          }
          if(j+1<=m-1)
          {
              if(arr[i+1][j+1]=='#'){c++;}
          }
          }
          if(i-1>=0)
          {
              if(arr[i-1][j]=='#'){c++;}

          if(j-1>=0)
          {
              if(arr[i-1][j-1]=='#'){c++;}
          }
          if(j+1<=m-1)
          {
              if(arr[i-1][j+1]=='#'){c++;}
          }
          }
          cout<<c;
        }
        else{cout<<"#";}
    }
    cout<<endl;
}

}


Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

struct Buffer{
    int idx = 0;
    char buf[1025];
    Buffer(){
        cin.read(buf, 1024);
    }
    void check(){
        if(idx == 1024){
            idx = 0;
            cin.read(buf, 1024);
        }
    }
    int next(){
        int ret = 0;
        while(check(), !isdigit(buf[idx])){ idx++; }
        while(check(), isdigit(buf[idx])){ ret = ret * 10 + buf[idx++] - '0'; }
        return ret;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    Buffer buf;
    int h = buf.next(), w = buf.next();
    vector<vector<short>> cs(10, vector<short>(10));
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            cs[i][j] = buf.next();
        }
    }
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            for(int k = 0; k < 10; k++){
                cs[j][k] = min((int)cs[j][k], cs[j][i] + cs[i][k]);
            }
        }
    }
    int ans = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            int a = buf.next();
            if(a != -1){
                ans += cs[a][1];
            }
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  int ans=0;
  int s=n;
  while(n>0)
  {
   ans+=n%10;
    n=n/10;
  }
  if(s%ans==0)
    cout<<"Yes";
  else
    cout<<"No";
}

Measured memory_bytes: 384
from itertools import permutations, combinations


def solve(string):
    n, a, b, c, *l = map(int, string.split())
    ans = 3000
    for _l in permutations(l):
        for i, j, k in combinations(range(1, len(l) + 1), 3):
            tmp = 10 * (i - 1) + abs(a - sum(_l[:i]))
            if tmp > ans:
                continue
            tmp += 10 * (j - i - 1) + abs(b - sum(_l[i:j]))
            if tmp > ans:
                continue
            tmp += 10 * (k - j - 1) + abs(c - sum(_l[j:k]))
            if tmp < ans:
                ans = tmp
    return str(ans)


if __name__ == '__main__':
    n, a, b, c = map(int, input().split())
    print(solve('{} {} {} {}\n'.format(n, a, b, c) + '\n'.join([input() for _ in range(n)])))


Measured memory_bytes: 58460
N = int(input())
alllist = []
listtime = []
listtask = []
for i in range(N):
    a,b = map(int,input().split())
    alllist.append([a,b])
sortlist = sorted(alllist, key=lambda x: x[1])

a = 0

for i in range(N):
    a += sortlist[i][0]
    if a > sortlist[i][1]:
        print("No")
        break
else:
    print("Yes")
    

Measured memory_bytes: 39588
#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);
      }
    }
  };

  auto dfs = [&](int v, T f, auto dfs) {
    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), dfs);
        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, dfs);
      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
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                           \
    (upper_bound((V).begin(), (V).end(), X) - \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                             \
    {                                        \
        cerr << #v << ':';                   \
        for (auto xv : v) cerr << xv << ' '; \
        cerr << endl;                        \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) a = b;
    return a > b;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* library */

/* main */

signed main() {
    ll N, M, A, B, C, D, X, Y;
    string S, T;
    vl v;
    cin >> N;
    vl p(N);
    FOR(i, 0, N)
    cin >> p[i];
    ll ans = 0;
    FOR(i, 1, N - 1) {
        bool b = max({p[i - 1], p[i], p[i + 1]}) > p[i];
        bool b2 = min({p[i - 1], p[i], p[i + 1]}) < p[i];
        ans += b && b2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

const long long MOD=1e9+7;

long long fanc[2009], inv_fanc[2009];

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

void fanc_list(){
    fanc[0] = 1;
    fanc[1] = 1;
    inv_fanc[0] = 1;
    inv_fanc[1] = 1;
    for(int i=2;i<=2000;i++){
        fanc[i] = (i*fanc[i-1])%MOD;
        inv_fanc[i] = modinv(fanc[i], MOD);
    }
}

long long combi(long long n, long long k){
    if(n<k)return 0;
    return ((fanc[n]*inv_fanc[n-k])%MOD)*inv_fanc[k]%MOD;
}

int main(){
    long long n, k;
    cin >> n >> k;
    fanc_list();
    for(long long i=1;i<=k;i++){
        cout << (combi(k-1, i-1)*combi(n-k+1, i))%MOD << endl;
    }
}

Measured memory_bytes: 256
import numpy as np
def f(b, n):
    s = 0
    while n > 0:
        s += n % b
        n //= b
    return s

INF = 10**15
def solve(n, s):
    if n == s:
        return n+1
    m = int(np.sqrt(n)) + 1
    for b in range(2, m+1):
        if f(b, n) == s:
            return b
    best = INF
    for p in range(1, m+10):
        q = s - p
        b = (n - q) // p
        if (b > p) and (b > q) and (f(b, n) == s):
            best = min(best, b)
    return -1 if (best == INF) else best

n = int(input())
s = int(input())
print(solve(n, s))

Measured memory_bytes: 14404
#include<iostream>
#include<stdlib.h>
#include<stack>
using namespace std;
 
int main(){
  stack<int> S;
  int a,b,x;
  string s;
  while(cin>>s){
    if(s[0]=='+'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a+b);
    }else if(s[0]=='-'){
      b=S.top();S.pop();
      a=S.top();S.pop();
      S.push(a-b);
    }else if(s[0]=='*'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a*b);
    }else{
      S.push(atoi(s.c_str()));
    }
  }
  cout<<S.top()<<endl;
  return 0;
}


#

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
int main ()
{
	int n,ans=0;
	cin>>n;
	int a[n],b[n];
	for (int i=0; i<n; i++)
	{
		cin>>a[i];
	}
	for (int i=0; i<n; i++)
	{
		cin>>b[i];
	}
	for (int i=0; i<n; i++)
	{
		if (a[i]>b[i])
		{
			ans+=(a[i]-b[i]);
		}
		else
		{
			continue;
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<int, string>;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

vector<P> run_length(const vector<string>& S) {
    string now = S[0];
    int cnt = 1;
    vector<P> res;
    rep(i, 1, S.size()) {
        if (S[i] == now) {
            ++cnt;
        }
        else {
            res.emplace_back(cnt, now);
            now = S[i];
            cnt = 1;
        }
    }
    res.emplace_back(cnt, now);
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<string> S(N);
    rep(i, 0, N) {
        cin >> S[i];
    }
    sort(all(S));
    vector<P> v = run_length(S);
    sort(all(v));
    reverse(all(v));
    vector<string> ans;
    int cnt = v[0].first;
    rep(i, 0, v.size()) {
        if (v[i].first == cnt) {
            ans.push_back(v[i].second);
        }
    }
    sort(all(ans));
    rep(i, 0, ans.size()) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 20588
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define Rev(a) reverse(a.begin(), a.end())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;

signed main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    
   
    mes(max(max(a*c, a*d), max(b*c, b*d)));
}
    
    
    
    
    


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){ return (int)s.size(); }

int cnt(ll x){
    int ans = 1;
    while(x / 10 != 0){
        ans++;
        x /= 10;
    }
    return ans;
}

int main(){
    cout << setprecision(16);
    ll n; cin >> n; ll ans = 0;
    for(int i = floor(sqrt(n)); i > 0; i--){
        if(n % i == 0){
            ans = i;
            break;
        }
    }
    cout << max(cnt(ans), cnt(n/ans)) << endl;
    return 0;
}


Measured memory_bytes: 256
#define ll long long
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mp make_pair
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<utility>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>
ll z = 1000000007 ;
ll inf = 100000000000000000 ;
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
ll power(ll a ,ll b){if(b == 0) return 1 ; ll c = power(a , b/2) ; if(b%2 == 0) return ((c*c)%z) ; else return ((((c*c)%z)*a)%z) ;}
ll inverse(ll a ,ll n){return power(a , n-2) ;}
ll max(ll a , ll b){if(a > b) return a ; return b ;}
//ios_base::sync_with_stdio(0);
//cin.tie(0); cout.tie(0);
using namespace std ;
string str = "a" ;

void get_ans(ll n , ll a)
{
	if(n == 0)
	{
		cout << str << '\n' ;
		return ;
	}
		
	for(ll i = 0 ; i <= a+1 ; i++)
	{
		str += (char)('a' + i) ;
		get_ans(n-1 , max(i , a)) ;
		string s ;
		fo(i , str.size()-1)
			s += str[i] ;
		str = s ;	
	}
	return ;
}

void solve()
{
	ll n ;
	cin >> n ;
	
	get_ans(n-1 , 0) ;
	return ;
}

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

Measured memory_bytes: 1536
#include <iostream>
using namespace std;
long long n, s=1, a[1005];
int main() {
	int i, j, k;
	cin>>n;
	for(i=2; i<=n; i++) {
		for(j=i, k=2; j>1;) {
			if(j%k==0) {
				a[k]++;
				j /= k;
			} else {
				k++;
			}
		}
	}
	for(i=2; i<=n; i++) {
		if(a[i]) s = s * (a[i]+1) % 1000000007;
	}
	cout << s;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define db long double
#define fi first
#define se second
#define  pb push_back
#define  pob pop_back
#define W while
#define fn(i,x) for(int i=0;i<x;i++)
#define fs(i,s,x) for(int i=s;i<x;i++)
#define fr(i,x) for(int i=x;i>=0;i--)
#define fit(it,s) for(auto it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mod 1000000007
#define MAX 1005
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

    // freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
    
    ll n;
    cin >> n;
    cout << (n-2)*180;

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n;
    cin >> n;
    vector<ll> p(n), q(n);
    REP(i, n) cin >> p[i], p[i]--;
    REP(i, n) cin >> q[i], q[i]--;

    ll idx = 0, a, b;
    vector<ll> ord(n);
    iota(ALL(ord), 0);
    do {
        if(ord == p) a = idx;
        if(ord == q) b = idx;
        idx++;
    } while(next_permutation(ALL(ord)));

    cout << abs(a-b) << endl;

    return 0;
}

Measured memory_bytes: 256
s = input()
a = int(s[:2])
b = int(s[2:])
if (a>12 or a==0) and (b>12 or b==0):
    print("NA")
elif a>12 or a==0:
    print("YYMM")
elif b>12 or b==0:
    print("MMYY")
else:
    print("AMBIGUOUS")

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n)cin >> s[i];
    int m;
    cin >> m;
    vector<string> t(m);
    rep(i, m)cin >> t[i];
    vector<string> call = s;
    unique(ALL(call));

    int ans = 0;
    rep(i, call.size()){
        int sum = 0;
        rep(j, n)if(s[j] == call[i])sum++;
        rep(j, m)if(t[j] == call[i])sum--;
        ans = max(ans, sum);
    }

    cout << ans << endl;
}

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

using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

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

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

    string ans;

    do{
        n--;
        char a='a'+n%26;
        ans.push_back(a);
        n/=26;
    }while(n>0);

    ll len=ans.size();

    repr(i,len-1,0)cout<<ans[i];

    cout<<endl;

}




Measured memory_bytes: 3628
#include "stdio.h"

int main()
{
  int a[4] = {}, b[4] = {}, c, i, count = 0;
  for(i = 0; i < 3; i++)
  {
    scanf("%1s", &a[i]);
  }
  for(i = 0; i < 3; i++)
  {
    scanf("%1s", &b[i]);
  }
  for(i = 0; i < 3; i++)
  {
    if(a[i] == b[i])
    {
      count++;
    }
  }
  printf("%d\n", count);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
	string a, b, c;
	cin >> a >> b >> c;
	if(a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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

template<typename T>
struct BinaryIndexedTree{
private:
  int n;
  T *data;

public:
  BinaryIndexedTree(int n = 0) : n(n){
    data = new T[n + 1];
    for(int i = 0; i <= n; i++) data[i] = 0;
  }

  bool add(int index, T x = 1){
    if(index < 0 || n <= index) return false;
    for(index++; index <= n; index += index & -index){
      data[index] += x;
    }
    return true;
  }

  T sum(int index){
    if(index < 0) index = 0;
    else if(index >= n) index = n - 1;

    T x = 0;
    for(index++; index; index -= index & -index){
      x += data[index];
    }
    return x;
  }

  ~BinaryIndexedTree(){
    delete [] data;
  }
};

using namespace std;

int main(){
  int N, Q;
  cin >> N >> Q;
  
  vector<int> c(N + 1);
  for(int i = 1; i <= N; i++){
    cin >> c[i];
  }
  
  vector<pair<pair<int, int>, int>> query(Q);
  for(int i = 0; i < Q; i++){
    cin >> query[i].first.second >> query[i].first.first;
    query[i].second = i;
  }
  
  sort(query.begin(), query.end());
  
  BinaryIndexedTree<int> bit(N + 1);
  vector<int> last(N + 1, -1);
  
  for(int i = 0; i < query[i].first.first; i++){
    bit.add(last[i] + 1);
  }
  
  vector<int> ans(Q);
  int r = 1;
  for(int i = 0; i < Q; i++){
    for(int j = r; j <= query[i].first.first; j++){
      if(last[c[j]] >= 0) bit.add(last[c[j]], -1);
      last[c[j]] = j;
      bit.add(last[c[j]], 1);
    }
    
    r = query[i].first.first;
    
    ans[query[i].second] = bit.sum(query[i].first.first) - bit.sum(query[i].first.second - 1);
  }
  
  for(int i = 0; i < Q; i++) cout << ans[i] << endl;
  
  return 0;
}

Measured memory_bytes: 17380
<?php

while (true) {
    fscanf(STDIN, '%d', $n);
    if ($n === 0) {
        break;
    }
    $c = 0;
    for ($i = 5; $i <= $n; $i *= 5) {
        $c += (int) ($n / $i);
    }
    echo $c . PHP_EOL;
}

Measured memory_bytes: 6572
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip> 

using namespace std;


int main()
{
	const long double pi = acos(-1.);
	ios_base :: sync_with_stdio(false);
	long double a, b, h, m;
	cin >> a >> b >> h >> m;
	long double a1 = ((h * 60. + m) / (12 * 60.)) * 2 * pi;
	long double a2 = (m / 60.) * 2. * pi;
	long double al = fabs(a1 - a2);
	long double c = sqrt(a * a + b * b - 2 * b * a * cos(al));
	cout << setprecision(40);
	cout << c;
	return 0;
}

Measured memory_bytes: 4184
#include<cstdio>
#include<cstring>
#include<cmath>
#include<utility>
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
string s,a[100];
int main()
{
	cin>>s;
	int k ;cin>>k;
	int n = s.length();
	int cur = 0;
	for(int i=0;i<n;i++)
	{
		for(int j=1;j<=min(5,n-i);j++)
		{
			a[cur+j] = s.substr(i,j);
		}
		cur += min(5,n-i);
		sort(a+1,a+1+cur);
		cur = unique(a+1,a+1+cur) - a - 1;
		if(cur>k)cur = k;
	}
	cout << a[k] << endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    ans=0
    for j in range(1,N+1,2):
        tmp=0
        for i in range(1,j+1):
            if j%i==0:
                tmp+=1
        if tmp==8:
            ans+=1
    print(ans)

if __name__ == '__main__':
    main()


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

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

int main(void)
{
  ll x;
  cin >> x;

  ll ans = (x / 11)*2;
  if(x % 11 > 6) ans +=2;
  else if(x % 11 > 0) ans += 1;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 998244353;

int main() {
    string s;
    cin >> s;
    int n = s.length();
    VI a(n);
    REP(i,n) a[i] = s[i] - '0';

    int r = 0;
    REP(i,n) r += a[i];
    int b = 2 * n - r;

    VI cnt(n);
    cnt[0] = a[0];
    REP(i,n-1) cnt[i+1] = cnt[i] + a[i+1];


    VVL dp(r + 1, VL(b + 1));
    dp[0][0] = 1;
    REP(i,r+1) REP(j,b+1){
        // cout << i << " " << j << endl;
        int t = i + j, cr = 0;
        if (t >= n) cr = r;
        else cr = cnt[t];
        int cb = 2 * min(n, (t + 1)) - cr;
        // cout << " " << cr << " " << cb << endl;
        if (i < cr) dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % mod;
        if (j < cb) dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % mod;
    }

    cout << dp[r][b] << endl;

    return 0;
}


Measured memory_bytes: 31616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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; }
int main(){
    ll n; cin>>n;
    vector<string> a(n);
    rep(i,n) cin>>a[i];
    vector<string> b=a, c=a;
    rep(i,n){
        rep(j,n-1){
            if(b[j][1]>b[j+1][1]){
                swap(b[j],b[j+1]);
            }
        }
    }
    rep(i,n){
        ll minj=i;
        for(ll j=i; j<n; j++){
            if(c[j][1]<c[minj][1]) minj=j;
        }
        if(i!=minj) swap(c[i],c[minj]);
    }

    rep(i,n){
        cout<<b[i];
        if(i<n-1) cout<<' ';
    }
    cout<<endl;
    cout<<"Stable"<<endl;
    rep(i,n){
        cout<<c[i];
        if(i<n-1) cout<<' ';
    }
    cout<<endl;
    bool ifstable=true;
    rep(i,n) if(b[i]!=c[i]) ifstable=false;
    if(ifstable) cout<<"Stable"<<endl;
    else cout<<"Not stable"<<endl;
    return 0;
}


Measured memory_bytes: 3184
import java.io.*;
import java.util.*;
import java.math.*;
import java.util.regex.Pattern;
class Main
{
		// your code goes here
		public static void main(String args[])
		{
                   // Comparator cmprtr=null;
                   String s;int a=0,b=0;
                   Scanner sc=new Scanner(System.in);
                   s=sc.next();
                   String s1[]=s.split("");
                   for(int i=0;i<3;i++)
                   {
                       if(s1[i].equals("A"))
                       {
                           a++;
                       }
                       else
                       {
                           b++;
                       }
                   }
                   if(a>0 && b>0)
                   {
                       System.out.print("Yes");
                   }
                   else
                   {
                       System.out.println("No");
                   }
                }}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define MAX 1e6
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int main() 
{
	string s;
	cin>>s;
	if(s[2] == s[3] && (s[4] == s[5])) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}  


Measured memory_bytes: 256
#include <stdio.h>

int main (void){

int n,i,a[10000],max,min;

long int totall=0;

scanf("%d",&n);

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

scanf("%d",&a[i]);

}

max=min=a[0];

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

if(max<a[i]){

max=a[i];

}

if(min>a[i]){

min=a[i];

}

totall+=a[i];

}

printf("%d %d %ld\n",min,max,totall);

return 0;

}

Measured memory_bytes: 636
#include <bits/stdc++.h>
#define int long long
#define ff first
#define dd second
#define mp make_pair
#define pb push_back
#define pp pair<int,int>
#define N 200007 // check
#define M 5007
#define K 61
#define endl "\n"
using namespace std;

int n, m;
int A[N];
int B[N];

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin >> n >> m;
    for(int i = 0; i < n; ++i) {char znak; cin >> znak; A[i] = znak-'a';}
    for(int i = 0; i < m; ++i) {char znak; cin >> znak; B[i] = znak-'a';}

    int aa = n/__gcd(n,m);
    int bb = m/__gcd(n,m);

    for(int i = 0;  i*aa < n and i*bb < m; ++i) {
        if(A[i*aa] != B[i*bb]) {
            cout << -1 << endl; exit(0);
        }
    }

    cout << (n*m/__gcd(n,m)) << endl;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

        ll ans = 0;
        for (int i = 0; i <= n; i++) {
                if (i % 3 && i % 5) ans += i;
        }

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define N 200006
#define mo 1000000007
using namespace std;
typedef pair<int,int> qwq;
int n,a,b,ans,h[N];
inline int read()
{
	int x=0,c=getchar(),f=1;while(c<'0'||c>'9')f=(c=='-'?-f:f),c=getchar();
	while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+c-48,c=getchar();return f>0?x:-x;
}
void print(int x)
{
	if(x>9LL)print(x/10LL);putchar(x%10+48);
}
bool wk(int x)
{
	long long t=0;
	for(int i=1;i<=n;i++)
		if(1LL*h[i]>1LL*x*b)t+=1LL*(h[i]-x*b)/(a-b)+(bool)(1LL*(h[i]-x*b)%(a-b));
	return t<=1LL*x;
}
int main()
{
	n=read();a=read();b=read();
	for(int i=1;i<=n;i++)h[i]=read();
	int l=1,r=1000000000;
	while(l<=r){
		int mid=(l+r)>>1;
		if(wk(mid))ans=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
#define INF (1e9)

vector<bool> isPrime;
vi prime;
void calcPrime(ll max) {
  isPrime = vector<bool>(max + 1, true);
  isPrime[0] = false;
  isPrime[1] = false;
  for (ll i = 4; i <= max; i += 2)
    isPrime[i] = false;
  for (ll i = 3; i * i <= max; i += 2) {
    if (!isPrime[i]) continue;
    for (ll j = i * i; j <= max; j += i)
      isPrime[j] = false;
  }

  prime = vi(0);
  for (int i = 0; i < max + 1; i++) {
    if (isPrime[i]) prime.push_back(i);
  }
}

bool isPrimeFunc(ll x) {
  if (x < 2) return false;
  for (ll p : prime) {
    if (x % p == 0) return false;
    if (p * p > x) break;
  }
  return true;
}

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

  if (N == 1) {
    cout << 0 << endl;
    return 0;
  }

  calcPrime(1e7);

  ll ans = 0;
  for (ll p : prime) {
    ll cnt = 0;
    while (N % p == 0 && N > 0) {
      N /= p;
      cnt++;
    }
    ll a = 1;
    while (cnt >= a * (a + 1) / 2) {
      ans++;
      a++;
    }
  }
  if (isPrimeFunc(N)) ans++;

  cout << ans << endl;
}


Measured memory_bytes: 12856
N, X, Y = map(int,input().split())
G = [k for k in range(N)]
G[Y-1] = G[X-1] + 1
dx = [abs(X-1-k) for k in range(N)]
dy = [abs(Y-1-k) for k in range(N)]

ans = [[10**9]*N for l in range(N)]
for k in range(N):
    d = [10**9]*N
    for l in range(N):
        d[l] = min(abs(k-l),abs(X-1-k)+dy[l]+1,abs(Y-1-k)+dx[l]+1)
    for l in range(N):
        ans[k][l] = min(ans[k][l],d[l])
d = [0]*(N-1)
for k in range(N-1):
    for l in range(k+1,N):
        d[ans[k][l]-1] += 1
for e in d:
    print(e)


Measured memory_bytes: 82396
Program ex1;
var
  i,len:longint;
  s:string;
 begin
   readln(s);len:=length(s);
   for i:=len downto 1 do
   if s[i]='F' then
   if (pos('C',s)<>0) and (pos('F',s)<>0) and (pos('C',s)<i) then 
   begin
     writeln('Yes');
     halt;
   end;
   writeln('No'); 
 end.

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

using namespace std;

// MACROS

#define ll long long
#define ull unsigned long long
#define ld long double

#define vi vector<int>
#define vll vector<ll>
#define vld vector<ld>
#define u_s unordered_set

#define pii pair<int,int>
#define pll pair<ll,ll>

#define FOR(i, n) for (ll (i) = 0; i < n; i++)
#define FORN(i, a, b) for (ll (i) = a; i < b; i++)
#define FORE(i, l) for (auto (i) : l)

#define pb push_back
#define pob pop_back
#define emp emplace

#define in(n) cin >> (n);
#define debug(n) cout << #n << ": " << n << '\n';

// FUNCTIONS

template< typename T >
inline T gcd(T a, T b) { if (b) return gcd(b, a % b); return a; }

template< typename T >
inline T ext_gcd(T a, T b, T & x, T & y) { if (a == 0) { x = 0; y = 1; return b; } T x1, y1; T g = ext_gcd(b % a, a, x1, y1); x = y1 - (b / a) * x1; y = x1; return g; }

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    	
        string s;
        cin >> s;
    ll n = s.size();
    ll c = 0;
    FOR(i, n / 2) if (s[i] != s[n - i - 1]) c++;
    cout << c << '\n';
}



Measured memory_bytes: 256
from itertools import combinations
X = int(input())
l = [(0,0)]
for i in range(1,121):
    a = pow(i,5)
    l.append((a,i))
    l.append((-a,-i))
for x in combinations(l,2):
    if abs(x[0][0]-x[1][0]) == X:
        if x[0][0]-x[1][0] > 0:
            ans = [x[0][1],x[1][1]]
        else:
            ans = [x[1][1],x[0][1]]
        break
print(*ans)

Measured memory_bytes: 9072
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rfor(i, a, b) for(int i = a; i < (int)b; i++)
#define all(ary) (ary).begin(), (ary).end()
#define debug(x) cerr << #x << ": " << x << '\n'
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
using namespace std;
using v = vector<int>;
using ll = long long;
template <class T = int> T in(){ T x; cin >> x; return (x);}

int main(int argc, char *argv[]){
    int n, k, x, y; cin >> n >> k >> x >> y;
    if(n <= k){
        cout << n*x << endl;
    }else{
        cout << k*x + (n-k)*y << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//Bismillahir Rahmanir Raheem
//#include<bits/stdc++.h>
#include<iostream>
#include<numeric>
#include<iomanip>
#include<stdlib.h>
#include<queue>
#include<map>
#include<unordered_map>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string>
#include<sstream>
#include<string.h>
#include<deque>
#include<set>
using namespace std;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
typedef pair<int, int> pii;
#define FF first
#define SS second
#define MP make_pair
#define mxN (int)2e5 + 2
#define sz(n) (int)(n).size()
#define fasterIO ios::sync_with_stdio(0); cin.tie(0);
ll gcd(ll a, ll b)
{
    if(b == 0LL) return a;
    return gcd(b, a % b);
}
ll bigmod(ll a, ll b, ll mod)
{
    if(b == 0LL) return 1LL;
    ll sq = bigmod(a, b/2LL, mod);
    sq = (sq * sq) % mod;
    if(b&1LL) return (sq * (a%mod)) % mod;
    return sq;
}
vi primes;
vi sieve(const int n)
{
    vi primes(n+1, 0);
    primes[1] = 1;
	for (int p = 2; p*p <= n; p++)
    {
        if (!primes[p])
        {
            for(int i = p*p; i <= n; i += p)
                primes[i] = p;
        }
    }
  	for(int i = 2; i <= n; i++)
        if(!primes[i]) primes[i] = i;
    return primes;
}
map<int, int> getDivs(int x)
{
    map<int, int> divs;
    while(x > 1)
    {
        int div = primes[x];
        int cnt = 0;
        while(x%div == 0){
            x /= div;
            cnt++;
        }
        divs[div] = cnt;
    }
    return divs;
}

#define SIZE 15000005
#define INF 1000000000

void solve()
{
    int n;
    cin >> n;
    cout << 1-n << endl;
}
int main()
{
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
    return 0;
}



Measured memory_bytes: 3160