akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        public static void Main(string[] args)
        {
            var a = ReadLine();
            var b = ReadLine();
            var rotation = a[2].ToString()+a[1].ToString()+a[0].ToString();

            var result = "NO";

            if(rotation == b) {
                result = "YES";
            }
            Console.WriteLine(result);
            ReadLine();
        }

        /// <summary>
        /// stringを一文字ずつintにキャストして配列に変換します。
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static int[] StringCharArrayIntArray(string str)
        {
            List<int> b = new List<int>();
            for (int i = 0; i < str.Length; i++) {
                b.Add( int.Parse(str[i].ToString()));
            }
            return b.ToArray();
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }

        public static int ReadLineInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static string[] ReadLineStringSplit(char a = ' ')
        {
            return ReadLine().Split(a).ToArray();
        }

        public static int[] ReadLineIntSpilit(char a = ' ')
        {
            return ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
        }
    }
}

Measured memory_bytes: 13140
object Main {
  import java.util.Scanner
  import scala.annotation.tailrec

  def readStrings(n: Int)(implicit sc: Scanner): Array[String] = Array.fill(n) { sc.next() }
  def readInts(n: Int)(implicit sc: Scanner): Array[Int] = Array.fill(n) { sc.nextInt() }
  def readLongs(n: Int)(implicit sc: Scanner): Array[Long] = Array.fill(n) { sc.nextLong() }
  def readLineStrings(implicit sc: Scanner): Array[String] = sc.nextLine().split(' ')
  def readLineInts(implicit sc: Scanner): Array[Int] = readLineStrings.map(_.toInt)
  def readLineLongs(implicit sc: Scanner): Array[Long] = readLineStrings.map(_.toLong)

  def main(args: Array[String]): Unit = solve(new Scanner(System.in))

  def solve(implicit sc: Scanner): Unit = {
    @tailrec def gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)

    val Array(n, x) = readLineInts
    val xs = readLineInts
    val sortedXs = (xs.toList :+ x).sorted
    val distances = sortedXs.zip(sortedXs.drop(1)).map(pair => pair._2 - pair._1)
    println(distances.reduce(gcd))
  }
}

Measured memory_bytes: 73572
// In the name of Allah the Most Merciful. 

import java.util.*;
import java.math.*;

public class Main{
    
    public static void main(String arg[]){
        
        Scanner sc = new Scanner(System.in);
        
        int a[] = new int[3];
        
        for(int i=0;i<3;i++)a[i] = sc.nextInt();
        
        Arrays.sort(a);
        
        int counter = 1;
        
        for(int i=0;i<2;i++){
            
            if(a[i]!=a[i+1])counter++;
        }
        
        System.out.println(counter);
        
    }
}

Measured memory_bytes: 23764
// 解説後
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>

template <typename T>
struct Vector2 {
  Vector2& operator+=(const Vector2& other) noexcept {
    x += other.x;
    y += other.y;
    return *this;
  }

  friend Vector2 operator+(Vector2 lhs, Vector2 rhs) noexcept {
    return Vector2(lhs) += rhs;
  }

  template<typename U>
  auto dot(Vector2<U> rhs) const noexcept {
    return x * rhs.x + y * rhs.y;
  }

  auto norm2() const noexcept { return dot(*this); }

  auto norm() const noexcept { return sqrt(norm2()); }

  T x, y;
};

// L^2ノルムを最大化したいので、方向が同じベクトルを集める
int solve_F() {
  size_t N;
  std::cin >> N;

  std::vector<Vector2<double>> directions(360);
  for (size_t i = 0; i < directions.size(); ++i) {
    const double angle = 3.14159265358979 * 2 * i / directions.size();
    directions[i].x = cos(angle);
    directions[i].y = sin(angle);
  }


  std::vector<Vector2<int64_t>> summations(directions.size());
  for (size_t i = 0; i < N; ++i) {
    Vector2<int64_t> v;
    std::cin >> v.x >> v.y;

    for (size_t j = 0; j < directions.size(); ++j) {
      if (directions[j].dot(v) >= 0.0) {
        summations[j] += v;
      }
    }
  }

  double result = 0.0;
  for (const auto& v : summations) {
    result = std::max(result, v.norm());
  }

  std::cout << std::setprecision(20) << result;
  return 0;
}

int main() { return solve_F(); }


Measured memory_bytes: 256
import sys

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

H, W = rl()
A = [list(rs()) for _ in range(H)]

for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            A[i][j] = 1
        else:
            A[i][j] = 0
    A[i].append(0)            
A.append([0] * (W + 1))
bool = True

for i in range(H):
    for j in range(W):
        if i == 0 and j == 0:
            if A[i+1][j] + A[i][j+1] != 1:
                bool = False
            continue
        if i == H - 1 and j == W - 1:
            if A[i-1][j] + A[i][j-1] != 1:
                bool = False
            continue
        if A[i][j] == 1:
            if A[i+1][j] + A[i][j+1] != 1:
                bool = False
            if A[i-1][j] + A[i][j-1] != 1:
                bool = False

print('Possible' if bool else 'Impossible')

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		int cost = 10000;
		int p1 = Math.abs(a - b) + Math.abs(b - c);
		if (p1 < cost) {
			cost = p1;
		}
		int p2 = Math.abs(a - c) + Math.abs(b - c);
		if (p2 < cost) {
			cost = p2;
		}
		int p3 = Math.abs(b - a) + Math.abs(a - c);
		if (p3 < cost) {
			cost = p3;
		}
		int p4 = Math.abs(b - c) + Math.abs(a - c);
		if (p4 < cost) {
			cost = p4;
		}
		int p5 = Math.abs(c - b) + Math.abs(b - a);
		if (p5 < cost) {
			cost = p5;
		}
		int p6 = Math.abs(c - a) + Math.abs(a - b);
		if (p6 < cost) {
			cost = p6;
		}
		System.out.println(cost);
	}
}


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

double dp[16][9];

double solve(int n, int p, const int t, const int b)
{
  if (n == 0) {
    if (p == t)
      return 1.0;
    return 0.0;
  }

  if (dp[n][p] != -1.0)
    return dp[n][p];

  double res = 0.0;
  // north
  if (p > 2 && p-3 != b)
    res += 0.25 * solve(n-1, p-3, t, b);
  else
    res += 0.25 * solve(n-1, p, t, b);

  // east
  if (p%3 != 2 && p+1 != b)
    res += 0.25 * solve(n-1, p+1, t, b);
  else
    res += 0.25 * solve(n-1, p, t, b);

  // south
  if (p < 6 && p+3 != b)
    res += 0.25 * solve(n-1, p+3, t, b);
  else
    res += 0.25 * solve(n-1, p, t, b);

  // west
  if (p%3 != 0 && p-1 != b)
    res += 0.25 * solve(n-1, p-1, t, b);
  else
    res += 0.25 * solve(n-1, p, t, b);

  return dp[n][p] = res;
}

int main()
{
  int n;
  while (cin >> n) {
    if (n == 0)
      break;

    for (int i = 0; i < 16; ++i) {
      for (int j = 0; j < 9; ++j)
	dp[i][j] = -1.0;
    }

    char s, t, b;
    cin >> s >> t >> b;
    printf("%.8f\n", solve(n, s-'A', t-'A', b-'A'));
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0,(i##_len)=(n);(i)<(i##_len);(i)++)
#define rep2(i,a,b) for(ll (i)=(a),(i##_len)=(b);(i)<=(i##_len);(i++))
#define Yes(n) cout<<((n)?"Yes\n":"No\n")
#define pb push_back
using namespace std;
using ll = long long;

template<class T> bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> T abs(T x){return max(x,-x);}
template<class T> T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> T lcm(T m,T n) {return m*n/gcd(m,n);}
template<class T> T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm<T>(r,v.at(i));return r;}
template<class T> T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> T nCr(T n,T k){return factorial<T>(n)/(factorial<T>(k)*factorial<T>(n-k));}
vector<string> split(const string&s,char d){vector<string>r;stringstream ss(s);string k;while(getline(ss,k,d))if(!k.empty())r.pb(k);return r;}

// Template ends here

int main() {
    ll n, k; cin >> n >> k;
    cout << min(n % k, k - (n % k)) << "\n";
    return 0;
}

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

char nome[100][101];

int cmp(const void *a, const void *b){

    return strcmp(a, b);
}

int cmpindice(const void *a, const void *b){
    const int *x = a, *y = b;
    return strcmp(nome[*x], nome[*y]);
}

int main(){

    int x, y;
    scanf("%d %d", &x, &y);
    int indice[x];
    for(int i = 0; i < x; ++i){
        scanf(" %s", nome[i]);
        indice[i] = i;
    }

    qsort(nome, x, sizeof(nome[0]), cmp);

    qsort(indice, x, sizeof(indice[0]), cmpindice);

    for(int i = 0; i < x; ++i){
        printf("%s", nome[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <limits>
#include <numeric>

using ld = long double;
using ll = long long int;
using ul = unsigned long long int;

namespace lamlib
{
	/* constant */
	constexpr double epsilon = std::numeric_limits<double>::epsilon();

	/* math */
	template<class T> inline T abs(const T &a){ return (a>0) ? a : -a; }
	ul inline digit(const ul &num){ return static_cast<ul>(std::log10(num+epsilon))+1; }

	/* algorithm */
	ul gcd(const ul &a,const ul &b) { return (!b) ? a : gcd(b,a%b); }
	ul lcm(const ul &a,const ul &b) { return (a/gcd(a,b))*b; } // a/gcd(a,b)*b <=> (a*b)/gcd(a,b)
	std::vector<bool> eratosthenes(const ul &n)
	{
		std::vector<bool> prime_candidate(n,true);
		prime_candidate[0] = prime_candidate[1] = false;
		for(ul i = 2;i*i < n;++i)
		{
			if(!prime_candidate[i]) continue;
			for(ul j = 2;i*j < n;++j) prime_candidate[i*j] = false;
		}
		return prime_candidate;
	}
	ll rho_method(const ll &n)
	{
		auto f = [&](const ll &xi){ return (xi*xi+1)%n; };
		ll x = 2, y = 2, d = 1;
		while(d == 1)
		{
			x = f(x);
			y = f(f(y));
			d = lamlib::gcd(lamlib::abs(x-y),n);
		}
		return d;
	}
	// 素因数分解(試し割)
	std::vector<ll> prime_factorization_trial(const ll &n)
	{
		ll num = n;
		std::vector<ll> prime;
		for(ll i = 2;i*i <= n;++i)
		{
			while((num%i) == 0)
			{
				prime.emplace_back(i);
				num /= i;
			}
		}
		if(num > 1) prime.emplace_back(num);
		return prime;
	}

	/* string */
	inline ul same_char_count(const std::string s,const char &ch){ return std::count(std::cbegin(s),std::cend(s),ch); }
}

// std::cout << std::fixed << std::setprecision(15) << std::endl;

int main(int argc,char *argv[])
{
	ll n;
	std::cin >> n;
	
	std::string ans;
	while(n > 0)
	{
		int tmp = (n-1)%26;
		ans += ('a'+tmp);
		n = (n-1)/26;
	}

	for(int i = ans.size()-1;i >= 0;--i) std::cout << ans[i];
	std::cout << std::endl;

	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>

void solve(std::string S)
{
  std::vector<long long> dp(13, 0);
  dp[0] = 1;
  long long num = 1;
  long long mod = 1e9 + 7;
  for (int i = S.size()-1; i >= 0; i--)
  {
    std::vector<long long> new_dp(13, 0);
    if(S[i]=='?')
    {
      for (int n = 0; n < 10; n++)
      {
        for (int m = 0; m < 13; m++)
        {
          new_dp[(m+n*num)%13] += dp[m];
          new_dp[(m+n*num)%13]%=mod;
        }
      }

    }
    else
    {
      int n = S[i] - '0';
      for (int m = 0; m < 13; m++)
      {
        new_dp[(m+n*num)%13] += dp[m];
        new_dp[(m+n*num)%13]%=mod;

      }
    }
    dp = new_dp;
    num *= 10;
    num %= 13;
  }
  std::cout << dp[5] << std::endl;
}

int main(void)
{
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 512
n=int(input())
d=[list(map(int,input().split())) for i in range(n)]
def fill(l,x):
    w=len(l[0])
    return [[x]*(w+2)]+[[x]+i+[x] for i in l]+[[x]*(w+2)]
def swap(a,b):
    if a>b:
        return b,a
    return a,b
d=fill(d,0)
edge=[{} for i in range(n+1)]
for j in range(1,n+1):
    for i in range(j+1,n+1):
        edge[j][i]=d[i][j]
for k in range(1,n+1):
    for i in range(1,n+1):
        for j in range(1,n+1):
            if  d[i][j]>d[i][k]+d[k][j]:
                print(-1)
                quit()
            elif d[i][j]==d[i][k]+d[k][j]:
                if k==i or k==j:
                    continue
                x,y=swap(i,j)
                if y in edge[x]:
                    del edge[x][y]
ans=0
for i in edge:
    ans+=sum(i.values())
print(ans)

Measured memory_bytes: 51604
import java.util.*;
class Main{
    public static void main(String[] args){
	Scanner stdIn=new Scanner(System.in);
	int A = stdIn.nextInt();
	int B = stdIn.nextInt();
	int[] ans=new int[3];
	ans[0]=A+B;
	ans[1]=A-B;
	ans[2]=A*B;
	Arrays.sort(ans);
	System.out.println(ans[2]);
    }
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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


int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    int N, X;
    cin >> N >> X;

    vector<int> m(N);
    int w_sum = 0;
    for(int i = 0; i < N; i++){
        cin >> m[i];
        w_sum += m[i];
    }

    sort(m.begin(), m.end());

    int ans;
    ans = N + (X-w_sum) / m[0];
    
    cout << ans << endl;

    return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int N, K;
int W[100010];

bool check(int P) {
  int truck = 1, sum = 0;
  REP(i, N) {
    if (W[i] > P) return false;
    if (sum + W[i] > P) {
      truck++;
      sum = W[i];
    } else {
      sum += W[i];
    }
  }
  //cout << sum << ' ' << truck << endl;
  return truck <= K;
}  

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  cin >> N >> K;
  REP(i, N) cin >> W[i];

  int left = 0, right = (int)1e9;
  while (left + 1 < right) {
    int mid = (left + right) / 2;
    (check(mid) ? right : left) = mid;
  }
  cout << right << endl;      
  return 0;
}

Measured memory_bytes: 1584
#include<iostream>
using namespace std;
int d,m=1e9+7,dp[10001][2][100];
string s;
main()
{
	cin>>s>>d;
	dp[0][0][0]=1;
	for(int i=0;i<s.size();i++)
	{
		for(int j=0;j<2;j++)
		{
			int L=j?9:s[i]-48;
			for(int l=0;l<=L;l++)
			{
				for(int k=0;k<d;k++)
					(dp[i+1][j|l<L][(k+l)%d]+=dp[i][j][k])%=m;
			}
		}
	}
	cout<<(dp[s.size()][0][0]+dp[s.size()][1][0]-1L+m)%m<<endl;
}

Measured memory_bytes: 8064
#include <stdio.h>

int main(void) {
	int W,H,x,y,r;
	scanf("%d",&W);
	scanf("%d",&H);
	scanf("%d",&x);
	scanf("%d",&y);
	scanf("%d",&r);
	if(x-r>=0&&x+r<=W&&y-r>=0&&y+r<=H)
		puts("Yes");
	else
		puts("No");
	return 0;
}


Measured memory_bytes: 2100
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

def lcm(*x):
    result = 1
    for x0 in x:
        d = gcd(result, x0)
        result = result // d * x0
    return result

def p_adic_valuation(n, p):
    result = 0
    while n % p == 0:
        n //= p
        result += 1
    return result

N, M = map(int, input().split())
a = list(map(int, input().split()))

def solve():
    v = p_adic_valuation(a[0], 2)
    for i in range(1, N):
        if p_adic_valuation(a[i], 2) != v:
            return 0
    assert v > 0
    X_min = lcm(*a) // 2
    return M // X_min - M // (2 * X_min)

print(solve())

Measured memory_bytes: 14244
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const ll md = 1000000007;
vector<ll> fact(1e6 + 7), invfact(1e6 + 7);

ll fn(ll a, ll r, ll n, ll mod = md) {
    ll res = 1, x = r%mod;
    ll ans = 0;
    while(n) {
        if(n&1) ans = (x*ans + res)%mod;
        res = ((res*x)%mod + res%mod)%mod;
        x = (x*x)%mod;
        n = n/2;
    }
    ans = (ans*a)%mod;
    return ans;
}

ll nCr(ll n, ll r) {
    if(r == 0) return 1;
    ll num = fact[n];
    ll den = (invfact[r] % md *invfact[n-r] % md)%md;
    return (num*den)%md;
}

ll mul(ll a, ll b, ll mod = md) {
    ll res = (a%mod * b%mod)%mod;
    return res;
}

ll mulm(ll a, ll b, ll mod = md) {
    ll r = 0;
    a %= mod;
    while (b) {
        if (b & 1) r = (r+a)%mod;
        a = (a+a)%mod;
        b = b/2;
    }
    r %= mod;
    return r;
}

ll power(ll x, ll n, ll mod = md) {
    ll res = 1;
    x %= mod;
    while (n) {
        if (n & 1)  res = (res*x)%mod;
        n = n/2;
        x = (x*x)%mod;
    }
    return res;
}

ll power2(ll x, ll n) {
    ll res = 1;
    while (n)  
    {  
        if (n & 1)  res = (res*x);  
        n = n/2; 
        x = (x*x);  
    }  
    return res;
}

bool is_prime(ll x) {
    if(x == 1 || x == 0) return false;
    for(int i=2; i*i <= x; i++) {
        if(x%i == 0) return false;
    }
    return true;
}

ll compgcd(ll n, vector<ll> const &primes) { 
    ll res = n; 
    for (ll i=0; primes[i]*primes[i] <= n; i++) {
        if (n % primes[i]== 0) { 
            res -= (res / primes[i]); 
            while (n%primes[i]== 0) {
               n/=primes[i]; 
            }
        } 
    } 
    if (n > 1) {
       res -= (res / n); 
    }
    return res; 
} 

void sieve(vector<bool> &prime, vector<ll> &primes, ll lim) {
    for(int i = 2; i*i <= lim; i++) {
        if(prime[i]) {
            for(int j = 2; j*i <= lim; j++) {
                prime[j*i] = false;
            }
        }
    }
    for(int i = 2; i <= lim; i++) {
        if(prime[i]) {
            primes.push_back(i);
        }
    }
}

void sieveGCD(ll lim, vector<ll> &tab, vector<ll> const &primes) {
    for(int  i = 1; i <= lim; i++) {
        tab[i] = i;
    }
    for(int i = 0; i<primes.size() && primes[i] <= lim; i++) {
        tab[primes[i]] = primes[i]-1;
        for(int j = 2; primes[i]*j <= lim; j++) {
            tab[primes[i]*j] = (tab[primes[i]*j]/primes[i])*(primes[i]-1);
        }
    }
}

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, k, count = 0, x, d;
    cin >> n >> k;
    map<ll , ll> visited;
    for(int i = 0; i < k; i++) {
        cin >> d;
        for(int j = 0; j < d; j++) {
            cin >> x;
            if(visited[x] == 0) {
                visited[x] = 1;
            }
        }
    }
    for(int i = 1; i <= n; i++) {
        if(!visited[i]) {
            count++;
        }
    }
    cout << count << "\n";
    return 0; 
}

Measured memory_bytes: 18600
using System;

namespace aoj9a
{
    class Program
    {
        static void Main(string[] args)
        {
            string W = (Console.ReadLine()).ToLower();  //W????????????????°????????????????????????????
            int counter = 0;
 //           string END = "END_OF_TEXT";
 
 

            for (;;)
            {
                string[] line = (Console.ReadLine()).Split(' ');
                for(int i = 0; i < line.Length; i++)
                {
                    if( line[i] == "END_OF_TEXT")
                    {
                        Console.WriteLine(counter);
                        return;
                    }
                    else
                    {
                        line[i] = line[i].ToLower();
                        if( line[i] == W)
                        {
                            counter++;
                        }
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 9040
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

int main(){
    ll x,y;
    cin >> x >> y;
    bool ans = false;
    for(int i=0;i<=x;i++){
        ll now = i * 2 + (x-i)*4;
        if(now==y)ans=true;
    }
    if(ans)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265359

int main()
{
  double r;
  cin >> r;
  // cout << r * r * PI << " " << 2 * PI * r << endl;
  printf("%.8lf %.8lf\n", r * r * PI, 2 * PI * r);
}


Measured memory_bytes: 3284
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

typedef struct{ 
    int array[100]; 
}abc; 



int main() {
  ll N;
  cin>>N;
  ll a[N];
  FOR(i,0,N-1){
    cin>>a[i];
  }
  ll ans1=0;
  ll ans2=0;
  ll seifu=0;
  FOR(i,0,N-2){
    if(a[i]>a[i+1]){
      if(seifu==1){

        seifu=0;

      }else if(seifu==0){
        seifu=-1;
        ans1++;

      }
    }else if(a[i]<a[i+1]){
      if(seifu==-1){

        seifu=0;
      }else if(seifu==0){
        seifu=1;
        ans1++;

      }
    }
    //cout<<"i "<<i<<"seifu "<<seifu<< "ans "<<ans1<<endl;
  }

  if(seifu==0)ans1++;
  
  cout<<max(ans1,ans1)<<endl;
  return 0;
}
 


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

int n;
long long a, b;
long long x, y, t, t1, t2;

long long gcd(long long a, long long b){return !b?a:gcd(b,a%b);}

int main()
{
	cin >> n;
	a = 1; b = 1;
	while(n--)
	{
		cin >> x >> y;
		t = gcd(x,y);
		x /= t; y /= t;
		t1 = a/x+(a%x!=0); t2 = b/y+(b%y!=0);
		a = x*max(t1,t2);
		b = y*max(t1,t2);
	}
	cout << a+b << endl;
	return 0;
}

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

using namespace std;

int main() {
	int N, M, C;
	int A[30][30];
	int B[30];
	int ans = 0;

	cin >> N >> M >> C;
	for (int i = 0; i < M; i++) {
		cin >> B[i];
	}

	for (int i = 0; i < N; i++) {
		int sum = 0;
		for (int j = 0; j < M; j++) {
			cin >> A[i][j];
			sum += A[i][j] * B[j];
		}
		sum += C;
		if (sum > 0) {
			ans++;
		}
	}

	cout << ans << endl;
}

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


int main(){
    int a,b,c;
    cin>>a>>b>>c;

    if(a+b ==c || a+c == b || b+c == a) cout<<"Yes"<<endl;
    else cout<< "No" <<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[m];
        int[] b = new int[m];
        Pair2[] pairs = new Pair2[m];
        for (int i = 0; i < m; i++) {
            Pair2 p = new Pair2();
            p.from = sc.nextInt();
            p.end = sc.nextInt();
            pairs[i] = p;
        }
        Arrays.sort(pairs);

        int cnt = 0;
        int nowclear = 0;
        for (int i = 0 ; i < m ; i++) {
            int nowFrom = pairs[i].from;
            int nowEnd = pairs[i].end;
            if (nowclear < nowFrom) {
                cnt++;
                nowclear = nowEnd - 1;
            }
        }
        System.out.println(cnt);

    }



}

class Pair2 implements Comparable {
    int from;
    int end;

    @Override
    public int compareTo(Object other) {
        Pair2 otherpair = (Pair2) other;
        return end - otherpair.end;
    }
}

Measured memory_bytes: 90260
#include<bits/stdc++.h>
#define ll long long

#define nl printf("\n")
#define pb(x) push_back(x)

#define S(a) scanf("%d",&a)
#define S2(a,b) scanf("%d%d",&a,&b)
#define S3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define P(a) printf("%d",a)

#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a<b)?a:b)

#define PLC(a) printf("%lld ",a)
#define PLN(a) printf("%lld\n",a)
#define SL(a) scanf("%lld",&a)
#define SL2(a,b) scanf("%lld%lld",&a,&b)
#define SL3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define SL4(a,b,c,d) scanf("%lld%lld%lld%lld",&a,&b,&c,&d)

#define CLR(a) memset(a,0,sizeof(a))
#define SET(a) memset(a,-1,sizeof(a))
#define FOOL(a) memset(a,false,sizeof(a))
#define fr(i,a,n) for(ll i=a;i<=n;i++)
#define pi acos(-1.0)
#define po 1000000
#define co 1000000
#define mx 200001
#define pll pair<ll,ll>
using namespace std;
ll a[mx],b[mx];
int main()
{
    ll n,i,n2;
     SL(n);
     n2=n/2;
     for(i=1;i<=n;i++)SL(a[i]),b[i]=a[i];
     a[0]=0;
     b[0]=0;
     sort(b,b+(n+1));
     for(i=1;i<=n;i++)
     {
          if(a[i]>b[n2])PLN(b[n2]);
          else PLN(b[n2+1]);
     }
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
int main() { 
  int N,M;
  int NGusu, MGusu;
  
  cin >> N >> M;
  
  NGusu = N*(N-1) / 2;
  MGusu = M*(M-1) / 2;
  
  cout << NGusu + MGusu << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[52][52]={0},m,n;
char s;
int main(){
	cin>>m>>n;
	for(int i=1;i<=m;i++){
		for(int j=1;j<=n;j++){
			cin>>s;
			if(s=='#')a[i][j]=1;
			else a[i][j]=0;
		}
	}
	for(int i=1;i<=m;i++){
		for(int  j=1;j<=n;j++){
			if(a[i][j]==1)cout<<'#';
			else cout<<a[i-1][j-1]+a[i-1][j]+a[i-1][j+1]+a[i][j-1]+a[i][j+1]+a[i+1][j-1]+a[i+1][j]+a[i+1][j+1];
		}
		cout<<endl;
	}
	return 0;
}

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

int func(int x)
{
  return x * x;
}

int main(void)
{
  const int max_x = 600;
  int d = 0;

  while (std::cin >> d) {
    int loop = max_x / d;

    int sum = 0;
    for (int i = 0; i < loop; i++) {
      sum += d * func(d * i);
    }

    std::cout << sum << std::endl;
  }

  return 0;
}

Measured memory_bytes: 3048
#include <iostream>

using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL << 60;

// 入力
int N;
long long h[100010];

// DP テーブル
long long dp[100100];

int main() {
    int N, K; cin >> N >> K;
    for (int i = 0; i < N; ++i) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 100100; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for (int i = 0; i < N; ++i) {
        for (int j = 1; j <= K; ++j) {
            chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }

    // 答え
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

int main() {
    vector<int> A(26);
    string s;
    cin >> s;
    for (int i = 0; i < (int)s.size(); i++) {
        A[(int)(s[i] - 'a')]++;
    }
    for (int i = 0; i < 26; i++) {
        if (A[i] == 0) {
            cout << (char)(i + 'a') << endl;
            return 0;
        }
    }
    cout << "None\n";
}


Measured memory_bytes: 512
#include <iostream>
#include<cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
 
int main() {
    ios::sync_with_stdio(false);
	string s,t;
	cin >> s >> t;
	int x = 0;
	for (int i = 0 ; i < s.length() ; i++) {
		if (t[i] != s[i]) x++;
	}
	cout << x;
}


Measured memory_bytes: 3868
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=85;
//↑templete
signed main(){
	int H, W;
	cin>>H>>W;
	int A[SIZE][SIZE]={}, B[SIZE][SIZE]={};
	for(int i=0;i<H;i++)
		for(int j=0;j<W;j++)
			cin>>A[i][j];
	for(int i=0;i<H;i++)
		for(int j=0;j<W;j++)
			cin>>B[i][j];

	bool DP[SIZE][SIZE][SIZE*SIZE*5]={};	//(i, j)でkを達成可能か？
	int offset=2*SIZE*SIZE+SIZE;
	DP[0][0][A[0][0]-B[0][0]+offset]=1;
	DP[0][0][B[0][0]-A[0][0]+offset]=1;

	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(i==0 && j==0)
				continue;

			for(int k=-2*SIZE*SIZE;k<=2*SIZE*SIZE;k++){
				int a=A[i][j]-B[i][j], b=B[i][j]-A[i][j];

				if((i-1>=0 && (DP[i-1][j][k-a+offset] || DP[i-1][j][k-b+offset])) || (j-1>=0 && (DP[i][j-1][k-a+offset] || DP[i][j-1][k-b+offset])))
					DP[i][j][k+offset]=1;
			}
		}
	}
	int ans=INF;
	for(int k=-2*SIZE*SIZE;k<=2*SIZE*SIZE;k++){
		if(DP[H-1][W-1][k+offset])
			ans=min(ans, abs(k));
	}
	cout<<ans<<endl;
	return 0;
}

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

struct war {
  int a, b;
};

int main () {
  int N, M;
  cin >> N >> M;
  vector<war> wars(M);
  rep(i,M) cin >> wars[i].a >> wars[i].b;


  sort(wars.begin(), wars.end(), [](const war&a, const war&b) { return a.a < b.a; });

  int l = 0, r = 1e9;
  int ans = 1;
  rep(i,M) {
    if(wars[i].a >= r) {
      ans += 1;
      l = wars[i].a;
      r = wars[i].b;
    } else {
      l = wars[i].a;
      r = min(r, wars[i].b);
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

func getString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()

	out((N + 1) / 2)

}


Measured memory_bytes: 640
#解法3
import collections
w = input()
s = list(w)
c = collections.Counter(s)
l = list(c.most_common())
#出現回数のリストがl
flag = 0
for i in range(len(l)):
  if l[i][1]%2 == 0:
    continue
  else:
    flag += 1
    break
if flag == 0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
  ll V;
  vector<vector<edge> > G;
  vector<ll> d;

  graph(ll n){
    init(n);
  }

  void init(ll n){
    V = n;
    G.resize(V);
    d.resize(V);
    rep(i,V){
      d[i] = INF;
    }
  }

  void add_edge(ll s, ll t, ll cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }

  void dijkstra(ll s){
    rep(i,V){
      d[i] = INF;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      ll v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};
int main(){
ll n,a,b;
cin>>n>>a>>b;
ll c[n]={};
rep(i,n) cin>>c[i];
  sort(c,c+n);
ll ca = 0;
  ll ng = 0;
  ll ok = c[n-1]+1;
  ll m = a - b;
  while(abs(ok-ng)>1){
    ca = 0;
    ll mid = (ok + ng)/2;
    for(ll i=0; i<n; i++){
      ll k = c[i] - mid*b;
      if(k<=0)continue;
      if(k%m==0){
        ca += k/m;
        continue;}
      ca +=k/m+1;}
    if(ca<=mid){
      ok = mid;}
    else ng = mid;
    //cout << ng << " " << ok << endl;
  }
  cout << ok << endl;}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	//ios_base::sync_with_stdio(0);
	int H, W, h, w, ans=0;

	cin >> H >> W >> h >> w;
	ll m = (H/h)*(W/w);
	ll o = (H%h>0)*(W/w) + (H/h)*(W%w>0) - (H%h>0)*(W%w>0);
	if( m < o * 1e9-1 ){
		cout << "Yes" << endl;
		rep(i,H){
			rep(j,W){
				cout << (
					((i+1)%h==0)&&((j+1)%w==0) ? (ll)-1e9 :
					(i%h==0)&&(j%w==0) ? (ll)(1e9-1) :
					0
				) << " ";
			}
			cout << endl;
		}
	}else{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 2944
#![allow(non_snake_case)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(
        n: i32,
        m: i32,
        arr: [i32; m*2]
    );
    let mut min: i32 = 0;
    let mut max: i32 = 100000;
    for j in 0..m {
        let i: usize = (j as usize) * 2;
        if arr[i] > min {
            min = arr[i];
        }
        if arr[i+1] < max {
            max = arr[i+1];
        }
    }
    let count =
        if n < min || min > max{
            0
        } else if n < max {
            n - min + 1
        } else {
            max - min + 1
        };
    println!("{:?}", count);
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + (ll)b) % mod
#define MUL(a, b) a = (a * (ll)b) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rer(i, a, b) for(int i = a - 1; i >= b; i--)
#define all(a) (a).begin(), (a).end()
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef pair<pi, pi> ppi;
typedef vector<ll> vec;

const int MAX_N = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;

void Debug() {cout << '\n'; }

template<class FIRST, class... REST> 
void Debug(FIRST arg, REST... rest) { cout << arg << " "; Debug(rest...); }

template<class T>
ostream& operator<< (ostream& out, const vector<T>& v) {
	out << "[";
	if(!v.empty()) {
		rep(i, 0, (int)v.size() - 1) out << v[i] << ", ";
		out << v.back();
	}
	out << "]";
  return out;
}

template<class S, class T>
ostream& operator<< (ostream& out, const pair<S, T>& v) {
	out << "(" << v.first << ", " << v.second << ")";
	return out;
}

///g++ -g3 -std=c++0x -DLOCAL -Wall -ftrapv -D_GLIBCXX_DEBUG -Wl,-stack,268435456 -o
///g++ -O2 -std=c++0x -DLOCAL -Wall -Wl,-stack,268435456 -o

///////////////////////////////////////////////////////////////////////

ll N, M;

void solve() {
	cin >> N >> M;
	if(abs(N - M) <= 1) cout << "Brown\n";
	else cout << "Alice\n";
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(0);	
    cout << fixed;
	cout.precision(20);
#ifdef LOCAL
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 256
def knapsack(sizes, vals, volume):
    n = len(sizes)

    # dp[i][j] is the max value at item i while using capacity j
    dp = [[0] * (volume+1) for _ in range(n)] # j is 0...volume

    for i in range(n):
        for j in range(volume+1):
            dp[i][j] = max(dp[i][j], dp[i-1][j])
            if j - sizes[i] >= 0:
                dp[i][j] = max(dp[i][j], dp[i-1][j-sizes[i]] + vals[i])

    return dp[-1][-1]


if __name__ == "__main__":
    n, volume = [int(x) for x in input().split()]
    sizes, vals = [], []
    for _ in range(n):
        s, v = [int(x) for x in input().split()]
        sizes.append(s)
        vals.append(v)
    print(knapsack(sizes, vals, volume))


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


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

int ans;
  for (int a = 0; a <= n; a++) {
    for (int b = 0; b <= n; b++) {
      int remain, hoge;
      remain = n - (a + b);
      hoge = y - (a * 10000 + b * 5000);
      if (remain >= 0 && remain == hoge / 1000) {
        cout << a << " " << b << " " << remain << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main() {
	int N;
	cin >> N;
	bool Plus = N >= 0, now = true;
	if (!Plus) N = -N;
	vector<int> Ans;
	while (N > 0) {
		if ((N & 1) == 1) Ans.push_back((2 * Plus - 1) * (2 * now - 1));
		else Ans.push_back(0);
		now = !now;
		N = N >> 1;
	}
	int digit = Ans.size();
	for (int i = 0; i < digit; i++) {
		if (Ans[i] == -1) {
			Ans[i] = 1;
			if (i == digit - 1) {
				Ans.push_back(1);
				digit++;
			}
			else Ans[i + 1]++;
		}
		if (Ans[i] == -2) {
			Ans[i] = 0;
			if (i == digit - 1) {
				Ans.push_back(1);
				digit++;
			}
			else Ans[i + 1]++;
		}
		if (Ans[i] == 2) {
			Ans[i] = 0;
			if (i == digit - 1) {
				Ans.push_back(-1);
				digit++;
			}
			else Ans[i + 1]--;
		}
	}
	if (digit == 0) {
		cout << 0 << endl;
		return 0;
	}
	for (int i = digit - 1; i >= 0; i--) cout << Ans[i];
	cout << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long h = sc.nextLong();
		long w = sc.nextLong();
		long n = h * w;
		if(h == 1 || w == 1) {
			System.out.println(1);
			System.exit(0);
		}

		if(n % 2 == 0) {
			System.out.println(n / 2);
		}else {
			System.out.println(n / 2 + 1);
		}
		sc.close();
	}
}


Measured memory_bytes: 21844
function main(input){
  var lines = input.split("\n");
  var length = parseInt(lines[0]);
  var nums = lines[1].split(" ").map(x=>parseInt(x));

  var answer = 0;  
  for(var i=0;i<length;i++){
    while(nums[i]%2===0){
      nums[i]=nums[i]/2;
      answer++;
    }
  }
  console.log(answer);
}

main(require("fs").readFileSync("/dev/stdin","utf-8"));

Measured memory_bytes: 7628
H, W=map(int, input().split())
deference=H*W
a=0
b=0
for i in range(W-1):
    a=H*(i+1)
    b=H//2*(W-i-1)
    if deference>max(a, b, H*W-a-b)-min(a, b, H*W-a-b):
        deference=max(a, b, H*W-a-b)-min(a, b, H*W-a-b)
for i in range(H-1):
    a=W*(i+1)
    b=W//2*(H-i-1)
    if deference>max(a, b, H*W-a-b)-min(a, b, H*W-a-b):
        deference=max(a, b, H*W-a-b)-min(a, b, H*W-a-b)
for i in range(W-2):
    a=H*(i+1)
    b=H*((W-i-1)//2)
    if deference>max(a, b, H*W-a-b)-min(a, b, H*W-a-b):
        deference=max(a, b, H*W-a-b)-min(a, b, H*W-a-b)
for i in range(H-2):
    a=W*(i+1)
    b=W*((H-i-1)//2)
    if deference>max(a, b, H*W-a-b)-min(a, b, H*W-a-b):
        deference=max(a, b, H*W-a-b)-min(a, b, H*W-a-b)
print(deference)

Measured memory_bytes: 3188
def c_755(N):
    from itertools import product
    is_upper = False
    ans = 0
    for digit in range(3, 10):
        for s in product('357', repeat=digit):
            s = ''.join(s)
            if s.count('3') == 0 or s.count('5') == 0 or s.count('7') == 0:
                continue
            if int(s) <= N:
                ans += 1
    return ans

N = int(input())
print(c_755(N))

Measured memory_bytes: 3060
import bisect
n = int(input())
l = list(map(int,input().split()))

l.sort()
ans = 0
for a in range(n):
    for b in range(a+1,n):
        t = l[a]+l[b]
        cc = bisect.bisect_left(l,t)
        ans += max(0,cc-b-1)
print(ans)

Measured memory_bytes: 43500
lst = list(map(int,input().split()))

m = 0
for i in range(len(lst)):
    m = max(m,lst[i])
    
for i in range(len(lst)):
    if lst[i]==m:
        idx = i

idx_1 = (idx + 1 + 3)%3
idx_2 = (idx - 1 + 3)%3

cnt_1 = (lst[idx]-lst[idx_1])//2
lst[idx_1] += 2*cnt_1
cnt_2 = (lst[idx]-lst[idx_2])//2
lst[idx_2] += 2*cnt_2

if lst[idx_1] == lst[idx_2] and lst[idx_1] == lst[idx]: print(cnt_1 + cnt_2)
elif lst[idx_1] == lst[idx_2] and lst[idx_1]+1 == lst[idx]: print(cnt_1 + cnt_2 + 1)
else: print(cnt_1 + cnt_2 + 2)

Measured memory_bytes: 3064
N,Q = map(int, input().split())
S = input()

t = [0] * (N+1)
for i in range(N):
    t[i] = t[i-1] + (1 if S[i:i+2] == "AC" else 0)
for i in range(Q):
    l,r = map(int, input().split())
    print(t[r-2] - t[l-2])

Measured memory_bytes: 7668
import sys
s = input()

# ２文字だった時の判定
if len(s) == 2:
    if s[0] == s[1]:
        print("1 2")
    else:
        print("-1 -1")

# 2文字以上の時の判定
else:
    # 比較
    for i in range(len(s) - 2):
        # ３文字比較すれば、アンバランスかわかる
        # 3文字全部ばらばらならOK
        # 1:2に別れたらアンバランス
        t = s[i:i + 3]
        # tの中で、１文字目の出現回数が１より上、もしくは、2文字目の出現回数が1より上
        # ２文字出た時点でアンバランス
        if t.count(t[0]) > 1 or t.count(t[1]) > 1:
            print(i + 1, i + 3)
            sys.exit()

    print("-1 -1")

Measured memory_bytes: 39408
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>
#include <limits>
#include <iomanip>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

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

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

	ll result = 0;
	ll maxHeight = a[0];
	for (int i = 1; i < n; i++)
	{
		int addHeight = 0;
		while ((a[i] + addHeight) < maxHeight)
		{
			addHeight++;
		}
		result += addHeight;
		maxHeight = a[i] + addHeight;
	}

	cout << result << endl;
    return 0;
}

Measured memory_bytes: 4836
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; } /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; } /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b)
{
  return *(char *)a - *(char *)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b)
{
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, n) for (int i = 0; i < n; i++)

int main(void)
{
  int n, x;
  scanf("%d %d", &n, &x);
  int l[101], d[101];
  int i;
  for (i = 0; i < n; i++)
  {
    scanf("%d", &l[i]);
  }

  bool able = true;
  int count = 1;
  d[0] = 0;
  for (i = 1; i < n + 1; i++)
  {
    d[i] = d[i - 1] + l[i - 1];
    if (d[i] > x)
      break;
    count++;
  }
  printf("%d\n", count);

  return 0;
}


Measured memory_bytes: 128