akhauriyash/Code-Regression huggingface dataset:
#![allow(unused_imports, unused_variables, dead_code)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

trait InputValue {
    fn parse(s: &str) -> Self;
}

fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn error_function(a: &Vec<u8>) -> Vec<usize> {
    let n = a.len();
    let mut err: Vec<usize> = vec![0; n+1];
    err[0] = n + 10;

    for i in 2..n+1 {
        let mut now = err[i-1];
        while now > 0 && a[i-1] != a[now] {
            now = err[now];
        }
        if a[i-1] == a[now] {
            err[i] = now + 1;
        } else {
            err[i] = 0;
        }
    }
    err
}

fn main() {
    let a: String = read();
    let a = a.into_bytes();

    let n = a.len();
    let prefix = error_function(&a);

    let mut ra = a;
    ra.reverse();

    let suffix = error_function(&ra);

    let cycle = if n % (n - prefix[n]) == 0 { n - prefix[n] } else { n };
    if cycle == n {
        println!("{}\n{}", 1, 1);
    } else if cycle == 1 {
        println!("{}\n{}", n, 1);
    } else {
        let mut cnt = n - 1;
        for pre in 1..n {
            let suf = n - pre;
            if (pre >= 2 && prefix[pre] >= 1 && pre % (pre - prefix[pre]) == 0) || (suf >= 2 && suffix[suf] >= 1 && suf % (suf - suffix[suf]) == 0) {
                cnt -= 1;
            }
        }
        println!("{}\n{}", 2, cnt);
    }
}

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

std::vector<int> v;
int main() {
	int N;
	int alice, bob;
	alice = bob = 0;
	std::cin >> N;
	for (int i = 0; i < N; i++) {
		int input;
		std::cin >> input;
		v.push_back(input);
	}
	std::sort(v.begin(), v.end(), std::greater<int>());

	for (int i = 0; i < v.size(); i++) {
		if (i % 2 == 0) alice += v[i];
		else bob += v[i];
	}

	std::cout << alice - bob << std::endl;
	return 0;
}


Measured memory_bytes: 256
from functools import lru_cache as cache

@cache(maxsize=None)
def t(n):
    return 1 if n == 0 else t(n - 1) * 2 + 3

@cache(maxsize=None)
def p(n):
    return 1 if n == 0 else p(n - 1) * 2 + 1

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

def f(N, X):
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + t(N - 1):
        return f(N - 1, X - 1)
    else:
        return p(N - 1) + 1 + f(N - 1, X - 2 - t(N - 1))

print(f(N, X))


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


template<int M>
class ModInt {
    int val;

public:
//    constexpr MonInt() : val(0) {}
    constexpr ModInt(long long v) : val(v % M < 0 ? v + M : v) {}

    constexpr explicit operator int() const { return val; }
    constexpr ModInt &operator+=(const ModInt &rhs) {
        if ((val += rhs.val) >= M) val -= M;
        return *this;
    }
    constexpr ModInt &operator-=(const ModInt &rhs) {
        if ((val += M - rhs.val) >= M) val -= M;
        return *this;
    }
    constexpr ModInt &operator*=(const ModInt &rhs) {
        val = (int)(1LL * val * rhs.val % M);
        return *this;
    }
    constexpr ModInt &operator/=(const ModInt &rhs) {
        *this *= rhs.inverse();
        return *this;
    }

    friend constexpr ModInt operator+(ModInt lhs, const ModInt &rhs) { return lhs += rhs; }
    friend constexpr ModInt operator-(ModInt lhs, const ModInt &rhs) { return lhs -= rhs; }
    friend constexpr ModInt operator*(ModInt lhs, const ModInt &rhs) { return lhs *= rhs; }
    friend constexpr ModInt operator/(ModInt lhs, const ModInt &rhs) { return lhs /= rhs; }

    constexpr bool operator==(const ModInt &rhs) const { return val == rhs.val; }
    constexpr bool operator!=(const ModInt &rhs) const { return val != rhs.val; }

    constexpr ModInt inverse() const{
        int a = val, b = M, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return ModInt(u);
    }

    constexpr ModInt pow(long long e) const {
        long long a = 1, p = val;
        while (e > 0) {
            if (e & 1) { a = (a * p) % M; e--;}
            else { p = (p * p) % M; e >>= 1;}
        }
        return ModInt(a);
    }

    friend std::ostream &operator<<(std::ostream &os, const ModInt &v) { return os << v.val; }
    friend std::istream &operator>>(std::istream &is, ModInt &v) {
        int x;
        is >> x;
        v = ModInt(x);
        return is;
    }
};


#define int long long
const int INF = 1LL<<60;
const int MOD = 998244353;
using modint = ModInt<MOD>;

signed main() {
    int n;
    cin >> n;
    vector<int> d(n, 0);
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        d[x]++;
        if ((i == 0 && x != 0) || (i != 0 && x == 0)) {
            cout << 0 << "\n";
            return 0;
        }
    }
    modint ans(1);
    for (int i = 1; i < n; i++) {
        ans *= modint(d[i - 1]).pow(d[i]);
    }
    cout << ans << "\n";
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define INTXT std::ifstream in ("input.txt"); std::cin.rdbuf(in.rdbuf());
#define INF 1e9

using namespace std;
typedef long long ll;
static const ll MOD = 1000000007LL;

signed main() {
  IOS
  // INTXT
  ll l, r;
  cin >> l >> r;

  if (r - l >= 2019 || r % 2019 < l % 2019){
    cout << 0 << endl; 
    return 0;
  }
  
  vector<int> candidate;
  FOR(i, l % 2019, r % 2019 + 1){
    candidate.push_back(i);
  }

  int min_val = 2020;
  REP(i, candidate.size()){
    FOR(j, i + 1, candidate.size()){
      min_val = min(min_val, (candidate.at(i) * candidate.at(j)) % 2019);
    }  
  }
  cout << min_val << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <string>
#include <vector>
#include <algorithm>
#include <random>

intmax_t ppow(intmax_t base, intmax_t iexp) {
  intmax_t res=1;
  for (intmax_t dbl=base; iexp; iexp>>=1) {
    if (iexp & 1)
      res *= dbl;

    dbl *= dbl;
  }
  return res;
}

intmax_t apply(intmax_t lhs, char op, intmax_t rhs) {
  switch (op) {
    case '+': return lhs + rhs;
    case '-': return lhs - rhs;
    case '*': return lhs * rhs;
    case '^': return ppow(lhs, rhs);
    default: assert(false);
  }
}

intmax_t fourt(
    const std::string &s, size_t &i, const std::vector<intmax_t> &vars,
    const std::vector<std::string> &ops={"+-", "*", "^", ""},
    size_t prec=0) {

  /* tsurai parser */
  if (ops[prec].empty()) {
    if (s[i] == '(') {
      intmax_t tmp=fourt(s, ++i, vars, ops, 0);
      assert(s[i] == ')');
      ++i;
      return tmp;
    }
    if (isalpha(s[i])) {
      // we assume only one-character variables
      return vars[s[i++]-'a'];
    }
    intmax_t res=0;
    while (s[i] >= '0' && s[i] <= '9')
      res = res*10 + s[i++]-'0';
    return res;
  }

  intmax_t res=fourt(s, i, vars, ops, prec+1);
  while (i < s.length()) {
    char op=s[i];
    if (!std::count(ops[prec].begin(), ops[prec].end(), op))
      break;
    intmax_t tmp=fourt(s, ++i, vars, ops, prec+1);
    res = apply(res, op, tmp);
  }
  return res;
}

intmax_t parse(const std::string &s, const std::vector<intmax_t> &vars) {
  size_t i=0;
  return fourt(s, i, vars);
}

std::string normalize(const std::string &s) {
  // explicit `*' signs and no spaces
  std::string res;
  enum {
    NONE, PAREN, FACTOR, OPERATOR
  } last=NONE;
  for (size_t i=0; i<s.length(); ++i) {
    if (s[i] == '(') {
      if (last == FACTOR) {
        res += '*';
      }
      res += '(';
      last = PAREN;
    } else if (s[i] == ')') {
      res += ')';
      last = FACTOR;
    } else if (isalnum(s[i])) {
      if (last == FACTOR) {
        res += '*';
      }
      res += s[i];
      if (isdigit(s[i])) {
        while (i+1 < s.length() && isdigit(s[i+1]))
          res += s[++i];
      }
      last = FACTOR;
    } else if (!isspace(s[i])) {
      res += s[i];
      last = OPERATOR;
    }
  }
  // fprintf(stderr, "#< %s\n", res.c_str());
  return res;
}

std::mt19937 rsk(0315);
int testcase_ends() {
  char buf[96];
  fgets(buf, sizeof buf, stdin);
  std::string s=buf;
  if (s == ".\n")
    return 1;

  s = normalize(s);
  while (true) {
    fgets(buf, sizeof buf, stdin);
    std::string t=buf;
    if (t == ".\n") {
      printf(".\n");
      return 0;
    }

    t = normalize(t);
    bool yes=true;
    for (int i=0; i<810; ++i) {
      std::vector<intmax_t> vars(26);
      for (int j=0; j<26; ++j)
        vars[j] = rsk() % 100;
      
      if (parse(s, vars) != parse(t, vars))
        yes = false;
    }

    printf("%s\n", yes? "yes":"no");
  }
}

int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 2584
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <istream>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <climits>
using namespace std;

typedef ostringstream OSS;
typedef istringstream ISS;

typedef vector<int> VI;
typedef vector< VI > VVI;

typedef long long LL;

typedef pair<int, int> PII;
typedef vector<PII> VPII;

#define X first
#define Y second

const string MCXI_STR("mcxi");
const VI MCXI_NUM({1000, 100, 10, 1});

int decode(string s) {
	int res = 0;
	
	for (int i = 0; i < (int)s.size(); i++) {
		if (isalpha(s[i])) {
			res += MCXI_NUM[MCXI_STR.find(s[i])];
		} else {
			res += MCXI_NUM[MCXI_STR.find(s[i + 1])] * (s[i] - '0');
			i++;
		}
	}

	return res;
}

string encode(int n) {
	string res;

	for (int i = 0; i < (int)MCXI_NUM.size(); i++) {
		int k = n / MCXI_NUM[i];

		if (k > 1) {
			res += k + '0';
		}
		if (k) {
			res += MCXI_STR[i];
		}

		n %= MCXI_NUM[i];
	}

	return res;
}

int main(void) {
	int N;
	cin >> N;

	for (int i = 0; i < N; i++) {
		string s1, s2;
		int n1, n2;
		
		cin >> s1 >> s2;

		n1 = decode(s1);
		n2 = decode(s2);

		cout << encode(n1 + n2) << endl;
	}

	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

int main() {
    string s;
    int cnt = 0;
    while(cin >> s) {
        string t = s;
        reverse(t.begin(), t.end());
        if (s == t) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
      x = (int) (1LL * x * p.x % mod);
      return *this;
  }

  ModInt &operator/=(const ModInt &p) {
      *this *= p.inverse();
      return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
      int a = x, b = mod, u = 1, v = 0, t;
      while(b > 0) {
          t = a / b;
          swap(a -= t * b, b);
          swap(u -= t * v, v);
      }
      return ModInt(u);
  }

  ModInt pow(int64_t n) const {
      ModInt ret(1), mul(x);
      while(n > 0) {
          if(n & 1) ret *= mul;
          mul *= mul;
          n >>= 1;
      }
      return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
      return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
      int64_t t;
      is >> t;
      a = ModInt< mod >(t);
      return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< MOD >;

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

    int N, A, B;
    cin >> N >> A >> B;

    modint ans = modint(2).pow(N) - 1;

    auto Combination = [](int n, int r) {
        modint chil(1), mom(1);
        modint cur(n);
        REP(i, r) {
            chil *= cur;
            cur -= modint(1);
        }
        cur = modint(1);
        REP(i, r) {
            mom *= cur;
            cur += modint(1);
        }
        return chil / mom;
    };

    ans -= Combination(N, A);
    ans -= Combination(N, B);

    cout << ans << endl;

    return 0;
}


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

int main() {

  int N;
  cin >> N;

  vector<int> h(N);
  int mx = 0;
  for(int i = 0; i < N; i++) {
    cin >> h[i];
    mx = max(mx, h[i]);
  }

  int answer = 0;
 
  for(int i = 1; i <= mx; i++) {

    bool flg = false;
    
    for (int j = 0; j < N; j++) {
    
      if (i <= h[j]) {
        if (!flg) {
          flg = true;
          answer++; 
        }
      } else {
        flg = false;
      }

    }

  }

  cout << answer << endl;

  return 0;

}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int n, k, x, y, res;
    scanf("%d%d%d%d", &n, &k, &x, &y);
    if (n - k >= 0)
    {
        res = x * k;
        res += (n - k) * y;
    }
    else
        res = n * x;
    printf("%d\n", res);
    return 0;
}

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

bool kaibun(string s) {
  int length = s.length();
  for(int i=0;i<length/2;i++) {
    if (s[i] != s[length-i-1]) return false;
  }
  return true;
}

int main() {
  string s;
  cin >> s;
  
  int n = s.length();
  int end_1 = (n-1)/2;
  int start_2 = (n+3)/2;
  
  bool zen = kaibun(s);
  
  string start = "";
  for(int i=0;i<end_1;i++) start += s[i];
  bool start_res = kaibun(start);
  
  string end = "";
  for(int i=start_2-1;i<n;i++) end += s[i];
  bool end_res = kaibun(end);
  
  string ans;
  if (zen && start_res && end_res) {
    ans = "Yes";
  } else {
    ans = "No";
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
int i,j,k,n,m;
string s;

int main() {
  int x,y,z;cin >> x >> y >> z;
  int out = x / (y+z);
  if (x % (y + z) < z) --out;
  cout << out << endl; 
  return 0;
}


Measured memory_bytes: 256
void main() {
  problem();
}

void problem() {
  auto R = scan!int;

  void solve() {
    real ans = cast(real)R * PI * 2f;
    writefln("%.10f", ans);
  }

  solve();
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

// -----------------------------------------------


Measured memory_bytes: 2988
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<climits>
using namespace std;

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

	int ret = INT_MAX;
	for(int i=0; i<=S.size()-3; i++){
		int n = stoi(S.substr(i, 3));
		ret = min(ret, abs(n - 753));
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
open Printf
let rec f x y =
  if x = 9 && y = 9 then printf "%dx%d=%d\n" x y (x*y)
  else if y = 9 then
    begin printf "%dx%d=%d\n" x y (x*y); f (x+1) 1 end
  else
    begin printf "%dx%d=%d\n" x y (x*y); f x (y+1) end;;
f 1 1


Measured memory_bytes: 2244
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

long long inf = 1000000007;

int n, x;
int l[105];

int main(){
  cin >> n >> x;
  int cnt = 1;
  int tmp = 0;
  for(int i = 0; i < n; ++i){
    cin >> l[i];
    tmp += l[i];
    if(tmp <= x){
      cnt++;
    }else{
      break;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
import re                                                                                                        
import copy                                                                                                      

n,a,b,c,d=map(int,input().split())                                                                               
s=input()                                                                                                        
a-=1                                                                                                             
b-=1                                                                                                             
c-=1                                                                                                             
d-=1                                                                                                             

if "##" in s[a:c+1] or "##" in s[b:d+1]:                                                                                 
    print("No")                                                                                                  
else:                                                                                                            
    if c<d:                                                                                                      
        print("Yes")                                                                                             
    else:                                                                                                        
        if "..." in s[b-1:d+2]:                                                                                  
            print("Yes")                                                                                         
        else:                                                                                                    
            print("No")                                                                                         
            

Measured memory_bytes: 4212
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

using State = string::const_iterator;

int factor(State& begin);

void consume(State &begin, char expected){
	if(*begin==expected)begin++;
	else{
		cerr << "expected '" << expected << "' but got '" << *begin << "'" << endl;
		cerr << "Rest string is'";
		while(*begin)cerr << *begin++;
		cerr << "'" << endl;
		exit(0);
	}
}


int reverse(int a){
	if(a==2)return 0;
	else if(a==0)return 2;
	else return 1;
}

int number(State& begin){
	int ret = (int)(*begin - '0');
	begin++;
	return ret;
}

int expression(State& begin){
	int ret = factor(begin);
	return ret;
}

int term(State& begin){
	int ret = factor(begin);
	for(;;){
		if(*begin == '+'){
			begin++;
			int ret2 = factor(begin);
			ret = max(ret,ret2);
		}else if(*begin == '*'){
			begin++;
			int ret2 = factor(begin);
			ret = min(ret,ret2);
		}else break;
	}
	return ret;
}

int factor(State& begin){
	int ret;
	if(*begin == '-'){
		begin++;
		ret = expression(begin);
		return reverse(ret);
	}else if(*begin == '('){
		consume(begin,'(');
		ret = term(begin);
		consume(begin,')');
		return ret;
	}else{
		return number(begin);
	}
}



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	string s;
	while(cin>>s,s[0]!='.'){
		int ct = 0;
		REP(P,3){
			REP(Q,3){
				REP(R,3){
					string tmps = s;
					replace(tmps.begin(),tmps.end(),'P',(char)('0' + P));
					replace(tmps.begin(),tmps.end(),'Q',(char)('0' + Q));
					replace(tmps.begin(),tmps.end(),'R',(char)('0' + R));
					State start = tmps.begin();
					if(expression(start) == 2)ct++;
				}
			}
		}
		cout << ct << endl;
	}
  return 0;
}

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

int main() {
  int h,w;
  cin >> h >> w;
  vector<vector<int>> wall(h, vector<int>(w));
  vector<vector<int>> dp(10, vector<int>(10));
  
  for(int i=0; i<=9; i++){
    for(int j=0; j<=9; j++){
      cin >> dp[i][j];
    }
  }
  
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      cin >> wall[i][j];
    }
  }
  
  for(int k=0; k<10; k++){
    for(int i=0; i<10; i++){
      for(int j=0; j<10; j++){
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
      }
    }
  }
  
  vector<int> route(10);
  for(int i=0; i<10; i++){
    route[i] = dp[i][1];
  }
  
  int sum = 0;
  
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      int value = wall[i][j];
      if(value != -1){
        sum += route[value];
      }
    }
  }
  
  
  
  cout << sum << endl;

}


Measured memory_bytes: 384
#include "bits/stdc++.h"
#define rep(i,a,n) for(int (i) = (a);(i) < (n);(i)++)

typedef long long ll;
using namespace std;

int main(){
    int h,r;
    cin >> h >> r;
    if(h+r > 0){
        cout << 1 << endl;
    }
    else if(h+r == 0){
        cout << 0 << endl;
    }
    else{
        cout << -1 << endl;
    }
}


Measured memory_bytes: 3136
#include <stdio.h>

long long int absyai(long long int a){
    if(a<0)return -a;
    return a;
}

int main(void){
    int N;
    scanf("%d",&N);
    long long int sum=0;
    long long int a[N];
    long long int ans=1145148931919810;//秒で分かったゾ～
    for(int i=0;i<N;i++){
        scanf("%lld",&a[i]);
        sum+=a[i];
    }
    long long int A=0;
    for(int i=0;i<N-1;i++){
        A+=a[i];
        if(absyai(sum-2*A)<ans)ans=absyai(sum-2*A);
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 1664
#pragma GCC optimize("O3")

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <assert.h>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <random>
#include <cmath>
#include <chrono>
#include <bitset>

#define ld long double
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;

const int INF = 2e18;
const int MOD = 1e9 + 7;
const int MB = 20;

void solve() {
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	s[k - 1] -= ('A' - 'a');
	cout << s;
}
signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout.precision(12);
	solve();
}

Measured memory_bytes: 892
#include<iostream>
#include<string>
#include<map>
using namespace std;

int main(){
    int n;
    cin >> n;
    map<string, int> s;
    for(int i=0; i<n; i++){
        string tmp;
        cin >> tmp;
        s[tmp]++;
    }
    cout << "AC x " << s["AC"] << endl;
    cout << "WA x " << s["WA"] << endl;
    cout << "TLE x " << s["TLE"] << endl;
    cout << "RE x " << s["RE"] << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N, K;
	cin >> N >> K;

	vector<Int> a(N);
	for (Int i = 0; i < N; i++) {
		cin >> a[i];
	}

	vector<pair<mint, mint>> count(N, pair<mint, mint>());

	Int before;
	Int after;
	for (Int i = 0; i < N; i++) {
		before = 0;
		after = 0;
		for (Int j = 0; j < N; j++) {
			if (i == j) continue;
			if ((j < i) && (a[i] > a[j]))before+=1;
			if ((j > i) && (a[i] > a[j]))after+=1;
		}
		count[i].first = before;
		count[i].second = after;
	}

	mint ans = 0;
	for (Int i = 0; i < N; i++) {
		ans += count[i].second * K + (count[i].second + count[i].first) * K * (K - 1) / 2;
	}

	cout << ans << endl;
}

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

p = [float("INF")] * n
check = [""]*n
for i in range(n):
    for j in range(m):
        if abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]) < p[i]:
            p[i] = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
            check[i] = j+1
for s in check: print(s)

Measured memory_bytes: 3188
import java.util.Scanner;

class Main {
	public static void main (String[] args) {
		Scanner scan = new Scanner(System.in);
		while (true) {
			int H = scan.nextInt();
			int W = scan.nextInt();

			if ( H == 0 && W == 0) {
				break;
			}
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					if (i == 0 || i == H-1) {
						System.out.print("#");
						if (j == W-1) System.out.println();
					} else if (i != 0 || i !=H-1) {
						if (j == 0 || j == W-1) {
							System.out.print("#");
						}else {
							System.out.print(".");
						}

						if (j == W-1) {
							System.out.println();
						}
					}
				}
			}
			System.out.println();
		}
		}
	}


Measured memory_bytes: 37000
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

ll factorial(ll n) {
  ll answer = 1;
  while (n > 1) {
    answer *= n;
    answer %= mod;
    n--;
  }
  return answer;
}

ll combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

ll permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int n;
  cin >> n;
  int numbers[] = {1, 2, 4, 8, 16, 32, 64};
  REP(i, 7) {
    if (numbers[i] > n) {
      cout << numbers[i - 1] << endl;
      return 0;
    }
  }
  cout << 64 << endl;
  return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn._
import java.lang.Math._
object Main {
  def main(args: Array[String]): Unit = {
    val NK = readLine.split("\\s+").toSeq.map{_.toInt}
    val N = NK(0)
    val K = NK(1)
    val x = readLine.split("\\s+").toSeq.map{_.toInt}
    val xs = for(i <- 0 to N - 1) yield x(i)
    val lb = scala.collection.mutable.ListBuffer[Int]()
    for(st <- 0 to N - K){
      if(xs(st) >= 0) lb += xs(st + K - 1)
      else if(xs(st + K - 1) > 0){
        lb += abs(xs(st))*2 + xs(st + K - 1)
        lb += xs(st + K - 1)*2 + abs(xs(st))
      }else lb += abs(xs(st))
    }
    println(lb.min.toString)
  }
}


Measured memory_bytes: 50996
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        Set<Integer> set = new HashSet<>();
        
        set.add(sc.nextInt());
        set.add(sc.nextInt());
        set.add(sc.nextInt());
        
        if(set.size() == 2){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21844
import java.util.*;
public class Main {
		
	public static void main(String[] args) {
		Scanner in=new Scanner (System.in);
		int []a=new int[3];
		int c=3;
		for (int i = 0; i < a.length; i++) {
			a[i]=in.nextInt();
		}
		Arrays.sort(a);
		for (int i = 1; i < a.length; i++) {
			if(a[i]==a[i-1]) {
				c--;
			}
		}
		System.out.println(c);
	}
}

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

#define Bye return 0
#define ll long long

void solve(){
    ll n; cin>>n;

    ll t[n+1];
    for (ll i=1; i<=n; i++) cin>>t[i];

    ll m; cin>>m;
    ll p[m+1], x[m+1];
    for (ll i=1; i<=m; i++) cin>>p[i]>>x[i];

    for (ll i=1; i<=m; i++){
        ll sum = 0;
        for (ll j = 1; j<=n; j++){
            if(p[i] == j)
                sum += x[i];
            else sum += t[j];
        }
        cout<<sum<<endl;
    }

}

int main()
{
    solve();
    Bye;
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
#define INF 1e9
typedef long long ll;

int main(void){
  string S,T;cin >> S >> T;
  int i,j,N=S.length();
  bool isMatch = false;
  REP(i,N){
    REP(j,N){
      if(S[(i+j)%N] != T[j]) break;
      if(j==N-1) isMatch=true;
    }
  }
  if(isMatch)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define reg register
#define ll long long
using namespace std;
const int MAXN = 1e5 + 10;
int n, d[MAXN];
void work() {
  scanf("%d", &n);
  for(reg int i = 1; i <= n; ++i) scanf("%d", &d[i]);
  sort(d + 1, d + n + 1);
  printf("%d\n", d[n / 2 + 1] - d[n / 2]);
}
int main() {
  int _ = 1;
  // scanf("%d", &_);
  while(_--) work();
  return 0;
}


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

using namespace std;

#define ll long long int

int main(){

    ll h,n;
    cin >> h >> n;

    vector<ll> a;
    ll a1,i;

    for(i=0;i<n;i++){
        cin >> a1;
        a.push_back(a1);
    }

    ll sum = 0;

    for(i=0;i<n;i++){
        sum = sum + a[i];
    }

    if(sum>=h){
        cout << "Yes";
    }
    else{
        cout << "No";
    }

}


Measured memory_bytes: 1400
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<functional>
#define rep(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
using namespace std;

#define MAX_V 900
#define E 900
#define INF 10000
int h,w,V;
#define pos(_h,_w) ((_h)*w)+(_w) 
struct edge{int to,cost;};
vector<edge> G[MAX_V];
int d[MAX_V];
typedef pair<int,int>P;

void dk(int s){
	priority_queue<P,vector<P>,greater<P> >que;
	fill(d,d+V,INF);
	d[s]=0;que.push(P(0,s));

	while(!que.empty()){
		P p=que.top();que.pop();
		int v=p.second;
		if(d[v]<p.first)continue;
		rep(i,0,(int)G[v].size()){
			edge e=G[v][i];
			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(void){
while(true){
	cin>>w>>h;
	V=h*w;
	if(w==0)return(0);
	rep(i,0,2*h-1){
		int now_h=i/2;
	if(!(i&1))
		rep(j,0,w-1){
			edge temp;cin>>temp.cost;
			if(temp.cost>0)continue;
			temp.cost++;
			temp.to=pos(now_h,j+1);
			G[pos(now_h,j)].push_back(temp);
			temp.to=pos(now_h,j);
			G[pos(now_h,j+1)].push_back(temp);
	}else{
		rep(j,0,w){
			edge temp;cin>>temp.cost;
			if(temp.cost>0)continue;
			temp.cost++;
			temp.to=pos(now_h+1,j);
			G[pos(now_h,j)].push_back(temp);
			temp.to=pos(now_h,j);
			G[pos(now_h+1,j)].push_back(temp);
		}

	}	
	
	}
	dk(0);
	if(d[V-1]>=INF)d[V-1]=0;
	else d[V-1]++;
	cout<<d[V-1]<<endl;
		rep(i,0,V)while(!G[i].empty())G[i].pop_back();
}
}

Measured memory_bytes: 1288
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
int IN[200000];
vector<int> G[200000];
bool used[200000];
int T[200000];
vector<int> vs;

int dfs1(int x) {
  if (used[x]) return x;
  used[x] = true;
  return dfs1(IN[x]);
}
int mex1(set<int> &s) {
  int i = 0;
  while (true) {
    if (s.find(i) == s.end()) return i;
    i++;
  }
}
int mex2(set<int> &s) {
  int i = 0;
  int ctr = 0;
  while (true) {
    if (s.find(i) == s.end()) {
      ctr++;
      if (ctr == 2) return i;
    }
    i++;
  }
}

int dfs2(int x, int p) {
  if (T[x] != -1) return T[x];
  set<int> V;
  for (int t : G[x]) {
    if (t == p) continue;
    V.insert(dfs2(t, -1));
  }
  return mex1(V);
}
set<int> dfs2s(int x, int p) {
  set<int> V;
  for (int t : G[x]) {
    if (t == p) continue;
    V.insert(dfs2(t, -1));
  }
  return V;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  rep(i, N) {
    int p;
    cin >> p;
    p--;
    G[p].pb(i);
    IN[i] = p;
  }
  int V = dfs1(0);
  int s = V;
  vs.pb(V);
  int ctr = 0;
  while (true) {
    s = IN[s];
    if (s == V) break;
    vs.pb(s);
    ctr++;
    if (ctr>N) return 1;
  }
  assert(IN[vs.back()] == V);

  rep(i, N) T[i] = -1;
  set<int> mp = dfs2s(V, vs.back());
  vector<int> cand;
  cand.pb(mex1(mp));
  cand.pb(mex2(mp));
  for (int w : cand) {
    rep(i, N) T[i] = -1;
    T[V] = w;
    int last = -1;
    for (int x : vs) {
      if (x == V) continue;
      last = dfs2(x, -1);
      T[x] = last;
    }
    set<int> xmp(mp);
    xmp.insert(last);
    if (mex1(xmp) == w) {
      cout << "POSSIBLE\n";
      return 0;
    }
  }
  cout << "IMPOSSIBLE\n";
  return 0;
}


Measured memory_bytes: 12788
N = int(input())
if N % 10 == 2 or N % 10 == 4 or N % 10 == 5 or N % 10 == 7 or N % 10 == 9:
    print("hon")
elif N % 10 == 0 or N % 10 == 1 or N % 10 == 6 or N % 10 ==8:
    print("pon")
else:
    print("bon")

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

vector<vector<int>> v(100010),rev(100010);
int d[100010];

void depth(int p,int u,int dist){
    d[p] = dist;
    for(auto i:v[p]){
        if(i != u){
            depth(i,p,dist+1);
        }
    }
}

int n,k;
int ans = 0;

void dfs(int p,int u,int dist){
    d[p] = dist;
    if(dist == 1) return;
    for(auto i:v[p]){
        if(i != u){
            dfs(i,p,dist-1);
        }
    }
}

void merge(int p,int u,int dist){
    if(dist == 1){
        dfs(p,-1,k);
        ans++;
        return;
    }
    for(auto i:rev[p]){
        if(i != u){
            merge(i,p,dist-1);
        }
    }
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    cin>>n>>k;
    int a[n];
    cin>>a[0];
    a[0]--;
    if(a[0]!=0){
        ans++;
        a[0] = 0;
    }
    for(int i=1;i<n;i++){
        cin>>a[i];
        a[i]--;
        v[a[i]].push_back(i);
        rev[i].push_back(a[i]);
    }
    depth(0,-1,0);
    pair<int,int> p[n];
    for(int i=0;i<n;i++){
        p[i] = make_pair(d[i],i);
    }
    sort(p,p+n,greater<pair<int,int>>());
    for(int i=0;i<n;i++){
        int j = p[i].second;
        if(d[j]>k){
            merge(j,-1,k);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 22144
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    vector<int> a(20001);
    vector<int> b(20001);
    vector<char> op(20001);
    int se = 0;
    for(int i = 0;i < a.size(); i++) {
        int tmp_a,tmp_b;
        char tmp_op;
        cin >> tmp_a >> tmp_op >> tmp_b;
        if(tmp_op == '?') {
            se = i;
            break;
        }
        a[i] = tmp_a;
        b[i] = tmp_b;
        op[i] = tmp_op;
    }

    for(int i = 0; i <= se;i++) {
        int res = 0;
        if(op[i] == '+') {
            cout << a[i] + b[i] << endl;
        } else if(op[i] == '-') {
            cout << a[i] - b[i] << endl;
        } else if(op[i] == '*') {
            cout << a[i] * b[i] << endl;
        } else if(op[i] == '/') {
            cout << a[i] / b[i] << endl;
        }
    }
    return 0;
}


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

int head=300000,tail,q,cnt=0;
char a[600005];

signed main()
{
	string s;
	cin>>s>>q;
	tail=head+s.size()-1;
	
	for (int i=head;i<=tail;i++)  a[i]=s[i-head];
	while (q--)
	{
		int flag,t1;
		cin>>flag;
		
		if (flag==1)  cnt=(cnt+1)%2;
		else if (flag==2)
		{
			char t2;
			cin>>t1>>t2;
			
			if (cnt%2==1)  t1=(t1+1)%2;
			if (t1==1)
			{
				head--;
				a[head]=t2;
			}
			else
			{
				tail++;
				a[tail]=t2;
			}
		}
	}
	if (cnt%2==0)
	{
		for (int i=head;i<=tail;i++)  cout<<a[i];	
	}
	else
	{
		for (int i=tail;i>=head;i--)  cout<<a[i];
	}
	cout<<endl;
	 
	return 0;
}

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

int main(){
    string s;
    cin >> s[0] >> s[1] >> s[2] >> s[3];

    if((s[0]==s[1] && s[1]==s[2]) || (s[1]==s[2] && s[2]==s[3]))
        cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin>>s;
  if(s=="Rainy")
    	cout<<"Sunny\n";
  if(s=="Sunny")
    	cout<<"Cloudy\n";
  if(s=="Cloudy")
    	cout<<"Rainy\n";
}

Measured memory_bytes: 3524
n, m = map(int, input().split())
card = [0 for _ in range(n+2)]

for _ in range(m):
    l, r = map(int, input().split())
    card[l] += 1
    card[r+1] -= 1

#print(card)

for i in range(n+1):
    card[i+1] += card[i]

#print(card)
print(card.count(m))


Measured memory_bytes: 7080
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import pdb
import sys
import fractions
F = sys.stdin

N, M = list(map(int,F.readline().rstrip().split()))
a_list = list(map(int,F.readline().rstrip().split()))

num = 1
while a_list[0] % 2**(num + 1) == 0:
    num += 1
def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)

lcm_before = 1
for a in a_list:
    if (a/(2**num)) % 2 != 1:
        print(0)
        sys.exit()

    lcm_before = lcm(lcm_before, a//2)



ans1 = M // lcm_before
ans = (ans1 + 1) // 2
print(ans)


Measured memory_bytes: 17416
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;



void main() {
    int a, b;
    scan(a, b);
    auto as = repeat(a.to!string, b).joiner.to!string;
    auto bs = repeat(b.to!string, a).joiner.to!string;
    writeln(as < bs ? as : bs);
}
















void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


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

int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int x=h2*60+m2-h1*60-m1-k;
    cout << max(0ll,x);
}

Measured memory_bytes: 3648
#include <stdio.h>

int main(void)
{
	int n,i,j,k,v,a[100];
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	
	for(i=0;i<n;i++){
		v= a[i];
		j=i-1;
		while(j>=0 && a[j]>v){
			a[j+1]=a[j];
			j--;
		}
		a[j+1]=v;	
		
		for(k=0;k<n;k++){
			if(k>0){
				printf(" ");
			}
			
			printf("%d",a[k]);
			
			if(k==n-1){
				printf("\n");
			}
		}
	}
	return 0;
}


Measured memory_bytes: 2036
#include <iostream>
#include <map>
#include <unordered_map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;


long long dp[3005][3005];

int main() {
        int n;
		cin >> n;
	    long long a[3005];
		for (int i = 0; i < n; i++) {
			scanf("%lld", &a[i]);
		}
		for (int i = n - 1; i >= 0; i--) {
			bool OK = false;
			for (int j = i; j < n;j++) {
				if (i == j) {
				    dp[i][j] = a[i];
				}
				else{ 
					dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1]);
				}
			}
		}
        cout << dp[0][n - 1] << endl;
		return 0;
}

Measured memory_bytes: 70016
import sys
import numpy as np
A, B = map(int,input().split())
amin, amax = A / 0.08, (A + 1) / 0.08
bmin, bmax = B / 0.10, (B + 1) / 0.10

if amax <= bmin or bmax <= amin:#解なし：区間重なりなし
    print(-1)
    sys.exit()

ans = np.ceil(max(amin, bmin)).astype(int)

if ans >= amax or ans >= bmax:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 21892
#include <stdio.h>

int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if((a<c && c<b )||(a>c && c>b)){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  //printf("%d %d %d\n",a,b,c);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  int d, t, s;
  float time;
  cin >> d >> t >> s;
  time = (float)d/(float)s;
  if (time <= t){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
}

Measured memory_bytes: 3604
a,b = map(int, input().split())

import math

def f(x):
  if x % 2 == 1:
    if ((x+1) // 2) % 2 == 0:
      return 0
    else:
      return 1
  else:
    if ((x+1) // 2 ) % 2 == 0:
      return x
    else:
      return x ^ 1

ans = f(a-1) ^ f(b)
print(ans)

Measured memory_bytes: 3188
#include<stdio.h>
int main(){
  int M=60001;
  char p[60001]={1,1};
  int i,j;
  for(i=2;i*i<M;i++){
    if(p[i])continue;
    for(j=i*i;j<M;j+=i)p[j]=1;
  }
  int n;
  while(scanf("%d",&n)!=EOF){
    for(i=n-1;p[i];i--);
    printf("%d ",i);
    for(i=n+1;p[i];i++);
    printf("%d\n",i);
  }
  return 0;
}

Measured memory_bytes: 660
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

typedef long long ll;
using namespace std;

int main() {
    int n = 0, m = 0;
    cin >> n >> m;
    cout << (ll)(((n - m) * 100 + m * 1900) * pow(2, m)) << endl;
    return 0;
}


Measured memory_bytes: 256