akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int a = in.nextInt();
        int b = in.nextInt();

        out.println((int) Math.ceil((double) (b - 1) / (double) (a - 1)));
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }

}


Measured memory_bytes: 22100
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#define INF 100000000000LL
using namespace std;

int main()
{
	int n;
	long long int a[300000], ans[100001], amax;
	ans[0]=0;
	multiset<long long int> a1, a2;
	scanf("%d", &n);
	for(int i=0; i<3*n; i++){
		scanf("%lld", &a[i]);
		if(i<n){
			ans[0]=ans[0]+a[i];
			a1.insert(a[i]);
		}
		if(i>=n){
			a2.insert(a[i]);
		}
	}
	auto itr2=a2.begin();
	for(int i=0; i<n; i++){
		ans[0]=ans[0]-*itr2;
		if(i!=n-1){
			itr2++;
		}
	}
	auto itr1=a1.begin();
	for(int i=0; i<n; i++){
		a1.insert(a[n+i]);
		if(*itr1<a[n+i]){
			ans[i+1]=ans[i]-*itr1+a[n+i];
			itr1++;
		}else{
          ans[i+1]=ans[i];
        }
		auto itr20=a2.upper_bound(a[n+i]);
		itr20--;
		if(*itr2>a[n+i]){
			itr2++;
			ans[i+1]=ans[i+1]+a[n+i]-*itr2;
			a2.erase(itr20);
		}else if(itr2==itr20){
			itr2=a2.erase(itr20);
			ans[i+1]=ans[i+1]+a[n+i]-*itr2;
		}else{
			a2.erase(itr20);
		}
	}
	for(int i=0; i<=n; i++){
		if(i==0){
			amax=ans[0];
		}else if(amax<ans[i]){
			amax=ans[i];
		}
	}
	printf("%lld\n", amax);
	return 0;
}

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

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)


//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

bool same(int x) {
	int a = x / 100;
	int b = (x / 10) % 10;
	int c = x % 10;

	return a == b&&b == c&&c == a;
}

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

	for (int i = n; i <= 999; i++) {
		if (same(i)) {
			cout << i << endl;
			return 0;
		}
	}

	return 0;
}

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

int main(){
  int N,D,X;
  cin >> N >> D >> X;
  int ans=X;
  vector<int> A(N);
  for(int i=0;i<N;++i) cin >> A.at(i);
  for(int i=0;i<N;++i){
    for(int j=0;j*A.at(i)+1<=D;++j){
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int A, B;
    cin >> A >> B;
    int ans;
    bool check = true;
    for (int i = floor(A * 12.5); i < (B + 1) * 10; i++) {
        if (floor(i * 0.08) == A && floor(i * 0.1) == B) {
            ans = i;
            check = false;
            break;
        }
    }
    if (check) {
        cout << -1 << endl;
    }
    else {
        cout << ans << endl;
    }
}

Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

int main()
{
    string s1,s2;
    while(cin>>s1>>s2)
    {
        int ans=0;
        vector<vector<int> >dp(s1.size(),vector<int>(s2.size(),0));
        REP(i,s2.size())if(s1[0]==s2[i])dp[0][i]=1;
        rep(i,1,s1.size())
        {
            REP(j,s2.size())
            {
                if(s1[i]==s2[j]){if(j==0)dp[i][j]++;else dp[i][j]+=dp[i-1][j-1]+1;}
                if(dp[i][j]>ans)ans=dp[i][j];
            }
        }
        cout<<ans<<endl;
    }
    
}



Measured memory_bytes: 65432
package main

import (
	"fmt"
)

func main() {
	var x, y, z int
	fmt.Scanf("%d %d %d", &x, &y, &z)

	answer(x, y, z)
}

func answer(x int, y int, z int) {
	fmt.Printf("%d %d %d", z, x, y)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll k,a,b;cin>>k>>a>>b;
    rep(i,a,b+1){
        if(i%k==0){
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
typedef long long int ll;
#define rep(i,n) for (int i = 0; i< (n); i++)
#define Rep(i,n,m) for (int i = (n); i< (m); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
using namespace std;

int main() {
    int k;
    cin>>k;
    
    vector<int> p{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};
    
    
    
    cout<<p[k-1]<<endl;
    return 0;
}


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

string srep(string x, int y){
    string s = "";
    rep(i, y) s += x;
    return s;
}


int main(){
    int n, m;
    cin >> n >> m;
    vector<int> ans(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        ans[a-1]++;
        ans[b-1]++;
    }
    rep(i, n){
        cout << ans[i] << endl;
    }
}


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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int a,b,c,d, A[100], B[100], C[100][100], D[100][100][100];
string s, t, r;




int main(){
	cin >> s;
	bool check = true;
	if(s[0] != 'A') {
		check = false;
		// cerr << 1;
	}

	int cnt = 0;
	for(int i = 2; i < s.size()-1; i++){
		if(s[i] == 'C') cnt++;
	}
	if(cnt != 1){
		check = false;
		// cerr << 2;
	}

	for(int i = 0; i < s.size(); i++){
		if(s[i] != 'A' && s[i] != 'C'){
			if(!('a' <= s[i] && s[i] <= 'z')){
				check = false;
				// cerr << 3;
			}
		}
	}

	if(check) cout << "AC" << endl;
	else cout << "WA" << endl;

	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var a, b int
	con.Scan(&a, &b)
	if a+b < 10 {
		con.Println(a + b)
	} else {
		con.Println("error")
	}
	return nil
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        if (a % 2 == 0 && (a % 3 != 0 && a % 5 != 0)) {
            cout << "DENIED\n";
            return 0;
        }
    }
    cout << "APPROVED\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define repc2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define inf 2e9
#define linf 9000000000000000000ll
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int n, m;
struct edge {
    int to;
    edge(int to) : to(to) {}
};
vector<edge> G[200009];
int color[200009];

int dfs(int s, int col) {
    int cnt = 1;
    color[s] = col;
    for (auto &e : G[s]) {
        if (color[e.to] == -1) {
            cnt += dfs(e.to, col);
        }
    }
    return cnt;
}
int main() {
    cin >> n >> m;
    int a, b;
    rep(i, m) {
        scanf("%d%d", &a, &b);
        a--, b--;
        G[a].push_back(edge(b));
        G[b].push_back(edge(a));
    }
    memset(color, -1, sizeof(color));
    int ans = 0;
    int col = 0;
    rep(i, n) {
        if (color[i] == -1) {
            ans = max(ans, dfs(i, col++));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 24712
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x_max=max(x)
y_min=min(y)

if (y_min-x_max > 0) and (Y-X > 0) and (X<y_min) and (x_max<Y):
    print("No War")
else:
    print("War")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll dp[200200];
int main(){
    fast_io

    int n, k;
    cin>>n>>k;
    vector<ll> x(n);
    rep(i,n) cin>>x[i];
    ll ans=100100100100;

    for(int i=0;i<n-k+1;i++){
        ll l=x[i];
        ll r=x[i+k-1];
        ans=min(ans, abs(l)+abs(r-l));
        ans=min(ans, abs(r)+abs(r-l));
    }
    cout<<ans<<endl;

    return 0;

}


Measured memory_bytes: 1024
s = input()
t = input()
n = len(s)
m = len(t)

ans = n
for i in range(n-m+1):
    ts = s[i:i+m]
    tmp = 0
    for tss,tt in zip(ts,t):
        if tss != tt:
            tmp += 1
    ans = min(ans,tmp)

print(ans)


Measured memory_bytes: 67820
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; cin >> n;
    rep(i,n/4){
        rep(j,n/7){
            if(n == 4*i + 7*j) {
                Yes;
                return 0;
            }
        }
    }
    No;

    return 0;
}



Measured memory_bytes: 256
K, N = map(int, input().split())
A_list = sorted(list(map(int, input().split())))
M = 0

for n, A in enumerate(A_list):
    if (n != (N - 1)) and (n != 0):
        D  = max(abs(A - A_list[n - 1]), abs(A - A_list[n + 1]))
    elif n == (N - 1):
        D = abs(A - A_list[n - 1])
    else:
        D = max(abs(A +(K - A_list[n - 1])), abs(A - A_list[n + 1]))
    if M < D:
        M = D


print(K - M)




Measured memory_bytes: 26444
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int main()
{
    int a, b;
    cin>>a>>b;
    Yes(a * b % 2 == 1);

    return 0;
}


Measured memory_bytes: 256
A,B,C,D = map(int, input().split())

def gcd(a, b):
  while b:
    a, b = b, a % b
  return a

# 範囲内の最も小さい数値
def cnt(inp):
  min_ = inp * ((A-1) // inp + 1)
  max_ = inp * (B // inp)
  num = (max_ - min_) // inp + 1
  return(num)

Ccnt = cnt(C)
Dcnt = cnt(D)
lcm = C*D // gcd(C,D)
CDcnt = cnt(lcm)

print((B+1-A)-Ccnt-Dcnt+CDcnt)


Measured memory_bytes: 3060
#import math
#import itertools
#import numpy as np
#from collections import deque
# sys.setrecursionlimit(10 ** 6)
#mod = 10 ** 9 + 7
#INF = 10 ** 9
#PI = 3.14159265358979323846

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    A=LIST()
    flg=True
    la=len(A)
    bool=[False]*(n+1)
    B=[]
    for i in range(la-1,-1,-1):
        a=A[i]
        s=i+1
        temp=0
        for j in range(n//s+1):
            if j==0:
                continue
            if bool[j*s]:
                temp+=1
        
        if temp%2!=a:
            B.append(s)
            bool[s]=True
    
    B=sorted(B)
    print(len(B))
    if len(B)!=0:
        print(*B)

            

if __name__=='__main__':
    do()

Measured memory_bytes: 18344
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    double n=0;
    cin>>s;
    for(int i=0;i<s.size();i++){
        n=n*10+(s[i]-'0');
    }
    cin>>s;
    for(int i=0;i<s.size();i++){
        n=n*10+(s[i]-'0');
    }
    if(sqrt(n)==floor(sqrt(n))){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    readLine()?.split(" ")?.let {
        val n = it[0].toInt()
        val x = it[1].toInt()
        val t = it[2].toInt()
        val count = (n / x) + if (n % x == 0) {
            0
        } else {
            1
        }
        val time = t * count
        println(time)
    }
}

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

int main()
{
    long long n, a, b;
    cin >> n >> a >> b;

    cout << (a > b || (n == 1 && a - b) ? 0 : (b - a) * (n - 2) + 1) << endl;

    return 0;
}


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

using namespace std;

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

  int R, C, k;
  cin >> R >> C >> k;

  vector<string> s(R);
  for (int r = 0; r < R; r++) cin >> s[r];

  int ans = (int) 1e9;
  // try all possible subset of rows as cut points
  for (int t = 0; t < (1 << (R - 1)); t++) {
    vector<int> sum(R);
    int cuts = __builtin_popcount(t);
    int idle = 0;

    for (int c = 0; c < C; c++) {
      int ptr = 0;
      for (int r = 0; r < R; r++) {
        sum[ptr] += (int) (s[r][c] - '0');
        if (t & (1 << r)) {
          ptr = r + 1;
        }
      }
      bool bad = false;
      for (int r = 0; r < R; r++) {
        if (sum[r] > k) {
          bad = true;
          ++idle;
          --c;
          ++cuts;
          fill(sum.begin(), sum.end(), 0);
          break;
        }
      }
      if (!bad) {
        idle = 0;
      }
      if (idle >= 2) {
        cuts = ans;
        break;
      }
    }
    ans = min(ans, cuts);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#142d
import collections

A,B = map(int, input().split()) #K<=100

#正整数 A,Bが与えられます。
#A と B の正の公約数の中からいくつかを選びます。
#ただし、選んだ整数の中のどの異なる 2つの整数についても互いに素でなければなりません。
#最大でいくつ選べるでしょうか。
#整数 x,y が互いに素であるとは、x,y の正の公約数が 1 のみであることをいいます。

#https://note.nkmk.me/python-prime-factorization/
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

pfa = collections.Counter(prime_factorize(A))
#print(set(pfa.keys()))
pfb = collections.Counter(prime_factorize(B))
#print(set(pfb.keys()))
print(1+len(set(pfa) & set(pfb)))

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

int main(void){
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	for(auto &x : s){
		cin >> x;
	}
	vector<vector<int> > a(h+2, vector<int>(w+2, 0)), b(h+2, vector<int>(w+2, 0));
	for(int i = 1; i < h+1; ++i){
		for(int j = 1; j < w+1; ++j){
			if(s[i-1][j-1] != '#'){
				a[i][j] = a[i][j-1] + 1;
			}
		}
		for(int j = w; j > 0; --j){
			if(a[i][j] != 0 && a[i][j+1] != 0){
				a[i][j] = a[i][j+1];
			}
		}
	}
	for(int j = 1; j < w+1; ++j){
		for(int i = 1; i < h+1; ++i){
			if(s[i-1][j-1] != '#'){
				b[i][j] = b[i-1][j] + 1;
			}
		}
		for(int i = h; i > 0; --i){
			if(b[i][j] != 0 && b[i+1][j] != 0){
				b[i][j] = b[i+1][j];
			}
		}
	}
	int ans = 0;
	for(int j = 1; j < w+1; ++j){
		for(int i = 1; i < h+1; ++i){
			ans = max(ans, a[i][j] + b[i][j] - 1);
		}
	}
	cout << ans << endl;
	return 0;
}


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

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

  for (int i = 0; i <= N; i++) {
    if (10000 * i > Y) break;
    for (int j = 0; j <= N; j++) {
      if (10000 * i + 5000 * j + 1000 * (N - i - j) == Y && N - i - j >= 0) {
        cout << i << " " << j << " " << N - i - j << endl;
        return 0;
      }
    }
  }

  cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int main( void )
{
	int n, s;
	short map[20000];
	while(cin >> n >> s, n | s) {
		for(int i=0; i < n; ++i) cin >> map[i];
		sort(map, map+n);
		int count = 0;
		for(int i=0; i < n; ++i)
			for(int j=i+1; j < n; ++j) {
				if(map[i] + map[j] > s) {
					count += n - j;
					break;
				}
			}
		cout << count << endl;
	}
	return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n, x;
    cin >> n >> x;
    vector< int > v(n);
    for( int i = 0; i < n; ++i ) {
        cin >> v[i];

    }
    sort(all(v));

    int g = abs(v[0] - x);
    for( int i = 0; i < n - 1; ++i ) {
        g = __gcd(g, v[i + 1] - v[i]);

    }
    cout << g << endl;
    return 0;
}


Measured memory_bytes: 640
def read():
    return int(input())


def readlist():
    return list(map(int, input().split()))


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


N = read()
A = readlist()

cnt = 0
for a in A:
    while a % 2 == 0:
        a = a // 2
        cnt += 1

print(cnt)


Measured memory_bytes: 4148
s = str(input())

# ans = s.count('PD')
# ans += s.count('D')

# for i in range(len(s)):
#     # print(s[i])
#     if s[i] == '?':
#         if s[i + 1] == '?' or s[i + 1] == 'D':
#             s[i] = 'P'
#         else:
#             s[i] = 'D'


s_list = list(s)


for i in range(len(s)):
    if s_list[i] == '?':
        # 末尾がnullの時も考える
        # if s_list[i] == s_list[-1]:
        #     s_list[i] = 'D'
        # elif s_list[i + 1] == '?' or s_list[i + 1] == 'D':
        #     s_list[i] = 'P'
        # else:
        #     s_list[i] = 'D'
        s_list[i] = 'D'

str_change = "".join(s_list)


# ans = str_change.count('PD')
# ans += str_change.count('D')

print(str_change)

Measured memory_bytes: 10804
#include <bits/stdc++.h>
#define pb push_back
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define cps CLOCKS_PER_SEC
#define tests(t) int t; cin >> t; while(t--)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define ll long long
#define ld double
#define eb emplace_back
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define fi first
#define se second
#define bitcount(x) __builtin_popcount(x)
#define PI acos(-1.0)
#define EPS 1e-9
#define mod 1000000007
#define bit(x) (1 << x)
#define par pair<int,int>
#define maxn 200005

using namespace std;
///All indexing is 0-based
using namespace __gnu_pbds;
template<class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
///methods: find_by_order(k); & order_of_key(k);
///To make it an ordered_multiset, use pairs of (value, time_of_insertion)
///to distinguish values which are similar

int N,M;
char s[maxn];

bool cumpl()
{
    for(int i=1;i<=N/2;i++)
        if(s[i]!=s[N-i+1])
            return 0;
    int fin = (N-1)/2;
    for(int i=1;i<=fin/2; i++ )
        if(s[i]!=s[fin-i+1])
            return 0;
    int ini = (N+3)/2 ;
    fin = N;
    for(int i=ini;i<=(fin+ini)/2;i++)
        if(s[i]!=s[fin-i+1])
            return 0;
    return 1;
}

int main()
{
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> (s+1);
    N=strlen(s+1);

    if(cumpl())
        cout << "Yes\n";
    else
        cout << "No\n";


}


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

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

using ll = long long;
using namespace std;

ll
attack (
    ll h)
{
    return 1 + (h == 1 ? 0 : 2 * attack(h / 2));
}

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

    cout << attack(h) << endl;
}


Measured memory_bytes: 256
fn read_lines() -> Vec<String> {
    use std::io::Read;

    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    return buf.lines().map(|e| e.to_string()).collect::<Vec<_>>();
}

fn main() {
    let input = read_lines();
    let n: usize = input[0].parse().unwrap();
    let input_series: Vec<usize> = input[1].split_whitespace().map(|e| e.parse().unwrap()).collect::<Vec<usize>>();

    // カウンタ配列を生成
    let k = 10_000;
    let mut counting: Vec<usize> = vec![0; k];
    for e in &input_series { // O(n)
        counting[*e] += 1;
    }
    for i in 1..k { // O(k)
        counting[i] += counting[i-1];
    }

    // カウンタ配列をもとに出力配列を作成
    let mut output_series = vec![0; n];
    for j in (0..n).rev() { // O(n)
        let target_elem = input_series[j];
        let output_position = counting[target_elem] - 1;
        output_series[output_position] = target_elem;
        counting[input_series[j]] -= 1;
    }

    println!("{}", output_series.into_iter().map(|u| format!("{}", u)).collect::<Vec<_>>().join(" "));
}



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

using namespace std;


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

    vector<int> dp(k + 1, 0);
    for(int i = 0;i<=k;i++) {
        for(auto a : A) {
            if(i >= a && !dp[i - a]) {
                dp[i] = 1;
            }
        }
    }
    //for(auto i : dp) cout<<i<<" ";
    cout<<(dp[k] ? "First":"Second")<<'\n'; 
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
int binary_search2(vector<int> &l,int key){
  int left=0;
  int right=l.size()-1;
  int mid;
  if(l[right]<key)return right;
  else{
  while(right-left>1){
    mid=(right+left)/2;
    if(l[mid]>=key)right=mid;
  else left=mid;
  }
  }
return left;
}
int main(){
  int n;
  cin>>n;
  vector<int> l(n);
  for(int i=0;i<n;i++){
    cin>>l[i];
  }
  sort(l.begin(),l.end());
  int key;
  int sum=0;
  int tmp;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      int buf=l[i]+l[j];
      tmp=0;
      if(binary_search2(l,buf)>j){
	//	if(l[n-1]>=buf)tmp=1;
      sum+=binary_search2(l,buf)-j+tmp;
	}
    }
    //    cout<<l[i]<<endl;
  }
  cout<<sum<<endl;
  //  cout<<binary_search2(l,3)<<endl;
  return 0;
}


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

using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

int main(){
  int n; cin >> n;
  vector<int> nums(n);
  rep_i(i, n){
    cin >> nums[i];
  }
  int q; cin >> q;
  int b, e, t;
  rep_i(i, q){
    cin >> b >> e >> t;
    // scanf("%d %d",&left,&right);
		// reverse(V.begin()+left,V.begin()+right);
    // reverse(&nums[b], &nums[e]);
    swap_ranges(nums.begin() + b, nums.begin() + e, nums.begin() + t);
  }
  for (vector<int>::iterator itr = nums.begin(); itr != nums.end(); itr++){
    if(itr == nums.begin()){
      cout << *itr;
      continue;
    }
    cout << " " << *itr;
  }
  cout << endl;
}


Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;

#define PI 3.14159265358979323846264338327950L

int res;

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int X;
    cin >> X;
    int prime[100000];
    prime[0] = 2;
    int cnt = 1;
    int number = 3;
    bool flag = true;
    bool isPrime = true;
    if (X==2){
        cout << 2 << endl;
        return 0;
    }
    while (flag)
    {
        for(int i = 0; i < cnt; i++ )
        {
            if(number % prime[i] == 0){
                isPrime = false;
                break;
            }
        }
        if(isPrime == true){
            prime[cnt] = number;
            if(X<=number){
                res = number;
                flag = false;
            }
            cnt++;
        }
        number++;
        isPrime = true;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
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")
    };
}

#[allow(non_snake_case)]
fn main() {
    input!{
        A: usize,
        B: usize,
    };

    println!("{}", if A >= 13 {B} else if A >= 6 {B/2} else {0});

}



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

int main(){
	int a, b;
	cin >> a >> b;
	cout << a * b - (a + b - 1) << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

vvi G = vv(200001, 0, 0, int);
std::vector<int> w(200001, 0);
std::vector<int> c(200001, 0);
std::vector<int> ok(200001, 1);
void dfs(int from, int now, int mode){
  if(mode==-1&&c[now]>=2) {
    ok[from] = 0;
    return;
  }
  /*
  std::cout << now  << " " << from<< '\n';
  for(int i=1;i<=6;i++) std::cout << w[i] << " ";
  std::cout << '\n';
  */
  if(mode==1){
    if(w[now]==1){
      std::cout << "First" << '\n';
      exit(0);
    }
    w[now] = 1;
    for(int i=0;i<G[now].size();i++){
      c[G[now][i]]--;
    }
  }
  for(int i=0;i<G[now].size();i++){
    if(from==G[now][i]||ok[G[now][i]]==0) continue;
    dfs(now, G[now][i], -mode);
  }
}
int main(int argc, char const *argv[]) {
  int N, a, b;
  std::cin >> N;
  for(int i=0;i<N-1;i++){
    std::cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for(int i=1;i<=N;i++) c[i] = G[i].size();
  for(int i=1;i<=N;i++) if(G[i].size()==1) dfs(-1, i, -1);
  std::cout << "Second" << '\n';
  return 0;
}


Measured memory_bytes: 12416
N, M, C = map(int, input().split())
*B, = map(int, input().split())
AM = [list(map(int, input().split())) for _ in range(N)]

ans = 0
for am in AM:
    chk = 0
    for i in range(M):
        chk += am[i] * B[i]
    if chk + C > 0:
        ans += 1
print(ans)

Measured memory_bytes: 3060
class MaximumHeap
  attr_accessor :tree

  def initialize
    @tree = [nil]
    @heapsize = 0
  end

  def insert(key)
    @heapsize += 1
    @tree[@heapsize] = -Float::INFINITY
    heap_increase_key(@heapsize, key)
  end

  def parent(i)
    i / 2
  end

  def heap_increase_key(i, key)
    raise Exception.new if key < @tree[i]
    @tree[i] = key
    while parent(i) > 0 && i > 0 && @tree[parent(i)] < @tree[i]
      @tree[parent(i)], @tree[i] = @tree[i], @tree[parent(i)]
      i = parent(i)
    end
  end

  def heap_extract_max
    raise Exception.new if @heapsize < 1
    max = @tree[1]
    @tree[1] = @tree[@heapsize]
    @tree.delete_at(@heapsize)
    @heapsize -= 1
    max_heapify(1)
    return max
  end

  def max_heapify(i)
    l = i * 2
    r = i * 2 + 1
    if l <= @heapsize && @tree[l] > @tree[i]
      largest = l
    else
      largest = i
    end
    if r <= @heapsize && @tree[r] > @tree[largest]
      largest = r
    end

    if largest != i
      @tree[i], @tree[largest] = @tree[largest], @tree[i]
      max_heapify(largest)
    end
  end
end

mh = MaximumHeap.new
while ( line = gets.strip ) != "end"
  cmd, key = line.split
  case cmd
  when "insert"
    mh.insert(key.to_i)
  when "extract"
    puts mh.heap_extract_max
  end
end

Measured memory_bytes: 16692
#include<iostream>
using namespace std;
int main(){
    int H, W;
    
    while(1){
        cin >> H >> W;
        
        if((H == 0) && (W == 0))break;
        
        
        for(int i = 0; i < W; i++){
            cout << "#";
        }
        
        cout << endl;
        
        for(int i = 0; i < H-2; i++){
            cout << "#";
            
            for(int i = 0; i < W-2; i++){
                cout << ".";
            }   
            cout << "#";
            
            cout << endl;
        }
            
        for(int i = 0; i < W; i++){
            cout << "#";
        }
        
    cout << endl;
    cout << endl;
    
    }
}


Measured memory_bytes: 3080
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
#define N 500050
ll po(ll x,ll y){
	ll res=1;
	for(;y;y>>=1){
		if(y&1)res=res*x%mod;
		x=x*x%mod;
	}
	return res;
}
ll inv[N],fac[N],ivf[N];
ll C(ll n,ll k){
	return fac[n]*ivf[n-k]%mod*ivf[k]%mod;
}
ll H(ll n,ll k){
	return C(n+k-1,k);
}
int main(){
	for(ll i=1;i<N;i++)inv[i]=po(i,mod-2);
	fac[0]=ivf[0]=1;
	for(ll i=1;i<N;i++){
		fac[i]=fac[i-1]*i%mod;
		ivf[i]=ivf[i-1]*inv[i]%mod;
	}
	ll n,k;
	cin>>n>>k;
	ll ans=0;
	for(ll x=0;x<=min(k,n-1);x++){
		ans=(ans+H(n-x,x)*C(n,x))%mod;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 11904
S = input()

ans = 1
looking = S[0]
before = False

for i in range(1, len(S)):
    if before:
        looking = S[i - 1] + S[i]
        before = False
        ans += 1
        continue

    if looking == S[i]:
        before = True
    else:
        ans += 1
        looking = S[i]
print(ans)



Measured memory_bytes: 41308
#include <stdio.h>
int main(){
    int x,y,min,max;
    scanf("%d%d",&x,&y);
    min=x<y?x:y;
    max=x>y?x:y;
    x=min;
    y=max;
    int a[7]={1,3,5,7,8,10,12};
    int b[4]={4,6,9,11};
    if(x==2||y==2){
        printf("No\n");
        return 0;
    }
    for(int i=0;i<4;i++){
        if(b[i]==x){
            for(int j=i;j<4;j++){
                if(b[j]==y) {
                    printf("Yes\n");
                    return 0;
                }
            }
        }
    }
    for(int i=0;i<7;i++){
        if(a[i]==x){
            for(int j=i;j<7;j++){
                if(a[j]==y) {
                    printf("Yes\n");
                    return 0;
                }
            }
        }
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main()
{
    string ar[3]={"Sunny", "Cloudy", "Rainy"};
    string str;
    getline(cin,str);
    if(ar[0]==str)
        cout << "Cloudy";
    else if (ar[1]==str)
        cout << "Rainy";
    else
        cout << "Sunny";

return 0;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int A,B;

int main(){
    cin>>A>>B;
    if(abs(A-B)<=1)out(A+B);
    else out(max(A,B)*2-1);
}


Measured memory_bytes: 256
import kotlin.math.max

fun main(args: Array<String>) {
    val n = readInt()
    val a = readIntList()

    val num = MutableList(100002) { 0 }
    a.forEach { num[it]++ }
    var ans = 0
    for (i in 1..100000) {
        ans = max(ans, num[i - 1] + num[i] + num[i + 1])
    }
    println(ans)
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)

Measured memory_bytes: 52712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
ll a,b,c,ans;
int main(void){
    cin>>a>>b>>c;
    if(c-1<=a+b)ans+=c;
    else ans+=a+b+1;
    ans+=b;
    cout<<ans<<endl;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k,num[10];

int main()
{
	int i,j,a;
	
	scanf("%d %d",&n,&k);
	for(i=0;i<k;i++)
	{
		scanf("%d",&a);
		num[a] = 2;
	}
	
	int now,flag;
	while(1)
	{
		flag = 0;
		now = n;
	//	printf("n = %d\n",n);
		while(now > 0)
		{
			if(num[ now%10 ] == 2)
			{
				flag = 1;
				break;
			}
			now /= 10;
		}
		
		if(flag == 0)
		{
			printf("%d\n",n);
			break;
		}	
		n++;
	}
}

Measured memory_bytes: 3756
s=input()
t=input()
n=len(s)
m=len(t)
li=[]
for i in range(n-m+1):
  u=s[i:i+m]
  c=0
  for j in range(m):
    if u[j]!="?" and u[j]!=t[j]:
      c=1
      break
  if c==0:
    if i==0:
      v=t+s[i+m:]
    elif i==n-m:
      v=s[:i]+t
    else:
      v=s[:i]+t+s[i+m:]
    for k in range(n):
      if v[k]=="?":
        v=v[:k]+"a"+v[k+1:]
    li.append(v)
if li==[]:
  print("UNRESTORABLE")
else:
  li.sort()
  print(li[0])

Measured memory_bytes: 3064
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String[] str = {"","SAT","FRI","THU","WED","TUE","MON","SUN"};
    for(int i=0;i<=7;i++)if(str[i].equals(s)){
      System.out.println(i);
      return;
    }
  }
}


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

int main(){
  long long N; cin >> N;
  if(N%2==0){
    //ふつうに
    //明らかに5の倍数に制約を受ける
    //5の倍数は10の倍数の部分にのみ存在
    long long cnt=N/10;
    N/=10;
    
    while(N){
      cnt+=N/5;
      N/=5;
    }
    
    cout << cnt << endl;
  }else{
    //偶数がなく，おしまい
    cout << 0 << endl;
  }
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;


class BIT {
public:
  int n;
  vector<int> bit;

  BIT(int n_) {
    n = 1;
    while (n < n_) {
      n <<= 1;
    }
    bit.resize(n + 1);
  }

  // add v[a] + w
  void add(int a, int w) {
    a++;
    if (a == 0 || a > n)
      return;
    for (int x = a; x <= n; x += x & -x)
      bit[x] += w;
  }

  // [0, a)
  int sum(int a) {
    if (a == 0)
      return 0;
    int ret = 0;
    for (int x = a; x > 0; x -= x & -x)
      ret += bit[x];
    return ret;
  }
};

BIT r(202020);

struct N {
  ll c, a, b, val;
};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<N> ns(n);
  int last = -1;
  for (int i = 0; i < n; i++) {
    cin >> ns[i].c;
    if (ns[i].c == 1) {
      cin >> ns[i].a >> ns[i].b;
    } else {
    }
  }
  map<ll, int> mp;
  for (int i = 0; i < n; i++) {
    if (ns[i].c == 1) {
      mp[ns[i].a] = 0;
    }
  }
  int c = 0;
  vector<ll> inv(201010);
  for (auto &v : mp) {
    inv[c] = v.first;
    v.second = c++;
  }

  vector<ll> v;
  c = 0;
  ll base = 0;
  ll lnum = 0, rnum = 0, now = 0, x = 0, val = 0;
  map<ll, int> num;
  for (int i = 0; i < n; i++) {
    if (ns[i].c == 1) {
      r.add(mp[ns[i].a], 1);
      c++;
      base += ns[i].b;
      v.push_back(ns[i].a);
      num[ns[i].a]++;
      if (i == 0) {
        lnum = 0;
        rnum = 0;
        now = 1;
        x = ns[i].a;
        val = 0;
      } else {
        if (ns[i].a < x) {
          lnum++;
        } else if (ns[i].a == x) {
          now++;
        } else {
          rnum++;
        }
        val += abs(x - ns[i].a);
      }
    } else {

      ll li = 0, ri = 202020;
      ll aim = (c + 1) / 2;
      while (ri - li > 1) {
        ll m = (li + ri) / 2;
        if (r.sum(m) >= aim) {
          ri = m;
        } else {
          li = m;
        }
      }
      ll a = inv[li];
      if (a < x) {
        auto it = num.find(x);
        while (true) {
          if (it->first == a) break;
          it--;
          val -= lnum * abs(it->first - x);
          val += now * abs(it->first - x);
          val += rnum * abs(it->first - x);
          lnum -= it->second;
          rnum += now;
          now = it->second;
          x = it->first;
        }
        cout << a << " " << base + val << endl;
      } else if (a > x) {
        auto it = num.find(x);
        while (true) {
          if (it->first == a) break;
          it++;
          val -= rnum * abs(it->first - x);
          val += now * abs(it->first - x);
          val += lnum * abs(it->first - x);
          rnum -= it->second;
          lnum += now;
          now = it->second;
          x = it->first;
        }
        cout << a << " " << base + val << endl;
      } else {
        cout << a << " " << base + val << endl;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 24820
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll A, B, C, K;
int main(){
	scanf("%lld %lld %lld %lld", &A, &B, &C, &K);
	if(K & 1 ^ 1)	printf("%lld\n", A - B);
	else printf("%lld\n", B - A);
	return 0;
}

Measured memory_bytes: 256