akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
template<class T> ll sumArr(const T& a){ return accumulate(all(a), 0LL);}
template<class T> auto minArr(const T& a){ return *min_element(all(a));}
template<class T> auto maxArr(const T& a){ return *max_element(all(a));}
template<class T> void DEBUG_PRINT(T tmp){cout<<tmp<<endl;}
template<class T1,class... T2> void DEBUG_PRINT(T1 tmp,T2... tmp2){cout<<tmp<<" ";DEBUG_PRINT(tmp2...);}
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,ans = 0;
    cin>>n;
    vector<int>sum(n + 1,1);
    rep(i,2,n + 1){
        sum[i]++;
        ll tmp = 2;
        while(true){
            if(i * tmp > n)break;
            else sum[i * tmp]++;
            tmp++;
        }
    }
    rep(i,1,n + 1)ans += sum[i] * i;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 42256
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================
/*Advanced
vi g[N];
int a[N];
*/
void solve() {
  int i, j, n, m;
}


int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	int n;
	cin >> n;
	int d;
	int ans = 0;
	cin >> d;
	int i;
	fo(i, n) {
		double x, y;
		cin >> x;
		cin >> y;
		double check = sqrt(x * x + y * y);
		if(check <= d) ans++;
	}
	cout << ans;
	
    return 0;
}
/*
int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
    u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}
*/


Measured memory_bytes: 3876
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#include <numeric>
#define lint unsigned long long int
#define FOR(x, to) for(int x=0; x<(int)(to); x++)
#define DUMP(ar) for(auto itd=begin(ar); itd != end(ar); itd++) cout << "["s << itd - begin(ar) << "]:"s << *itd << endl
#define DUMPL(ar) for(auto itd=begin(ar); itd != end(ar); itd++) { cout << *itd; if(end(ar)-itd > 1) cout << ' '; } cout << endl
#define COUT(x) cout << (x) << endl
#define VCIN(ar) for(auto &vcin: (ar)) cin >> vcin
#define ALL(ar) ar.begin(), ar.end()
#define LOOPD(i) cout << "ループ["s << i << "]回目---------------"s << endl
using namespace std;
// lint:64ビット 10^19

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

    vector<vector<int>> a(3, vector<int>(3));
    int n;
    for(int i=0; i<3; i++){
        VCIN(a[i]);
    }
    cin >> n;
    vector<int> b(n);
    VCIN(b);

    vector<vector<bool>> bingo(3, vector<bool>(3, false));

    for(int i=0; i<n; i++){
        for(int j=0; j<3; j++){
            for(int k=0; k<3; k++){
                if(a[j][k] == b[i]) bingo[j][k] = true;
            }
        }
    }

    bool flag = true;
    for(int i=0; i<3; i++){
        flag = true;
        for(int j=0; j<3; j++){
            if(bingo[i][j] == false){
                flag = false;
                break;
            }
        }
        if(flag){
            COUT("Yes");
            return 0;
        }
    }

    for(int i=0; i<3; i++){
        flag = true;
        for(int j=0; j<3; j++){
            if(bingo[j][i] == false){
                flag = false;
                break;
            }
        }
        if(flag){
            COUT("Yes");
            return 0;
        }
    }

    if(bingo[0][0] && bingo[1][1] && bingo[2][2]){
        COUT("Yes");
        return 0;
    }
    if(bingo[2][0] && bingo[1][1] && bingo[0][2]){
        COUT("Yes");
        return 0;
    }

    COUT("No");
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
M = 1000005
cnt = [0]*M
for a in A:
    if cnt[a]!=0:
        cnt[a]+=1
        continue
        
    for i in range(a, M, a):
        cnt[i]+=1
        
ans = 0
for a in  A:
    if cnt[a] == 1:
        ans+=1
print(ans)

Measured memory_bytes: 32196
#include <cstdio>
#include <vector>


long long mergeSort(std::vector<int> &a, std::vector<int> &b, int left, int right){
    if(left >= right) return 0;

    int mid = left + (right - left) / 2;
    long long sum1 = mergeSort(a, b, left, mid);
    long long sum2 = mergeSort(a, b, mid+1, right);

    int i = left;
    int j = mid+1;
    long long count = 0;
    for(int k = left; k <= right; ++k){
        if(i > mid){
            b[k] = a[j++];
        } else if(j > right){
            b[k] = a[i++];
        } else if(a[i] <= a[j]){
            b[k] = a[i++];
        } else if(a[i] > a[j]){
            count += mid - i + 1;
            b[k] = a[j++];
        }
    }

    for(int k = left; k <= right; ++k){
        a[k] = b[k];
    }

    return sum1 + sum2 + count;
}

int main(){
    int n;
    std::scanf("%d", &n);
    std::vector<int> a(n, 0);
    std::vector<int> b(n, 0);

    for(int i = 0; i < n; ++i){
        std::scanf("%d", &a[i]);
    }

    long long count = mergeSort(a, b, 0, n - 1);
    std::printf("%lld\n", count);

    return 0;
}


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

int main(){
    int W, H, x, y, r ;
    cin >> W >> H >> x >> y >> r;
    if (0 <= x-r && y-r >= 0 && x+r <= W && y+r <= H){
        cout << "Yes" << endl;    
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

int main()
{
	int N, M, X, A[100],B,cost1,cost2;
	cost1 = 0;
	cost2 = 0;
	cin >> N;
	cin >> M;
	cin >> X;
	
	for (int i = 0; i < 100; i++)A[i] = 0;

	for (int i = 0; i <M; i++)
	{
		cin >> B;
		for (int i = 0; i <100; i++)
		{
			if (B == i)A[i] = 1;
		}
	}
	for (int i = X; i != N; i++)cost1 += A[i];
	for (int i = X; i != 0; i--)cost2 += A[i];

	if (cost1 > cost2)cout << cost2 << endl;
	else cout << cost1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;

int main(void)
{
	int n,i,e,h[65000];
	unsigned int x,z,a,w;
	while(1){
		w=0;
		scanf("%d",&n);
		if(n==0) break;
		for(i=0;i<n;i++){
			scanf("%d",&e); w+=e;
		}
		for(i=0;i<n-1;i++) scanf("%d",&h[i]);
		sort(h,h+n-1,greater<int>());
		x=n*w; z=w;
		for(i=0;i<n-1;i++){
			z+=h[i];
			a=(n-(i+1))*z;
			if(a>x) x=a;
		}
		printf("%u\n",x);
	}
	return 0;
}	

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

using namespace std;
//fold
#define ll long long
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define Loop(i, a, b) for(int i = a ; i < b ; ++i)
#define loop(i, n) Loop(i, 0, n)
#define ff first
#define ss second
#define mkp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define vii vector<pii>
#define vvii vector<vii>
#define vl vector<ll>
#define pll pair<ll, ll>
#define vll vector<pll>
#define vvll vector<vll>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define nmbr(c) (int)(c-'0')
#define ltr(c) (int)(c-'a')
#define INF 1e18+5
#define inf 1e9+5
#define M 1000000007 //check
#define _69e27 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define trace(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

template <typename T> T max(T a, T b, T c){ return max(a, max(b, c));}
template <typename T> T min(T a, T b, T c){ return min(a, min(b, c));}
//endfold
vl v;
int main() {
	_69e27;
	ll a, b;
	scanf("%lld %lld", &a, &b);
	if(a > b) swap(a, b);
	a = __gcd(a, b);
	for(ll i = 1 ; i*i <= a ; ++i)
	{
		if(a%i) continue;
		v.pb(i);
		if(a/i != i) v.pb(a/i); 
	}
	ll c = 1;
	int ans = 0;
	sort(all(v));
	for(auto it : v) if(__gcd(c, it) == 1) c *= it, ans++;
	printf("%d\n", ans);
	return 0;
}

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

int main() {
  int n, t, a;
  cin >> n >> t >> a;
  vector<double> d;
  d.reserve(1000);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    d.push_back(abs(t - x * 0.006 - a));
  }
  cout << distance(d.begin(), min_element(d.begin(), d.end())) + 1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int NUM=1e5+1;

int main(){
  int N, M;
  cin >> N >> M;
  int Y[NUM];
  int P[NUM];
  vector<int> C[NUM];
  for(int i=1; i<=M; i++){
    cin >> P[i] >> Y[i];
    C[P[i]].push_back(Y[i]);
  }
  for(int i=1; i<=N; i++){
    sort(C[i].begin(), C[i].end());
  }
  for(int i=1; i<=M; i++){
    int keta = log10(P[i])+1;
    for(int j=1; j<=6-keta; j++){
      cout << "0";
    }
    cout << P[i];
    auto pos = lower_bound(C[P[i]].begin(), C[P[i]].end(), Y[i]);
    int idx = (int)distance(C[P[i]].begin(), pos)+1;
    keta = log10(idx)+1;
    for(int j=1; j<=6-keta; j++){
      cout << "0";
    }
    cout << idx << endl;
  }
  return 0;
}


Measured memory_bytes: 7808
N = int(input())
A_list = list(map(int, input().split()))
two_list = [2 ** i for i in range(32)]
count = 0
items = {}
for a in A_list:
    if a in items:
        items[a] += 1
 
    else:
        items[a] = 1
A_list.sort(reverse=True)
 
for a in A_list:
    if items[a] >= 1:
 
        for t in two_list:
            m = t -a
            if m in items:
                if m == a and items[a] >= 2:
                    count += 1
                    items[a] -= 1
                    items[m] -= 1
                    break
 
                elif m != a and items[m] >= 1 and items[a] >=1:
                    count += 1
                    items[a] -= 1
                    items[m] -= 1
                    break
print(count)

Measured memory_bytes: 33692
#include <stdio.h>

#define NUM 3

int pt[6][NUM] = { {0, 2, 1},
			   {0, 1, 2},
			   {1, 0, 2},
			   {1, 2, 0},
			   {2, 0, 1},
			   {2, 1, 0}
			 };

int judge(int [], int []);

int judge(int a[NUM], int b[NUM]) {
	
	int flag = 0;
	
	if( a[b[0]] <= a[b[1]] && a[b[1]] <= a[b[2]])	flag = 1;
	
	return flag;
	
}


int main(int argc, char *argv[]) {
	
	int i = 0;
	int in[NUM] = {0};
	
	fscanf(stdin, "%d %d %d", in, in+1, in+2);
	
	while(judge(in, pt[i]) == 0) {
		i++;
	}
	
	fprintf(stdout, "%d %d %d\n", in[pt[i][0]], in[pt[i][1]], in[pt[i][2]]);
	
	return 0;

}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main(){
    vector<int> A(5);
	cin >> A[0] >> A[1] >> A[2] >> A[3] >> A[4];
    vector<int> P = { 0, 1, 2, 3, 4 };
	int final_answer = 1000000;
    do {
		int ans = 0;
		for (int i = 0; i < 5; ++i) {
			while (ans % 10 != 0) ans += 1;
			ans += A[P[i]];
		}
		final_answer = min(final_answer, ans);
	} while (next_permutation(P.begin(), P.end()));
	cout << final_answer << endl;
	return 0;
}


Measured memory_bytes: 256
S = input()
ans = 0
for i in range(2**(len(S)-1)):  # 総当たり
    tmp = S[0]  # 先頭だけ格納
    for j in range(len(S)-1):   # mask
        if i & (1<<j):  # iと1をjbitシフトしたものを比較
            tmp += "+"
        tmp += S[j+1]
    ans += eval(tmp)
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main()
{
	int n,m,k;
	cin >> n >>m >> k;

	rep(i,n+1)
	{
		rep(j,m+1)
		{
			if(i*j+(n-i)*(m-j)==k)
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
					cout<<"No"<<endl;

	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);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int c = sc.nextInt();

    int res = 0;

    int[] b = new int[m];

    for (int i = 0; i < m; ++i)
      b[i] = sc.nextInt();

    for (int i = 0; i < n; ++i) {
      int sum = c;
      for (int j = 0; j < m; ++j)
        sum += b[j] * sc.nextInt();
      res = (sum > 0) ? res + 1 : res;
    }

    System.out.println(res);
  }
}

Measured memory_bytes: 21844
X,K,D = map(int, input().split())
absX = abs(X)
if absX - K*D > 0:
  ans = absX - K*D
else:
  q = absX // D
  mod = absX % D
  if (K-q) % 2 == 0:
    ans = mod
  else:
    ans = min(abs(mod-D),abs(mod+D))
print(ans)

Measured memory_bytes: 9180
n=int(input())
if n==1:
    print(0)
else:
    lst=[]
    i=2
    while i**2<=n:
        if n%i==0:
            n//=i
            lst.append(i)
            continue
        i+=1
    lst.append(n)
    from collections import Counter
    dic=dict(Counter(lst))
    s=0
    for i in dic:
        n=dic[i]
        k=0
        while n>=0:
            s+=1
            k+=1
            n-=k
        s-=1
    print(s)

Measured memory_bytes: 68164
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(string, s);
  print((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3]) ? "Yes" : "No");
}


Measured memory_bytes: 256
import math
x = int(input())

def prime_num(x):
    ret = x
    flag = False
    while True:
        for p in range(2, int(math.sqrt(ret)+1)):
            if ret % p == 0:
                flag = True
                break
        if flag == True:
            flag = False
            ret += 1
            continue
        else:
            return ret


print(prime_num(x))


Measured memory_bytes: 3060
/*
考虑直径，要么直径减1，要么直径减2（除了只有两个点的情况）。 
*/
#include<bits/stdc++.h>
using namespace std;
const int maxn=2E5+5;
int n,sizeE,head[maxn]; 
struct edge
{
	int to,next;
}E[maxn*2];
inline void add(int u,int v)
{
	E[++sizeE].to=v;
	E[sizeE].next=head[u];
	head[u]=sizeE;
}
int pos,ans;
void dfs(int u,int F,int d)
{
	if(d>ans)
		ans=d,pos=u;
	for(int i=head[u];i;i=E[i].next)
	{
		int v=E[i].to;
		if(v==F)
			continue;
		dfs(v,u,d+1);
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=2;i<=n;++i)
	{
		int x,y;
		cin>>x>>y;
		add(x,y);
		add(y,x);
	}
	dfs(1,1,1);
	dfs(pos,pos,1);
	if((ans+1)%3==0)
		cout<<"Second"<<endl;
	else
		cout<<"First"<<endl;
	return 0;
}


Measured memory_bytes: 16840
#include <iostream>
#include<stdio.h>
using namespace std;

int main() {
    int n;
    cin >>n;
    if (n%10 == 9){
        printf ("Yes");
    }
    else if(n/10 == 9){
        printf("Yes");
    }
    else printf("No");
    
    return 0;
}


Measured memory_bytes: 256
N,K=map(int,input().split())
V=list(map(int,input().split()))
ans=[0]

for i in range(K+1):
    #print(i)
    for j in range(i+1):
        if N<=i:
            temp=sorted(V)
        elif j-i!=0:
            temp=sorted(V[:j]+V[j-i:])
        else:
            temp=sorted(V[:j])
        t=0
        for k in range(min(i,N)):
            if temp[k]>=0:
                t=k+1
                break
        #print(temp,t,j,j-i)
        #if t==0:
        #    print(":",0)
        if t>K-i:
            #print("1",temp[K-i:])
            #print("1",sum(temp[K-i:]))
            ans.append(sum(temp[K-i:]))
        elif (K-1-t)%2==1:
            if t>=2:
                #print("2",max(sum(temp[t-2:]),sum(temp[t:])))
                ans.append(max(sum(temp[t-2:]),sum(temp[t:])))
            else:
                #print("3",sum(temp[t:]))
                ans.append(sum(temp[t:]))
        else:
            #print("4",sum(temp[t-1:]))
            ans.append(sum(temp[t-1:]))
print(max(ans))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;
typedef long long ll;
// cd test ; rm -R ./*; cd .. 
int n, a, b, c;
int l[10];
int ans = 1001001001;
void dfs(int now, int a_num, int a_sum, int b_num, int b_sum, int c_num, int c_sum) {
  if (now == n) {
    if (a_num == 0 || b_num == 0 || c_num == 0) return;
    int sum = 0;
    
    if (a_num >= 2) sum += (a_num - 1) * 10;
    if (b_num >= 2) sum += (b_num - 1) * 10;
    if (c_num >= 2) sum += (c_num - 1) * 10;

    sum += abs(a - a_sum) + abs(b - b_sum) + abs(c - c_sum);
    ans = min(ans, sum);
    return;
  }

  dfs(now + 1, a_num + 1, a_sum + l[now], b_num, b_sum, c_num, c_sum);
  dfs(now + 1, a_num, a_sum, b_num + 1, b_sum + l[now], c_num, c_sum);
  dfs(now + 1, a_num, a_sum, b_num, b_sum, c_num + 1, c_sum + l[now]);
  dfs(now + 1, a_num, a_sum, b_num, b_sum, c_num, c_sum);

}

int main(void) {
  
  cin >> n >> a >> b >> c;
  rep (i, n) cin >> l[i];

  dfs(0, 0, 0, 0, 0, 0, 0);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

N, K = map(int, input().split())
S = list(input().rstrip())

score = 0
for i in range(N-1):
    if S[i] == S[i+1]:
        score += 1

print( min(N-1, score+2*K) )

Measured memory_bytes: 3956
input()
xs = list(map(int, input().split()))
sortx = sorted(xs)
l = len(xs)
t = (l+1)//2 - 1
medv = sortx[t]
if l%2 == 0:
    v1 = medv
    v2 = sortx[t+1]
    for x in xs:
        if x <= medv:
            print(v2)
        else:
            print(v1)
else:
    v1 = sortx[t-1]
    v2 = medv
    for x in xs:
        if x < medv:
            print(v2)
        else:
            print(v1)


Measured memory_bytes: 26180
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
using ll = long long;

int main() {
  string s;
  cin >> s;
  bool ok = false;
  if (s[0] == '7')
    ok = true;
  if (s[1] == '7')
    ok = true;
  if (s[2] == '7')
    ok = true;
  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3616
def solve(n, a):
    sum_a=0
    sum_b=0
    for i in range(n):
        if a[i][0]==a[i][1]:
            sum_a+=a[i][0]
            sum_b+=a[i][1]
        elif a[i][0]>a[i][1]:
            sum_a+=(a[i][0]+a[i][1])
        else:
            sum_b+=(a[i][0]+a[i][1])
    return sum_a, sum_b


while True:
    n = int(input())
    if n==0: break
    a=[[int(i) for i in input().split()] for i in range(n)]
    ans_1, ans_2 = solve(n,a)
    print (ans_1, ans_2)

Measured memory_bytes: 9188
/**
 *    author        : Sudipta Banik Trisha 
 *    created       : August 29, 2020 6:00 PM
 *    Problem Name  : A - Don't be late
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/abc177/tasks/abc177_a
 *    @genarated by : ai-virtual-assistant
**/

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

int main(){
    ios_base::sync_with_stdio(false);
    double d,t,s;
    cin >> d >> t >> s;

    double temp = (d/s);
    if(temp<=t) cout << "Yes" << endl;
    else cout << "No" << endl;




    return 0 ;
}


Measured memory_bytes: 3736
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
using namespace std;

int main() {

	unsigned long long N;
	unsigned long long A;
	unsigned long long B;
	cin >> N;
	cin >> A;
	cin >> B;

	unsigned long long val1 = N / (A + B);
	unsigned long long val2 = N - val1 * (A + B);
	
	unsigned long long ans = 0;
	if (val2 > A) {
		ans = A * val1;
		ans += A;
		cout << ans << endl;
	}
	else {
		ans = A * val1;
		ans += val2;
		cout << ans << endl;
	}

	return 0;
}

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

constexpr char NL = '\n';
constexpr int MOD = 1e9 + 7;

struct safe_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

void solve()
{
    int n, m; cin >> n >> m;
    int sx, sy, dx, dy; cin >> sx >> sy >> dx >> dy;
    --sx; --sy; --dx; --dy;
    vector<vector<bool>> v(n, vector<bool>(m));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            char c; cin >> c;
            v[i][j] = c == '.';
        }
    }
    deque<pair<pair<int, int>, int>> q;
    q.push_back({{sx, sy}, 0});

    while (!q.empty()) {
        int cx = q.front().first.first, cy = q.front().first.second, cw = q.front().second;
        q.pop_front();

        if (cx == dx && cy == dy) {
            cout << cw << NL;
            return;
        }

        if (!v[cx][cy]) continue;
        v[cx][cy] = false;

        for (int i = -2; i <= 2; ++i) {
            for (int j = -2; j <= 2; ++j) {
                int nx = cx + i, ny = cy + j;

                if (nx < 0 || ny < 0 || nx >= n || ny >= m) continue;

                if (abs(i) + abs(j) != 1) {
                    q.push_back({{nx, ny}, cw + 1});
                } else {
                    q.push_front({{nx, ny}, cw});
                }
            }
        }
    }
    cout << -1 << NL;
}

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

Measured memory_bytes: 6424
#include<stdio.h>
#define MAX 100005
#define NIL -1

typedef struct{
  int p,l,r;
}Node;
Node T[MAX];

void preorder(int);
void inorder(int);
void postorder(int);

int main(){

  int n,i,j,k,root,node,child;

  scanf("%d",&n);
 for(i = 0; i < n; i++){
    T[i].p = NIL;
    T[i].l = NIL;
    T[i].r = NIL;
 }
 for(i = 0; i < n; i++){
   scanf("%d",&node);
   for(j = 0; j < 2; j++){
     scanf("%d",&child);
     if(child != -1){
       T[child].p = node;
       if(j == 0)
	 T[node].l = child;
       else
	 T[node].r = child;
     }
   }
 } 
 for(i = 0; i < n; i++){
   if(T[i].p == NIL)
     root = i;
 }
 printf("Preorder\n");
   preorder(root);
   printf("\n");
   printf("Inorder\n");
   inorder(root);
   printf("\n");
   printf("Postorder\n");
   postorder(root);
   printf("\n");
   return 0;
}

void preorder(int root){
  printf(" %d",root);
  if(T[root].l != -1)
  preorder(T[root].l);
  if(T[root].r != -1)
    preorder(T[root].r);
}

void inorder(int root){

  if(T[root].l != -1)
    inorder(T[root].l);
  printf(" %d",root);
  if(T[root].r != -1)
    inorder(T[root].r);
}

void postorder(int root){
  if(T[root].l != -1)
    postorder(T[root].l);
  if(T[root].r != -1)
    postorder(T[root].r);
  printf(" %d",root);
}

Measured memory_bytes: 616
# coding: utf-8


def solve(*args: str) -> str:
    day = {'SUN': 0, 'MON': 1, 'TUE': 2,
           'WED': 3, 'THU': 4, 'FRI': 5, 'SAT': 6}
    return str(7-day[args[0]])


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 2940
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;
void GetAge(int N, int A =2 ,int B = 3) {
    if(N==1){
        cout << "Hello World\n";
    }else{
        cout << A+B << "\n";
    }
}
int main()
{ 
    int N;
    int A,B;
    cin >> N;
    if(N==1){
    GetAge(N); // Hello World
    }else{
    cin >> A;
    cin >> B;
    GetAge(N,A,B); // 8
    }
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<bitset>
#include<vector>
#include<algorithm>
#include<string>
#include <cstdlib> 
using namespace std;
bool tri_check(unsigned int a,unsigned int b,unsigned int c)
{
  if(a==b || b==c || c==a) return false;
  if(a+b<=c) return false;
  if(b+c<=a) return false;
  if(c+a<=b) return false;
  //cout<<a<<b<<c<<endl;
  return true;
}

int main()
{
  int N=0;
  cin >> N;
  vector<unsigned int> bou(N);
  int count=0;
  for(int i=0;i<N;i++)
  {
    cin >> bou.at(i);
  }
  sort(bou.begin(),bou.end());
  for(int i=0;i<N-2;i++)
  {
    for(int j=i+1;j<N-1;j++)
    {
      for(int k=j+1;k<N;k++)
      {
        if(tri_check(bou.at(i),bou.at(j),bou.at(k)))
        {
          count++;
        }
      }
    }
  }
  cout << count << endl;
  
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        try ( Scanner sc = new Scanner ( System.in)){
            String line = sc.nextLine();
            String answer = "";
            int length = line.length();
            for ( int i = 0 ; i<length;i++) {
                char ch = line.charAt(i);
                if (Character.isLowerCase(ch)) {
                    ch = Character.toUpperCase(ch);
                } else {
                    ch = Character.toLowerCase(ch);
                }
                answer+=ch;
            }
            System.out.println(answer);
        }
    }
}


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

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

    string S[N];
    for(int i=0; i<N; i++){
        cin >> S[i];
    }

    for(int j=0; j<N; j++) {
        if(S[j] == "Y") {
            cout << "Four" << endl;
            break;   
        } 
        else if(j == N-1)
            cout << "Three" << endl;
    }

}

Measured memory_bytes: 256
def main():
    n,k = map(int,input().split())
    sunukes = [0] * n
    for i in range(k):
        d = int(input())
        lst = list(map(int,input().split()))
        for j in lst:
            sunukes[j-1] += 1

    print(sunukes.count(0))



if __name__ == '__main__':
    main()


Measured memory_bytes: 9168
#define _CRT_SECURE_NO_DEPRECATE
#include<bits/stdc++.h>
#define Rint register int
#define MP make_pair
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii; // 注意必要时改类型
typedef vector<int> vi;
const int N = 3e3 + 3;
//dp[i][j]表示拓展到i,j区间的最大差值
ll n, a[N], dp[N][N];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
#ifdef _DEBUG
	int tt = clock();
	// freopen("in.txt", "r", stdin);
#endif 
	cin >> n;
	for (Rint i = 0; i < n; ++i) 
		cin >> a[i];
	for (Rint L = n - 1; L >= 0; --L) {
		for (Rint R = L; R < n; ++R) {
			if (L == R) {
				dp[L][R] = a[L];
			}
			else {
				dp[L][R] = max(a[L] - dp[L + 1][R], a[R] - dp[L][R - 1]);
			}
		}
	}
	cout << dp[0][n - 1] << endl;
	




#ifdef _DEBUG
	cerr << "\nTIME = " << clock() - tt << endl;
	tt = clock();
#endif

	return 0;
}


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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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;}

struct Pos{
    int x,y;
    Pos(int x,int y):x(x),y(y){}
};

int H,W;
int Ch,Cw;
int Dh,Dw;
string field[1005];
int d[1000005];
int s[1005][1005];
bool visited1[1005][1005];
bool visited2[10000005];
int id;
set<int> E[1000005];


void init(){
    id=0;
    for(int i=0;i<1000003;++i){
        d[i]=INF;
        visited2[i]=false;
    }
    for(int i=0;i<1003;++i){
        for(int j=0;j<1003;++j){
            s[i][j]=-1;
            visited1[i][j]=false;
        }
    }
}

void bfs1(int sx,int sy){
    queue<Pos> que;
    que.push(Pos(sx,sy));
    s[sy][sx]=id;
    while(que.size()){
        Pos p=que.front();
        que.pop();
        visited1[p.y][p.x]=true;
        for(int i=0;i<4;++i){
            int nx=p.x+dx[i],ny=p.y+dy[i];
            if(nx<0||nx>=W||ny<0||ny>=H)continue;
            if(visited1[ny][nx])continue;
            if(s[ny][nx]!=-1)continue;
            if(field[ny][nx]=='#')continue;
            que.push(Pos(nx,ny));
            s[ny][nx]=id;
        }
    }
    id++;
}

void bfs2(int s){
    queue<int> que;
    que.push(s);
    d[s]=0;
    while(que.size()){
        int p=que.front();
        que.pop();
        visited2[p]=true;
        //cout << "p: " << p << endl; 
        for(auto u:E[p]){
            //cout << "u: " << u << endl;
            if(d[u]!=INF)continue;
            if(visited2[u])continue;
            que.push(u);
            d[u]=d[p]+1;
        }
    }
}

signed main(){
    init();
    cin>>H>>W;
    cin>>Ch>>Cw;
    cin>>Dh>>Dw;
    Ch--,Cw--;
    Dh--,Dw--;
    for(int i=0;i<H;++i)cin>>field[i];
    for(int y=0;y<H;++y){
        for(int x=0;x<W;++x){
            if(field[y][x]=='#')continue;
            if(s[y][x]!=-1)continue;
            bfs1(x,y);
        }
    }
    for(int y=0;y<H;++y){
        for(int x=0;x<W;++x){
            if(field[y][x]=='#')continue;
            for(int i=-2;i<=2;++i){
                for(int j=-2;j<=2;++j){
                    int nx=x+i,ny=y+j;
                    if(nx<0||nx>=W||ny<0||ny>=H)continue;
                    if(s[ny][nx]==s[y][x])continue;
                    if(field[ny][nx]=='#')continue;
                    E[s[y][x]].insert(s[ny][nx]);
                    E[s[ny][nx]].insert(s[y][x]);
                }
            }
        }
    }
    bfs2(s[Ch][Cw]);
    if(d[s[Dh][Dw]]==INF)cout<<-1<<endl;
    else cout<<d[s[Dh][Dw]]<<endl;
}

Measured memory_bytes: 88432
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  string S;
  cin >> S;
  set<char> s;
  s.insert(S[0]);
  s.insert(S[1]);
  s.insert(S[2]);
  if(s.size()==2)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  
  return 0;
}


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

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
    if (v.size()) {
        os << v.front();
        for (auto vi = v.begin() + 1; vi != v.end(); vi++)
            os << " " << *vi;
    }
    return os;
}

int bubble_count(vector<int> &a)
{
    int count = 0;

    for (int i = 0; i < a.size() - 1; i++)
        for (int j = a.size() - 1; j > i; j--)
            if (a[j] < a[j - 1]) {
                swap(a[j], a[j - 1]);
                count++;
            }

    return count;
}

int main()
{
    int n, count;
    cin >> n;
    vector<int> array(n);

    for (int x, i = 0; i < n && cin >> x; i++)
        array[i] = x;

    count = bubble_count(array);

    cout << array << endl;
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int mod = 1e9+7, A = 1e5+5;
ll rep[A], sz[A];
ll find(ll u)
{
	return rep[u] == u ? u : rep[u] = find(rep[u]);
}
void join(ll a, ll b, ll &ret)
{
	a = find(rep[a]), b = find(rep[b]);
	if (a == b)
		return;
	if (sz[a] < sz[b])
		swap(a, b);
	ret = sz[a] * sz[b];
	rep[b] = a, sz[a] += sz[b], sz[b] = 0;
}

int main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	ll n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		rep[i] = i, sz[i] = 1;
	vector<pair<ll, ll>> v;
	for (int i = 0; i < m; i++)
	{
		int x, y;
		cin >> x >> y;
		v.pb({x, y});
	}
	reverse(v.begin(), v.end());
	ll ans[m];
	ans[0] = n * (n - 1) / 2;
	for (int i = 0; i < m - 1; i++)
	{
		ll x = find(rep[v[i].F]), y = find(rep[v[i].S]);
		ll ret = -1;
		join(x, y, ret);
		ans[i + 1] = ans[i] - (~ret ? ret : 0);
	}
	for (int i = m - 1; i >= 0; i--)
		cout << ans[i] << '\n';
	return 0;
}

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


int main(){
    int n, a;
    cin >> n >> a;
    n %= 500;
    if(n <= a) cout << "Yes\n" << endl;
    else cout << "No\n" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

ll d[1<<16];
ll dp[1<<16];

int main() {
  int n;
  scanf("%d",&n);
  vvi a(n,vi(n));
  cin>>a;
  int n2 = 1<<n;
  rep(i,n2) if (i) {
    int j = i&-i;
    int ni = i^j;
    d[i] = d[ni];
    j = pcnt(j-1);
    while (ni) {
      int k = ni&-ni;
      ni ^= k;
      d[i] += a[j][pcnt(k-1)];
    }
  }
  rep(i,n2) {
    dp[i] = d[i];
    for (int j = i; j; j = (j-1)&i) {
      maxs(dp[i], dp[i^j]+d[j]);
    }
  }
  cout<<dp[n2-1]<<endl;
  return 0;
}






















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

int main() {
  int t;
  cin >> t;
  vector<int> arr(t);
  for (int i = 0; i < t; i++) cin >> arr[i];
  for (int i = 0; i < t; i++) {
    int max_idx = i;
    int max = arr[i];
    for (int j = i; j < t; j++) {
      if (arr[j] > max) {
        max_idx = j;
        max = arr[j];
      }
    }
    int tmp = arr[i];
    arr[i] = arr[max_idx];
    arr[max_idx] = tmp;
  }
  int alice = 0;
  int bob = 0;
  for (int i = 0; i < t/2; i++) {
    alice += arr[2 * i];
    bob += arr[2 * i + 1];
  }
  if (t % 2 == 1) alice += arr[t - 1];
  cout << alice - bob << endl;
}

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

if 0 < a:
    print("Positive")
elif a == 0 or 0 <= b:
    print("Zero")
else:
    length = abs(a + b + 1)
    if length % 2 == 0:
        print("Positive")
    else:
        print("Negative")

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

#define int         long long
#define mp          make_pair
#define pb          push_back
#define vi          vector<int>
#define vii         vector<pair<int,int>>
#define mi          map<int,int>
#define mii         map<pair<int,int>,int>
#define all(a)      (a).begin(),(a).end()
#define f           first
#define s          second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define hellhsh     444440583533
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rep0(a,n)  for(int i=0;i<n;i++)cin>>a[i];
#define si(x)       cin>>x;
#define sii(x,y)    cin>>x>>y;
#define ahell   998244353
#define p(x)   printf("%I64d",x)
#define aut(x,u) for(auto x:u)
#define pri     queue<pii>
#define forn(k) for(int i=0;i<k;i++)
#define N 200007
#define fl 1.0000000000
#define ms(a,n) memset(a,n,sizeof(a))
#define INF 10000000000007
using namespace std;
int x,y,m,k;
int n;
vii list[1006];
void solve()
{
int q=0,i,j;
int x,y=0,ct=0;
string s1;
cin>>s1;
if(s1[2]==s1[3]&&s1[4]==s1[5])cout<<"Yes";
else cout<<"No";
}




main()
{
ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int i,j,k,test=1;
    
  //cin>>test;
  while(test--)
  {
      solve();
      //cout<<"\n";
 }

}


Measured memory_bytes: 256
n = int(input())
s = [input() for i in range(n)]
print('AC x %d' % (s.count('AC')))
print('WA x %d' % (s.count('WA')))
print('TLE x %d' % (s.count('TLE')))
print('RE x %d' % (s.count('RE')))


Measured memory_bytes: 16204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll a,b;
  cin >> a >> b;
  if (a <= 0 && 0 <= b) {
    cout << "Zero" << endl;
  }
  else if (a > 0 && b > 0) {
    cout << "Positive" << endl;
  }
  else if ((b - a) % 2 == 0) {
    cout << "Negative" << endl;
  }
  else {
    cout << "Positive" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n, k; cin >> n >> k;
    vector<pair<ll, ll>> a(n);

    rep(i, n) cin >> a[i].first >> a[i].second;
    sort(all(a));

    rep(i, n){
        if(a[i].second < k) k -= a[i].second;
        else{
            cout << a[i].first << endl;
            break;
        }
    }
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair <int,ll> P;
typedef pair <int,P> iP;
ll n;
vector <ll> a;
queue <iP> Q;

void mk28(ll div){
  if(n<div)return;
  if(div)a.push_back(div);
  mk28(div*10+2);
  mk28(div*10+8);
}

int bfs(){
  if(n==1)return -1;
  int ans=-1;
  Q.push(iP(0,P(0,n)));
  while(!Q.empty()){
    iP t=Q.front();Q.pop();
    int idx=t.first,sum=t.second.first;
    ll num=t.second.second; 
    if(num==1) ans=max(ans,sum);
    if(num<a[idx]|| idx==a.size()) continue;
    if(num%a[idx]==0) Q.push(iP(idx,P(sum+1,num/a[idx])));
    Q.push(iP(idx+1,P(sum,num)));
  }
  return ans;
}

int main(){
  cin>>n;
  mk28(0);
  sort(a.begin(),a.end());
  cout <<bfs()<<endl;
  return 0;
}

Measured memory_bytes: 7256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  int n;
  cin >> n;
  string s;
  cin >> s;
  int q;
  cin >> q;
  int k[q];
  rep(i,q){
    cin >> k[i];
  }
  ll Cdp[n],Mdp[n],CMdp[n];
  Cdp[0]=Mdp[0]=CMdp[0]=0;
  rep(i,n){
    if(i!=0){
      Cdp[i]=Cdp[i-1];
      Mdp[i]=Mdp[i-1];
      CMdp[i]=CMdp[i-1];
    }
    if(s[i]=='C'){
      Cdp[i]++;
      if(i!=0) CMdp[i]+=Mdp[i-1];
    }      
    else if(s[i]=='M'){
      Mdp[i]++;
    }
  }
  ll ans[q];
  rep(i,q) ans[i]=0;
  rep(i,n){
    if(s[i]=='D'){
      rep(j,q){
      int li=min(i+k[j]-1,n-1);
      ans[j]+=CMdp[li]-CMdp[i]-(Cdp[li]-Cdp[i])*Mdp[i];
      }
    }    
  }
  rep(i,q) cout << ans[i] << endl;
  return 0;
    

}


Measured memory_bytes: 24860
#include<stdio.h>
int getPattern(int,int,int,int);
int main(void)
{
  int n,x;
  for(;;)
    {
      scanf("%d%d",&n,&x);
      if(n==0&&x==0) break;
      printf("%d\n",getPattern(1,n,3,x));
    }
  return 0;
}
int getPattern(int min,int max,int num,int goal)
{
  int i;
  int ret=0;
  if(num<1) return 0;
  if(num==1)
    {
      if(min<=goal&&goal<=max) return 1;
      else return 0;
    }
  for(i=min;i<max;i++)
    {
      ret+=getPattern(i+1,max,num-1,goal-i);
    }
  return ret;
}


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

using namespace std;

int main()
{
    int n, k, q;
    cin >> n >> k >> q;

    vector<int> score(n,k-q);

    for(int i=0;i<q;i++){
        int a;
        cin >> a;
        score[a-1]+=1;
    }

    for(int i=0;i<n;i++){
        if(score[i]>0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

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

int main(){
    int N,ans=0;
    cin >> N;
    int A[N+1],B[N],C[N-1];
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    A[N]=0;
    for(int i=0;i<N;i++){
        cin >> B[i];
    }
    for(int i=0;i<N-1;i++){
        cin >> C[i];
    }
    for(int i=0;i<N;i++){
        ans+=B[A[i]-1];
        if(A[i+1]==A[i]+1)
        ans+=C[A[i]-1];
    }
    cout << ans << endl;
}

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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<Edge>>;

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

    int h, n;
    cin >> h >> n;
    vi a(n), b(n);
    REP(i, n) cin >>a[i] >> b[i];

    vvi dp(n+1, vi(h + 1, 1e9));
    dp[0][0] = 0;
    REP(i, n) REP(j, h + 1) {
        dp[i + 1][j] = min(dp[i][j], j >= a[i] ? dp[i + 1][j - a[i]] + b[i] : b[i]);
    }
    cout << dp[n][h] <<endl; 

    return 0;
}

Measured memory_bytes: 39424
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <queue>
#include <vector>
using namespace std;
typedef char chr;
typedef double  dbl;
typedef long long int lld;
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
double getComb (double n, double x){
    if (x > n){
        return 0;
    }
    else{
        double r = 1.0;
        for(double i = 1.0; i<=x;i+=1){
            double a = n-i+1;
            double b = a / i;
            r*=b;
        }
        return r;
    }
}
int main () {
    FastIO
    lld n, i;
    cin >> n;
    lld s =0;
    for(i = 1; i<=n; i+=1){
    	if (i%3 == 0 || i%5 == 0){
    		
    	}
    	else{
    		s += i;
    	}
    }
    cout << s << "\n";
    return 0;
}

Measured memory_bytes: 3632
A,B,K = map(int, input().split())
for i in range(K):
    if (i %2 == 0):
        if(not A % 2 == 0):
            A -= 1
            B += A/2
            A /= 2
        else:
            B += A/2
            A /= 2
    else:
        if(not B % 2 == 0):
            B -= 1
            A += B/2
            B /= 2
        else:
            A += B/2
            B /= 2

print("{} {}".format(int(A),int(B)))

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

using namespace std;

int main()
{
  long long n,h[100010],dp[100010];
  cin>>n;
  for(int i=1;i<=n;++i)
    cin>>h[i];
  dp[1]=0;
  dp[2]=abs(h[1]-h[2]);
  for(int i=3;i<=n;++i)
  {
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  }
  cout<<dp[n]<<endl;
  return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cstdlib>
#include<ctype.h>
using namespace std;

char str[10000];
int i = 0;

int sort(const void *a, const void *b){
  return *(int*)b - *(int*)a;
}

int main(){
  scanf("%[^\n]", str);
  while(str[i] != '\0'){
    str[i] = toupper((unsigned char) str[i]);
    i++;
  }
  printf("%s\n", str);
  return 0;
}

Measured memory_bytes: 948