akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int timeten(int time)
{
    int current = time/10;
    if(time%10 > 0){
        current ++;
    }
    return current;
}

int judge(int timea, int timeb)
{
    timea = timea%10;
    timeb = timeb%10;

    if(timea == 0){
        timea = 10;
    }
    if(timeb == 0){
        timeb = 10;
    }

    int judge;

    if(timea <= timeb){
        judge = timea;
    }else{
        judge = timeb;
    }

    return judge;
}

int main()
{
    int numa, numb, numc, numd, nume;
    cin >> numa >> numb >> numc >> numd >> nume;

    int time = 0;
    time += timeten(numa);
    time += timeten(numb);
    time += timeten(numc);
    time += timeten(numd);
    time += timeten(nume);

    time = time * 10;

    int i;
    i = judge(numa,numb);
    i = judge(i,numc);
    i = judge(i,numd);
    i = judge(i,nume);

    cout << time -10 + i <<endl;
    
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AEatingSymbolsEasy solver = new AEatingSymbolsEasy();
        solver.solve(1, in, out);
        out.close();
    }

    static class AEatingSymbolsEasy {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            out.println(in.nextString().chars().filter(c -> c == '+').count() * 2 - 4);
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

    }
}



Measured memory_bytes: 26580
#include <bits/stdc++.h>
using namespace std;
# define ll long long
# define endl "\n"
# define str string
# define vll vector<ll>
# define pb push_back
# define mll map<ll,ll>
# define mp make_pair
# define ff first
# define ss second
# define pll pair<ll,ll>
# define f(x,y) for(int x=0;x<y;x++)
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll x;
    cin>>x;
    ll a[x];
    f(i,x){
        cin>>a[i];
    }
    ll ans=0;
    for(ll i=0;i<x;i++){
        for(ll j=i+1;j<x;j++){
            for(ll k=j+1;k<x;k++){
                vll v;
                v.pb(a[i]);
                v.pb(a[j]);
                v.pb(a[k]);
                sort(v.begin(),v.end());
                mll m;
                m[a[i]]++;
                m[a[j]]++;
                m[a[k]]++;
                if(m.size()==3){
                if(v[0]+v[1] >v[2]){
                    ans++;
                }
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int n,x;
  
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    bool found;
    while(cin >> n >> x)
    {
        x /= 1000;
        found = false;
        for(int a = 0; a <= n && !found; a++)
            for(int b = 0; b <= n - a && !found; b++)
            {
                int c = n - a - b;
                if(a * 10 + b * 5 + c == x)
                {
                    cout << a << " " << b << " " << c << '\n';
                    found = true;
                }
            }
        if(!found)
            cout << "-1 -1 -1" << '\n';
    }
    return 0;
} 

Measured memory_bytes: 256
# abc115_b.py
# https://atcoder.jp/contests/abc115/tasks/abc115_b

# B - Christmas Eve Eve /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# とある世界では、今日はクリスマスイブの前日です。
# 高羽氏は、デパートで N個の品物を買おうとしています。i 個目の品物 (1≤i≤N) の定価は pi円です。
# 彼は割引券を持っており、N個のうち最も定価が高い品物 1 個を定価の半額で買うことができます。
# 残りの N−1個の品物に対しては定価を支払います。支払金額は合計でいくらになるでしょうか？

# 制約
#     2≤N≤10
#     100≤pi≤10000
#     piは偶数である。

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N
# p1
# p2
# :
# pN

# 出力
# 合計支払金額を (整数として) 出力せよ。

# 入力例 1
# 3
# 4980
# 7980
# 6980

# 出力例 1
# 15950

# 7980円の品物が半額になり、合計 4980+7980/2+6980=15950円です。
# 15950.0 などと出力すると Wrong Answer と判定されるので注意してください。

# 入力例 2
# 4
# 4320
# 4320
# 4320
# 4320

# 出力例 2
# 15120

# 4個の品物のうち 1 個だけが半額になり、合計 4320/2+4320+4320+4320=15120 円です。


def calculation(lines):
    # X = lines[0]
    N = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    values = list()
    for i in range(N):
        values.append(int(lines[i+1]))

    result = sum(values) - int(max(values)/2)

    return [result]


# 引数を取得
def get_input_lines():
    line = input()
    N = int(line)
    lines = list()
    lines.append(line)
    for _ in range(N):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['3', '4980', '7980', '6980']
        lines_export = [15950]
    if pattern == 2:
        lines_input = ['4', '4320', '4320', '4320', '4320']
        lines_export = [15120]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines()
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


Measured memory_bytes: 9216
A = gets.to_i#Aは500円玉の枚数
B = gets.to_i#Bは100円玉の枚数
C = gets.to_i#Cは50円玉の枚数
X = gets.to_i#Xは目標金額
ans = 0

for h in 0..A do
    for i in 0..B do
        for j in 0..C do
            if h * 500 + 100 * i + 50 * j == X
                ans = ans + 1
            end
        end
    end
end

puts ans

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n;
  cin >> n;
  vec l(n),r(n);
  ll mxl=0,mnr=inf,mlr=0;
  for(ll i=0;i<n;i++) {
    cin >> l[i] >> r[i];
    r[i]++;
    mxl=max(mxl,l[i]);
    mnr=min(mnr,r[i]);
    mlr=max(mlr,r[i]-l[i]);
  }
  ll ans=mlr+max(0LL,mnr-mxl);
  vector<pll> a(n);
  for(ll i=0;i<n;i++) {
    a[i].first=r[i]-mxl;
    a[i].second=mnr-l[i];
  }
  sort(a.begin(),a.end());
  ll mn=a[0].second;
  for(ll i=0;i<n;i++) {
    ans=max(ans,mn+a[i].first);
    mn=min(mn,a[i].second);
  }
  cout << ans << endl;
}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long a, b, n, x;
	cin >> a >> b >> n;
	x = min(b-1,n);
	cout << floor(a*x/b) << "\n";
	return 0;
}

Measured memory_bytes: 3816
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    vector<vector<int>> dp(n + 1, vector<int>(k + 1));
    dp[0][0] = 1;
    rep(i, n){
        rep(j, k){
            dp[i][j+1] += dp[i][j];
            dp[i][j+1] %= MOD;
        }
        rep(j, k + 1){
            int culc = dp[i][j] + MOD;
            if(j - a[i] > 0){
                culc -= dp[i][j-a[i]-1];
            }
            culc %= MOD;;
            dp[i+1][j] += culc;
            dp[i+1][j] %= MOD;
        }
    }
    cout << dp[n][k] << endl;

    return 0;
}


Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
// template<class t, class u>
// ostream& operator<<(ostream& os, const pair<t, u>& p) {
//   return os << "{" << p.first << ", " << p.second << "}";
// }
// template<class t> ostream& operator<<(ostream& os, const vector<t>& v) {
//   os << "{";
//   rep(i, v.size()) { if(i) os << ", "; os << v[i]; }
//   return os << "}";
// }
// template<class t> ostream& operator<<(ostream& os, const set<t>& se) {
//   os << "{";
//   auto itr = se.begin();
//   rep(i, se.size()) { if(i) os << ", "; os << *itr; itr++; }
//   return os << "}";
// }
// template<class t, class u>
// ostream& operator<<(ostream& os, const map<t, u>& mp) {
//   os << "{";
//   auto itr = mp.begin();
//   rep(i, mp.size()) { if(i) os << ", "; os << *itr; itr++; }
//   return os << "}";
// }
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

struct UnionFind {
  vector< int > data;

  UnionFind(int sz) {
    data.assign(sz, -1);
  }

  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }

  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k) {
    return (-data[find(k)]);
  }
};

int main() {

  ll N, M, K;
  cin >> N >> M >> K;
  vector< pair<ll, ll> > ab(M);
  vector< pair<ll, ll> > cd(K);
  ll tomo[N];
  REP(i, 0, N) {
    // tomo includes friend and block
    tomo[i] = 1; // 1 is myself
  }
  ll temp1, temp2;
  REP(i, 0, M) {
    cin >> temp1 >> temp2;
    ab[i] = make_pair(temp1 - 1, temp2 - 1);
    tomo[temp1 - 1]++;
    tomo[temp2 - 1]++;
  }
  REP(i, 0, K) {
    cin >> temp1 >> temp2;
    cd[i] = make_pair(temp1 - 1, temp2 - 1);
    // tomo[temp1 - 1]++;
    // tomo[temp2 - 1]++;
  }

  UnionFind uf(100000000);
  REP(i, 0, M) {
    // cout << "first: " << ab[i].first << ", second: " << ab[i].second << endl;
    uf.unite(ab[i].first, ab[i].second);
  }
  // cout << uf.find(1) << endl;

  vector<ll> ans;
  REP(i, 0, N) {
    ans.push_back(uf.size(i) - tomo[i]);
  }
  REP(j, 0, K) {
    if (uf.find(cd[j].first) == uf.find(cd[j].second)) {
      ans[cd[j].first]--;
      ans[cd[j].second]--;
    }
  }

  REP(i, 0, N) {
    cout << max(ans[i], (ll)0) << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 396276
#include<bits/stdc++.h>
using namespace std;
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(n) for(int i=0;i<n;i++)
#define ll long long
ll mob=1000000007;
using namespace std;
int d[100000];int c1[10000];
int main()
{ 
int r,g,a,b,c;
std::cin >> r>>g>>a>>b>>c;
int r1[a],g1[b];
int sum=0;int sum1=0;
FOR(a) cin>>r1[i];
FOR(b) cin>>g1[i];
FOR(c) cin>>c1[i];
sort(r1,r1+a,greater<int>());
sort(g1,g1+b,greater<int>());
sort(c1,c1+c);
vector<int> h;
FOR(r)
{h.push_back(r1[i]);
}
FOR(g)
{
    h.push_back(g1[i]);
}
FOR(c)

{
        h.push_back(c1[i]);
}
sort(h.begin(),h.end(),greater<int>());


    
    

ll t=0;
ll u=r+g;
FOR(u)
{
    t+=h[i];
}

cout<<t;


return 0;
}


Measured memory_bytes: 3572
import java.util.Scanner;

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

        int n = stdIn.nextInt();

        long sum = 0;
        for(int i=1; i<=n; i++){
            if(i%3!=0 && i%5!=0){
                sum += i;
            }
        }

        System.out.println(sum);
    }
}

Measured memory_bytes: 35856
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <tuple>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rep1(i, n) for(int i=1; i<=n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
#define countof(array) (sizeof(array) / sizeof(array[0]))
typedef long long ll;

#define MAX_N 100000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string ab = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string as = {"abcdefghijklmnopqrstuvwxyz"};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

void yes() {
  cout << "Yes" << endl;
}

void no() {
  cout << "No" << endl;
}

void print_array(int array[], int len) {

  for(int i=0; i<len; ++i) {
    cout << array[i] << endl;
  }

}

ll absolute(ll x) {
  return (x<0)? (-1)*x : x;
}

//g++ AtCoder.cpp -o AtCoder
//AtCoder

//--------------------------
//提出するときC++に帰る
//--------------------------

int N, M, Q;
ll ans = 0;
int A[51], B[51], C[51], D[51];

void dfs(vector<int> v, int cnt, int las) {

  if(cnt==N) {
    ll res = 0;
    rep(i, Q) {
      if(v[B[i]]-v[A[i]] == C[i]) res += D[i];
    }
    ans = max(ans, res);
    return;
  }

  rrep(i, las, M+1) {
    vector<int> nv = v;
    nv.push_back(i);
    dfs(nv, cnt+1, i);
  }

}

void solve() {

  cin >> N >> M >> Q;
  rep(i, Q) {
    cin >> A[i] >> B[i] >> C[i] >> D[i];
    A[i]--, B[i]--;
  }

  vector<int> v;
  dfs(v, 0, 1);

  cout << ans << endl;
}

int main() {

  solve();

  return 0;
}


Measured memory_bytes: 3624
#include"bits/stdc++.h"

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7



int main()
{
	int N;
	cin >> N;
	set<set<ll>> st;
	if (N % 2 == 0) {
		FOR(i, 1, N)st.insert({ i,N + 1 - i });
	}
	else {
		FOR(i, 1, N-1)st.insert({ i,N - i });
	}

	vector<string> res;
	FOR(i, 1, N)FOR(j, i + 1, N + 1)if (st.find({ i,j }) == st.end()) {
		stringstream ss;
		ss << i << " " << j;
		res.push_back(ss.str());
	}
	cout << res.size() << endl;
	for (auto row : res)cout << row << endl;

	return 0;
}


Measured memory_bytes: 512
from heapq import heappush, heappop

N, M = map(int, input().split())
jobs = [[] for _ in range(M)]

for i in range(N):
  ab = list(map(int, input().split()))
  #Ai > M の仕事はいらない
  if ab[0] <= M:
    jobs[ab[0] - 1].append(ab[1])

#最終日はAi=1の仕事のみ選べる。その前の日はAi<=2, ...
#終わりから考えればよさそう
hq = []
ans = 0
for i in range(M):
  for b in jobs[i]:
    heappush(hq, -1 * b)
  if len(hq) > 0:
    m = -1 * heappop(hq)
    ans += m

print(ans)

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

int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  int cnt = 0;
  for (int i = 0; i < N; i++) cin >> p[i];
  for (int i = 0; i < N-1; i++) {
    if (p[i] == i+1) {
      swap(p[i], p[i+1]);
      cnt++;
    }
  }
  for (int i = N-1; i > 0; i--) {
    if (p[i] == i+1) {
      swap(p[i], p[i-1]);
      cnt++;
    }
  }
  cout << cnt << endl;
}


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

#define MAX_INT 0x3f3f3f3f 
#define precision(x) setprecision(x)
#define boost ios_base::sync_with_stdio(false); 	cin.tie(NULL);

int main()
{
	boost;
	int n;
	cin >> n;
	vector<long long int> v;
	for(int i=0;i<n;i++)
	{
		long long int p;
		cin >> p;
		v.push_back(p);
	}
	sort(v.begin(),v.end(), greater<int> ());
	long long int ans=0;
	if(n==1)
	{
		cout << "0\n";
	}
	else if(n==2)
	{
		cout << v[0] << "\n"; 
	}
	else
	{
		ans+=v[0];
		int p = n-2;
		int z = p/2;
		for(int i=1;i<=z;i++)
		{
			ans+=2*v[i];
		}
		if(p%2==0)
		{
			cout << ans << "\n";
		}
		else
		{
			cout << ans + v[z+1] << "\n";
		}
	}
}

Measured memory_bytes: 5340
#include <iostream>
#include <cstdio>


int main(){


  double r = 0 , area = 0 , shu = 0 ;


  scanf("%lf",&r);


  area = (double) r * r * 3.141592653589 ;

  shu = (double) 2 * 3.141592653589 * r ;


  printf("%f %f\n",area ,shu);


  return 0;

}

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

const int a_coin = 500;
const int b_coin = 100;
const int c_coin = 50;

void solve(long long A, long long B, long long C, long long X){
  int count = 0;
  for (int a = 0; a <= A; a++) {
    for (int b = 0; b <= B; b++) {
      for (int c = 0; c <= C; c++) {
        if (a_coin * a + b_coin * b + c_coin * c == X) {
          count++;
        }
      }
    }
  }

  cout << count << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long X;
    scanf("%lld",&X);
    solve(A, B, C, X);
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  int N, A, B, C, D; cin >> N >> A >> B >> C >> D; A--; B--; C--; D--;
  string S; cin >> S;
  int snow = A, tnow = B; 
  while (snow!=C) { 
    snow++;
    if (S[snow]=='#') {
      snow++;
      if (S[snow]=='#') { cout << "No" << endl; return 0; }
    }
  }
    while (tnow!=D) { 
    tnow++;
    if (S[tnow]=='#') {
      tnow++;
      if (S[tnow]=='#') { cout << "No" << endl; return 0; }
    }
  }

  string result = "No";
  if (C<D) result = "Yes";
  else {
    repr(i,B,D+1) {
      if (S[i-1]=='.'&&S[i]=='.'&&S[i+1]=='.') {
        result = "Yes";
      }
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <queue>
#define MAXN 110
typedef long long lnt;
int n, head[MAXN], to[MAXN << 1], next[MAXN << 1], tot = 0;
inline void $(int u, int v) {
	next[tot] = head[u], to[tot] = v, head[u] = tot++;
	next[tot] = head[v], to[tot] = u, head[v] = tot++;
}
std::queue<int> Q;
int vis[MAXN];
inline int farthest(int s) {
	memset(vis, 0, sizeof(vis));
	vis[s] = 1;
	Q.push(s);
	int t = s;
	while (Q.size()) {
		int x = Q.front();
		Q.pop();
		t = x;
		for (int i = head[x]; ~i; i = next[i]) {
			if (!vis[to[i]]) {
				vis[to[i]] = 1;
				Q.push(to[i]);
			}
		}
	}
	return t;
}
int path[MAXN], plen = 0;
bool dfs(int s, int t, int fa) {
	if (s == t) return path[++plen] = s, 1;
	for (int i = head[s]; ~i; i = next[i]) {
		if (to[i] == fa) continue;
		if (dfs(to[i], t, s)) return path[++plen] = s, 1;
	}
	return 0;
}
int count[MAXN], maxdeep;
void fill(int x, int deep, int fa) {
	int sc = 0;
	for (int i = head[x]; ~i; i = next[i]) {
		if (to[i] == fa) continue;
		sc++;
		fill(to[i], deep + 1, x);
	}
	if (sc) {
		count[deep] = std::max(count[deep], sc);
		maxdeep = std::max(maxdeep, deep);
	}
}
int main() {
	memset(head, -1, sizeof(head));
	for (int i = scanf("%d", &n), u, v; i < n; i++) scanf("%d%d", &u, &v), $(u, v);
	int x = farthest(1);
	int y = farthest(x);
	dfs(x, y, 0);
	printf("%d ", (plen + 1) / 2);
	if (plen & 1) {
		int x = path[plen / 2 + 1];
		fill(x, 1, 0);
		lnt ans = 1;
		for (int i = 1; i <= maxdeep; i++) ans *= count[i];
		for (int j = head[x]; ~j; j = next[j]) {
			memset(count, 0, sizeof(count));
			maxdeep = 0;
			fill(x, 1, to[j]);
			fill(to[j], 1, x);
			lnt tmp = 2;
			for (int i = 1; i <= maxdeep; i++) tmp *= count[i];
			ans = std::min(ans, tmp);
		}
		printf("%lld\n", ans);
	} else {
		int u = path[plen / 2];
		int v = path[plen / 2 + 1];
		fill(u, 1, v);
		fill(v, 1, u);
		lnt ans = 2;
		for (int i = 1; i <= maxdeep; i++) ans *= count[i];
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args){
 
        Scanner sc = null;
        sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int t = sc.nextInt();
        sc.close();
        int ans = 0;

        for (int i = 0; i < 1000; i++) {

            ans += t;
            n -= x;
            if (n <= 0) {
                break;
            }
        }

        System.out.println(ans);   
      }
}

Measured memory_bytes: 35688
import sys

def I(): return int(sys.stdin.readline().rstrip())
def S(): return sys.stdin.readline().rstrip()

N = I()
G = {}
for i in range(1,N+1):
    G[i] = []
for i in range(N-1):
    a,b,c = map(int,S().split())
    G[a].append((b,c))
    G[b].append((a,c))

Q,K = map(int,S().split())

from collections import deque

distance = [-1]*(N+1)  # arrive[i] = 頂点Kからの最短距離
distance[K] = 0

q = deque([K])
while q:
    a = q.pop()
    for b,c in G[a]:
        if distance[b] != -1:
            continue
        distance[b] = distance[a] + c
        q.appendleft(b)

for i in range(Q):
    x,y = map(int,S().split())
    print(distance[x] + distance[y])

Measured memory_bytes: 78180
#include <iostream>
#include <cmath>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

// y:年数, t:金利の種類(1:単利, 2:複利) r:年利率[%] 
double f(int y, int t, int r){
	if( t == 1 ){
		return 1.0 + y * r / 100.0; 
	}
	return pow( 1.0 + r / 100.0 , y );
}

int main(){
	int n;
	while( cin >> n, n ){
		int y;
		cin >> y;
		vector<pair<double,int> > v;
		for(int i=0 ; i < n ; i++ ){
			int b, r, t;
			cin >> b >> r >> t;
			v.push_back( pair<double,int>( f(y,t,r), b ) );
		}
		sort( v.rbegin() , v.rend() );
		cout << v[0].second << endl;
	}
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES

#include <iostream>
#include <math.h> 
#include <vector>
#include <algorithm>
#include <iomanip>      // std::setprecision
#include <map>
#include <unordered_map>
#include <string>
#include <set>
#include <unordered_set>

using namespace std;

int main()
{
	int N,sol=0, s_counter = 0;
	std::vector<int> nums;
	std::cin >> N;
	int sum = 0;
	for (int i = 0; i < N; i++)
	{
		int num;
		std::cin >> num;
		nums.push_back(num);
		sum += num;
	}
	int optimum_point = round(sum/(float)N);
	for (int i = 0; i < N; ++i)
	{
		sol += pow((optimum_point - nums[i]), 2);
	}
	std::cout << sol;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
signed main(){
    ll sum=0;
    ll n;cin>>n;
    REP(i,1,n+1){
        if(i%3!=0&&i%5!=0)sum+=i;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3620
import java.util.Arrays;
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

class Main{

	private void solve(){
		int n=gInt(),t=gInt();
		int[]v=INTS(n).toArray();
		int[]max=new int[n];
		max[n-1]=v[n-1];
		for(int i:rrep(n-2,0))
			max[i]=Math.max(v[i],max[i+1]);
		System.err.println(Arrays.toString(max));
		int maxincome=REP(n).map(i->max[i]-v[i]).max().getAsInt();
		System.out.println(REP(n).map(i->max[i]-v[i]).filter(i->i==maxincome).count());
	}
	public static void main(String[]$){
		new Main().solve();
	}

	Scanner s=new Scanner(System.in);

	int gInt(){
		return Integer.parseInt(s.next());
	}
	long gLong(){
		return Long.parseLong(s.next());
	}
	double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplierIterator<Integer> ints(int n){
		return new SupplierIterator<>(n,this::gInt);
	}
	SupplierIterator<Long> longs(int n){
		return new SupplierIterator<>(n,this::gLong);
	}
	SupplierIterator<Double> doubles(int n){
		return new SupplierIterator<>(n,this::gDouble);
	}
	SupplierIterator<String> strs(int n){
		return new SupplierIterator<>(n,s::next);
	}

	static class SupplierIterator<T> implements Iterable<T>,Iterator<T>{
		int			t;
		Supplier<T>	supplier;

		SupplierIterator(int t,Supplier<T> supplier){
			this.t=t;
			this.supplier=supplier;
		}

		@Override
		public Iterator<T> iterator(){
			return this;
		}

		@Override
		public boolean hasNext(){
			return t>0;
		}

		@Override
		public T next(){
			--t;
			return supplier.get();
		}
	}


	Range rep(int i){
		return Range.rep(i);
	}
	Range rep(int f,int t,int d){
		return Range.rep(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(f,t,-1);
	}

	static class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{

		int to,cur,d;

		Range(int from,int to,int d){
			this.cur=from-d;
			this.to=to;
			this.d=d;
		}

		Range(int n){
			this(0,n-1,1);
		}

		@Override
		public Iterator<Integer> iterator(){
			return this;
		}

		@Override
		public boolean hasNext(){
			return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
		}

		@Override
		public int nextInt(){
			return cur+=d;
		}

		static Range rep(int i){
			return new Range(i);
		}
		static Range rep(int f,int t,int d){
			return new Range(f,t,d);
		}
		static Range rep(int f,int t){
			return rep(f,t,1);
		}
		static Range rrep(int f,int t){
			return rep(f,t,-1);
		}
	}


	IntStream REP(int v){
		return IntStream.range(0,v);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return REP(n).map(i->gInt());
	}
	Stream<String> STRS(int n){
		return REP(n).mapToObj(i->s.next());
	}
}


Measured memory_bytes: 49272
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

int main()
{
    ll sum[500005] {0};
    for(int i = 1; i < 500001; i++){
        sum[i] = sum[i - 1] + i;
    }
    string s;
    cin >> s;
    ll n = s.size();
    ll last = 0;
    ll now = 1;
    ll ans = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == '<' && s[i + 1] == '<'){
            now++;
        }
        if(s[i] == '<' && s[i + 1] == '>'){
            ans += sum[now - 1];
            last = now;
            now = 1;
        }
        if(s[i] == '>' && s[i + 1] == '>'){
            now++;
        }
        if(s[i] == '>' && s[i + 1] == '<'){
            ans += sum[now - 1];
            ans += max(now, last);
            now = 1;
        }
    }
    ans += sum[now];
    cout << ans << endl;
}

Measured memory_bytes: 4740
// Sakhiya07 - Yagnik Sakhiya
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
 
#define mp make_pair
#define bp __builtin_popcountll
#define MOD  1000000007
const int N = 100005;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));
ll pre[12][1005];
void solve()
{
     ll h,w,K;
     cin >> h >> w >> K;
     string s[h];
     for(ll i=0;i<h;i++)   cin >> s[i];
     memset(pre,0,sizeof(pre)); 
     for(ll i=1;i<=w;i++)
     {
          for(ll j=1;j<=h;j++)   pre[j][i] = pre[j-1][i] + s[j-1][i-1] - '0';
     }
     ll ans = INT_MAX;
     ll ka = h-1;
     for(ll i=0;i<(1<<ka);i++)
     {
          ll chk = 1;
          ll sum = 0;
          vector<ll> v;
          v.pb(0);
          for(ll j=0;j<ka;j++)
          {
               if((i&(1<<j)))  v.pb(j+1);
          }
          v.pb(h);
          sum = v.size()-2;
          ll previous = 0;
          vector<ll> sum1(v.size()-1,0);
          for(ll j=1;j<=w;j++)
          {
               for(ll k=0;k<v.size()-1;k++)
               {
                    ll nxt = v[k+1];
                    ll pre1 = v[k];
                    sum1[k] += pre[nxt][j] - pre[pre1][j];
                    if(sum1[k]>K)
                    {
                         if(j-1==previous)
                         {
                              chk = 0;
                              break;
                         }    
                         else
                         {
                              sum++;
                              previous = j-1; 
                              j--;
                              for(ll l=0;l<sum1.size();l++)    sum1[l] = 0;
                              break;
                         }
                    }
               }
               if(!chk)   break;
          }
          if(chk)
          ans = min(ans,sum);
     }
     cout<<ans;
}

int main()
{
     FAST;
     ll t = 1;
   //  cin >> t;
     while(t--)
     {
          solve();
     }
}

Measured memory_bytes: 384
#include<iostream>
#include<set>
using namespace std;main(){for(long long n,w,s;cin>>n,n;cout<<s-w<<endl){multiset<int>c;multiset<int>::iterator i;for(;n-->0;c.insert(w))cin>>w;w=s=0;for(i=c.begin();i!=c.end();)s+=w+=*i++;}}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define ll long long
#define pb puhs_back
#define Int int64_t
using namespace std;

int N;
int main()
{
   cin>>N;
   string S;cin>>S;
   Int ans=1;
   for(int i=1;i<S.length();++i){
       ans+=(S[i]!=S[i-1]);
   }
   cout<<ans<<"\n";
}

Measured memory_bytes: 3732
from collections import defaultdict
import sys
input = sys.stdin.readline


def f(x):
    a = str(x)[-1]
    b = str(x)[0]
    return (b, a)


def main():
    N = int(input())

    freq = defaultdict(int)
    for i in range(1, N + 1):
        p = f(i)
        freq[p] += 1

    ans = 0
    for i in range(1, N + 1):
        p = f(i)
        q = (p[1], p[0])
        ans += freq[q]
    print(ans)


if __name__ == "__main__":
    main()


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

#define ff first
#define ss second
#define mp make_pair

#define ALPHA 4003

using namespace std;

typedef long long ll;

char A[4005], B[4005];

int MOD[6] = {0,(int)1e9+7,(int)1e9+9,(int)1e9+23,(int)1e9+97,(int)1e9+33};
int off[6] = {0,0,(int)1e2, (int)1e4, int(1e6), (int)1e8};

bitset<1000000097> h[2];
int pot[6][30];

inline int add(int a, int b, int m){
	ll ret = a+b;
	if(ret >= m) ret -= m;
	return (int)ret;
}

int main(){
	scanf(" %s", A);
	scanf(" %s", B);

	for(int j = 1; j <= 5; j++)
		pot[j][0] = 1;
	for(int i = 1; i < 30; i++){
		for(int j = 1; j <= 5; j++)
			pot[j][i] = ((ll)pot[j][i-1]*ALPHA)%MOD[j];
	}

	for(int i = 0; A[i]; i++){
		int l[6] = {0};
		for(int j = i; A[j]; j++){
			for(int k = 1; k <= 5; k++){
				l[k] = add(l[k],pot[k][A[j]-'a'],MOD[k]);

				int pos = add(l[k], off[k],MOD[k]);

				if(k <= 2) h[0][pos] = 1;
				else h[1][pos] = 1;
			}
		}
	}

	int ans = 0;
	for(int i = 0; B[i]; i++){
		int l[6] = {0};
		for(int j = i; B[j]; j++){
			bool flag = 1;
			for(int k = 1; k <= 5; k++){
				l[k] = add(l[k],pot[k][B[j]-'a'],MOD[k]);
				
				int x = 0;
				int pos = add(l[k], off[k],MOD[k]);
				if(k <= 2) x = h[0][pos];
				else x = h[1][pos];

				if(x == 0) flag = 0;
			}

			if(flag) ans = max(ans,j-i+1);
		}
	}

	printf("%d\n", ans);

	return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main()
{
    cout << fixed << setprecision(15);
    string S;
    cin >> S;

    int a = S[0] - '0';
    int b = S[1] - '0';
    int c = S[2] - '0';
    int d = S[3] - '0';

    int x = 10 * a + b;
    int y = 10 * c + d;

    if(x >= 1 && x <= 12){
        if(y >= 1 && y <= 12){
            cout << "AMBIGUOUS" << endl;
            return 0;
        }
        else{
            cout << "MMYY" << endl;
            return 0;
        }
    }
    else{
        if(y >= 1 && y <= 12){
            cout << "YYMM" << endl;
            return 0;
        }
        else{
            cout << "NA" << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	h := make([]int, N)
	for i := 0; i < N; i++ {
		h[i] = getInt()
	}

	// out(h)
	ans := 0
	for i := 0; i < N; i++ {
		x := h[i]
		if x == 0 {
			continue
		}
		for k := 0; k < x; k++ {
			ans++
			for j := i; j < N; j++ {
				if h[j] < 1 {
					break
				}
				h[j]--
			}
			// out(i, x, h)
		}
	}
	out(ans)
}


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

#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
#define endl '\n'
// #define int long long

typedef pair<int,int> pii;
const int N = 1e2+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int n, a[N];
int32_t main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> n;
	for(int i=1; i<=n; i++) {
		cin >> a[i];
		a[i] += a[i-1];
	}
	int ans = INF;
	for(int i=1; i<n; i++){
		ans = min(ans, abs(a[n]-2*a[i]));
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
int main()
{
int i=1;
int ans=0;
string s;
cin>>s;
while(i+1<s.size())
{
if(s[i]=='p'&&s[i+1]=='p')ans=ans-1;
if(s[i]=='g'&&s[i+1]=='g')ans=ans+1;
i=i+2;
}
if(i+1==s.size()&&s[i]=='g')ans=ans+1;
cout<<ans;
return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


int main()
{
	int n, m, p;
	while (scanf("%d%d%d", &n, &m, &p), n | m | p)
	{
		int x[128];
		rep (i, n)
			scanf("%d", x + i);
		if (x[m - 1])
			printf("%d\n", accumulate(x, x + n, 0) * (100 - p) / x[m - 1]);
		else
			puts("0");
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define For(i, l, r) for (register int i = l, _r = r; i <= _r; ++i)
#define Ford(i, l, r) for (register int i = r, _l = l; i >= _l; --i)
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 20;

int n,k,hi;
int a[maxn];

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 << 3) + (x << 1) + ch - '0';ch = getchar();}
	return x * f;
}

int main()
{
	k=read();
	n=read();
	For(i,1,n)
		a[i]=read();
	For(i,2,n)
		hi=max(hi,a[i]-a[i-1]);
	hi=max(hi,a[1]-a[n]+k);
	printf("%d",k-hi);
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>

using namespace std;

template<typename A, typename B> bool chmin(A &a, const B &b){ return b < a && (a = b, true); }
template<typename A, typename B> bool chmax(A &a, const B &b){ return a < b && (a = b, true); }

int main(){
  int a,b;
  cin >> a >> b;
  if ((a + b) % 2 == 0){
    cout << (a + b) / 2 << '\n';
  }
  else{
    cout << (a + b) / 2 + 1 << '\n';
  }
  return 0;
}

Measured memory_bytes: 384
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

s = input()
ans = 'No'
if s[2] ==  s[3] and s[4] == s[5]:
    ans = 'Yes'

print(ans)

Measured memory_bytes: 31276
#include <iostream>
#include <set>
#include <queue>
#include <algorithm>
using namespace std;

typedef pair <int, int> PII;
typedef pair <int, PII> PIP;
const int dx[6] = { 0, 1, 1, 0, -1, -1 };
const int dy[6] = { 1, 1, 0, -1, -1, 0 };

int main( void ) 
{
    int t, n;
    while ( cin >> t >> n && t ) {
        // init
        set <PII> O;
        set <PII> V;

        // input
        for ( int i = 0; i < n; i++ ) {
            PII o;
            cin >> o.first >> o.second;
            O.insert( o );
        }
        PII start;
        cin >> start.first >> start.second;

        // proc
        queue <PIP> Q;
        PIP start_node( 0, start );
        Q.push( start_node );
        V.insert( start );

        while ( !Q.empty() ) {
            PIP node = Q.front();
            Q.pop();

            int next_t = node.first + 1;
            PII pos = node.second;
            if ( next_t > t ) continue;

            for ( int i = 0; i < 6; i++ ) {
                PII next_pos = pos;
                next_pos.first += dx[i];
                next_pos.second += dy[i];
                if ( O.count( next_pos ) || V.count( next_pos ) ) continue;
                V.insert( next_pos );

                PIP next_node( next_t, next_pos );
                Q.push( next_node );
            }
        }

        cout << V.size() << endl;
    }
    return 0;
}

Measured memory_bytes: 1016
#include <iostream>
using namespace std;
int main(void){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    if(a + b > c + d){
        cout << "Left" << endl;
    }else if(a + b < c + d){
        cout << "Right" << endl;
    }else{
        cout << "Balanced" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toLong() }
    val b = readLine()!!.split(" ").map { it.toLong() }
    var stock = Math.max( b[n-1] - a[n], 0)
    var ret = Math.min(b[n-1], a[n])
    for (i in n-1 downTo 1) {
        ret += Math.min(stock + b[i-1], a[i])
        if (a[i] - stock >= 0) {
            stock = Math.max(b[i-1] - (a[i] - stock), 0)
        } else {
            stock = b[i-1]
        }
    }
    ret += Math.min(stock, a[0])
    println(ret)
}

Measured memory_bytes: 82932
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int x[N],bk[17][N];
int main()
{
	int n,l,q;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",x+i);
	scanf("%d%d",&l,&q);
	int pre=0;
	for(int i=0;i<n;i++)
	{
		while(x[i]-x[pre]>l)
			pre++;
		bk[0][i]=pre;
	}
	for(int i=1;i<17;i++)
		for(int j=0;j<=n;j++)
			bk[i][j]=bk[i-1][bk[i-1][j]];
	for(;q--;)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		a--;
		b--;
		if(a==b)
		{
			puts("0");
			continue;
		}
		if(a>b)
			swap(a,b);
		int ret=0;
		for(int i=16;i>=0;i--)
		{
			if(bk[i][b]>a)
			{
				ret+=1<<i;
				b=bk[i][b];
			}
		}
		printf("%d\n",ret+1);
	}
	return 0;
}
////

Measured memory_bytes: 7808
#include <cstdio>
#include <queue>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
  char S[100001];
  scanf("%s",S);
  int len=strlen(S),cnta=0,cntb=0,cntc=0;
  for(int i=0;i<len;i++){
    if(S[i]=='a') cnta++;
    else if(S[i]=='b') cntb++;
    else if(S[i]=='c') cntc++;
  }
  int MIN=min(cnta,min(cntb,cntc));
  cnta-=MIN;cntb-=MIN;cntc-=MIN;
  if(cnta==0&&cntb==0&&cntc==0){
    printf("YES\n");return 0;
  }else if(cnta==0&&cntb==0){
    if(cntc==1){
      printf("YES\n");return 0;
    }else{
      printf("NO\n");return 0;
    }
  }else if(cntb==0&&cntc==0){
    if(cnta==1){
      printf("YES\n");return 0;
    }else{
      printf("NO\n");return 0;
    }
  }else if(cntc==0&&cnta==0){
    if(cntb==1){
      printf("YES\n");return 0;
    }else{
      printf("NO\n");return 0;
    }
  }else if(cnta==0){
    if(cntb==1&&cntc==1){
      printf("YES\n");return 0;
    }else{
      printf("NO\n");return 0;
    }
  }else if(cntb==0){
    if(cntc==1&&cnta==1){
      printf("YES\n");return 0;
    }else{
      printf("NO\n");return 0;
    }
  }else if(cntc==0){
    if(cnta==1&&cntb==1){
      printf("YES\n");return 0;
    }else{
      printf("NO\n");return 0;
    }
  }else{
    printf("NO\n");return 0;
  }
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

import heapq

N,M,S,T = map(int,readline().split())

edges = [[] for i in range(N)]
edget = [[] for i in range(N)]

for i in range(M):
    u,v,a,b = map(int,readline().split())
    u -= 1
    v -= 1
    edges[u].append([a,v])
    edges[v].append([a,u])
    edget[u].append([b,v])
    edget[v].append([b,u])

def dijkstra_heap(s,n,edge):
    #始点sから各頂点への最短距離
    d = [INF] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

ds = dijkstra_heap(S-1,N,edges)
dt = dijkstra_heap(T-1,N,edget)

ans = [INF]*N
ans[0] = ds[N-1] + dt[N-1]
for i in range(1,N):
    ans[i] = min(ans[i-1],ds[N-i-1]+dt[N-i-1])
for i in range(N):
    print(10**15-ans[N-1-i])


Measured memory_bytes: 159072
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
const int MOD=1e9+7;
 
signed main(){
    int N;cin>>N;
    vector<char>A(N);
    vector<char>B(N);
    REP(i,N)cin>>A[i];
    REP(i,N)cin>>B[i];
    int ans=1;
    bool tate=false;
    for(int i=0;i<N;i++){
        if(i==0){
            if(A[i]==B[i]){
                ans=3;
                tate=true;
                continue;
            }
            else{
                ans=6;
              	i++;
                continue;
            }
        }
        if(A[i]==B[i]){
            if(tate)ans=ans*2%MOD;
            tate=true;
        }
        if(A[i]!=B[i]){
            if(tate)ans=ans*2%MOD;
            else ans=ans*3%MOD;
            tate=false;
            i++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    ll s; cin >> s;
    vector<int> v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    ll sum = 0;
    int res = INF;
    int right = 0;
    for(int left = 0; left < n; left++)
    {
        while(right < n)
        {
            if (sum >= s) break;
            sum += v[right];
            right++;
        }
        if(sum >= s) res = min(right - left, res);
        if(left == right) right++;
        else sum -= v[left];
    }
    cout << (res != INF ? res : 0) << endl;
    return 0;
}




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

long long N, Z, W;
vector<long long> A;

int main(){
	cin >> N >> Z >> W;
	for(long long i = 0; i < N; i++){
		long long tmp;
		cin >> tmp;
		A.push_back(tmp);
	}
	if(N == 1){
		cout << abs(W - A[A.size() - 1]) << endl;
		return 0;
	}

	  //Xが全部とる
	cout << max(abs(W - A[A.size() - 1]), abs(A[A.size() - 2] - A[A.size() - 1])) << endl;
}



Measured memory_bytes: 256
#include<stdio.h>


int main(void)


{


int a,b,c;


int count=0;


int i;


scanf("%d %d %d",&a,&b,&c);


for(i=a;i<=b;i++)


{


if(c%i==0) count++;


}


printf("%d\n",count);


return 0;


}

Measured memory_bytes: 1024