akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DDisjointSetOfCommonDivisors solver = new DDisjointSetOfCommonDivisors();
        solver.solve(1, in, out);
        out.close();
    }

    static class DDisjointSetOfCommonDivisors {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long a = in.nextLong(), b = in.nextLong();
            long n = NumberTheory.gcd(a, b);

            for (long i = 2; i * i <= n; i++) {
                long d = i * i;
                while (n % d == 0) {
                    n /= i;
                }
            }

            if (n == 1) {
                out.println(1);
                return;
            }

            long answer = 2;
            for (long i = 2; i * i <= n; i++) {
                if (n % i == 0) {
                    answer++;
                    n /= i;
                }
            }

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }

    static class NumberTheory {
        public static long gcd(long a, long b) {
            long c;
            while (a != 0) {
                c = a;
                a = b % a;
                b = c;
            }
            return b;
        }

    }
}



Measured memory_bytes: 22484
/** 
 *                                                                   
 *   |    |                        ,   .              ,--.,--.,--.,--.
 *   |    |    ,---..    ,,---.    |   |,---..   .      -||  ||  ||  |
 *   |    |    |   | \  / |---'    `---'|   ||   |       ||  ||  ||  |
 *   `    `---'`---'  `'  `---'      |  `---'`---'    `--'`--'`--'`--'
 *                                   `                                
**/
#include <bits/stdc++.h>
using namespace std;

int n, m, dp[3005][3005];
string s, t;

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

	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	cin >> s >> t;
	n = s.size();
	m = t.size();

	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			if (i == 0 || j == 0) {
				dp[i][j] = 0;
			} else if (s[i - 1] == t[j - 1]) {
				dp[i][j] = dp[i - 1][j - 1] + 1;
			} else {
				if (dp[i - 1][j] > dp[i][j - 1]) {
					dp[i][j] = dp[i - 1][j];
				} else {
					dp[i][j] = dp[i][j - 1];
				}
			}
		}
	}

	string ans = "";
	int i = n, j = m;
	while (i > 0 && j > 0) {
		if (dp[i][j] == dp[i][j - 1]) {
			j--;
		} else if (dp[i][j] == dp[i - 1][j]) {
			i--;
		} else {
			ans = s[i - 1] + ans;
			i--; j--;
		}
	}

	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 35456
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    a,b,k=MI()
    taka=max(a-k,0)
    if taka:aoki=b
    else:aoki=max(0,b-(k-a))
    print(taka,aoki)
main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
typedef long long ll;

void solve() {
    string s;
    cin >> s;
    int buf = 15 - s.size();
    int cnt = buf;
    for(const auto &it: s) if(it == 'o') cnt++;
    string ans = (cnt >= 8) ? "YES" : "NO";
    cout << ans << endl;
}

int main() {
    solve();
    return 0;
}


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

int main(){
	string s,t;
	int i=0;
	cin>>s>>t;
	
	while(i<s.size()){
		if(s[i]!=t[i]){
			cout<<"No"<<endl;
			return 0;
		}
		else i++;
	}
	
	cout<<"Yes"<<endl;
	return 0;
} 

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

int main(){
   
    int N;
    cin>>N;
    vector<pair<string,pair<int,int>>> S(N);
    for(int i=0;i<N;i++){
        string a;
        int b;
        cin>>a>>b;
        S[i].first=a;
        S[i].second.first=-b;
        S[i].second.second=i+1;
    }
    sort(S.begin(),S.end());
    for(int i=0;i<N;i++){
        cout<<S[i].second.second<<endl;;
    }
}


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


class Monster
{
public:

    int hp;
    int ap;

    Monster(int hp, int ap)
    {
        this->hp = hp;
        this->ap = ap;

    }
};

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

    Monster *monsterT = new Monster(A, B);
    Monster *monsterA = new Monster(C, D);

    // 1 なら takahashi
    int turn = 1;
    while(true)
    {
        if(turn == 1)
        {
            monsterA->hp -= monsterT->ap;
        }
        else
        {
            monsterT->hp -= monsterA->ap;
        }

        if (monsterA->hp <= 0 || monsterT->hp <= 0)
        {
            break;
        }

        // turn change
        turn = 3 - turn;
    }

    delete monsterA;
    delete monsterT;

    if(turn == 1)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
#include<cmath>
#include<string>
#include<iomanip>
#include <numeric>
#include <limits>
using namespace std;
 
int main()
{
string a,b; cin>>a>>b;
int ab= stoi(a+b);
int s= (int) sqrt(ab);
if(s*s==ab) cout<<"Yes";
else cout<<"No";
return 0;
}

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

using namespace std;

typedef pair <int, int> ii;

int n;
vector <ii> towns;
vector <double> path_lengths;

double dist(ii p, ii q) {
	return sqrt(((p.first - q.first) * (p.first - q.first)) + ((p.second - q.second) * (p.second - q.second)) );
}

void generate(int i, vector <int> taken, vector <int> permutation) {
	if (i == n) {
		double path = 0.0;

		for (int j = 1; j < n; j++) {
			path += dist(towns[permutation[j]], towns[permutation[j-1]]);
		}

		path_lengths.push_back(path);

		return;
	}

	for (int j = 0; j < n; j++) {
		if (taken[j])
			continue;

		taken[j] = true;
		permutation.push_back(j);
		generate(i+1, taken, permutation);
		permutation.pop_back();
		taken[j] = false;
	}
}

int factorial(int n) {
	if (n == 0)
		return 1;

	return n * factorial(n-1);
}

int main() {

	cin >> n;

	towns.resize(n);

	for (int i = 0; i < n; i++) {
		cin >> towns[i].first >> towns[i].second;
	}

	vector <int> taken(n, false);
	vector <int> permutation;

	path_lengths.clear();

	generate(0, taken, permutation);

	double total = 0.0;

	for (double path: path_lengths) {
		total += path;
	}

	double average = total / factorial(n);

	cout << fixed << setprecision(15) << average << "\n";

	return 0;
}

Measured memory_bytes: 896
import java.io.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {

		String s =nextString();
		String t = nextString();

		String ans = "No";
		if(s.equals(t.substring(0,t.length()-1))){
			ans="Yes";
		}

		System.out.println(ans);
	}
	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 25332
while True:
  n = int(input())
  if n == 0:break
  to = []
  for i in range(n):
    line = list(map(int, input().split()))
    for j in range(n):
      x, y = line[2 * j:2 * j + 2]
      to.append(y * n + x)
  
  order = []
  used = [False] * (n * n)
  def dfs(x):
    if used[x]:return
    used[x] = True
    dfs(to[x])
    order.append(x)
  
  for i in range(n * n):
    dfs(i)
  order.reverse()
  
  def dfs2(x, used, group):
    if used[x]:return False
    if x in group:return True
    group.add(x)
    return dfs2(to[x], used, group)
  
  used = [False] * (n * n)
  ans = 0
  for i in order:
    group = set()
    if not used[i]:
      if dfs2(i, used, group):ans += 1
    for g in group:used[g] = True
  print(ans)
  


Measured memory_bytes: 6672
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include <cstddef>
using namespace std;

int main()
{
    int N, ans = 0; 
    cin >> N;
    vector<int> A(N), B(N), C(N);
    for(int i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }
    for(int i = 0; i < N; i++)
    {
        cin >> B.at(i);
        ans += B.at(i);
    }
    for(int i = 0; i < N - 1; i++)
    {
        cin >> C.at(i);
    }
    for(int i = 0; i < N - 1; i++)
    {
        if(A.at(i + 1) - A.at(i) == 1) ans += C.at(A.at(i) - 1);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define N 100000
#define ll long long

int n, cnt, prime[N + 5], vis[N + 5], ans;
ll a[N + 5];
map<ll, int> rp, p2;
map<ll, ll> match;

void sieve() {
    vis[1] = 1;
    for (int i = 2; i <= N; ++i) {
        if (!vis[i])
            prime[++cnt] = i;
        for (int j = 1; j <= cnt && i * prime[j] <= N; ++j) {
            vis[i * prime[j]] = 1;
            if (i % prime[j] == 0)
                break;
        }
    }
    p2[1] = 1;
    for (int i = 1; i <= cnt; ++i)
        p2[1LL * prime[i] * prime[i]] = prime[i];
}

void pre() {
    // 预处理norm
    for (int i = 1; i <= n; ++i) {
        ll x = a[i], y = 1, z = 1;
        for (int j = 1; j <= cnt && 1LL * prime[j] * prime[j] * prime[j] <= x; ++j) {
            if (x % prime[j]) continue;
            int t = 0;
            while (x % prime[j] == 0) {
                x /= prime[j];
                t++;
            }
            t %= 3;
            if (t == 1) y = y * prime[j], z = z * prime[j] * prime[j];
            else if(t == 2) y = y * prime[j] * prime[j], z = z * prime[j];
        }
        rp[y * x]++;
        if (p2.count(x))
            match[y * x] = z * p2[x];
        else
            match[y * x] = z * x * x;
    }
}

void solve() {
    auto it = match.begin();
    while (it != match.end()) {
        if (it->first == 1) {
            ans++;
        }
        else if (rp.count(it->second)) {
            if (it->second > it->first)
                ans += max(rp[it->first], rp[it->second]);
        }
        else
            ans += rp[it->first];
        it++;
    }
}

int main() {
    // freopen("data.in", "r", stdin);
    // freopen("my.out", "w", stdout);
    sieve();
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
        scanf("%lld", &a[i]);
    pre();
    solve();
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 14592
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int a,b;
    int js,fs,cs,mx;
    cin >> a >> b;
    js=a+b;
    fs=a-b;
    cs=a*b;
    mx=js;
    if(mx<fs) mx=fs;
    if(mx<cs) mx=cs;
    cout << mx;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cassert>
#include<climits>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define EPS (1e-10)
#define COUNTER_CLOCKWISE 1
#define CLOCKWISE -1 
#define ONLINE_BACK 2
#define ONLINE_FRONT -2
#define ON_SEGMENT 0
#define equals(a,b) (fabs((a)-(b)) < EPS)
#define MAX 31
#define pow2(a) ((a)*(a))

using namespace std;

class Point
{
  public:
  double x,y,z;

  Point(double x = -IINF,double y = -IINF,double z=-IINF): x(x),y(y),z(z){}

  Point operator + (Point p){return Point(x+p.x,y+p.y,z+p.z);}
  Point operator - (Point p){return Point(x-p.x,y-p.y,z-p.z);}
  Point operator * (double a){return Point(a*x,a*y,a*z);}
  Point operator / (double a){return Point(x/a,y/a,z/a);}

  bool operator == (const Point& p)const
  {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS && fabs(z-p.z) < EPS;
  }

};

typedef Point Vector;

int V;
Point ps[MAX];

inline double dist(Point a,Point b)
{
  return sqrt(pow2(a.x-b.x)+pow2(a.y-b.y)+pow2(a.z-b.z));
}

inline void compute()
{
  Point mp = Point(50,50,50);
  double rate = 1;
  int max_pos;
  while(rate > EPS)
    {
      rep(_,50)
	{
	  max_pos = 0;
	  REP(j,1,V)
	    {
	      if(dist(mp,ps[max_pos]) < dist(mp,ps[j]))
		{
		  max_pos = j;
		}
	    }
	  mp.x += (ps[max_pos].x-mp.x) * rate;
	  mp.y += (ps[max_pos].y-mp.y) * rate;
	  mp.z += (ps[max_pos].z-mp.z) * rate;
	}
      rate = rate * 0.5;
    }
  printf("%.5lf\n",dist(mp,ps[max_pos]));
}

int main()
{
  while(scanf("%d",&V),V)
    {
      rep(i,V)
	{
	  scanf("%lf %lf %lf",&ps[i].x,&ps[i].y,&ps[i].z);
	}

      compute();

    }
  return 0;
}

Measured memory_bytes: 1256
N = gets.to_i
a, b = 0, 0
ans = 0
N.times do |i|
  a, b = b, gets.to_i
  if b > i || b > a + 1
    ans = -1
    break
  elsif b == a + 1
    ans += 1
  else
    ans += b
  end
end
puts ans


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

int main() {
  int R;
  cin >> R;
  if(R<1200){
    cout << "ABC" << endl;
  }else if(R<2800){
    cout << "ARC" << endl;
  }else{
    cout << "AGC" << endl;
  }
}

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

typedef long long  ll;

ll MOD = 1000000007;
ll INF = 100000000000;
double PI = 3.1415926535;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
int N;
int ans = 0;
char field[5010][5010];
vector<pair<int,int>> A(N);

void search(int n){
    int x = A[n].first,y = A[n].second;
    for(int i = 0;i < N;i++){
        if(i != n){
            bool frag = 1;
            int dx = A[i].first - x,dy = A[i].second - y;
            if(field[A[i].first+dy][A[i].second+dx] != '#')frag = 0;
            if(field[A[i].first+dy][A[i].second+dx] != '#')frag = 0;
        }
    }
}

int main(){
    int H,W,N;
    cin >> H >> W >> N;
    vector<int> A(N);
    for(int i = 0;i < N;i++){
        cin >> A[i];
    }
    int table[110][110];
    queue<int> Q;
    for(int i = 0;i < N;i++){
        int n = A[i];
        for(int j = 0;j < n;j++){
            Q.push(i+1);
        }
    }
    bool frag = 1;
    for(int i = 0;i < H;i++){
        if(frag){
            for(int j = 0;j < W;j++){
                table[i][j] = Q.front();
                Q.pop();
            }
            frag = 0;
        }else{
            for(int j = W-1;j >= 0;j--){
                table[i][j] = Q.front();
                Q.pop();
            }
            frag = 1;
        }
    }
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            cout << table[i][j] << ' ';
        }
        cout << endl;
    }
}


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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define all(c) begin(c),end(c)
const int INF = 1e9;

int main() {
	cin.sync_with_stdio(false);
	int N, T;
	cin >> N >> T;
	vector<int>A(N);
	rep(i, N)cin >> A[i];
	int min_p = INF;
	int max_b=0;
	int ans = 1;
	rep(i, N) {
		min_p = min(min_p, A[i]);
		if (A[i] - min_p == max_b)ans++;
		else if (A[i] - min_p > max_b) {
			max_b = A[i] - min_p;
			ans = 1;
		}

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

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define U [1<<17]={}
typedef long long L;using namespace std;map<L,L>T U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c,p,r;char s U;
L D(L a){L d;Z[a]=1;for(map<L,L>::iterator I=T[a].begin();I!=T[a].end();I++)
    d=I->first,d-P[a]?P[d]=a,E[d]=E[a]+1,C[d]=I->second,D(d),Z[a]+=Z[d],!H[a]|Z[H[a]]<Z[d]?H[a]=d:0:0;}
L G(L a){r=A[a]+A[P[a]]+C[a];return r%k?r:0;}
L M(L i){return i?B[i]+M(i-(i&-i)):0;}
L S(L x,L i){for(x=G(x)+M(i++)-M(i);i<1e5;B[i]+=x,i+=i&-i);}
L W(){for(c=0;p=X[a],n=X[b],p-n;a=P[p])E[p]<E[n]?swap(p,n),swap(a,b),0:0,c+=M(O[a])-M(O[p])+G(p);cout<<c+abs(M(O[a])-M(O[b]))<<endl;}
main(){for(cin>>n>>k;++p<n;T[a][b]=T[b][a]=c)cin>>a>>b>>c;
       for(D(c=p=0);p<n;p++)if(!p|H[P[p]]-p)for(a=p;!c|a;S(a=H[a],O[a]=c++))X[a]=p;
       for(cin>>a;cin>>s>>a>>b;*s&2?W():A[a]+=b,S(H[a],O[a]),a?S(a,O[a]-1):0);}

Measured memory_bytes: 33368
#include <iostream>

using namespace std;
typedef long long ll;

int main(void)
{
    int N;

    cin >> N;
    ll ans = 0;
    int t = 0;
    for (int A = 1; A <= N; A++) {
        for (int B = 1; B <= N / A; B++) {
            int C = N - A * B;
            if (C > 0) {
                ans++;
            }
            t++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a[ohara],b,c,d,tmp[ohara],tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>x;
    rep(i,n)cin>>a[i];
    tmp[0]=0;
    rrep(i,1,n+1){
        tmp[i]=tmp[i-1]+a[i-1];
    }
    rep(i,n+1){
        if(tmp[i]<=x)ans++;
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 2304
#include <iostream>
using namespace std;
int main()
{
	int a, b, c, x,count=0,temp;
	cin >> a >> b >> c >> x;
	for (int i = 0; i <= a; i++)
	{
		for (int j = 0; j <= b; j++)
		{
			for (int k = 0; k <= c; k++)
			{
				temp = 50 * k + 100 * j + 500 * i;
				if (temp== x)
					count++;
				if (temp > x)
					break;
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 配列
        int x = sc.nextInt();
        int y = sc.nextInt();

        if(x * 4 < y || x * 2 > y || y % 2 != 0) {
            System.out.println("No"); 
        } else {
            System.out.println("Yes");
        }
    }
}


Measured memory_bytes: 35780
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin >> s;

	vector<char> v1, v2;

	int f = 0;

	int q;
	cin >> q;

	while(q--) {
		int t;
		cin >> t;
		if(t==1) {
			f ^= 1;
		}
		else {
			int x;
			char c;
			cin >> x >> c;
			x--;
			if(x^f==0) v1.push_back(c);
			else v2.push_back(c);
		}
	}

	if(f) {
		reverse(s.begin(), s.end());
		swap(v1, v2);
	}

	reverse(v1.begin(), v1.end());

	for(int i = 0; i < v1.size(); i++) cout << v1[i];
	cout << s;
	for(int i = 0; i < v2.size(); i++) cout << v2[i];

	

	return 0;
}


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

int main(){
    uint64_t a, b, x;
    cin >> a >> b >> x;

    if(a == 0) {
        cout << b / x + 1 << endl;
        return 0;
    }
    cout << b / x - (a - 1) / x << endl;
    return 0;
}

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

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

  int n, q, s, t, d, roadwork[200200];
  vector<pair<int, int>> events;
  cin >> n >> q;
  for (int i = 1; i <= n; i++)
  {
    cin >> s >> t >> roadwork[i];
    events.push_back({s - roadwork[i], i});
    events.push_back({t - roadwork[i], -i});
  }

  sort(events.begin(), events.end());
  set<pair<int, int>> active;
  int i = 0;
  while (q--)
  {
    cin >> d;
    while (i < events.size() && events[i].first <= d)
    {
      int id = events[i].second;
      if (id > 0) active.insert({roadwork[id], id});
      else active.erase({roadwork[-id], -id});
      i++;
    }
    if (active.empty()) cout << "-1\n";
    else cout << active.begin()->first << '\n';
  }
}


Measured memory_bytes: 14572
#include <stdio.h>

int main(){
  int H,W,N;
  int max;
  int k = 0;
  int tmp;
  scanf("%d",&H);
  scanf("%d",&W);
  scanf("%d",&N);
  
  if(H<=W) max = W;
  else max = H;
  
  tmp = N;
  while(tmp >= 1){
    tmp-=max;
    k++;
  }
  printf("%d\n",k);
  
  return 0;
}

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

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

	vector<int> l(n);
	for(int i = 0; i < n; ++i)
		cin >>l[i];
	int cnt = 0;
	sort(begin(l), end(l));
	for(int i = 0; i < n; ++i){
		for(int j = i + 1; j < n; ++j){
			for(int k = j + 1; k < n; ++k){
				if(l[i] == l[j] || l[i] == l[k] || l[j] == l[k])
					continue;
				if(l[i] + l[j] > l[k])
					++cnt;
			}
		}
	}
	cout <<cnt <<'\n';
	return 0;
}


Measured memory_bytes: 3636
import java.io.*;
import java.util.Random;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        FastReader scan = new FastReader();
        //PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("cowmbat.out")));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        Task solver = new Task();
        //int t = scan.nextInt();
        int t = 1;
        for(int i = 1; i <= t; i++) solver.solve(i, scan, out);
        out.close();
    }
    static class Task {
        public void solve(int testNumber, FastReader sc, PrintWriter pw) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            pw.println(a+b+c>21?"bust":"win");
        }
		/*
		public long exp(long base, int power){
			if(power == 0) return 1;
			if(power == 1) return (base + mod) % mod;
			long ans = exp(base,power/2);
			ans = (ans*ans + mod) % mod;
			if(power%2 == 1) ans = (ans*base + mod) % mod;
			return (ans + mod) % mod;
		}*/

    }
    static class pair implements Comparable<pair>{
        int a, b,c;
        pair(int a, int b,int c){
            this.a=a;
            this.b=b;
            this.c=c;
        }

        @Override
        public int compareTo(pair o) {
            return Integer.compare(b,o.b);
        }
    }
    static void shuffle(long[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            long temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(new File(s)));
        }

        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;
        }
    }

}

Measured memory_bytes: 21460
n=int(input())
s=[1,2,3,4,5,6,7,8,9,10,11,12,13]
h=[1,2,3,4,5,6,7,8,9,10,11,12,13]
c=[1,2,3,4,5,6,7,8,9,10,11,12,13]
d=[1,2,3,4,5,6,7,8,9,10,11,12,13]

while n>0:
    l=input().split()
    if l[0]=="S":
        s.remove(int(l[1]))
    elif l[0]=="H":
        h.remove(int(l[1]))
    elif l[0]=="C":
        c.remove(int(l[1]))
    else:
        d.remove(int(l[1]))
    n=n-1

if not s==[]:
    for a in s:
        print("S "+str(a))
else:
    pass

if not h==[]:
    for b in h:
        print("H "+str(b))
else:
    pass

if not c==[]:
    for e in c:
        print("C "+str(e))
else:
    pass

if not d==[]:
    for f in d:
        print("D "+str(f))
else:
    pass



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

int main() {
  int n;
  cin >>n;
  ll power = 1;
  rep(i,n){
    power *= i+1;
    power = power%(1000000000+7);
  }
  cout << power << endl;
}

Measured memory_bytes: 256
#include <iostream>
  #include <string>
  #include <vector>
  #include <algorithm>
  #include <utility>
  using namespace std;
  typedef long long ll;
  #define rep(i,n) for (int i=0;i < (int)(n);i++)
  
  int gcd(int a,int b){
    if(b) return gcd(b,a%b);
    return a;
  }
  int main(){
    int a,b,k;
    cin >> a >> b >> k;
    vector<int> ans;
    for (int i=1;i <= 100;i++){
      if (a%i == 0 && b%i == 0) ans.push_back(i);
    }
    cout << *(ans.end()-k) << endl;
    


    return 0;
  }



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  int m=0;
  for(int i=1; i <= N; i++){
    if(i%15==0){
      m+=800-200;
    }else{
      m+=800;
    }
  }
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 504
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
using namespace std;

int main(){
    long long int a,b,n;
    long long int c,d,e;
    long long int m,l;
    cin >> a >> b >> n;
    d = (a*min(n,(b-1)))/b ;
    cout << d << endl;
    return 0;
}

Measured memory_bytes: 3608
def actual(s):
    is_agct = lambda string: set(string).issubset({'A', 'G', 'C', 'T'})

    N = len(s)

    answer = 0

    for i in range(N):
        for j in range(N):
            substr = s[i:j + 1]  # スライスの後半は要素数を超えてもエラーにならないことに注意

            if is_agct(substr):
                answer = max(answer, len(substr))

    return answer


s = input()
print(actual(s))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <sstream>
#include <math.h>

using namespace std;
//for (int i = 0; i < N; i++){}


int main() {
    long long N, M;
	cin >> N >> M;

    long long res = 0;
    if(M - 2 * N < 0){
       res += M/2;
    }else{
        res += N;
        res += (M - 2*N)/4;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
from itertools import product

N, M = map(int, input().split())
kss = [list(map(int, input().split())) for _ in range(M)]
ps = list(map(int, input().split()))

answer = 0
for switches in product(range(2), repeat=N):
    for (_, *ss), p in zip(kss, ps):
        okay = True
        if sum([switches[s-1] for s in ss]) % 2 != p:
            okay = False
            break
    if okay:
        answer += 1

print(answer)


Measured memory_bytes: 3064
#!/usr/bin/env pypy3

#import numpy as np
#import scipy, scipy.special

# Python 3 modules: https://docs.python.org/3/library/

import math, itertools, operator
from math import *
from math import factorial as fact
from itertools import permutations, combinations
from functools import reduce
# Use scipy for stats: https://docs.scipy.org/doc/scipy/reference/stats.html
# Before Python 3.5
from fractions import gcd

inf = float('inf')

def lcm(a, b):
    return a * b // gcd(a,b)

def perm(a, b):
    import scipy.special
    return scipy.special.perm(a, b, exact = True)

def comb(a, b):
    import scipy.special
    return scipy.special.comb(a, b, exact = True)

def dfact(n):
    import scipy.special
    return scipy.special.factorial2(n, exact = True)

def prod(l):
    return reduce(operator.mul, l)

def input_ints(inp = input, sep = ' ', conv = int):
    return map(conv, inp().split(sep = sep))

################################################################################


S = int(input())

p = S // 100
q = S % 100

def ismonth(x):
    return 1 <= x <= 12

if ismonth(p) and ismonth(q):
    print('AMBIGUOUS')
elif ismonth(p) and not ismonth(q):
    print('MMYY')
elif not ismonth(p) and ismonth(q):
    print('YYMM')
else:  # Not month both
    print('NA')


Measured memory_bytes: 5120
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
bool check(int pos, int n) { return (pos >= n ? true : false); }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    while(cin >> n >> m, n | m)
    {
        int A[n + 1];
        for(int i = 1; i <= n; i++) cin >> A[i];
        int pos = 1;
        int B[m + 1];
        for(int i = 0; i < m; i++) cin >> B[i];
        int i;
        for(i = 0; i < m; i++)
        {
            pos += B[i];
            if(check(pos, n)) break;
            pos += A[pos];
            if(check(pos, n)) break;
        }
        cout << i + 1 << endl;
    }
    return 0;
}




Measured memory_bytes: 3048
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

 
public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<String> stringList = new ArrayList<>();
		List<String> ansList = new ArrayList<>();
		
		for(int i = 0; i < N; i++) {
			stringList.add(sc.next()); 
		}
		
		Collections.sort(stringList);
		
		String temp = stringList.get(0);
		int sameCount = 1;
		int maxCount = 0;

		//　最多回数を取得
		for(int i = 1; i < N; i++) {
			if(temp.equals(stringList.get(i))) {
				sameCount++;
			}else {
				if(maxCount < sameCount) {
					maxCount = sameCount;
				}
				sameCount = 1;
				temp = stringList.get(i);
			}
		}
		// 全て同じ文字だった場合の最多回数を取得
		if(maxCount < sameCount) {
			maxCount = sameCount;
		}

		// 最多回数と同じ文字列を取得
		sameCount = 1;
		temp = stringList.get(0);
		for(int i = 1; i < N; i++) {
			if(temp.equals(stringList.get(i))) {
				sameCount++;
			}else {
				if(maxCount == sameCount) {
					ansList.add(temp);
				}
				sameCount = 1;
				temp = stringList.get(i);
			}
		}
		
		// 最後の文字が最多かどうか確認
		if(maxCount == sameCount) {
			ansList.add(temp);
		}

		for(int i = 0; i < ansList.size(); i++) {
			System.out.println(ansList.get(i));
		}
		
		sc.close();
	}
	
}

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

int main(){
  int N, D; cin >>N >>D;
  int X[N][D];
  for(int i=0;i<N;i++){
    for(int j=0;j<D;j++){
      cin >>X[i][j];
    }
  }

  int ans=0;
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      int m=0, n=0;
      for(int k=0;k<D;k++){
        n += pow((X[i][k]-X[j][k]),2);
      }
      m = sqrt(n);
      if(m*m == n) ans++;
    }
  }

  cout << ans << endl;
  return 0;
}


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

int main() {
  long long a, b; cin >> a >> b;
  if (a > 0 && b > 0) cout << "Positive" << endl;
  else if (a <= 0 && b >= 0) cout << "Zero" << endl;
  else {
    if ((b - a) % 2 == 1) cout << "Positive" << endl;
    else cout << "Negative" << endl;
  }
}

Measured memory_bytes: 256
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        int count = int.Parse(ReadLine());

        double result = 0;
        for (int i = 0; i < count; i++)
        {
            var input = ReadLine().Split(' ');

            double money = double.Parse(input[0]);
            if (input[1] == "BTC")
            {
                money *= 380000;
                result += money;
            }
            else
            {
                result += money;
            }
        }
        WriteLine(result);
        ReadKey();
    }
}

static class MyUtil
{
    public static int[] ReadIntArray()
    {
        return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
    }

    /// <summary>
    /// <see cref="IEnumerable{T}"/>の各要素を並べてコンソールに出力します。各要素の間には半角スペースが一つ入ります。
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="ts"></param>
    public static void WriteToConsole<T>(this IEnumerable<T> ts)
    {
        StringBuilder stringBuilder = new StringBuilder();
        foreach (T t in ts)
        {
            stringBuilder.Append(t.ToString());
            stringBuilder.Append(" ");
        }
        stringBuilder.Remove(stringBuilder.Length - 1, 1);
        Console.WriteLine(stringBuilder.ToString());
    }
}


Measured memory_bytes: 11092
import sys
from itertools import accumulate
N, M, Q = map(int, sys.stdin.readline().split())
 
LR = [[0]* (N-i) for i in range(N)]
for i in range(M):
  L, R = map(int, sys.stdin.readline().split())
  LR[L-1][R-L] += 1
 
for i in range(N-2,-1,-1):
  for j, acc in enumerate(accumulate(LR[i])):
    LR[i][j] = acc + (0 if j==0 else LR[i+1][j-1])
 
for i in range(Q):
  p, q = map(int, sys.stdin.readline().split())
  sys.stdout.write(str(LR[p-1][q-p])+"\n")

Measured memory_bytes: 8620
x1, y1 , x2, y2 = map(int, input().split())

x3, y3 = x2 - (y2 - y1), y2 + (x2 - x1)
x4, y4 = x3 - (y3 - y2), y3 + (x3 - x2)

print(x3, y3, x4, y4)


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

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define MOD 1000000007
const double PI=3.14159265358979323846;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> T Ceil(T a, T b){return (a+b-1)/b;}

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

void printv(vint &v){
    for(auto e:v) cout<<e<<" ";
        cout<<endl;
    }

int main() {
    cout<<fixed<<setprecision(10);

    ll n,m; cin>>n>>m;
    vint a(m); rep(i,m) cin>>a[i];

    ll s = 0;
    for(auto e:a) s+=e;
    if(s <= n) cout<<n-s<<endl;
    else cout<<-1<<endl;

    return 0;

}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, C;
    cin >> N >> C;
    vector<vector<ll>> grid(C + 1, vector<ll>(C + 1, 0));
    rep(i, C) {
        rep(j, C) {
            ll d;
            cin >> d;
            grid[i + 1][j + 1] = d;
        }
    }
    vector<map<ll, ll>> cnt(3, map<ll, ll>());
    rep(i, N) {
        rep(j, N) {
            ll c;
            cin >> c;
            cnt[(i + 1 + j + 1) % 3][c]++;
        }
    }
    vector<ll> X;
    rep(i, C) {
        X.push_back(i + 1);
    }
    ll ans = INF;
    rep(i, C) {
        ll c1 = 0;
        for (P p: cnt[0]) {
            c1 += grid[p.first][X[i]] * p.second;
        }
        rep(j, C) {
            if (i == j) continue;
            ll c2 = 0;
            for (P p: cnt[1]) {
                c2 += grid[p.first][X[j]] * p.second;
            }
            rep(k, C) {
                if (j == k || i == k) continue;
                ll c3 = 0;
                for (P p: cnt[2]) {
                    c3 += grid[p.first][X[k]] * p.second;
                }
                ans = min(ans, c1 + c2 + c3);
            }
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<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; }



void func(long long N, long long X, long long T){

    for(lli i=0;i<100000;i++){
        if(i*X>=N){
            cout<<i*T<<endl;
            return;
        }
    }

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    long long X;
    scanf("%lld",&X);
    long long T;
    scanf("%lld",&T);
    func(N, X, T);
    return 0;
}


Measured memory_bytes: 3764
#include <iostream>
#include <algorithm>
#include <functional>
#include <cmath>
#include <utility>
#include <tuple>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<vector<int> > vvi;
#define rep(i,n) for (int i=0;i<n;i++)

ll mod = 1e9+7;

int ans = 0;
vvi _ab;
vvi ab;
vector<bool> visit;

void dfs(int pos,int x){
    bool visited = true;
    rep(i,visit.size()){
        if (!visit[i]){
            visited = false;
            break;
        }
    }
    if (visited){
        ans++;
        return;
    }
    rep(i,ab[pos].size()){
        if (_ab[x][0]==pos  && _ab[x][1]==ab[pos][i]) continue;
        if (visit[ab[pos][i]]==true) continue;
        visit[i] = true;
        dfs(ab[pos][i],x);
    }
    return;
}

int main(){
    string S;
    cin >> S;
    int count = 0;
    for (int i=1;i<S.length();i++){
        if (S[i]!=S[i-1]) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<(n);i++)
#define ll long long
using namespace std;
int h,w,d,q;
map<int,pair<int,int>> data{};
map<pair<int,int>,int> ruiseki{};
int main(){
	cin>>h>>w>>d;
	for(int i=1;i<=h;i++)for(int j=1;j<=w;j++){
		int l1;
		cin>>l1;
		data[l1]={i,j};
	}
		
	for(int i=1;i<=d;i++){
		int p=i;
		ruiseki[{i,0}]=0;
		for(int j=1;p<=h*w;j++){
			p+=d;
			ruiseki[{i,j}]=ruiseki[{i,j-1}]+abs(data[p].first-data[p-d].first)+abs(data[p].second-data[p-d].second);
			//cout<<ruiseki[{i,j}]<<endl;
		}
		
	}
	cin>>q;
	for(int i=0;i<q;i++){
		int l,r;
		cin>>l>>r;
		int kk=l%d;
		if(kk==0)kk=d;
		int oo=(l-kk)/d;
		int tt=(r-kk)/d;
		cout<<ruiseki[{kk,tt}]-ruiseki[{kk,oo}]<<endl;
	}
//	cout<<ruiseki[{2,0}]<<" "<<ruiseki[{2,1}]<<endl;
	
}




Measured memory_bytes: 22912
#include<stdio.h>
int main()
{
  char s[3];
  for(int i=0;i<3;i++){
    scanf("%s",&s[i]);
  }
  if(s[0]==s[1]&&s[1]==s[2]){
    puts("No");
  }
  else {
    puts("Yes");
  }
  return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

#include<unordered_set>

using namespace std;

#define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);}
#define printe(...) fprintf(stderr, __VA_ARGS__);
#define PrtExp(_Exp)  cerr<< #_Exp <<" = "<< (_Exp)
#define PrtExpN(_Exp)  cerr<< #_Exp <<" = "<< (_Exp) <<"\n"

#define SINT(n) scanf("%d",&n)
#define SINT2(n,m) scanf("%d %d",&n,&m)
#define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o)
#define SINT4(n,m,o,p) scanf("%d %d %d %d",&n,&m,&o,&p)
#define SINT5(n,m,o,p,q) scanf("%d %d %d %d %d",&n,&m,&o,&p,&q)
#define SLL(n) scanf("%lld",&n)
#define SLL2(n,m) scanf("%lld %lld",&n,&m)
#define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o)
#define SST(s) scanf("%s",s)
#define SCH(c) scanf("%c",&c)

#define GC() getchar()

#define PINT(n) printf("%d",(int)(n))
#define PINT2(n,m) printf("%d %d",(int)(n),(int)(m))
#define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l))
#define PLL(n) printf("%lld",(long long)(n))
#define PST(s) printf("%s",(s))
#define PCH(s) printf("%c",(s))

#define PINTN(n) printf("%d\n",(int)(n))
#define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m))
#define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l))
#define PLLN(n) printf("%lld\n",(long long)(n))
#define PSTN(s) printf("%s\n",(s))
#define PCHN(s) printf("%c\n",(s))

#define PSP() printf(" ")
#define PN() printf("\n")

#define PC(c) putchar(c)
#define CSP (' ')
#define SN ("\n")

#define rep(i,a) for(int i=0;i<a;i++)
#define reP(i,a) for(int i=0;i<=a;i++)
#define Rep(i,a) for(int i=a-1;i>=0;i--)
#define ReP(i,a) for(int i=a;i>=0;i--)

#define rEp(i,a) for(i=0;i<a;i++)
#define rEP(i,a) for(i=0;i<=a;i++)
#define REp(i,a) for(i=a-1;i>=0;i--)
#define REP(i,a) for(i=a;i>=0;i--)

#define repft(i,a,b) for(int i=a;i<b;i++)
#define repfT(i,a,b) for(int i=a;i<=b;i++)
#define Repft(i,a,b) for(int i=a-1;i>=b;i--)
#define RepfT(i,a,b) for(int i=a;i>=b;i--)

#define foreach(a,it) for(auto it = a.begin(); it != a.end(); ++it)

#define FILL(a,v) fill(begin(a),end(a), v)
#define FILL0(a) memset(a,0,sizeof(a))
#define FILL1(a) memset(a,-1,sizeof(a))

typedef long long ll;

typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll>   Pll;


const int INF = 1000000009;
const ll INFLL = 0x1f1f1f1f1f1f1f1fLL;//2,242,545,357,980,376,863

template <class A, class B> inline ostream& operator<<(ostream& st, const pair<A, B>& P) { return st << "(" << P.first << "," << P.second << ")"; };
template <class A, class B> inline pair<A, B> operator+(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first + Q.first, P.second + Q.second); };
template <class A, class B> inline pair<A, B> operator-(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first - Q.first, P.second - Q.second); };

#define fs  first	
#define sc  second


int main() {
	int a, b, c, d, e, f, g, h;
	int i, j, k, l, m, n, o, p, q, r;
	string s, t, u;
	int v, w, x, y, z;

	cin >> a >> b;
	if (a > 8) puts(":(");
	else if (b > 8) puts(":(");
	else puts("Yay!");


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
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;}

template<class T> ll llpow(T x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//yes(0:Yes or 1:YES)  no(0:No or 1:NO)
void yes(int which_yes){if(which_yes==0)cout<<"Yes"<<endl;else if(which_yes==1)cout<<"YES"<<endl;}
void no(int which_no){if(which_no==0)cout<<"No"<<endl;else if(which_no==1)cout<<"NO"<<endl;}
long long INF = 1LL<<60;
int main(){
    int n;
    cin>>n;
    int a[n];
    rep(i,n)cin>>a[i];
    int odd=0;
    int fdivable=0;
    rep(i,n){
        if(a[i]%2)odd++;
        else {
            if(!(a[i]%4))fdivable++;
        }
    }
    if(odd>fdivable){
        if((odd-fdivable<=1&&odd+fdivable==n)&&fdivable!=0)yes(0);
        else no(0);
    }
    else{
        yes(0);
    }
    return 0;
}




Measured memory_bytes: 640