akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
const lli INF = 1e9 + 100;
const lli INF64 = (1LL << 61) + 100;
const lli MOD = 1e9 + 7;
const lli MH1 = 1599614977, MH2 = 2034417103, MH3 = 1090250123, MH4 = 2024491871; 
const int N = 1e7 + 10;
int sieve[N];
void fillSieve() {
	for(int i = 1; i < N; i++) sieve[i] = 1;
	for(int i = 1; i < N; i++) {
		for(int j = 2*i; j < N; j+=i)
			sieve[j]++;
	}
}
lli bpow(lli baseee, lli exponenttt) {
	if(exponenttt < 0) return 0;
	lli res = 1;
	baseee %= MOD;
	while (exponenttt > 0) {
		if ((exponenttt & 1) == 1) res = (res*baseee) % MOD;
		baseee = (baseee*baseee) % MOD;
		exponenttt >>= 1;
	}
	return res;
}
lli multInverse(lli a) {//if_mod_is_prime
	return bpow(a, MOD - 2);
}
lli divm(lli a, lli b) {//if_mod_is_prime
	return (a * multInverse(b)) % MOD;
}
lli multm(lli a, lli b) {
	return (a * b) % MOD;
}
lli subm(lli a, lli b) {
	a += MOD;
	lli r = a - b;
	if(r >= MOD) return r - MOD;
	return r;
}
lli addm(lli a, lli b) {
	lli r = a + b;
	if(r >= MOD) return r - MOD;
	return r;
}
signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	fillSieve();
	int n;
	cin >> n;
	lli ans = 0;
	for(int k = 1; k <= n; k++)
		ans += k * 1LL * sieve[k];
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 42632
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret; scanf("%d", &ret);
  return ret;
}

template<class T>
class SegmentTree{
  std::vector<T> v;
  int n;
  T initSub(int idx){
    if(idx < n - 1){
      return v[idx] = std::plus<T>()(initSub(idx * 2 + 1), initSub(idx * 2 + 2));
    }else{
      return v[idx];
    }
  }
  int beki(int x){
    x = x - 1;
    x = x | (x >> 1);
    x = x | (x >> 2);
    x = x | (x >> 4);
    x = x | (x >> 8);
    x = x | (x >> 16);
    return x + 1;
  }
public:
  SegmentTree(int nn){
    //binary tree
    n = beki(nn);
    v = std::vector<T>(n + n - 1, 0);
  }
  SegmentTree(const std::vector<T> &vc){
    n = beki(vc.size());
    v = std::vector<T>(n + n - 1, 0);
    for(int i = 0; i < (int)vc.size(); i++){
      v[n - 1 + i] = vc[i];
    }
    initSub(0);
  }
  void update(int idx, int val){
    int pos = n - 1 + idx;
    v[pos] = val;
    while( pos != 0 ){
      pos = (pos - 1) / 2;
      T oldVal = v[pos];
      T newVal = std::plus<T>()(v[pos * 2 + 1], v[pos * 2 + 2]);
      if(oldVal == newVal) break;
      v[pos] = newVal;
    }
  }
  T queryIter(int a, int b, int k, int l, int r){
    if(r <= a || b <= l) return 0;
    if(a <= l && r <= b) return v[k];
    else{
      T v1 = queryIter(a, b, k * 2 + 1, l, (l + r) / 2);
      T v2 = queryIter(a, b, k * 2 + 2, (l + r) / 2, r);
      return std::plus<T>()(v1, v2);
    }
  }
  int query(int a, int b){
    return queryIter(a, b, 0, 0, n);
  }
  int at(int p){
    return v[p + n - 1];
  }
};

int main(){
  int n = getInt();
  int m = getInt();

  vector<int> v(n-1);

  REP(i,n-1) v[i] = getInt();

  SegmentTree<int> st(v);

  int pos = 0;
  int ans = 0;
  REP(i,m){
    int next = pos + getInt();

    //printf("%d => %d: %d\n", pos, next, st.query(min(pos, next), max(pos, next)));
    ans = (ans + st.query(min(pos, next), max(pos, next))) % 100000;

    pos = next;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 0
#面積計算
modelmap = list(input())
S1 = []
S2 = []
A = 0
 
for i, l in enumerate(modelmap):
    if l == "\\":
        S1.append(i)
    elif l == "/" and len(S1) > 0:
        ip = S1.pop()
        A += i - ip
        L = i - ip
        while len(S2) > 0 and S2[-1][0] > ip:
            L += S2.pop()[1]
        S2.append([ip, L])
 
print(A)
text2 = "{}".format(len(S2))
for s in S2:
    text2 += " " + str(s[1])
print(text2)


Measured memory_bytes: 6388
/*　　　　　　　{:i:i:|i:i:/l/l--　 　 　--l/li:i:i|i:i:i:i}
　　　　　　 　 {:rx|:i:i ィi芥ミ 　 　 .ィi芥ミｉ:ｉ|ﾍ:i:i:}
.　　　 　 　 　 ｛ﾏ|ｉ:  {::’:} 　 　 　{:‘::} :ｉ:i:|〉｝:/
　　 　 　 　 　 乂|:i:| ｀¨¨¨¨´ 　 　　｀¨¨¨´  :i:ｉ:|ｼ/
　 　 　 　 　 　 ﾉ:|:i|　　　　　　′　　　 　   |:i:i:|ﾂ
　　　　　　　　/:/|:i:| ､　　　 　_ _ 　　　　  |:i:i:|
　 　 　　 　 /:/ .|:i:|/ ＼　　　 　 　     ｨ〔|:i:/
　　 　 　  　 〈;/ く刈＿ 个 　   -   　＜}　./|/_〉
　　     　　 r-っ'~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ|___
　　 　     /／ニつ　　　　　　 ､　　　　　　　ノﾆﾆ　＼
.　　　     |　　ニ⊃ 　./　/　 ──   /　/　　..⊆ﾆﾆ　　:|
.　　　     |　　丁´　 /|￣|￣  ─‐ /|￣|￣ 　 .￣|丁 　|
.　　　     |　　ﾉ.  　 |￣|￣  ─‐  |￣|￣ 　 　.|八 　|
.　　　     |　　||. 　 |￣|￣ |￣| |￣|￣ 　   .|　|
.　 　 　   |  　||   　￣￣￣　￣ 　￣￣￣　　  .|　|  |
.　 　 　  　    ||＿＿＿＿＿＿＿＿＿＿＿＿______|__　　 ',
　 　      ,′　 | ７ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ}  ,′
.　　     {　　　|/　}ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ{/ 　 　
*///讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐。
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>

using namespace std;

#define rep(a,b) for(int i=int(a);i<int(b);i++)
#define ll long long
#define fst first
#define snd second
#define pf(b) printf("%.12f\n",(double)b)
#define _GLIBCXX_DEBUG
const double pai = 3.1415926535897;
#define _cos(n) cos(n*pai/180)
#define l_b lower_bound
#define u_b upper_bound
#define b_s binary_search

//factorial(練習)　階乗
int fact(int n) {
	int a = 1;
	for (int i = 1;i <= n;i++) a *= i;
	return a;
}
int sa(int n, int m) {      //差！
	if (n < m)return m - n;
	else return n - m;
}
int keta(int num) {
	int n = 0;
	if (num == 0) {
		return 1;
	}
	while (num != 0) {
		num /= 10;
		n++;
	}
	return n;
}

char a;
signed main() {
	cin >> a;
	if (a < 97)cout << "A" << endl;
	else cout << "a" << endl;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll, ll> Pll;
typedef pair<int, Pii > P1;

#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define mp1(a,b,c) P1(a,P(b,c))
#define get_arsize(a) (sizeof(a)/sizeof(a[0]))

const ll MOD = 1000000007;
const double EPS = 1e-10;
const int MAX = 200000;

int main() {
  ll x;
  cin >> x;
  ll k = 0;
  ll sum = 100;
  while(sum < x) {
    sum *= 1.01;
    k++;
  }
  cout << k << endl;
  return 0;
}


Measured memory_bytes: 3624
MAX_N = 44
_memo = [None for _ in range(MAX_N + 1)]
_memo [0] = _memo[1] = 1

def fibonacci(n):
    
    if _memo[n] is not None:
        return _memo[n]
    else:
        _memo[n] = fibonacci(n - 1) + fibonacci(n - 2)
        return _memo[n]

if __name__ == '__main__':
    n = int(input())
    print(fibonacci(n))



Measured memory_bytes: 5600
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>



int main() {
	ll a, b;
	cin >> a >> b;
	if (a <= 5)cout << 0 << endl;
	else if (a <= 12)cout << b / 2 << endl;
	else cout << b << endl;
}

Measured memory_bytes: 256
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
int J = 0, O = 0, I = 0;
void res()
{
	J = 0;
	O = 0;
	I = 0;
}
int main()
{
	string a;
	cin >> a;
	int ans = 0;
	
	for (int i = 0; i < a.size(); i++)
	{
		switch (a[i])
		{
		case'J':
			if (O != 0 || I != 0)
			{
				res();
				J++;
			}
			else
			{
				J++;
			}
			break;
		case'O':
			if (J == 0||I!=0)
			{
				res();
				continue;
			}
			else
			{
				O++;
				if (O > J)
				{
					res();
				}
			}

			break;
		case'I':
			I++;
			if (O < I||J<I)
			{
				res();
			}
			if(I==O)ans = max(ans, I);
			break;
		}
	//	cout << ans << endl;

	}
	cout << ans << endl;

}

Measured memory_bytes: 2052
#include<iostream>
#include<algorithm>

int N;

int count(int n, int b) {
  int res = 0;
  while(n > 0) {
    res += n%b;
    n /= b;
  }
  return res;
}

int main() {
  std::cin >> N;
  int ans = N;
  for(int i = 0; i <= N; i += 9) {
    ans = std::min(ans, count(i/9, 9)+count(N-i, 6));
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
l=list(map(int,input().split()))
l.sort()
ct = 0
j=n-1
a=0
for i in range(n-1):
  if((j==n-1 and ct==1) or (ct==2)):
    j-=1
    ct=0
  a+=l[j]
  ct+=1
print(a)

Measured memory_bytes: 31424
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::iter::*;
#[allow(unused_imports)]
use std::*;

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
#[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

fn main() {
    println!("{}", solve(&stdin!()));
}
struct Book<'a> {
    c: usize,
    u_s: &'a [usize],
}
fn solve(src: &str) -> String {
    input! {
        source = src,
        n:usize,
        m:usize,
        x:usize,
        nums:[[usize;m+1];n],
    }
    let books = nums
        .iter()
        .map(|ns| Book {
            c: ns[0],
            u_s: &ns[1..ns.len()],
        })
        .collect::<Vec<_>>();
    let m_c = r_min(usize::MAX, x, vec![0; m], &books);
    (m_c as isize).to_string()
}

fn r_min(min_c: usize, x: usize, u_s: Vec<usize>, books: &[Book]) -> usize {
    if !books.is_empty() {
        let current_book = &books[0];
        let next_books = &books[1..books.len()];
        let not_read_current = r_min(min_c, x, u_s.clone(), next_books);
        let u_s = u_s
            .iter()
            .enumerate()
            .map(|(i, u)| current_book.u_s[i] + u)
            .collect::<Vec<_>>();
        let min_c = if min_c == usize::MAX { 0 } else { min_c } + current_book.c;
        let read_current = if u_s.iter().all(|&u| u >= x) {
            min_c
        } else {
            r_min(min_c, x, u_s, next_books)
        };

        min(not_read_current, read_current)
    } else if u_s.iter().all(|&u| u >= x) {
        min_c
    } else {
        usize::MAX
    }
}

test! {
    include_str!("c1_in.txt") => "120",
    include_str!("c2_in.txt") => "-1",
    include_str!("c3_in.txt") => "1067",
}


Measured memory_bytes: 2128
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int inf=1e9,mod=1e9+7;
typedef long long ll;
int read() {
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();
	while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}
struct node {
	int x,v;
} a[1000001];
bool cmp(const node & a,const node & b) {
	if(a.v==b.v) return a.x<b.x;
	return a.v<b.v;
}
main() {
	int n=read(),tot=0;
	for(int i=1; i<=n; i++)
		a[i].x=read(),a[i].v=read();
	sort(a+1,a+1+n,cmp);
	for(int i=1; i<=n; i++) {
		if(tot+a[i].x>a[i].v)
			printf("No"),exit(0);
		tot+=a[i].x;
	}
	puts("Yes");
}


Measured memory_bytes: 4352
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	sc.Split(bufio.ScanWords)
	K, X := nextInt(), nextInt()
	if 500*K >= X {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
bool check(vector<int>a){
  if(a[0]!=(int)a.size()) return false;
  rep(i,1,a.size()){
    if(a[i]!=a[i-1]) return false;
  }
  return true;
}
void solve(vector<int>&a ,int n,int k){
  if(check(a) || k<=0) return;
  vector<int> pre(n,0);
  rep(i,0,n){
    pre[max(i-a[i],0)]++;
    if(min(n-1,i+a[i])+1<n) pre[min(n-1,i+a[i])+1]--;
  }
  rep(i,1,n) pre[i]+=pre[i-1];
  rep(i,0,n) a[i]=pre[i];
  k--;
  solve(a,n,k);
}
int main(){
    optimizeIO();
    int n,k;
    cin>>n>>k;
    std::vector<int>a(n);
    rep(i,0,n) cin>>a[i];
    solve(a,n,k);
    rep(i,0,n) cout<<a[i]<<" ";
    cout<<endl;
}


Measured memory_bytes: 36876
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
const int INF = 1000000000;

int dp[1001][10001];
int h, n;
int a[1000], b[1000];

int main(){
  cin >> h >> n;
  rep(i, n){
    cin >> a[i] >> b[i];
  }
  for(int i = 1; i <= h; i++){
    dp[0][i] = INF;
  }
  for(int i = 0; i < n; i++){
    for(int j = 0; j <= h; j++){
      if(j < a[i]) dp[i+1][j] = min(dp[i][j], b[i]);
      else dp[i+1][j] = min(dp[i][j], dp[i+1][j-a[i]] + b[i]);
    }
  }
  /*for(int i = 1; i < n+1; i++){
    rep(j,h+1){
  cout << "dp[" << i <<"]["<<j<<"] = "<<dp[i][j] <<endl;
    }
  }*/
  cout << dp[n][h] <<endl;
}

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

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

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

  // for(int i = 0; i < n; i++) {
  //   cout << a[i] << endl;
  // }

  int cnt = 0;
  while(1){
    for(int i = 0; i < n; i++) {
      if(a[i] % 2 != 0) {
        cout << cnt << endl;
        return 0;
      }
      a[i] = a[i]/2;
    }
    cnt++;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];

    map<int, long long> mp;
    long long sum = 0;

    rep(i,N) {
        if (mp.find(A[i]) == mp.end()) {
            mp[A[i]] = 1;
        } else {
            mp[A[i]] = mp[A[i]] + 1;
        }
    }

    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        long long x = itr->second;
        sum += x * (x - 1) / 2;
    }

    rep(i,N) {
        long long x = mp[A[i]];
        long long ans = (sum - (x * (x - 1) / 2) + ((x - 1) * (x - 2) / 2));
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 11776
#include <stdio.h>

int main(void)
{
	int i, j, k, l;
	int count;
	int n;

	while (scanf("%d", &n) != EOF){
		count = 0;

		for (i = 0; i < 10; i++){
			for (j = 0; j < 10; j++){
				for (k = 0; k < 10; k++){
					for (l = 0; l < 10; l++){
						if ((i + j + k + l) == n){
							count++;
						}
					}
				}
			}
		}
		
		printf("%d\n", count);
	}

	return (0);
}

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

	if(s.at(0)==s.at(1) && s.at(2)==s.at(3) && s.at(0)!=s.at(2))
		cout << "Yes" << endl;
	else if(s.at(0)==s.at(2) && s.at(1)==s.at(3) && s.at(0)!=s.at(1))
		cout << "Yes" << endl;
	else if(s.at(0)==s.at(3) && s.at(1)==s.at(2) && s.at(0)!=s.at(1))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i,n) for(int i=0; i<(int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

int K;

char check(ll n) {
#ifdef LOCAL
  string nstr;
  ll tmp = n;
  while(tmp>0) {
    nstr.push_back('0'+tmp%10);
    tmp/=10;
  }
  reverse(nstr.begin(), nstr.end());
  if ((n > K) ^ (nstr > to_string(K))) {
    return 'N';
  } else {
    return 'Y';
  }
#else
  cout << "? " << n << endl;
  char c; cin >> c;
  return c;
#endif
}

char check(vector<int> vec) {
  ll n = 0;
  for(auto e: vec) {
    n *= 10;
    n += e;
  }
  return check(n);
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  #ifdef LOCAL
  // debug
  cin >> K;
  #endif

  vector<int> ans;
  int ok = 9;
  int ng = 0;
  while(ng+1<ok) {
    ll med = (ok+ng)/2;
    ll nine = med*(1e+9)+999999999;
    char c;
    c = check(nine);
    if (c == 'Y') {
      ok = med;
    } else {
      ng = med;
    }
  }
  ans.push_back(ok);

  while(ans.size() <= 9) {
    ok = 9;
    ng = -1;
    while(ng+1 < ok) {
      int med = (ok+ng)/2;
      vector<int> n;
      for(auto e: ans) {
        n.push_back(e);
      }
      n.push_back(med);
      while(n.size() < 12) {
        n.push_back(9);
      }
      char c;
      c = check(n);
      if (c == 'Y') {
        ok = med;
      } else {
        ng = med;
      }
    }
    ans.push_back(ok);
  }

  // special case: 1000...
  bool flag = true;
  if (ans[0] != 1) flag = false;
  for(int i=1; i<=9; i++) {
    if (ans[i] != 0) {
      flag = false;
    }
  }

  if (flag) {
    int ret = 1e+9;
    while (ret > 1) {
      char c;
      c = check(ret-1);
      if (c == 'N') {
        cout << "! " << ret << endl;
        return 0;
      }
      ret /= 10;
    }
    cout << "! " << ret << endl;
    return 0;
  }
  // special case end

  ll ret = ans[0];
  for(int i=1; i<9; i++) {
    ret *= 10;
    ret += ans[i];
  }

  ll before;
  while(ret > 0) {
    char c;
    c = check((ret-1)*10);
    if (c == 'Y') {
      cout << "! " << before << endl;
      return 0;
    }
    before = ret;
    ret /= 10;
  }
  cout << "! " << before << endl;
  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 100010, LOG=20;

int n, m, k, u, v, x, y, t, a, b;
string s, ans;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>s;
	for (char ch:s){
		if (ch=='T' && ans.size() && ans.back()=='S') ans.pop_back();
		else ans+=ch;
	}
	cout<<ans.size()<<'\n';
	
	return 0;
}


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

using namespace std;

const long long int MOD = 998244353;
const long double EPS = 1e-8;

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


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

	cin >> N >> M >> K >> L >> R;
	vector<long double>ans;
	while (N) {
		L--;
		R--;
		vector<int>v(N);
		for (int i = 0; i < N; i++)cin >> v[i];
		vector<vector<long double>>edge(M, vector<long double>(M, MOD));
		for (int i = 0; i < K; i++) {
			int a, b;
			long double d;
			cin >> a >> b >> d;
			a--;
			b--;
			edge[a][b] = d;
			edge[b][a] = d;
		}
		vector<vector<long double>>dp(1 << N, vector<long double>(M, MOD));
		dp[(1 << N) - 1][L] = 0;
		for (int i = (1 << N) - 1; i > 0; i--) {
			for (int j = 0; j < M; j++) {
				if (dp[i][j] == MOD)continue;
				for (int k = 0; k < M; k++) {
					if (edge[j][k] == MOD)continue;
					for (int l = 0; l < N; l++) {
						if (i&(1 << l)) {
							dp[i - (1 << l)][k] = min(dp[i - (1 << l)][k], dp[i][j] + edge[j][k] / v[l]);
						}
					}
				}
			}
		}
		long double ret = MOD;
		for (int i = 0; i < 1 << N; i++)ret = min(ret, dp[i][R]);
		ans.push_back(ret);
		cin >> N >> M >> K >> L >> R;
	}
	for (auto i : ans) {
		if (i == MOD)cout << "Impossible\n";
		else cout <<setprecision(20)<< i << endl;
	}
	return 0;
}


Measured memory_bytes: 3432
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cassert>
using namespace std;

typedef vector<int> VI;
typedef long long LL;

#define REP(i, n) for (int i=0;i<n;++i)
#define FOR(i, a, b) for (int i=a;i<b;++i)
#define REP_1(i, n) for (int i=1;i<=n;++i)
#define ALL(A) A.begin(), A.end()
#define PB push_back

template<class T> inline bool checkMin(T &a,const T b){return b < a ? a = b, 1 : 0;}
template<class T> inline bool checkMax(T &a,const T b){return a < b ? a = b, 1 : 0;}

/** I/O Accelerator Interface .. **/ //{
#define g (c=getchar())
#define d isdigit(g)
#define p x=x*10+c-'0'
#define n x=x*10+'0'-c
#define pp l/=10,p
#define nn l/=10,n
template<class T> inline T& RD(T &x){
    char c;while(!d);x=c-'0';while(d)p;
    return x;
}
#undef nn
#undef pp
#undef n
#undef p
#undef d
#undef g
inline char* RS(char *s){
    //gets(s);
    scanf("%s", s);
    return s;
}

LL last_ans; int Case; template<class T> inline void OT(const T &x){
    cout << x << endl;
}

//}/* .................................................................................................................................. */

const int N = 109, M = 5040;

int dp[N][M], a[N], d[N]; vector<VI> P; VI p;
int ne[M][8], pos[7], n;

int main(){



    RD(n); REP(i, n) RD(d[i]); REP(i, n) RD(a[i]);
    VI p; REP(i, 7) p.PB(i); do P.PB(p); while(next_permutation(ALL(p)));

    REP(i, M) REP(j, 8){
        p = P[i]; REP(i, 7) if (p[i] >= j) ++p[i];
        FOR(i, 1, 7) if (p[i] >= p[0]) --p[i]; p.erase(p.begin());
        ne[i][j] = lower_bound(ALL(P), p) - P.begin();
    }

    REP(i, n) REP(j, M){
        int u = dp[i][j]; REP(k, 7) pos[P[j][k]] = k;
        FOR(k, 1, 8) if(i-k >= 0 && k<=d[i]) u += a[i];
#define v  dp[i + 1][ne[j][k]]
        int k; for (k=0;k<7;++k){
            checkMax(v, u); int dd = 7-pos[k];
            if(i-dd >= 0 && dd <= d[i]) u -= a[i];
            if(i-dd >= 0 && dd <= d[i-dd]) u += a[i-dd];
        }
        checkMax(v, u);
    }

    int ans = 0; REP(j, M) checkMax(ans, dp[n][j]);
    OT(ans);
}

Measured memory_bytes: 3788
#include<stdio.h>
#include<string.h>
int main()
{
    int N,i,x;
    scanf("%d\n",&N);
    char s[N];
    gets(s);
    x=0;
    for(i=0;i<N;i++){
        if(s[i]!=s[i+1]){
            x++;
        }
    }
    printf("%d\n",x);
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict
from heapq import heapify,heappush,heappop
readline=sys.stdin.readline

def main():
    N,M,R=map(int,readline().split())
    r=list(map(int,readline().split()))
    ew=[tuple(map(int,readline().split())) for _ in range(M)]
    edges=defaultdict(list)
    wt=defaultdict(int)
    for e in ew:
        edges[e[0]].append(e[1])
        edges[e[1]].append(e[0])
        wt[(e[0],e[1])]=e[2]
        wt[(e[1],e[0])]=e[2]
    inf=float('inf')
    def dijkstra(v):
        dist=[inf]*(N+1)
        dist[v]=0
        vw=[(0,v)]
        heapify(vw)
        while vw:
            cvw=heappop(vw)
            if cvw[0]>dist[cvw[1]]:
                continue
            for w in edges[cvw[1]]:
                cand=cvw[0]+wt[(cvw[1],w)]
                if dist[w]>cand:
                    dist[w]=cand
                    heappush(vw,(cand,w))
        return dist
    distdict=dict((v,dijkstra(v)) for v in r)
    mindist=inf
    def permlist(lst):
        tmp=[]
        if not lst:
            return [[]]
        for i,x in enumerate(lst):
            lstx=lst[:i]+lst[i+1:]
            ret=permlist(lstx)
            for e in ret:
                e.append(x)
            tmp.extend(ret)
        return tmp
    #print(distdict,permlist(r))
    pathlist=[sum([distdict[v][w] for v,w in zip(lst,lst[1:])]) for lst in permlist(r)]
    print(min(pathlist))

if __name__=='__main__':
    main()


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

int main(){
  long long X, K, D;
  cin >> X >> K >> D;
  if(X<0) X = -X;
  long long ans = 0;
  long long r = X % D;
  long long a = (X-r) / D;
  if(K-a<=0){
    ans = X - K*D;
  }else if((K-a)%2==0){
    ans = r;
  }else{
    ans = D - r;
  }
  cout << ans;
  return 0;
}


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

ll modpower(ll a, ll r, ll mod){ //a^r
    ll x = 1;
    a %= mod;
    while (r > 0) {
        if (r & 1) x = x * a % mod;
        r >>= 1;
        a = a * a % mod;
    }
    return x;
}

ll modinv(ll a, ll mod){
    return modpower(a, mod-2, mod);
}

vector<ll> fact;
vector<ll> invfact;

void set_fact(ll n, ll mod){
    fact.resize(n+1, 1);
    invfact.resize(n+1, 1);
    for (ll i = 2; i <= n; i++) {
        fact[i] = fact[i-1] * i % mod;
    }
    invfact[n] = modinv(fact[n], mod);
    for (ll i = n-1; i >= 2; i--) {
        invfact[i] = invfact[i+1] * (i+1) % mod;
    }
    return;
}

ll comb(ll n, ll k, ll mod) {
    if (k > n || k < 0) return 0;
    if (k == n || k == 0) return 1;
    return fact[n] * invfact[n-k] % mod * invfact[k] % mod;
}

int main() {
    ll K;
    cin >> K;
    string S;
    cin >> S;
    ll N = S.size();
    ll mod = 1e9+7;
    
    set_fact(N+K+2, mod);
    ll ans = 0;
    for (ll i = N; i <= N+K; i++) {
        ans += comb(N+K, i, mod) * modpower(25, N+K-i, mod) % mod;
    }
    cout << ans%mod << endl;
    return 0;
}


Measured memory_bytes: 35640
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

unsigned int adjust( double n )
{
	if ( (int)( n * 10 ) % 10 < 5 )
	{
		return n;
	}
	else
	{
		return n + 1;
	}
}

int main()
{
	unsigned long totalprice = 0, totalnum = 0, n = 0;
	string buffer;

	while ( cin >> buffer )
	{
		for ( unsigned int i = 0; i < buffer.length(); i++ )
		{
			if ( buffer[i] == ',' )
			{
				buffer[i] = ' ';
				break;
			}
		}

		unsigned int price, num;
		istringstream iss( buffer );

		iss >> price >> num;

		totalprice += price * num;
		totalnum += num;
		n++;
	}

	cout << totalprice << endl;
	cout << adjust( (double)totalnum / n ) << endl;

	return 0;
}

Measured memory_bytes: 0
//BeautifulStrings.cpp (B)
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main(){
  string w;
  cin >> w;
  map<char ,int> chk;
  for(int i = 0; i < w.size(); i++){
    chk[w[i]]++;
  }

  bool flag = true;
  for(auto x: chk){
    if(x.second%2!=0){
      flag = false;
      break;
    }
  }

  if(flag) printf("Yes\n");
  else printf("No\n");

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)

#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pi pair<ll,ll>
#define all(X) X.begin(),X.end()

// for pair comparison function(ascending order) use return (i1.ff < i2.ff);

/* string operations :
   str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
   str.substr (x) : returns a substring str[x],... end of string
   str.find(qtr) : returns the first occurenece of qtr in str.
   builtin functions :
   __builtin_popcount(n) : no. of set bits in n.
   __builtin_parity(n) : parity of no. of set bits
   __builtin_clz(n) : no. of leading zeros before 1
   __builtin_ctz(n) : no of zeros from last to first occurrence of 1
*/

const int M = (1<<20)+5;
const int md = 1e9+7;

ll pwr(ll a,ll n,ll m)
{
	ll p=1;
	while(n>0)
	{
		if(n%2==1)
			p=(p*a)%m;
		a=(a*a)%m;
		n=n/2;
	}
	return p;
}

ll binlen(ll a)
{
	ll v = 0;
	for(ll i=0;i<61;++i)
	{
		v += (1ll<<i);
		if(a<=v) return i;
	}
}

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

	double p = 3.141592653589793238;
	double a,b,c,h,m,mh,ma;
	cin >> a >> b >> h >> m;

	ma = m*6.0;
	mh = h*30.0 + (m/12.0)*6.0;

	c = sqrt(a*a+b*b-2.0*a*b*cos(p*abs(ma-mh)/180.0));
	cout << setprecision(12) << c << "\n";
}


Measured memory_bytes: 4244
import java.util.Scanner;

public class Main {

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

        int n = Integer.parseInt(sc.next());
        n = n%10;
        if(n == 3){
            System.out.println("bon");
        }else if(n == 0 || n == 1 || n == 6 || n == 8){
            System.out.println("pon");
        }else{
            System.out.println("hon");
        }
    }
}

Measured memory_bytes: 35608
#include <stdio.h>
int binarySearch(int S[], int n,int key){
  int left=0, right=n;
  int mid;
  while(left<right){
	mid=(left+right)/2;
	if(S[mid]==key)
	  return mid;
	else if(S[mid]<key)
	  left=mid+1;
	else 
	  right=mid;
  }
  return -1;
}
int main(){
  int n, q;
  int S[100005];
  int i;
  int key;
  int count=0;
  scanf("%d", &n);
  for(i=0; i<n; ++i){
	scanf("%d", &S[i]);
  }
  scanf("%d", &q);
  for(i=0; i<q; ++i){
	scanf("%d", &key);
	if(binarySearch(S, n, key)>=0)
	  ++count;
}
  printf("%d\n", count);
  return 0;
}



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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()

const int MAX = 1e5+10;
const int MOD = 1e9+7;
const int ord[13] = {0, 4, 8, 12, 3, 7, 11, 2, 6, 10, 1, 5, 9};

string S;
ll dp[MAX][13];
ll dp2[42];

int solve() {
    int n = S.size();
    dp[0][0] = 1;
    REP (i, n) {
        if (S[i] == '?') {
            dp2[0] = 0;
            REP (j, 13*3) {
                dp2[j+1] = (dp2[j] + dp[i][ord[j%13]]) % MOD;
            }
            REP (j, 13) {
                dp[i+1][j] = MOD + dp2[j+14]-dp2[j+4];
                dp[i+1][j] %= MOD;
            }
        } else {
            int k = S[i]-'0';
            REP (j, 13) {
                dp[i+1][(j*10+k)%13] = dp[i][j];
            }
        }
    }
    return dp[n][5];
}

int main() {
    cin >> S;
    cout << solve() << endl;
}

Measured memory_bytes: 10752
#include <iostream>

using namespace std;

int main()
{

    int length;    cin >> length;

    int sequenceA[100], sequenceB[100];
    for (int i = 0; i < length-1; i++){
        cin >> sequenceB[i];
    }

    sequenceA[0] = sequenceB[0];
    sequenceA[length] = sequenceB[length-2];
    int sum = sequenceA[0] + sequenceA[length];

    for (int i = 1; i < length-1; i++){
        if (sequenceB[i] > sequenceB[i-1]){
            sequenceA[i] = sequenceB[i-1];
        }

        else{
            sequenceA[i] = sequenceB[i];
        }

        sum += sequenceA[i];
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    if (a < b)  printf("a < b\n");
    if (a == b) printf("a == b\n");
    if (a > b)  printf("a > b\n");
    return 0;
}


Measured memory_bytes: 2604
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K;
    cin >> N >> K;
    ll ans = 0;
    while(N > 0){
        ans++;
        N /= K;
    }
    print(ans);

    

}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<cstring>

using namespace std;

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

bool dis[52][52][52][52];

typedef pair<pair<int, int>, pair<int, int> > status;
#define LEFT first
#define RIGHT second
#define X first
#define Y second

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

int main() {
  int w, h;
  while (true) {
    vector<string> left, right;
    cin >> w >> h;
    if (w == 0 && h == 0) break;
    string block;
    rep (i, w + 2) block += '#';
    left.push_back(block);
    right.push_back(block);
    rep (i, h) {
      string str;
      cin >> str;
      left.push_back("#" + str + "#");
      cin >> str;
      right.push_back("#" + str + "#");
    }
    left.push_back(block);
    right.push_back(block);
    memset(dis, 0, sizeof(dis));
    queue<status> que;
    int lx, ly, rx, ry;
    rep (i, left.size()) rep (j, left[0].size()) {
      if (left[i][j] == 'L') {
	lx = j;
	ly = i;
      }
      if (right[i][j] == 'R') {
	rx = j;
	ry = i;
      }
    }
    status s;
    s.LEFT.X = lx;
    s.LEFT.Y = ly;
    s.RIGHT.X = rx;
    s.RIGHT.Y = ry;
    que.push(s);
    while (!que.empty()) {
      status now = que.front();
      que.pop();
      if (dis[now.LEFT.X][now.LEFT.Y][now.RIGHT.X][now.RIGHT.Y]) {
	continue;
      }
      dis[now.LEFT.X][now.LEFT.Y][now.RIGHT.X][now.RIGHT.Y] = true;
      rep (i, 4) {
	status next = now;
	next.LEFT.X += dx[i];
	next.LEFT.Y += dy[i];
	next.RIGHT.X -= dx[i];
	next.RIGHT.Y += dy[i];
	if (left[next.LEFT.Y][next.LEFT.X] == '#') {
	  next.LEFT.X -= dx[i];
	  next.LEFT.Y -= dy[i];
	}
	if (right[next.RIGHT.Y][next.RIGHT.X] == '#') {
	  next.RIGHT.X += dx[i];
	  next.RIGHT.Y -= dy[i];
	}
	if (left[next.LEFT.Y][next.LEFT.X] == '%' && right[next.RIGHT.Y][next.RIGHT.X] == '%') goto aaa;
	if (left[next.LEFT.Y][next.LEFT.X] == '%') continue;
	if (right[next.RIGHT.Y][next.RIGHT.X] == '%') continue;
	que.push(next);
      }
    }
    cout << "No" << endl;
    continue;
  aaa:;
    cout << "Yes" << endl;
  }
  return 0;
}

Measured memory_bytes: 12072
S=input()
flag=True

if len(S)%2!=0:
  print("No")
else:
  for i in range(len(S)//2):
    if S[2*i]+S[2*i+1]=="hi":
      pass
    else:
      flag=False
      break
      
  if flag:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define rv(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
const int M = 120000;
typedef long long ll;
int n,m,k;
int main(){
    string s,t,u;
    int a,b;
    //cin>>s>>t>>a>>b>>u;
    cin>>s;
    n = s.size();
    while(n--){
        putchar('x');
    }
    puts("");
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		long ary[] = {0L, 0L, 0L, 0L, 0L}; //M, A, R, C, H
		for(int i=0; i<N; i++) {
			char c = sc.next().charAt(0);
			switch(c) {
			case 'M': ary[0]++; break;
			case 'A': ary[1]++; break;
			case 'R': ary[2]++; break;
			case 'C': ary[3]++; break;
			case 'H': ary[4]++;
			}
		}
		sc.close();
		long x = 0L;
		
		for(int i=0; i<=2; i++) {
			for(int j=i+1; j<=3; j++) {
				for(int k=j+1; k<=4; k++) {
					x += ary[i] * ary[j] * ary[k];
				}
			}
		}
		
		System.out.println(x);
	}

}

Measured memory_bytes: 46116
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long int X,Y;
    cin >> X >> Y;
    long long int A,B,C;
    cin >> A >> B >> C;
    vector<long long int> p(A),q(B),r(C);
    for(int i=0;i<A;i++)cin >> p[i];
    for(int i=0;i<B;i++)cin >> q[i];
    for(int i=0;i<C;i++)cin >> r[i];
    sort(p.begin(),p.end(),greater<>());
    sort(q.begin(),q.end(),greater<>());
    sort(r.begin(),r.end(),greater<>());
    vector<long long int>All(X+Y+C);
    for(int i=0;i<X;i++)All[i]=p[i];
    for(int i=0;i<Y;i++)All[X+i]=q[i];
    for(int i=0;i<C;i++)All[X+Y+i]=r[i];
    sort(All.begin(),All.end(),greater<>());
    long long int Ans =0;
    for(int i=0;i<X+Y;i++)Ans+=All[i];
    cout << Ans << endl;
}


Measured memory_bytes: 7728
#include "bits/stdc++.h"
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <random>
#include <stdio.h>
#include <bitset>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef string ST;


#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) {LL i=0; for(auto (a): v ){   cerr <<i << " : "<<  a << endl; i++;}}
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl

void func() {
  LL N;
  cin >> N;

  REP(i, 10) {
    REP(j, 10) {
      if ((i * j) == N) {
        cout << "Yes";
        return;
      }
    }
  }
  cout << "No";
}

#ifdef CALC_TIME 
#include <windows.h>
int main()
{
  LARGE_INTEGER freq;
  QueryPerformanceFrequency(&freq);
  LARGE_INTEGER start, end;
  QueryPerformanceCounter(&start);
  // 何かの処理
  func();
  QueryPerformanceCounter(&end);
  double time = static_cast<double>(end.QuadPart - start.QuadPart) * 1000.0 / freq.QuadPart;
  fprintf(stderr, "\n%lf[ms]\n", time);
  return 0;
}
#else 
int main()
{
  func();
  return 0;
}
#endif





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

int main(){
    int n, k;
    cin >> n >> k;
    int r, s, p;
    cin >> r >> s >> p;
    map<char, int> point;
    point['r'] = p;
    point['s'] = r;
    point['p'] = s;
    string t;
    cin >> t;
    long long ans = 0;
    for (int i = 0; i < k; i++){
        bool flag = true;
        char before = 'z';
        for (int j = i; j < n; j += k){
            if (t[j] == before){
                if (flag) ans += point[t[j]], flag = false;
                else flag = true;
            }
            else ans += point[t[j]], flag = false;
            before = t[j];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back()
#define ALL(a) (a).begin(),(a).end()
using namespace std;
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;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

const ll MOD = 1e9+7;
const double pi = 3.141592653589793;
signed main(){
    double a,b,h,m; cin >> a >> b >> h >> m;
    double x=30.0*h+0.50*m;
    double y=6.0*m;
    double d=x-y;
    if(d<0) d=(-1.0)*d;
    if(360.0-d<d)d=360.0-d;
    
    //cout << x << " " << y << endl;
    if(x==y){
        double z=a-b;
        if(z<0)z=(-1.0)*z;
        cout << fixed << setprecision(20) << z << endl;
    }else{
        double z=a*a+b*b-2.0*a*b*cos(pi*d/180.0);
        z=sqrt(z);
        cout << fixed << setprecision(20) << z << endl;
    }
    
}



Measured memory_bytes: 4132
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s1;
  string s2;
  cin>>s1>>s2;
  long m=s1.size();
  long n=s2.size();
  long dp[m+1][n+1];
  for(long i=0;i<=m;i++){
    for(long j=0;j<=n;j++){
        if(i==0||j==0){
            dp[i][j]=0;
        }
      else if(s1[i-1]==s2[j-1]){
        dp[i][j]=1+dp[i-1][j-1];
      }
      else{
      dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
      }
    }
  }
string ans="";
  long i=m;
  long j=n;
  while(i>0 && j>0){
    if(s1[i-1]==s2[j-1]){
      ans+= s1[i-1];
      i--;
      j--;
    }
    else if(dp[i-1][j]>dp[i][j-1]){
      i--;
    }
    else{
      j--;
    }
  }
  reverse(ans.begin(),ans.end());
  cout<<ans<<endl;
}
    
    
    
    
    
    
    
    

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

int main() {
  int H = 0, W = 0;

  while(true) {
    cin >> H >> W;
    if (H == 0 && W == 0) {
      break;
    }
    else {
      for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
          cout << "#";
          if (j == W - 1) {
            cout << endl;
          }
        }
        if (i == H - 1) {
          cout << endl;
        }
      }
    }
  }
}



Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

struct St{
  string nm;
  int fv;

  St() {}
  St(string _nm, int _fv): fv(_fv), nm(_nm) {}

  void print(){
    cout << fv << " " << nm << endl;
    return ;
  }

  bool operator<(const St& st) const{
    if(fv == st.fv) return nm < st.nm;
    return fv < st.fv;
  }
};

int main()
{
  int n, m, d;
  string str;
  bool a[21][31];
  vector<St> vec;

  while(cin>>n && n){
    fill(&a[0][0], &a[21][0], false);

    for(int i = 0; i < n; i++){
      cin >> str >> m;
      vec.push_back(St(str, 0));
      while(m--){
	cin >> d;
	a[i][d] = true;
      }
    }

    for(int i = 0; i < 31; i++){
      vector<int> v1;
      for(int j = 0; j < n; j++)
	if(a[j][i]) v1.push_back(j);

      for(int j = 0, l = v1.size(); j < l; j++)
	vec[v1[j]].fv += (n-l+1);
    }
    sort(vec.begin(), vec.end());

    vec[0].print();
    vec.clear();
  }

  return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    string N;
    cin >> N;
    ll s = accumulate(N.begin(), N.end(), (ll)(-N.size() * '0'));
    if(stoll(N) % s) cout << "No";
    else cout << "Yes";
    cout << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
int main()
{
    int a,s=0,b;
    scanf("%d",&a);
    b=a;
    while(b!=0){
        s+=b%10;
        b/=10;
    }
    if(a%s==0) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 128