akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
// #define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr double EPS = 1e-9;



int main() {


    

    int n,k;
    cin>>n>>k;
    
    si s;
    rep(i,k){
        int d;
        cin>>d;
        rep(j,d){
            int D;
            cin>>D;
            s.insert(D);
        }
    }
    fin(n-s.size());
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 998244353LL
#define EPS 0.00001
#define f first
#define s second
#define pb push_back

#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (int i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 200005
int n;
string t;
int zc, oc;
int pz[MN];

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

    cin >> t;
    int n = t.length();
    F0R(i, n) if(t[i] == '0') ++zc; else ++oc;
    RFOR(i, n-1, 0) pz[i] = pz[i+1]+(t[i]=='0'?1:0);
    //111...1 ans = (n/2)+(n/2)+...
    ll ans = 0;
    FOR(i, 1, oc){
        ans += (i+1)/2;
    }

    int nz = 0;
    int cl = 0;
    int oc = 0;
    F0R(i, n){
        if(t[i] == '0'){
            if(cl % 2 == 1){
                //keep
                //cout << "keeping " << i << "\n";
                ++cl;
                ++nz;
            }
        } else{
            //always keep this guy!
            //process the deletions before this guy
            //moving from location i to location cl excl. count number of evens
            ans = ans+(i/2+1)-(cl/2+1);
            if(cl%2==0){
                //how long do i sit here?
                //however many zeroes are to the right of this guy
                //cout << "hi " << pz[i+1] << "\n";;
                ans += pz[i+1];
            }
            //now we move from this location to oc excl. how many evens
            ans = ans+(cl/2+1)-(oc/2+1);
            ++cl;
            ++oc;
        }
        //cout << i << " " << ans << "\n";
    }
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 4564
#%%
import heapq

N, M = map(int, input().split())
l = [0] * N
for i in range(N):
    l[i] = list(map(int, input().split()))

l.sort()
#print(l)

L = [[] for _ in range(M+1)]
for i in range(N):
    if l[i][0] <= M:
        L[l[i][0]].append(l[i][1]) 

#print(L)


a = []
ans = 0
for i in range(M+1):
    for j in range(len(L[i])):
        heapq.heappush(a, -L[i][j])
    if len(a) != 0:
        ans += heapq.heappop(a)

print(-ans)

#%%


Measured memory_bytes: 40032
#include<stdio.h>
#include<string.h>
using namespace std;
char c[101][101];
int a[101][101];
int main()
{
   int n,m,i,j;
   scanf("%d%d\n",&n,&m);
   for(i=1;i<=n;i++)
   {
      gets(c[i]);
   }
   for(i=1;i<=n;i++)
   {   
      for(j=0;j<m;j++)
      {
	     if(c[i][j]=='#')
	     {
		   a[i][j]=c[i][j]-'#'+100;
		 }else
		 {
		     a[i][j]=c[i][j]-'.'+0;
		 }
	  }  
   }
   for(i=1;i<=n;i++)
   {
       for(j=0;j<m;j++)
       if(a[i][j]==100)
       {
	     continue;
	   }
       else
       {
	     if(a[i-1][j]==100)
	     {
		    a[i][j]+=1; 
		 }
		 if(a[i-1][j+1]==100)
	     {
		    a[i][j]+=1; 
		 }
		 if(a[i-1][j-1]==100)
	     {
		    a[i][j]+=1; 
		 }
		 if(a[i][j+1]==100)
	     {
		    a[i][j]+=1; 
		 }
		 if(a[i][j-1]==100)
	     {
		    a[i][j]+=1; 
		 }
		 if(a[i+1][j+1]==100)
	     {
		    a[i][j]+=1; 
		 }
		 if(a[i+1][j]==100)
	     {
		    a[i][j]+=1; 
		 }
		 if(a[i+1][j-1]==100)
	     {
		    a[i][j]+=1; 
		 }
	   }
   }
   for(i=1;i<=n;i++)
   {
      for(j=0;j<m;j++)
      {
	    if(a[i][j]==100)
	    {
		   printf("#");
		}
		else
		{
		  printf("%d",a[i][j]);
		}
		if(j==m-1)
		{
		  printf("\n");
	    }
	  }
   }
   return 0;
}

Measured memory_bytes: 128
n,y = map(int,input().split())
ans = 0
for a in range(0,n+1):
    if ans == 1:
      a -= 1
      break
    for b in range(0,n+1):
        c = n-a-b
        if 10000*a + 5000*b + 1000*c == y and c >= 0:
            ans = 1
            break

if ans == 0:
    print("-1 -1 -1")
else:
    print(a,b,c)

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

void AddShifts(int c, auto &v) {
    int cnt = 0;
    for (int a = 0; a * 1ll * a <= c; a++) {
        int64_t  val = c - a * 1ll * a;
        int64_t sq = sqrt(val);
        if (sq * sq == val) {
            v.push_back({a, sq});
        }
    }
}
const int MAXN = 611;
bool used[MAXN][MAXN];
int color[MAXN][MAXN];
int n, d1, d2;

void Dfs(int x, int y, int col, const auto& s) {
    used[x][y] = true;
    color[x][y] *= 2;
    color[x][y] += col;
    for (const auto& sh : s) {
        for (int i = -1; i <= 1; i += 2) {
            for (int j = -1; j <= 1; j += 2) {
                int cur_x = x + i * sh.first;
                int cur_y = y + j * sh.second;
                if (cur_x >= 0 && cur_y >= 0 && cur_x < 2 * n && cur_y < 2 * n) {
                    if (!used[cur_x][cur_y]) {
                        Dfs(cur_x, cur_y, col ^ 1, s);
                    } else {
                        if (color[cur_x][cur_y] == color[x][y]) {
                            exit(1);
                        }
                    }
                }
            }
        }
    }
}


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> d1 >> d2;
    std::vector<pair<int, int>> d1_c;
    std::vector<pair<int, int>> d2_c;
    AddShifts(d1, d1_c);
    AddShifts(d2, d2_c);
    for (int i = 0; i < 2 * n; i++) {
        for (int j = 0; j < 2 * n; j++) {
            if (!used[i][j]) {
                Dfs(i, j, 0, d1_c);
            }
        }
    }

    for (int i = 0; i < 2 * n; i++) {
        for (int j = 0; j < 2 * n; j++) {
            used[i][j] = false;
        }
    }

    for (int i = 0; i < 2 * n; i++) {
        for (int j = 0; j < 2 * n; j++) {
            if (!used[i][j]) {
                Dfs(i, j, 0, d2_c);
            }
        }
    }
    int cnt[4] = {0, 0, 0, 0};
    for (int i = 0; i < 2 * n; i++) {
        for (int j = 0; j < 2 * n; j++) {
            cnt[color[i][j]]++;
        }
    }
    int g_c = (std::max_element(cnt, cnt + 4) - cnt);
    int rem = n * n;
    for (int i = 0; i < 2 * n; i++) {
        for (int j = 0; j < 2 * n; j++) {
            if (rem && color[i][j] == g_c) {
                rem--;
                cout << i << " " << j << "\n";
            }
        }
    }
}

Measured memory_bytes: 30848
#include <bits/stdc++.h>
using namespace std;
#define M_PI 3.14159265358979323846
#define MOD 1000000007
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> ipair;
typedef pair<ll, ll> llpair;

int n, a[100001], b[100001], c[100001];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    int dp[3][n];
    dp[0][0] = a[0];
    dp[1][0] = b[0];
    dp[2][0] = c[0];
    for(int i=1; i<n; i++){
        dp[0][i] = a[i] + max(dp[1][i-1], dp[2][i-1]);
        dp[1][i] = b[i] + max(dp[0][i-1], dp[2][i-1]);
        dp[2][i] = c[i] + max(dp[0][i-1], dp[1][i-1]);
    }
    cout<<max({dp[0][n-1], dp[1][n-1], dp[2][n-1]})<<"\n";
	return 0;
}

Measured memory_bytes: 5972
#include<stdio.h>
void mergesort(double v[],int left,int right)
{
  int temp[50];
  int mid,i,j,k;
  if(left>=right)
    return;
  mid=(left+right)/2;
  mergesort(v,left,mid);
  mergesort(v,mid+1,right);
  for(i=left;i<=mid;i++)
    temp[i]=v[i];
  for(i=mid+1,j=right;i<=right;i++,j--)
    temp[i]=v[j];
  i=left;
  j=right;
  for(k=left;k<=right;k++)
  {
    if(temp[i]<=temp[j])
      v[k]=temp[i++];
    else
      v[k]=temp[j--];
  }
}
void main(void)
{
  int N,i;
  scanf("%d",&N);
  double v[N];
  for(i=0;i<N;i++)
    scanf("%lf",&v[i]);
  mergesort(v,0,N-1);
  for(i=0;i<N-1;i++)
    v[i+1]=(v[i]+v[i+1])/2;
  printf("%lf",v[N-1]);
}

Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var A = Sarray()[0];
            var B = Sarray()[0];
            var C = Sarray()[0];
            var X = Sarray()[0];
            var ans = 0L;
            for (var a = 0; a <= A; ++a)
                for (var b = 0; b <= B; ++b)
                    for (var c = 0; c <= C; ++c)
                        if (a * 500 + b * 100 + c * 50 == X)
                            ++ans;
            WriteLine(ans);
        }
        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28148
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int n;
    cin>>n;
    
    vector<int> v(n);
    rep(i,n)cin>>v[i];
    
    rep(i,n){
        rep(j,n){
            if(i==j)continue;
            if(abs(v[i]-v[j])%(n-1)==0){
                cout<<v[i]<<" "<<v[j]<<endl;
                return 0;
            }
        }
    }
}



Measured memory_bytes: 3104
import sys
from math import factorial
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N = INT()
count15 = N//15
count3 = N//3
count5 = N//5
sum3 = count3*(count3+1)*3//2
sum5 = count5*(count5+1)*5//2
sum15 = count15*(count15+1)*15//2
temp = sum3+sum5-sum15
print(N*(N+1)//2 -temp)

Measured memory_bytes: 72700
package main

import "fmt"

func main() {
	var n, m, c int
	fmt.Scan(&n, &m, &c)

	bs := make([]int, m)
	for i := range bs {
		fmt.Scan(&bs[i])
	}

	count := 0
	for i := 0; i < n; i++ {
		var x int
		sum := c
		for j := 0; j < m; j++ {
			fmt.Scan(&x)
			sum += x * bs[j]
		}
		if sum > 0 {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  while(b>=2){
    if (a%b==0) return false;
    b--;
  }
  return true;
}

int main(void){
  ll N, M, A, B, C, D, W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> A >> B;
  if (A<= B) cout << A << endl;
  else cout << A-1<< endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define RALL(c) rbegin(c),rend(c)
typedef long long llong;
using vi = vector<int>;


int main() {
	vi a(3);
	for (int i = 0; i < 3; i++) cin >> a[i];
	sort(RALL(a));
	cout << a[0] * 10 + a[1] + a[2] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int myfind(int a, vector<int>& relation) {
    if (relation[a] == a) return a;
    int res = myfind(relation[a], relation);
    relation[a] = res;
    return res;
}

void myunion(int a, int b, vector<int>& relation) {
    int ta = myfind(a, relation);
    int tb = myfind(b, relation);
    if (ta == tb) return;
    relation[ta] = tb;
}

int main() {
    int n, q;
    cin >> n >> q;
    vector<int> relation(n, 0);
    for (int i = 0; i < n; i++) {
        relation[i] = i;
    }
    for (int i = 0; i < q; i++) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            myunion(u, v, relation);
        } else {
            if (myfind(u, relation) == myfind(v, relation)) {
                cout << 1 << endl;
            } else {
                cout << 0 << endl;
            }
        }
    }
}




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

int main() {
  ll n;
  cin >> n;

  ll sum = 0;

  rep2(i, n) {
    if (i % 3 != 0 && i % 5 != 0) {
      sum += i;
    }
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3636
N,W=map(int,input().split())
table=[]
for i in range(N):
    w,v=map(int,input().split())
    table.append((w,v))
dp=[[10**22]*(N*(10**3)+1) for i in range(N+1)]
dp[0][0]=0
for i in range(1,N+1):
    w,v=table[i-1]
    for j in range(N*(10**3)+1):
        if j-v>=0:
            dp[i][j]=min(dp[i-1][j-v]+w,dp[i-1][j])
        else:
            dp[i][j]=dp[i-1][j]
for j in range(N*(10**3),-1,-1):
    if dp[N][j]<=W:
        print(j)
        break


Measured memory_bytes: 145032
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
struct edges
{
	int to,next;
}edge[202020];
int first[101010],now;
void adde(int x,int y)
{
	now++;
	edge[now].to=y;
	edge[now].next=first[x];
	first[x]=now;
}
int s[101010],al=(1<<20)-1;
int pre[1<<20];
int lowbit(int x)
{
	return x&(-x);
}
int h=0;
void work(int p,int fa)
{
	int mk=1;
	s[p]=0;
	for(int e=first[p];e;e=edge[e].next)
		if(edge[e].to!=fa)
		{
			work(edge[e].to,p);
			mk=max(mk,pre[s[p]&s[edge[e].to]]);
			s[p]|=s[edge[e].to];
		}
	while(mk&s[p])
		mk<<=1;
	h=max(h,mk);
	s[p]&=(al^(mk-1));
	s[p]^=mk;
}
int main()
{
	int n,x,y,ans;
	scanf("%d",&n);
	pre[0]=0;
	pre[1]=1;
	for(int i=2;i<(1<<20);i++)
		pre[i]=pre[i>>1]<<1;
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		adde(x,y);
		adde(y,x);
	}
	work(1,0);
	ans=-1;
	while(h)
	{
		ans++;
		h>>=1;
	}
	printf("%d\n",ans);
	return 0;
}

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

long long int kaijyou(int i){
    long long int answer = 0;
    while(i>0){
        answer += i;
        i--;
    }
 //   cout << "answer:" << answer << endl; 
    return answer;
}

int main(){
    int N;
    cin >> N;
    vector<string> s(N);
    for(int i=0;i<N;i++){
        cin >> s[i];
        sort(s[i].begin(),s[i].end());
    }
    sort(s.begin(),s.end());
    long long int answer = 0;
    int n_count = 0;

    vector<int> k_count;
    int same;

    for(int i=0;i<N;i++){
        same = 1;
        if(i==N-1) k_count.push_back(1);
        for(int k=i+1;k<N;k++){
            if(s[i] == s[k]){
                same++;
                if(k == N-1){
                k_count.push_back(same);
                i = k;
                }
            }else if(s[i] != s[k]){
                k_count.push_back(same);
                i = k-1;
                break;
            }
        }
    }

  //  for(int i=0;i<k_count.size();i++) cout << "k:" << k_count[i] << endl;

    for(int i=0;i<k_count.size();i++){
        if(k_count[i]!=1) answer += kaijyou(k_count[i]-1);
    }
/*
    for(int i=N-1;i>=0;i--){
        n_count = count(s.begin(),s.end(),s[i]);
        if(n_count != 1) answer += kaijyou(n_count-1);
        i -= n_count - 1;
        s.erase( s.end()-n_count , s.end() );
      //  for(int k=0;k<s.size();k++) cout << s[k] << endl;
    } */
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 7936
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,a[101010]={},s[101010]={};
	cin>>n;
	FORQ(i,1,n)cin>>a[i];
	int all=0;
	FORQ(i,0,n){
		all+=fabs(a[i]-a[i+1]);
	}
	FORQ(i,1,n){
		int t=fabs(a[i]-a[i+1])+fabs(a[i]-a[i-1])-fabs(a[i-1]-a[i+1]);
		cout<<all-t<<endl;
	}
	

    return 0;
}


Measured memory_bytes: 1664
{-# LANGUAGE FlexibleContexts #-}
import Control.Monad
import Control.Monad.State
import Control.Monad.Reader
import Control.Arrow
-- import Control.Comonad
import Data.Maybe
import Data.List
import Data.Either
import Data.Bool
import Data.Fixed
import Data.Tuple
import Data.Ratio
import qualified Data.Map.Strict as M
import qualified Data.Array.IO as IA
import qualified Data.Vector as V
 
getI = read <$> getLine :: IO Int
getIs = map read . words <$> getLine :: IO [Int]
getD = read <$> getLine :: IO Double
getDs = map read . words <$> getLine :: IO [Double]
getInt = read <$> getLine :: IO Integer
getInts = map read . words <$> getLine :: IO [Integer]
 
type Row = Integer
type Col = Integer
type PointI = (Integer, Integer)
type Point = (Int, Int)
 
mmm = 1000000007
fact n
    | n < 1 = 1
    | True = foldr1 (*) [1..n]
fi = fromInteger
fig = fromIntegral
rf = realToFrac
 
(.<.) f g -- combination
    | f < g = 0 
    | g < 1 || f < 1 = 1
    | True = foldr1 (*) (take g [f,f-1..]) `div` fact g
(.>.) f g --combination with repetition
    | g < 1 || f < 1 = 1
    | True = fact (f + g - 1) `div` (fact (f - 1) * fact g)
comb = (.<.)
combWp = (.>.)
 
unique a = unique_ (reverse . sort $ a) [] Nothing
    where
        unique_ [] arr _ = arr
        unique_ (x:xs) arr n
            | n == Just x = unique_ xs arr n
            | otherwise = unique_ xs (x:arr) $ Just x
 
zeroume keta num
    | (length . show $ num) > keta = show num
    | otherwise = do 
        let zeros = take keta $ repeat '0'
        reverse . take keta $ (reverse . show $ num) ++ zeros
 
i2b num
    | num < 2 = show num
    | otherwise = i2b_ num []
        where
            i2b_ num str
                | num == 0 = str
                | num == 1 = '1':str
                | otherwise = do
                    let next = num `div` 2
                    let this = if odd num then '1' else '0'
                    i2b_ next (this:str)
 
mapIncr = mapPlus 1
mapPlus n Nothing = Just n
mapPlus n a = (+) n <$> a
 
countIf f = length . filter f
 
-- 
--
--

main = do
  subject <- getLine
  target <- getLine
  if check subject target && check target subject then putStrLn "Yes"
  else putStrLn "No"
  where
    check s t = do
      let sbj = zip s t
      isRight $ foldr (\x y -> y >>= ins x) (Right M.empty)  sbj
      where
        ins (a, b) mp = do
          let t = M.lookup a mp
          if t == Nothing then Right $ M.insert a b mp
          else if t == Just b then Right mp
          else Left ()


Measured memory_bytes: 28028
from math import inf
n,k=map(int,input().split())
arr=[0]+list(map(int,input().split()))
cost=[0]+list(map(int,input().split()))
ma=-inf
for i in range(1,n+1):
    se=set()
    cur=i
    pref=[0]
    f=0
    while(cur not in se and f<k):
        se.add(cur)
        cur=arr[cur]
        co = cost[cur]
        pref.append(pref[-1]+co)
        ma=max(ma,pref[-1])
        f+=1

    if pref[-1]>0 and k>=f:
        ans=pref[-1]*(k//f)
        for j in range(k%f+1):
            ma=max(ma,ans+pref[j])
        ma=max(ma,pref[-1]*(k//f-1)+max(pref))
print(ma)











Measured memory_bytes: 168180
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	num, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return num
}

func main() {
	sc.Split(bufio.ScanWords)

	a := nextInt()
	b := nextInt()
	c := nextInt()
	d := nextInt()

	ans := func() string {
		for {
			c -= b
			if c <= 0 {
				return "Yes"
			}
			a -= d
			if a <= 0 {
				return "No"
			}
		}
	}()

	fmt.Println(ans)
}


Measured memory_bytes: 1756
#include <stdio.h>
#include <math.h>
int main()
{
	int x,a,b;
	scanf("%d%d%d",&x,&a,&b);
	a=fabs(x-a);
	b=fabs(x-b);
	if(a<b)
		printf("A");
	else
		printf("B");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define double long double
#define rep(i, n) for (int i = 0; i < n; i++)
#include <math.h> /* M_PI */
#define INF 2147483647
int main()
{
    int x, n;
    cin >> x >> n;
    vector<ll> p(n);
    rep(i, n)
    {
        cin >> p[i];
    }
    int flag = 1;
    int min1 = INF;
    int data = 0;
    for (int i = 0; i < 105; i++)
    {
        flag = 1;
        for (int j : p)
        {
            if (j == i)
            {
                flag = 0;
                break;
            }
        }
        if (flag == 1)
        {
            if (min1 > abs(x - i))
            {
                min1 = min(min1, abs(x - i));
                data = i;
            }
                }
    }
    cout << data << endl;
}

Measured memory_bytes: 3636
n,m = map(int,input().split())
A = [list(map(int,input().split()))for i in range(n)]
ans = 0
for j in range(1,m+1):
    c = 0
    for i in range(n):
        if j in A[i][1:]:
            c += 1
    if c == n:
        ans += 1
print(ans)

Measured memory_bytes: 3060
while True:
  a0,L = map(int, raw_input().split())
  if a0==L==0: break
  dic = {}
  dic[a0] = 0
  a = a0
  i = 1
  while True:
    if len(str(a)) < L:
      a *= 10 ** (L-len(str(a)))
    amax = int("".join(sorted(str(a), reverse=True)))
    amin = int("".join(sorted(str(a), reverse=False)))
    a = amax - amin
    if a in dic:
      print "%d %d %d" % (dic[a], a, i-dic[a])
      break
    else:
      dic[a] = i
      i += 1

Measured memory_bytes: 6464
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
typedef long long ll;
int main(){
    int x,a,b;
    cin >> x >> a >> b;
    if(abs(x-a) < abs(x-b)) cout << "A" << endl;
    else cout << "B" << endl;
    return 0;
}


Measured memory_bytes: 256
#ブログの模範解答（参考のため提出）
#https://marco-note.net/abc-175-work-log/

N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = -float('inf')
for s in range(N):
    ### Step1
    S = []  # 累積和S. ただし, 初項は0ではなく1回目の移動後の得点とする.
    # 1回目の移動
    i = P[s] - 1
    S.append(C[i])
    # 2回目以降の移動. スタート地点に戻ってくるまで繰り返し.
    while i != s:
        i = P[i] - 1
        S.append(S[-1] + C[i])

    ### Step2: KとSの長に応じて場合分けして, 得点の最大値を求める.
    # 1周未満しか移動できない場合:
    if K <= len(S):
        score = max(S[:K])
    # 1周以上回ることができるが, ループを1周したときに得点が減る場合:
    elif S[-1] <= 0:
        score = max(S)
    # 1週以上回ることができ, かつループを1週するごとに得点が増える場合:
    else:
        # ループを (K // len(S) - 1)回 廻る場合:
        score1 = S[-1] * (K // len(S) - 1)
        score1 += max(S)
        # ループを (K // len(S))回 廻る場合:
        score2 = S[-1] * (K // len(S))
        r = K % len(S)
        if r != 0:
            score2 += max(0, max(S[:r]))
        # score1 と score2 の大きい方がこの場合の得点の最大値
        score = max(score1, score2)

    ans = max(ans, score)

print(ans)


Measured memory_bytes: 80716
#include <bits/stdc++.h>
using namespace std;
typedef long long in;
typedef pair<in,in> ii;
#define F first
#define S second
#define sqr(x) (x)*(x)
#define pb(x) push_back(x)
#define sz(x) (in)x.size()
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,x,y) for(in i=x;i<(y);++i)
#define per(i,x,y) for(in i=y;i>=(x);--i)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
/* start */

in v[3];

int main()
{
	IOS;
	in a,b;
	cin >> a >> b;
	v[a]++;
	v[b]++;
	rep(i,1,4)
	{
		if(v[i] != 1)
		{
			cout << i << "\n";
		}
	}
}

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

int main() {
  string s;
  int a = 0,b = 0,c = 0;
  cin >> s;
  rep(i,0,s.size()){
    if(s[i] == 'a') a++;
    if(s[i] == 'b') b++;
    if(s[i] == 'c') c++;
  }
  bool f = false;
  if(abs(a-b) > 1) f = true;
  if(abs(a-c) > 1) f = true;
  if(abs(b-c) > 1) f = true;
  if(f) cout << "NO" << endl;
  else cout << "YES" << endl;
}

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

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

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

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


signed main() {
  int X, Y, A, B, C; 
  cin >> X >> Y >> A >> B >> C;

  vector<int> p(A);
  REP(i, A) cin >> p[i];

  vector<int> q(B);
  REP(i, B) cin >> q[i];

  vector<int> r(C+X+Y);
  REP(i, C) cin >> r[i];

  sort(ALL(p), greater<>());
  sort(ALL(q), greater<>());

  REP(i, X) r[C+i] = p[i];
  REP(i, Y) r[C+X+i] = q[i];

  sort(ALL(r), greater<>());

  int ans = 0;
  REP(i, X+Y) ans += r[i];

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 4096
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Integer[] lines = getStdinInt();
        int five = 0;
        int seven = 0;
        for(int i = 0; i < lines.length; i++){
            if(lines[i] == 5){
                five++;
            }else if(lines[i] == 7){
                seven++;
            }
        }
        if(seven == 1 && five == 2){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }

    private static Integer[] getStdinInt() {
        Scanner scanner = new Scanner(System.in);
        ArrayList<Integer> lines = new ArrayList<>();
        while (scanner.hasNext()) {
            lines.add(scanner.nextInt());
        }
        return lines.toArray(new Integer[lines.size()]);
    }
}


Measured memory_bytes: 21712
N, K = [int(x) for x in input().split()]
H = sorted([int(input()) for _ in range(N)])
minh = H[0]
H = [h-minh for h in H]
l = K-1
ans = H[-1]
for i in range(N-l):
    ans = min(ans, H[i+l]-H[i])
print(ans)


Measured memory_bytes: 56936
#include<bits/stdc++.h>
using namespace std;
int n,k,ans=1;
int main()
{
	int ok;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		ans+=min(ans,k);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int a = in.nextInt();
		int b = in.nextInt();
		System.out.println(a * b);
	}
}

Measured memory_bytes: 35800
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		while(true) {
			
			String datas = br.readLine();
			String[] data = datas.split(" ");
			int x = Integer.parseInt(data[0]);
			int y = Integer.parseInt(data[1]);
			
			if(x==0&&y==0) {
				break;
			}
			
			if(x<y) {
				System.out.println(x+" "+y);
			}else {
				System.out.println(y+" "+x);
			}
			
		}
		
	}
}

Measured memory_bytes: 26860
#include<bits/stdc++.h>
using namespace std;
int main(){
  int k,s,count=0;
  cin>>k>>s;
  for(int i=0;i<=k;i++){
    for(int j=0;j<=k;j++){
      int z=s-i-j;
      if(z>=0 && z<=k){
        count++;
      }
    }
  }
  	cout<<count<<'\n';
    return(0);
  }

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from math import sqrt

while True:
    e = int(input())
    if e == 0:
        break
    ans = 10**9
    for z in range(e):
        if z**3 > e:
            break
        y = int(sqrt(e-z**3))
        x = e - y ** 2 - z ** 3
        ans = min(ans,x+y+z)
    print(ans)

Measured memory_bytes: 6808
#include <bits/stdc++.h>
#define ll long long
#define lld long double
#define MOD 1000000007
#define CAP 10000000
#define inf 1000000000000000000LL
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define sz(v) v.size()
#define all(v)    v.begin(),v.end()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
ll power(ll x,ll y, ll md=MOD){ll res = 1;x%=md;while(y>0){if(y&1)res = (res*x)%md;x = (x*x)%md;y = y>>1;}return res%md;}
#define dbg(x) cout <<#x<<":"<<x<<endl;
 
#define int ll



signed main() {
	fast;

	int n;
	cin>>n;
	vector<pii> a(n), b(n);
	vector<pii> x(n);

	for(int i=0;i<n;i++) cin>>x[i].s, a[i] = {x[i].s,i};
	for(int i=0;i<n;i++) cin>>x[i].f, b[i] = {x[i].f,i};

	sort(all(a));
	sort(all(b));
	sort(all(x));

	int f = 1;
	for(int i=0;i<n;i++) if(a[i].f>b[i].f) f = 0;

	if(!f) {
		cout<<"No";
		return 0;
	}

	f = 0;

	for(int i=1;i<n;i++) {
		if(a[i].f<=b[i-1].f) f = 1;
	}
	if(f) {
		cout<<"Yes";
		return 0;
	}

	map<int,int> index;
	for(int i=0;i<n;i++) index[a[i].s] = i;

	int cycles = 0;
	set<int> vis;
	for(int i=0;i<n;i++) {
		if(vis.find(i)!=vis.end()) continue;
		cycles++;

		int cur = i;
		while(true) {
			if(vis.find(cur)!=vis.end()) break;
			vis.insert(cur);
			cur = b[index[cur]].s;
		}
	}
	if(cycles>1) cout<<"Yes";
	else cout<<"No";
}

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

typedef long long ll;
#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define llrep(i,n)   for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prt_dbl(i,var) cout<<fixed<<setprecision(i)<<var<<endl;
template <typename Val>
Val gcd(Val a, Val b) {
//use ll or int for gcd
    if (b==0) return a;
    else return gcd(b, a%b);
}
template <typename Val>
Val vec_max(vector<Val> v){
  return *max_element(v.begin(),v.end());
}
template <typename Val>
Val vec_min(vector<Val> v){
  return *min_element(v.begin(),v.end());
}

template <typename Val,typename Number>
void count_vector(vector<Val>* A,vector<pair<Number,Val>>*R){
  sort(A->begin(),A->end());
  int count = 1;
  rep(i,A->size()){
    if(i<A->size()-1){
      if(A->at(i)==A->at(i+1))count++;
      else{
        R->push_back(make_pair(count,A->at(i)));
        count = 1;
      }
    }else{
      R->push_back(make_pair(count,A->at(i)));
      count = 1;
    }
  }
}

//---------------------------------------------------------------
int main(){
  ll N;
  cin>>N;
  vector<string> S(N);
  llrep(i,N){
    cin>>S.at(i);
  }

  sort(S.begin(),S.end());
  vector<pair<ll,string>> A;
  count_vector(&S,&A);

  cout<<A.size()<<endl;





}


Measured memory_bytes: 19928
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
 
template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}
 
const int N=55,M=125005,inf=1e9+9;
struct node{
	ll s,v;
	friend bool operator < (node a,node b){
		return a.v*b.s<b.v*a.s;
	}
} x[N];
int m[N],n,p,sum;
ll f[M],X,D,ans;
vi e[N];
 
void dfs(int u){
	x[u].s=1,x[u].v=m[u];
	for(auto v:e[u]){
		dfs(v);
		x[u].s+=x[v].s;
		x[u].v+=x[v].v;
	}
	sum+=x[u].s*n;
}
 
int main(){
	read(n),read(X),read(D);
	rep(i,1,n){
		read(m[i]);
		if(i>=2) read(p),e[p].pb(i);
	}
	dfs(1);
	sort(x+1,x+n+1);
	memset(f,0x3f,sizeof f);
	f[0]=0;
	rep(i,1,n){
		int rem=(x[i].s==n?n:min((ll)n,D));
		for(int k=1;k<=rem;k<<=1){
			ll a=x[i].s*k,b=x[i].v*k;
			for(int s=sum;~s;s--) if(f[s]>=0)
				f[s+a]=min(f[s+a],f[s]+b);
			rem-=k;
		}
		if(!rem) continue;
		ll a=x[i].s*rem,b=x[i].v*rem;
		for(int s=sum;~s;s--) if(f[s]>=0)
			f[s+a]=min(f[s+a],f[s]+b);
	}
	rep(i,0,sum){
		ll rem=X-f[i],res=0;
		if(rem<0) continue;
		rep(j,1,n){
			ll owo=min((x[j].s==n?(ll)inf:D-min((ll)n,D)),rem/x[j].v);
			res+=owo*x[j].s,rem-=owo*x[j].v;
		}
		ans=max(ans,i+res);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int main() {
  int h, w;
  while(1) {
    cin >> h >> w;
    if(h == 0 && w == 0) break;

    for(int i=0; i<h; i++) {
      if(i==0 || i == h-1) {
        for(int j=0; j<w; j++) {
          cout << "#";
        }
      } else {
        for(int j=0; j<w; j++) {
          if(j == 0 || j == w-1) {
            cout << "#";
          } else {
            cout << ".";
          }
          
        }
      }
      cout << "\n";
    }
    cout << "\n";
  }
  return 0;
}



Measured memory_bytes: 3080
S = input()
def check_ACGT(char):
    for c in list(char):
        if c not in {"A","C","G","T"}:
            return False
    return True
max_len = 0
for start in range(len(S)):
    for end in range(start,len(S)):
        bubun_S = S[start:end+1]
        if check_ACGT(bubun_S):
            if len(bubun_S)>max_len:
                max_len = len(bubun_S)

print(max_len)

Measured memory_bytes: 3060
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.split('\n');
const N = +lines[0];
const A = lines[1].split(' ').map(v => +v);

// console.log(N);
// console.log(A);

const m = {};
for (let i = 1; i <= N; i++) {
    m[i] = 0;
}

A.forEach((i) => m[+i]++);

// console.log(`m=`);
// console.log(m);

Object.values(m).forEach((v) => {
    console.log(`${v}`);
});


Measured memory_bytes: 65772
#include<stdio.h>

int main(){
  int n, m;
  int tmp, i;

  scanf("%d%d", &n, &m);
  if(m!=0){
    for(i=0; i<m; i++){
      scanf("%d", &tmp);
    }
  }
  printf("%d\n", n-1-m);

  return 0;
}

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

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



Measured memory_bytes: 3116
/*                        _
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                   ____/`---'\____
                  /  \\|     |//  \
                 / \\||| /:\ |||// \
                / _||||| -:- |||||- \
               |   | \\\ \-/ /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
            ____'. .'  /--.--\  `. .'_____
          /"" '<  `.___\_<|>_/___.' >' "" \
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` / _/
          `-.____`.___ \_____/___.-`___.-'

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 JENISH MONPARA S.    IIT PATNA    I_LOVE_ADITI_GOEL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793;
const long double DEL = 1e-12;
const int mod =  1000000007;
const int LIM = 100005;


#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mpq priority_queue<int,vector<int>,greater<int>>
#define deb(a) cerr << #a << ": " << a << endl
#define ftt cin>>t;for(int tt=1;tt<=t;++tt)
#define forr(i,n) for((i)=1;(i)<=(n);(i)++)
#define Rev(v) reverse(v.begin(),v.end())
#define Sort(v) sort(v.begin(),v.end())
#define mem(a,b) memset(a,b,sizeof(a))
#define umii unordered_map<int,int>
#define all(a) a.begin() , a.end()
#define vvi vector<vector<int>>
#define pq priority_queue<int>
#define sqr(a) (((a) * (a)))
#define double long double
#define dbg cout<<"\nhi\n"
#define pii pair<int,int>
#define mii map<int,int>
#define vb vector<bool>
#define eb emplace_back
#define vi vector<int>
#define nl cout<<"\n"
#define pb push_back
#define int long long
#define vec vector
#define sp <<" "<<
#define ss second
#define ff first
 
int fpow(int x, int n){
    int res = 1;
    while(n){
          if(n&1){
                res = res * x % mod;
          }
          x = x * x % mod;
          n>>=1;
    }
    return res;
}
int gcd(int a,int b){
    if(b == 0)return a;
    return gcd(b,a % b);
}
void sieve(int n){
     bool prime[5*LIM];
     memset(prime, true, sizeof(prime));
      int rootn = (int)sqrt(n);
     for (int p = 2; p <= rootn; p++)
          if (prime[p] == true)
               for (int i = p*p; i <= n; i += p)
                    prime[i] = false;
     prime[1] = 0;

}

int cnt, sum, mid, mx = -1e17, mn = 1e17, a[2*LIM];
int n, m, d, t, i, j, k, l, r, x, y, z;
bool f, f1, f2;
string s;

//******************************************* CHECK CONSTRAINTS **************************************************


int32_t main()
{     fio;
      cin>>n;
      int add=0,sub=0;
      forr(i,n){
            add+=i*(n-i+1);
      }
      forr(i,n-1){
            cin>>x>>y;
            if(y<x)swap(x,y);
            sub+=x*(n-y+1);
      }
      cout<<add-sub;
     
}


Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
typedef long long ll;
typedef long double ld;
char str[200005];
int main() {
	int n;
	scanf("%d%s", &n, str);
	vector<int> dp(2), ndp(2);
	for (int i = 0; i < n; ++i) {
		ndp[0] = dp[0] + (str[i] == '#');
		ndp[1] = min(dp[0], dp[1]) + (str[i] == '.');
		swap(ndp, dp);
	}
	printf("%d\n", min(dp[0], dp[1]));
}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-
import sys

def main():
	H, W = map(int, input().split(" "))
	MP = []
	for _ in range(10):
		tmp = input().split(" ")
		tmp = [int(s) for s in tmp]
		MP.append(tmp)
	
	MP = warshall_floyd(MP, 10)
	
	ans = 0
	for _ in range(H):
		tmp = input().split(" ")
		tmp = [int(s) for s in tmp]
		for i, val in enumerate(tmp):
			if val == -1:
				continue
			ans += MP[val][1]
		
	print(ans)
	
def warshall_floyd(d, n):
	#d[i][j]: iからjへの最短距離
	for k in range(n):
		for i in range(n):
			for j in range(n):
				d[i][j] = min(d[i][j],d[i][k] + d[k][j])
	return d
	
if __name__ == "__main__":
	main()
	

Measured memory_bytes: 3188
#include<iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>

unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

#define LOCAL  1
#define UPLOAD 2

using namespace std;

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int N;
    vector<pair<int,int>> data;
    cin >> N;

    for(int i=0;i<N;i++){
        int a, b;
        cin >> a >> b;
        data.push_back({a,b});
    }
    std::sort(data.begin(), data.end(), [](pair<int,int> p1, pair<int,int> p2){
        return p1.second < p2.second;
    });

    int sum=0;
    for(auto iter:data){
        sum += iter.first;
        if(sum > iter.second){
            cout << "No" << endl;
            return 0;
        }    
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 2548
#include<stdio.h>

int main(){

    long int N, C[5];

    long int time;

    scanf("%ld %ld %ld %ld %ld %ld", &N, &C[0], &C[1], &C[2], &C[3], &C[4]);

    long int min_cap = C[0];

    for (int i = 1; i < 5; i++){
        if(min_cap > C[i]){
            min_cap = C[i];
        }
    }

    time = ((N + min_cap - 1) / min_cap) + 4;

    printf("%ld", time);

    return 0;
}

Measured memory_bytes: 128
//By Don4ick 
//#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;

#define forn(i, n) for (int i = 1; i <= n; i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define y1 qewr1234

const double PI = acos(-1.0);
const int DIR = 4;
const int X[] = {1, 0, -1, 0};
const int Y[] = {0, 1, 0, -1};

const int N = (int)5e5 + 228;

using namespace std;

int n, k, p[N], q[N], t1[N], t2[N], t[N << 1], res[N];
vector < pair < int, int > > g[N];
bool used[N];

int get(int l, int r)
{
	l += n - 1, r += n - 1;
	int res = n + 1;
	while(l <= r)
	{	
		if (l & 1)
			res = min(res, t[l++]);
		if (!(r & 1))
			res = min(res, t[r--]);
		l >>= 1, r >>= 1;		
	}
	return res;
}

void upd(int v, int val)
{
	v += n - 1;
	t[v] = val;
	while(v != 1)
	{
		v >>= 1;
		t[v] = min(t[v << 1], t[v << 1 | 1]);	
	}
}

int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie();
	//cout.tie();		

	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	//~read
	scanf("%d%d", &n, &k);
	forn(i, n)	
		scanf("%d", &p[i]);
	forn(i, n)
		q[p[i]] = i;
	//~calc_t1_t2
	fill(t + 1, t + (n << 1), n + 1);
	for (int i = n; i >= 1; i--)
	{
		upd(q[i], i);
		t2[q[i]] = get(q[i] + 1, min(n, q[i] + k - 1));
		t1[q[i]] = get(max(1, q[i] - k + 1), q[i] - 1);		
		g[t1[q[i]]].pb({q[i], t2[q[i]]});
		g[t2[q[i]]].pb({q[i], t1[q[i]]});
	}
	//~solve
	set < int > st;
	used[n + 1] = true;
	for (auto it : g[n + 1])
	{
		if (used[it.second])
			st.insert(it.first);
	}
	vector < int > ans;
	while(!st.empty())
	{
		int v = *st.rbegin();
		st.erase(v);
		ans.pb(v);
		used[p[v]] = true;
		for (auto it : g[p[v]])
		{
			if (used[it.second])
			{
				st.insert(it.first);
			}
		}
	}
	reverse(all(ans));
	for (int i = 0; i < (int)ans.size(); i++)
		res[ans[i]] = i + 1;
	forn(i, n)
		printf("%d\n", res[i]);	

	return 0;
}



Measured memory_bytes: 64744
x1, y1, x2, y2 = map(int,input().split())
x3 = x2 - (y2-y1)
y3 = y2 + (x2-x1) 
x4 = x1 - (y2-y1)
y4 = y1 + (x2-x1)
print(x3, y3, x4, y4, sep=" ")

Measured memory_bytes: 3060
# https://atcoder.jp/contests/abc061/tasks/abc061_a

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def main():
    A, B, C = map(int, input().split())
    print('Yes' if A <= C <= B else "No")

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384