akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    string S;
    cin >> S;
    char C = S[0];

    bool ok = true;
    for (int i = 1; i < S.size(); i++)
    {
        if(S[i] != C){
            ok = false;
            break;
        }
    }
    if(ok){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
}

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

int main(){
    int i;
    int j;
    int k;
    for(i=1;i<=9;i++){
        for(j=1;j<=9;j++){
            k = i*j;
            cout << i << "x" << j << "=" << k <<endl;
        }
    }
    return 0;
    
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

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

int main() {
  int n, c;
  cin >> n >> c;
  int iwa[c][c];
  for (int i = 0; i < c; i++)
    for (int j = 0; j < c; j++)
      cin >> iwa[i][j];
  map<int, int> m[3];
  int a;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a;
      a--;  // 0スタートにしておく
      m[(i + j) % 3][a]++;
    }
  }

  vector<int> col = {1, 2, 3};
  col.resize(c);
  sort(col.begin(), col.end());

  ll ans = INFL;
  do {
    ll res = 0;
    for (int i = 0; i < col.size(); i++)  // i=色番号
      if (col[i]) // col[i]が1か2か3のとき
        for (auto x : m[col[i] - 1])
          if (x.first != i)  // 色をiにしないといけない
            res += iwa[x.first][i] * x.second;
    ans = min(ans, res);
  } while (next_permutation(col.begin(), col.end()));
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
 {
	
	
	    int n,w;
	    cin>>n>>w;
	    int wt[n];
	    int val[n];
	    for(int i=0; i<n; i++){
	        cin>>wt[i]>>val[i];
	    }
	    
	    
	    long long int dp[n+1][w+1];
	    for(int i=0; i<=n; i++){
	    	for(int j=0; j<=w; j++){
	    		if(i==0 || j==0){
	    			dp[i][j]=0;
				}
	    		else if(wt[i-1]>j){
	    			dp[i][j] = dp[i-1][j];
				}
				else{
					dp[i][j] = max(val[i-1]+dp[i-1][j-wt[i-1]] , dp[i-1][j]);
				}
			}
		}
		cout<<dp[n][w];
	
	return 0;
}

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

//===
struct UnionFind {
    vector<int> parent;

    UnionFind(){}
    
    UnionFind(int nmemb)
    {
        init(nmemb);
    }

    void init(int nmemb)
    {
        parent.clear();
        parent.assign(nmemb, -1);
    }

    int root(int x)
    {
        if (parent[x] < 0) {
            return x;
        }
        return parent[x] = root(parent[x]);
    }

    bool same(int x, int y)
    {
        return root(x) == root(y);
    }

    void unite(int x, int y)
    {
        x = root(x);
        y = root(y);

        if (x == y) return;

        parent[x] += parent[y];
        parent[y] = x;
        
        return;
    }

    int size(int x)
    {
        x = root(x);
        return -parent[x];
    }
};
//===

int main()
{
    int n, m;
    int a[105];
    int b[105];
    int ans = 0;

    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
    }

    for (int i = 0; i < m; i++) {
        UnionFind uf(n + 1);

        for (int j = 0; j < m; j++) {
            if (i == j) continue;
            uf.unite(a[j], b[j]);
        }

        if (uf.size(1) < n) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 888
class UnionFind:
    def __init__(self, size):
        self.parents = list(range(size))

    def find(self, i):
        ret = i
        path = []
        while self.parents[ret]!=ret:
            path.append(ret)
            ret = self.parents[ret]
        for p in path:
            self.parents[p] = ret
        return ret

    def union(self, i, j):
        self.parents[self.find(i)] = j

n = int(input())
xys = [(tuple(map(int, input().split())), i) for i in range(n)]

sortx = sorted(xys, key=lambda xy: xy[0][0])
roadsx = [(sortx[i][0][0]-sortx[i-1][0][0], sortx[i][1], sortx[i-1][1]) for i in range(1, n)]
sorty = sorted(xys, key=lambda xy: xy[0][1])
roadsy = [(sorty[i][0][1]-sorty[i-1][0][1], sorty[i][1], sorty[i-1][1]) for i in range(1, n)]
roads = roadsx + roadsy
roads.sort(key=lambda x:x[0])

ctr = 1
ans = 0
uf = UnionFind(n)
for road in roads:
    if ctr >= n:
        break
    cost, i1, i2 = road
    if uf.find(i1) != uf.find(i2):
        ans += cost
        ctr += 1
        uf.union(i1, i2)

print(ans)

Measured memory_bytes: 57284
s = input()
min_a = 200001
max_z = 0
for i, one_s in enumerate(s):
  if one_s == "A":
    if i < min_a:
      min_a = i
  elif one_s == "Z":
    if i > max_z:
      max_z = i
print(max_z - min_a + 1)

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

typedef vector <int> vi;
typedef pair< int , int > pii;
#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);



int main()
{
	FIO;
	int N;
	cin >> N;
	if (N % 10 == 2 || N % 10 == 4 || N % 10 == 5 || N % 10 == 7 || N % 10 == 9 ) {
		cout << "hon";
		return 0;
	}
	if (N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 6 || N % 10 == 8 ) {
		cout << "pon";
		return 0;
	}
	if (N % 10 == 3 ) {
		cout << "bon";
		return 0;
	}
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
using vvll = vector< vector<ll> >;
using vll = vector<ll> ;

#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define ar array
#define endl '\n'


const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 4*1e18;


void pre(){

}

long long A,B,C,D;   
map<long long ,long long> MAP;

long long get(long long goal){
    if(goal == 0)
        return 0;
    if(goal == 1)
        return D;
    if(MAP.count(goal))
        return MAP[goal];
    
    long long best = oo;
    if( D < oo / goal ){
        best = min(best ,  D*goal);
    }
    for(int i=0;i<3;i++){
        int mul = vector<int>{2,3,5}[i];
        long long cost  = vector<long long>{A,B,C}[i];
        if(goal%mul == 0){
            best = min(best , cost + get(goal/mul) );
        }else{
            long long down = goal/mul*mul;
            best = min(best , cost + D*( goal - down ) + get(goal/mul) );
            long long up = down + mul;
            best = min( best , cost + D*(up-goal) + get(goal/mul + 1) );
        }
    }
    return MAP[goal] = best;
}

void solve(){    
    
    long long N;
    cin >> N;
    cin >> A >> B >> C >> D;
    cout << get(N) << endl;
    MAP.clear(); 
}


int main(){
    
    IOS;
    pre();
    ll T = 1;
    cin >> T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 4452
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

m,d=nii()

ans=0
for i in range(1,m+1):
  for j in range(1,d+1):
    if j>=10:
      d1=j%10
      j//=10
      d2=j
      if d1>=2 and d2>=2 and d1*d2==i:
        ans+=1

print(ans)

Measured memory_bytes: 9092
import math
N, D= list(map(int,input().split()))
cnt = 0
for i in range(N):
    x, y = list(map(int, input().split()))
    #print(math.sqrt((x^2)+(y^2)))
    if math.sqrt((x*x)+(y*y)) <= D:
        cnt+=1
        
print(cnt)

Measured memory_bytes: 9168
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> s(h+2, vector<char>(w+2));
    rep(i, h+2){
        s[i][0] = '#';
        s[i][w+1] = '#';
    }
    rep(j, w+2){
        s[0][j] = '#';
        s[h+1][j] = '#';
    }
    rep(i, h)rep(j, w){
        cin >> s[i+1][j+1];
    }
    vector<vector<int>> L(h+2, vector<int>(w+2, 0));
    vector<vector<int>> R(h+2, vector<int>(w+2, 0));
    vector<vector<int>> U(h+2, vector<int>(w+2, 0));
    vector<vector<int>> D(h+2, vector<int>(w+2, 0));
    rep(i, h+1)rep(j, w+1){
        if(i==0 or j==0) continue;
        if(s[i][j] == '#'){
            L[i][j] = 0;
            R[i][j] = 0;
            U[i][j] = 0;
            D[i][j] = 0;
            continue;
        }
        L[i][j] = L[i][j-1]+1;
        U[i][j] = U[i-1][j]+1;
    }

    for(int i=h+1; i>0; i--)for(int j=w+1; j>0; j--){
        if(s[i][j] == '.'){
            R[i][j] = R[i][j+1]+1;
            D[i][j] = D[i+1][j]+1;
        }
    }
    int ans = 0;
    rep(i, h+1)rep(j, w+1){
        if(i==0 or j==0) continue;
        chmax(ans, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	// your code goes here
	int x;
	cin >> x;
	int hap = 1000 * (x / 500);
	x %= 500;
	hap += 5 * (x / 5);
	cout << hap << endl;
	return 0;
}


Measured memory_bytes: 256
using System;

namespace AtCoder
{
	public class ProblemA
	{
		public static void Main(string[] args)
		{
			string[] line = Console.ReadLine().Split(' ');
			int d = int.Parse(line[0]);
			int g = int.Parse(line[1]);

			Probrem[] prob = new Probrem[d];

			for (int i = 1; i <= d; i++)
			{
				line = Console.ReadLine().Split(' ');
				int p = int.Parse(line[0]);
				int c = int.Parse(line[1]);
				prob[i - 1] = new Probrem() { Unit = i * 100, Number = p, Bonus = c, Total = i * 100 * p + c };
			}

			int minimum = int.MaxValue;

			int limit = (1 << d);

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

				int bit = i;
				int last = d - 1;
				for (int j = 0; j < d && bit > 0; j++, bit >>= 1)
				{
					bool add = (bit & 1) == 1;
					if (add)
					{
						total += prob[j].Total;
						count += prob[j].Number;
					}
					else
					{
						last = j;
					}
				}

				if (total < g)
				{
					int unit = 100 * (last + 1);
					// 満たないパターンを網羅するためにunitを足すけど、
					// もともとちょうど割り切れるポイントだった時に余計に計上されることを防ぐため、1を減算している。
					int need = (g - total + (unit - 1)) / unit;
					if (need >= prob[last].Number)
						continue;

					count += need;
				}

				minimum = Math.Min(minimum, count);
			}

			Console.WriteLine(minimum);
		}
	}

	public class Probrem
	{
		public int Unit
		{
			get; set;
		}

		public int Number
		{
			get; set;
		}

		public int Bonus
		{
			get; set;
		}

		public int Total
		{
			get; set;
		}
	}
}


Measured memory_bytes: 27520
#include <stdio.h>

int main(void) {
    int t, num, ticket[4] = {6000, 4000, 3000, 2000};
    int i;

    for (i=0; i<4; i++) {
        scanf("%d %d", &t, &num);
        printf("%d\n", num * ticket[t-1]);
    }

    return 0;
}

Measured memory_bytes: 600
n = gets.to_i
x = n / 2 * 2
ans = []

1.upto(x) do |i|
    (i+1).upto(x) do |j|
        next if i + j == x + 1
        ans << "#{i} #{j}"
    end
end

1.upto(x) {|i| ans << "#{i} #{n}"} if n.odd?
puts ans.size, ans

Measured memory_bytes: 2172
#include<cstdio>
int main()
{
    int n[5],i;
    for(i=1;i<=4;i++)
        scanf("%1d",&n[i]);
    if(n[1]==n[2]&&n[2]==n[3]){
        printf("Yes\n");
        return 0;
    }
    if(n[2]==n[3]&&n[3]==n[4]){
        printf("Yes\n");
        return 0;
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cctype>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdarg>
using namespace std;

const char UP    = 'N';
const char DOWN  = 'S';
const char RIGHT = 'E';
const char LEFT  = 'W';

class Dice{
public:
    int und;
    int over;
    int up;
    int down;
    int right;
    int left;

    Dice(int arr[]){
        und   = arr[5];
        over  = arr[0];
        up    = arr[4];
        down  = arr[1];
        right = arr[2];
        left  = arr[3];
    }

    void upd(int& a, int& b, int& c, int& d){
        int tmp;
        tmp = a;
        a = b;
        b = c;
        c = d;
        d = tmp;
    }

    void move(char order){
        if (order == UP){
            upd(und, up, over, down);
        }else if(order == DOWN){
            upd(und, down, over, up);
        }else if(order == RIGHT){
            upd(und, right, over, left);
        }else{
            upd(und, left, over, right);
        }
    }

    void act(int len, ...){
        va_list args;
        va_start(args, len);
        char order;
        for(int i = 0; i < len; i ++){
            order = va_arg(args, int);
            move(order);
        }
        va_end(args);
    }

    char getPos(int num){
        if(und == num){
            return 'B';
        }else if(over == num){
            return 'O';
        }else if(up == num){
            return 'U';
        }else if(down == num){
            return 'D';
        }else if(right == num){
            return 'R';
        }else if(left == num){
            return 'L';
        }else{
            cout << "Nothing" << endl;
            return 0;
        }
    }


    void show(){
        cout << over << endl;
    }
};

int main(int argc, char const *argv[])
{
    int a[6];
    for(auto &i: a){
        cin >> i;
    }
    Dice d(a);
    int Q;
    cin >> Q;
    int x, y;
    char info;
    for(int i = 0; i < Q; i ++){
        cin >> x >> y;
        info = d.getPos(y);

        switch(info){
        case 'B':
            d.act(2, UP, UP);
            break;
        case 'O':
            break;
        case 'U':
            d.act(1, DOWN);
            break;
        case 'D':
            d.act(1, UP);
            break;
        case 'R':
            d.act(1, LEFT);
            break;
        case 'L':
            d.act(1, RIGHT);
            break;
        }

        info = d.getPos(x);
        switch(info){
        case 'U':
            d.act(1, DOWN);
            break;
        case 'D':
            d.act(3, RIGHT, RIGHT, UP);
            break;
        case 'R':
            d.act(2, DOWN, LEFT);
            break;
        case 'L':
            d.act(2, DOWN, RIGHT);
            break;
        }
        cout << d.right << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#define _ijps 0
#define _ALLOW_RTCc_IN_STL
#define _CRT_SECURE_NO_DEPRECATE
//#pragma comment(linker, "/STACK:667772160")
#include <iostream>
#include <cmath>
#include <time.h>
#include <map>
#include <set>
#include <deque>
#include <cstdio>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <algorithm>
#include <string>
#include <fstream>
#include <assert.h>
#include <list>
#include <cstring>
#include <queue>

using namespace std;

#define name "pail"

typedef long long ll;

struct __isoff {
	__isoff() {
		if (_ijps)
			freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);//, freopen("test.txt", "w", stderr);
		//else freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);
		//ios_base::sync_with_stdio(0);
		//srand(time(0));
		srand('C' + 'T' + 'A' + 'C' + 'Y' + 'M' + 'B' + 'A');
	}

	~__isoff() {
		//if(_ijps) cout<<times<<'\n';
	}
} __osafwf;

int main() {
	int n;
	cin >> n;
	deque<int> T;
	bool rev = false;
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		if (i % 2) {
			T.push_back(t);
		}
		else {
			T.push_front(t);
		}
	}
	if (!(n % 2)) {
		reverse(T.begin(), T.end());
	}
	for (auto v : T) {
		cout << v << ' ';
	}
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
int main(){
  int w[100050],n,k,q,a;
  cin >> n >> k >> q;
  for(int i=0;i<=n;i++){
w[i]=0;
  }
  for(int i=0;i<q;i++){
    cin >> a;
    w[a]++;
  }
  for(int i=1;i<=n;i++){
    if(q-w[i]>=k) cout << "No" << endl;
    else cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<climits>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
#define ll long long
ll dp[100009];
ll arr[100009] = {0};
int n = 0,k = 0;

ll solve(int i)
{
    if(i == n-1)
        return 0;

    if(dp[i] != -1)
        return dp[i];

    ll op1 = INT_MAX;
    for(int j = 1;j<=k;j++)
    {
     if(i+j<n)
     {
       op1 = min(abs(arr[i] - arr[i+j]) + solve(i+j),op1);
       dp[i] = op1;
     }
    }
   return dp[i];
}



int main()
{
    cin>>n;
    cin>>k;
    for(int i=0;i<n;i++)
        cin>>arr[i];
        memset(dp,-1,sizeof(dp));
        cout<<"\n"<<solve(0);
        return 0;
}


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

struct UnionFind {
  vector<int> d;
  vector<int> r;
  UnionFind(int n): d(n,-1),r(n,-1){}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  int rank(int x) {
    if (r[x] < 0) return x;
    return r[x] = rank(r[x]);
  }
  bool unite(int x,int y) {
    x = find(x);y = find(y);
    if(x == y) return false;
    if (d[x] > d[y])swap(x,y);
      d[x] += -1;
      r[x] += r[y];
      d[y] = x;
      r[y] = x;
      return true;
  }
  bool same(int x,int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
  int size2(int x) { return -r[rank(x)];}
};

int deg[100005];
vector<int> to[100005];

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  UnionFind uf(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a; --b;;
    deg[a]++;
    deg[b]++;
    uf.unite(a,b);
  }
  rep(i,k) {
    int a,b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  rep(i,n) {
    int ans = uf.size2(i)-1-deg[i];
    for(int u : to[i]) {
      if (uf.same(i,u)) --ans;
    }
    printf("%d%c", ans, i==n-1?'\n':' ');
  }
  return 0;
}


Measured memory_bytes: 7168
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(){
  
  int N,M; cin >> N >> M;
  vector<vector< int > > vec(M);
  
  for (int i = 0; i < M; i++){
    int k; cin >> k;
    vec[i].resize(k);
    for(int j = 0; j < k; j++){
      cin >> vec[i][j];
    }
  }

  vector <int> p(M);
  for(int i = 0; i < M; i++){
    cin >> p[i];
  }

  int ans = 0;

  for(int i = 0; i < (1 << N); i++){
    bool flag = true;
    for (int j = 0; j < M; j++){
      int cnt = 0;
      for(auto x: vec[j]){
	if((i >> (x-1)) & 1){
	  cnt++;
	}
      }
      if((cnt%2) != p.at(j)) flag = false;
    }
    if(flag) ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
/**
 * File    : E.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-9-29 21:23:01
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N;
string S;
int parent[100010];

void no()
{
  cout << -1 << endl;
  exit(0);
}

void yes()
{
  for (auto i = 0; i < N; i++)
  {
    if (parent[i] != -1)
    {
      cout << i + 1 << " " << parent[i] + 1 << endl;
    }
  }
  exit(0);
}

int main()
{
  cin >> S;
  N = S.size();
  if (S[N - 1] == '1')
  {
    no();
  }
  for (auto i = 0; i < N - 2; i++)
  {
    int j = N - 2 - i;
    if (S[i] != S[j])
    {
      no();
    }
  }
  if (S[0] == '0')
  {
    no();
  }
  int M = N / 2;
  int now = 0;
  for (auto i = 0; i < M; i++)
  {
    if (S[i] == '1')
    {
      parent[now] = i + 1;
      now = i + 1;
      parent[now] = -1;
    }
    else
    {
      parent[i + 1] = now;
    }
  }
  for (auto i = M; i < N - 1; i++)
  {
    parent[i + 1] = now;
  }
  yes();
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define mod 1e+7
#define int long long
#define garou ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
signed main() {
	int a,b,c,d;
    cin>>a>>b>>c>>d;
  int l=-1,r=-1;
  if(a%d==0){
      l=a/d;
  }
  else{
      l=(a/d)+1;
  }
  if(c%b==0){
      r=c/b;
  }
  else{
      r=(c/b)+1;
  }
  if(l>=r){
      cout<<"Yes";
  }
  else{
      cout<<"No";
  }
}

Measured memory_bytes: 3632
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        int n = Utils.ReadInts()[0];
        string[] s = new string[n];

        for (int i = 0; i < n; i++)
        {
            char[] ss = Console.ReadLine().ToArray();
            Array.Sort(ss);
            s[i] = new string(ss);
        }
        long count = 0;
        var groups = s.GroupBy(a => a);
        foreach (var group in groups)
        {
            long groupCount = group.Count();
            count += groupCount * (groupCount - 1) / (long)2;
        }

        Utils.Return(count);
    }
}

static class Utils
{
    /// <summary>
    /// int入力を取得する
    /// </summary>
    /// <returns></returns>
    public static int[] ReadInts()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    /// <summary>
    /// 最初に条件ヒットした配列のindexを取得する
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="source"></param>
    /// <param name="func"></param>
    /// <param name="start"></param>
    /// <returns></returns>
    public static int FindFirstIndex<T>(IList<T> source, Func<T, bool> func, int start)
    {
        for(int i = start; i < source.Count; i++)
        {
            if (func(source[i]))
            {
                return i;
            }
        }
        return -1;
    }
    /// <summary>
    /// Yes or Noの文字列を返却する
    /// </summary>
    /// <param name="result"></param>
    public static void ReturnYesOrNo(bool result)
    {
        Console.WriteLine(result ? "Yes" : "No");
        Console.ReadLine();
    }

    internal static void Return(object result)
    {
        Console.WriteLine(result);
    }
    /// <summary>
    /// コンソール入力を指定回数受け取る
    /// </summary>
    /// <param name="n"></param>
    /// <returns></returns>
    internal static string[] ReadStrings(int n)
    {
        string[] result = new string[n];
        for(int i = 0; i < n; i++)
        {
            result[i] = Console.ReadLine();
        }
        return result;
    }
}
/// <summary>
/// ソートクラス
/// </summary>
class IntDisComparetor : IComparer<int>
{
    public static IComparer<int> Instance { get; } = new IntDisComparetor();
    private IntDisComparetor() { }
    public int Compare(int x, int y)
    {
        return Comparer<int>.Default.Compare(y, x);
    }
}
/// <summary>
/// ソートクラス
/// </summary>
class IntComparetor : IComparer<int>
{
    public static IComparer<int> Instance { get; } = new IntComparetor();
    private IntComparetor() { }
    public int Compare(int x, int y)
    {
        return Comparer<int>.Default.Compare(x, y);
    }
}

Measured memory_bytes: 35592
// G++ MACRO.CPP -STD=C++17
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair
 
int main(){
  SCIN(a,b);
  SANKOU((a=="H"&&b=="H")||(a=="D"&&b=="D"),H,D);
 
  return 0;
}

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

  
// Driver code 
int main() 
{ 
    int n;
    cin>>n;
    vector<int> arr(n), sum(n), diff(n);
    map<int, int> ct;
    for(int i = 0; i < n; i++)
        {cin>>arr[i];}
    for(int i = 0; i < n; i++)
        sum[i]=i+arr[i];
    for(int j = 0; j < n; j++)
    {
        diff[j] = j - arr[j];
        ct[diff[j]]++;
    }
    sort(diff.begin(), diff.end());
    sort(sum.begin(), sum.end());
    long long ans = 0;
    for(int i = 0; i < n; i++)
        // if(binary_search(diff.begin(), diff.end(), sum[i]))
            ans+=ct[sum[i]];
    cout<<ans<<endl;
    return 0; 
} 

Measured memory_bytes: 22640
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
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(a > b){ a = b; return 1; } return 0; }
typedef long long ll;
vector<ll> a;
vector<vector<ll>> dp;
vector<ll> sum;
ll rec(int left, int right) {
  if(left + 1 == right) return 0;
  if(dp[left][right] > 0) return dp[left][right];
  ll res = 1e+18;
  for (int i = left + 1; i < right; ++i) {
    chmin(res, rec(left, i) + rec(i, right) + sum[i] - sum[left] + sum[right] - sum[i]);
  }
  return dp[left][right] = res;
}

int main()
{
  int n;cin >> n;
  a.resize(n);
  rep(i,n) cin >> a[i];
  sum.resize(n+1, 0);
  rep(i,n) sum[i+1] = sum[i] + a[i];
  
  dp.resize(n+1, vector<ll>(n+1, 0));
  
  cout << rec(0, n) << "\n";
  
  return 0;
}


Measured memory_bytes: 1536
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

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 SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }

typedef pair<int, ll> P;

class D {
	int n, q, k;
	vll d;
	vector<vector<P>> g;
	const int nul = INTMAX;
public:
	D()
	{
		cin >> n;
		d.resize(n + 1, nul);
		g.resize(n + 1);

		REP(i, n - 1)
		{
			int a, b;
			ll c;
			cin >> a >> b >> c;

			g[a].emplace_back(MP(b, c));
			g[b].emplace_back(MP(a, c));

		}

		cin >> q >> k;

	}

	void init()
	{
		d[k] = 0;

		deque<int> que;
		que.PB(k);

		while (!que.empty())
		{
			int cur = que.front(); que.pop_front();

			REP(i, SZ(g[cur]))
			{
				int nxt = g[cur][i].first;
				ll c = g[cur][i].second;

				if (d[nxt] == nul)
				{
					d[nxt] = d[cur] + c;
					que.PB(nxt);
				}
			}
		}

	}

	void solve()
	{

		init();
/*
		REP(i, n + 1)
			cout << d[i] << " ";
		cout << endl;
*/
		REP(i, q)
		{
			int x, y;
			cin >> x >> y;

			cout << d[x] + d[y] << endl;

		}

	}
};


int main()
{
	D solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 9984
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int a;
	string s;
	cin >> a >> s;
	if(a >= 3200) cout << s << endl;
	else cout << "red" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <random>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
//const double EPS = 1e(-12);
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
#define ALL(a) ((a).begin(), (a).end())

int N;
ll A[100010];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(7);
    cin >> N;
    for (int i = 0; i < N; ++i)
    {
        cin >> A[i];
    }

    int t[100010];
    for (int i = 0; i < N; ++i)
    {
        t[i] = A[i];
    }
    ll ans = 0, cnt = 0;

    for (int i = 0; i < N - 1; ++i)
    {
        ll tmp = t[i] / 2;
        cnt += tmp;
        t[i] -= tmp * 2;

        tmp = min(t[i], t[i + 1]);
        cnt += tmp;
        t[i] -= tmp;
        t[i + 1] -= tmp;
    }
    cnt += t[N - 1] / 2;
    ans = cnt;

    for (int i = 0; i < N; ++i)
    {
        t[i] = A[i];
    }

    cnt = 0;
    for (int i = N - 1; i >= 1; --i)
    {
        ll tmp = t[i] / 2;
        cnt += tmp;
        t[i] -= tmp * 2;

        tmp = min(t[i], t[i - 1]);
        cnt += tmp;
        t[i] -= tmp;
        t[i - 1] -= tmp;
    }
    cnt += t[0] / 2;
    ans = max(ans, cnt);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1408
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [D] = [int(input_raw[0])]
    if D==25:
        print "Christmas"
    elif D==24:
        print "Christmas Eve"
    elif D==23:
        print "Christmas Eve Eve"
    elif D==22:
        print "Christmas Eve Eve Eve"



if __name__ == '__main__':
    main()


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

using i64 = long long;
using P = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()


void solve(long long X, long long Y, long long Z){
    cout << Z << " " << X << " " << Y << endl;
}

struct IoSetup {
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    long long Z;
    scanf("%lld",&Z);
    solve(X, Y, Z);
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import numpy as np

N, K = map(int, input().split())

Hn = np.array(input().split(" "), dtype=np.int)

Hn = np.sort(Hn)[::-1]

if N >= K:
    out = np.sum(Hn[K:])
else:
    out = 0

print(out)


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

int main() {
  double x,a=100,ans=0;
  cin >> x;
  while(a<x){ a /= 100; a *= 101; a=floor(a); ans++;}
  cout << ans << endl;
}


Measured memory_bytes: 3788
import Control.Applicative
import Data.Char

main :: IO ()
main =  do 
    s <- getLine
    putStrLn $ show (solve s)

solve :: String -> Int 
solve s | s == "SUN" = 7
        | s == "MON" = 6
        | s == "TUE" = 5
        | s == "WED" = 4
        | s == "THU" = 3
        | s == "FRI" = 2
        | otherwise  = 1

Measured memory_bytes: 380
def main(N):
    if N==1:
        return 0
    elif N==2:
        return 2
    else:
        return (10**N - (9**N*2 - 8**N))%(10**9 + 7)

if __name__ == '__main__':
    N = int(input())
    ans = main(N)
    print(ans)



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

using namespace std;

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

const int N = 55;

int n, m;
ll Pass[N];
vector <pii> Adj[N];

bool DFS(int x, int y, int i, int p = 0)
{
    if(x == y)  return true;

    for(int k = 0; k < Adj[x].size(); k++)
    {
        int z = Adj[x][k].first;
        int j = Adj[x][k].second;

        if(z == p)  continue;

        Pass[i] |= (1LL << j);

        if(DFS(z, y, i, x)) return true;

        Pass[i] &= ~(1LL << j);
    }

    return false;
}

ll Rec(int i = 0, int k = 0, ll Mask = 0)
{
    if(i == m)
    {
        ll Res = 1LL << ((ll)n - 1 - __builtin_popcountll(Mask));

        return k & 1 ? -Res : +Res;
    }

    return Rec(i + 1, k, Mask) + Rec(i + 1, k + 1, Mask | Pass[i]);
}

int main()
{
    cin >> n;

    for(int i = 1; i < n; i++)
    {
        int x, y;   scanf("%d%d", &x, &y);

        Adj[x].emplace_back(y, i);
        Adj[y].emplace_back(x, i);
    }

    cin >> m;

    for(int i = 0; i < m; i++)
    {
        int x, y;
        scanf("%d%d", &x, &y);
        DFS(x, y, i);
    }

    cout << Rec() << endl;
}


Measured memory_bytes: 256
#include <iostream>

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

using namespace std;
int isLike(int *a,int i){
	if(i == a[a[i]]){
		return 1;
	}
	else return 0;
}

int main(){

	int n;
	int *a;
	int sum=0;
	int *flag;

	cin>>n;
	a = new int[n];
	flag = new int[n];

	REP(i,n){
		int tmp;
		cin>>tmp;
		a[i] = tmp-1;
		flag[i]=0;
	}

	REP(i,n){
		if(isLike(a,i) && !flag[i]){
			sum++;
			flag[a[i]]=1;
		}
		flag[i]=1;
	}


	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int i;
	int j;
	
	for (i = 1; i < 10; i++){
		for (j = 1; j < 10; j++){
			printf("%dx%d=%d\n", i, j, i * j);
		}
	}
	
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
int main(){

	int n, mx = -1, ans; cin>>n;
	for(int i=1; i<=n; i++){
		int cnt = 0, tmp = i;
		while(tmp > 1 && tmp % 2 == 0)
			tmp /= 2, cnt++;
		if(mx < cnt){mx = cnt; ans = i;}
		//cout<<i<<" "<<cnt<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
using ulong = unsigned long;
using ll = long long;
const int M = 1e9 + 7;
#pragma unused(M)

int main(){
	int n;
	cin >> n;
	string s1, s2;
	char q[2][4] = {
		{'.', '.', '#', '#',},
		{'.', '#', '.', '#',},
	};
	string ans;
	bool next = false;
	//right
	while(!next){
		s1 += ' '; s2 += ' ';
		for(int i=0;i<4;i++){
			s1.back() = q[0][i];
			s2.back() = q[1][i];
			cout << s1 << '\n' << s2 << endl;
			cin >> ans;
			if(ans == "F"){
				if(i == 3){
					next = true;
					s1.pop_back();
					s2.pop_back();
				}
				continue;
			}else if(ans == "T"){
				break;
			}else{
				return 0;
			}
		}
	}
	//left
	while(1){
		s1 = ' ' + s1; s2 = ' ' + s2;
		for(int i=0;i<4;i++){
			s1[0] = q[0][i];
			s2[0] = q[1][i];
			cout << s1 << '\n' << s2 << endl;
			cin >> ans;
			if(ans == "F"){
				continue;
			}else if(ans == "T"){
				break;
			}else{
				return 0;
			}
		}
	}
}



Measured memory_bytes: 1228
#include <bits/stdc++.h>
#define DIM 107
#define INF 1000000000000000007
//#define endl "\n"
using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<long long, long long>  pairll;

ll n,m,h,w;
ll i,j,res;
ll a[DIM][DIM];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    cin >> h >> w;
    for(i=1; i<=h; i++){
        for(j=1; j<=m; j++) a[i][j]=1;
    }
    for(i=1; i<=n; i++){
        for(j=1; j<=w; j++) a[i][j]=1;
    }
    for(i=1; i<=n; i++){
        for(j=1; j<=m; j++) if(a[i][j]==0) res++;
    }
    cout << res << endl;
    return 0;
}


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

int main()
{
	string text, pat;
	cin >> text >> pat;

	int n = text.size();
	int k = pat.size();
	vector<int> failure(k + 1);

	failure[0] = 0;
	for(int i = 1; i <= k; i++) {
		int v = i - 1;
		while(v > 0) {
			v = failure[v];
			if(pat[v] == pat[i - 1]) {
				failure[i] = v + 1;
				v = -1;
				break;
			}
		}
		if(v == 0) {
			failure[i] = 0;
		}
		//printf("failure[%d] = %d\n", i, failure[i]);
	}

	int state = 0;
	vector<int> ans;

	for(int pos = 0; pos < n; pos++) {

		if(state < k && pat[state] == text[pos]) {
			state += 1;
			if(state == k) {
				ans.push_back(pos + 1 - k);
			}
			continue;
		}

		if(state > 0) {
			state = failure[state];
			pos -= 1;
		}
	}

	ios::sync_with_stdio(false);

	for(auto a : ans) {
		cout << a << "\n";
	}

	return 0;
}



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

using namespace std;
typedef long long ll;
typedef vector<pair<ll, ll> > vpll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FI first
#define SE second
#define SZ(x) (ll) x.size()

//-----------------------------------------
vector<long long> factor_array(long long n){
    vector<long long> res ;
    for(long long i=1;i*i<=n;i++){
        if(n%i==0){
            res.push_back(i) ;
            if(i*i!=n){
                res.push_back(n/i) ;
            }
        }
    }
    sort(res.begin(),res.end()) ;
    return res ;
}

bool is_prime(long long n){
    if(n==2){
        return true ;
    }
    else if(n<2 || n%2==0){
        return false ;
    }
    else{
        long long i = 3 ;
        while(i*i<=n){
            if(n%i==0){
                return false ;
            }
            i += 2 ;
        }
        return true ;
    }
}

vector<pair<long long, long long>> prime_factorization(long long n){
    vector<pair<long long, long long>> res ;
    vector<long long> tmp = factor_array(n) ;
    for(long long i = 0; i<(long long)tmp.size(); i++){
        if(is_prime(tmp[i])){
            long long m = n ;
            long long cnt = 0 ;
            while(m%tmp[i]==0){
                m /= tmp[i] ;
                cnt++ ;
            }
            res.push_back(make_pair(tmp[i],cnt)) ;
        }
    }
    return res ;
}
//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n ;
    cin >> n ;
    vpll tmp = prime_factorization(n) ;
    int ans = 0 ;
    REP(i,SZ(tmp)){
        int j = 1 ;
        while(tmp[i].SE-j>=0){
            tmp[i].SE -= j ;
            j++ ;
            ans++; 
        }
    }
    cout << ans <<endl;


    return 0;
}

Measured memory_bytes: 3676
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor.hpp>
#include <boost/algorithm/string.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::math;

using ll = long long;
namespace bst = boost;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<string> s;


  return ((s[2] == s[3] && s[4] == s[5]) ? "Yes" : "No");
}

template<typename T> void plot(const T& func) { cout << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }
template<> void plot<double()>(double(&func)()) { cout << setprecision(9) << func() << endl; }

int main() {
  plot(solve);

  return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;


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

	string s;
	int dp[10][10][2] = {};
	int ndp[10][10][2] = {};
	while (cin >> s, s != "#") {
		for (auto &i : s)i--;
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				for (int k = 0; k < 2; k++) {
					dp[i][j][k] = MOD;
				}
			}
		}
		for (int i = 0; i < 9; i++) {
			for (int j = 0; j < 9; j++) {
				if (i % 3 <= j % 3) {
					dp[i][j][0] = dp[i][j][1] = 0;
				}
			}
		}
		for (auto c : s) {
			for (int i = 0; i < 10; i++) {
				for (int j = 0; j < 10; j++) {
					for (int k = 0; k < 2; k++) {
						ndp[i][j][k] = MOD;
					}
				}
			}
			for (int i = 0; i < 9; i++) {
				for (int j = 0; j < 9; j++) {
					int a = c - '0', b = j;
					if (a % 3 <= b % 3) {
						ndp[a][b][0] = min({ ndp[a][b][0], dp[i][j][0] + 1,dp[i][j][1] });
					}
					a = i, b = c - '0';
					if (a % 3 <= b % 3) {
						ndp[a][b][1] = min({ ndp[a][b][1], dp[i][j][1] + 1,dp[i][j][0] });
					}
				}
			}
			for (int i = 0; i < 10; i++) {
				for (int j = 0; j < 10; j++) {
					for (int k = 0; k < 2; k++) {
						dp[i][j][k] = ndp[i][j][k];
					}
				}
			}
		}
		int ans = MOD;
		for (int i = 0; i < 9; i++) {
			for (int j = 0; j < 9; j++) {
				for (int k = 0; k < 2; k++) {
					ans = min(ans, dp[i][j][k]);
				}
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3264
#include<bits/stdc++.h>
using namespace std;
signed main(){
  vector<int> a,b;
  int c=1,d,e=0;
  while(true){
    cin>>c>>d;
    if(c==0&&d==0){
      break;
    }
    a.push_back(c);
    b.push_back(d);
    e++;
  }
  for(int i=0;i<e;i++){
    for(int j=0;j<a[i];j++){
      for(int h=0;h<b[i];h++){
	cout<<"#";
      }
      cout<<"\n";
    }
    cout<<'\n';
  }
  return(0);
}
    


Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long a, b, c;
  cin >> a >> b >> c;
  if(c < a+ b){
      cout << "No" << endl;
      return 0;
  }
  if(4*a*b < (c - a - b)*(c - a - b)){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}


Measured memory_bytes: 764