akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

using namespace std;
int main(void)
{
  for(;;){
    vector<pair<int,int> > alist[32][32];
    queue<pair<int,pair<int,int> > > bfs;
    int steps[32][32];
    REP(i,32) REP(j,32)
      steps[j][i]=100000000;
    int w,h;
    cin >> w >> h;
    if(!w&&!h) return 0;
    REP(j,h){
      if(j)
	REP(i,w){
	  int tmp;
	  cin >> tmp;
	  if(tmp==0){
	    alist[j][i].PB(MP(j-1,i));
	    alist[j-1][i].PB(MP(j,i));
	  }
	}
      REP(i,w-1){
	int tmp;
	cin >> tmp;
	if(tmp==0){
	  alist[j][i].PB(MP(j,i+1));
	  alist[j][i+1].PB(MP(j,i));
	}
      }
    }
    for(bfs.push(MP(1,MP(0,0)));!(bfs.empty());bfs.pop()){
      int canstep=bfs.front().first;
      pair<int,int> xy=bfs.front().second;
      int x=xy.second,y=xy.first;
      if(canstep<steps[y][x]){
	steps[y][x]=canstep;
	REP(i,SZ(alist[y][x])){
	  bfs.push(MP(canstep+1,alist[y][x][i]));
	}
      }
    }
    int answer=steps[h-1][w-1];
    if(answer>10000) answer=0;
    cout << answer << endl;
  }
}

Measured memory_bytes: 1292
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  vector<P> a(n),x(n),y(n);
  for(int i=0;i<n;i++) cin >> a[i].first >> a[i].second;
  int ans=0;
  
  for(int i=0;i<n;i++) a[i].first-=a[i].second;
  sort(a.begin(),a.end());
  for(int i=0;i<n;i++) a[i].first+=a[i].second;
  x[0].first=a[0].first; x[0].second=a[0].second;
  y[n-1].first=a[n-1].first; y[n-1].second=a[n-1].second;
  for(int i=1;i<n;i++){
    x[i].first=max(a[i].first,x[i-1].first);
    x[i].second=min(a[i].second,x[i-1].second);
  }
  for(int i=n-2;i>=0;i--){
    y[i].first=max(a[i].first,y[i+1].first);
    y[i].second=min(a[i].second,y[i+1].second);
  }
  for(int i=1;i<n;i++){
    int cnt=max(0,x[i-1].second-x[i-1].first+1)+max(0,y[i].second-y[i].first+1);
    ans=max(ans,cnt);
  }
  
  for(int i=0;i<n;i++) a[i].first+=a[i].second;
  sort(a.begin(),a.end());
  for(int i=0;i<n;i++) a[i].first-=a[i].second;
  x[0].first=a[0].first; x[0].second=a[0].second;
  y[n-1].first=a[n-1].first; y[n-1].second=a[n-1].second;
  for(int i=1;i<n;i++){
    x[i].first=max(a[i].first,x[i-1].first);
    x[i].second=min(a[i].second,x[i-1].second);
  }
  for(int i=n-2;i>=0;i--){
    y[i].first=max(a[i].first,y[i+1].first);
    y[i].second=min(a[i].second,y[i+1].second);
  }
  for(int i=1;i<n;i++){
    int cnt=max(0,x[i-1].second-x[i-1].first+1)+max(0,y[i].second-y[i].first+1);
    ans=max(ans,cnt);
  }
  
  sort(a.begin(),a.end());
  x[0].first=a[0].first; x[0].second=a[0].second;
  y[n-1].first=a[n-1].first; y[n-1].second=a[n-1].second;
  for(int i=1;i<n;i++){
    x[i].first=max(a[i].first,x[i-1].first);
    x[i].second=min(a[i].second,x[i-1].second);
  }
  for(int i=n-2;i>=0;i--){
    y[i].first=max(a[i].first,y[i+1].first);
    y[i].second=min(a[i].second,y[i+1].second);
  }
  for(int i=1;i<n;i++){
    int cnt=max(0,x[i-1].second-x[i-1].first+1)+max(0,y[i].second-y[i].first+1);
    ans=max(ans,cnt);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 2560
package main

import (
	"fmt"
)
func Mizar(N int) int{
	count := 0
	r := 0
	
	for(N > 0){
		r = N % 10
		count = count + r
		N = N / 10
	}

	return count
}

func main(){
	var A, B, N int
	sum := 0
	fmt.Scanf("%d%d%d",&N,&A,&B)
	for i := 1; i <= N; i++ {
		count := Mizar(i)
		if count >= A && count <= B {
			sum = sum + i
		} 
	}
	fmt.Printf("%d\n",sum)
	
}

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



int main(){
  int n;
  cin >> n;
  string s[n];
  vector<pair<int,int>> ls,rs;
  int sum=0;
  rep(i,n){
    cin >> s[i];
    int tmp=0,min=0;
    rep(j,(int)s[i].size()){
      if(s[i][j]=='('){
        tmp++;
        sum++;
      }else{
        tmp--;
        if(tmp<min)min=tmp;
        sum--;
      }
    }
    if(tmp>0)ls.emplace_back(min,tmp);
    else rs.emplace_back(min-tmp,-tmp);
  }
  if(sum!=0){
    cout << "No\n";
    return 0;
  }
  sort(ls.rbegin(), ls.rend());
  sort(rs.rbegin(), rs.rend()); 
  int h=0;
  for(auto l: ls){
    if(h+l.first<0){
      cout << "No\n";
      return 0;
    }
    h += l.second;
  }
  int h2=0;
  for(auto r: rs){
    if(h2+r.first<0){
      cout << "No\n";
      return 0;
    }
    h2 += r.second;
  }
  cout << "Yes\n";

  return 0;
}

Measured memory_bytes: 42492
#include <iostream>
#include <algorithm>
#include <set>
#include <numeric>
#include <vector>

using namespace std;


int main()
{
	char s[5];
	cin >> s;
	char s1[3], s2[3];
	s1[0] = s[0];
	s1[1] = s[1];
	s1[2] = '\0';
	s2[0] = s[2];
	s2[1] = s[3];
	s2[2] = '\0';

	int d1 = atoi(s1);
	int d2 = atoi(s2);

	if (0 < d1 && d1 < 13)
	{
		if (0 < d2 && d2 < 13)
		{
			cout << "AMBIGUOUS" << endl;
		}
		else
		{
			cout << "MMYY" << endl;
		}
	}
	else
	{
		if (0 < d2 && d2 < 13)
		{
			cout << "YYMM" << endl;
		}
		else
		{
			cout << "NA" << endl;
		}

	}

	return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define INF (1 << 30)
#define ALEN(ARR) (sizeof(ARR) / sizeof((ARR)[0]))
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back

#if DEBUG
#define _DEBUG(x) cout << #x << ": " << x << endl
#define _DDEBUG(x, y) cout << #x << ": " << x << ", " << #y << ": " << y << endl
#else
#define _DEBUG(x) ;
#define _DDEBUG(x, y) ;
#endif

#define ll long long
#define ull unsigned long long
#define MOD 1000000007

/** FOR VECTOR DEBUG */
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  if (!v.empty()) {
    out << '[';
    copy(v.begin(), v.end(), ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}

/* template end */
const int limit = 11729;
string dp[limit];
int match[10] = {-INF, 2, 5, 5, 4, 5, 6, 3, 7, 6};

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

  int n, m;
  cin >> n >> m;

  vector<pair<int, string>> al(m);
  REP(i, m) {
    int t;
    cin >> t;
    al[i] = mp(t, to_string(t));
  }
  sort(al.begin(), al.end(), [](auto a, auto b) { return b.first > a.first; });
  REP(i, limit) {
    dp[i] = "-1";
  }
  dp[0] = "";
  REP(i, n) {
    if (dp[i].find("-") != string::npos) {
      continue;
    }
    for (auto j : al) {
      int idx = i + match[j.first];
      dp[idx] = [&](string s, string t) {
        if (s.find("-") != string::npos || t.size() > s.size() || t > s) {
          return t;
        }
        return s;
      }(dp[idx], dp[i] + j.second);
    }
  }

  cout << dp[n] << endl;

  return 0;
}

Measured memory_bytes: 45184
#include <stdio.h>

int main(void)
{
	int N;
	int i;
	int sum = 0;
	
	scanf("%d", &N);
	
	for(i = 1; i <= N; i++){
		sum += i;
	}
	
	printf("%d\n", sum);
	
	return 0;
}


Measured memory_bytes: 128
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	for _, _ = range Scan() {
		fmt.Print("x")
	}
	fmt.Println("")
}


Measured memory_bytes: 1776
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <bits/stdc++.h>
#define re register
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=10000+10,L=1000000+10,P=80000+10;
const int mod=1000000007;
inline int qpow(int a,int b) { int c=1;
    for (;b;b>>=1,a=1ll*a*a%mod) if (b&1) c=1ll*c*a%mod;
    return c;
}

int v[L],mp[L],p[P],cnt=0;
inline void sieve(int n) {
    for (re int i=2;i<=n;++i) {
        if (!v[i]) p[++cnt]=i,mp[i]=cnt;
        for (re int j=1;j<=cnt&&i*p[j]<=n;++j) {
            v[i*p[j]]=1,mp[i*p[j]]=j;
            if (i%p[j]==0) break;
        }
    }
}

int n;
int a[N],b[N];
int mx[P];

int main() { sieve(1e6);
    n=read();
    for (re int i=1;i<=n;++i) a[i]=read();
    for (re int i=1;i<=n;++i) {
        int x=a[i];
        while (x>1) { int v=mp[x];
            int c=0;
            while (x%p[v]==0) x/=p[v],++c;
            mx[v]=max(mx[v],c);
        }
    }
    int lcm=1;
    for (re int i=1;i<=cnt;++i) lcm=1ll*lcm*qpow(p[i],mx[i])%mod;
    for (re int i=1;i<=n;++i) b[i]=1ll*lcm*qpow(a[i],mod-2)%mod;
    int ans=0;
    for (re int i=1;i<=n;++i) ans=(ans+b[i])%mod;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 8704
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,ans;
  cin>>a>>b;
  if(a<b){
    ans=a;
    for(int i=0;i<b-1;i++){
      ans*=10;
      ans+=a;
    }
    cout<<ans<<"\n";
    return(0);
  }   
  ans=b;
  for(int i=0;i<a-1;i++){
    ans*=10;
    ans+=b;
  }
  cout<<ans<<"\n";
  return(0);
}


Measured memory_bytes: 256
### subroutines

def make_tree(st)
  return nil if st[0] != '('

  st[0] = ''
  lt = make_tree(st)
  puts "error ," if st[0] != ','
  st[0] = ''
  rt = make_tree(st)
  puts "error )" if st[0] != ')'
  st[0] = ''

  [lt, rt]
end

def intersection(t0, t1)
  return nil if t0.nil? || t1.nil?

  [ intersection(t0[0], t1[0]), intersection(t0[1], t1[1])]
end

def union(t0, t1)
  return t1 if t0.nil?
  return t0 if t1.nil?

  [ union(t0[0], t1[0]), union(t0[1], t1[1])]
end

def tree2str(t)
  return '' if t.nil?
  '(' + tree2str(t[0]) + ',' + tree2str(t[1]) + ')'
end

### main

while line = gets
  op, st0, st1 = line.strip.split(' ')

  t0 = make_tree(st0)
  t1 = make_tree(st1)
  #p t0
  #p t1

  t = (op == 'i') ? intersection(t0, t1) : union(t0, t1)
  puts tree2str(t)
end

Measured memory_bytes: 6128
#include <bits/stdc++.h>
#define Mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x, y) memset(x, y, sizeof(x))
#define Maxn 1000000 + 10
using namespace std;
int N;
int len[Maxn];
int result = 0;
int main()
{
    cin >> N;
    for (int i = 0; i < N; i++)
        cin >> len[i];
    sort(len,len+N);
    for (int i = 0; i < N - 1; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            int a=len[i];
            int b=len[j];
            int k=lower_bound(len,len+N,a+b)-len;
            result+=k-j-1;
        }
    }
    cout<<result<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <bitset>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S, T;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

vector<string> G(0);
bool ok(int d){
    rep(i,N){
        int k = (d + i) % N;
        rep(j,N){
            if(G[i][j] != G[(j + N - d)%N][k]) return false;
        }
    }
    return true;
}

int main(){
    cin>>N;
    rep(i,N) cin>>S, G.push_back(S);
    ll ans = 0;
    rep(i,N){ //
        if(ok(i)) ans += N;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <unordered_map>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

struct Edge{
    int color,id;
    Edge(int color=0,int id=0)
        :color(color),id(id){}
};

int N;
map<int,Edge> G[100001];
int ans[100001];

void bfs(int from,int parent,int NG){
    int c=1;
    for(auto& e:G[from]){
        if(e.first==parent) continue;
        if(c==NG) c++;
        e.second.color=c;
        G[e.first][from].color=c;
        ans[e.second.id]=c;
        c++;
    }
    for(auto& e:G[from]){
        if(e.first==parent) continue;
        bfs(e.first,from,e.second.color);
    }
}

int main(){
    cin>>N;
    repn(i,N-1){
        int a,b;
        cin>>a>>b;
        G[a][b]=Edge(0,i);
        G[b][a]=Edge(0,i);
    }

    int K=0;
    repn(i,N) K=max(K,(int)G[i].size());

    bfs(1,0,0);

    cout<<K<<endl;
    repn(i,N-1) cout<<ans[i]<<endl;
}

Measured memory_bytes: 18944
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<stack>

using namespace std;
using ll = long long;

void solve(int n){
  int ans = 0;
  string f;
  stack<pair<int, pair<int, int> > > st;
  st.push({0, {-1, 0}});
  for(int i = 0; i < n; i++){
    cin >> f;
    int c = 0;
    for(int j = 0; j < f.length(); j++){
      if(f[j] == '.'){
        c++;
        continue;
      }
      while(c != st.top().second.first + 1){
        int tmp = st.top().second.second;
        st.pop();
        if(st.top().first == 0) st.top().second.second += tmp;
        else st.top().second.second *= tmp;
        // cout << st.top().second.first << ' ' << st.top().second.second << endl;
      }
      if(f[j] == '+'){
        st.push({0, {c, 0}});
      }
      else if(f[j] == '*'){
        st.push({1, {c, 1}});
      }
      else{
        if(st.top().first == 0){
          st.top().second.second += int(f[j] - '0');
        }
        else{
          st.top().second.second *= int(f[j] - '0');
        }
      }
    }
    // cout << st.top().second.first << ' ' << st.top().second.second << endl;
  }
  while(0 != st.top().second.first + 1){
    int tmp = st.top().second.second;
    st.pop();
    if(st.top().first == 0) st.top().second.second += tmp;
    else st.top().second.second *= tmp;
    // cout << st.top().second.first << ' ' << st.top().second.second << endl;
  }
  ans = st.top().second.second;
  cout << ans << endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int n;
  while(cin >> n && n){
    solve(n);
  }

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}



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

#define fi first
#define se second
#define mp make_pair
#define pb push_back

//#define int long long

#define upper(n,m) (n+m-1)/m
#define rounding(n) (int)((double)n+0.5)

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define ALL(a) a.begin(),a.end()

#define coutALL(i,a) {int i=0;for(int e:a) cout<<(i++?" ":"")<<e; cout<<endl;}
#define coutYN(a) cout<<(a?"Yes":"No")<<endl;
#define coutyn(a) cout<<(a?"yes":"no")<<endl;

#define deb cout<<"debug"<<endl
#define debn(n) cout<<"debug: "<<n<<endl

const int INF=INT_MAX;
const int MOD=(int)1e9+7;
const double EPS=1e-12;
//const int dx[]={0,1,0,-1},dy[]={-1,0,1,0};
const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using namespace std;

typedef pair<int,int> P;
typedef long long LL;

int ans;

void merge(vector <int> &A,int left,int mid,int right){

  int n1=mid-left;
  int n2=right-mid;
  int L[n1], R[n2];

  for(int i=0;i<n1;i++) L[i] = A[left + i];
  for(int i = 0;i<n2;i++) R[i] = A[mid + i];

  L[n1] = INF;
  R[n2] = INF;

  for(int i=0,j=0,k=left;k<right;k++){

    ans++;

    if(L[i]<=R[j]){

      A[k] = L[i];
      i = i + 1;

    }

    else {

      A[k] = R[j];
      j = j + 1;

    }

  }

}

void mergeSort(vector <int> &A,int left,int right){

  if(left+1 < right){

    int mid = (left + right)/2;

    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);

  }

}

signed main(){

  int n;
  cin>>n;

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

  mergeSort(a,0,n);

  coutALL(i,a);

  cout<<ans<<endl;

  return 0;

}


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

using namespace std;

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

void solve()
{
	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	string str;
	cin >> str;
	if (c < d)
	{
		if (str.substr(a, c - a).find("##") != string::npos || str.substr(b, d - b).find("##") != string::npos)
		{
			cout << "No\n";
			return;
		}
		cout << "Yes\n";
		return;
	}
	bool flag = false;
	for(int i = b; i <= d && i < n; i++)
	{
		if(str.substr(i - 2, 3) == "...")
		{
			flag = true;
			break;
		}
	}
	if(!flag)
	{
		cout << "No\n";
		return;
	}
	if (str.substr(a, c - a).find("##") != string::npos || str.substr(b, d - b).find("##") != string::npos)
	{
		cout << "No\n";
		return;
	}
	cout << "Yes\n";
}

int main()
{
	solve();
}


Measured memory_bytes: 772
#include <bits/stdc++.h>
 
using namespace std;
using LL = long long int; 

template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}

template<class T> ostream & operator<<(ostream & os, vector<T> V){
  os<<"[";
  for(auto vv: V) os << vv <<",";
  return os << "]";
}
template<class L, class R> ostream & operator <<(ostream & os, pair<L,R> P){
  return os <<"("<<P.st <<","<<P.nd <<")";
}

#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int main() {
  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mov(i,a,b) for(int i = a; i < b; i++)
#define MOD 1000000007
#define INF 1e9+5
typedef long long ll;
using namespace std;
bool isPowerOfTwo(ll n){
	return (ceil(log2(n)) == floor(log2(n)));
}
long long binpow(long long a, long long b){
	long long res = 1;
	while(b>0){
		if(b&1) res *= a;
		a = a*a;
		b >>= 1;
	}
	return res;
}
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
	bool x = false;
	if((a.second*a.first) < b.second*b.first){
		x = true;
	}
    return x;
}
int main(){
	
	ll n,k;
	cin>>n>>k;
	double ans = 0.0;
	for(int i = 1; i <= n; i++){
		double inter = 0.0;
		inter = (1.0/(double)(n));
		int t = i;
		while(t < k){
			inter *= (double)(0.5);
			t = t*2;
;		}
		ans += inter;
	}
	printf("%.12f",ans);
}









Measured memory_bytes: 256
/*
*  Created By : solo_loser
*  OS : Ubuntu16.04
* 
*/
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define inf 1000000007
#define fr first
#define sc second
#define eps 1e-9
#define sni(x) scanf("%d",&x)
#define snl(x) scanf("%lld", &x)
#define snc(x) scanf("%c", &c);
#define rep(i, n) for(int i = 0 ; i < n ;i ++)
#define FOR(i, x, y) for(int i = x ; i < y ; i ++)
#define DEC(i, x, y) for(int i = x ; i >= y ; i --)
#define all(v) v.begin(), v.end()
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;

bool isUpper(char c) {return (c >= 'A' && c <= 'Z');}
bool isLower(char c) {return (c >= 'a' && c <= 'z');}
bool iplpha(char c) {return (c >= 'A' && c <= 'Z')||(c >= 'a' && c <= 'z');}
bool iplnum(char c) {return (c >= 'A' && c <= 'Z')||(c >= 'a' && c <= 'z')||(c >= '0' && c <= '9');}
char toUpper(char c){return isUpper(c)?c:c-'a'+'A';}
char toLower(char c){return isLower(c)?c:c+'a'-'A';}
template<typename t> t gcd(t a, t b){return ((b == 0) ? a : gcd(b, a%b));} 
template<typename t> t lcm(t a, t b){return (a * (b / gcd(a, b)));}
 

template <typename c>
int binary_search(c *a, int lo, int hi, c key){
    while(lo <= hi){
        int mid = (lo + hi) / 2;
        if(a[mid] == key){
            return mid;
        }else if(a[mid] < key){
            lo = mid + 1;
        }else{
            hi = mid - 1;
        }
    }
    return -1;
}

template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}

string toLowerCase(string s){
    rep(i, s.size()){
        if(!isLower(s[i])){
            s[i] = toLower(s[i]);
        }
    }
    return s;
}



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



void solve(){
    ll t, r, s;
    cin >> t >> r >> s;
    ll g = r + s;
    ll ans = 1;
    while(g <= t){
        g += r + s;
        ans++;
    }
    ans--;
    g -= (r + s);
    // cout << g << ans << endl;
    if(g + s > t){
        ans--;
    }
    cout << ans << endl;


}


int main(){
    std::ios::sync_with_stdio(0);
    // int start = clock();
    // freopen("input.in" , "r" , stdin);
    // freopen("output.txt", "w", stdout);
    solve();
    // cout << n;
    // int stop = clock();
    // cout << (stop - start) / 1000.0000<< endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5 + 5;
int n;

void solve(){
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long a, b, c, k;
    cin >> a >> b >> c >> k;
    long long sum = 0;
    if(k >= a){
        sum += a;
        k -= a;
        if(k >= b){
            k -= b;
            sum -= k;
        }
    }
    else
        sum = k;
    cout << sum;
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C;vector<int> a(3);
  cin>>a.at(0)>>a.at(1)>>a.at(2);
  sort(a.begin(),a.end());
  int ans=a.at(0)+a.at(1);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define MAX 100000000
using namespace std;
int main()
{
  string s;cin>>s;ll flag=1;
  rep(i,0,3)
  {
  	if(s[i]==s[i+1])
  	{
  		cout<<"Bad";flag=0;break;
	  }  
  }	
  if(flag) cout<<"Good";
	
	
	
	
	
	
 return 0;
}

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

int main(void)
{
	char str[101]= {};
	cin>>str;

	bool check= false;
	for(int i= 0; i < strlen(str); i++)
	{
		if(str[i] == 'C')
			check= true;
		if(str[i] == 'F' && check)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}

	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>


long long X[ 100 ][ 2 ] ,x[ 100 ] ;
long long Y[ 100 ][ 2 ] ,y[ 100 ] ;
long long Z[ 100 ][ 2 ] ,z[ 100 ] ;

int i ,j ,k ,l ;

inline void sort( long long *a ,int size )
{
	qsort( a ,size ,sizeof( long long ) ,[]( const void *a ,const void *b ){ return *( int* )a - *( int* )b ; } ) ;
}

int check()
{
	if(
			X[ l ][ 0 ] > x[ i ] || X[ l ][ 1 ] < x[ i + 1 ] ||
			Y[ l ][ 0 ] > y[ j ] || Y[ l ][ 1 ] < y[ j + 1 ] ||
			Z[ l ][ 0 ] > z[ k ] || Z[ l ][ 1 ] < z[ k + 1 ]
	)
	{
		return 1 ;
	}

	return 0 ;
}

int main( void )
{
	int N ,K ;
	scanf( "%d %d" ,&N ,&K ) ;

	N *= 2 ;

	--K ;

	int n = N - 1 ;

	for( i = 0 ; i < N ; ++i )
	{
		scanf( "%lld %lld %lld" ,x + i ,y + i ,z + i ) ;

		X[ i / 2 ][ i % 2 ] = x[ i ] ;
		Y[ i / 2 ][ i % 2 ] = y[ i ] ;
		Z[ i / 2 ][ i % 2 ] = z[ i ] ;
	}

	sort( x ,N ) ;
	sort( y ,N ) ;
	sort( z ,N ) ;

	long long ans = 0 ;
	for( i = 0 ; i < n ; ++i )
	{
		for( j = 0 ; j < n ; ++j )
		{
			for( k = 0 ; k < n ; ++k )
			{
				int cnt = 0 ;

				for( l = 0 ; l < N ; ++l )
				{
					if( check() == 0 )
					{
						++cnt ;
					}
				}

				if( cnt > K )
				{
					ans += ( x[ i + 1 ] - x[ i ] ) * ( y[ j + 1 ] - y[ j ] ) * ( z[ k + 1 ] - z[ k ] ) ;
				}
			}
		}
	}


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

	return 0 ;
}

Measured memory_bytes: 2680
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <set>

using namespace std;
typedef long long ll;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int w, h;
int n;
char inifield[100][100];
int field[100][100];
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
set<int> tree[1000];
pair<int, int> range[1000];
int weight[1000];

void printFiled() {
  REP(y, h) {
    REP(x, w) {
      printf("%3d", field[y][x]);
    }
    puts("");
  }
}

void dfs(int y, int x, char c, int num) {
  weight[num] += x * 2 + 1;
  field[y][x] = num;
  inifield[y][x] = '.'; 
  REP(i, 4) {
    int nx = x + dx[i];
    int ny = y + dy[i];
    if (inifield[ny][nx] != c) { continue; }
    dfs(ny, nx, c, num);
  }
}

pair<int, int> calc(int index) {
  pair<int, int> total = make_pair(0, 0);
  FORIT(it, tree[index]) {
    pair<int, int> ntotal = calc(*it);
    if (ntotal.first == -1) { return ntotal; }
    total.first += ntotal.first;
    total.second += ntotal.second;
  }
  total.first += weight[index];
  total.second += 4;
  double g = (double)total.first / total.second;
  //cout << index << " " << g << " " << range[index].first << " " << range[index].second << endl;
  if (g <= range[index].first || range[index].second <= g) { return make_pair(-1, -1); }
  return total;
}

int main() {
  while (scanf("%d %d", &w, &h), w|h) {
    MEMSET(field, -1);
    MEMSET(inifield, -1);
    MEMSET(weight, 0);
    REP(y, h) {
      REP(x, w) {
        char c;
        scanf(" %c ", &c);
        inifield[y][x] = c;
      }
    }
    n = 0;
    for (int y = h - 1; y >= 0; y--) {
      REP(x, w) {
        if (inifield[y][x] == '.') { continue; }
        dfs(y, x, inifield[y][x], n);
        tree[n].clear();
        range[n] = make_pair(1000, -1);
        n++;
      }
    }
    REP(y, h) {
      REP(x, w) {
        if (field[y][x] != -1 && field[y + 1][x] != field[y][x]) {
          if ((field[y][x] == 0 && y == h - 1) || field[y + 1][x] != -1) {
            int index = field[y][x];
            int nindex = field[y + 1][x];
            if (nindex != -1) {
              tree[nindex].insert(index);
            }
            range[index].first = min(range[index].first, 2 * x);
            range[index].second = max(range[index].second, 2 * x + 2);
          }
        }
      }
    }
    if (calc(0).first != -1) {
      puts("STABLE");
    } else {
      puts("UNSTABLE");
    }
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
const int N=310;
int n,v[N],cnt[4];
double n1,dp[N][N][N];
int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9') {if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch&15),ch=getchar();
	return x*f;
}
double dfs(int a,int b,int c)
{
	if (dp[a][b][c]!=-1) return dp[a][b][c];
	if (a==0&&b==0&&c==0) return 0;
	double s=0;
	if (a) s+=a/n1*dfs(a-1,b,c);
	if (b) s+=b/n1*dfs(a+1,b-1,c);
	if (c) s+=c/n1*dfs(a,b+1,c-1);
	return dp[a][b][c]=(s+1)*n/(a+b+c);
}
int main()
{
	n=read();n1=n;
	for (register int i=1;i<=n;++i) v[i]=read(),cnt[v[i]]++;
	for (register int i=0;i<=n;++i)
	  for (register int j=0;j<=n;++j)
	    for (register int k=0;k<=n;++k)
	      dp[i][j][k]=-1;
	printf("%0.11lf\n",dfs(cnt[1],cnt[2],cnt[3]));
	return 0;
}

Measured memory_bytes: 227712
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const ll mod=998244353;


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();

    ll n;
    cin>>n;
    ll ans=0;
    for (int i=1; i<=sqrt(n-1);++i) { 
        for (int j=i;j*i<n;++j) 
            ++ans; 
    } 
    ans*=2; 
    ans-=int(sqrt(n- 1)); 
    cout<<ans;



    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}

Measured memory_bytes: 3840
n = gets.to_i
a = [-1]
checked = Array.new(n+1,0)
n.times do
	a.push(gets.to_i)
end
current = 1
cnt = 0
flag = false
while flag == false && checked[current] == 0
	checked[current] = 1
	current = a[current]
	cnt += 1
	if current == 2
		flag = true
	end
 end

ans = flag ? cnt : -1
puts ans

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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

bool solve(string s)
{
	if(s.size()&1)
		return s[0]!=s.back();
	else
		return s[0]==s.back();
}

int main()
{
	for(string s;cin>>s&&s!="#";)
		cout<<(solve(s)?"First":"Second")<<endl;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void){
  int l[10],v1,v2,s,x,i;
  while(scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
	      &l[0],&l[1],&l[2],&l[3],&l[4],&l[5],&l[6],
	      &l[7],&l[8],&l[9],&v1,&v2)!=EOF){
    s=0;
    for(i=0;i<10;i++)
      s+=l[i];
    x=(int)(double)s*v1/(v1+v2);
    s=0;
    for(i=0;i<10;i++){
      s+=l[i];
      if(s>=x){
	printf("%d\n",i+1);
	break;
      }
    }
  }  
  return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

const ll INF = 1LL << 60;

int main(){
  int n,m; cin >> n >> m;
  vi C(n);
  rep(i, 2*m){
    int a; cin >> a;
    a--; C[a]++;
  }

  bool ok = true;
  rep(i, n) if(C[i]%2 == 1) ok = false;
  std::cout << (ok ? "YES" : "NO") << '\n';
}


Measured memory_bytes: 768
#include<stdio.h>
int main(void){
int N ,sum=0;
scanf("%d",&N);
int V[N], C[N];
for(int i=0;i<N;i++) scanf("%d",&V[i]);
for(int k=0;k<N;k++) scanf("%d",&C[k]);
for(int j=0;j<N;j++){
    if( (V[j]-C[j]) > 0 ) sum+=(V[j]-C[j]);
}
printf("%d\n",sum);
return 0;
}

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    int n;
    cin >> n;
    int x, y;
    x = 800 * n;
    y = 200 * (n / 15);
    cout << x - y << endl;
    
    return 0;
}

Measured memory_bytes: 3620
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
n = I()
s = IR(n)
su = sum(s)
dp = [[0 for i in range(su+1)] for j in range(n)]
dp[0][s[0]] = 1
for i in range(n):
    dp[i][0] = 1
for i in range(1,n):
    for j in range(su+1)[::-1]:
        if s[i]+j <= su:
            dp[i][s[i]+j] = max(dp[i][s[i]+j],dp[i-1][j])
        dp[i][j] = max(dp[i][j],dp[i-1][j])
for i in range(su+1)[::-1]:
    if dp[n-1][i] == 1 and i%10 != 0:
        break
print(i)
#B

#C

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


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

using namespace std;

int N, CG, vol[100009], max_vol[100009], q[100009], frq[100009], col[100009];
long long h[100009];
vector < pair < int, int > > v[100009];

void dfs (int nod, int tata)
{
    vol[nod] = 1, max_vol[nod] = 0;
    for (auto it = v[nod].begin (); it != v[nod].end (); it ++)
        if (it->first != tata)
            dfs (it->first, nod), vol[nod] += vol[it->first], max_vol[nod] = max (max_vol[nod], vol[it->first]);
}

void detCG ()
{
    int mini = -1;
    dfs (1, -1);
    for (int i=1; i<=N; i++)
    {
        int curr = max (max_vol[i], N - vol[i]);
        if (i == 1 || curr < mini)
            mini = curr, CG = i;
    }
}

void read ()
{
    scanf ("%d", &N);
    for (int i=1; i<N; i++)
    {
        int x, y, d;
        scanf ("%d %d %d", &x, &y, &d);
        v[x].push_back ({y, d});
        v[y].push_back ({x, d});
    }
}

void df (int nod, int tata)
{
    if (tata == CG) col[nod] = nod;
    else
    if (tata != -1) col[nod] = col[tata];
    for (auto it = v[nod].begin (); it != v[nod].end (); it ++)
        if (it->first != tata)
            h[it->first] = h[nod] + it->second, df (it->first, nod);
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

read ();
detCG ();
df (CG, -1);
long long ans = 0;
/*for (int i=1; i<=N; i++)
    printf ("%d ", col[i]);
printf ("\n");*/
for (int i=1; i<=N; i++)
    ans += h[i];
ans += ans;
int maxi = 0, how = 0;
for (int i=1; i<=N; i++)
if (col[i])
{
    frq[col[i]] ++;
    if (frq[col[i]] > maxi)
        maxi = frq[col[i]], how = col[i];
}
if (maxi * 2 == N)
{
    long long mini = 1LL << 60;
    for (int i=1; i<=N; i++)
        if (col[i] == how && h[i] < mini)
            mini = h[i];
    ans -= mini;
}
else
if (maxi * 2 - 1 < N)
{
    sort (h + 1, h + N + 1);
    ans -= (h[1] + h[2]);
}
else
{
    int nr = 0;
    for (int i=1; i<=N; i++)
        if (col[i] == how)
            q[++nr] = h[i];
    sort (q + 1, q + N + 1);
    ans -= (q[1] + q[2]);
}
printf ("%lld\n", ans);
return 0;
}


Measured memory_bytes: 12288
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,A,B; cin>>N>>A>>B;
  int K=abs(A-B);
  if(K%2==0)
    cout<<K/2<<endl;
  else{
    int X=min(A,B)-1,Y=N-max(A,B);
    int Z=min(X,Y);
    cout<<Z+K/2+1<<endl;
  }
  }



Measured memory_bytes: 256
#include <stdio.h>
 
#define MAX (2*10*10*10*10*10)
 
int main(void) {
  char input[MAX + 1];
  long long place_w,answer,i;
 
  scanf("%s",input);
  for(i = answer = place_w = 0;i < MAX && input[i] != '\0';i++){
    if(input[i] == 'W'){
      answer += i - place_w++;
    }
  }
     
  printf("%lld\n",answer);
}

Measured memory_bytes: 384
import sys

input = sys.stdin.readline


def main():
    n = int(input())
    t, a = map(int, input().split())
    print(
        min(
            [
                [i, t - h * 0.006]
                for i, h in enumerate(map(int, input().split()), start=1)
            ],
            key=lambda x: abs(x[1] - a),
        )[0]
    )


if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
#include <iostream>

int main() {
  int N, tmp = 1, tmp2 = 0;
  std::cin >> N;
  int a[N+1];
  for(int i=0; i<N; ++i) std::cin >> a[i];
  if(N == 1) {
    std::cout << "0";
    return 0;
  }
  for(int i=0; i<N; ++i) {
    if(tmp == a[i]) ++tmp; 
    else ++tmp2;
  }
  if(tmp2 == N) tmp2 = -1;
  std::cout << tmp2;
  return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <map>
using namespace std;
int n = 0, q = 0;
map<long long, int> m;
long long sum = 0;
int main() {
	scanf("%d", &n);
	long long a = 0, b = 0;
	for (int i = 1; i <= n; ++i) {
		scanf("%lld", &a);
		++m[a];
		sum += a;
	}
	scanf("%d", &q);
	for (int i = 1; i <= q; ++i) {
		scanf("%lld%lld", &a, &b);
		sum += (b - a) * m[a];
		m[b] += m[a];
		m.erase(a);
		printf("%lld\n", sum);
	}
	return 0;
}

Measured memory_bytes: 7028
s = list(map(int, list(input())))
zero_begin = 0
one_begin = 0
for i in range(len(s)):
  if(i % 2 == 0):
    if(s[i] == 0):
      one_begin += 1
    else:
      zero_begin += 1
  else:
    if(s[i] == 0):
      zero_begin += 1
    else:
      one_begin += 1
print(min([zero_begin, one_begin]))

Measured memory_bytes: 4652
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

lli n,m;
lli data[100010];
vector<vector<lli>> v(100010);

bool dfs(lli pos,lli color){
	data[pos] = color;

	for(auto e:v[pos]){
		if(data[e] == color)return false;

		if(data[e]==0 && !dfs(e,-color))return false;
	}
	return true;
}

signed main(){

	cin>>n>>m;
	REP(i,0,m){
		lli a,b;
		cin>>a>>b;
		a--,b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}

	bool bipgraph = dfs(0,1);

	if(bipgraph==false){
		if(DEBUG)cout<<"n="<<n<<endl;
		cout<<n*(n-1)/2 -m <<endl;
	}
	else{
		lli b=0,w=0;
		for(lli i=0;i<n;i++){
			if(data[i]==1)b++;
			else if(data[i]==-1)w++;
		}
		if(DEBUG)cout<<"b="<<b<<"w="<<w<<endl;
		cout<<b*w-m<<endl;
	}

	return 0;
}

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

long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}

int main(){
    long long int n;
    cin >> n;
    long long int ans;
    long long int ans1 = 1;
    long long int ans2 = 1;
    long long int ans3 = 1;
    long long int ans4;
    if(n == 1){
        cout << 0 << endl;
        return 0;
    }else if(n==2){
        cout << 2 << endl;
        return 0;
    }else{
        for(int i=0;i<n;i++){
            ans1 *= 10;
            ans1 = ans1 % 1000000007;
        }
        for(int i=0;i<n;i++){
            ans2 *= 9;
            ans2 = ans2 % 1000000007;
        }
        //ans = (2*(ans1-ans2))% 1000000007;
        for(int i=0;i<n;i++){
            ans3 *= 8;
            ans3 = ans3 % 1000000007;
        }
        //ans = ((((2*(ans1-ans2)%1000000007)-ans3) % 1000000007)/2) % 1000000007;
        ans = mod(ans1-ans2, 1000000007);
        ans = mod(2*ans, 1000000007);
        ans4 = mod(ans1-ans3, 1000000007);
        ans = mod(ans-ans4, 1000000007);
        //ans = mod(ans/2, 1000000007);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

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

    if(s == "Sunny"){
        cout << "Cloudy" << endl;
    }else if(s == "Cloudy"){
        cout << "Rainy" << endl;
    }else{
        cout << "Sunny" << endl;

    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

ll gcd(ll a, ll b) {
    if (a < b) return gcd(b, a);
    return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
 
int main() {
    ll a, b, ans = 0;
    cin >> a >> b;

    cout << lcm(a, b) << endl;

    
    return 0;
}

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

int main()
{
    int  a[] ={0, 0};
    scanf("%d %d", &a[0], &a[1]);
    int d = a[0] / a[1];
    double f = (double)a[0] / a[1];

    cout.flags(ios::fixed);
    cout << d <<  " " << a[0] % a[1]  << " " << f << endl;

}

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

template<typename T> T K(T a) { return a * a; }
#define K(a) K(1LL * (a))
typedef long double ll; // can be changed to 'long double'
typedef long double ld;
// const ld PI = 2 * acos(0);
const ld eps = 1e-12;
#pragma GCC diagnostic ignored "-Wnarrowing"
struct P {
	ll x, y; // + ... (trivial operators)
	P operator +(P b) {
		return P{x + b.x, y + b.y};
	}
	P operator -(P b) {
		return P{x - b.x, y - b.y};
	}
	ll operator *(P b) {
		return x * b.y - y * b.x;
	}
	P operator *(ll mul) {
		return P{x * mul, y * mul};
	}
	
	ll dot(P b) { return x * b.x + y * b.y; }
	ld len() { return sqrt(K(x) + K(y)); }
	P scaleTo(ld to) { return *this * (to / len()); }
	ld dist(P & b) { return (*this - b).len(); }
	P rotate90() { return P{-y, x}; }
	ld angle() { return atan2(y, x); }
	P rotate(ld ang) {
		ld c = cos(ang), s = sin(ang);
		return P{x * c - y * s, x * s + y * c};
	}
	// '<' and 'below()' needed for Convex Hull
	bool operator < (P he) { return make_pair(x, y) < make_pair(he.x, he.y); }
	bool below(P a, P b) { return (b - a) * (*this - a) <= 0/*eps*/; } //INFO 1
};
struct L2 {
	P one, two;
	// P p[2]; P & operator [](int i) { return p[i]; }
	// const P & operator [](int i) const { return p[i]; }
	P dir() { return two - one; }
	P normal() { return dir().rotate90(); }
	ld dist(P he) {
		return abs((he - one) * (he - two)) / one.dist(two);
	}
	ld segDist(P he) { // epsilon not needed, but it would work too
		if((he - two) * normal() < 0 && normal() * (he - one) < 0)
			return dist(he);
		return min(one.dist(he), two.dist(he));
	}
	P inter(L2 he) {
		P A = dir(), B = he.dir();
		ll den = A * B;
		assert(abs(den) > eps); // parallel, maybe equal
		return (A * (he.one * he.two) - B * (one * two)) * (1.0 / den);
		// A = (x1*y2-y1*x2)*(x3-x4)-(x1-x2)*(x3*y4-y3*x4)
		// A'= (x1*y2-y1*x2)*(y3-y4)-(y1-y2)*(x3*y4-y3*x4)
		// B = (x1-x2)*(y3-y4)-(y1-y2)*(x3-x4)
		// return P{A / B, A' / B};
	}
	P project(P he) {
		P unit_normal = normal().scaleTo(1);
		return he + unit_normal * unit_normal.dot(one - he);
	}
	P reflect(P he) { return project(he) * 2 - he; }
// for CH: sort by slope; below() : change to L3 or compare 'x' of intersections
};

L2 normal(P A, P B) {
	P mid = (A + B) * 0.5;
	P vec = B - A;
	vec = P{vec.y, -vec.x};
	return L2{mid, mid + vec};
}

int main() {
	int n;
	cin >> n;
	vector<P> points(n);
	for(P& p : points) {
		cin >> p.x >> p.y;
	}
	double answer = 1e9;
	auto consider = [&](P M) {
		double radius = 0;
		for(P p : points) {
			radius = max(radius, (double) p.dist(M));
		}
		answer = min(answer, radius);
	};
	for(int i = 0; i < n; ++i) {
		for(int j = i + 1; j < n; ++j) {
			for(int k = j + 1; k < n; ++k) {
				P A = points[i], B = points[j], C = points[k];
				if(abs((B - A) * (C - A)) < 1e-9) {
					continue;
				}
				L2 one = normal(A, B);
				L2 two = normal(A, C);
				P M = one.inter(two);
				consider(M);
			}
		}
	}
	for(P A : points) {
		for(P B : points) {
			consider((A+B)*0.5);
		}
	}
	printf("%.10lf\n", answer);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair
 
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vi a(n);
    forn(i,n) cin >> a[i], a[i] -= i;
    sort(all(a));
    int med = a[n/2];

    ll ans = 0;
    for (auto x : a) ans += abs(x - med);
    cout << ans << '\n';
    return 0;
}


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


int gcd(long long int a, long long int b)
{
if (a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }
return b ? gcd(b, a % b) : a;
}
int lcm(long long int a, long long int b)
{
return a * b / gcd(a, b);
}

void solve(long long A, long long B){
    long long int ans = A * B;
    if (gcd(A, B)!=1) {
        ans = lcm(A, B);
    }
    cout << ans << endl;
}

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


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

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

    vector<int> A(N);
    rep(i, N) cin >> A[i];

    vector<P> V(M);
    rep(i, M) {
        int b, c;
        cin >> b >> c;
        V[i] = P(c, b);
    }

    sort(A.begin(), A.end());
    sort(V.begin(), V.end(), greater<P>());

    int i = 0;
    rep(j, M) {
        P p = V[j];
        int v = p.first, n = p.second;
        while (i < N && A[i] < v && n > 0) {
            A[i] = v;
            i++; n--;
        }
    }

    ll ans = accumulate(A.begin(), A.end(), 0L);
    cout << ans << endl;
}

Measured memory_bytes: 1408