akhauriyash/Code-Regression huggingface dataset:
//Catchharsh
    //I Luv Kunj017
    #include<bits/stdc++.h>
    #define ll long long int 
    #define ld long double
    #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    #define F first
    #define S second
    #define pb push_back
    #define endl '\n'
    const ll MOD = 1e9+7;
    const ll INF = 1011111111;
    const ll LLINF = 1000111000111000111LL;
    const ld EPS = 1e-10;
    const ld PI = 3.14159265358979323;
    using namespace std;
    ll power (ll x,ll n)
    {
        if(n==0)
        return 1;
        else if(n%2==0)
        return power((x*x),n/2);
        else
        return x*power((x*x),(n-1)/2); 
    }
    int main()
    {   
         IOS;
         ll n,m,i,j,k;
         cin>>n>>m;
         for(i=m-n+1;i<m+n;i++)
         cout<<i<<" ";    
         
    }

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

typedef pair<int,int> P;

int n, k;
string s;
vector<P> v;

signed main(){
  
  cin>>n>>k;
  
  cin>>s;
  
  int flg = 0;
  
  for(int i=0;i<s.size();i++){
    if( s[i] == '0' ) flg = 1;
  }
  
  if( !flg ){
    cout<<n<<endl;
    return 0;
  }
  
  int num = s[0], cnt = 0;
  
  for(int i=0;i<s.size();i++){
    
    if( num == s[i] ) cnt++;
    else{
      v.push_back(P( num-'0', cnt ));
      num = s[i];
      cnt = 1;
    }
    
  }
  
  v.push_back(P( num-'0', cnt ));
  
  int ans = 0, sum = 0, cnt_0 = 0, start_0;
  
  for(int i=0;i<v.size();i++){
    
    int num = v[i].first, C = v[i].second;
    
    if( num == 0 ){
            
      if( cnt_0 == k ){
	
	if( start_0 != 0 ) sum -= v[start_0-1].second;
	sum -= v[start_0].second;
	
	start_0 += 2;
	
      }
      else cnt_0++;
      
      if( i <= 1 ) start_0 = i;
      
    }

    sum += C;
    
    ans = max( ans, sum );
    
  }
  
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 2548
// Problem : C - Sum of product of pairs
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*

WINNERS NEVER QUIT AND QUITTERS NEVER WIN!!

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<long,long> pl;
typedef pair<ll,ll> pll;
typedef vector<long> vl;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll,ll> umll;

#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define REV(i,a,b) for(long long i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define tc ll tests;cin>>tests;while(tests--)
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define coutv(v) for(auto it: (v))cout<<it<<" ";newl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";newl;}
#define cinv(v,n) vll (v)(n);FOR(i,0,(n)){cin>>v[i];}
#define cinvg(v,n) (v).resize(n);FOR(i,0,(n)){cin>>v[i];}
#define cin2d(v,n,m) vvll (v)(n,vll(m,0));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define cin2dg(v,n,m) (v).resize(n,vll(m));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define newl cout<<"\n"
#define mod 1000000007
#define INF LLONG_MAX/2

long long d,x,y;//declare d,x,y outside function

void exteuc(long long A, long long B)
{
    if(B==0){
        d=A;
        x=1;
        y=0;
    }
    else{
        exteuc(B,A%B);
        long long temp=x;
        x=y;
        y=temp-(A/B)*y;
    }
}

long long modinv(long long A,long long M)
{//declare d,x,y(same as exteuc)
    exteuc(A,M);
    return (x%M+M)%M;//as x may be negative
}

int main()
{
    io;
    ll n,s=0;
    cin>>n;
    cinv(a,n)
    FOR(i,0,n)
    {
    	s+=a[i];
    }
    
    
    ll ans=((s%mod)*(s%mod))%mod;
    
    FOR(i,0,n)
    {
    	ans=(ans-(a[i]%mod*a[i]%mod)%mod+mod)%mod;
    }
    
    cout<<(ans*modinv(2,mod))%mod;
    
    return 0;
}



Measured memory_bytes: 4776
a,b = map(int,input().split())
if a <= 0 <= b:
    ans = "Zero"
elif 0 < a:
    ans = "Positive"
elif b < 0:
    num = b - a + 1
    if num % 2 == 0:
        ans = "Positive"
    elif num % 2 == 1:
        ans = "Negative"
print(ans)

Measured memory_bytes: 2940
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

int main(void){
    char s[10];
    // ll n,ans=0;
    scanf("%s",s);
    // ll [n];
    if(s[2]==s[3] && s[4]==s[5]){
        YES;
    }else{
        NO;
    }
    // rep(i,0,n){
    //     scanf("%lld",&[i]);
    // }
    // printf("\n");
    return 0;
}


Measured memory_bytes: 128
import java.io.*;
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// get a integer
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		int max = a;
		if ( b > a) {
			if (c > b) {
				max = c;
				if (max == a + b)
					System.out.println("Yes");
				else
					System.out.println("No");
			}
			else {
				max = b;
				if (max == a + c)
					System.out.println("Yes");
				else
					System.out.println("No");
			}
		}
		else if (c > a) {
			if (b > a) {
				max = b;
				if (max == a + c)
					System.out.println("Yes");
				else
					System.out.println("No");
			}
			else {
				max = c;
				if (max == a + b)
					System.out.println("Yes");
				else
					System.out.println("No");
			}
		}
		else {
			if (max == b + c)
				System.out.println("Yes");
			else
				System.out.println("No");
		}
		sc.close();
	}
}

Measured memory_bytes: 10196
ans = {"1100000011": "A", "1000000010000000100000001": "B",
       "1111": "C", "1000000110000001": "D",
       "11000000011": "E", "100000001100000001": "F", "110000011": "G"}
while True:
    try:
        st = "".join([input() for _ in range(8)])

        st = st[st.find("1"): st.rfind("1")+1]
        for k, v in ans.items():
            if st == k:
                print(v)
                break
        input()
    except:
        break



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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int n,m;
bool used[1111];

int main(){
	cin.sync_with_stdio(false);
	cin>>n>>m;
	rep(i,m){
		int c,d;
		cin>>c>>d;
		c--; d--;
		repl(i,c,d){
			used[i]=true;
		}
	}
	int l=-1;
	int cnt=0;
	rep(i,n+1){
		if(l==-1&&used[i]){
			l=i;
		}else if(l!=-1&&!used[i]){
			cnt+=(i-l);
			l=-1;
		}
	}
	cout<<n+1+cnt*2<<endl;
	return 0;
}

Measured memory_bytes: 3180
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sa = sum(A)
sb = sum(B)

if sb > sa:
    print(-1)
    exit()

has_margin = []
need_point = []
for a, b in zip(A, B):
    if a == b:
        continue

    if a < b:
        need_point.append(b - a)
    else:
        has_margin.append((a - b, False))

has_margin = sorted(has_margin)
ans = len(need_point)
for x in need_point:
    while x > 0:
        y = has_margin[-1][0]
        if y >= x:
            has_margin[-1] = (y - x, True)
            x = 0
        else:
            has_margin.pop()
            x -= y
            ans += 1
if has_margin[-1][1]:
    ans += 1
print(ans)



Measured memory_bytes: 104688
#include <stdio.h>

int iii[100010];
int a[100010];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int t;
		scanf("%d",&t);
		iii[t]=i;
	}
	for(int i=0;i<n;i++){
		int t;
		scanf("%d",&t);
		a[t]++;
	}
	int idx=-1;
	for(int i=1;i<=n;i++)if(!a[i])idx=i;
	if(idx==-1)puts("Yes");
	else{
		puts("No");
		for(int k=0;k<2;k++)for(int i=1;i<=n;i++){
			printf("%d%c",1+(i==iii[idx]&&k==1),i==n?10:32);
		}
	}
}


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

using namespace std;

int main()
{
  string s;
  cin >> s;
  for(int i = 0; i < s.size(); i++)
  {
    if(i % 2 == 0 && s[i] == 'L')
    {
      cout << "No";
      return 0;
    }
    else if(i % 2 == 1 && s[i] == 'R')
    {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

    long long int a,b,k;

    cin >> a >> b >> k;

    if(a >= k){
        cout << a - k << " " << b << endl;
    }
    else{
        if(b < k -a){
            cout << "0 0" << endl;
        }
        else{
            cout << "0 " << b - (k - a) << endl;
        }
    }

    return 0;
}

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

int main(){
    ll n;
    cin >> n;
    
    const ll a = 1e9 + 7;

    ll ans = 1;
    for(ll i = 1; i < n + 1; i++){
        ans *= i;
        if(ans > a){
            ans = ans % a;
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

#define rep(i,s,n) for(ll (i)=(s);(i)<(n);(i)++)
#define repd(i,n,s) for(ll (i)=(n-1);(i)>=(s);(i)--)
#define all(x) x.begin(),x.end()
#define size(x) ((ll)(x).size()
#define PB push_back

int main(){
  ll n,m;
  cin >> n >> m;
  vector<ll> a(m);
  ll count = 0;
  rep(i,0,m){
    cin >> a[i];
    count+=a[i];
  } 
  if(n>=count){
      cout << n-count << endl;
  }else{
      cout << -1 << endl;
  }
  
}



Measured memory_bytes: 3680
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000000000000;
const int MOD=1000000007;

int X,Y,Z,K;
int A[1010],B[1010],C[1010];
vector<int> V,V2;

signed main(){
	cin>>X>>Y>>Z>>K;
	REP(i,X){
		cin>>A[i];
	}
	REP(i,Y){
		cin>>B[i];
	}
	REP(i,Z){
		cin>>C[i];
	}
	sort(A,A+X,greater<>());
	sort(B,B+Y,greater<>());
	sort(C,C+Z,greater<>());
	REP(i,X)REP(j,Y){
		V.push_back(A[i]+B[j]);
	}
	vector<int> v;
	sort(V.begin(),V.end(),greater<>());
	REP(i,min(K,(int)V.size())){
		v.push_back(V[i]);
	}
	V.clear();
	REP(i,v.size())REP(j,Z){
		V.push_back(v[i]+C[j]);
	}
	sort(V.begin(),V.end(),greater<>());
	REP(i,K){
		cout<<V[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 35044
using System;

namespace AOJ.Volume3
{
    public class Shopping
    {
        public static int Main()
        {
            var input = Console.ReadLine().Split(' ');
            int m = int.Parse(input[0]);
            int f = int.Parse(input[1]);
            int b = int.Parse(input[2]);

            if (m + f < b) { Console.WriteLine("NA"); }
            else if (m >= b) { Console.WriteLine("0"); }
            else { Console.WriteLine(b - m); }

            return 0;
        }
    }
}

Measured memory_bytes: 9180
#include <iostream>

using namespace std;

int main(void) {

        string s;
        cin >> s;
        int num = 0;
        for (int i = 0; i < (int)s.size(); i++) {
                if (s[i] == '1') {
                        ++num;
                }

        }

        cout << num << endl;
        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int i,j;
    cin >> n;
    vector<int> d(n);
    for(i=0;i<n;i++){
        cin >> d.at(i);
    }
    int h=n;
    int na=1000;
    for(i=0;i<n;i++){
        for(j=1;j+i<n;j++){
            if(d.at(i)==d.at(i+j)){
                h--;
                //cout << i <<  "&" << i+j << endl;
                d.at(i+j)=na;
                na++;
            }
        }
    }
    cout << h << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  ((a%2==0)or(b%2==0))?(cout << "No" << endl):(cout << "Yes" << endl);
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

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

int main() {
  LL N; cin >> N;
  vector<LL> v(N); cin >> v;

  LL sum = 0;
  for (int i = N - 1; i >= 0; --i) {
    sum = (2LL * v[i]) - sum;
  }
  LL x = sum / 2LL;
  cout << x << " ";
  for (int i = 1; i < N; ++i) {
    x = 2LL * v[i-1] - x;
    cout << x << " ";
  }
  cout << endl;
}


Measured memory_bytes: 4040
#include <iostream>
#include <cmath>
#include <limits>
using namespace std;
using ll = long long;
int main(){
  ll a,b,c;
  cin >> a >> b >> c;
  double ra = sqrt(a);
  double rb = sqrt(b);
  ll left = 4*a*b;
  ll right = (c-a-b)*(c-a-b);
  bool flag = false;

  if(left < right) flag = true;
  else flag = false;
  if(c-a-b < 0) flag = false;

  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
template <class T>
bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T>
bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

#define MAX 1000000005
 
typedef long long ll;
typedef pair<int, int> P;

int main(int, char**)
{
    int n, a, b, c;
    cin >> n >> a >> b >> c;

    vector<string> s(n);
    rep(i,n) cin >> s[i];

    vector<char> ans;

    rep(i,n) {
        char fst_c = s[i][0];
        char snd_c = s[i][1];
        int *fst, *snd;
        if (fst_c == 'A') fst = &a; else fst = &b;
        if (snd_c == 'B') snd = &b; else snd = &c;

        int dir = 0;    // 0:fst++, snd-- 1:fst--,snd++
        if (*fst + *snd == 0) {
            cout << "No" << endl;
            return 0;
        } else if (*fst + *snd == 1) {
            dir = (*fst == 0) ? 0 : 1;
        } else if (*fst == 1 && *snd == 1) {
            if (i < n-1) {
                char nxt_fst_c = s[i+1][0];
                char nxt_snd_c = s[i+1][1];
                dir = (fst_c == nxt_fst_c || fst_c == nxt_snd_c) ? 0 : 1;   // 次に使う方を増やしておく
            } else {
                dir = 0;    // どちらでもOK
            }
        } else {
            dir = (*fst < 2) ? 0 : 1;
        }
        ans.push_back((dir == 0) ? fst_c : snd_c);
        *fst += (dir == 0) ? 1 : -1;
        *snd += (dir == 1) ? 1 : -1;
    }
    cout << "Yes" << endl;
    rep(i,n) cout << (char)ans[i] << endl;

    return 0;
}

Measured memory_bytes: 6732
s = input()
l = len(s)
s1 = s[:int((l-1)/2)]
s3 = s[int((l+1)/2):]
s4 = s3[::-1]

m = s[:int((l-1)/2)]
n = len(m)
m1 = m[:int((n)/2)]
m3 = m[int((n+1)/2):]
m4 = m3[::-1]

a = s[int((l+3)/2-1):]
b = len(a)
a1 = a[:int((b-1)/2)]
a3 = a[int((b+1)/2):]
a4 = a3[::-1]


if (s1 in s4) & (m1 in m4) & (a1 in a4):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#import numpy as np
#n = int(input())
x = [int(i) for i in input().split()]
#s = list(input())

a = x[0]
b = x[1]
k = x[2]

if a+k-1 >= b-k+1:
    for i in range(a, b+1):
        print(i)
else:
    for i in range(a, a+k):
        print(i)
    for i in range(b-k+1, b+1):
        print(i)


Measured memory_bytes: 3060
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  int a, b, c, x, y;
  scanf("%d%d%d%d%d", &a, &b, &c, &x, &y);
  int ans;
  if (a+b < 2*c) ans = a*x + b*y;
  else {
    int rest;
    if (x<y) {
      rest = y-x;
      ans = 2*c*x;
      ans += (rest*b < rest*2*c) ? rest*b : rest*2*c;
    } else {
      rest = x-y;
      ans = 2*c*y;
      ans += (rest*a < rest*2*c) ? rest*a : rest*2*c;
    }
  }
  printf("%d\n", ans);
  return 0;
}


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

int main(){
    int s, x, d=2; 
    cin >> s;
    set<int> a;
    a.insert(s);

    while(1) {
        if(s%2==0){
            x = s/2;
            if(a.find(x)!=a.end()) {
                cout << d << endl;
                return 0;
            }
            a.insert(x);
        } else {
            x = 3*s + 1;
            if(a.find(x)!=a.end()) {
                cout << d << endl;
                return 0;
            }
            a.insert(x);
        }
        s = x;
        d++;
    }

    cout << d << endl;

    return 0;
}

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

f = [(1,1), ]

def ncr(n,r,p):
    num = (f[-1][0] * (n-(r-1))) % p
    den = (f[-1][1] * ((r-1) + 1)) % p
    f.append([num, den])
    return (num * pow(den, p-2, p)) % p

n,m,k = (int(x) for x in input().split())
p = 998244353
ans = 0

for i in range(k+1):
    if i == 0:
        ans += m*pow(m-1, n-i-1,p)
    else:
        ans += m*pow(m-1, n-i-1,p) * ncr(n-1,i,p)
    ans = ans % p 
print(ans)


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

const int N = 100010;
int a[N],f[N][2],n;
int main(){
	scanf("%d",&n);
	for(int i =1;i<=n;i++)scanf("%d",a+i); 
	f[1][0]=f[1][1]=1;
	for(int i =2;i<=n;i++){
		if(a[i]>a[i-1]) f[i][0]=min(f[i-1][0],f[i-1][1])+1; else f[i][0]=min(f[i-1][0],f[i-1][1]+1);
		
		if(a[i]<a[i-1]) f[i][1]=min(f[i-1][0],f[i-1][1])+1; else f[i][1]=min(f[i-1][1],f[i-1][0]+1);
		
	}
	cout<<min(f[n][0],f[n][1])<<endl;
	return 0;
}

Measured memory_bytes: 1408
using System;

	public class Class1
	{
		public static void Main()
		{   string question=Console.ReadLine();
		
			int counter=0;
			
			string target=Console.ReadLine();
		    while(target!="END_OF_TEXT")
		    {
		    	bool found=false;
		    	string[] compare=target.Split();
		   
		    	for(int i=0;i<compare.Length;i++)
		    	{
		    		found=compare[i].Equals(question,StringComparison.OrdinalIgnoreCase);
		    		
		    
		    			    
		    
		     if(found)
		    {
		     	counter++;
		    }
		 
		    
		     
		    	}
		    	target=Console.ReadLine();
				
			}
		    Console.WriteLine(counter);
		    
		}
		
	}

Measured memory_bytes: 9040
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <vector>
using namespace std;

#define REP2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define REP(i, n) REP2(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define FOREACH(i, c) for(auto i = (c).begin(); i != (c).end(); ++i)
#define BIT(n, m) (((n) >> (m)) & 1)

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

const ll inf = 1e15;
const ll mod = 1000 * 1000 * 1000 + 7;
const double eps = 1e-9;

template <typename S, typename T> ostream &operator<<(ostream &out, const pair<S, T> &p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}

template <typename T> ostream &operator<<(ostream &out, const vector<T> &v) {
  out << "[";
  REP(i, v.size()){
    if (i > 0) out << ", ";
    out << v[i];
  }
  out << "]";
  return out;
}


inline bool equal(double a, double b){
  return abs(a - b) < eps;
}

int main(){
 // http://tozangezan.hatenablog.com/entry/2015/03/13/235417 ??????????????????
  int W, H, N;
  while (cin >> W >> H >> N && W){
    vector<int> X(2 * N), Y(2 * N);
    REP(i, 2 * N) cin >> X[i] >> Y[i];
    X.push_back(W);
    Y.push_back(0);
    X.push_back(W);
    Y.push_back(H);

    vector<double> Ys1, Ys2;
    REP(i, X.size()) REP(j, i) if (X[i] != X[j]){
      double y = Y[i] - (double)(Y[j] - Y[i]) / (X[j] - X[i]) * X[i];
      if (y < 0 || y > H) continue;
      Ys1.push_back(y);
    }
    Ys1.push_back(0);
    Ys1.push_back(H);
    sort(ALL(Ys1));
    Ys1.erase(unique(ALL(Ys1)), Ys1.end());
    
    double res = 0;
    REP(i, Ys1.size() - 1){
      Ys2.clear();
      
      double y = (Ys1[i + 1] + Ys1[i]) / 2;
      REP(j, 2 * N){
        Ys2.push_back(y + (Y[j] - y) / X[j] * W);
      }
      sort(ALL(Ys2));
      double h = (min((double)H, Ys2[N]) - (max(0.0, Ys2[N - 1])));
      res += (Ys1[i + 1] - Ys1[i]) * max(0.0, h);
    }
    

    printf("%.10lf\n", res / H / H);
  }

  return 0;
}

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

using namespace std;
const int N = 6e5 + 10;
long long a[N],L[N],R[N], n;

int main()
{
    while (cin>>n){
        for (int i=0;i<3*n;++i) cin>>a[i];
        long long sum = 0;
        map<long long,int> M;
        for (int i=0;i<3*n;++i){
            if (i<n){
                sum += a[i];
                M[a[i]]++;
            }
            else{
                long long lowest = M.begin()->first;
                if (a[i] > lowest){
                    sum -= lowest;
                    sum += a[i];
                    M[a[i]]++;
                    if (M[lowest] == 1) M.erase(lowest);
                    else M[lowest]--;
                }
            }
            L[i] = sum;
            if (i>n-1)
            L[i] = max(L[i-1], L[i]);
        }
        M.clear();
        sum = 0;
        for (int i=3*n-1;i>=0;--i){
            if (i>=2*n){
                sum += a[i];
                M[a[i]]++;
            }
            else{
                long long highest = M.rbegin()->first;
                if (a[i] < highest){
                    sum -= highest;
                    sum += a[i];
                    M[a[i]]++;
                    if (M[highest] == 1) M.erase(highest);
                    else M[highest]--;
                }
            }
          //  printf("%d -> sum = %d\n", i, sum);
            R[i] = sum;
            if (i<2*n-1-1)
            R[i] = min(R[i], R[i+1]);
        }
       // for (int i=0;i<3*n;++i) printf("%6d ", i); puts("");
       // for (int i=0;i<3*n;++i) printf("%6lld ", L[i]); puts("");
       // for (int i=0;i<3*n;++i) printf("%6lld ", R[i]); puts("");
       // puts("====================");

        long long ans = L[n-1] - R[2*n];
        for (int i=n-1;i<2*n;++i){
           // cout<<L[i]-R[i+1]<<endl;
            ans = max(ans, L[i]-R[i+1]);
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 18816
(let* ((lst (list (read) (read) (read)))
       (lst2 (remove-duplicates
               (loop for i in lst
                     collect (cons i (count i lst)))
               :test #'equal)))

  (format t "~A~%"
          (if 
            (or
              (equal lst2 '((5 . 2) (7 . 1)))
              (equal lst2 '((7 . 1) (5 . 2))))
            'yes 'no)))


Measured memory_bytes: 10464
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h> 
using namespace std;

typedef long long ll;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0) 
#define rep(pp,nn) for (int ii = pp; ii < nn; ++ii)
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
#define endl "\n"

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

string int_to_string(int x) {
    stringstream ss;
	ss << x;
	string ni = ss.str();
	return ni;
}
int string_to_int(string x) {
	int n;
	stringstream s(x);
	s >> n;
	return n;
}

int64_t power_mod(ll a, ll b, ll mo) {
	ll ans = 1;
	while (b) {
		if(b & 1) {
			ans = (ans % mo * a % mo) % mo;
		}
		a = (a % mo * a % mo) % mo;
		b /= 2;
	}
	return ans;
}
int64_t POW(ll a, ll b) {
	ll ans = 1;
	while (b) {
		if(b & 1) {
			ans = ans * a;
		}
		a = a * a;
		b /= 2;
	}
	return ans;
}

vector<int64_t> INVERSE(int64_t nn, int64_t mo) {
	vector<int64_t> inv(nn + 1);
	vector<int64_t> mul(nn + 1);
	inv[0] = 1;
    inv[1] = 1;
	for (ll i = 2; i <= nn; ++i) {
		inv[i] = (mo - (mo / i) * inv[mo % i] % mo) % mo; 
	}
	mul[0] = 1;
	for (int i = 1; i <= nn; ++i) {
		mul[i] = (mul[i - 1] * inv[i]) % mo;
	}
	return mul;
}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

vector<int64_t> fact(2001);
vector<int64_t> inv(2001);
int mod = 1e9 + 7;

int64_t C(int64_t n, int64_t k) {
	if (k > n) {
		return 0;
	}
	return (fact[n] % mod * inv[k] % mod * inv[n - k] % mod) % mod;
}

int main() {
	IOS;
	int n, k;
	cin >> n >> k;
	int z = 2000;
	fact[0] = 1;
	for (int i = 1; i <= z; ++i) {
		fact[i] = (fact[i - 1] * i * 1LL) % mod;
	}
	inv = INVERSE(z, mod);
	int64_t R = n - k;
	int64_t B = k;
	for (int i = 1; i <= k; ++i) {
		 cout << (C(R + 1, i) % mod * C(B - 1, i - 1) % mod) % mod << endl;
	}
}















Measured memory_bytes: 3696
#include<iostream>
using namespace std;
int main()
{
	int d;
	cin>>d;
	if(d==25){
		cout<<"Christmas"<<endl;
	}
	if(d==24){
		cout<<"Christmas Eve"<<endl;
	}
	if(d==23){
		cout<<"Christmas Eve Eve"<<endl;
	}
	if(d==22){
		cout<<"Christmas Eve Eve Eve"<<endl;
	}
	return 0;
 } 

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

int main() {
  string O, E;
  cin >> O >> E;
  vector<string> T = { O, E };

  for (int i = 0; i < O.size() + E.size(); i++) cout << T[i % 2][i / 2];
  puts("");
  return 0;
}

Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto A = aryread!ulong();
    ulong ans;
    long[62][2] cnt;
    foreach (ulong i; 0 .. 61)
    {
        foreach (j; 0 .. N)
        {
            cnt[(A[j] & (1UL << i)) != 0][i]++;
        }
    }
    foreach (ulong i; 0 .. 61)
    {
        foreach (j; 0 .. N)
        {
            ans += ((1UL << i) % MOD) * cnt[(A[j] & (1UL << i)) == 0][i];
            ans %= MOD;
        }
    }
    writeln(ans * invmod!ulong(2) % MOD);
}

// x^^n % m
T powmod(T = long)(T x, T n, T m = 10 ^^ 9 + 7)
{
    if (n < 1)
        return 1;
    if (n & 1)
    {
        return x * powmod(x, n - 1, m) % m;
    }
    T tmp = powmod(x, n / 2, m);
    return tmp * tmp % m;
}

T invmod(T = long)(T x, T m = 10 ^^ 9 + 7)
{
    return powmod(x, m - 2, m);
}


Measured memory_bytes: 19268
import java.io.*;
import java.util.StringTokenizer;


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        char [] s = sc.next().toCharArray();
        for (char c :s )
            out.print("x");
        out.flush();
        out.close();
    }


    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        boolean ready() throws IOException {
            return br.ready();
        }


        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

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

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

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }


        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 2e5+7;
const int N = 1e8+7;
const int INF = 1000000009;
const int MOD = 1000000009;
const double eps = 1e-2;
#define pb push_back
ll po(ll x, ll y) {
    if (y == 0) {
      return 1;
    }
      ll sq = po(x, y / 2);
      sq *= sq;
      sq = sq%MOD;
      if (y % 2 != 0) {
        sq *= x;
        sq = sq%MOD;
      }
      return sq;
}
int a[MAX], pre[MAX];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    char x;
    cin >> x;
    char y = tolower(x);
    if(x == y){
        cout << 'a' << endl;;
    }
    else{
        cout << 'A' << endl;
    }
}

/*
1
4 2
0000


*/


Measured memory_bytes: 3560
K = int(input())

table_gcd = [[0 for i in range(K)] for j in range(K)]
table_num = [0 for i in range(K)]

def gcd(a, b) :
  if(a < b) :
    return gcd(b, a)
  else :
    if(b == 0) :
      return a
    else :
      return gcd(b, a%b)

for a in range(0, K) :
  for b in range(0, a+1) :
    if(a == b) :
      table_gcd[a][b] = a+1
      table_gcd[b][a] = a+1
      table_num[a] += 1
    else :
      cd = gcd(a+1, b+1)
      table_gcd[a][b] = cd
      table_gcd[b][a] = cd
      table_num[cd-1] += 2
    
ans = 0
for c in range(0, K) :
  for cd in range(0, K) :
    ans += table_num[cd] * table_gcd[c][cd]
  
print(ans)

Measured memory_bytes: 9520
n, y = list(map(int, input().split()))

for i in range(n+1):
    for j in range(n+1):
        k = n-i-j
        if k>=0 and y == i*10000+j*5000+k*1000:
            print(i, j, k)
            exit()
print(-1, -1, -1)

Measured memory_bytes: 9140
fn main() {
    let mut reader = acio::Reader::new();
    let n = reader.read::<i32>();
    let nd = n - 1;
    let l = reader.read::<i32>();
    let total = if 0 < l {
        ((l + 1) * nd) + (nd * (nd - 1) / 2)
    } else if 0 < n + l {
        (l * n) + (n * (n - 1) / 2)
    } else {
        (l * nd) + (nd * (nd - 1) / 2)
    };
    println!("{}", total);
}

/// IO Module for AtCoder
#[allow(dead_code)]
mod acio {
    use std::fmt::Debug;
    use std::io::{stdin, Stdin};
    use std::str::FromStr;

    pub struct Reader {
        input: Stdin,
        stack: Vec<String>,
    }

    impl Reader {
        pub fn new() -> Self {
            Reader {
                input: stdin(),
                stack: vec![],
            }
        }

        pub fn read_by<F>(&mut self, count: usize) -> Vec<F>
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            let mut v = vec![];
            for _ in 0..count {
                v.push(self.read());
            }
            return v;
        }

        pub fn read<F>(&mut self) -> F
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            if self.stack.is_empty() {
                let mut line = self.read_line();
                self.stack.append(&mut line);
                self.stack.reverse();
            }
            self.stack.pop().unwrap().parse().unwrap()
        }

        fn read_line(&mut self) -> Vec<String> {
            let mut buf = String::new();
            self.input.read_line(&mut buf).unwrap();
            buf.split_whitespace().map(|s| s.to_string()).collect()
        }
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

int main(){
  int n;cin>>n;
  string a;
  cin>>a;
  rep(i,a.size()){
    if((a[i]+n)>'Z'){
      cout<<(char)('A'+(a[i]+n-'Z'-1));
    }
    else{
      cout<<(char)(a[i]+n);
      
    }
  }
  cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define float long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define endl '\n'
#define pii pair<int, int>
#define min3(a,b,c) min(a, min(b, c))
#define max3(a,b,c) max(a, max(b, c))
#define all(x) x.begin(), x.end()
#define fill(a,b) memset(a, b, sizeof(a))
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

signed main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int x,n; cin>>x>>n;
    set<int> s; s.insert(x);
    for(int i=1;i<105;i++){
        s.insert(x+i);
        s.insert(x-i);
    }
    for(int i=0;i<n;i++){
        int y; cin>>y;
        if(s.find(y)!=s.end()) s.erase(y);
    }
    int ans=0,ans1=105;
    for(int it : s){
        if(abs(it-x)<ans1){
            ans1=abs(it-x);
            ans=it;
        }
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 3620
#include <stdio.h>
int main()
{
    int  a,b,c,i,j,k;
    //char ch,ch1;
    scanf("%d %d %d",&a, &b, &c);
    if(a==c) printf("YES\n");
    else if(c>a && b>=(c-a)) printf("YES\n");
    else printf("NO\n");
    return 0;
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
  string str;
  getline(cin ,str);
  for(int i = 0; i < (int)str.size(); i++){
	  if (str[i] >= 'a' && str[i] <= 'z') str[i] += 'A' - 'a';
	  else if (str[i] >= 'A' && str[i] <= 'Z') str[i] += 'a'- 'A'; 
	}
  cout << str << endl;
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



Measured memory_bytes: 3208
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MS2020A
{
    class Program
    {
        static void Main(string[] args)
        {
            int X = int.Parse(Console.ReadLine());
            X /= 200;
            Console.WriteLine(10 - X);
        }
    }
}


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

int main() {
  int n, i, k = 0, even = 0;
  cin >> n;
  vector<int> a(n);
  map<int, int> mp;
  for (i = 0; i < n; ++i) {
    cin >> a[i];
    ++mp[a[i]];
  }
  for (auto p : mp) {
    ++k;
    if (p.second % 2 == 0) {
      ++even;
    }
  }
  if (even % 2 == 1) {
    --k;
  }
  cout << k << "\n";
  return 0;
}

Measured memory_bytes: 5376
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextLong();
        }
        for (int i = k; i < n; i++) {
            if (a[i] > a[i - k]) {
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
        }
    }


    private static int nextInt(Scanner scanner) {
        return Integer.parseInt(scanner.next());
    }

    private static long nextLong(Scanner scanner) {
        return Long.parseLong(scanner.next());
    }

    private static float nextFloat(Scanner scanner) {
        return Float.parseFloat(scanner.next());
    }

    private static double nextDouble(Scanner scanner) {
        return Double.parseDouble(scanner.next());
    }


}









Measured memory_bytes: 61220
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>

using namespace std;

int main(){
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    int right,left;
    if(A>C) left=A;
    else left=C;
    if(B>D)right=D;
    else right=B;
    int ans=right-left;
    if(ans<0)ans=0; 
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
###A - Still TBD
import datetime

y,m,d = map(int, input().split('/'))
if y<2019:
    print('Heisei')
elif y>2019:
    print('TBD')
else:
    if m<4:
        print('Heisei')
    elif m>4:
        print('TBD')
    else:
        if d<=30:
            print('Heisei')
        else:
            print('TBD')

Measured memory_bytes: 3312
s=set(list(input()))
if "S" in s:
    if not "N" in s:
        print("No")
        exit()
if "N" in s:
    if not "S" in s:
        print("No")
        exit()
if "E" in s:
    if not "W" in s:
        print("No")
        exit()
if "W" in s:
    if not "E" in s:
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(x) scanf("%d", &x)
#define sc(x) scanf("%c", &x)
#define sl(x) scanf("%lld", &x)
#define pl(x) printf("%lld\n", x)
#define pi(x) printf("%d\n", x)
#define pii pair <int, int>
#define pll pair <long long, long long>
#define gu getchar_unlocked
#define pu putchar_unlocked
#define setbits __builtin_popcountll
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define speed ios::sync_with_stdio(false)

const int N = 100005;

int hasharr[N];

int main(){
    int n, k, q;
    cin>>n>>k>>q;
    for(int i = 1; i <= q; i++){
        int x;
        cin>>x;
        hasharr[x]++;
    }
    for(int i = 1; i <= n; i++){
        int points = q - hasharr[i];
        if(k - points > 0){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
typedef long long ll;
using namespace std;
int main(void){
    int k,n;cin>>k>>n;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    int maxi=0;
    rep(i,n){
        if(i==n-1)maxi=max(maxi,a[0]-a[i]+k);
        else maxi=max(maxi,a[(i+1)%n]-a[i]);
        //cout<<a[(i+1)%n]-a[i]<<endl;
    }
    int res=k-maxi;
    cout<<res<<endl;
}


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

vector<bool> solve(int n, vector<bool> &s)
{
	for(int i = 0; i < 2; i++)
    {
    	for(int j = 0; j < 2; j++)
        {
        	vector<bool> res(n);
          	res[0] = i;
          	res[1] = j;
          	for(int k = 2; k < n; k++)
            	res[k] = (res[k - 2] ^ res[k - 1] ^ s[k - 1]);
          	if (s[n - 1] == (res[n - 2] ^ res[n - 1] ^ res[0]) &&
                    s[0] == (res[n - 1] ^ res[0] ^ res[1]))
                return res;
        }      
    }
  	return vector<bool>();
}

int main()
{
  	int n;
  	cin>>n;
  	vector<bool> v(n);
  	for(int i = 0; i < n; i++)
    {
    	char c;
      	cin>>c;
      	v[i] = (c == 'o');
    }
  	vector<bool> res = solve(n, v);
  	if(res.empty())
      	cout <<-1<<"\n";
  	else
    {
    	for (bool p : res) 
          cout << (p ? 'S' : 'W');
        cout << "\n";
    }
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n, b, e, q;
    cin >> n;
    vector<int> vec(n);
    for (int i = 0; i < n; i++)
        cin >> vec[i];
    cin >> q;
    while (q--) {
        cin >> b >> e;
        vector<int>::iterator itbe, iten;
        itbe = begin(vec) + b;
        iten = begin(vec) + e;
        reverse(itbe, iten);
    }
    for (int i = 0; i < n; i++) {
        if (i == n - 1)
            cout << vec[i] << endl;
        else cout << vec[i] << " ";
    }
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define N (long long)(1e9 + 7)
#define MAX 500000

long long factorial[MAX] = {0}, finverse[MAX] = {0},
          inverse[MAX] = {0};

void smodfact() {
  factorial[0] = factorial[1] = 1;
  finverse[0] = finverse[1] = 1;
  inverse[1] = 1;
  for(int i = 2; i < MAX; ++i) {
    factorial[i] = factorial[i - 1] * i % N;
    inverse[i] = N - (inverse[N % i] * (N / i)) % N;
    finverse[i] = finverse[i - 1] * inverse[i] % N;
  }
}

long long calccomb(long long n, long long k) {
  if(n == k && n == 0) return 1;
  if(n < 0 || k < 0 || n < k) return 0;
  return factorial[n] * finverse[k] % N * finverse[n - k] %
         N;
}

long long n, k;
vector<long long> ans;

void solve();

int main() {
  smodfact();
  cin >> n >> k;
  ans.resize(k);
  solve();
  if(n==k)ans[0]=1;
  for(int i = 0; i < k; ++i) cout << ans[i] << endl;
  return 0;
}

void solve() {
  for(long long i = 0; i < k; ++i) {
    long long r = 0, b = 0, now = i + 1;
    b = calccomb(k - 1, now - 1);
    b %= N;
    r += calccomb(n - k - 1, now - 2);
    r %= N;
    r += calccomb(n - k - 1, now - 1) * 2 % N;
    r %= N;
    r += calccomb(n - k - 1, now);
    r %= N;
    ans[i] = r * b % N;
  }
}


Measured memory_bytes: 12032
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, k, a[200009];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = k; i < n; i++) {
		if (a[i] > a[i - k]) cout << "Yes\n";
		else cout << "No\n";
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 4432
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef set<ii> sii;
typedef set<int> si;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;

const int INF = 1000000000;
const ll MOD = 1000000007;

int main() {FIN
	
	vi pk(3);
	cin >> pk[0] >> pk[1] >> pk[2];
	sort(pk.rbegin(), pk.rend());
	if (pk[0] == pk[1]+pk[2])
		cout << "Yes\n";
	else
		cout << "No\n";
	
	return 0;
}


Measured memory_bytes: 3660