akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

constexpr int64 P = 1000000007;

// Verified: ABC133E, ABC132D, ABC130E
struct FiniteField {
 private:
  int64 x;
 public:
  FiniteField(int64 input_x) : x(input_x) {}
  FiniteField() : x(0) {}
  int64 Value() { return x; }
  inline FiniteField operator+(FiniteField o) {
    FiniteField r(*this); r += o; return r;
  }
  inline FiniteField operator-(FiniteField o) {
    FiniteField r(*this); r -= o; return r;
  }
  inline FiniteField operator* (FiniteField o) {
    FiniteField r(*this); r *= o; return r;
  }
  inline FiniteField operator/ (FiniteField o) {
    FiniteField r(*this); r /= o; return r;
  }
  inline void operator+= (FiniteField o) { x = (x + o.x) % P; }
  inline void operator-= (FiniteField o) { x = (x + P - o.x) % P; }
  inline void operator*= (FiniteField o) { x = (x * o.x) % P; }
  void operator/=(FiniteField o) {
    int64 p = P - 2; while (p) { if (p % 2) { *this *= o; } o *= o; p /= 2; }
  }
};

struct Edge {
  int from, to;
};

vector<vector<Edge>> ReadUndirectedGraph(
    int n, int m, bool is_one_indexed=false) {
  vector<vector<Edge>> graph(n);
  for (int i = 0; i < m; i++) {
    int v1, v2;
    cin >> v1 >> v2;
    if (is_one_indexed) {
      v1--;
      v2--;
    }
    graph[v1].push_back(Edge({v1, v2}));
    graph[v2].push_back(Edge({v2, v1}));
  }
  return graph;
}

template<typename T>
vector<vector<T>> Make2DVector(int d1, int d2, T default_value) {
  return vector<vector<T>>(d1, vector<T>(d2, default_value));
}

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

  int n;
  cin >> n;
  vector<vector<Edge>> graph = ReadUndirectedGraph(n, n - 1, true);

  vector<vector<FiniteField>> dp = Make2DVector(n, 2, FiniteField(0));

  function<void(int, int)> dfs = [&](int v, int parent) {
    // cerr << "v: " << v << endl;

    dp[v][0] = 1;
    dp[v][1] = 1;
    for (auto e : graph[v]) {
      if (e.to == parent) continue;
      dfs(e.to, v);
      dp[v][0] *= dp[e.to][0] + dp[e.to][1];
      dp[v][1] *= dp[e.to][0];
    }
    // cerr << "v: " << v << " " << dp[v][0].Value() << " " << dp[v][1].Value() << endl;
  };
  dfs(0, -1);
  auto ans = dp[0][0] + dp[0][1];
  cout << ans.Value() << endl;
}


Measured memory_bytes: 19584
using System;

// ガウス・ジョルダン法
// https://www.mk-mode.com/blog/2013/09/20/cpp-simultaneous-equation-by-gauss-jorden/#

namespace Prob0004
{
    class Program
    {
        static void Main(string[] args)
        {

            const int COLUMN = 2;
            const int ROW = 3;

            string line;
            while((line = Console.ReadLine()) != null)
            {
                // a[0][0]x + a[0][1]y = a[0][2]
                // a[1][0]x + a[1][1]y = a[1][2]
                string[] tokens = line.Split(' ');
                double[,] a = new double[COLUMN, ROW];
                for(int y = 0; y < COLUMN; y++)
                {
                    for (int x = 0; x < ROW; x++)
                    {
                        a[y, x] = double.Parse(tokens[y * ROW + x]);
                    }
                }

                // pivot = (p, p)
                double coef;
                for (int p = 0; p < ROW - 1; p++)
                {

                    // ピボットのある行要素への処理
                    coef = a[p, p];
                    for (int x = p; x < ROW; x++)
                    { 
                        a[p, x] /= coef;
                    }

                    // ピボット以外の行要素への処理
                    for (int y = 0; y < COLUMN; y++)
                    {
                        if(p == y)
                        {
                            continue;
                        }

                        coef = a[y, p];
                        for (int x = p; x < ROW; x++)
                        {
                            a[y, x] -= a[p, x] * coef;
                        }
                    }
                }

                // outputs
                Console.Write("{0}", a[0, ROW - 1].ToString("F3"));
                for (int y = 1; y < COLUMN; y++)
                {
                    Console.Write(" {0}", a[y, ROW - 1].ToString("F3"));
                }
                Console.WriteLine();
            }

        }
    }
}



Measured memory_bytes: 15960
#include "bits/stdc++.h"
using namespace std;

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

int main() {
	long long N, M;
	cin >> N >> M;
	long long ans = 0;
	if ((1 == N) && (1 == M)) {
		ans = 1;
	}
	else if(1 == N){
		ans = M - 2;
	}
	else if (1 == M) {
		ans = N - 2;
	}
	else {
		ans = (N-2)*(M-2);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define PI acos(-1)
double calcAngle(double h, double m)
{
    if (h == 12) h = 0;
    if (m == 60) m = 0;
    double hour_angle = 0.5 * (h * 60 + m);
    double minute_angle = 6 * m;
    double angle = abs(hour_angle - minute_angle);
    angle = min(360 - angle, angle);

    return angle;
}
int main()
{
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    double angle = calcAngle(h,m);
    //cout<<angle<<endl;
    angle = angle*PI/180.00;
    double minuS = (2.00*a*b*cos(angle));
    //cout<<minuS<<" "<<cos(angle)<<endl;
    double ans = (a*a + b*b) - minuS ;
    //cout<<ans<<endl;
    ans = sqrtl(ans);
    printf("%.20f\n",ans);
}


Measured memory_bytes: 4168
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
using namespace std;
bool b[1000110] = { false };
int main() {
	int n;
	cin >> n;
	int a[200020];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	int co = 0;
	for (int i = 0; i < n; i++) {
		bool bo = true;
		for (int j = 1; j * j <= a[i]; j++) {
			if (a[i] % j == 0) {
				if (b[j] == true) {
					bo = false;
				}
				if (b[a[i] / j] == true) {
					bo = false;
				}
			}
		}
		b[a[i]] = true;
		if (i != n - 1) {
			if (a[i] == a[i + 1]) {
				bo = false;
			}
		}
		if (bo == true) {
			co++;
		}
	}
	cout << co << endl;
	return 0;
}


Measured memory_bytes: 5216
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#define ll long long
#define FOR(i,n) for(int i=0;i<(n);i++)
using namespace std;
const int INF = (int)1e9,mxN = (int)1e5;

void solve()
{
	string s,t;
	cin >> s >> t;
	int ans = INF,n=(int)s.size(),m=(int)t.size();
	for(int i=0;i<=n-m;i++)
	{
		int k = 0;
		for(int j=i,p=0;p<m;j++,p++)
			if(s[j]!=t[p])k++;
		ans = min(ans,k);
	}
	cout << ans << '\n';//123
	
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
}



Measured memory_bytes: 3608
import itertools
from collections import defaultdict

N, W = map(int, input().split())
d = defaultdict(list)
for _ in range(N):
    w, v = map(int, input().split())
    d[w].append(v)

for i in d:
    d[i] = list(itertools.accumulate(sorted(d[i], reverse=True)))
mm = min(d)

ans = 0
for t in itertools.product(range(len(d[mm]) + 1), range(len(d[mm + 1]) + 1),
                           range(len(d[mm + 2]) + 1), range(len(d[mm + 3]) + 1)):
    if sum((mm + i) * t[i] for i in range(4)) > W:
        continue
    ans = max(ans, sum(d[mm + i][t[i] - 1] if t[i] else 0 for i in range(4)))
print(ans)


Measured memory_bytes: 3316
N=input()
N=int(N)
S=[100]*N
P=[100]*N
for num in range(N):
    S[num]=input().split()
    S[num].append(num+1)
    S[num][1]=int(S[num][1])

S.sort()
flag=0
flag2=0
while(flag==0):
    flag2=0
    for num in range(0,N-1):
        if(S[num][0]==S[num+1][0]):
            if(S[num][1]<S[num+1][1]):
                S[num],S[num+1]=S[num+1],S[num]
                flag2=1
    if(flag2==0):
        flag=1
    
            

for num in range(N):
    print(S[num][2])


Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const long long maxn=100000+50;
long long n,m,w[maxn],v[maxn],dp[maxn];
int main()
{
	cin>>n>>m;
	for(long long i=1;i<=n;i++)cin>>w[i]>>v[i];
	for(long long i=1;i<=n;i++)
	{
		for(long long j=m;j>=w[i];j--)
		{
			dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
		}
	}
	cout<<dp[m]<<endl;
	return 0;
}

Measured memory_bytes: 4328
using System;
using System.Linq;
using System.Collections.Generic;

class P
{
    static void Main()
    {
        int[] a = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();
        string res = "";
        if (0 < a[0] && 0 < a[1])
        {
            res = "Positive";
        } 
        else if (0 > a[0] && 0 > a[1])
        {
            if ((a[1] - a[0]) % 2 == 1)
            {
                res = "Positive";
            }
            else
            {
                res = "Negative";
            }
        }
        else
        {
            res = "Zero";
        }
        Console.WriteLine(res);
    }
}

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

int countDigits(int x){
   int cnt = 0;
   while(x){
      cnt++;
      x /= 10;
   }
   return cnt;
}

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

  int n;
  cin >> n;
   
  int ans = 12;

  for(int i = 1; i * i <= n; i++){
      if(n % i) continue;
      
      int temp = countDigits(i);
      temp = max(temp, countDigits(n / i));
      ans = min(ans, temp);
  }

  cout << ans;

  return 0;
}

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

using namespace std;

int c[300300];

int main() {
	int n;
	scanf("%d", &n);
	vector<int> a;
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		a.push_back(x);
	}
	int l = 0, r = 0;
	int now = 0;
	long long ans = 0;
	while (l < n) {
		while (r < n && (now ^ a[r]) == now + a[r]) {
			now ^= a[r++], ans++;
		}
		now ^= a[l++];
		ans += r - l;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 1400
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_A main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

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

    if (N==1) {
        cout << "Hello World" << endl;
    } else {
        cout << A + B << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
#include <queue>

using namespace std;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)
#define INF (1001001001)
#define EPS (1e-15)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define pra(x,n) rep(__i,n) pri(x,__i);
#define prar(x,b,e) repr(__i,b,e) pri(x,__i);

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;

ll MOD = 1000000007;

int in() {
	int a;
	scanf("%d ", &a);
	return a;
}

int main() {
	int N = in();
	int x = 0, y = 0, t = 0;
	rep(i, N) {
		int tot = in();
		int tox = in();
		int toy = in();
		int interval = tot - t;
		int dx = abs(tox - x);
		int dy = abs(toy - y);
		if (dx + dy > interval || (dx + dy - interval) % 2 != 0) {
			cout << "No" << endl;
			return 0;
		}
		t = tot;
		x = tox;
		y = toy;
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
int main(void){
    ll h, w;
    cin >> h >> w;
    ll a[h][w];
    for(ll i = 0; i < h; i++)
        for(ll j = 0; j < w; j++)
            cin >> a[i][j];
    vector<p> check, before, after, go;
    for(ll i = 0; i < h; i++){
        for(ll j = 0; j < w; j++){
            if(i%2==0 && a[i][j]%2!=0)
                check.push_back(p(i+1,j+1));
            if(i%2!=0 && a[i][w-1-j]%2!=0)
                check.push_back(p(i+1, w-j));
            if(i%2==0)
                go.push_back(p(i+1,j+1));
            else if(i%2!=0)
                go.push_back(p(i+1, w-j));
        }
    }
    ll cnt = 0; bool ok = false;
    for(ll i = 0; i < go.size(); i++){
        if(cnt+1 >= check.size())
            break;
        if(go[i].first==check[cnt].first && go[i].second==check[cnt].second)
            ok = true;
        if(ok==true){
            before.push_back(p(go[i].first, go[i].second));
            after.push_back(p(go[i+1].first, go[i+1].second));
        }
        if(go[i+1].first==check[cnt+1].first && go[i+1].second==check[cnt+1].second){
            cnt+=2;
            ok = false;
        }
    }
    cout << before.size() << endl;
    for(ll i = 0; i < before.size(); i++)
        cout << before[i].first << " " << before[i].second << " " << after[i].first << " " << after[i].second << endl;
    return 0;
}



Measured memory_bytes: 17244
Grid = [list(map(int, input().split(' '))) for _ in range(3)]
b1 = Grid[0][0]
b2 = Grid[0][1]
b3 = Grid[0][2]
a1 = 0
a2 = Grid[1][0] - b1
a3 = Grid[2][0] - b1
if Grid[1][1] == a2 + b2 and Grid[1][2] == a2 + b3 and Grid[2][1] == a3 + b2 and Grid[2][2] == a3 + b3:
    print('Yes')
else: print('No')

Measured memory_bytes: 3064
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from fractions import gcd
def resolve():
    S=input()
    Sd=S[::-1]
    cnt=0
    for i in range(len(S)):
        if S[i]!=Sd[i]:
            cnt+=1
    print(cnt//2) 
#%%submit!
resolve()


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

int main()
{
    int h, w, k, ans = 0;
    char c[10][10];
    cin >> h >> w >> k;
    rep(i, h) rep(j, w) cin >> c[i][j];

    rep(i, 1 << h) rep(j, 1 << w)
    {
        int cnt = 0;
        rep(m, h) rep(n, w)
        {
            if (i >> m & 1)
                continue;
            if (j >> n & 1)
                continue;
            if (c[m][n] == '#')
                cnt++;
        }
        if (cnt == k)
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
int main(){
  string s;
  cin >> s;
  string t = "keyence";
  if(s.size()>7)REP(i,7){
    if(s[i]!=t[i]){
      s.erase(s.begin()+i,s.begin()+(int)s.size()-7+i);
    }
  }
  cout << (s==t?"YES":"NO") << endl;
}


Measured memory_bytes: 256
from sys import stdin, stdout
n = int(stdin.readline())
nmleaves = list(map(int, stdin.readline().strip().split()))

if nmleaves[0]:
   if n == 0 and nmleaves[0] == 1:
      print(1)
   else:
      print(-1)
   exit()

# pref[i]: sum(nmleaves[i:]), i.e., the number of leaves at or below level i.
pref = [0]*(n+1)
totsum = sum(nmleaves)
pref[0] = totsum
t = 0
for i in range(1, n+1):
    t += nmleaves[i-1]
    pref[i]  = totsum - t

prev_nl = 1
ans = 1
for lev in range(1, n+1):
    nodes = min(prev_nl*2, pref[lev])
    ans += nodes
    prev_nl = nodes - nmleaves[lev]
    if prev_nl < 0:
        print(-1)
        exit()
    elif prev_nl == 0 and lev+1<n+1 and pref[lev + 1]>0:
        print(-1)
        exit()
print(ans)

Measured memory_bytes: 83460
#include<stdio.h>

void swap(int*, int*);

int main(){
  int a,b;

  while (1){
    scanf("%d %d", &a, &b);
    if(a==0 && b==0){
      break;
    }
    else{
      swap(&a,&b);
      printf("%d %d\n",a,b);
    }
  }

  return 0;
}


void swap(int *a, int *b){
  int temp;
  if(*a>*b){
    temp = *a;
    *a = *b;
    *b = temp;
  }
}


Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <istream>
#include <iomanip>
 
#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(int argc, char **argv){
	int w = 0;
	int n = 0;
	int a = 0;
	int b = 0;
	char tmp = 0;
	std::vector<int> z;
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

#if INPUT_FROM_FILE
	ifs >> w >> n;
#else
	std::cin >> w >> n;
#endif

	z.resize(w);
	for(int i = 0; i < w; i++){
		z[i] = i + 1;
	}
	for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
		ifs >> a >> tmp >> b;
#else
		std::cin >> a >> tmp >>  b;
#endif
		std::swap(z[a - 1], z[b - 1]);
	}
	for(int i = 0; i < w; i++){
		std::cout << z[i] << std::endl;
	}
	return 0;
}


Measured memory_bytes: 2980
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int dp[305][305];
char name[50];
int cost[305];
int v[305],b[305],f[305];
int n,m;
int solve(int s[],int i,int c){
  int res,sk,nc;
  if(i==n) return 0;
  if(dp[i][c]>=0) return dp[i][c];
  res= solve(s,i+1,c);

  for(nc=cost[i],sk=s[i];c>=nc;nc+=cost[i],sk+=s[i]){
    res=max(res,solve(s,i+1,c-nc)+sk);
  }

  return dp[i][c]=res;
}
int main(void){
  int ans;
  while(scanf("%d %d",&n,&m)!=EOF){
    getchar();
    for(int i=0;i<n;i++){
      fgets(name,sizeof(name),stdin);
      scanf("%d %d %d %d",&cost[i],&v[i],&b[i],&f[i]);
      getchar();
    }
    ans=0;
    memset(dp,-1,sizeof(dp));
    ans=max(ans,solve(v,0,m));
    memset(dp,-1,sizeof(dp));
    ans=max(ans,solve(b,0,m));
    memset(dp,-1,sizeof(dp));
    ans=max(ans,solve(f,0,m));
    printf("%d\n",ans);
  }
}

Measured memory_bytes: 1148
n,y = map(int, input().split())
ans_list = ['-1 -1 -1']
for i in range(n+1):
    for j in range(n+1):
        yen = 10000*i+5000*j+1000*(n-(i+j))
        if y == yen and n-(i+j) >= 0:
            ans_list.append(str(i)+' '+str(j)+' '+str(n-(i+j)))
if len(ans_list) == 1:
    print(ans_list[0])
else:
    print(ans_list[1])

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int N,Q;
  string S;
  cin >> N >> Q >> S;
  vector<int> isAC(N+1, 0);
  for(int i=1;i<N;i++){
    if(S[i-1] =='A' && S[i] =='C'){
      isAC[i+1] = isAC[i] + 1;
    }
    else isAC[i+1] = isAC[i];
  }
  vector<int> I(Q),R(Q);
  for(int i=0;i<Q;i++){
    cin >> I[i] >> R[i];
  }
  for(int i=0;i<Q;i++){
    int ans =  isAC[R[i]] - isAC[I[i]];
    cout << ans << endl; 
  }
}

Measured memory_bytes: 2176
n, k = map(int, input().split())
a = list(map(int, input().split()))

class Bit(object):
    def __init__(self):
        self.bit = [0] * 2001

    def add(self, i):
        while i <= 2000 and i >= 1:
            self.bit[i] += 1
            i += i & -i

    def query(self, i):
        ans = 0
        while i <= 2000 and i >= 1:
            ans += self.bit[i]
            i -= i & -i
        return ans

gl, suf = Bit(), Bit()

for i in range(n):
    gl.add(a[i])

ans = 0

for i in range(n - 1, -1, -1):
    u = suf.query(a[i] - 1)
    v = gl.query(a[i] - 1)
    ans += (u + (u + v * (k - 1))) * k // 2
    suf.add(a[i])

print(ans % (10 ** 9 + 7))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

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

    int cnt[3] = {};
    REP(i, 0, s.size()) {
        cnt[s[i] - 'a']++;
    }

    if (max(max(cnt[0], cnt[1]), cnt[2]) - min(min(cnt[0], cnt[1]), cnt[2]) > 1) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
    return 0;
}

Measured memory_bytes: 512
s = input()
n = len(s)-1
ans = 0

for bit in range(1 << n):
    f = s[0]

    for i in range(n):
        if bit & (1 << i):
            f += "+"
        f += s[i+1]
    
    ans += sum(list(map(int, f.split("+"))))

print(ans)

Measured memory_bytes: 71912
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;

vector<bool> eratosthenes(int n) {
	vector<bool> prime(n + 1);
	for (int i = 2; i <= n; i++) {
		prime[i] = true; // 初期化
	}
	prime[0] = prime[1] = false;
	for (int i = 2; i*i <= n;i++) {
		if (prime[i]) {
			for (int j = i * 2; j <= n; j += i) {
				prime[j] = false;
			}
		}
	}
	return prime;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

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

	vector<bool> prime = eratosthenes(n);
	ll ans = 1;
	int kj = 1;
	for (int i = 2; i <= n; i++) {
		kj *= i;
	}
	for (int i = 2; i <= n; i++) {
		if (prime[i]) {
			int e = 0;
			for (int j = i; j <= n; j *= i) {
				e += (n / j);
			//	cout << i << " " << j << " " << e << endl;
			}
			ans = (ans * (e + 1) % 1000000007);
			//cout << i << " " << e << endl;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 888
#include <stdio.h>

int main (void)
{
	int height[10];
	int i;
	int highest[3];

	for(i=0;i<10;i++){
		scanf("%d", &height[i]);
	}

	for(i=0;i<3;i++){
		highest[i]=0;
	}

	for(i=0;i<10;i++){
		if(height[i]>highest[0]){
			highest[2]=highest[1];
			highest[1]=highest[0];
			highest[0]=height[i];
		} else if (height[i]>highest[1]){
			highest[2]=highest[1];
			highest[1]=height[i];
		} else if (height[i]>highest[2]){
			highest[2]=height[i];
		}
	}

	for(i=0;i<3;i++){
		printf("%d\n", highest[i]);
	}

	return 0;
}

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

using namespace std;

int main(){
	long long n, k;
	cin >> n >> k;
	long long a = n % k;
	long long b = a - k;
	long long c = abs(b);
	if (a > c) {
		cout << c << endl;
	}
	else {
		cout << a << endl;
	}
	return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

import qualified Data.Map.Strict as Map

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	m1 <- readMap
	m2 <- readMap
	putStrLn $ which "YES" "NO" $ Map.isSubmapOfBy (<=) m2 m1

readMap :: IO ( Map.Map Int Int )
readMap = getLine >> getList >>= return . foldl f Map.empty

f m a
	| Map.lookup a m /= Nothing = Map.adjust succ a m
	| otherwise = Map.insert a 1 m


Measured memory_bytes: 66940
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        if(a<b){
        System.out.println("a < b");
        }else if (b<a){
        System.out.println("a > b");
        }else if(a==b){
        System.out.println("a == b");
        }
        
    }
}    
          

Measured memory_bytes: 25964
#include <stdio.h>
#include <string.h>
int main(){
  char s[10];
  scanf("%10s", s);
  int jud1=0, jud2=0, jud3=0, count=0;
  if(s[0]=='A')
    jud1=1;
  for(int i=2; i<strlen(s)-1; i++){
    if(s[i]=='C'){
      jud2=1;
      count++;
    }
  }
  for(int i=0; i<strlen(s); i++){
    if('A'<=s[i] && s[i]<='Z')
      jud3++;
  }
  if(s[strlen(s)]=='C')
    jud2=0;
  if(jud1==1 && jud2==1 && jud3==2 && count==1)
    printf("AC\n");
  else
    printf("WA\n");
  
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    string S;
    io.read(S);
    set<char> st;
    string ans = "yes";
    for(int i = 0; i < S.size(); i++){
        if(st.find(S[i]) != st.end()){
            ans = "no";
            break;
        }
        st.insert(S[i]);
    }
    cout << ans;
    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();
        final int T = sc.nextInt();
        final int A = sc.nextInt();
        final int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = sc.nextInt();
        }

        int index = -1;
        double min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            double x = T - H[i] * 0.006;
            if (Math.abs(A-x) < min) {
                index = i;
                min = Math.abs(A-x);
            }
        }

        System.out.println(index+1);
    }
}


Measured memory_bytes: 23780
#include"bits/stdc++.h"
using namespace std;


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

	if (a == 'H') {
		if (b == 'H') {
			cout << "H" << endl;
		}
		else
			cout << "D" << endl;
	}
	else {
		if (b == 'H')
			cout << "D" << endl;
		else
			cout << "H" << endl;
	}
}

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

int main(){
  ll n; int p;
  string s;
  cin >> n >> p;
  cin >> s;
   ll ans = 0;
  if(p==2 || p==5){
     reverse(s.begin(),s.end());
     for(ll i = 0; i < n; i++){
         if((s[i]-'0')%p ==0) ans += n-i;
    }
  cout << ans <<endl;
  return 0;
  }
   reverse(s.begin(), s.end());
   ll ten = 1;
   ll d[n+5]={0};
   for(ll i=0;i<n;i++){
    ll a = (s[i]-'0')*ten%p;
    ten = ten*10%p;
    d[i+1] = (d[i]+ a)%p;
    }
    ll cnt[p+1]={0};
    for(ll i =0; i<=n;i ++){
       cnt[d[i]]++;
   }
   for(ll i=0; i<p;i ++){
        ll k = cnt[i];
        ans += k*(k-1)/2;
   }
   cout << ans<< endl;
}
       

Measured memory_bytes: 2180
from collections import defaultdict

dic = defaultdict(list)
keys = set()
n = int(input())
acc = 0
dic[0].append(0)
keys.add(0)
for i in range(1, n + 1):
  d = int(input())
  acc += d
  dic[acc].append(i)
  keys.add(acc)

ans = 0
for key in keys:
  lst = dic[key]
  ans = max(ans, max(lst) - min(lst))

print(ans)


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

int main() {
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;

    if (s == u) a--;
    if (t == u) b--;

    cout << a << " " << b << endl;

    return 0;
}


Measured memory_bytes: 256
def prim():
    distance[0] = 0
    parent[0] = -1

    while True:
        mincost = float('inf')
        for i in range(n):
            if color[i] != 'black' and distance[i] < mincost:
                mincost = distance[i]
                u = i
        if mincost == float('inf'):
            break

        color[u] = 'black'

        for v in range(n):
            if color[v] != 'black' and adjMat[u][v] != float('inf'):
                if adjMat[u][v] < distance[v]:
                    distance[v] = adjMat[u][v]
                    parent[v] = u
                    color[v] = 'gray'


n = int(input())
color = ['white'] * n
parent = [-1] * n
distance = [float('inf')] * n

adjMat = [[0] * n for _ in range(n)]
for i in range(n):
    adjRow = list(map(int, input().split()))
    for v, weight in enumerate(adjRow):
        if weight == -1:
            adjMat[i][v] = float('inf')
        else:
            adjMat[i][v] = weight

prim()

print(sum(distance))

Measured memory_bytes: 7932
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
typedef long long LL;
#define ms(a,b) memset(a,b,sizeof(a))
# define eps 1e-8

double spd=0.0;
double ans=0.0;
double t[105],v[105];
double ev[105];

int main()
{
    char s[10],t[10];
    cin>>s>>t;
    if(s[0]==t[2]&&s[1]==t[1]&&s[2]==t[0]) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


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

int main() {

    int N, count=0, maximum=-100;
    string S;
    cin >>N>>S;

    for (int i = 0; i < N; ++i) {
        if(S[i] == 'I'){
            count++;
        }
        else {
            count--;
        }
        maximum=max(count,maximum);
    }
    if(maximum<0) maximum=0;
    printf("%d\n",maximum);

    return 0;
}

Measured memory_bytes: 256
n=int(input())
lis=[[int(i) for i in input().split()] for j in range(n)] 
for i in range(n):
  lis[i].reverse()
lis.sort()
a=0
b=0
ans=0
for i in range(n):
  a+=lis[i][1]
  b=lis[i][0]
  if a>b:
    ans=1
    break
if ans==1:
  print("No")
else:
  print("Yes")

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

typedef struct {
  char num[2];
  int  value;
}Roll;

void BubbleSort(Roll *);
void isStable(Roll * ,Roll *);

int N;

int main(){
  Roll *Cin;
  Roll *C;
  Roll *C1;
  int i,j;
  Roll c;
  int mini;

  scanf("%d",&N);
  C=(Roll *)malloc(N*sizeof(Roll));
  Cin=(Roll *)malloc(N*sizeof(Roll));
  C1=(Roll *)malloc(N*sizeof(Roll));
  for(i=0;i<N;i++){
    scanf("%s",C[i].num);
    C1[i].num[0]=C[i].num[0];
    C1[i].num[1]=C[i].num[1];
    Cin[i].num[0]=C[i].num[0];
    Cin[i].num[1]=C[i].num[1];

    C[i].value=C[i].num[1]-'0';
    C1[i].value=C[i].num[1]-'0';
    Cin[i].value=C[i].num[1]-'0';
  }
  BubbleSort(C1);

  for(i=0;i<N;i++){
    mini=i;
    for(j=i;j<N;j++){
      if(C[j].value<C[mini].value)
	mini=j;
    }
    c=C[i];
    C[i]=C[mini];
    C[mini]=c;
  }
  for(i=0;i<N-1;i++) printf("%s ",C[i].num);
  printf("%s\n",C[i].num);
  isStable(C,Cin);
}

void isStable(Roll *in,Roll *out){
  int i,j;
  int a,b;  
  for(i=0;i<N;i++){
    for(j=i+1;j<N;j++){
      for(a=0;a<N;a++){
	for(b=a+1;b<N;b++){
	  if(in[i].value==in[j].value&&in[i].num[0]==out[b].num[0]&&in[j].num[0]==out[a].num[0]){
	    printf("Not stable\n");
	    return;
          }
        }
      }
    }
  }
printf("Stable\n");	
return;
}
	
void BubbleSort(Roll *C){
int i,j;
Roll c;
for(i=0;i<N;i++){
    for(j=N-1;j>i;j--){
      if(C[j].value<C[j-1].value){
        c=C[j];
        C[j].num[0]=C[j-1].num[0];
        C[j].num[1]=C[j-1].num[1];
        C[j].value=C[j-1].value;
        C[j-1].num[0]=c.num[0];
        C[j-1].num[1]=c.num[1];
        C[j-1].value=c.value;
      }
    }
  }

  for(i=0;i<N-1;i++) printf("%s ",C[i].num);
  printf("%s\n",C[i].num);
  printf("Stable\n");
}



Measured memory_bytes: 2084
n = int(input())

coins = [9**5,6**6,6**5,9**4,6**4,9**3,6**3,9**2,6**2,9,6,1]

res = n

dp = [-1]*(n+1)
dp[0] = 0
min_coins = [-1]*(n+1)
for i in range(1,n+1):
    min_c = n+1 
    c = 0
    for coin in coins:
        if coin <= i:
            #find first coin no more than i
            if dp[i-coin] != -1 and 1 + dp[i-coin]<min_c:
                min_c = 1+dp[i-coin]
                c = coin
    if min_c == n+1:
        dp[i] = -1
    else:
        dp[i] = min_c
        min_coins[i] = c
print(dp[n])
'''
money = n
for i in range(dp[n]):
    print(min_coins[money])
    money-=min_coins[money]
'''


Measured memory_bytes: 4596
import java.util.Scanner;
import java.lang.Math;

public class Main{

    public static void main(String[] args) {
        Scanner input1 = new Scanner(System.in);
        int len = input1.nextInt();
        int total = 0;
        int num;
        int sqrted;
        boolean isPrime;

        for (int i = 0; i < len; i++) {
            num = input1.nextInt();
            isPrime = true;
            sqrted =(int) Math.sqrt(num);

            for (int j = 2; j <= sqrted; j++) {
                if (num % j == 0) {
                    isPrime = false;
                    break;
                }
            }
            if (isPrime) {
                total++;
            }
        }
        System.out.println(total);
    }
}



Measured memory_bytes: 41276
#include <iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstring>
#include <map>
using namespace std;
typedef long long ll;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	int a, b, c, d; cin >> a >> b >> c >> d;
	while (1) {
		c -= b;
		if (c <= 0) {
			cout << "Yes" << '\n'; return 0;
		}
		a -= d;
		if (a <= 0) {
			cout << "No" << '\n'; return 0;
		}
	}



}

Measured memory_bytes: 3108
#from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

h1,m1,h2,m2,k = inm()
print(h2*60+m2-(h1*60+m1)-k)


Measured memory_bytes: 9188
#include <map>
#include <algorithm>
#include <cassert>
#include <climits>
#include <complex>
#include <cstdio>
#include <string>
#include <iostream>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmin(T &a, T b) { return a>b?(a=b,true):false; }
template<class T> bool chmax(T &a, T b) { return a<b?(a=b,true):false; }
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
#define bs2int(bs) (int)((bs).to_ulong())
#define FOR(i,x,y) for(int i=(x);i<(int)(y);i++)
#define FORP(i,x,y) for(int i=(x);i<=(int)(y);i++)
#define REP(i,y) for(int i=0;i<(int)(y);i++)
#define REPP(i,y) for(int i=1;i<=(int)(y);i++)
#define REPB(i,n) for(int i=(int)(n)-1;i>=0;i--)

template<int M, bool IsPrime = false>
class Modulo {
  using ll = long long;
  int n;
  static enable_if_t<IsPrime, ll> inv(ll a, ll p) {
    return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
  }
public:
  Modulo () : n(0) {;}
  Modulo (int m) : n(m) {
    if (n >= M) n %= M;
    else if (n < 0) n = (n % M + M) % M;
  }
  Modulo (ll m) {
    if (m >= M) m %= M;
    else if (m < 0) m = (m % M + M) % M;
    n = m;
  }
  explicit operator int() const { return n; }
  explicit operator ll() const { return n; }
  bool operator==(const Modulo &a) const { return n == a.n; }
  Modulo operator+=(const Modulo &a) { n += a.n; if (n >= M) n -= M; return *this; }
  Modulo operator-=(const Modulo &a) { n -= a.n; if (n < 0) n += M; return *this; }
  Modulo operator*=(const Modulo &a) { n = (ll(n) * a.n) % M; return *this; }
  Modulo operator+(const Modulo &a) const { Modulo res = *this; return res += a; }
  Modulo operator-(const Modulo &a) const { Modulo res = *this; return res -= a; }
  Modulo operator*(const Modulo &a) const { Modulo res = *this; return res *= a; }
  Modulo operator^(int n) const {
    if (n == 0) return Modulo(1);
    const Modulo a = *this;
    Modulo res = (a * a) ^ (n / 2);
    return n % 2 ? res * a : res;
  }
  enable_if_t<IsPrime, Modulo> operator/(const Modulo &a) const {
    return *this * inv(ll(a), M);
  }
};

const int mod = 1000000007;
using Mod = Modulo<mod, true>;

int n;
vector<string> s(2);

int main() {
  cin>>n;
  cin>>s[0]; cin>>s[1];
  vector<char> B;
  REP(i,n)
  {
    if (s[0][i]==s[1][i]) B.push_back('v');
    else B.push_back('h'),i++;
  }
  Mod cnt=(B[0]=='v'?3:3*2);
  FOR(i,1,B.size())
  {
    if (B[i-1]=='v'&&B[i]=='v') cnt*=2;
    if (B[i-1]=='v'&&B[i]=='h') cnt*=2;
    if (B[i-1]=='h'&&B[i]=='h') cnt*=3;
    if (B[i-1]=='h'&&B[i]=='v') cnt*=1;
  }
  cout << int(cnt) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using P=pair<int,int>;

signed _main(){
  int X,Y,Z; cin >> X >> Y >> Z;
  swap(X,Y);
  swap(X,Z);
  cout << X << " " << Y << " " << Z << endl;
  return 0;
}


Measured memory_bytes: 256
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
const int inf = 1e9;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
//	#ifndef ONLINE_JUDGE
  //  	freopen("input.txt", "r", stdin);
 //   	freopen("output.txt", "w", stdout);
//	#endif
	int n,k,s;
	cin>>n>>k>>s;
	if(n == k){
		rep(i,n){
			cout<<s<<" "; 
		}
	}	
	else{
		int a = (s+1)/2;
		int b = s/2;
		if(s == 1){
			rep(i,k){
				cout<<1<<" ";
			}
			repa(i,k,n){
				cout<<inf<<" ";
			}
			return 0;
		}
		rep(i,k+1){
			if(i%2)cout<<a<<" ";
			else cout<<b<<" ";
		}
		repa(i,k+1,n){
			if(s == inf)cout<<1<<" ";
			else cout<<inf<<" ";
		}
	}
	return 0;
}

Measured memory_bytes: 1280
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();
		
		if(a == b) {
			System.out.println("Draw");
			
		} else if((a > b && b!=1) || a == 1) {
			System.out.println("Alice");
			 
		} else {
			System.out.println("Bob");
			
		}		
  	}
}


Measured memory_bytes: 23764
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    seika s;
    cin >> s;
    bool ok = s[2] == s[3] && s[4] == s[5];
    cout << (ok ? "Yes" : "No") << endl;
}

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


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int n,ans=0;
  scanf("%d",&n);
  int p[n+1];
  for(int i=1;i<=n;i++){
    scanf("%d",&p[i]);
  }
  
  for(int i=2;i<=n-1;i++){
    if((p[i-1]<p[i] && p[i]<=p[i+1]) || (p[i-1]>=p[i] && p[i]>p[i+1])){
      ans+=1;
    }
  }
  
  printf("%d",ans);
  return 0;
}

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

class line
{
public:
    long long a;
    long long b;

    line()
    {
        ;
    }

    line(long long A, long long B)
    {
        a = A;
        b = B;
    }

    long long eval(long long x)
    {
        return a*x + b;
    }
};

vector<line> L;

void insert(line k)
{
    if(L.size() <= 1) L.push_back(k);
    else
    {
        line l1 = L[L.size()-2];
        line l2 = L[L.size()-1];
        if((l2.b - l1.b) >= ((l2.b - k.b)/(k.a - l2.a))*(l1.a - l2.a))
        {
            L.pop_back();
            insert(k);
        }
        else L.push_back(k);
    }
}

long long b_search(long long x, long long a, long long b)
{
    if(a == b) return L[a].eval(x);
    long long m = (a+b)/2;
    if((L[m+1].b - L[m].b) < x*(L[m].a - L[m+1].a)) return b_search(x, m+1, b);
    else return b_search(x, a, m);
}

int main()
{
    long long N, C;
    cin >> N >> C;

    long long h[N+1];
    for(long long i = 1; i <= N; i++) cin >> h[i];

    long long DP[N+1];
    DP[1] = 0;
    insert(line(-2*h[1], h[1]*h[1]));
    for(long long i = 2; i <= N; i++)
    {
        DP[i] = C + h[i]*h[i] + b_search(h[i], 0, L.size()-1);
        insert(line(-2*h[i], DP[i] + h[i]*h[i]));
    }
    cout << DP[N] << '\n';
    return 0;

    //DP[1] = 0;
    //DP[i] = C + h[i]^2 + min{1 <= j < i; (-2*h[j])*h[i] + (DP[j] + h[j]^2)}
}

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

using ui = unsigned int;
using ll = long long;
using ull = unsigned long long;
using str = string;
using bl = bool;
using ch = char;

template<class T> using v = vector<T>;
template<class T> using uset = unordered_set<T>;
template<class T1, class T2> using umap = unordered_map<T1, T2>;

template<class T> void pd(T x)
{
    cout << x << " ";
}
template<class T> void pl(T x)
{
    cout << x << endl;
}

#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define sz(x) ((int)(x).size())
#define ph push_back
#define pp pop_back
#define mp make_pair
#define rep(i, a) for(int i = 0; i < (int)a; ++i)
#define repd(i, a) for(int i = (int)a; i >= 0; --i)
#define REP(i, a, b) for(int i = a; i < (int)b; ++i)
#define REPD(i, a, b) for(int i = (int)a; i >= b; --i)
#define fore(i, a) for(auto& i : a)
#define FORE(i, a) for(auto i : a)

// -----



int main()
{
    int k;
    string s;
    cin >> k >> s;
    
    if(sz(s) <= k)
    {
        pl(s);
        return 0;
    }
    pl(s.substr(0, k) + "...");
}

Measured memory_bytes: 3632
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split(/\n/);
const word = input[0];
let count = 0;
for (let i = 1; i < input.length; i++) {
    let str = input[i].split(' ');
    if (input[i] === 'END_OF_TEXT') {
        break;
    }
    for (let j = 0; j < str.length; j++) {
        if (word.toLowerCase() === str[j].toLowerCase()) {
            count++;
        }
    }
}
 console.log(count);



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

int main() {
  int n, h;
  cin >> n >> h;
  vector<int> a(n), b(n);
  rep(i,n) cin >> a[i] >> b[i];
  sort(a.begin(),a.end());
  int max_a = a[n-1];
  sort(b.begin(),b.end());
  reverse(b.begin(),b.end());
  int cnt = 0;
  while (h > 0 && b[cnt] >= max_a) {
    h -= b[cnt];
    cnt++;
  }
  while (h > 0) {
    h -= max_a;
    cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		if (k % 2 == 0) {
			System.out.println((k / 2) * (k / 2));
		} else {
			System.out.println((k / 2) * (k / 2 + 1));
		}
	}
}

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

#define ll long long
#define pb push_back
#define vi vector<int>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define sizeOf(A) (sizeof(A))/(sizeof(A[0]))
#define odd(x) ((x) % (2))
#define fastio ios_base::sync_with_stdio(false), cin.tie(0);
const ll MOD = 1e9 + 7;

int main() {
    fastio;

    string s;
    cin >> s;
    bool ispalindrome = true;
    FOR(i, 0, s.size()/2) {
        if (s[i] != s[s.size()-i-1]) {
            ispalindrome = false;
            break;
        }
    }
    (ispalindrome) ? cout << "Yes\n" : cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
const int MOD=1e9+7;
using pii=std::pair<int,int>;
using namespace std;

int a, b, k;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> k >> a >> b;
    int good = 0;
    for(int i = a; i <= b; i++)
        if(i % k == 0)
            good = 1;
    if(good)
        cout << "OK\n";
    else
        cout << "NG\n";
    return 0;
}

Measured memory_bytes: 3648
#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<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n;
  cin>>n;
  vll a(n);
  REP(i,n)cin>>a[i];

  ll ans=0;
  map<ll,ll>l,r;
  REP(i,n){
    ll target=i+1-a[i];
    ans += l[target];

    l[i+1+a[i]]+=1;
  }

  cout<<ans<<endl;
}



Measured memory_bytes: 27332
temp = input().split(" ")

temp = [int(i) for i in temp]

x = temp[0]
y = temp[1]

flag = False

for i in range(0, 101):
    if flag:
        break
    for j in range(0, 101):
        if flag:
            break

        total = i + j
        foots = 2 * i + 4 * j

        if total == x and foots == y:
            print('Yes')
            flag = True

if not flag:
    print('No')

Measured memory_bytes: 9192