akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define endl '\n'
#define debug(X) cout << #X << " = " << X << endl

using namespace std;

const int MN = 1000010;
const int MD = 1e9 + 7;

long long fact[MN];

long long fastExp(long long b, long long e) {
	long long ans = 1;
	while (e > 0) {
		if (e & 1) ans = (ans * b) % MD;
		b = (b * b) % MD;
		e >>= 1;
	}
	return ans;
}

int comb(int a, int b) {
	long long p = fact[a];
	long long q = (fact[b] * fact[a - b]) % MD;
	return (p * fastExp(q, MD - 2)) % MD;
}

int solve(int x, int y) {
	if ((x + y) % 3) return 0;
	int n = (x + y) / 3;
	if (2 * n - x < 0 || 2 * n - x > n) return 0;
	return comb(n, 2 * n - x);
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	#ifdef UTP
	freopen("input.txt", "r", stdin);
	#endif
	fact[0] = 1;
	for (int i = 1; i < MN; i++)
		fact[i] = (fact[i - 1] * i) % MD;
	int x, y; cin >> x >> y;
	int ans = solve(x, y);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 8064
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;

class Root
{
    static T to<T>(string str)
    {
        return (T)Convert.ChangeType(str, typeof(T));
    }

    static string cin2str()
    {
        return System.Console.ReadLine().Trim();
    }

    static string[] cin2strs()
    {
        return cin2str().Split(' ');
    }

    static T[] cin2arr<T>()
    {
        return cin2strs().Select(line => to<T>(line)).ToArray();
    }

    static void Main(string[] args)
    {
        int[] arr = cin2arr<int>();
        var A     = arr[0];
        var N     = arr[1];
        var M     = arr[2];
        var nos = new List<ulong>();
        for (var i = 1;; ++i) {
            var ret_pow = (ulong)Math.Pow(i + A, N);
            if (ret_pow > (ulong)M) break;
            nos.Add(ret_pow);
        }
        var ret   = nos.AsParallel().Where(no => {
            var ints    = no.ToString().ToCharArray().Select(c => (int)char.GetNumericValue(c));
            var ret_pow = (ulong)Math.Pow(ints.Sum() + A, N);
            return no == ret_pow;
        });
        var count = ret.Count();
        Console.WriteLine("{0}", count);
    }
}


Measured memory_bytes: 24496
#include <bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vvl = vector<vl>;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define per(i,n) for(int i = (n)-1; i >= 0; --i)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main() {
    string s; cin >> s;
    s[1] = s[1]=='B' ? 'R' : 'B';
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
 
// 0-indexed
// now node k
// child node k*2+1 and k*2+2
// parent node (k-1)/2
struct data {
  int a;
};
const int maxint = 2147483647;
data resetdata = {maxint};
struct RMQ {
  // except bottom size
  int sizen;
  vector<data> dat;
  RMQ(int newn = 1, data resets = resetdata) {
    reset(newn, resets);
  }
  void reset(int newn = 1, data resets = resetdata) {
    sizen = 1;
    while(sizen < newn) sizen *= 2;
    dat.resize(2 * sizen - 1);
    for(int i = 0; i < dat.size(); ++i) dat[i] = resets;
  }
  // "go up" process
  // data[k].a = newnum
  bool update(int k, int newnum) {
    k += sizen - 1;
    dat[k].a = newnum;
    while(k > 0) {
      k = (k - 1) / 2;
      dat[k].a = min(dat[k * 2 + 1].a, dat[k * 2 + 2].a);
    }
    return 1;
  }
  // "go down" process
  // return min number in [a,b)
  // pick(a,b,0,0,sizen)
  int pick(int a, int b, int k = 0, int l = 0, int r = -1) {
    if(r == -1) r = sizen;
    // [l,r)[a,b) or [a,b)[l,r)
    if(r <= a || b <= l) return maxint;
    // [a,[l,r),b)
    if(a <= l && r <= b) return dat[k].a;
    // else
    int nowl, nowr, nextlr = k * 2 + 1, med = (l + r) / 2;
    nowl = pick(a, b, nextlr, l, med);
    nowr = pick(a, b, nextlr + 1, med, r);
    return min(nowl, nowr);
  }
};
RMQ rmq;
long long n, ans = 100000000000000000, x;
long long a[20005] = {0};
 
int main() {
  cin >> n >> x;
  rmq = RMQ(2 * n + 1);
  for(long long i = 0; i < n; ++i) {
    cin >> a[i];
    rmq.update(i, a[i]);
    rmq.update(i + n, a[i]);
  }
  for(long long i = 0; i < n; ++i) {
    long long nans = i * x;
    for(long long j = 0; j < n; ++j)
      nans += rmq.pick(j + n - i, j + n + 1);
    ans = min(ans, nans);
  }
  cout << ans << endl;
  return 0;
}

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

int main()
{
    int N;
    long long K;
    cin>>N>>K;
    vector<long long> A(N);
    for (long long &a: A)
        cin>>a;

    long long S = 0;
    for (long long a: A)
        S += a;

    vector<long long> F;
    for (long long i=1; i*i<=S; i++)
        if (S%i==0)
            F.push_back(i);
    for (int i=(int)F.size()-1; i>=0; i--)
        F.push_back(S/F[i]);
    reverse(F.begin(), F.end());

    for (long long f: F)
    {
        vector<long long> R;
        long long rs = 0;
        for (long long a: A)
            if (a%f!=0)
            {
                R.push_back(f-a%f);
                rs -= a%f;
            }
        if (R.size()==0)
        {
            cout<<f<<endl;
            return 0;
        }
        sort(R.begin(), R.end());
        long long k = 0;
        for (long long r: R)
        {
            k += r;
            if (k>K)
                break;
            rs += f-r;
            if (k+rs>=0)
            {
                cout<<f<<endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K,res=0;
  cin >> N >> K;
  vector<int> L(N);
  for(int i=0; i<N; i++) cin >> L.at(i);
  sort(L.begin(),L.end(), greater<int>());
  for(int i=0; i<K; i++) res += L.at(i);
  cout << res << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using std::cin;
using std::cout;
using std::endl;
using std::string;

string s, result;

int main() {
	cin >> s;
	for(auto c : s) {
		if(c == 'B') {
			if(!result.empty()) result.erase(result.size()-1);
			continue;
		}
		result.append(1, c);
	}
	cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b,s,n;
int main()
{
    cin>>n;
    for (int i=1; i<=n; ++i)
    {
        cin>>a>>b;
        s=s+b-a+1;
    }
    cout<<s;
    return 0;
}


Measured memory_bytes: 256
const EMPTY: usize = 2;
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n = sc.read::<usize>();
    let mut graph = vec![vec![]; n];
    for _ in 1..n {
        let u = sc.read::<usize>() - 1;
        let v = sc.read::<usize>() - 1;
        let w = sc.read::<u64>();
        graph[u].push((v, w));
        graph[v].push((u, w));
    }

    let mut color = vec![EMPTY; n];
    color[0] = 0;
    dfs(0, &graph, &mut color);
    for c in color.into_iter() {
        println!("{}", c);
    }
}

fn dfs(v: usize, graph: &Vec<Vec<(usize, u64)>>, color: &mut Vec<usize>) {
    for &(next, weight) in graph[v].iter() {
        let next_color = if weight % 2 != 0 {
            color[v] ^ 1
        } else {
            color[v]
        };
        if color[next] != EMPTY {
            assert_eq!(color[next], next_color);
        } else {
            color[next] = next_color;
            dfs(next, graph, color);
        }
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

int main() {
  string S; cin >> S;
  int a = S.at(0), b = S.at(1), c = S.at(2), d = S.at(3);
  if (a == b || b == c || c == d) {
    cout << "Bad" << endl;
  }
  else {
    cout << "Good" << endl;
  }
}

Measured memory_bytes: 384
#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>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl

//ここから編集する


int main() {
    int n;
    cin >> n;
    int ans = 114514;
    rep(i,0,n){
        int inp;
        cin >> inp;
        for(int j = 0; ; j++){
            if(inp >> j & 1){
                ans = min(ans,j);
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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 long long INF = 1LL << 60;

int N;
long long h[100010];

long long dp[100010];

int main() {
	int N; cin >> N;
	for (int i = 0; i < N; ++i) cin >> h[i];
	
	for (int i = 0; i < 100010; ++i) dp[i] = INF;
	
	dp[0] = 0;
	
	for (int i = 1; i < N; ++i) {
		chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
		if (i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	
	cout << dp[N - 1] << endl;
}


Measured memory_bytes: 1792
import itertools
n,m,q=map(int,input().split())
a=[0 for i in range(q)]
b=[0 for i in range(q)]
c=[0 for i in range(q)]
d=[0 for i in range(q)]
for i in range(q):
    a[i],b[i],c[i],d[i]=map(int,input().split())
    a[i]-=1
    b[i]-=1
ans=0
buf=[None]*n

def dfs(nowdigit,cannum):
    global ans
    if nowdigit==n:
        tmp=0
        for j in range(q):
            if buf[b[j]] - buf[a[j]] == c[j]:
                tmp+=d[j]
        ans=max(ans,tmp)
    else:
        for i in range(cannum,m+1):
            buf[nowdigit]=i
            dfs(nowdigit+1,i)
dfs(0,1)
print(ans)

Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
  int n,m,x;
  cin >> n >> m >> x;

  vector<vector<int>> table(n,vector<int>(m));
  vector<int> c(n);

  for (int i = 0; i < n; i++) {
    cin >> c.at(i);
    for (int j = 0; j < m; j++) {
      cin >> table.at(i).at(j);
    }
  }
  int ans = INF;
  int all = 1<<n;
  for (int s = 0; s < all; s++) {
    vector<int>level(m);
    int cost =0;
  
    for (int i = 0; i < n; i++) {
      if ((s>>i)&1) {
        cost += c.at(i);
        for (int j = 0; j < m; j++) {
          level.at(j) += table.at(i).at(j);
        }
      }
    }
      bool ok = true;
      for (int j = 0; j < m; j++) {
        if (level.at(j) < x) ok = false;
      }
        if (ok) ans = min (ans,cost);
   }
   if (ans == INF) {
     cout << -1 << endl;
   }
   else cout << ans << endl;

}

Measured memory_bytes: 3624
module solution;
import std.stdio;

void main ()
{
	int n, k;
	while (readf (" %s %s", &n, &k) > 0)
	{
		readln;
		readln;
		n -= 1;
		k -= 1;
		writeln ((n + k - 1) / k);
	}
}


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


int search_maxi(int array[26]){
  int maxi=0;
  for(int i=0;i<26;i++){
    if(array[maxi] < array[i]){
      maxi=i;
    }
  }
  return maxi;
}


bool check(int count[26],int maxi,int x){
  
  for(int j=0;j<26;j++){
    if( maxi!=j && count[j]+x >= count[maxi] ){
      return false;
    }
  }

  return true;
}


int main(){
  
  while(1){
    int n;
    int count[26]={};
    
    cin>>n;
    if(n==0)break;

    char ansC;
    int ansI=n+1;
    
    for(int i=0;i<n;i++){
      char ch;
      cin>>ch;

      int id=ch-'A';
      count[id]++;

      int maxi=search_maxi(count);
      
      if( check( count , maxi, n-1-i ) ){
        ansC=('A' + maxi);
        ansI=min(ansI,i+1);
      }
    }

    if(ansI==n+1){
      cout<<"TIE"<<endl;
    }else{
      cout<<ansC<<' '<<ansI<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 2984
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
    int main () {
    string s;
    cin >> s;
    int ret;
    if ((s[0] == 'R')&&(s[1] == 'R')&&(s[2] == 'R')) {
        ret = 3;
    }
    else if (((s[0] == 'R')&&(s[1] == 'R'))||((s[1] == 'R')&&(s[2] == 'R'))) {
        ret = 2;
    }
    else if ((s[0] == 'R')||(s[1] == 'R')||(s[2] == 'R')) {
        ret = 1;
    }
    else {
        ret = 0;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
  using namespace std;
  #define       M                        1000000007
  #define       ll                       long long
  #define       FIO                      ios_base::sync_with_stdio(false);cin.tie(NULL)
  #define       ifor(st,lim)             for(int i=st;i<lim;i++)
  #define       jfor(stt,llim)           for(int j=stt;j<llim;j++)
  #define       eifor(st,lim)            for(int i=st;i<=lim;i++)
  #define       ejfor(stt,llim)          for(int j=stt;j<=llim;j++)
  #define       blank                    cout<<'\n' 

  void solve()
  { 
      int n; cin>>n;
      int a[n]; 
      ifor(0,n) cin>>a[i];
      int mx = 0;
      ll ans  = 0;
      ifor(0,n) {
      		mx = max(a[i],mx);
      		ans+=mx-a[i];
      }
      cout<<ans;
  } 

  int main()
  {
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
  int t=1; 
    while(t--){
      solve();
     } 
  }

Measured memory_bytes: 4284
# include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

# define pb push_back
# define fr first
# define sc second
# define mk make_pair

using namespace std;

const long long linf = 1e18 + 7;
const int inf = 1e9 + 7;
const int N = 1e6 + 5;

typedef long long ll;

string a, b, d;
int c;

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

      d = b + a;
      a = a + b;

      for(int i = 0; i < a.size(); i ++){
            c *= 10;
            c += a[i] - '0';
      }

      int sq = sqrt(c);

      if(sq * sq == c){
            puts("Yes");
            return 0;
      }

      c = 0;

      for(int i = 0; i < d.size(); i ++){
            c *= 10;
            c += a[i] - '0';
      }

      sq = sqrt(c);

      if(sq * sq == c){
            puts("Yes");
            return 0;
      }

      puts("No");
}


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

#define ll long long
#define db double
#define deb(x) cout<<#x<<": "<<x<<"\n"
#define all(x) x.begin(),x.end()
#define fo(i, n) for(i=0 ; i<n ; i++)
#define Fo(i, k, n) for(i=k ; i<n ; i++)

using namespace std;
using namespace chrono;

const ll MOD = 1000000007;
const ll N = 3005;  // array size
const ll inf = 10000000000000000;


void print(vector<ll> v) {
    ll i;
    fo(i, v.size())cout << v[i] << " ";
    cout << "\n";
}

void print(vector<pair<ll, ll> > v) {
    ll i;
    fo(i, v.size()) {
        cout << v[i].first << " " << v[i].second << "\n";
    }
}

vector<ll> read(ll n) {
    ll i;
    vector<ll> arr(n, 0);
    fo(i, n)cin >> arr[i];
    return arr;
}

vector<ll> read(ll n, ll k) {
    ll i;
    vector<ll> arr(n + k, 0);
    Fo(i, k, n + k)cin >> arr[i];
    return arr;
}

bool isEven(ll n) {
    return n % 2 == 0;
}

bool isOdd(ll n) {
    return n % 2 != 0;
}

int dp[10010][1010];
ll h, n;
vector<ll> a(N), b(N);

ll get(ll health, ll pos) {

    if (pos == n) {
        return INT_MAX;
    }

    if (health <= 0) {
        return 0;
    }

    if (dp[health][pos] != -1) {
        return dp[health][pos];
    }

    // take pos
    ll op1 = b[pos] + get(health - a[pos], pos);
    ll op2 = get(health, pos + 1);

    dp[health][pos] = min(op1, op2);
    return dp[health][pos];
}

void solve() {
    ll t = 1;
//    cin >> (t);
    while (t--) {

        ll i, j, k, m, p, q, x, y, l, r;
        cin >> h >> n;

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

        fo(i, h + 1) {
            fo(j, n + 1) {
                dp[i][j] = -1;
            }
        }

//        fo(i, h) {
//            fo(j, n) {
//                cout << dp[i][j] << " ";
//            }
//            cout << "\n";
//        }

        ll ans = get(h, 0);

        cout << ans;

    }
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif

    auto start = high_resolution_clock::now();

    solve();

    ll i, j, k, n, m, p, q, x, y, a, b, l, r;


    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
#ifndef ONLINE_JUDGE
    cerr << "Time: " << duration.count() / 1000.0 << endl;
#endif


    return 0;
}




Measured memory_bytes: 43616
#include <algorithm>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  string S;
  cin >> S;
  set<char> NS, WE;
  for (char c : S) {
    if (c == 'N' || c == 'S') {
      NS.insert(c);
    } else {
      WE.insert(c);
    }
  }
  bool res = NS.size() != 1 && WE.size() != 1;
  cout << (res ? "Yes" : "No") << endl;
  return 0;
}


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

int main() {
  long long N, M;
  cin >> N >> M;
  vector<vector<int>> ab(N, vector<int>(2));
  for (long long i=0; i<N; i++) {
    cin >> ab.at(i).at(0) >> ab.at(i).at(1);
  }
  sort(ab.begin(), ab.end());
  
  long long num, can=0;
  for (long long i=0; i<N; i++) {
    can += ab.at(i).at(1);
    if (can>=M) {
      num=i;
      break;
    }
  }
  
  long long cost=0;
  can=0;
  if (num>0) {
    for (long long i=0; i<num; i++) {
      cost += (long long)ab.at(i).at(0)*ab.at(i).at(1);
      can += ab.at(i).at(1);
    }
    cost += (long long)ab.at(num).at(0)*(M-can);
  }
  else {
    cost = (long long)ab.at(0).at(0)*M;
  }
  
  cout << cost << endl;

}


Measured memory_bytes: 5760
import java.util.*;
class Main {
  static Scanner sc = new Scanner(System.in);
  static String pw = sc.next();

  public static String check(String pw) {
    for(int i=0; i < pw.length()-1; i++) {
      if (pw.substring(i, i+1).equals(pw.substring(i+1, i+2))){
        return "Bad";
      }
    }
    return "Good";
  }
  
  public static void main(String args[]){
	String result = check(pw);
    System.out.println(result);
  }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int main(){
 int N;
  int flag=0;
 cin >> N;
 rep(i,10){
   rep(j,10){
     if ( N == i * j) flag++;
   }
 }
  if (flag == 0) {
    cout << "No"<<endl;
  }else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
<?php
error_reporting(0);
$stdin = file_get_contents('php://stdin');
$line = explode("\n",$stdin);
$fi = 0;
$cnt = 0;
$list = array();
$key = new stdclass();
foreach($line as $l) {
  if (strlen($l)==0) continue;
  if ($fi == 0) {
    $a = explode(" ",$l);
    $key->A = $a[0];
    $key->B = $a[1];
    $key->C = $a[2];
    $fi++;
    continue;
  }
  if ($fi > 0) {
    $a = explode(" ",$l);
    $key->X=$a;
  }
}
if ((($key->A % 2) == 0) ||
    (($key->B % 2) == 0) ||
    (($key->C % 2) == 0)) {
    printf("0\n");
}
else {
  printf("%d\n",min($key->B*$key->C,$key->A*$key->C,$key->A*$key->B));
}


Measured memory_bytes: 3832
/*
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

int main()
{
    int n, k;
    std::string s;
    std::cin >> n >> k;
    std::cin >> s;

    s[k - 1] += 32;

    std::cout << s << std::endl;
    return 0;
}

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

using namespace std;

int main()
{
    int w, h, n;
    cin >> w >> h >> n;

    vector<vector<bool>> rec(w, vector<bool>(h, true));

    for (int i = 0; i < n; i++) {
        int x, y, a;
        cin >> x >> y >> a;
        switch (a) {
            case 1:
                for (int j = 0; j < x; j++) {
                    for (int k = 0; k < h; k++) {
                        rec[j][k] = false;
                    }
                }
                break;

            case 2:
                for (int j = x; j < w; j++) {
                    for (int k = 0; k < h; k++) {
                        rec[j][k] = false;
                    }
                }
                break;

            case 3:
                for (int j = 0; j < w; j++) {
                    for (int k = 0; k < y; k++) {
                        rec[j][k] = false;
                    }
                }
                break;

            case 4:
                for (int j = 0; j < w; j++) {
                    for (int k = y; k < h; k++) {
                        rec[j][k] = false;
                    }
                }
                break;
        }
    }

    int ans = 0;
    for (int i = 0; i < w; i++) {
        for (int j = 0; j < h; j++) {
            if (rec[i][j]) {
                ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

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

int main(){
  int a;
  cin >> a;
  if(a%10==3)cout <<"bon";
  else if(a%10==0||a%10==1||a%10==6||a%10==8)cout <<"pon";
  else cout <<"hon";
}

Measured memory_bytes: 3632
/*
    Mbak Sana Dong
    Mbak Chaeyoung Dong
*/
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll arr[200200];
int main()
{
    int n,i,j,k,x,y,ans,curr,m;
    int tc;
    cin >> n;
    ll chaeng = 0;
    for(i=1;i<=n;i++) {
        cin >> arr[i];
        chaeng ^= arr[i];
    }
    for(i=1;i<=n;i++) {
        cout << (arr[i] ^ chaeng) << " ";
    }
    cout << endl;
    return 0;
}


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

ll N, K;
vector<ll> A, F, S;

bool achievable(ll m) {
  ll n = 0;
  rep(i, N) n += (max(0LL, S[i] - m) + F[i] - 1) / F[i];
  return n <= K;
}

int main() {
  cin >> N >> K;
  A.resize(N), F.resize(N), S.resize(N);
  rep(i, N) cin >> A[i];
  rep(i, N) cin >> F[i];

  sort(all(A));
  sort(all(F), greater<ll>());
  assert(A[0] <= A[N - 1]);
  assert(F[0] >= F[N - 1]);
  rep(i, N) S[i] = A[i] * F[i];

  ll l = -1, r = 1e12;
  while (r - l > 1) {
    ll m = (l + r) / 2;

    if (achievable(m)) {
      r = m;
    } else {
      l = m;
    }
  }

  cout << r << endl;

  return 0;
}


Measured memory_bytes: 4992
// *********************************************************************************
// *                        MURTAZA MUSTAFA KHUMUSI                                *
// *                        NIT-DGP,CSE - 2019-2023                                *
// *********************************************************************************

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007;
#define loop(i, a, n) for (int i = a; i < n; i++)
#define loop1(i, b, n) for (int i = b; i <= n; i++)
#define loopit(a) for (auto it = a.begin(); it != a.end(); it++)
#define ms(a, b) memset(a, b, sizeof(a))
#define pb(a) push_back(a)
#define MP make_pair
#define pi pair<int, int>
#define ff first
#define ss second
#define bloop(i, a, b) for (int i = a; i > b; i--)
#define bloop1(i, a, b) for (int i = a; i >= b; i--)
#define PQ priority_queue<int> pq;
#define MPQ priority_queue<pi, vector<int>, greater<pi>> mpq;
#define io                        \
    ios_base::sync_with_stdio(0); \
    cin.tie(NULL);
const int maxm = 100001;

void solve()
{
    string str;
    cin>>str;
    int s=0;
    loop(i,0,str.size()){
      s += str[i]-'0';
    }

    cout<<(s%9==0?"Yes":"No")<<"\n";
}
int main()
{
    io;

    solve();

    return 0;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
// ???
const int mod = 1e9+7 ;
//998244353;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//??
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
}   ;
 
mint dp[2005][2005] ; //dp n m 
int main(){
 ll n ,m ; cin>>n>>m ;
 vector<ll> S(n) ,T(m) ;
 rep(i,n)  {cin>>S[i] ; dp[i+1][0]=1 ;}
 rep(i,m)  {cin>>T[i] ; dp[0][i+1]=1 ;}
 dp[0][0]=1 ;
 rep(i,n){
   rep(j,m){
     if(S[i]!=T[j]) dp[i+1][j+1]=dp[i][j+1]+dp[i+1][j]-dp[i][j] ;
     else dp[i+1][j+1]=dp[i+1][j]+dp[i][j+1] ;

     }
   }
//   for(int i=0;i<=n;i++)
//	{
//		for(int j=0;j<=m;j++)
//		{
//			cout<<dp[i][j]<<" ";
//		}
//		cout<<endl;
//	}
   cout<<dp[n][m]<<endl ;
    return 0;
  }


Measured memory_bytes: 31744
//Waqt Ha Badal Jayega//

#include <bits/stdc++.h>
#include <stdint.h>
#define mod 1000000007
#define ull unsigned ll
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define pi 3.1415926535897932
using namespace std;
/*-------------------------------------------------------------*/

//for (a*b)%mod

uint64_t mulmod(uint64_t a, uint64_t b, uint64_t m)
{
	long double x;
	uint64_t c;
	int64_t r;
	if (a >= m) a %= m;
	if (b >= m) b %= m;
	x = a;
	c = x * b / m;
	r = (int64_t)(a * b - c * m) % (int64_t)m;
	return r < 0 ? r + m : r;
}

/*-------------------------------------------------------------*/
ull binpowmod(ull a, ull b, ull m)
{
	ull res = 1;
	while (b > 0)
	{
		if (b & 1)
		{
			res = ((res % m) * (a % m)) % m;
		}
		a = ((a % m) * (a % m)) % m;
		b >>= 1;
	}
	return res;
}
/*-------------------------------------------------------------*/

ll countsetbits(ll n)
{
	ll count = 0;
	while (n > 0)
	{
		n = n & (n - 1);
		count++;
	}
	return count;
}

/*-------------------------------------------------------------*/
ll binpow(ll a, ll b)
{
	ll res = 1;
	while (b > 0)
	{
		if (b & 1)
		{
			res *= a;
		}
		a *= a;
		b >>= 1;
	}
	return res;
}



/*-------------------------------------------------------------*/
ll binarysearch(ll l, ll r, ll a[], ll x)
{
	while (l <= r)
	{
		ll mid = l + ((r - l) / 2);

		if (a[mid] == x )
		{
			return mid ;
		}
		if (a[mid] < x)
		{
			l = mid + 1;
		}
		else
		{
			r = mid - 1;
		}
	}
	return -1;
}
/*--------------------------------------------------------------*/
//Adjacency list

/*vector<ll>adj[100005];

ll vis[100005];  //how many i-th node have been visited
void dfs(ll node)
{
	vis[node] = 1;
	for (ll child : adj[node])
	{
		if (!vis[child])
		{
			dfs(child);
		}
	}
}

*/
/*--------------------------------------------------------------*/
/* Upper bound of x gives numbers less than or equal to x */
ll countdig(ll n)
{
	ll count = 0;
	while (n > 0)
	{
		n /= 10;
		count++;
	}
	return count;
}

// Bad day ! Luck matters > Stop Judging



/*-------------------------------------------------------------*/
int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	ll k;
	cin >> k;
	string s;
	cin >> s;
	if (k >= s.size())
	{
		cout << s << "\n";
	}
	else
	{
		for (ll i = 0; i < k; i++)
		{
			cout << s[i];
		}
		cout << "...\n";
	}
	return 0;

}

Measured memory_bytes: 3556
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>


// #define INT_MAX 2147483647
// #define LL_MAX 9223372036854775807

using namespace std;
#define i64  long long

void solve(void)
{
  int a,b,c;
  cin>>a>>b>>c;
  if((a<b)&&(b<c))
  cout<<"Yes"<<endl;
  else
  cout<<"No"<<endl;
  
  return;
}
int main(int argc, const char *argv[])
{

  solve();

  return 0;
}



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
LL read()
{
    LL x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}
int lcm(int a,int b)
{
	return a/__gcd(a,b)*b;
}

int main()
{
	LL k=read(),L=k/50,M=k%50;
	cout<<50<<endl;
	For(i,1,50)cout<<49-M+(i<=M)*51+L<<" ";
	return 0;
}




Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int n;
bool x[100100];
char str[100100]; 
int s[100100];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n;
	scanf("%s",str);
	for(int i=0;i<n;i++)
		x[i+1]=(str[i]=='x');
	x[n+1]=x[1];
	for(int mask=0;mask<8;mask++){
		s[0]=mask&1;
		s[1]=(mask>>1)&1;
		s[2]=(mask>>2)&1;
		for(int j=2;j<=n+1;j++)
			s[j+1]=(s[j-2]^x[j]);
		if(s[0]^s[n]^s[1]^s[n+1]||s[1]^s[n+1]^s[2]^s[n+2])
			continue;
		for(int i=1;i<=n;i++){
			if(s[i]^s[i-1])
				cout<<'W';
			else
				cout<<'S';
		}
		return  0;
	}
	cout<<-1;
	return 0;
}


Measured memory_bytes: 896
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdlib.h>
#include<set>
#include<math.h>
#include<iomanip>

using namespace std;


int main(void)
{
    int a,b;
    cin>>a>>b;
    
    int add=a+b, sub=a-b ,mul=a*b;
    
    int max=add;
    if(sub>max) max=sub;
    if(mul>max) max=mul;
    
    cout<<max<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>
#include <omp.h>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;

const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 
//const long long int pl=1000000;

long long int N,res=0,L,R,d;

int main(){

    cout << fixed << setprecision(18);
    cin>>L>>R>>d;
    cout<<(R/d)-((L-1)/d)<<endl;
}



Measured memory_bytes: 3620
#include <iostream>
#include <string>
#define int long long
using namespace std;

int n;
string s;
string tmp = "MARCH";
int cnt[6];

signed main() {
	int i, j;
	
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> s;
		for (j = 0; j < 5; j++) {
			if (s[0] == tmp[j]) break;
		}
		cnt[j]++;
	}
	
	int ans = 0;
	for (i = 0; i < (1 << 5); i++) {
		int selectCnt = 0;
		int id[5];
		for (j = 0; j < 5; j++) {
			if ((i >> j) & 1) {
				id[selectCnt++] = j;
			}
		}
		if (selectCnt == 3) {
			ans += cnt[id[0]] * cnt[id[1]] * cnt[id[2]];
		}
	}
	cout << ans << endl;
	return 0;
}

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

// ローリングハッシュ
// 構築 O(n)
// ハッシュ計算 O(1)
// 最長共通Suffix計算 O(log n)
//
// 文字列を、hs[i+1] = hs[i] * b + s[i] (mod m)によってハッシュする。
class RollingHash {
	private:
		vector<long long> mod; // ハッシュなので、複数種類のmodで強化する
		const long long b = 1000000007LL; // 素数が望ましい
		int n;
		void init() {
			mod.push_back(1000000009LL);
			mod.push_back(1000000009LL + 777777LL);
			//rep(i, 4) 
			//    mod.push_back(1000000009LL + rand() % 100000ll);
		}

		// hs: 文字列のローリングハッシュ値
		// hs: hs[i+1] = hs[i] * b + s[i] (mod m)
		// s = "xyzw"
		// ""     hs[0] = 0 
		// "x"    hs[1] = x * b^0 
		// "xy"   hs[2] = x * b^1 + y * b^0
		// "xyz"  hs[3] = x * b^2 + y * b^1 + z * b^0
		// "xyzw" hs[4] = x * b^3 + y * b^2 + z * b^1 + w * b^0
		// "yz"   y * b^1 + z * b^0 = hs[3] - hs[1] * b^2
		vector<vector<long long> > hs;
		// pw: b^n (mod m)
		vector<vector<long long> > pw;

	public:
		// ローリングハッシュ構築
		// O(n)
		RollingHash(const string &s) : n(s.size()) {
			init();
			hs.resize(mod.size()), pw.resize(mod.size());
			for (int m = 0; m < mod.size(); m++) {
				hs[m].assign(n + 1, 0);//0で初期化
				pw[m].assign(n + 1, 0);//0で初期化
				hs[m][0] = 0;
				pw[m][0] = 1;
				for (int j = 0; j < n; j++) {
					pw[m][j + 1] = pw[m][j] * b % mod[m];
					hs[m][j + 1] = (hs[m][j] * b + s[j]) % mod[m];
				}
			}
		}

		// 部分文字列[l, r)のローリングハッシュ値計算
		// O(1)
		inline long long hash(int l, int r, int m) {
			return ((hs[m][r] - hs[m][l] * pw[m][r - l]) % mod[m] + mod[m]) % mod[m];
		}

		// 文字列の一致判定
		// O(1)
		// l1から始まるk文字の文字列のhash
		pair<long long, long long> get_hash(int l1, int k) {
			return make_pair(hash(l1, l1 + k, 0), hash(l1, l1+k,1));
		}
};

long long N;
string S;

int main(){
	cin >> N >> S;
	RollingHash rh = RollingHash(S);
	//for(long long i = 0; i < S.size() - 4; i++){
	//	cout << "hash from " << i << " : " << rh.get_hash(i, 5) << endl;
	//}
	long long start = 0;
	long long end = S.size();

	while(start + 1 < end){
		long long mid = (start+end)/2;

		bool ok = false;
		set<pair<long long, long long>> done;
		for(long long i = 0; i < S.size() - mid + 1; i++){
			if(i >= mid){
				//cout << " mid " << mid << endl;
				//cout << "i = " << i << " add from " << i - mid << endl;
				done.insert(rh.get_hash(i-mid, mid));
			}

			if(done.count(rh.get_hash(i, mid))){
				ok = true;
				break;
			}
		}

		if(ok){
			start = mid;
		}else{
			end = mid;
		}
	}
	cout << start << endl;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define INF 1000000000
#define N 100010
using namespace std;

int n,k,cnta,cntb,Ans,a[N],b[N];

int main()
{
	scanf("%d%d",&n,&k);
	for (int i=1; i<=n; i++) a[i]=b[i]=INF;
	for (int i=1; i<=n; i++)
	{
		int x;
		scanf("%d",&x);
		if (x<0) a[++cnta]=-x;
		else b[++cntb]=x;
	}
	for (int i=1; i<=(cnta/2); i++) swap(a[i],a[cnta-i+1]);
	Ans=b[k];
	for (int i=1; i<=min(cnta,k); i++)
		Ans=min(Ans,a[i]+b[k-i]*2);
	Ans=min(Ans,a[k]);
	for (int i=1; i<=min(cntb,k); i++)
		Ans=min(Ans,b[i]+a[k-i]*2);
	printf("%d\n",Ans);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
#define __lcm(a,b) ((a)/__gcd(a,b)*(b))
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288419716939937510582097;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}

int main()
{
	puts((read()>8 || read()>8)?":(":"Yay!");
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
using litn = lint;
template<class T>
using vec = vector<T>;

#define FOR(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define all(x) (x).begin(),(x).end()


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

  string d[4] = {"dream","dreamer","erase","eraser"};

  reverse(all(s));
  REP(i,4) reverse(all(d[i]));

  string ans="YES";
  for(int i=0;i<s.size();){
    bool ju = false;
    REP(j,4){
      if(s.substr(i,d[j].size()) == d[j]){
        ju = true;
        i += d[j].size();
      }
    }
    if(ju == false){
      ans = "NO";
      break;
    }
  }

  cout <<ans <<endl;

}


Measured memory_bytes: 512
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int n,m,p,X,Y,Z,res,b[9][9][9];
int dx[] = {1,0,0,1,1,0,-1,-1, 0,1, 1, 1,-1};
int dy[] = {0,1,0,1,0,1, 1, 0,-1,1, 1,-1, 1};
int dz[] = {0,0,1,0,1,1, 0, 1, 1,1,-1, 1, 1};

int check(int col){
  rep(i,n)rep(j,n)rep(k,n){
    if(b[i][j][k]==col){
      rep(t,13){
	int c=0,tx=i,ty=j,tz=k;
	while(c<m && 0<=tx && tx<n && 0<=ty && ty<n && 0<=tz && tz<n){
	  if(b[tx][ty][tz] == b[i][j][k])c++;
	  else break;
	  tx += dx[t]; ty += dy[t]; tz += dz[t];
	}
	if(c==m)return b[i][j][k];
      }
    }
  }
  return -1;
}

int main(){
  while(cin >> n >> m >> p,n+m+p){
    rep(i,n)rep(j,n)rep(k,n)b[i][j][k] = -1;

    bool f = true;
    rep(i,p){
      cin >> X >> Y;
      if(f){
	X--; Y--;Z=0;
	while(b[X][Y][Z]>=0)Z++;
	b[X][Y][Z] = i&1;
	
	res = check(i&1);
	if(res==0){
	  cout << "Black " << i+1 << endl;
	  f = false;
	}else if(res==1){
	  cout << "White " << i+1 << endl;
	  f = false;
	}
      }
    }
    if(f)cout << "Draw\n";
  }
}

Measured memory_bytes: 1164
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>

using namespace std;

using ll = long long;
using ld = long double;

#ifdef EBUG
#define debug(x) cout << "\033[31m" << #x << ": " << x << "\033[0m\n";
#else
#define debug(x)
#endif

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

ld pi = 3.141592653589793238;
ld a, b, h, m, ax, bx, ay, by;

int main() {
  cin >> a >> b >> h >> m;
  ax = cos(2.0 * pi * ((h * 60 + m) / 720)) * a;
  ay = sin(2.0 * pi * ((h * 60 + m) / 720)) * a;
  debug(ax);
  debug(ay);
  bx = cos(2.0 * pi * (m / 60.0)) * b;
  by = sin(2.0 * pi * (m / 60.0)) * b;
  debug(bx);
  debug(by);
  cout << std::fixed << std::setprecision(15) << sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by)) << endl;
}

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

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  
  if (a == b && b == c) {
    cout << 1 << endl;
  } else if (a != b && a != c && b != c) {
    cout << 3 << endl;
  } else {
    cout << 2 << endl;
  }
  return 0;
}
    


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

#define ll  long long
#define ull unsigned ll
#define LD long double

#define MP make_pair
#define BS binary_search
#define GCD __gcd
#define pb push_back
#define pp pop_back
#define ff first
#define ss second

#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define sz(a) (int)a.size()
const int MAX = 2e5+25;
ll Arr[MAX];
ll Dp[MAX];
int main(){

    int N;
    cin >> N;
    for(int i=1;i<=N;i++){
        cin >> Arr[i];
        Dp[i] = Dp[i-1]+Arr[i];
    }
    ll Min = INT_MAX;
    for(int i=1;i<=N-1;i++){
        //cout << Dp[N]-Dp[i] << " " <<  Dp[i] << endl;
        ll Min2 = abs((Dp[N]-Dp[i])-Dp[i]);
        Min = min(Min,Min2);
    }
    cout << Min << endl;
	return 0;
}


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();

		if((a+b)%3==0 || a%3==0 || b%3==0) {
			System.out.println("Possible");
		}else {
			System.out.println("Impossible");
		}

	}
}




Measured memory_bytes: 21204
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>
 
#define lint long long
#define VI vector<int>
#define VL vector<lint>
#define VB vector<bool>
#define VC vector<char>
#define VS vector<string>
#define VVI vector<VI>
#define VVL vector<VL>
#define rep(i, n) for(int i = 0 ; i < n ; i++)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

int main(){
    int w, h, n;
    cin >> w >> h >> n;
    int x0 = 0, y0 = 0, xw = w, yh = h;
    rep(i, n){
        int x, y, a;
        cin >> x >> y >> a;
        if(a == 1){
            x0 = max(x0, x);
        }else if(a == 2){
            xw = min(xw, x);
        }else if(a == 3){
            y0 = max(y0, y);
        }else{
            yh = min(yh, y);
        }
    }
    if((yh-y0) > 0 && (xw - x0) > 0){
        cout << (yh-y0) * (xw-x0) << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}

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

using namespace std;

int main() {
	long n, w;
	cin >> n >> w;

	vector<long long> prev(w+1, 0), ans(w+1, 0);
	
	while(n--) {
		long long weight, val;
		cin >> weight >> val;
		
		for (int i = 1; i <= w; i++) {
			if (i >= weight) {
				ans[i] = max(prev[i], prev[i-weight] + val);
			}
		}
		prev = ans;
	}
	cout << prev[w] << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int L = A + B;
  int R = C + D;
  if(L < R){
    cout << "Right" << endl;
  }
  else if(R < L){
    cout << "Left" << endl;
  }
  else{
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for(int i = 0; i < n; i++)
#define int long long

int32_t main() {
ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
        int r; cin >> r;
        cout << r * r;
return 0;
}


Measured memory_bytes: 256