akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
#define si scanf
#define so printf
#define N 100100
#define nxt t[j]
template<typename TP>inline bool rd(TP& r)
{
	r=0;
	bool mns=0;
	char tmp=getchar();
	while(tmp<'0'||tmp>'9')
    {
		if(tmp=='-')
			mns=1;
		if(tmp==EOF)
			return 0;
		tmp=getchar();
    }
	while('0'<=tmp&&tmp<='9')
    {
		r=r*10+tmp-'0';
		tmp=getchar();
    }
	if(mns) r=-r;
    return 1;
}
int n,m,nm,ans;
struct Graph
{
	int h[N],x[N*10],t[N*10],tot;
	inline void ade(int u,int v)
	{
		++tot;
		x[tot]=h[u];
		h[u]=tot;
		t[tot]=v;
	}
};
Graph g,ms;
int dep[N],f[N][24];
void GetDep(int now,int fa)
{
	dep[now]=dep[fa]+1;
	f[now][0]=fa;
	for(int j=g.h[now];j;j=g.x[j])
		if(g.nxt!=fa)
			GetDep(g.nxt,now);
}
inline int LCA(int u,int v)
{
	if(dep[u]<dep[v])
		swap(u,v);
	for(int k=20;k>=0;--k)
		if(dep[f[u][k]]>=dep[v])
			u=f[u][k];
	if(u==v)
		return u;
	for(int k=20;k>=0;--k)
		if(f[u][k]!=f[v][k])
			u=f[u][k],v=f[v][k];
	return f[u][0];
}
int vs[N*10][2],rev[N*10],vis[N*10],fr[N*10];
int d[N];
void dfs(int now,int fa)
{
	for(int j=g.h[now];j;j=g.x[j])
		if(g.nxt!=fa)
		{
			dfs(g.nxt,now);
			d[now]+=d[g.nxt];
		}
	if(fa)
		ans+=min(d[now],2);
	int lst=0;
	for(int j=ms.h[now];j;j=ms.x[j])
		if(!vis[ms.nxt])
		{
			vis[ms.nxt]=1;
		    if(vs[ms.nxt][0]==vs[ms.nxt][1])
				continue;
			if(lst)
			{
				if(vs[lst][1]!=now)
				{
					rev[lst]^=1;
					swap(vs[lst][0],vs[lst][1]);
				}
				if(vs[ms.nxt][0]!=now)
				{
					rev[ms.nxt]^=1;
					swap(vs[ms.nxt][0],vs[ms.nxt][1]);
				}
				fr[lst]=fr[ms.nxt]=++nm;
				vs[nm][0]=vs[lst][0],vs[nm][1]=vs[ms.nxt][1];
				ms.ade(vs[nm][0],nm),ms.ade(vs[nm][1],nm);
				lst=0;
			}
			else
				lst=ms.nxt;
		}
	if(lst)
	{
		if(vs[lst][0]!=now)
		{
			rev[lst]^=1;
			swap(vs[lst][0],vs[lst][1]);
		}
		fr[lst]=++nm;
		vs[nm][0]=fa,vs[nm][1]=vs[lst][1];
		ms.ade(vs[nm][0],nm),ms.ade(vs[nm][1],nm);
	}
}
int main()
{
	rd(n),rd(m);
	for(int i=2,u,v;i<=n;++i)
	{
		rd(u),rd(v);
		g.ade(u,v);
		g.ade(v,u);
	}
	GetDep(1,0);
	for(int k=1;k<=20;++k)
		for(int i=1;i<=n;++i)
			f[i][k]=f[f[i][k-1]][k-1];
	for(int i=1,lca;i<=m;++i)
	{
		rd(vs[i][0]),rd(vs[i][1]);
		ms.ade(vs[i][0],i),ms.ade(vs[i][1],i);
		lca=LCA(vs[i][0],vs[i][1]);
		++d[vs[i][0]],++d[vs[i][1]];
		d[lca]-=2;
    }
	nm=m;
	dfs(1,0);
	for(int i=nm;i;--i)
	{
		rev[i]^=rev[fr[i]];
		if(rev[fr[i]])
			swap(vs[i][0],vs[i][1]);
	}
	so("%d\n",ans);
	for(int i=1;i<=m;++i)
		so("%d %d\n",vs[i][0],vs[i][1]);
	return 0;
}


Measured memory_bytes: 16768
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

int main(){
  ll h;
  cin >> h;
  ll cnt = 0;
  while(h > 0){
    h /= 2;
    cnt++;
  }
  ll ans = pow(2,cnt) - 1;
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    int ans = 0;
    vector<pair<int, int> > r, b;
    rep (i, n) {
      int c, d;  cin >> c >> d;
      r.push_back(make_pair(c, d));
    }
    rep (i, n) {
      int c, d;  cin >> c >> d;
      b.push_back(make_pair(c, d));
    }
    sort(r.begin(), r.end());
    sort(b.begin(), b.end());

    rep (i, n) {
      int index = -1;
      int t = -Inf;
      rep (j, n) {
        if (b[i].first > r[j].first && b[i].second > r[j].second) {
          if (r[j].second > t) {
            t = r[j].second;
            index = j;
          }
        }
      }
      if (index != -1) {
        ans++;
        r[index].first = Inf;
      }
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
const int Maxn=200000;
typedef long long ll;
int n,d,b;
struct Monster{
	int x,h;
	friend bool operator <(Monster p,Monster q){
		return p.x<q.x;
	}
}a[Maxn+5];
ll f[Maxn+5];
void add(int x,int a){
	for(int i=x;i<=n;i+=(i&(-i))){
		f[i]+=a;
	}
}
ll query(int x){
	ll ans=0;
	for(int i=x;i>0;i-=(i&(-i))){
		ans+=f[i];
	}
	return ans;
}
int main(){
	scanf("%d%d%d",&n,&d,&b);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i].x,&a[i].h);
	}
	sort(a+1,a+1+n);
	ll ans=0;
	int left,right,mid;
	ll last;
	for(int i=1;i<=n;i++){
		left=i,right=n;
		while(left<right){
			mid=(left+right+1)>>1;
			if(a[mid].x-a[i].x<=(d<<1)){
				left=mid;
			}
			else{
				right=mid-1;
			}
		}
		last=a[i].h-query(i);
		if(last<=0){
			continue;
		}
		ans+=(last+b-1)/b;
		add(i,(last+b-1)/b*b);
		add(left+1,-(last+b-1)/b*b);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n;
    cin >> n;
    ll ans=-1;
    for(ll i=0;i<100000;i++){
        if((ll)(i*1.08)==n){
            ans=i;
            break;
        }
    }
    if(ans==-1){
        cout << ":(" << endl;
    }
    else {
        cout << ans << endl;
    }
}


Measured memory_bytes: 3612
/*/**/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 21;

int a[N], pos[N];

struct bypos {
	bool operator ()(const int &i, const int &j) {
		return a[i] < a[j];
	}
};

int main() {
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++) {
		scanf("%d", a + i);
		pos[i] = i;
	}
	sort(pos, pos + n, bypos());
	int ans = 0;
	for(int i = 0; i < n; i++) {
		ans += (abs(i - pos[i]) % 2);
	}
	assert(ans % 2 == 0);
	printf("%d\n", ans / 2);
	return 0;
}


Measured memory_bytes: 1024
use std::cmp::*;
use std::collections::*;
#[cfg(debug_assertions)]
include! {"./debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}

macro_rules! read {
    ([$t:ident] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ([$t:ident]) =>
        (rl().split_whitespace().map(|w| read_type!(w, $t)).collect::<Vec<_>>());
    (_, [$t:ident] ; $n:expr) =>
        ((0..$n).map(|_| read!(_, [$t])).collect::<Vec<_>>());
    (_, [$t:ident]) =>
        (rl().split_whitespace().skip(1).map(|w| read_type!(w, $t)).collect::<Vec<_>>());
    ($($t:ident),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ($t:ident) => (read_type!(rl(), $t));
    ($($t:ident),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(read_type!(w.next().unwrap(), $t)),*)
    }};
}

macro_rules! read_type {
    ($s:expr, chars) => {
        $s.chars().collect::<Vec<char>>()
    };
    ($s:expr, usize1) => {
        read_type!($s, usize) - 1
    };
    ($s:expr, $t:ty) => {
        $s.parse::<$t>().unwrap()
    };
}

fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

////////////////////////////////////////////////////////////////////////////////

fn main() {
    let (n, a, b, a_to, b_to) = read!(usize, usize1, usize1, usize1, usize1);
    let s = read!(chars);

    let ans = if a_to < b_to {
        let mut ok = true;
        for i in a..a_to - 1 {
            if s[i] == '#' && s[i + 1] == '#' {
                ok = false;
            }
        }
        for i in b..b_to - 1 {
            if s[i] == '#' && s[i + 1] == '#' {
                ok = false;
            }
        }
        ok
    } else {
        let mut ok = true;
        for i in a..a_to - 1 {
            if s[i] == '#' && s[i + 1] == '#' {
                ok = false;
            }
        }
        for i in b..b_to - 1 {
            if s[i] == '#' && s[i + 1] == '#' {
                ok = false;
            }
        }
        let mut jump = false;
        let fr = b - 1;
        let to = b_to - 1 + 1;
        for i in fr..to {
            if s[i] == '.' && s[i + 1] == '.' && s[i + 2] == '.' {
                jump = true;
            }
        }
        ok && jump
    };

    println!("{}", if ans { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

ANS=sum(B)
for i in range(1,N):
    if A[i-1]==A[i]-1:
        ANS+=C[A[i-1]-1]

print(ANS)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    int n, a, b;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        n = sc.nextInt();
        a = sc.nextInt();
        b = sc.nextInt();
        long ans = 0;
        int prevX = sc.nextInt();
        for (int i = 1; i < n; i++) {
            int x = sc.nextInt();
            if ((long)a * (x - prevX) < b) {
                ans += (long)a * (x - prevX);
            } else {
                ans += b;
            }
            prevX = x;
        }
        System.out.println(ans);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 35524
#include <bits/stdc++.h>
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main()
{	
	double pi = 3.1416; 
    ll r;
	cin >> r;
    cout << 2.0*r*pi << endl;
}


Measured memory_bytes: 3788
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long A = sc.nextLong();
        long B = sc.nextLong();
        long ans = N / (A + B) * A;
        long amari = N % (A + B);
        if(amari >= A) {
            System.out.println(ans + A);
        }else {
            System.out.println(ans + amari);
        }
    }
}


Measured memory_bytes: 21972
import java.util.*;

public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		Long A = sc.nextLong();
		if(A==0){
			System.out.println("0");
			return;
		}
		String str = sc.next();
		str = str.replace(".", "");
		Long B = Long.valueOf(str);
		A *= B;
      	if(A<100){
         	System.out.println("0");
			return;
        }
      	
		String ans = String.valueOf(A);
		int len = ans.length();
		System.out.println(ans.substring(0, len-2));
		return;
	}
}

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

int main() {
	int n,W;
	cin>>n>>W;
	vector<int> w(n), v(n);
	vector<long long int> dp(W+1, 0);
	for(int i=0;i<n;i++) {
		cin>>w[i]>>v[i];
	}
	for(int i=0;i<n;i++) {
		for(int j=W;j>=w[i];j--) {
			dp[j] = max(dp[j], dp[j-w[i]] +v[i]);
		}
	}
	cout<<dp[W]<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
void pass(bool a)
{
  if(a) puts("Bad");
  else puts("Good");
  exit(0);
}
int main()
{
  string s;
  cin>>s;
  for(int i=0;i<3;i++) if(s[i]==s[i+1]) pass(true);
  pass(false);
}

Measured memory_bytes: 256
A = [1000000000,1000000000]
Q = []

def a(x,y,z)
 Q << [?+,x,y,z]*" "
 A[z] = (A[x]||=0) + (A[y]||=0)
end

def c(x,y,z)
 Q << [?<,x,y,z]*" "
 A[z] = (A[x]||=0) < (A[y]||=0) ? 1 : 0
end

c(3,0,3)
0.upto(30){|i|
 a(3+i,3+i,4+i)
}

def to_b(x,s)
 a(x,3,x)
 31.downto(0){|i|
  a(3+i,s+33,s+32)
  c(s+32,x,s+i)
  a(s+i,2,s+32)
  i.times{a(s+32,s+32,s+32)}
  a(s+32,s+33,s+33)
 }
end

to_b(0,67)
to_b(1,195)

30.times{|i|
 30.times{|j|
  a(67+i,195+j,324)
  c(3,324,325)
  a(326+i+j,325,326+i+j)
 }
}

60.times{|i|
 i.times{a(326+i,326+i,326+i)}
 a(2,326+i,2)
}

# STDERR.puts "Q = #{Q.size}",A.map.with_index{|x,i|x||=0;"#{i}:#{x}"}*" "

puts Q.size,Q


Measured memory_bytes: 14836
//Compete against Yourself.
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N];

int findTrailingZeros(int n) 
{ 
   // Initialize result 
   int count = 0; 

   // Keep dividing n by powers of 
   // 5 and update count 
   for (int i = 5; n / i >= 1; i *= 5) 
      count += n / i; 

   return count; 
} 

void solve(){
   cin>>n;

if (n % 2){
   cout<<0;
   exit(0);
}

n/= 2;
int ans = findTrailingZeros(n);

cout<<ans;

}

int32_t main(){_
   
   int t = 1;
   //cin >> t;

   while(t--){
     solve();
     cout << endl;
   }
   

   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){


 
  int H,W;

  for( ; ; ){

    cin>>H>>W;

    if(H==0&&W==0)break;

    for(int i=0;i<H;i++){
      for(int j=0l;j<W;j++){
	cout<<"#";
      }
      cout<<endl;
    }

    cout<<endl;
  }









    
  return 0;
}

Measured memory_bytes: 3076
/*input
RRR
*/
 
 
#include <bits/stdc++.h>
using namespace std;
 
#define ld long double
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define INTMAX  2147483647
#define INTMIN  -2147483648
#define LLMAX 9223372036854775807
#define LLMIN -9223372036854775808
#define MOD 1000000007
typedef map<long long int, long long int> mpi;
typedef set<long long int> seti;
typedef multiset<long long int> mseti;
typedef priority_queue<long long int> pq;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define PI 3.1415926535
#define dbg(x) cerr << "\n" << (#x) << " = " << (x) << endl ;
//#define cerr if(false)cerr

// cout<<fixed<<setprecision(10)<<(v1+v2+v3)<<endl;
  
struct node{
    ll val;
};
struct Interval {int start, end;};
bool compare(struct node n1, struct node n2) {
    return (n1.val < n2.val);
}






int main(){
	string s; cin>>s;
	int ans = 0;
	int ct = 0;
	for(int i=0;i<s.size();i++){
		if(s[i] == 'R'){++ct;}
		else{
			ans = max(ct,ans);
			ct=0;
		}
	}
	ans = max(ct,ans);
	cout<<ans<<endl;
	return 0;	
}















 

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

struct UnionFind{
    vector<int> par; // par[i]:iの親の番号
    
    UnionFind(int N) : par(N) {
        for(int i=0; i<N; i++) par[i] = i;
    }
    
    int root(int x){ // xが属する木の根
        if(par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    
    void unite(int x, int y){ // xとyの木を併合
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return;
        par[rx] = ry;
    }
    
    bool same(int x, int y){ // xとyが同じ木に属するかどうか
        return root(x) == root(y);
    }
};

int main(void){
    ll N,M; cin >> N >> M;
    VI A(M), B(M);
    REP(i,M){
        int a,b; cin >> a >> b;
        a--; b--;
        A[i] = a; B[i] = b;
    }
    UnionFind uf(N);
    vector<ll> n(N,1);
    vector<ll> ans(M+1,0); ans[M] = N*(N-1)/2;
    RREP(i,M){
        if(uf.same(A[i], B[i])){
            ans[i] = ans[i+1];
        }
        else{
            ll ra = uf.root(A[i]), rb = uf.root(B[i]);
            ans[i] = ans[i+1] - n[ra]*n[rb];
            uf.unite(A[i], B[i]);
            n[uf.root(A[i])] = n[ra] + n[rb];
        }
    }

    REP(i,M) cout << ans[i+1] << endl;
    return 0;
}

Measured memory_bytes: 4096
n, m = map(int, input().split())
a = []
for i in range(n):
    a.append(input())

b = []
for i in range(m):
    b.append(input())

diff = n - m
if diff == 0:
    if a == b:
        print('Yes')
    else:
        print('No')
else:
    for i in range(diff + 1):
        for j in range(diff + 1):
            ans = True
            for k in range(m):
                for l in range(m):
                    if b[k][l] != a[i + k][j + l]:
                        ans = False
            if ans:
                print('Yes')
                exit()
    print('No')


Measured memory_bytes: 3064
import math

a,b,h,m=map(int,input().split())

long_angle=6*m
short_angle=(60*h+m)/2
angle=max(long_angle,short_angle)-min(long_angle,short_angle)
if angle>180:
    angle=360-angle

ans = math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(angle)))
print(ans)


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

int main(){
  string s; cin >> s;
  map<int, int>mp;
  int n = s.size();
  for(int i = 0; i < n; ++i){
    mp[s[i]-'a']++;
    if(mp[s[i]-'a'] > 1) {
      cout << "no" << endl;
      return 0;
    }
  }
  cout << "yes" << endl;
  return 0; 
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
signed main()
{
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    vector<int> c(n);
    rep(i, n) cin >> c[i];
    
    int sum = 0;
    rep(i, n) {
        if (v[i] - c[i] > 0) {
            sum += v[i] - c[i];
        }
    }
    put(sum);
    return 0;
}

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }

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

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

  int Max = a[0], Min = a[0];
  for(int i = 0; i < N; i++){
    if(Max < a[i]){
      Max = a[i];
    }
    if(Min > a[i]){
      Min = a[i];
    }
  }
  //cout << Max << " " << Min << endl;
  int ans = 0;
  ans = Max - Min;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
tree = [None for _ in range(N)]
root = set(range(N))

for i in range(N):
    i, l, r = map(int,input().split())
    tree[i] = (l, r)
    root -= {l, r}

root_node = root.pop()

def preorder(i):
    if i == -1:
        return
    (l, r) = tree[i]
    print(" {}".format(i), end = "")
    preorder(l)
    preorder(r)
    
def inorder(i):
    if i == -1:
        return
    (l, r) = tree[i]
    inorder(l)
    print(" {}".format(i), end = "")
    inorder(r)
    
def postorder(i):
    if i == -1:
        return
    (l, r) = tree[i]
    postorder(l)
    postorder(r)
    print(" {}".format(i), end = "")
    
print('Preorder')
preorder(root_node)
print()

print('Inorder')
inorder(root_node)
print()

print('Postorder')
postorder(root_node)
print()

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

int main()
{
	int n;
	int i;
	
	while(1)
	{
		cin >> n;
		if(n == 0) break;
		int as=0,bs=0;
		for(i=0;i<n;i++)
		{
			int a =0,b = 0;
			cin >> a >> b;
			if(a==b)
			{
				as += a;
				bs += b;
			}
			else if(a>b)
			{
				as += (a+b);
			}
			else
			{
				bs += (a+b);
			}
		}
		cout << as << " " << bs << endl;

	}
	
	return 0;
}

Measured memory_bytes: 1160
class _in{struct my_iterator{int it;const bool rev;explicit constexpr my_iterator(int it_, bool rev=false):it(it_),rev(rev){}constexpr int operator*(){return it;}constexpr bool operator!=(my_iterator& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const my_iterator i,n;public:explicit constexpr _in(int n):i(0),n(n){}explicit constexpr _in(int i,int n):i(i,n<i),n(n){}constexpr const my_iterator& begin(){return i;}constexpr const my_iterator& end(){return n;}};

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

using i64 = long long;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<int> a(N);
    vector<vector<int>> b(N);
    for(int i : _in(N)) {
        cin >> a[i];
        --a[i];
        b[a[i]].push_back(i);
    }
    int cnt = 0;
    for(int i : _in(N)) {
        for(int x : b[i])
          if(x == a[i])
            ++cnt;
    }
    cout << cnt / 2 << endl;
    return 0;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
const ll INF=1e16;
int main()
{
    int n;
    cin>>n;
    ll x=1,y=1;
    ll a,b;
    ll r,l;
    for(int i=0; i<n; i++){
        cin>>a>>b;
        l=1,r=INF;
        while(l<r){
            ll mid=(l+r)/2;
            if(mid*a>=x && mid*b>=y)  r=mid;
            else  l=mid+1;
        }
        if(l*a<x || l*b<y){
            l=l+max((x-l*a)/a,(y-b*l)/b);
        }
        while(l*a<x || l*b<y)  l++;
        x=l*a;
        y=l*b;
    }
    cout<<x+y<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, M; 
  cin >> N >> M;

  vector<int> cnt(M, 0);
  vector<int> vec(M, 0);

  vector<int> A(N);
  map<int, int> m;
  REP(i, N){
    cin >> A[i];
    m[A[i]]++;
    cnt[A[i]%M]++;
  }

  for(auto p : m){
    vec[p.first%M] += p.second/2;
  }

  int ans = cnt[0]/2;
  FOR(i, 1, M){
    int j = M-i;

    if(i == j){
      ans += cnt[i]/2;
      cnt[i] %= 2;
    }
    else{
      int now = min(cnt[i], cnt[j]);
      ans += now;
      cnt[i] -= now;
      cnt[j] -= now;
    }

    ans += min(cnt[i]/2, vec[i]);
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 8832
#include<bits/stdc++.h>
using ll = long long;
#define int ll
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
signed main(){
    int n,w,z; cin>>n>>w>>z;
    vector<int>v(n); rep(i,n)cin>>v[i];
    if(n==1){
        cout<<abs(v[0]-z)<<endl;
    }else{
        cout<<max(abs(v[n-2]-v[n-1]),abs(v[n-1]-z))<<endl;
    }
}

Measured memory_bytes: 384
// code for nothing 
// live for nothing 
// die for nothing
// nothing is everything
# include <iostream>
using namespace std;
int main()
{
	unsigned int M = 1000000007; 
	long long n,k,s,p;
	cin>>n>>k;
	int a[n];
	for(int i=0; i<n; i++)
	{
		cin>>a[i];
		s=a[0];
	}
	for(int i=0; i<n-k; i++)
	{
		if(a[i+k]>s)
		{
			s=a[i+1];
			cout<<"Yes"<<endl;
		}
		else
		{
			s=a[i+1];
			cout<<"No"<<endl;
		}
	}
}


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

int main(){
  int a, b;
  cin >> a >> b;
  int c = b - a;
  int ans = 0;
  for(int i = 1; i <= c; i++){
    ans += i;
  }
  ans -= b;
  cout << ans << endl;
  return 0;
}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,t[50],ans;
string x;
map<string,int> m;

signed main() {
    cin >> n;
    rep(i,n) {
        string s;
        cin >> s >> t[i];
        m[s] = i;
    }
    cin >> x;
    int b = m[x]+1;
    rep(i,b) ans -= t[i];
    rep(i,n) ans += t[i];
    cout << ans << endl;
}















Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<queue>
using namespace std;
const int INF=0x3f3f3f3f;
typedef long long ll;
int n,a,b;
ll ans;
int sum(int x)
{
	int tmp=0,temp=x;
	while(x)
	{
		tmp+=x%10;
		x/=10;
	}
	//printf("%d\n",tmp);
	if(tmp>=a&&tmp<=b)
	{
		return temp;
	}
	return 0;
}
int main()
{
	scanf("%d%d%d",&n,&a,&b);
	for(int i=1;i<=n;i++)
	{
		ans+=sum(i);
		//printf("%d\n",sum(i));
	}
	printf("%lld\n",ans);
	return 0;
}

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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 
#define MAXN 11111

const int INF = 1 << 29 ;
typedef long long ll ;
typedef pair < int , int > pii ;

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

    int count = 1 ;
    char prev = ' ' ;

    for(int i = 0 ; i<(int)s.length() ; i++) {
        if(prev == s[i]) 
            count++ ;
        else count = 1 ;
        prev = s[i] ;
        if(count>=3)break ;
    }
    if(count>=3) cout << "Yes" << endl ;
    else cout << "No" << endl ;

    return 0 ;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>

using namespace std;

int inf = 1000000000;
int main(){
    int ans = 0;
    string a,b;
    cin >>a >>b;
    for(int i=0;i<3;i++){
        if(a[i] == b[i])ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int search(int a[20],int from,int n,int m){
	int judge;
	
	for(int i=from;i<n;i++){
		judge=m-a[i];
		if(judge<0)continue;
		else if(judge==0)return 1;
		else if(from==n)return 0;
		else if(search(a,i+1,n,judge))return 1;
	}
	return 0;
}

int main(void){
	int n,q,m;
	int a[20];
	
	scanf("%d",&n);
	
	for(int i=0;i<n;i++)scanf("%d",&a[i]);
	
	scanf("%d",&q);
	
	for(int i=0;i<q;i++){
		scanf("%d",&m);
		if(search(a,0,n,m))printf("yes\n");
		else printf("no\n");
	}
	
	return 0;
}


Measured memory_bytes: 2144
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;


int main() {
    string S; cin >> S;
    int K; cin >> K;
/*
    char s = 1;
    string z = "z";
    cout << z << '\n';
    z[0] += s;
    cout << z << '\n';
    int a_ = z[0] - 'z';
    cout << a_ << '\n';

    cout << 'p' - 'l' << ' ' << 't' - 'z' << '\n';
    cout << 'f' + 17 << '\n';
    */

    int ind = 0;
    while (K > 0) {
        if (S[ind] == 'a') {
            ind++;
            continue;
        }
        if (ind == S.size()) break;
        int cost = 'z' - S[ind] + 1;
        if (cost <= K) {
            S[ind] = 'a';
            K -= cost;
        }
        ind++;
    }
    if (K > 0) {
        int plus = K % 26;
        S[S.size() - 1] += plus;
    }
    cout << S << '\n';
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
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;
}
int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    vector<ll> T(n), A(n);
    rep(i,n){
        cin>>T[i]>>A[i];
    }
    ll t = T[0], a = A[0];
    repr(i, 1, n){
        DEBUG{
            printf("t: %lld, a: %lld\n", t,a);
        }
        if(T[i] == A[i]) {
            chmax(t, a);
            chmax(a, t);
            continue;
        }
        if(t % T[i] == 0 && a % A[i] == 0 && t / T[i] == a / A[i]) {
            DEBUG{
                printf("continue\n");
            }
            continue;
        }
        if(T[i] < A[i]) {
            if(t % T[i] != 0){
                t = (t / T[i] + 1) * T[i];
            }
            if(!chmax(a, t / T[i] * A[i])){
                if(a % A[i] != 0){
                    a = (a / A[i] + 1) * A[i];
                }
                t = a / A[i] * T[i];
            }
        } else {
            if(a % A[i] != 0){
                a = (a / A[i] + 1) * A[i];
            }
            DEBUG{
                printf("a: %lld\n", a);
            }
            if(!chmax(t, a / A[i] * T[i])){
                if(t % T[i] != 0){
                    t = (t / T[i] + 1) * T[i];
                }
                a = t / T[i] * A[i];
            }

        }
    }
    DEBUG{
        printf("t: %lld, a: %lld\n", t,a);
    }
    cout << a + t << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	int cnt=0;
	auto pri = prime_table(55555);
	FOR(i,2,55556){
		if(pri[i] && i%5==1){
			cout << i << " ";
			cnt++;
		}
		if(cnt==n) break;
	}
	
	return 0;
}



Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	x := getNextInt(scanner)
	y := getNextInt(scanner)

	if x > y {
		x, y = y, x
	}
	if x*2 < y || (x+y)%3 != 0 {
		fmt.Println(0)
		return
	}

	c := (x + y) / 3
	facs := make([]int64, c+1)
	invs := make([]int64, c+1)

	facs[0] = 1
	invs[0] = inv(facs[0])
	mod := int64(1e9 + 7)
	for i := 1; i <= c; i++ {
		facs[i] = (facs[i-1] * int64(i)) % mod
		invs[i] = inv(facs[i])
	}
	k := x - c

	fmt.Fprintln(writer, cm(facs[c], invs[c-k], invs[k]))
	writer.Flush()
}

func cm(f, i, ii int64) int64 {
	mod := int64(1e9 + 7)
	return (((f * i) % mod) * ii) % mod
}
func inv(n int64) int64 {
	var ii [32]int64
	mod := int64(1e9 + 7)
	ii[0] = n
	for i := 1; i < 31; i++ {
		ii[i] = (ii[i-1] * ii[i-1]) % mod
	}
	var ans int64
	ans = 1
	m := mod - 2
	for i := 30; i >= 0; i-- {
		for m >= 1<<uint(i) {
			ans = (ans * ii[i]) % mod
			m -= 1 << uint(i)
		}
	}

	return ans
}


Measured memory_bytes: 11392
#include<bits/stdc++.h>
#define ll long long
#define int long long int
#define MOD 1000000007
#define mkp make_pair
#define maxn 100005
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,a,b) for(int i=a;i<b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define  vi vector<int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define in cin>>
#define out cout<<
using namespace std;
const int infi=1e9+7;
void printVector(vector<int> v){
    for(int i=0;i<(int)v.size();i++)
        cout<<v[i]<<" ";
    out endl;
}

void printArray(int arr[],int n)
{
   for(int i=0;i<n;i++)cout<<arr[i]<<' ';
cout<<endl;
}
 set<pair<int,int>> primeset;
 vi prime_number;
void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
        for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
           primeset.insert(mkp(p,1));
}
ll modExp(ll base, ll power) {
    if (power == 0) {
        return 1;
    } else {
        ll cur = modExp(base, power / 2); cur = cur * cur; cur = cur % MOD;
        if (power % 2 == 1) cur = cur * base;
        cur = cur % MOD;
        return cur;
    }
}
//for making unordered_map with pair
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
int32_t main()
{
fastio;
int t=1;
//in t;
int tt=1;
while(t--){
string s;in s;
if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes";
else cout<<"No";
}
    return 0;
}

/*
google kick start
  cout << "Case #" << tt << ": "<<ans<<endl;
*/


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

int main() {
  int a;
  cin >> a;
  
  
  if(a%(a%10+(a%100)/10+(a%1000)/100+(a%10000)/1000+(a%100000)/10000+(a%1000000)/100000+(a%10000000)/1000000+(a%100000000)/10000000+(a%1000000000)/100000000+(a/1000000000) )== 0){
    cout <<"Yes" << endl;
  }
    else{
      cout <<"No" <<endl;
    }
  }


Measured memory_bytes: 256
n, x = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)

ans = 0
for i in a:
    if x >= i:
        ans += 1
        x -= i
    else:
        x = 0
        break
if x > 0:
    ans -= 1

print(ans)


Measured memory_bytes: 61840
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,h,i,o=0;
	cin>>n>>k;
	for(i=0;i<n;i++){
		cin>>h;
		if(h>=k){
			o++;
		}
	}
	cout<<o<<endl;
}

Measured memory_bytes: 256
#  --*-coding:utf-8-*--


def main():
    N, M = map(int, input().split())
    
    N2 = 2**N
    X = [10**8+1]*N2
    X[0] = 0

    for i in range(M):
        a, b = map(int, input().split())
        C = list(map(int, input().split()))

        k = sum(1<<(c-1) for c in C)
        
        for j in range(N2):
            if X[j|k] > X[j] + a:
                X[j|k] = X[j] + a

    
    ans = X[-1]
    if ans >= 10**8+1:
        ans = -1

    print(ans)
    

if __name__ == '__main__':
    main()



Measured memory_bytes: 3188
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONG_INF 100000000000000
int main() {
	long long n,a,b;
	cin >> n >> a >> b;
	vector<long long> x;
	REP(i, n) {
		int c;
		cin >> c;
		x.push_back(c);
	}
	long long ans = 0;
	for (int i = 1;i < x.size();++i) {
		ans += min(b, a*(x[i] - x[i-1]));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1400
using System;
using System.Collections.Generic;

namespace ABC
{
    class ABC075D
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int N = int.Parse(str[0]);//全点数
            int K = int.Parse(str[1]);//包含してほしい点数
            var PointXs = new List<Int64>(N);
            var PointYs = new List<Int64>(N);
            var xList = new List<Int64>(N);
            var yList = new List<Int64>(N);
            for (int i = 0; i < N; ++i)
            {
                string[] s = Console.ReadLine().Split(' ');
                Int64 x = (Int64)int.Parse(s[0]);
                PointXs.Add( x );
                xList.Add(x);
                Int64 y = (Int64)int.Parse(s[1]);
                PointYs.Add( y );
                yList.Add(y);
            }

            //座標をソート
            xList.Sort();
            yList.Sort();

            UInt64 minArea = UInt64.MaxValue;
            for(int xi = 0; xi < N; ++xi)//矩形の端点のx座標について.
            {
                for (int xj = xi+1; xj < N; ++xj)//もう一方の端点のx座標について
                {
                    var lx = xList[xi];//矩形の左のX座標
                    var rx = xList[xj];//右
                    
                    for (int yi = 0; yi < N; ++yi)//矩形の端点のy座標について
                    {
                        for (int yj = yi+1; yj < N; ++yj)//もう一方の端点のy座標について
                        {
                            var by = yList[yi];//下
                            var uy = yList[yj];//上

                            //その矩形が内包する点の数を計算
                            int num = 0;
                            for(int i = 0; i < N; ++i)
                            {
                                if(lx <= PointXs[i] && PointXs[i] <= rx &&
                                   by <= PointYs[i] && PointYs[i] <= uy)
                                {
                                    ++num;
                                }
                            }

                            if(num >= K)
                            {
                                UInt64 area = (UInt64)((rx - lx) * (uy - by));
                                minArea = Math.Min(minArea, area);
                            }
                        }
                    }
                }
            }
            Console.WriteLine("{0}",minArea);
        }
    }
}


Measured memory_bytes: 13396
#include<stdio.h>

int main(void)
{
  long int n, d;
  long int x, y;

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

  int ans = 0;

  for(int i=0; i<n; i++){
	scanf("%ld %ld", &x, &y);
	if(x*x + y*y <= d*d){
	  ans++;
	}
  }

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

  return 0;
}


Measured memory_bytes: 1712
#include<stdio.h>
int main(void){
  int a, b;
  int ans;
  int c, d, e;
  
  scanf("%d %d", &a, &b);
  
  c = a + b;
  d = a - b;
  e = a * b;
 
  if(c >= d && c >= e){
    ans = c;
  }
  if(d > c && d > e){
    ans = d;
  }
  if(e > c && e > d){
    ans = e;
  }
  
  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cmath>
#include<vector>
//#include<string>

using namespace std;

void elem_swap(int &a,int &b){
  int temp=a;
  a=b;
  b=temp;
}

int selectionSort(vector<int> &vec,int size){
  int min_index,count=0;
  for(int i=0;i<size-1;i++){
    min_index=i;
    for(int j=i;j<size;j++){
      if(vec.at(min_index)>vec.at(j)){
        min_index=j;
      }
    }
    if(min_index>i){
      elem_swap(vec.at(i),vec.at(min_index));
      count++;
    }
  }
  return count;
}

int main(void){

  int size,count;
  cin>>size;
  vector<int> vec(size);
  for(int i=0;i<size;i++) cin>>vec.at(i);

  count=selectionSort(vec,size);

  for(int i=0;i<size-1;i++) cout<<vec.at(i)<<" ";
  cout<<vec.at(size-1)<<endl;
  cout<<count<<endl;

  return 0;
}



Measured memory_bytes: 3096
def resolve():
    # n switches, m bulbs
    n, m = map(int, input().split())
    s = list(list(map(int, input().split()))[1:] for _ in range(m))
    p = list(map(int, input().split()))
    print(sum([1 for i in range(1 << n) if all([sum([1 for sji in sj if i & (1 << (sji - 1))]) % 2 == pj for sj, pj in zip(s, p)])]))


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ls x<<1
#define rs x<<1|1
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-6;
const ull hashp=1e7+19;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=2e5+100;

void solve()
{
	int n;cin>>n;
	int ans=-1;
	rep1(i,50000){
		if((int)(i*1.08)==n){
			ans=i;
			break;
		}
	}
	if(~ans)ac;
	else printf(":(");
}
int main(){
    //IOS;
    solve();
    return 0;
}

Measured memory_bytes: 256
n,m = map(int, input().split())
a = [list(map(int,input().split())) for _ in range(n)]

a.sort()
b1=0
b2=0
c=0

for i in range(n):
  b1, b2 = b1+a[i][1], b1
  if b1 <= m:
    c += a[i][0] * a[i][1]
  else:
    c += a[i][0] * (m - b2)
    break

print(c)

Measured memory_bytes: 27344
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

const int MAXN = 1e5+10;
int n, m;
vector<int> adj[MAXN];

int mem[MAXN];
int dp(int u) {
  int & ans = mem[u];
  //cerr << u << " " << ans <<endl;
  if (ans>=0) return ans;
  ans = 0;
  for(int v:adj[u]) {
    ans = max(ans,1+dp(v));
  }
  //cerr << "@ " << u << " " << ans << " " << mem[u] <<endl;
  return ans;
}

int main(){
  cin.tie(0); ios_base::sync_with_stdio(0);
  cin >> n >> m;
  memset(mem,-1,sizeof mem);
  for(int i=0;i<m;i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
  }
  int ans = 0;
  for(int i=1;i<=n;i++) ans = max(dp(i), ans);
//  for(int i=1;i<=n;i++) cerr << dp(i) <<endl;
  cout << ans <<endl;
}


Measured memory_bytes: 7552