akhauriyash/Code-Regression huggingface dataset:
"use strict";

var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.split(/ |\n/),
    cid = 0;

function next() {
    return +cin[cid++];
} // number一個取得
function nextstr() {
    return cin[cid++];
} // 文字列一個取得
function nextbig() {
    return BigInt(cin[cid++]);
} // BigInteger一個取得
// 長さnの配列として取得。aは文字列フラグ
function nexts(n, a) {
    return a ? cin.slice(cid, cid += n) : cin.slice(cid, cid += n).map(a => +a);
}
// 長さnのBigInt配列として取得。
function nextsbig(n) {
    return cin.slice(cid, cid += n).map(a => BigInt(a));
}
// w個ずつを組にして長さhの配列。aは文字列フラグ。
function nextm(h, w, a) {
    var r = [],
        i = 0;
    if (a)
        for (; i < h; i++) r.push(cin.slice(cid, cid += w));
    else
        for (; i < h; i++) r.push(cin.slice(cid, cid += w).map(a => +a));
    return r;
}
// 多次元配列。v,a1,a2,a3 なら、3次元。[[値vで長さa3の配列]をa2個並べた配列]をa1個並べた配列。
function xArray(v) {
    var a = arguments,
        l = a.length,
        r = "Array(a[" + --l + "]).fill().map(x=>{return " + v + ";})";
    while (--l) r = "Array(a[" + l + "]).fill().map(x=>" + r + ")";
    return eval(r);
}


console.log(main().toString());

function main() {
    let n = next();
    let a = nexts(n);
    for (let i = 0; i < 30; i++) {
        for (let j = 0; j < n; j++) {
            if ((a[j] & 1) == 0) {
                a[j] = a[j] >> 1;
            } else {
                return i;
            }
        }
    }
}

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

long long N;

long long f(long long x) {
  int a = 0, ret = 0;
  for (int i = 0; i < 8; i++) {
    if (x / pow(10, i) > 0) {
      a = i;
    }
  }
  for (int i = 0; i <= a; i++) {
    ret += x % 10;
    if (i == a) {
      break;
    }
    x = (x - x % 10) / 10;
  }
  return ret;
}

int main() {
  long long N;
  cin >> N;
  if (N % f(N) == 0) {
    cout << "Yes";
  }
  else {
    cout << "No";
  }
}

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

int main() {
  int k, s; cin >> k >> s;
  int answer = 0;
  
  for (int x = 0; x <= k; x++) {
    for (int y = 0; y <= k; y++) {
      int z = s - x - y;
      if (z >= 0 && z <= k) answer++;
    }
  }
  
  cout << answer << endl;
}

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

typedef pair<int, int> Pair;

struct Edge {
    int to;
    int cost;
};

int n;
bool used[100000];
vector<Edge> es[100000];

Pair dfs(int v) {
    used[v] = true;

    Pair ret = Pair(0, v);
    for (int i=0; i<es[v].size(); i++) {
        const int u = es[v][i].to;
        const int w = es[v][i].cost;
        if (used[u]) continue;
        Pair tmp = dfs(u);
        ret = max(ret, Pair(w+tmp.first, tmp.second));
    }
    return ret;
}

int main() {
    scanf("%d", &n);
    for (int i=0; i<n-1; i++) {
        Edge e;
        int a, b;
        scanf("%d%d%d", &a, &b, &e.cost);
        e.to = b;
        es[a].push_back(e);
        e.to = a;
        es[b].push_back(e);
    }

    Pair p = dfs(0);
    fill(used, used+n, false);
    printf("%d\n", dfs(p.second).first);
}

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

int main() {
	/*
cout<<"Hello World"<<endl;

	int x;
	cin>> x;
	cout<< x*x*x <<endl;
*/
int a;
int b;
cin>>a>>b;
cout<<a*b<<" "<<2*a+2*b<<endl;


	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  unordered_map<string,int> memo;
  rep(i,N){
    string s;
    cin >> s;
    sort(ALLOF(s));
    memo[s]++;
  }

  ll ret = 0;

  FOR(it,memo){
    ll x = it->second - 1;
    ret += x * (x+1) / 2;
  }

  cout << ret << endl;
  
  return 0;
}



Measured memory_bytes: 10660
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}

int op(int a,int b){
    return max(a,b);
}

int e(){
    return 0;
}

void solve(){
    int n,k;
    cin>>n>>k;
    segtree<int,op,e> seg(300001);
    int ans{};
    for(int i{};i<(n);++i){
        int a,tmp;
        cin>>a;
        tmp=seg.prod(max(0,a-k),min(300001,a+k+1))+1;
        chmax(ans,tmp);
        seg.set(a,tmp);
    }
    cout<<ans<<'\n';
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    solve();
}

Measured memory_bytes: 8516
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"
int main()
{
	
	int n,s=0;
	cin>>n;
	vi v(n),c(n);
	for0(i,n) cin>>v[i];
	for0(i,n) cin>>c[i];
	for0(i,n){
		if(v[i]>c[i]) s += (v[i]-c[i]);
		}
	cout<<s<<nw;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
	int n; cin >> n;
	int sum = 0;
	int in_num = 0;
	int sum_in = 0;
	vector<int> sum_line1_a(n);
	vector<int> line2_a(n);
	for (int i = 0; i < n; ++i) {
		cin >> in_num;
		sum_in += in_num;
		sum_line1_a[i] = sum_in;
	}
	for (int i = 0; i < n; ++i) {
		cin >> line2_a[i];
	}
	int ans = -1;
	for (int i = n - 1; i > -1; --i) {
		int sum_can = sum_line1_a[i];
		for (int j = i; j < n; ++j) {
			sum_can += line2_a[j];
		}
		ans = max(ans, sum_can);
	}
	cout << ans << endl;
    return;
}

int main() {
    solve();
    return 0;
}



Measured memory_bytes: 256
import sys
import math
import numpy as np

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


s = S()
n = int(s[-1])
l = [2, 4, 5, 7, 9]

if n in l:
    print("hon")
elif n == 3:
    print("bon")
else:
    print("pon")


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

int main() {
	int H, W;

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

		}
		cout << endl;
	}
	return 0;
}


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

using namespace std;

int main() {
	
	//freopen("test.inp", "r", stdin);
	int n,m;
	scanf("%d %d", &n, &m);
	string c;
	for (int i =0; i < n; i++){
		for (int j = 0; j < m; j++){
			cin >> c;
			if (string(c) == "snuke"){
				printf("%c%d\n", (char) j + 'A', i+1);
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
#include<cstdio>

using namespace std;


int adddigit(int n) {
    int result = 0;
    while(n) {
        result += n % 10;
        n /= 10;
    }
    return result;
}

int main() {
    int n;
    scanf("%d", &n);

    int min = n;
    for(int i = 1; i <= n/2; ++i) {
        int t = adddigit(i) + adddigit(n-i);
        if(t < min) min = t;
    }
    printf("%d\n", min);
    return 0;
}


Measured memory_bytes: 128
/*
	Created by : imay_10
	" It won't be EASY, but I'll make it "
*/

#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
const int mod = 1e9+7;
const ll inf = 1e18;
const double pi = 3.1415926535897932384626;

// Utility for fast exponentiation
ll mpow(ll a,ll b,ll m){
    ll res=1;
    //a%=m;
    while(b){
    	if(b%2) res=res*a%m;
		a=a*a%m;
		b/=2;
	}
	return res;
}

// Utility for modular inverse
ll inv(ll a,ll m){
	return mpow(a,m-2,m);
}

// Utility for GCD Calculation
ll gcd(ll a,ll b){
	if(b==0) return a;
	return gcd(b,a%b);
}

// Utility for binomial coefficient
ll ncr(ll n,ll k)
{
    if(n<k)
        return 0;
    ll C[n + 1][k + 1];
    ll i,j;
    for(i=0;i<=n;i++){
        for(j=0;j<=min(i,k);j++){
            if (j==0 || j==i)
                C[i][j]=1;
            else
                C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
        }
    }
    return C[n][k];
}

void solve(){
	//code
	string s1,s2;
	cin>>s2>>s1;
	ll n=s1.size();
	ll m=s2.size();
	ll ans=INT_MAX;
	
	for(ll i=0;i<m-n+1;i++){
		ll m=0;
		for(ll j=0;j<n;j++){
			if(s1[j]!=s2[i+j])
				m++;
		}
		ans=min(m,ans);
	}
	cout<<ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	solve();
 	return 0;
}


Measured memory_bytes: 3660
import sys
from collections import deque

readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)


def main():
    N, Q = map(int, readline().split())
    G = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = map(int, readline().split())
        G[a - 1].append(b - 1)
        G[b - 1].append(a - 1)
    X = [0] * N
    for i in range(Q):
        p, x = map(int, readline().split())
        X[p - 1] += x

    C = [0] * N
    C[0] = X[0]
    seen = [False] * N
    stack = deque([0])
    
    while stack:
        v = stack.pop()
        seen[v] = True
        for nv in G[v]:
            if not seen[nv]:
                stack.append(nv)
                C[nv] = C[v] + X[nv]

    print(*C)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 63504
fun main(args: Array<String>) {
    val keywords = arrayOf("dream", "dreamer", "erase", "eraser").map { it.reversed() }.toTypedArray()
    val s = StringBuilder(readLine()!!.reversed())
    while (s.isNotEmpty()) {
        val m = keywords.firstOrNull { s.startsWith(it) } ?: break
        s.delete(0, m.length)
    }
    println(if (s.isEmpty()) "YES" else "NO")
}


Measured memory_bytes: 32576
#include <bits/stdc++.h>
#define lowbit(x) ((x)&(-x))
#define mem(i, a) memset(i, a, sizeof(i))
#define sqr(x) ((x)*(x))
#define ls(x) (x << 1)
#define rs(x) (x << 1 | 1)
typedef long long ll;
const double eps = 1e-8;
const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + 7;
using namespace std;
int sum[maxn], prime[maxn], tot, mod = 1e9 + 7;
bool check[maxn];
void init(int n){
    tot = 0; sum[1] = 1;
    for(int i = 2; i <= n; i++){
        if(!check[i]) {
            prime[tot++] = i;
            sum[i] = i - 1;
        }
        for(int j = 0; j < tot && prime[j] <= n / i; j++){
            check[i * prime[j]] = 1;
            if(i % prime[j])
                sum[i * prime[j]] = sum[i] * (prime[j] - 1);
            else{
                sum[i * prime[j]] = sum[i] * prime[j];
                break;
            }
        }
    }
    for(int i = 1; i<= n; i++) sum[i] = (sum[i] + sum[i - 1]) % mod;
}
ll qpow(ll a, ll n){
    ll ans = 1;
    for(a %= mod; n; n >>= 1){
        if(n & 1) ans = ans * a % mod;
        a = a * a % mod;
    }
    return ans % mod;
}
int main(void){
#ifdef ljxtt
freopen("data.in", "r", stdin);
#endif
    init(maxn - 1);
    int n, k; scanf("%d%d", &k, &n);
    ll ans = 0;
    for(int i = 1, r; i <= n; i = r + 1){
        r = min(n / (n / i), n);
        ans += qpow(n / i, k) * (sum[r] - sum[i - 1]) % mod;
        ans %= mod;
    }
    printf("%lld\n", (ans + mod) % mod);
    return 0;
}

Measured memory_bytes: 4360
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int n;
  cin>>n;
  int t = n;
  int s = 0;
  while(t > 0) {
    s += t % 10;
    t /= 10;
  }
  if(n % s == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


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

class Dice {
public:
    int upside() {
        return faces[0];
    }
    int frontside() {
        return faces[1];
    }
    int rightside() {
        return faces[2];
    }
    int backside() {
        return faces[4];
    }
    int leftside() {
        return faces[3];
    }
    int downside() {
        return faces[5];
    }

    void E() {
        int tmp = faces[0];
        faces[0] = faces[3];
        faces[3] = faces[5];
        faces[5] = faces[2];
        faces[2] = tmp;
    }

    void N() {
        int tmp = faces[0];
        faces[0] = faces[1];
        faces[1] = faces[5];
        faces[5] = faces[4];
        faces[4] = tmp;
    }

    void S() {
        int tmp = faces[0];
        faces[0] = faces[4];
        faces[4] = faces[5];
        faces[5] = faces[1];
        faces[1] = tmp;
    }

    void W() {
        int tmp = faces[0];
        faces[0] = faces[2];
        faces[2] = faces[5];
        faces[5] = faces[3];
        faces[3] = tmp;
    }

    void rotate() {
        int tmp = faces[1];
        faces[1] = faces[2];
        faces[2] = faces[4];
        faces[4] = faces[3];
        faces[3] = tmp;
    }

private:
    int faces[6] = {0, 1, 2, 3, 4, 5};
};

int main() {
    int a[6], b[6];
    for (int i = 0; i < 6; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < 6; i++) {
        cin >> b[i];
    }

    Dice diceA, diceB;
    if (a[diceA.frontside()] == b[diceB.upside()]) {
        diceA.N();
    } else if (a[diceA.rightside()] == b[diceB.upside()]) {
        diceA.W();
    } else if (a[diceA.backside()] == b[diceB.upside()]) {
        diceA.S();
    } else if (a[diceA.leftside()] == b[diceB.upside()]) {
        diceA.E();
    } else if (a[diceA.downside()] == b[diceB.upside()]) {
        diceA.N();
        diceA.N();
    }

    bool isSame = false;
    for (int i = 0; i < 4; i++) {
        if (a[diceA.upside()] == b[diceB.upside()] &&
            a[diceA.frontside()] == b[diceB.frontside()] &&
            a[diceA.rightside()] == b[diceB.rightside()] &&
            a[diceA.backside()] == b[diceB.backside()] &&
            a[diceA.leftside()] == b[diceB.leftside()] &&
            a[diceA.downside()] == b[diceB.downside()]) {
            isSame = true;
            break;
        }
        diceA.rotate();
    }
    cout << (isSame ? "Yes" : "No") << endl;

    return 0;
}


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

int main()
{
  int h,m,s;
  cin >> s;
  h = s / 3600;
  s = s - 3600 * h;
  m = s / 60;
  s = s - m * 60;
  cout << h << ":" << m << ":" << s << endl;

  return 0;
}


Measured memory_bytes: 3104
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <math.h>
//#include <algorithm>
#include <vector>

#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))

using namespace std;

#define MOD 1000000007

int main(int argc, char* argv[])
{
    long n, k;
    scanf("%ld %ld", &n, &k);

    long a[101]={0};
    vector<vector<long long> > dp(n+1, vector<long long>(k+1, 0));
 
    long i, j;
    for(i=0; i<n; i++) {
        scanf("%ld", &(a[i]));
    }

    for(i=0; i<=n; i++) {
        dp[i][0] = 1;
    }
    for(i=0; i<n; i++) {
        for(j=1; j<=k; j++) {
            if(j-1-a[i]>=0) {
                dp[i+1][j] = (dp[i][j] + dp[i+1][j-1] - dp[i][j-1-a[i]] +MOD) % MOD;
            }
            else {
                dp[i+1][j] = (dp[i][j] + dp[i+1][j-1]) % MOD;
            }
        }
    }
   
    printf("%lld\n", dp[n][k]);

    return 0;
}


Measured memory_bytes: 80256
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int sum = a+b+c;
		int high = a;
		if(b>high){
			high = b;
		}
		if(c>high){
			high = c;
		}
		System.out.println(sum-high);
	}
}


Measured memory_bytes: 21716
#__author__ = "tatuo"
#__date__ = "$Mar 3, 2018 12:34:20 PM$"

import math
import re
import sys


def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result




arr_data = getinputdata()



s1 = arr_data[0][0][0]
s2 = arr_data[0][1][0]
s3 = arr_data[0][2][0]


print(s1.upper() + s2.upper() + s3.upper())

Measured memory_bytes: 3188
n,m,x = map(int,input().split())
all_cand = []
for i in range(2**n):
  p_m_list = [False for i in range(n)]
  for j in range(n):
    if ((i >>j) & 1):
      p_m_list[j] = True
  all_cand.append(p_m_list)
c_list = []
for i in range(n):
  c_list.append(list(map(int,input().split())))
result_list = []
for cand in all_cand:
  count = 0
  a_list = [0 for i in range(m)]
  for i in range(len(cand)):
    if cand[i] == True:
      count += c_list[i][0]
      for j in range(1,m+1):
        a_list[j-1] += c_list[i][j]
  if min(a_list) >= x:
    result_list.append(count)
if len(result_list) == 0:
  print(-1)
else:
  print(min(result_list))

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

int main() {
  int H, W;
  cin >> H >> W;

  vector<vector<char>> a(H, vector<char>(W));
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> a.at(i).at(j);
    }
  }

  // 空白行を探す
  for (auto i = a.begin(); i != a.end();) {
    vector<char> row = *i;
    bool empty = true;
    for (char r : row) {
      if (r == '#') {
        empty = false;
      }
    }
    if (empty) {
      i = a.erase(i);
    } else {
      i++;
    }
  }

  // 空白列を探す
  for (int j = 0; j < a.at(0).size();) {
    bool empty = true;
	for (int i = 0; i < a.size(); i++) {
      if (a.at(i).at(j) == '#') {
        empty = false;
      }
    } 

    if (empty) {
      for (auto i = a.begin(); i != a.end(); i++) {
        (*i).erase((*i).begin() + j);
      }
    } else {
      j++;
    }
  }

  // 出力する
  for (auto row : a) {
    for (auto col : row) {
      cout << col;
    }
    cout << endl;
  }

}


Measured memory_bytes: 3652
#include<stdio.h>

int e[12];

int check(){
  int i, j, t;
  for ( i = 0; i < 12 - 1; i++ ){
    for ( j = 12 - 2; j >= i; j-- ){
      if ( e[j] > e[j+1] ){
        t = e[j];
        e[j] = e[j+1];
        e[j+1] = t;
      }
    }
  }

  for ( int i = 0; i < 12; i += 4)
    for ( int j = 0; j < 3; j++ )
      if ( e[i+j] != e[i+j+1] ) return 0;
  return 1;
}

int main(){
  int i;
  for ( i = 0; i < 12; i++ ) scanf("%d", &e[i]);
  if ( check() ) printf("yes\n");
  else printf("no\n");
  return 0;
}






Measured memory_bytes: 2112
#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         1000000007
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;
 
}
ll NcR(int n, int r) 
{ 
    ll p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 
  
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
            ll m=__gcd(p, k); 
            p /= m; 
            k /= m; 
            n--; 
            r--; 
        } 
    } 
    else
        p = 1; 
    return p;
}
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x)
{
    return (ll)(log(x)/log(base));
}
bool cc(ll a, ll b, ll c)
{
	if((a+b<=c) || (a+c<=b) || (b+c<=a)) 
	return false;
	return true;
}
bool cd(ll a,ll b,ll c)
{
	if(a==b || b==c || a==c) return false;
	return true;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
    while(TESTS--)
    {
    	ll i,j,m,k,n,x,y,d;
    	cin>>x>>k>>d;
    	x=abs(x);
    	if(x>d)
    	{
    		if(k>=x/d){
    			k-=x/d;
    			x = x %d;
    			if(k%2) x = abs(x-d);
			} else
			{
				x = x - k*d;
			}
		}
		else{
			if(k%2) x = abs(x-d);
		}
		cout<<x;
    } 
	return 0;
}













Measured memory_bytes: 3696
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

//0繰り上がりなし, 1繰り上がりあり
//long long dp[1000][2];
long long dp[1000100][2];
const long long INF = 1LL << 61;

int main(){
    string money = "0";
    string s;
    cin >> s;

    money += s;

    long long n = money.size();
    long long ans = 0;

    //init
    for(int i=0; i< 1000100; ++i){
        for(int j=0; j<2; ++j){
            dp[i][j] = INF;
        }
    }

    //後ろから数える
    int first = money[n-1] - '0';
    dp[n-1][0] = first;
    dp[n-1][1] = 10 - first;


    for(long long  i=n-2; i >= 0; --i){

        int num = money[i] - '0';

            //繰り上がりなし
            dp[i][0] = min(dp[i][0], dp[i+1][0] + num);
            dp[i][0] = min(dp[i][0], dp[i+1][1] + (num+1) );

            //繰り上がりあり
            dp[i][1] = min(dp[i][1], dp[i+1][0] + (10 - num) );
            dp[i][1] = min( dp[i][1], dp[i+1][1] + (10 - (num+1) ) );
    }

    cout << min(dp[0][0], dp[0][1]) << endl;
}

Measured memory_bytes: 20792
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    char a,b;
    cin>>a>>b;
    if(a==b){
        cout<<'H';
    }else{
        cout<<'D';
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define il inline
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define rep0(i, n) for(int i = 0; i < (n); i ++)
#define per0(i, n) for(int i = (n) - 1; i >= 0; i --)
#define ept 1e-9
#define INF 0x3f3f3f3f
#define sz(x) (x).size()
#define All(x) (x).begin(), (x).end()
#define lowbit(x) ((x) & -(x))
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
inline ll read1()
{
	ll x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const ll mod = 1e9 + 7;
const int N = 4e6 + 10;
const db pi = acos(-1);
priority_queue<int> a[1010];
int main()
{
	int n = read();
	int Q = read();
	
	while(Q --)
	{
		int op = read();
		if(op == 0) {int x = read();a[x].push(read());}
		if(op == 1) 
		{
			int x = read();
			if(a[x].size() != 0) printf("%d\n", a[x].top());
		}
		if(op == 2) 
		{
			int x = read();
			if(a[x].size() != 0) a[x].pop();
		}
	}
	return 0;
}



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

int main(){
  int N;
  long count=0;
  cin >> N;
  for(int i=0; i<N; i++){
    long a; cin >> a;
    while(a%2==0){
      count++;
      a/=2;
    }
  }
  cout << count <<endl;
  return 0;
}

Measured memory_bytes: 256
implicit none
  integer :: N
  integer(8),allocatable :: a(:)
  integer(8) :: tmp
  integer :: out ,i
  read(*,*) N
  allocate( a(N))

  read(*,*) a(:)
  out = 0
  do i = 1, N
     tmp = a(i)
     do
        if (mod(tmp,2) == 0) then
           tmp = tmp/2
           out = out + 1
        else
           exit
        end if
     end do
  end do
  write(*,'(i0)')  out 
end


Measured memory_bytes: 384
S=input()
T=input()
N=len(S)
d=dict()
for i in range(N):
    if S[i] not in d.keys():
        if T[i] in d.values():
            print("No")
            break
        d[S[i]]=T[i]
    else:
        if d[S[i]]!=T[i]:
            print("No")
            break
else:
    print("Yes")


Measured memory_bytes: 9420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
static const long double pi = 3.141592653589793;



int main(){
    ll N, M;
    cin>>N>>M;
    vector<ll> P(M), Y(M);
    vector<priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>>  Q(N+1);
    rep(i, M){
        cin>>P[i]>>Y[i];
        Q[P[i]].push(make_pair(Y[i], i));
    }
    vector<ll> R(M);
    rep(i, N+1){
        ll T=1;
        while(Q[i].size()){
            pair<ll, ll> S=Q[i].top();
            Q[i].pop();
            R[S.second]=T;
            T++;
        }
    }
    rep(i, M){
        ll Ke, Ta;
        Ke=0;
        Ta=0;
        while(pow(10, Ke)<=P[i]){
            Ke++;
        }
        while(pow(10, Ta)<=R[i]){
            Ta++;
        }
        rep(j, 6-Ke)cout<<0;
        cout<<P[i];
        rep(j, 6-Ta)cout<<0;
        cout<<R[i]<<endl;

    }
}
     

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

int main() {
  int n; cin >> n;
  map<int, int> d;
  rep(i,n) {
    int di; cin >> di;
    d[di]++;
  }
  int m; cin >> m;
  string ans = "YES";
  rep(i,m) {
    int ti; cin >> ti;
    if (d.count(ti) && d[ti] != 0)  d[ti]--;
    else { ans = "NO"; break; }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 13004
<?php
list($S,$T)=sscanf(trim(fgets(STDIN)),"%d %d");
$r="";
if($S < $T){
    for($i=0;$i<$T;$i++){
        $r = $r.$S;
    }
}else{
    for($i=0;$i<$S;$i++){
        $r = $r.$T;
    }
}
printf($r);

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<char> S(4);
  int count=0;
  for (int i=0; i<4; i++) {
    cin >> S.at(i);
    if (S.at(i)=='+') {
      count++;
    }
    else {
      count--;
    }
  }
  cout << count << endl;
}

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

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

    vector<vector<pint>> A(n);
    rep(i, n - 1)
    {
        int u, v, w;
        cin >> u >> v >> w, --u, --v;
        A[u].emplace_back(pint(w, v));
        A[v].emplace_back(pint(w, u));
    }

    // BFS のためのデータ構造
    vector<ll> dist(n, -1);
    queue<int> que;

    // initial state
    dist[0] = 0;
    que.push(0);

    // bfs
    while (!que.empty())
    {
        int v = que.front();
        que.pop();

        for (pint nv : A[v])
        {
            if (dist[nv.second] != -1)
                continue;

            dist[nv.second] = dist[v] + nv.first;
            que.push(nv.second);
        }
    }

    // output
    rep(i, n)
    {
        if (dist[i] % 2 == 0)
            cout << 0 << endl;
        else
            cout << 1 << endl;
    }
}

Measured memory_bytes: 9952
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k,i;
    cin>>n>>k;
    int p[n];
    for(i=0;i<n;i++)
    cin>>p[i];
    
    sort(p,p+n);
    int sum=0;
    for(i=0;i<k;i++)
    sum+=p[i];
    cout<<sum<<endl;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w; cin>>h>>w;
    vector<vector<char> > f(h+2,vector<char>(w+2,'#'));
    rep(i,h)rep(j,w) cin>>f[i+1][j+1];
    rep(i,h+2){
        rep(j,w+2) cout<<f[i][j];
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <utility>
#include <vector>
#include <limits>
#include <unordered_map>

typedef long long ll;

int main(int argc, char *argv[])
{
    int n;

    std::cin >> n;

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

    std::unordered_map<int, int> L;

    for (int i = 0; i < n; i++) {
        const int x = i + a[i];
        L[x]++;
    }


    ll ans = 0;
    for (int j = 0; j < n; j++) {
        int x = j - a[j];
        if (x < 1) {continue;}
        ans += L[x];
    }
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 13876
#include<stdio.h>
int main(){
  int a,b,c,d,st,en;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  st = a<c?c:a;
  en = b<d?b:d;
  if(en-st>0)printf("%d\n",en-st);
  else puts("0");
  return 0;
}


Measured memory_bytes: 128
import collections
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

d0 = {
    1: 2,
    2: 5,
    3: 5,
    4: 4,
    5: 5,
    6: 6,
    7: 3,
    8: 7,
    9: 6,
}

n, m = ril()
ls = ril()

d = collections.defaultdict(int)
for x in ls:
    d[d0[x]] = max(x, d[d0[x]])

dp = [(0, 0)] * (n + 1)
for i in range(2, n + 1):
    for count, num in d.items():
        if count > i:
            continue
        k, l = dp[i - count]
        if count != i and l == 0:
            continue
        dp[i] = (max(dp[i][0], 10 * k + num), max(dp[i][1], l + 1))
        if k != 0:
            dp[i] = (max(dp[i][0], num * 10**l + k), max(dp[i][1], l + 1))
print(dp[n][0])

Measured memory_bytes: 15744
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<pair<int, int>> roll;
    int i;
    for(i=0; i<n; i++){
        int x, y;
        cin >> x >> y;
        roll.pb(mp(x, y));
    }
    bool ok = false;
    for(i=0; i<(n-2); i++){
        if((roll[i].first==roll[i].second) && (roll[i+1].first==roll[i+1].second) && (roll[i+2].first==roll[i+2].second)){
            ok = true;
            break;
        }
    }
    if(ok){
        cout << "Yes\n";
    }
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 3656
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let h: usize = input();
    let w: usize = input();
    let mut s: Vec<Vec<char>> = (0..h)
        .map(|_| input::<String>().chars().collect())
        .collect();

    for i in 0..h {
        for j in 0..w {
            if s[i][j] == '#' {
                continue;
            }

            let mut cnt = 0;
            if i > 0 && j > 0 && s[i - 1][j - 1] == '#' {
                cnt += 1;
            }
            if i > 0 && s[i - 1][j] == '#' {
                cnt += 1;
            }
            if i > 0 && j < w - 1 && s[i - 1][j + 1] == '#' {
                cnt += 1;
            }
            if j > 0 && s[i][j - 1] == '#' {
                cnt += 1;
            }
            if j < w - 1 && s[i][j + 1] == '#' {
                cnt += 1;
            }
            if i < h - 1 && j > 0 && s[i + 1][j - 1] == '#' {
                cnt += 1;
            }
            if i < h - 1 && s[i + 1][j] == '#' {
                cnt += 1;
            }
            if i < h - 1 && j < w - 1 && s[i + 1][j + 1] == '#' {
                cnt += 1;
            }

            s[i][j] = ('0' as u8 + cnt) as char;
        }
    }

    for i in 0..h {
        println!("{}", s[i].iter().cloned().collect::<String>());
    }
}


Measured memory_bytes: 4352
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

typedef long long ll;

ll a[100005];
ll b[100005];
ll sum[100005][2];
vector<pair<ll,ll> >vec;

int main(){

	int N;

	ll K;

	scanf("%d %lld",&N,&K);

	int i;

	for(i=1;i<=N;i++){
		scanf("%lld %lld",&a[i],&b[i]);
		vec.push_back(make_pair(a[i],b[i]));
	}

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


	sum[1][0]=1ll;
	sum[0][1]=0ll;

	for(i=1;i<=N;i++){
		if(i>=2){
			sum[i][0]=sum[i-1][0]+vec[i-2].second;
		}
		sum[i][1]=sum[i-1][1]+vec[i-1].second;

	}

	for(i=1;i<=N;i++){
		if(sum[i][0]<=K&&K<=sum[i][1]){
			cout<<vec[i-1].first<<endl;
			break;
		}
	}


	return 0;
}

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

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> x(N);
    for(size_t i = 0; i < N; i++)
    {
        cin >> x[i];
    }
    int ret = 1e9;
    for(size_t i = 0; i < N-K+1; i++)
    {
        int dist = x[i-1+K] - x[i];
        int this_ret = dist + min(abs(x[i]), abs(x[i-1+K]));
        if (this_ret < ret)
            ret = this_ret;
    }
    cout << ret << endl;
    
    return 0;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
namespace 令和{
    class ABC{
        static void Main(){
            
            int n = int.Parse(Console.ReadLine());
            List<int[]>[] tonari = new List<int[]>[n+1];
            int[] ans = new int[n+1];
            for(int i=0;i<n+1;i++){
                tonari[i] = new List<int[]>();
                ans[i] = -1;
            }
            int u;int v;int w;
            for(int i=1;i<n;i++){
                string[] uvw = Console.ReadLine().Split();
                u = int.Parse(uvw[0]);
                v = int.Parse(uvw[1]);
                w = int.Parse(uvw[2]);
                tonari[u].Add(new int[2]{v,w});
                tonari[v].Add(new int[2]{u,w});
            }

            Queue<int> q = new Queue<int>();
            q.Enqueue(1);
            ans[1] = 0;

            while(q.Count>0){
                int p = q.Dequeue();
                foreach(int[] tnr in tonari[p]){
                    if(ans[tnr[0]]==-1){
                        if(tnr[1]%2==0){
                            ans[tnr[0]] = ans[p];
                        }else{
                            ans[tnr[0]] = 1-ans[p];
                        }
                        q.Enqueue(tnr[0]);
                    }
                }
            }
            for(int i=0;i<n;i++){
                Console.WriteLine(ans[i+1]);
            }


        }
    }
}

Measured memory_bytes: 39368
#include <stdio.h>

int main()
{
  int n=0;
  char s[101];
  scanf("%d", &n);
  scanf("%s", s);

  int ri=0, bi=0;
  for(int i = 0; i < n; i++){
    if(s[i] == 'R'){
      ri++;
    }else{
      bi++;
    }
  }
  
  if(ri > bi){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <ctime>

using namespace std;
#define RN cout << "\r\n";
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef long long int ll;
typedef pair<ll, ll> P;

// combination
const int MAX = 510000;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}


int main() {
    string s;
    ll k;
    cin >> s >> k;
    ll oneCount = 0;
    REP(i, s.size()) {
        if(s[i] == '1') {
            oneCount++;
        } else {
            break;
        }
    }
    if (k <= oneCount) {
        cout << 1;
    } else {
        cout << s[oneCount];
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
//typedef __int128_t i128;

using namespace std;
bool isPalindrome(string str)
{
    // Start from leftmost and rightmost corners of str
    int l = 0;
    int h = str.length() - 1;

    // Keep comparing characters while they are same
    while (h > l)
    {
        if (str[l++] != str[h--])
        {
            //printf("%s is Not Palindrome", str);
            return false;
        }
    }
    //printf("%s is palindrome", str);
    return true;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p;
    string s, t, r;
    cin >> s;
    n = s.length();
    //cout << n << endl;
    t = s.substr(0,(n-1)/2);
    r = s.substr((n+3)/2 - 1, (n-3)/2 + 1);
    //cout << t << endl << r << endl;
    if(isPalindrome(s) && isPalindrome(t) && isPalindrome(r)){
        cout << "Yes";
    }
    else{
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const int MAX_N = 200000;
int n;
ll a[MAX_N];

int main() {
    fastio();

    cin >> n;
    forn(i, n) cin >> a[i];

    ll total = accumulate(a, a + n, 0LL);

    ll ans = LLONG_MAX;
    ll snuke = 0;
    for (int i = 0; i < n - 1; i++) {
        snuke += a[i];
        chmin(ans, abs(snuke - (total - snuke)));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
string solve(string &s, int k, int C) {
    string ret;
    int cnt = C;
    for (auto &c : s) {
        if (c == 'x') {
            ret += c;
            cnt++;
            continue;
        }
        if (k && cnt >= C) {
            ret += 'c';
            k--;
            cnt = 0;
        } else {
            ret += c;
            cnt++;
        }
    }
    return ret;
}
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, k, c; cin >> n >> k >> c;
    string s; cin >> s;
    string l = solve(s, k, c);
    reverse(s.begin(), s.end());
    string r = solve(s, k, c);
    reverse(r.begin(), r.end());
    int l_c = 0, r_c = 0;
    for (int i = 0 ; i < n ; i++) {
        if (l[i] == 'c')
            l_c++;
        if (r[i] == 'c')
            r_c++;
        if (l[i] == r[i] && l[i] == 'c' && l_c == r_c)
            cout << i + 1 << '\n';
    }
}


Measured memory_bytes: 2324
n = gets.to_i
balls = gets.split.map &:to_i

balls_as = [0] * (n + 1)
balls.each do |a|
  balls_as[a] += 1
end

nC2 = balls_as.inject(0) { |sum, m| sum + m * (m-1) / 2 }

balls.each do |a|
  m = balls_as[a]
  # diff = mC2 - (m-1)C2
  diff = m-1
  
  puts nC2 - diff
end




Measured memory_bytes: 23304
#include <bits/stdc++.h>
using namespace std;
int x;
int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    int a[n];
    int sum = 0;
    for (int i = 0; i < n; i++){
        scanf("%d",&a[i]);
        sum += a[i];
    }
    vector<int> v;
    for (int i = 1; i*i <= sum; i++){
        if (sum % i == 0){
            v.push_back(i);
            v.push_back(sum/i);
        }
    }
    sort(v.begin(),v.end(),greater<int>());
    for (auto id : v){
        x = id;
        int p = 0;
        int q = 0;
        sort(a,a+n,[](int a, int b){
            return a%x < b%x;
        });
        for (int s = 0, e = n; s < e; s++){
            p += a[s]%x;
           while (q < p){
                e--;
                q += (x-a[e]%x);
           }

        }
        if (max(p,q) <= k){
            //printf("%d %d\n",p,q);
            printf("%d ",x);
            return 0;
        }
    }
}


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

using namespace std;

int main()
{
    int n ;
    string s;

    cin>>n>>s;

    int small = n/2;
    string t = "";


    for(int i = 0 ; i<small ; i++)
        t+=s[i];

    if(t+t == s)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

int main() {
    ll N; cin >> N;
    string S; cin >> S;
    for(int i = 0; i < S.length(); ++i){
        if(S[i] + N > 90){
            printf("%c", S[i]+N-26);
        }
        else{
            printf("%c", S[i]+N);
        }
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;

const int MAXN = 100005;

int N;
int a[2 * MAXN];
int tmp[2 * MAXN];

void load() {
  scanf("%d", &N);
  for (int i = 1; i < 2 * N; i++)
    scanf("%d", a + i);
}

bool check(int val) {
  for (int i = 1; i < 2 * N; i++)
    tmp[i] = a[i] >= val;
  
  for (int i = 1; i < N; i++) {
    if (tmp[N - i] == tmp[N - i + 1])
      return tmp[N - i];
    if (tmp[N + i] == tmp[N + i - 1])
      return tmp[N + i];
  }
  
  return tmp[N] ^ ((N - 1) % 2);
}

int solve() {
  int lo = 1, hi = 2 * N - 1;
  while (lo < hi) {
    int mid = (lo + hi + 1) / 2;
    if (check(mid))
      lo = mid;
    else
      hi = mid - 1;
  }
  
  return lo;  
}

int main() {
  load();
  printf("%d\n", solve());
  return 0;
}

Measured memory_bytes: 1664
import math
from itertools import product

N = int(input())
if N <= 356:
    print(0)
    exit()
c = 0
for keta in range(3, int(math.log(N, 10)) + 2):
    for t in product("753", repeat=keta):
        if int("".join(t)) <= N and len(set(t)) == 3:
            c += 1
print(c)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
	int aaa = 0;
	int c = 1;
	while (c < b){
    	c += a-1;
    	aaa += 1;
	}
  cout<<aaa;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
#define ALPHANUM 26
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
ll guukiruiseki[200001]={};
int opt[200001];
int dp[(1<<ALPHANUM)];
bool kaibun(int left,int right){
	ll info=guukiruiseki[left]^guukiruiseki[right];
	if(info-(info & -info)==0) return true;
	else return false;
}
int main(){
	fill_n(dp,1<<ALPHANUM,INF);
	string S;
	scan(S);
	int maxN=S.size();
	rep1(i,maxN){
		guukiruiseki[i]=guukiruiseki[i-1]^(1<<(S[i-1]-'a'));
	}
	opt[0]=0;
	dp[0]=0;
	rep1(i,maxN){
		int mindp=INF;
		rep(j,ALPHANUM+1){
			int x;
			if(j==0) x=0;
			else x=(1<<(j-1));
			mindp=min(mindp,dp[guukiruiseki[i]^x]);
		}
		opt[i]=mindp+1;
		dp[guukiruiseki[i]]=min(dp[guukiruiseki[i]],opt[i]);
	}
	prin(opt[maxN]);
	return 0;
}


Measured memory_bytes: 265092