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

#include <algorithm>
#include <array>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <vector>

using namespace std;
using Graph = vector<vector<int>>;

using ll = long long;
typedef pair<ll, ll> P_ll;
typedef pair<int, int> P;

const ll INF_ll = 1e17;
const int INF = 1e8;

int main() {
  int N, W;
  cin >> N >> W;
  vector<vector<int>> vw(N, vector<int>(2, 0));
  for (int i = 0; i < N; i++) {
    cin >> vw[i][0] >> vw[i][1];
  }
  vector<vector<int>> dp(N + 1, vector<int>(W + 1, 0));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= W; j++) {
      if (j < vw[i][1]) {
        dp[i + 1][j] = dp[i][j];
      } else {
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - vw[i][1]] + vw[i][0]);
      }
    }
  }
  cout << dp[N][W] << endl;
}


Measured memory_bytes: 6840
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

const int MAXN = 1000000;
Int fact[MAXN], inv[MAXN];

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

void init_fact() {
    fact[0] = 1;
    for(int i=1; i<MAXN; i++) {
        fact[i] = (fact[i-1] * i) % MOD;
    }

    inv[MAXN - 1] = mod_pow(fact[MAXN - 1], MOD-2);
    for(int i=MAXN - 2; i>=0; i--) {
        inv[i] = (inv[i+1] * (i+1)) % MOD;
    }
}

Int comb(int n, int r) {
    if(r < 0 || n < r) return 0;
    return fact[n] * inv[n-r] % MOD * inv[r] % MOD;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

char s[100005];
char st;
void rec(char a, char b){
    if (a == 'T' && b == 'F') st = 'F';
    else st = 'T';
}
int field[10][10];
vector<int> ans;

int rec(int a, int b, int c, int d){
    int cnt = 0;
    for (int i = a; i <= c; i++){
        for (int j = b; j <= d; j++){
            if (field[i][j]){
                cnt++;
            }
        }
    }
    ans.push_back(cnt);
    return 0;
}
int a[10];

int main(){
    cin.tie(0);

    int ma = -1;
    for (int i = 0; i < 3; i++){
        cin >> a[i];
        ma = max(a[i], ma);
    }
    for (int i = 0; i < 3; i++){
        if (ma == a[i]){
            cout << (char)('A' + i) << endl;
            return 0;
        }
    }

}



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

int main() {
    
    // 1. input.
    int a, b;
    cin >> a >> b;
    
    // 2. output answer.
    if(a < b)  cout << "a < b" << endl;
    if(a > b)  cout << "a > b" << endl;
    if(a == b) cout << "a == b" << endl;
    
    return 0;
    
}


Measured memory_bytes: 3088
#include <iostream>
#include <string>

using namespace std;

int main()
{
  auto const rot = []( string s, int g )
    {
      for( char& c : s )
        if ( c >= 'a' && c <= 'z' )
          c = (c - 'a' + g) % 26 + 'a';
      return s;
    };

  string s;
  while( getline( cin, s ) ) {
    for( int g=0; g<26; ++g ) {
      auto const& t = rot( s, g );
      if ( t.find( "the" ) != string::npos
           || t.find( "this" ) != string::npos
           || t.find( "that" ) != string::npos
           ) {
        cout << t << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 1184
with Ada.Text_IO, Ada.Integer_Text_IO;
 use Ada.Text_IO, Ada.Integer_Text_IO;

procedure main is
   K: Integer;
   A: Integer;
   B: Integer;
begin
   get(K);
   get(A);
   get(B);
   for i in A..B loop
      if (i rem K = 0) then
        put_line("OK");
        return;
      end if;
   end loop;
   put_line("NG");
end main;

Measured memory_bytes: 3676
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define min(x, y) ((x) < (y) ? (x) : (y))
int main()
{
	int n; scanf("%d", &n);
	rep(i, n) {
		int h, m; scanf("%d:%d", &h, &m);
		double ah = 0.5 * (60 * h + m);
		double am = 6.0 * m;
		double d = fabs(ah - am);
		d = min(d, 360.0 - d);

//printf("%02d:%02d, %4.1f %4.1f, d=%.1f ", h, m, 0.5 * ah, 0.5 * am, d);
		if (d < 30) puts("alert");
		else if (d < 90) puts("warning");
		else puts("safe");
	}
	return 0;
}

Measured memory_bytes: 0
s = input()

ans = 0

n = len(s)-1

for i in range(2 ** n):
    bag = []
    for j in range(n):
        if ((i >> j) & 1):
            bag.append(1)
        else:
            bag.append(0)
    c = 0

    temp = s
    for j in range(0, n):
        c += 1
        if (bag[j]):
            temp = temp[:c] + '+' + temp[c:]
            c += 1

    ans += eval(temp)


print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)


long long poww(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;  
        x = x * x % MOD;
        n >>= 1;  
    }
    return ret;
}

int main(){
    ll N;
    cin>>N;
    if(N==1){
        cout<<0<<endl;
        return 0;
    }


    ll ans=(poww(10,N)-poww(9,N)-poww(9,N)+poww(8,N))%MOD;
    if(ans<0){
        ans+=MOD;
    }
    cout<<ans<<endl;






    
}

Measured memory_bytes: 3620
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define all(v) v.begin(), v.end()
#define P pair<int, int>
const ll  MOD = 1000000007;

int main() {
	ll n;
	cin >> n;
	vector<ll> h(n);
	vector<bool> c(n, true);
	rep(i, n) cin >> h.at(i);
	for (ll i = 0; i < n - 1; ) {
		if (h.at(i) > h.at(i + 1)) {
			h.at(i)--;
			c.at(i) = false;
			if (h.at(i) > h.at(i + 1)) {
				cout << "No";
				return 0;
			}
			i += 2;
		}
		else i++;
	}
	rep(i, 100) {
		for (ll i = 0; i < n - 1; ) {
			if (h.at(i) > h.at(i + 1)) {
				if (c.at(i)) {
					h.at(i)--;
					c.at(i) = false;
				}
				if (h.at(i) > h.at(i + 1)) {
					cout << "No";
					return 0;
				}
				i += 2;
			}
			else i++;
		}
	}
	cout << "Yes";
	return 0;
}

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

#define rep(X,N) for(int X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    int n;
    cin >> n;

    vector<ll> a(n);
    vector<ll> b(n);

    rep(i, n){
        cin >> a[i] >> b[i];

        if(n % 2 == 0){
            a[i] *= 2;
            b[i] *= 2;
        }
    }

    sort(ALL(a));
    sort(ALL(b));

    if(n % 2 == 0){
        cout << max((b[n / 2] + b[n / 2 - 1]) / 2 - (a[n / 2] + a[n / 2 - 1]) / 2 + 1, 0LL) << endl;
    }else{
        cout << max(b[n / 2] - a[n / 2] + 1, 0LL) << endl;
    }



    return 0;
}


Measured memory_bytes: 6388
if __name__ == "__main__":
    a,b,c,k = map(int,input().split())
    if k%2 == 0:
        if abs(a-b)>10**18:
            print("Unfair")
        else:
            print(a-b)
    else:
        if abs(a-b)>10**18:
            print("Unfair")
        else:
            print(b-a)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;

int main(void){
    // Your code here!
    int w,h,n;
    cin >> w >> h >> n;
    if (w >= h) cout << ceil((double)n / w) << endl;
    else cout << ceil((double)n / h) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   String s = sc.next();
   String t = sc.next();
   int a = sc.nextInt();
   int b = sc.nextInt();
   String u = sc.next();

   if(s.equals(u)){
     System.out.println((a-1)+" "+b);
   }
   else if(t.equals(u)){
     System.out.println(a+" "+(b-1));
   }
 
 }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <cstdint>
#include <sys/time.h>

typedef std::int_fast32_t  s32;
typedef std::uint_fast32_t u32;
typedef std::int_fast64_t  s64;
typedef std::uint_fast64_t u64;

const unsigned long mod = 1000000007;
const double EPS = 0.00000001;
const int INF = (1 << 29);

typedef std::pair<int, int> pii;

template<typename T>
void print_array(T *A_, s32 size) {
  //printf("%d\n", size);
  if( size != 0 ) {
    for(int i = 0; i < size - 1; ++i) {
      printf("%d ", A_[i]);
    }
    printf("%d\n", A_[size - 1]);
  }
}

double diagonal2(pii p) {
  double h = p.first;
  double w = p.second;
  return h * h + w * w;
}

bool operator < (pii left, pii right) {
  if( diagonal2(left) < diagonal2(right) ) {
    return true;
  }
  if( diagonal2(left) > diagonal2(right) ) {
    return false;
  }
  return left.first < right.first;
}

int main() {

  for(;;) {
    int h, w;
    std::cin >> h >> w;
    if( h == 0 and w == 0 ) break;
    
    pii target(h, w);
    pii res(301, 301);
  
    for(int y = 1; y <= 200; ++y) {
      for(int x = y + 1; x <= 200; ++x) {
        pii temp(y, x);
        if( target < temp and temp < res ) {
          res = temp;
        }
      }
    }

    std::cout << res.first << " " << res.second << std::endl;
  }

  return 0;
}

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

public class Prog
{
    public void run()
    {
        var input = Console.ReadLine().Split();
        int N = int.Parse(input[0]);
        int K = int.Parse(input[1]);
        int rest = N - K;
        if(K == 1)
        {
            Console.WriteLine("0");
        }
        else
        {
            Console.WriteLine(rest);
        }
    }
    public static void Main()
    {
        //var input = Console.ReadLine().Split();
        //int[] X = Array.ConvertAll(input, int.Parse);
        var prog = new Prog();
        prog.run();
    }
}

//Array.ConvertAll(int.Parse)

Measured memory_bytes: 11092
n, m = map(int, input().split())
ans = [0] * n

for i in range(m):
    s, c = map(int, input().split())

    if(ans[s-1] != 0 and ans[s-1] != c):
        print(-1)
        exit()
    elif(n != 1 and s == 1 and c == 0):
        print(-1)
        exit()
    else:
        ans[s-1] = c

if(ans[0] == 0 and len(ans) > 1):
    print(str(1) + "" .join(map(str, ans[1:])))
else:
    print("".join(map(str, ans)))


Measured memory_bytes: 9192
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for (int x=0; x<=2000; x++) {
			for (int y=0; y<=4000; y++) {
				int z = N - x - y;
				if (z >= 0 && 10000*x + 5000*y + 1000*z == Y) {
					System.out.println(String.format("%d %d %d", x, y, z));
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
}

Measured memory_bytes: 21972
N = int(input())
s = input()
t = input()

S = s + t
r = len(S)
for i in range(N):
    ti = t[:(N-i)]
    index = s.find(ti)
    if index > -1:
        print(len(s)+len(t) - (len(s)-index))
        exit()
print(r)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,k,a[N],b[N];
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=k;i++)
    {
        bool flag=true;
        memset(b,0,sizeof(b));
        for(int j=1;j<=n;j++)
        {
            int l=max(1,j-a[j]),r=min(n,j+a[j]);
            b[l]++;b[r+1]--;
        }
        for(int j=1;j<=n;j++)
        {
            b[j]+=b[j-1];
            if(b[j]!=a[j]) a[j]=b[j],flag=false;
        }
        if(flag) break;
    }
    for(int i=1;i<=n;i++)
        printf(i==n?"%d\n":"%d ",a[i]);
}


Measured memory_bytes: 5384
using System;

class Program
{
    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        double x1 = double.Parse(str[0]);
        double y1 = double.Parse(str[1]);
        double x2 = double.Parse(str[2]);
        double y2 = double.Parse(str[3]);
        double dx = x1 - x2, dy = y1 - y2;
        Console.WriteLine(Math.Sqrt(dx * dx + dy * dy));
    }
}


Measured memory_bytes: 15944
#include<iomanip>
#include<iostream>
#include<complex>
using namespace std;
typedef complex<double> xy_t;

double dot(xy_t a,xy_t b){
    return (conj(a)*b).real();
}

xy_t proj(xy_t a,xy_t b){ //b???a????°???±
    return b*dot(a,b)/norm(b);
}

int main(){
    double x1,y1,x2,y2,xq,yq;
    char no;
    while(cin>>x1>>no>>y1>>no>>x2>>no>>y2>>no>>xq>>no>>yq){
        xy_t normal=xy_t(y2-y1,x1-x2); //??????????????????
        //cerr<<normal.real()<<" "<<normal.imag()<<"\n";
        xy_t v=xy_t(x1-xq,y1-yq);
        //cerr<<v.real()<<" "<<v.imag()<<"\n";

        xy_t r=xy_t(xq,yq)+proj(v,normal)+proj(v,normal);
        //cerr<<proj(v,normal).real()<<" "<<proj(v,normal).imag()<<"\n";

        cout<<fixed<<setprecision(6)<<r.real()<<" "<<r.imag()<<"\n";
    }
}

Measured memory_bytes: 3328
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def p(s):
    N = len(s)
    for i in range(N//2):
        if s[i] != s[N-i-1]:
            return False
    return True

def main():
    S = input()

    N = len(S)

    if p(S) and p(S[:(N-1)//2]) and p(S[(N+1)//2:]):
        print("Yes")
    else:
        print("No")

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc159","b",main)

Measured memory_bytes: 3064
#define _GLIBCXX_DEBUG
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define mp make_pair
#define pb push_back
#define FI first
#define SE second
#define FOR(i,a,b) for(int (i)=((int)a); (i)<=((int)b); (i)++)
#define REP(i,N) FOR((i), 0, ((int)N)-1)
#define INF (1 << 30)
#define all(v) (v).begin(),(v).end()
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
#define vidx(v,it) distance((v).begin(),(it))
#define vsum(v) accumulate(all(v),0)
#define vfnd(v,val) find(all(v),val) // itrを返す
#define vcnt(v,val) count(all(v),val)
#define vrep(v,it) for(auto it=(v).begin(); it != (v).end(); ++it)

#ifdef LOCAL
    #define debug(...) fprintf(stderr, __VA_ARGS__)
    #define stopif(val) assert( !(val) )
#else
    #define debug(...) 1
    #define stopif(val) 1
#endif

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
int gcd(int a, int b){if(a>b) swap(a,b); return a==0 ? b : gcd(b%a,a);}

int main(){
    int N;
    int A,ans=0;
    cin >> N;
    REP(i,N){
        cin >> A;
        ans = gcd(ans,A);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main()
{
  int A,B;
  string S;
  cin >> A >> B;
  cin >> S;

  if( S.length() != A+B+1 )
    {
      cout << "No" << endl;
      return 0;
    }
  for( int i=0;i<S.length();i++ )
    {
      if( i==A )
	{
	  if( S[i]!='-' )
	    {
	      cout << "No" << endl;
	      return 0;
	    }
	}
      else
	{
	  int digit = S[i]-'0';
	  if( !(digit>=0 && digit<=9) )
	    {
	      cout << "No" << endl;
	      return 0;
	    }
	}
    }
  cout << "Yes" << endl;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (998244353LL)

class mod {
public:
    mod() {m_n = 0;}
    mod(ll n) {if (n >= 0) m_n = n % MOD; else m_n = n % MOD + MOD;}
    friend bool operator== (const mod& a, const mod& b) {return a.m_n == b.m_n;}
    friend bool operator!= (const mod& a, const mod& b) {return !(a == b);}
    friend mod operator+ (const mod& a, const mod& b) {return (a.m_n + b.m_n) % MOD;}
    friend mod& operator+= (mod& a, const mod& b) {return a = a + b;}
    friend mod operator- (const mod& a) {return -a.m_n;}
    friend mod operator- (const mod& a, const mod& b) {return (a.m_n + (-b.m_n)) % MOD;}
    friend mod& operator-= (mod& a, const mod& b) {return a = a - b;}
    friend mod operator* (const mod& a, const mod& b) {return (a.m_n * b.m_n) % MOD;}
    friend mod& operator*= (mod& a, const mod& b) {return a = a * b;}
    friend mod pow(const mod& n, ll r) {
        if (r == 0) {
            return 1;
        } else if (r < 0) {
            return pow(n, (MOD - 2) * (-r));
        } else if (r % 2 == 0) {
            mod tmp = pow(n, r / 2);
            return tmp * tmp;
        } else {
            return n * pow(n, r - 1);
        }
    }
    friend mod operator/ (const mod& a, const mod& b) {return a * pow(b, -1);}
    friend mod& operator/= (mod& a, const mod& b) {return a = a / b;}
    friend ostream& operator<< (ostream& os, const mod& n) {os << n.m_n; return os;}
    friend istream& operator>> (istream& is, mod& n) {ll tmp; is >> tmp; n = mod(tmp); return is;}
private:
    ll m_n;
};
mod pow(ll n, ll r) {return pow(mod(n), r);}

#define FACT_MAX 5000
mod t_fact[FACT_MAX], t_fact_inv[FACT_MAX];
mod fact(int n)
{
    if (n == 0 || n == 1) return t_fact[n] = 1;
    if (t_fact[n] != 0) return t_fact[n];
    else return t_fact[n] = n * fact(n-1);
}
mod fact_inv(int n)
{
    if (t_fact_inv[n] != 0) return t_fact_inv[n];
    else return t_fact_inv[n] = pow(fact(n), -1);
}
mod comb(int n, int k) {if (n < 0 || k < 0 || k > n) return 0; else return fact(n) * fact_inv(n - k) * fact_inv(k);}
mod multi_choose(int n, int k) {return comb(n + k - 1, k);}

int main(int argc, const char * argv[]) {
    int K, N;
    cin >> K >> N;
    
    for (int k = 2; k <= 2*K; ++k) {
        mod Res = 0;
        int p = min(k-1, K) - max(k-K, 1) + 1;
        if (k%2 != 0) {
            for (int q = 0; q <= p/2; ++q) {
                Res += comb(p/2, q) * pow(2, q) * multi_choose(K-p+q, N-q);
            }
            cout << Res << endl;
        } else {
            for (int q = 0; q <= p/2; ++q) {
                Res += comb(p/2, q) * pow(2, q) * (multi_choose(K-p+q, N-q) + multi_choose(K-p+q, N-q-1));
            }
            cout << Res << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 384
import math
import fractions
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n, x_s = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
#n, x_s = [3, 3]
#x = [1,7,11]
x.append(x_s)
y = sorted(x)
# print(y)
# print([i - y[0] for i in y][1:])
print(gcd_list([i - y[0] for i in y][1:]))
# print(y)
# print(gcd_list([i - x_s for i in y].remove(0)))


Measured memory_bytes: 16304
def resolve():
    from collections import defaultdict
    N = int(input())
    A = [int(i) for i in input().split()]
    L = defaultdict(int)
    ans = 0
    for i in range(N):
        L[A[i] + i] += 1
        ans += L[i - A[i]]
    print(ans)


resolve()


Measured memory_bytes: 61268
#include <iostream>
using namespace std;
int main(void){
    
    int A, B;
    
    cin >> A >> B;
    
    if (A == B) cout << "Draw" << endl;
    else if (A == 1) cout << "Alice" << endl;
    else if (B == 1) cout << "Bob" << endl;
    else if (A > B) cout << "Alice" << endl;
    else cout << "Bob" << endl;
    
    return 0;
    
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	String line ;
	int pos;
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			String str = sc.next() + "#";
			if(str.equals("##")) break;
			str = str.replaceAll("--", "");
			ArrayList<Character> list = new ArrayList<Character>();
			for(int i=0; i < str.length();i++){
				char temp = str.charAt(i);
				if('a' <= temp && temp <= 'k'){
					if(! list.contains(temp)){
						list.add(temp);
					}
				}
			}
			int len = list.size();
			boolean flg = true;
			for(int i=0; i < (1 << len); i++){
				line = new String(str);
				pos = 0;
				for(int j = 0; j < len; j++){
					String temp = ""+list.get(j);
					
					if((i & (1 << j)) != 0){
						line = line.replaceAll(temp, "T");
					}
					else{
						line = line.replaceAll(temp, "F");
					}
				}
				boolean res = eval();
				if(! res){
					flg = false;
					break;
				}
			}
			if(flg) System.out.println("YES");
			else System.out.println("NO");
		}
	}
	
	private boolean eval() {
		boolean left = exp();
		char op = line.charAt(pos++);
		boolean right = exp();
		return left == right;
	}

	private boolean exp() {
		char temp = line.charAt(pos++);
		switch(temp){
		case 'T':
			return true;
		case 'F':
			return false;
		case '-':
			return (! exp());
		case '(':
			boolean left = exp();
			char op = line.charAt(pos++);
			boolean right;
			switch(op){
			case '*':
				right = exp();
				pos++;
				return (left && right);
			case '+':
				right = exp();
				pos++;
				return (left || right);
			case '-':
				pos++;
				right = exp();
				pos++;
				boolean res = getA(left, right);
				return res;
			}
		}
		return false;
	}

	private boolean getA(boolean left, boolean right) {
		if(left && ! right){
			return false;
		}
		return true;
	}

	public static void main(String[] args) {
		Main obj = new Main();
		obj.doit();
	}
}

Measured memory_bytes: 13000
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <typeinfo>
using namespace std;


// define list


namespace  math{
    const double PI = 3.14;
    const int INF = 1000000007;
    int GCM(int a,int b); //最大公約数
    int LCM(int a,int b); //最小公倍数
    int Pemu(int n,int r); //順列
    int Comb(int n,int m); //組み合わせ
    int Digit(int N); //桁和
    
    int GCM(int a,int b){
        if(a<b){
            swap(a,b);
        }
        int r = a%b;
        while (r!=0)
        {
            a=b;
            b=r;
            r=a%b;
        }
        return b;
    }

    int LCM(int a,int b){
        return a*(b/GCM(a,b));
    }

    int Pemu(int n,int r){
        int ans = n;
        for(int i=1;i<r;i++){
            ans*=(ans-i);
        }
        return ans;
    }

    int Comb(int n,int m){
        int a=n,b=m;
        for(int i=1;i<m;i++){
            a *= (a-i);
        }
        for(int i=1;i<m;i++){
            b *= (b-i);
        }
        
        return a/b;
    }

    int Digit(int N){
        if(N<10){
            return N;
        }
        int r = 0;
        while (N>=10)
        {
            r += (N%10);
            N /= 10;
        }
        r += N;
        return r;
    }
}

namespace SubLib{
    #define int long long
    #define double long double
    #define incin(n) int (n); cin >> (n);
    #define strcin(s) string (s); cin >> (s);
    #define incin2(a,b) int a,b; cin >> a >> b; 
    #define rap(n,i) for(int (i) = 0;i<(n);(i)++)
    #define input(n,v) (v) = SubLib::Input((n),(v))
    #define all(v) (v).begin(),(v).end()
    using intv = vector<int>;
    using strv = vector<string>;
    using charv = vector<char>;
    template <class T1>
    using pvec = vector<pair<T1,T1>>;
    template <typename T> vector<T> Input(int n,vector<T> v){
        for(int i=0;i<n;i++){
            cin >> v.at(i);
        }
        return v;
    }
}

using namespace math;
using namespace SubLib;

signed main(){
    incin2(a,b);
    incin(k);
    int c = 0;
    for(int i=100;i>=1;i--){
        if(a%i==0 && b%i==0){
            c++;
        }
        if(c==k){
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    char c; cin >> c;
    cout << (char)(c + 1) << endl;
    return 0;
}


Measured memory_bytes: 764
#include"bits/stdc++.h"
using namespace std;
//#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const double eps = 1e-11;
const int inf = 1ll << 62;

signed main(){
	int x,t;cin>>x>>t;
	cout<<max(x-t,0)<<endl;
	}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

int main(){
  string S;
  cin >> S;

  string res = "AC";

  if(S[0] != 'A')
  {
    res = "WA";
  }

  if(islower(S[1]) == false)
  {
    res = "WA";
  }

  
  if(islower(S[S.size()-1]) == false)
  {
    res = "WA";
  }


  ll hasC = 0;
  for(ll i = 2; i < S.size()-1; ++i)
  {
    if(S[i] == 'C')
    {
      hasC++;
      continue;
    }
    if(islower(S[i]) == false)
    {
      res = "WA";
    }
  }

  if(hasC != 1)
  {
    res = "WA";
  }

  cout << res << endl;

  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
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; }
typedef pair<int,int> P;

int main(){
  int k,n;
  cin >> k >> n;
  int res = 0;
  int a[n];
  rep(i,n)cin >> a[i];
  for(int i=0;i<n-1;i++)chmax(res,a[i+1]-a[i]);
  chmax(res,a[0]+k-a[n-1]);
  cout << k-res << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(){
  int i,j,n,u,k,v,g[105][105];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++) g[i][j]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      g[u-1][v-1]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j) printf(" ");
      printf("%d",g[i][j]);
    }
    printf("\n");
  }
  return 0;
}
  



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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

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

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############
S = inputS()
N = len(S)
for i in range(N):
  if S[i] == "A":
    a = i
    break
for i in range(N)[::-1]:
  if S[i] == "Z":
    z = i
    break

print(z-a+1)

Measured memory_bytes: 40176
#include<stdio.h>
#include<math.h>
int main(void)
{
    double x1,x2,y1,y2,ans1,ans2,ans;
    scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
    ans1=fabs(x2-x1);
    ans2=fabs(y2-y1);
    ans1=pow(ans1,2);
    ans2=pow(ans2,2);
    ans=sqrt(ans1+ans2);
    printf("%f\n",ans);
    return 0;
}


Measured memory_bytes: 2104
//omajinai c++
#include <iostream>
#include<cmath>
#include<vector>
#include <algorithm>
#include <limits>
#include <numeric>
#include <type_traits>
#include <map>
#include <string>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
constexpr auto mod = 1000000007;
using namespace std;
int main() {
string s;
  cin>>s;
  rep(i,s.size()){
    cout<<'x';
  }
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		if(Integer.parseInt(sc.next()) < 9 && Integer.parseInt(sc.next()) < 9) ou.println("Yay!");
		else ou.println(":(");
		ou.flush();
	}
}

Measured memory_bytes: 35808
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func max(a ...int) int {
	m := a[0]
	for i, v := range a {
		if i == 0 {
			continue
		}
		if m < v {
			m = v
		}
	}
	return m
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for E - Dist Max
	var N int
	fmt.Scan(&N)

	sc.Split(bufio.ScanWords)
	x := make([]int, N)
	y := make([]int, N)

	var z1, z2 int

	var Max1 int
	var MaxNum1 int
	var Min1 int = 10000000000
	var MinNum1 int

	var Max2 int
	var MaxNum2 int
	var Min2 int = 10000000000
	var MinNum2 int

	for i := 0; i < N; i++ {
		x[i] = nextInt()
		y[i] = nextInt()

		z1 = x[i] - y[i]
		z2 = x[i] + y[i]

		if Max1 < z1 {
			Max1 = z1
			MaxNum1 = i
		}

		if Min1 > z1 {
			Min1 = z1
			MinNum1 = i
		}

		if Max2 < z2 {
			Max2 = z2
			MaxNum2 = i
		}

		if Min2 > z2 {
			Min2 = z2
			MinNum2 = i
		}
	}

	var ans, ans1, ans2, ans3, ans4 int
	for i := 0; i < N; i++ {
		ans1 = int(math.Abs(float64(x[MaxNum1]-x[i]))) + int(math.Abs(float64(y[MaxNum1]-y[i])))
		ans2 = int(math.Abs(float64(x[MinNum1]-x[i]))) + int(math.Abs(float64(y[MinNum1]-y[i])))
		ans3 = int(math.Abs(float64(x[MaxNum2]-x[i]))) + int(math.Abs(float64(y[MaxNum2]-y[i])))
		ans4 = int(math.Abs(float64(x[MinNum2]-x[i]))) + int(math.Abs(float64(y[MinNum2]-y[i])))
		ans = max(ans, ans1, ans2, ans3, ans4)
	}

	fmt.Println(ans)
}


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

int main() {
  int64_t a, b, c, d;
  cin >> a >> b >> c >> d;
  
  int64_t x, y, lcm, ans;
  x = b - (b/c) - (b/d);
  y = (a-1) - ((a-1)/c) - ((a-1)/d);
  lcm = c*d;
  
  if (c < d) {
    int64_t tmp = c;
    c = d;
    d = tmp;
  }
  int64_t r = c % d;
  while (r != 0) {
    c = d;
    d = r;
    r = c % d;
  }
  
  lcm /= d;
  x += (b/lcm);
  y += ((a-1)/lcm);
  ans = x - y;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using graph = vector<vector<int>>;
using wgraph = vector<vector<pair<int, lint>>>;
const lint INF = 1001001001001001LL;
const lint MOD = 1000000007LL;
const double PI = 3.1415926535897932;
int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

void yes(){ cout << "yes" << endl; }
void Yes(){ cout << "Yes" << endl; }
void YES(){ cout << "YES" << endl; }
void no(){ cout << "no" << endl; }
void No(){ cout << "No" << endl; }
void NO(){ cout << "NO" << endl; }
void possible(){ cout << "possible" << endl; }
void Possible(){ cout << "Possible" << endl; }
void POSSIBLE(){ cout << "POSSIBLE" << endl; }
void impossible(){ cout << "impossible" << endl; }
void Impossible(){ cout << "Impossible" << endl; }
void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

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


lint cntBubbleSort(vector<lint> array){
  
  lint ret = 0;
  lint n = (lint)array.size();
      while(1){
        
        lint flag = 1;
        for(lint i = 0 ; i < n-1; i++){
            if(array[i] > array[i+1]){
                ret++;
                lint temp;
                temp = array[i];
                array[i] = array[i+1];
                array[i+1] = temp;
                flag = 0;
            }
        }
        if(flag == 1){ break ;}
    }
  
  return ret;
}

int main(){
   
  lint n, k; cin >> n >> k;
  vector<lint> a(n);
  rep(i, n) cin >> a[i];
  
  lint bubl = cntBubbleSort(a);
  cerr << bubl << endl;
  bubl %= MOD;
  bubl *= k;
  bubl %= MOD;

  sort(rall(a));
  lint mul = k * (k - 1) / 2;
  mul %= MOD;

  lint ans = 0;
  for(lint i = 1; i < n; i++){
    lint cnt = 0;
    rep(j, n) if(a[i] < a[j]) cnt++;
    cnt %= MOD;
    ans += cnt * mul;
    ans %= MOD;
  }

  ans += bubl;
  ans %= MOD;
  cout << ans << endl;

  return 0;
}


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

int main()
{
  int N,A,B;
  cin >> N >> A >> B;
  int acc = 0;

  for(int i=0; i<N+1; i++) {
    int ss = i/10000 + (i%10000)/1000 + (i%1000)/100 + (i%100)/10 + i%10;
    if (ss >= A && ss <= B) {
      acc += i;
    }
  }
  cout << acc << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 500001

void insert(int);

typedef struct node {
  int key;
  struct node *parent,*left,*right;
}Node;
  
Node *root,*NIL;

void inorder(Node *);
void preorder(Node *);

void insert(int k){
  Node *y=NIL;
  Node *x=root;
  Node *z;

  z=(Node *)malloc(sizeof(Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }else{
      x=x->right;
    }
  }

  z->parent=y;

  if(y==NIL){
    root=z;
  }else{
    if(z->key < y->key){
      y->left=z;
    }else{
      y->right=z;
    }
  }
}

void inorder(Node *u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node *u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int m,i,x;
  char com[10];

  scanf("%d",&m);
  
  for(i=0;i<m;i++){
    scanf("%s",com);
    if(strcmp(com,"insert")==0){
      scanf("%d",&x);
      insert(x);
    }else if(strcmp(com,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}

Measured memory_bytes: 26028
while True:
    H,W = [int(i) for i in input().strip().split()]
    if H < 1 or W < 1:
        break
    for i in range(H):
        row = ""
        if i % 2 == 0:
            for j in range(W):
                if j%2==0:
                    row+="#"
                else:
                    row+="."
        else:
            for j in range(W):
                if j%2==0:
                    row+="."
                else:
                    row+="#"
        print(row)
    print()



Measured memory_bytes: 5616
#include <iostream>

constexpr int MAXN = 100;
int V[MAXN][MAXN];
int main() {
    int n;
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        int id, e_num;
        std::cin >> id >> e_num;
        for (int j = 0; j < e_num; j++) {
            int t;
            std::cin >> t;
            V[id - 1][t - 1] = 1;
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (j) std::cout << " ";
            std::cout << V[i][j];
        }
        std::cout << std::endl;
    }
}


Measured memory_bytes: 3136
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]

city = [0]*n

for i in range(m):
  city[a[i][0]-1] += 1
  city[a[i][1]-1] += 1
  
print(*city, sep = '\n')

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

bool isEvenString(string s);

int main(){
    //std::string str("012345");
    //std::string sub = str.substr(2, 3);     //  [2] の位置から3文字切り出す
    //std::cout << sub << "\n";
    
    string s;
    cin >> s;
    int l = s.length(), ans = 0;
    for(int i = l - 2; i > 0; i -= 2){
        string t = s.substr(0, i);
        if(isEvenString(t)){
            ans = t.length();
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

bool isEvenString(string s){
    string s1 = s.substr(0, s.length() / 2);
    string s2 = s.substr(s.length() / 2, s.length() / 2);
    return (s1 == s2);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#include<algorithm>

using namespace std;
typedef long long ll;

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

    // prime factoring
    vector<pair<ll, int>> fs;

    for (ll i = 2; i*i <= n; i++){
        ll ct = 0;
        while (n%i == 0){
            n /= i;
            ct++;
        }
        if (ct != 0) fs.emplace_back(i, ct);
    }
    if (n != 1) fs.emplace_back(n, 1);

    ll ans = 0;
    for (auto p : fs){
        ll x = p.second;
        ll b = 1;
        while (b <= x){
            x -= b;
            b++;
            ans++;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3560
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s = input()
    t = []
    for i,si in enumerate(s):
        if si != "x":
            t.append((i,si))
    q = [i[1] for i in t]
    if q != q[::-1]:
        print(-1)
        return
    n = len(t)
    if not n:
        print(0)
        return
    m = n >> 1
    l = t[m-(1-(n&1))][0]
    r = t[m][0]
    ans = 0
    while l >= 0 or r < len(s):
        if l < 0:
            r += 1
            ans += 1
        elif r >= len(s):
            l -= 1
            ans += 1
        elif s[l] == s[r]:
            l -= 1
            r += 1
        elif s[l] == "x":
            l -= 1
            ans += 1
        else:
            r += 1
            ans += 1
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


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

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

  int p = n;

  for (char i = 97; i < 123; i++) {

    if (i == p) {

      cout << char (i + 1) << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
/*****************************************************

@author: blue_is_love
Compiled On: 25th May 2019

*****************************************************/

#include<bits/stdc++.h>
#define MAX 9223372036854775807
#define endl "\n"
#define ll long long
#define int long long
#define pb push_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define ip pair<int, int>

#define loop(i,n) for(int i=0;i<n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
using namespace std;

const ll MOD = 1e9+7;
const ll SZ = 107;
const ll N = 2e3+7;

int pow(int x, int y)
{
    ll r = 1LL;
    while(y)
    {
        if(y&1)
            r = (r * x);
        y >>= 1;
        x = (x * x);
    }
    return r;
}

void solve()
{
	int n, p; cin>>n>>p;
    p += n *3;
    cout<<p/2;
}


signed main()
{

    int t=1;
    //cin >>t;
    while(t--){
        solve();
    }
    return 0;
}

/*****************************


****************************/

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

int main(){
  int N,M;cin >> N >> M;
  vector<int> H(N);
  for(int i=0;i<N;i++){
    cin >> H[i];
  }
  vector<bool> P(N,true);
  for(int j=0;j<M;j++){
    int A,B;cin >> A >> B;
    A --;
    B --;
    if(H[A]>H[B]){
      P[B] = false;
    }else if(H[A]<H[B]){
      P[A] = false;
    }else{
      P[A] = false;
      P[B] = false;
    }
  }
  int count = 0;
  for(int i=0;i<N;i++){
    if(P[i]){
      count ++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3784
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll Mypow(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}

ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 1000000000;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

int main(){
  string S; cin >> S;
  for(int i = 1;; i++){
    if((S.size() - i) % 2) continue;
    int x = S.size() - i;
    int y = x / 2;
    string a = "", b = "";
    for(int j = 0; j < x; j++){
      if(j < y) a += S[j];
      else b += S[j];
    }
    if(a == b){
      cout << x << endl;
      return 0;
    }
  }




}


Measured memory_bytes: 256
#!/usr/bin/ruby
$c=0
def binary(a,v)
	left=0;right=a.length-1
	while left<=right do
		$c+=1
		center=(left+right)/2
		if a[center]==v then return v end
		if a[center]>v then right=center-1 else left=center+1 end
	end
	return nil
end
while(n=gets.to_i)>0 do
	a=[];n.times{a.push(gets.to_i)}
	$c=0;binary(a,gets.to_i);p $c
end

Measured memory_bytes: 2300
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
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; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll n, k;
cin >> n >> k;
ll ans = abs(n % k - k) < n % k ? abs(n % k - k) : n % k;
cout << ans << endl;
// system("pause");
return 0;
}

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

using namespace std;

string S, T;
int v[100];

void solve()
{
	for ( int i=0;i<=S.length()-T.length();i++)
	{
		int ok = 1;
		for (int j=0;j<T.length();j++)
		{
			if (!(S[i+j]==T[j] || S[i+j]== '?'))
				ok=0;
		}
		v[i]=ok;
	}
	int ok=1;
	for(int i=S.length()-T.length()+1;i>=0;i--)
		if(v[i]==1){
			ok=0;
			for (int j=0;j<=S.length();j++)
				if (S[j]=='?') S[j]='a';
			for (int j=0; j<T.length(); j++)
				S[i+j]=T[j];
			break;
		}
	if (ok)
		cout<<"UNRESTORABLE";
	else
		cout<<S;
}


int main ()
{
	cin>>S>>T;
	if(S.length()>=T.length())
		solve();
	else
		cout<<"UNRESTORABLE";
    return 0;
}




Measured memory_bytes: 256