akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int, nuint_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define int long long
#define MOD 1000000007
#define what_is(x) cerr << #x << " is " << x << endl;
#define loop(i,a,n) for(int i=a;i<n;i++)
#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, szof(x))
#define sortall(x) sort(aint(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626 
 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int, int> pt;
 
// int arr[2][2]={{0,1},{1,0}};
signed main() {
 
	fastio();
	//#define LOCAL_DEFINE	
	#ifdef LOCAL_DEFINE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
		//https://zhuhan0.blogspot.com/2017/09/leetcode-425-word-squares.html
		//https://yzygitzh.github.io/algorithm/2018/11/09/leetcode-summary.html
		//https://beginnersbook.com/2015/03/why-dont-we-call-run-method-directly-why-call-start-method/
		//https://leetcode.com/problems/lfu-cache/
	// int n,k;
	// cin>>n>>k;
	// vector<int> arr(n);
 // 	for(int i=0;i<n;i++)
 // 	{
 // 		cin>>arr[i];
 // 	}
 // 	set<int> hash;
 // 	int ans=0;
 // 	bool flag=false;
 // 	for(int i=0;i<k;i++)
 // 	{
 // 		if(hash.lower_bound(arr[i])!=hash.end())
 // 		{
 // 			flag=true;
 // 		}
 // 		hash.insert(arr[i]);
 // 	}
 // 	if(flag)
 // 	{
 // 		ans++;
 // 	}
 // 	bool flag1=false;
 // 	for(int i=k;i<n;i++)
 // 	{
 // 		cout<<ans<<endl;
 // 		hash.erase(arr[i-k]);
 // 		if(hash.lower_bound(arr[i])!=hash.end())
 // 		{
 // 			ans++;
 // 		}else if(hash.lower_bound(arr[i-k])!=hash.begin())
 // 		{
 // 			ans++;
 // 		}else{
 // 			flag1=true;
 // 		}
 
 // 		hash.insert(arr[i]);	
 // 	}
 // 	if(!flag || !flag1)
 // 		ans++;
 // 	cout<<ans;

    ll a,b;
	cin>>a>>b;
	ll g=__gcd(a,b);
	ll ans=0;
	ll x=g;
 
	for(int i=2;i*i<=x;i++)
	{
		if(g%i==0)
		{
			ans++;
			while((g%i)==0)
			{
				g=(g/i);
			}
		}
 
	}
	if(g!=1)
		ans++;
	cout<<ans+1;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
dist = []
ans = 0

for i in range(N - 1):
	dist.append(X[i + 1] - X[i])
	
for i in range(N - 1):
	ans += min(dist[i] * A, B)
	
print(ans)

Measured memory_bytes: 63468
n=int(input())
a=list(map(int,input().split()))
b=[0]+list(map(int,input().split()))
c=[0]+list(map(int,input().split()))

cnt=0
before=0

for i in range(n):
    cnt+=b[a[i]]
    if a[i]==before+1:
        cnt+=c[before]
    before=a[i]
print(cnt)

Measured memory_bytes: 9124
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e9+7;

ll n;
vector<ll> to[1005];

vector<ll> bfs(ll sv){
    vector<ll> dist(n,INF),prev(n,-1);
    dist[sv]=0;
    queue<ll> q;
    q.push(sv);
    while(!q.empty()){
        ll v=q.front();
        q.pop();
        for(auto u:to[v]){
            if(dist[u]!=INF) continue;
            dist[u]=dist[v]+1;
            prev[u]=v;
            q.push(u);
        }
    }
    pll best=make_pair(INF,-1);
    rep(s,n){
        for(auto v:to[s]){
            if(v==sv){
                if(dist[s]<best.first){
                    best=make_pair(dist[s],s);
                }
            }
        }
    }
    vector<ll> res;
    ll v=best.second;
    if(v==-1){
        return res=vector<ll>(n+1);
    }
    while(v!=-1){
        res.push_back(v+1);
        v=prev[v];
    }
    return res;
}

int main()
{
    ll m;
    cin >> n >> m;
    rep(i,m){
        ll a,b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
    }
    vector<ll> ans(n+1);
    rep(s,n){
        vector<ll> now=bfs(s);
        if(now.size()<ans.size()){
            ans=now;
        }
    }
    if(ans.size()==n+1){
        cout << -1 << endl;
        return 0;
    }
    cout << ans.size() << endl;
    for(auto x:ans){
        cout << x << endl;
    }
    return 0;
} 

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int n,k,a[200100],mn[200100],mx[200100];
deque<int> q;
int main(){
	#ifdef FILIN
		#ifndef LOCAL
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	while(q.size())
		q.pop_back();
	for(int i=n;i>=1;i--){
		while(q.size()&&q.front()>=i+k) q.pop_front();
		while(q.size()&&a[q.back()]>a[i]) q.pop_back();
		q.push_back(i);
		if(q.size()==1) mn[i]=1;
	}
	while(q.size())
		q.pop_back();
	for(int i=1;i<=n;i++){
		while(q.size()&&q.front()<=i-k) q.pop_front();
		while(q.size()&&a[q.back()]<a[i]) q.pop_back();
		q.push_back(i);
		if(q.size()==1) mx[i]=1;
	}
	int num=0;
	for(int i=1,j=1;i<=n;i=j){
		j++;
		while(j<=n&&a[j]>a[j-1]) j++;
		if(j>=i+k) num++;
	}
	int tot=n-k+1-max(num-1,0);
	for(int i=k;i<=n;i++)
		tot-=(mx[i]&&mn[i-k]);
	cout<<tot<<endl;
	return 0;
}


Measured memory_bytes: 2560
from itertools import combinations
from collections import Counter

N, X, Y = map(int, input().split())

C = Counter(min(abs(i - j), abs(X - i) + abs(Y - j) + 1, abs(X - j) + abs(Y - i) + 1) for i, j in combinations(range(1, N + 1), 2))

print("\n".join(str(C[k]) for k in range(1, N)))

Measured memory_bytes: 3700
#include <cstdio>
using namespace std;

int zeller(int y, int m , int d) {
  if (m < 3) y--, m += 12;
  return (y + y / 4 - y / 100 + y / 400 + (13 * m + 8) / 5 + d) % 7;
}

int main() {
  char day[7][15] = {"Sunday", "Monday", "Tuesday", "Wednesday",
                     "Thursday","Friday","Saturday"};
  int m, d;
  while (scanf("%d%d", &m, &d), m) {
    puts(day[zeller(2004, m, d)]);
  }
}


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

using namespace std;

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

    int n = (int)S.size();
    if (n==1)
    {
        cout<<1<<endl;
        return 0;
    }

    vector<int> T1(n);
    vector<int> T2(n);
    T1[0] = 1;
    T1[1] = S[0]==S[1] ? -n : 2;
    T2[0] = -n;
    T2[1] = 1;

    for (int i=2; i<n; i++)
    {
        T1[i] = max(
            S[i]==S[i-1] ? -n : T1[i-1]+1,
            T2[i-1]+1);
        T2[i] = max(
            i>=3 && S[i]==S[i-2] && S[i-1]==S[i-3] ? -n : T2[i-2]+1,
            T1[i-2]+1);
    }
    cout<<max(T1[n-1], T2[n-1])<<endl;
}


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

int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    ll sum=0,sum2=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    ll ans=1e18;
    rep(i,n-1){
        sum-=a[i];
        sum2+=a[i];
        ans=min(ans,abs(sum-sum2));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void){
  long long  a,b,x;
  long long ans = 0;
  scanf("%lld%lld%lld",&a,&b,&x);

  ans += b/x+1;
  if(a != 0) ans -= (a-1)/x+1;

  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int targetSum = sc.nextInt();
        int[] usedMoneyArray;

        Eager eager = new Eager(num, targetSum);
        usedMoneyArray = eager.getMoneyArray();

        for(int i=0; i<usedMoneyArray.length; i++){
            if(i == 2){
                System.out.println(usedMoneyArray[i]);
            } else {
                System.out.print(String.format("%d ", usedMoneyArray[i]));
            }
        }
    }
}

class Eager{
    private int num;
    private int targetSum;
    private int sum = 0;
    private int[] usedMoneyArray = {0, 0, 0};

    Eager(int num, int targetSum){
        this.num = num;
        this.targetSum = targetSum;
    }

    public int[] getMoneyArray(){
        loop: for(int i=num; i>=0; i--){
            for(int j=num-i; j>=0; j--){
                int k = num -i - j;
                if((i+j+k) != num || i < 0 || j < 0 || k < 0){
                    continue;
                } else {
                    int total = i*10000 + j*5000 + k*1000;
                    if(total == targetSum){
                        usedMoneyArray[0] = i;
                        usedMoneyArray[1] = j;
                        usedMoneyArray[2] = k;

                        return usedMoneyArray;
                    }
                }
            }
        }
        usedMoneyArray[0] = -1;
        usedMoneyArray[1] = -1;
        usedMoneyArray[2] = -1;
        return usedMoneyArray;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public void setTargetSum(int targetSum) {
        this.targetSum = targetSum;
    }

    public void setSum(int sum) {
        this.sum = sum;
    }

    public void setUsedMoneyArray(int[] usedMoneyArray) {
        this.usedMoneyArray = usedMoneyArray;
    }
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    int v[100005], x;
    for(int i = 1; i <= n; i++) {
        cin >> x;
        v[x] = i;
    }
    for(int i = 1; i <= n; i++) {
        cout << v[i] << " ";
    }
    return 0; 
}

Measured memory_bytes: 1152
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>

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

int main() {
	set<int> s;
	int N;

	scanf("%d", &N);

	rep(i, N) {
		int t;
		scanf("%d", &t);
		s.insert(t);
	}

	printf("%d\n", s.size());

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int ans;
  int a=-1;
  for(int i=1; i<=n; i++){
    int count=0;int s=i;
    while(s%2==0&&s>0){
      s=s/2;
      count++;
    }
    if(count>a){
      a=count;
      ans=i;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3644
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N;

bool C( ll x, ll rest ) {
  return x*x >= rest;
}

ll cnt[100010][2];
ll z[200000];

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

  repi( rest, 1, 2*N ) {
    ll ng = 1, ok = rest;

    while( ok-ng > 1 ) {
      ll mid = (ng+ok)/2;

      (C(mid, rest) ? ok : ng) = mid;
    }

    if( ok*ok == rest )
      z[rest] = ok;
    else
      z[rest] = -1;
  }

  repi( i, 1, N+1 ) {
    ll ans = 0;

    for( ll x = 2; x*x <= 2*i; ++x ) for( ll y = 2; y*y <= 2*i-x*x; ++y ) {
      ll rest = 2*i-x*x-y*y;
      ll ok = z[rest];

      if( ok != -1 ) {
        ll s = (x+y+ok)/2;
        if( s-x >= 1 && s-y >= 1 && s-ok >= 1 )
          ++ans;
      }
    }

    std::cout << ans << std::endl;
  }

  return 0;
}

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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

template<typename T1,typename T2> using M = map< T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

int main(){
    LL N;
    cin>>N;
    Vll A(N);
    M<LL,LL> ball;
    REP(i,N){
        cin>>A[i];
        ball[A[i]]++;
    }

    LL zenbu = 0;
    for(auto b : ball){
        if(b.se-1>0) zenbu += b.se*(b.se-1)/2;
    }

    REP(i,N){
        cout<<zenbu-(ball[A[i]]-1)<<endl;
    }

    return 0;
}

Measured memory_bytes: 12032
// Last Change: 12/29/2018 21:06:27.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  ll A, B, C;
  ll ans = 0;
  cin >> A >> B >> C;
  if (A + B > C) {
    ans = B + C;
  } else {
    ans = A + B + B;
  }
  if (A + B < C) {
    ++ans;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map> 
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

 
int main(){
  int n;
  cin >> n;
  if (n%2 == 0) cout << n << endl;
  else cout << n*2 << endl;
  
  return 0; 
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
	ll n,k;cin >> n >> k;
	vector<ll> h(n+1);
	REP(i,n) cin >> h[i+1];
	vector<vector<ll>> dp(n+1,vector<ll>(n+1,INF));
	dp[0][0]=0;
	REP(i,n){
		REP(j,n+1){
			REP(l,i+1){
				chmin(dp[i+1][j+1],dp[l][j]+max(0LL,h[i+1]-h[l]));
			}
		}
	}
	ll ans=INF;
	REP(i,n+1){
		chmin(ans,dp[i][n-k]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3988
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	scan_init()
	x := scanInt()
	max := int(2*math.Pow(10,5))
	memo := toKeys(allSosu(max))
	for i:= 0; i<len(memo); i++ {
		if memo[i] >= x {
			fmt.Println(memo[i])
			break
		}
	}
}
func toKeys (memo map[int]bool)[]int{
	k := 0
	output := make([]int, len(memo))
	for i,_ := range memo {
		output[k] = i
		k++
	}
	sort.Ints(output)
	return output
}
func allSosu(max int) map[int]bool{
	// max値までの素数群を返す
	// 計算量logmax*logmax
	output := map[int]bool{}
	furui := make([]int, max+1)
	for i:= 2; i*i<=max; i++ {
		if furui[i] > 0 {
			continue
		}
		for j:=i+i; j<=max; j += i{
			furui[j]++
		}
	}
	for i:=2; i<=max; i++ {
		if furui[i] == 0 {
			output[i] = true
		}
	}
	return output
}
var sc = bufio.NewScanner(os.Stdin)

func scan_init() {
	sc.Split(bufio.ScanWords)
}
func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func scan() string {
	sc.Scan()
	return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 200000)

func readLine() string {
	buf := make([]byte, 0, 200000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}
func readLineToNumber() int {
	S := readLine()
	number, _ := strconv.Atoi(S)
	return number
}
func readLineToSlice() []string {
	S := readLine()
	list := strings.Split(S, "")
	return list
}
func readLineToNumberSlice(memo map[string]int) []int {
	// err時は-1を代入
	S := readLine()
	intList := make([]int, len(S))
	for i := 0; i < len(S); i++ {
		if val, ok := memo[string(S[i])]; ok {
			intList[i] = val
		} else {
			intList[i] = -1
		}
	}
	return intList
}

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

template<typename T>
istream& operator >> (istream& istr, vector<T>& v){
    for(T& x: v) istr >> x;
    return istr;
}

template<typename T, typename U>
istream& operator >> (istream& istr, pair<T,U>& p){
    istr >> p.first >> p.second;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& v){
    if(!v.empty()){
        ostr << v.front();
        for(auto itr = ++v.begin(); itr != v.end(); itr++)
            // ostr << *itr;
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    // ostr << p.first << p.second;
    ostr << p.first << ", " << p.second;
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& vv){
    if(!vv.empty()){
        ostr << vv.front();
        for(auto itr = ++vv.begin(); itr != vv.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& vp){
    if(!vp.empty()){
        ostr << vp.front();
        for(auto itr = ++vp.begin(); itr != vp.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<double> vd;
// vll x(n); x[i]=a;
typedef vector<vll> vvll;
typedef vector<vc> vvc;
typedef vector<vd> vvd;
// vvll x(m,vi(n)); x[i][j]=a;
typedef pair<ll,ll> pll;
typedef pair<double,double> pd;
typedef vector<pll> vpll;
typedef vector<pd> vpd;
// vpll x(n); x[i]={a,b}; x[i].first/second;

#define PI 3.1415926535897932
#define EPS 1e-12
#define INF (ll)1e+12
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));

ll sum(vll &v) {return accumulate(all(v), 0LL);}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream&o,const pair<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
mt19937 rnd(random_device{}());

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
V<ll>fac,rfac; void setFac(int n,int mod){fac=rfac=V<ll>(++n);fac[0]=1;FOR(i,1,n)fac[i]=fac[i-1]*i%mod;rfac[n-1]=modInv(fac[n-1],mod);FORR(i,n-1,1)rfac[i-1]=rfac[i]*i%mod;}

ll randInt(ll l,ll r){return uniform_int_distribution<ll>(l,r)(rnd);}
double randDouble(double l,double r){return uniform_real_distribution<double>(l,r)(rnd);}
void dout(double d){printf("%.12f\n",d);}

const double PI = acos(-1);
const double EPS = 1e-10;
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;

const int N = 1e3;
const int NN = 5e5;
int n, nn;
int _z[N][N];
VV<int> e;
inline int z(int a, int b){ return (a>b) ? _z[b][a] : _z[a][b]; }
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  nn = n*(n-1)/2;
  e.resize(nn);
  {
    int idx = 0;
    FOR(i, 0, n)FOR(j, i+1, n) _z[i][j] = idx++;
    FOR(i, 0, n){
      int p; cin >> p; p--;
      FOR(j, 0, n-2){
        int a; cin >> a; a--;
        e[z(i, p)].pb(z(i, a));
        p = a;
      }
    }
  }
//  each(itr, e) uniq(*itr);

  int vc = 0, ans = 0;
  queue<int> q, q2;
  vector<int> c(nn, 0);
  for(int i=0; i<nn; i++) for(int a:e[i]) c[a]++;
  for(int i=0; i<nn; i++) if(!c[i]) q.push(i);
  while(!q.empty()){
    ans++;
    while(!q.empty()){
      int a = q.front(); q.pop();
      vc++;
      for(int b:e[a]){
        c[b]--;
        if(!c[b]) q2.push(b);
      }
    }
    swap(q, q2);
  }
  cout << (vc==nn ? ans : -1) << endl;
}

Measured memory_bytes: 33408
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
int N;
int K;
int Q;
int A[100000];
int ok[100000];
int main(){
  int i;
  rd(N);
  rd(K);
  rd(Q);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<(Q);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);A[Lj4PdHRW] += (-1);
    }
  }
  for(i=0;i<(N);i++){
    ok[i] = K - Q;
  }
  for(i=0;i<(Q);i++){
    ok[A[i]]++;
  }
  for(i=0;i<(N);i++){
    if(ok[i]>0){
      wt_L("Yes");
      wt_L('\n');
    }
    else{
      wt_L("No");
      wt_L('\n');
    }
  }
  return 0;
}
// cLay varsion 20190914-1

// --- original code ---
// int N, K, Q, A[1d5];
// int ok[1d5];
// {
//   rd(N,K,Q,(A--)(Q));
//   rep(i,N) ok[i] = K - Q;
//   rep(i,Q) ok[A[i]]++;
//   rep(i,N) wt( if[ok[i]>0, "Yes", "No"] );
// }


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,c[555],s[555]={},f[555],ans[555]={};
  cin>>n;
  for(int i=0;i<n-1;i++){
    cin>>c[i]>>s[i]>>f[i];
  }
  for(int i=0;i<n-1;i++){
    for(int j=i;j<n-1;j++){
      if(j==i)ans[i]=s[i];
      else{
	if(ans[i]<s[j])ans[i]+=(s[j]-ans[i]);
	else if(ans[i]%f[j]!=0)ans[i]+=(f[j]-ans[i]%f[j]);
      }
      ans[i]+=c[j];
    }
  }
  for(int i=0;i<n;i++)cout<<ans[i]<<endl;
  return 0;
}


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

int LCS(std::string X, std::string Y)
{
    int m = X.size();
    int n = Y.size();
    X = ' ' + X;
    Y = ' ' + Y;
    int c[m+1][n+1];
    for (int i = 0; i <= m; i++) c[i][0] = 0;
    for (int j = 0; j <= n; j++) c[0][j] = 0;

    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= n; j++) {
            if (X[i] == Y[j]) {
                c[i][j] = c[i - 1][j - 1] + 1;
            } else if (c[i-1][j] >= c[i][j-1]) {
                c[i][j] = c[i-1][j];
            } else {
                c[i][j] = c[i][j-1];
            }
        }
    }

    return c[m][n];
}

int main(int argc, char *argv[])
{
    int n;
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::string X, Y;
        std::cin >> X;
        std::cin >> Y;
        std::cout << LCS(X, Y) << std::endl;
    }
}


Measured memory_bytes: 6968
#include <bits/stdc++.h>
#pragma once
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


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

int n,m,a[1100], b[1100];bool c[1100][20];
int dp[10000],t[20];
signed main(){
  cin>>n>>m;
  rep(i,10000)dp[i] = INF;
  rep(i,20)t[i] = INF;
  dp[0] = 0;
  rep(i,m){
    cin>>a[i]>>b[i];
    rep(j,b[i]){
      int cc;cin>>cc;cc--;
      c[i][cc] = true;
    }
  }
  rep(bit,1<<n){
    rep(i,m){
      int bb = bit;
      rep(j,n){
        if(c[i][j]){
          bb |= (1<<j);
        }
      }
      chmin(dp[bb], dp[bit] + a[i]);
    }
  }
  cout << (dp[(1<<n)-1] == INF ? -1 : dp[(1<<n)-1]) << endl;
}


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

int main(){
    int n;
    const int N = 1e6;

    vector<bool> is_prime(N,true);
    is_prime[0] = false;
    is_prime[1] = false;

    for(int i=2;i*i<N;i++){
        if(is_prime[i]){
            for(int j=i*2;j<N;j+=i){
                is_prime[j] = false;
            }
        }
    }

    while(cin >> n){
        int small = n-1;
        int big = n + 1;
        while(!is_prime[small]) small--;
        while(!is_prime[big]) big++;

        cout << small << " " << big << endl;
    }


}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

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


Measured memory_bytes: 10756
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    FOR(i, 0, n-1) cin >> a[i];

    ll x1 = 0;
    for(int i=0; i<n; i++) {
        if(i%2==0)
            x1 += 2*a[i];
        else
            x1 -= 2*a[i];
    }
    x1 /= 2;
    cout << x1 << " ";
    ll x_prev = x1;
    ll x_next;
    for(int i=0; i<n-1; i++) {
        x_next = 2*a[i] - x_prev;
        cout << x_next << " ";
        x_prev = x_next;
    }
    cout << endl;
    // cout << 2*a[n] - x1 << endl;

    return 0;
}

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

int main(){
	ll n;
	cin>>n;
	cin>>ws;
	ll a=0,b=0,c=0,d=0;
	for(ll i=0;i<n;i++){
		string s;
		cin>>s;
		if(s=="AC"){
			a++;
		}
		if(s=="WA"){
			b++;
		}
		if(s=="RE"){
			c++;
		}
		if(s=="TLE"){
			d++;
		}
	}
	cout<<"AC "<<"x "<<a<<"\n";
	cout<<"WA "<<"x "<<b<<"\n";
	cout<<"TLE "<<"x "<<d<<"\n";
	cout<<"RE "<<"x "<<c<<"\n";

	return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(){
  int A[100][100];
  int i,j;
  int n,x,y,z;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      A[i][j]=0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&x,&y);
    x--;
    for(j=0;j<y;j++){
      scanf("%d",&z);
      z--;
      A[x][z]=1;
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j!=0)printf(" ");
      printf("%d",A[i][j]);
    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2120
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  string s;

  cin >> s;

  if(s[0] == s[s.size()-1]){
    if(s.size()%2){
      puts("Second");
    }else{
      puts("First");
    }
  }else{
    if(s.size()%2){
      puts("First");
    }else{
      puts("Second");
    }
  }
  
  return 0;
}


Measured memory_bytes: 512
#include<stdio.h>

int main(void)
{
  int n,i,s,t;
  
  scanf("%d",&n);
  
  for(i=0;i<3;i++){
    s=n%10;
    n=n/10;
    if(s==7){
      t++;
    }
  }
  
  if(t>0)
    puts("Yes");
  
  else
    puts("No");
  
  return 0;
}


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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    string s("ABC"), n; 
    cin >> n;
    
    cout << s+n << endl;
    
    return 0;
}   
/** atcoder **/


Measured memory_bytes: 256
K = int(input())
print(50)

div = K // 50
margin = K % 50

#K回
for i in range(margin):
	print(str(49+51*(div+1)-K) + " ",end="") 

for i in range(margin,50):
	print(str(49+51*div-K) + " ",end="")

print()
	




Measured memory_bytes: 3060
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<long long>;
using pll = pair<long, long>;
template<class T> using pr = pair<T, T>;
template<class T> using vec = vector<T>;

#define debug(x) (std::cerr << (x) << "\n")
#define debug_tab(n, x) (std::cerr << strMulti("\t",n) << (x) << "\n")
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b)
constexpr int INF = 2000000100;
constexpr ll MOD = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T mod_pow(T x, T n, const T& p) { T ret = 1; while (n > 0) { if (n & 1) { (ret *= x) %= p; } (x *= x) %= p; n >>= 1; } return ret; }

/*****/

void Main()
{
	string S;
	cin >> S;
	int len = S.length();
	cout << strMulti("x", len);
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


Measured memory_bytes: 256
// Problem : A - αlphabet
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sort(a) sort(all(a))
#define ff first
#define ss second
#define vi vector<int>
#define pii pair<int, int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define mod (int)1e9+7
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define repf(i,a,b) for(i=a;i<b;i++)
#define repb(i,a,b) for(i=a;i>=b;i--)
#define N 100005
int main()
{
	FAST
    int t=1;
    //cin>>t;
    while(t--)
    {
		char ch;
		cin>>ch;
		// int n=(int)ch;
		if(ch>=65 && ch<=90) cout<<"A"; else cout<<"a";cout<<endl;
    }
    return 0;
} 


Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main() {
	int n, d;
	cin >> n >> d;
	int ans = 1;
	for (int i = 1; i <= n; i++) {
		if ((d * 2 + 1) * i < n) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define pr1(a) (#a)<<"="<<(a)
#define pr2(a,b) pr1(a)<<", "<<pr1(b)
#define pr3(a,b,c) pr2(a,b)<<", "<<pr1(c)
#define pr4(a,b,c,d) pr3(a,b,c)<<", "<<pr1(d)
#define pr5(a,b,c,d,e) pr4(a,b,c,d)<<", "<<pr1(e)
#define int long long
#define double long double
using namespace std;
const int N = 100010;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}

int n;
vector<double> X,Y,R;


double dijkstra(){
  
  auto dis = [&](int i,int j){
    double x = X[i]-X[j];
    double y = Y[i]-Y[j];
    return sqrt(x * x + y * y);
  };
  
  auto disC = [&](int i,int j){return max((double)0,dis(i,j) - R[i] - R[j]);};

  using P = pair<double,int>;
  vector<double> D(n,INF);
  vector<int> used(n);
  priority_queue<P,vector<P>,greater<P> > Q;
  D[0] = 0;
  Q.push(P(0,0));
  while(!Q.empty()){
    auto t = Q.top();Q.pop();
    double cost = t.first;
    int pos = t.second;
    if(used[pos]++) continue;
    if(pos == 1) return cost;
    
    for(int to=0;to<n;to++){
      double ncost = cost + disC(pos,to);
      if(D[to] <= ncost || used[to]) continue;
      D[to] = ncost;
      Q.push(P(ncost,to));
    }
  }
  assert(0);
}

signed main(){
  int xs,ys,xt,yt;
  cin>>xs>>ys>>xt>>yt;
  cin>>n;
  X.resize(n+2);
  Y.resize(n+2);
  R.resize(n+2);
  
  X[0] = xs, Y[0] = ys, R[0] = 0;
  X[1] = xt, Y[1] = yt, R[0] = 0;

  for(int i=2;i<n+2;i++) cin>>X[i]>>Y[i]>>R[i];
  n+=2;

  double ans = dijkstra();
  printf("%.10Lf\n",ans);
  
  return 0;
}


Measured memory_bytes: 10604
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <numeric>
 
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
ll N,K,H,W;
ll ans;
P A[200005];
ll M = 1000000007;
ll ac;
P minminus= P(M,0);
P maxminus = P(M,0);
P minplus = P(M,0);
P maxplus = P(M,0);
bool found = true;

int main() {
    cin >> N;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        if(i%2==0&&a%2==1){
            ans++;
        }
    }
    cout << ans << endl;
}


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

int main() {
  ll n,x;
  cin >> n >> x;
  vector<ll>a(n),b(n-1);
  for(int i=0; i<n; i++) cin >> a[i];
  for(int i=0; i<n-1; i++) b[i]=a[i]+a[i+1];
  ll count=0;
  for(int i=0; i<n-1; i++){
    ll res = b[i]-x;
    if(b[i]<=x) continue;
    if(a[i+1]>=res) b[i]-=res,b[i+1]-=res,count+=res;
    else b[i]-=a[i+1],b[i+1]-=a[i+1],count+=a[i+1];
  }
  if(b[0]>x)count+=b[0]-x;
  if(b[n-2]>x && 0!=n-2)count+=b[n-2]-x;
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 1792
import java.util.*;

  public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        long[] e = new long[n];
        long[] o = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
            if(0 < i){
                e[i] = e[i-1]; o[i] = o[i-1];
            }
            if(i % 2 == 0) e[i] += a[i];
            else o[i] += a[i];
        }
        long ans = Long.MIN_VALUE;
        if(n % 2 == 0){
            for (int i = 0; i <= n; i+=2) {
                long t = 0L;
                if(0 < i) t += e[i-2];
                t += o[n-1];
                if(0 < i) t -= o[i-1];
                if(ans < t) ans = t;
            }
        }else{
            long[] s2 = new long[n];
            long max2 = Long.MIN_VALUE;
            for (int i = n-1; i >= 0; i-=2) {
                long t = 0L;
                if(i < n-1) t += e[n-1] - e[i];
                t += o[i];
                if(max2 < t) max2 = t;
                s2[i] = max2;
            }
            for (int i = 0; i < n; i+=2) {
                long t = 0L;
                if(0 < i) t += e[i-2];
                t += s2[i] - o[i];
                if(ans < t) ans = t;
            }

        }
        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 65268
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int count(int x, int y){
  if(y==1){
    return x;
  }
  else{
  y --;
  if(x%y == 0){
    return x/y;
  }
  else return x/y+1;
  }
}

int main() {
  int n, k;
  cin >> n >> k;
  vi v(n);
  int ind;
  rep(i,n){
    cin >> v[i];
    if (v[i] == 1){
      ind = i;
    }
  }
  int ans = INF;
  
  rep(i,k){
    
    ans = min(ans, 1+count(ind-i, k)+count(n-ind-k+i, k));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
import java.util.*;
import java.lang.*;
import java.io.IOException;

public class Main{
	static Tree tree;
	static boolean[] visited;
	public static void main(String[] args) {
		int n = nextInt();
		int q = nextInt();
		tree = new Tree(n);
		for (int i = 0; i < n - 1; i++) {
			tree.union(nextInt() - 1, nextInt() - 1);
		}
		for (int i = 0; i < q; i++) {
			tree.node[nextInt() - 1].value += nextInt();
		}
		visited = new boolean[n];
		visited[0] = true;
		dfs(0);
		for (int i = 0; i < n - 1; i++) {
			System.out.print(tree.node[i].value + " ");
		}
		System.out.println(tree.node[n - 1].value);
	}
	static void dfs(int n) {
		visited[n] = true;
		for (int key : tree.node[n].list) {
			if (!visited[key]) {
				visited[key] = true;
				tree.node[key].value += tree.node[n].value;
				dfs(key);
			}
		}
	}
  
    static int nextInt() {
        int c;
        try {
            c = System.in.read();
            while(c != '-' && (c < '0' || c > '9')) c = System.in.read();
            if(c == '-') return -nextInt();
            int res = 0;
            while(c >= '0' && c <= '9') {
                res = res * 10 + c - '0';
                c = System.in.read();
            }
            return res;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return -1;
    }
}

class Node {
	ArrayList<Integer> list;
	int value;
	Node() {
		list = new ArrayList<>();
		value = 0;
	}
}

class Tree {
	Node[] node;
	Tree(int n) {
		node = new Node[n];
		for (int i = 0; i < n; i++) {
			node[i] = new Node();
		}
	}
	void union(int n, int m) {
		node[n].list.add(m);
		node[m].list.add(n);
	}
}


Measured memory_bytes: 123400
#include <cstdio>
using namespace std;
int gcd(register int a, register int b){
	register int c;
	while (c = a % b) {
		a = b;
		b = c;
	}
	return b;
}
int x[20007], n;
int Check(register int pre, register int sum){
	register int i;
	for (i = pre + 1; i <= 30000; ++i) {
		if (gcd(sum, i) > 1 && (sum + i) % 2 == 0 && (sum + i) % 3 == 0) {
			x[n] = i;
			return 1;
		}
	}
	return 0;
}
int dfs(register int t, register int pre, register int sum){
	if (t == n) return Check(pre, sum);
	register int i;
	for (i = pre + 1; i <= 30000; ++i) {
		if (i % 2 == 0 || i % 3 == 0) {
			x[t] = i;
			if (dfs(t + 1, i, sum + i)) return 1;
		}
	}
	return 0;
}
int main(){
	register int i, cnt, sum = 0;
	scanf("%d", &n);
	dfs(1, 1, 0);
	for (i = 1; i <= n; ++i) printf("%d ", x[i]);
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  vector <int> a(n);
    for(int i=0;i<n;i++){
    cin >> a.at(i);
    }
  vector <int> b(n);
  b=a;
  sort(a.begin(),a.end());
  
  for(int i=0;i<n;i++){
  if(b.at(i)==a.at(n-1))
    cout << a.at(n-2) << endl;
    else cout << a.at(n-1) << endl;
  }
  
    
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long a[N], d[N], cnt[N];
int main() {
	int n;
	scanf("%d", &n);
	long long s = 0, should = 0;
	for (int i = 0; i < n; ++ i) {
		int a;
		scanf("%d", &a);
		::a[i] = a;
		s += ::a[i];
		should += i + 1;
	}
	long long sum = 0;
	for (int i = 0; i < n; ++ i) {
		d[i] = a[i] - a[(i + 1) % n];
		sum += d[i];
	}
	if (sum % n != 0 || s % should != 0) return 0 * puts("NO");
	sum /= n;
	s /= should;
	for (int i = 0; i < n; ++ i) {
		if ((-sum + d[i] + s) % n != 0) return 0 * puts("NO");
		long long y = (-sum + d[i] + s) / n;
		long long x = s - y;
		if (y < 0 || x < 0) return 0 * puts("NO");
		cnt[i] += y;
	}
	long long work = 0, ws = 0;
	for (int i = 0; i < n; ++ i) {
		work += (n - i) * cnt[i];
		ws += cnt[i];
	}
	for (int i = 0; i < n; ++ i) {
		a[i] -= work;
		if (a[i] < 0 || a[i] % should != 0) return 0 * puts("NO");
		work -= n * cnt[i];
		work += ws;
	}
	puts("YES");
}



Measured memory_bytes: 2560
package main

import (
	"fmt"
)

func main() {
	var N, R int
	fmt.Scan(&N, &R)
	// fmt.Printf("A %d, B %d\n", a, b)

	if N >= 10 {
		fmt.Printf("%d\n", R)
	} else {
		fmt.Printf("%d\n", R+100*(10-N))
	}
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int n;cin >>n;
    vector<int>l(n);
    for (int i = 0; i <n; ++i) {
        cin >>l[i];
    }
    sort(all(l));
    ll ans=0;
    for (int i = 0; i < n; ++i) {
        for (int j = i+1; j <n; ++j) {
            for (int k =j+1; k < n; ++k) {
                if(l[i]==l[j]||l[j]==l[k])continue;
               if(l[i]+l[j]>l[k])ans++;
            }
        }
    }
    cout <<ans <<endl;
}


Measured memory_bytes: 3628