akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();

		if(n == m) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define int long long
//template
//main
signed main(){
  int N,K;cin>>N>>K;
  std::vector<int> h(10000000),dp(10000000,1e12);
  for(int i=0;i<N;i++)cin>>h[i];
  dp[0]=0;
  for(int i=0;i<N;i++)
    for(int j=1;j<=K;j++)
      dp[i+j]=min(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
  cout<<dp[N-1]<<endl;
}


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

int main() {
  int n,k;
  cin >> n >> k;
  vector<ll>a(n);
  rep(i,0,n) cin >> a[i];
  rep(i,0,k){
    vector<ll>imos(n,0);
    rep(j,0,n){
      if(j-a[j] >= 0) imos[j-a[j]]++;
      else imos[0]++;
      if(j+a[j]+1 < n) imos[j+a[j]+1]--;
    }
    a[0] = imos[0];
    int c = 0;
    if(a[0] == n) c++;
    rep(j,1,n){
      a[j] = a[j-1]+imos[j];
      if(a[j] == n) c++;
    }
    if(c == n) break;
  }
  rep(i,0,n){
    cout << a[i];
    if(i != n-1) cout << " ";
    else cout << "" << endl;
  }
}

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  string sd, t;
  cin >> sd >> t;
  string res(sd);
  bool hit = false;
  for (int i = sd.size() - t.size(); i >= 0; i--) {
    bool ok = true;
    for (int j = 0; j < t.size(); j++) {
      if (sd.at(i + j) != t.at(j) && sd.at(i + j) != '?') {
        ok = false;
        break;
      }
    }
    if (ok) {
      for (int j = 0; j < t.size(); j++) {
        res.at(i + j) = t.at(j);
      }
      hit = true;
      break;
    }
  }
  if (hit) {
    // 残りの ? はすべて a に置換
    replace(res.begin(), res.end(), '?', 'a');
    cout << res << endl;
  } else {
    cout << "UNRESTORABLE" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<sstream>
#include<algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define pb         push_back

const int N = 10000001;

class f{
public:
  int a,b,c,d;
};

bool a[N];
bool b[N];
vector<int> pr;
//99982249
void generate(){
  for(int i=0;i<N;i+=2)a[i]=false,b[i]=false;
  for(int i=1;i<N;i+=2)a[i]=true,b[i]=false;
  a[1]=false;
  for(int i=3;i*i <= N;i+=2){
    if (a[i])for(int j=2*i;j<N;j+=i)a[j]=false;
  }
  
  for(int i=3;i+8 < N;i+=2){
    if (a[i] && a[i+2]&&a[i+6] && a[i+8]){
      b[i+8]=true;
    }
  }
  for(int i=3;i<N;i+=2)if (b[i])pr.pb(i);
}

main(){
  generate();
  int n;
  while(cin>>n && n){
    int ans ;
    rep(i,pr.size()){
      if (pr[i] > n)break;
      ans=pr[i];
    }
    cout <<  ans << endl;
  }
}

Measured memory_bytes: 19000
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}


use input::*;

use std::cmp::Ordering;
use std::collections::BinaryHeap;

#[derive(Eq, PartialEq, Clone)]
struct Pair {
    time: usize,
    cost: usize,
}

impl Ord for Pair {
    fn cmp(&self, other: &Self) -> Ordering {
        if self.time == other.time {
            self.cost.cmp(&other.cost)
        } else {
            other.time.cmp(&self.time)
        }
    }
}

impl PartialOrd for Pair {
    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
        Some(self.cmp(other))
    }
}

fn main() {
    let (n, m): (usize, usize);
    input!(n, m);
    let mut v = Vec::new();
    let mut heap = BinaryHeap::new();
    for _ in 0..n {
        let (a, b): (usize, usize);
        input!(a, b);
        v.push(Pair { time: a, cost: b });
    }
    v.sort();
    v.reverse();

    let mut i = 0;
    let mut cost = 0;
    for d in (0..m + 1).rev() {
        let remain = m - d;
        if i < v.len() {
            while v[i].time <= remain {
                heap.push(v[i].cost);
                i += 1;
                if i>=v.len(){
                    break;
                }
            }
        }
        if heap.is_empty() {
            continue;
        } else {
            let w = heap.pop().unwrap();
            cost += w;
        }
    }
    p(cost);
}

Measured memory_bytes: 8444
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#define N 110000
#define maxd 18
using namespace std;
struct node{int y,nex;}a[2*N];
struct node1{int dep,par[20];}t[N];
int n,m,fir[N],fa[N],len,q[N][2],ql,f[N];
bool b[N];
void ins(int x,int y)
{
	a[++len].y=y;a[len].nex=fir[x];fir[x]=len;
}
int find(int x)
{
	if(x!=fa[x]) fa[x]=find(fa[x]);
	return fa[x];
}
void dfs(int x,int fa)
{
	t[x].dep=t[fa].dep+1;
	t[x].par[0]=fa;for(int i=1;i<=maxd;i++) t[x].par[i]=t[t[x].par[i-1]].par[i-1];
	for(int k=fir[x];k;k=a[k].nex)
	{
		int y=a[k].y;
		if(y==fa) continue;
		dfs(y,x);
	}
}
int lca(int x,int y)
{
	if(t[x].dep<t[y].dep) swap(x,y);
	for(int i=maxd;i>=0;i--) if(t[t[x].par[i]].dep>=t[y].dep) x=t[x].par[i];
	if(x==y) return x;
	for(int i=maxd;i>=0;i--) if(t[x].par[i]!=t[y].par[i]) x=t[x].par[i],y=t[y].par[i];
	return t[x].par[0];
}
void dp(int x,int fa)
{
	for(int k=fir[x];k;k=a[k].nex)
	{
		int y=a[k].y;
		if(y==fa) continue;
		dp(y,x);
		f[x]+=f[y];
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) fa[i]=i;
	for(int i=1;i<=m;i++)
	{
		int x,y,fx,fy;scanf("%d%d",&x,&y);
		fx=find(x);fy=find(y);
		if(fx!=fy) fa[fx]=fy,ins(x,y),ins(y,x);
		else q[++ql][0]=x,q[ql][1]=y;
	}
	for(int i=1;i<=n;i++) if(find(i)==i) dfs(i,0);
	for(int i=1;i<=ql;i++)
	{
		int x=q[i][0],y=q[i][1],u=lca(x,y);
		f[x]++;f[y]++;f[u]-=2;
	}
	for(int i=1;i<=n;i++) if(find(i)==i) dp(i,0);
	for(int i=1;i<=n;i++) if(find(i)!=i && f[i]%2==0) {printf("NO\n");return 0;}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 11904
#include <bits/stdc++.h>
//#include <atcoder/all>

using namespace std;
//using namespace atcoder;
 
#ifdef DEBUG
    #include "debug.h"
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define dump(...)
#endif

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

#define int long long
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

//*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)


void solve(){
    int N;
    cin >> N;
    int streak = 0;
    while(N--){
        int a, b;
        cin >> a >> b;
        if(a==b) streak++;
        else streak = 0;
        if(streak>=3){ Yes; return;}
    }
    No;
}


signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed;
    solve();
}


Measured memory_bytes: 3628
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <typeinfo>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define vi vector<int>
#define pb push_back

const int INF = 100000001;

int n;
int N[101010] = {};
vi a;

int main(){
    cin >> n;
    REP(i,n){
        int in;
        cin >> in;
        a.pb(in);
    }
    REP(i,n){
        N[a[i]]++;
        N[a[i]+1]++;
        if(a[i] != 0) N[a[i]-1]++;
    }

    int mx_v=-1;
    int mx = -1;
    REP(i,101010){
       if(N[i] > mx_v){
           mx_v = N[i];
           mx = i;
       }
    }
    cout << mx_v << endl;
}


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

using namespace std;
int main()
{
    int c=0;
    string s,t;
    cin>>s;
    cin>>t;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
            c++;
    }
    cout<<c;
   return 0;
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const double eps = 1e-9;

/*{
  }*/
template<int M>
class Combination
{
  public:
    int n;
    vector<int> fac, finv;

    Combination(int n_) : n(n_), fac(n_), finv(n_)
  {
    fac[0] = 1;
    for(int i = 1; i < n; i++) fac[i] = fac[i-1]*i%M;
    finv[n-1] = pow(fac[n-1], M-2);
    for(int i = n-1; i > 0; i--) finv[i-1] = finv[i]*i%M;
  }

    int pow(int a, int b)
    {
      if(b == 0) return 1; 
      return pow(a*a%M, b/2)*(b%2?a:1)%M;
    }

    int C(int a, int b)
    {
      if(b < 0 or a < b) return 0;
      return fac[a]*finv[a-b]%M*finv[b]%M;
    }

    int P(int a, int b)
    {
      if(b < 0 or a < b) return 0;
      return fac[a]*finv[a-b]%M; 
    }

    int H(int a, int b){
      if(a == 0 and b == 0) return 1;
      return C(a+b-1, b);
    }
};

signed main(){
  Combination<mod> comb(1000000);

  int x, y;
  cin >> x >> y;
  if(x < y) swap(x, y);

  if((x+y)%3 or (x*2 < y) or (x > y*2)){
    cout << 0 << endl;
    return 0;
  }

  int x2 = (x+y)/3, y2 = x-y;
  if(x2 < y2) swap(x2, y2);
  int x3 = (x2+y2)/2, y3 = (x2-y2)/2;

  int ans = 1;
  (ans *= comb.fac[x3+y3]) %= mod;
  (ans *= comb.finv[x3]) %= mod;
  (ans *= comb.finv[y3]) %= mod;

  cout << ans << endl;


  return 0;
}




Measured memory_bytes: 15872
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	long long n, b, c = 0, e;
	cin >> n;
	long long a[123456];
	long long uiop[5] = { 0 };
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	for (int h = 0; h < n - 1; h++) {
		if (a[h] == a[h + 1]) {
			uiop[c] = a[h];
			c++;
			h++;
		}
		if (c == 3) {
			uiop[0] = uiop[1];
			uiop[1] = uiop[2];
			c--;
		}
	}
	cout << uiop[0] * uiop[1] << endl;
	cin >> e;
}

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

using namespace std;

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    string path;
    path += string(tx - sx, 'R');
    path += string(ty - sy, 'U');
    path += string(tx - sx, 'L');
    path += string(ty - sy, 'D');
    path += "L";
    path += string(ty - sy + 1, 'U');
    path += string(tx - sx + 1, 'R');
    path += "DR";
    path += string(ty - sy + 1, 'D');
    path += string(tx - sx + 1, 'L');
    path += "U";
    cout << path;
    return 0;
}


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

using namespace std;

int main(){
    int a,b;cin >> a >> b;
    for(int i = 1;i <= 3;i++){
        if((a*b*i)%2==1){
            cout << "Yes" << endl;
            break;
        }
        if(i==3)cout << "No" << endl;
    }
}

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


#define ll long long int 
#define all(v) v.begin(),v.end()
#define MOD 1000000007
#define PB push_back
#define F first
#define S second


int main(){
     
     ll n; cin>>n;
     vector< ll > v(n);
     for(auto &i:v)  cin>>i;

     ll cnt=0;
     if(n<3) return cout<<0<<endl,0;
     sort(all(v));

     for(int i=0;i<n-2;i++){

        for(int j=i+1;j<n-1;j++){
        
            if(v[i]==v[j]) continue;
        
            for(int k=j+1;k<n;k++){
                if(v[k]==v[j]) continue;
                if(v[k]>abs(v[i]-v[j]) && v[k]<(v[i]+v[j])) cnt++;
            }
        }
     }

     cout<<cnt<<endl;

    return 0;
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	if (v.size()) {
		os << v[0];
		for (int i = 1; i < v.size(); i++) os << " " << v[i];
	}
	return (os);
}

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

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int N; cin >> N;
	vll A(N); cin >> A;
	vector<Pl> ans;
	sort(rbegin(A), rend(A));

	int plus = 0;
	for (int i = 0; i < N; i++) {
		if (A[i] > 0) plus++;
	}
	
	if (plus <= 1) {
		ll val = A[0];
		for (int i = 1; i < N; i++) {
			ans.emplace_back(val, A[i]);
			val = val - A[i];
		}
		cout << val << endl;
		for (auto &an : ans) {
			cout << an.first << " " << an.second << el;
		}
		return;
	}
	
	ll val = A[N-1];

	int num = min(N-2, plus-1);
	for (int i = 0; i < num; i++) {
		ans.emplace_back(val, A[i]);
		val = val - A[i];
	}
	ans.emplace_back(A[num], val);
	val = A[num] - val;
	for (int i = num+1; i < N-1; i++) {
		ans.emplace_back(val, A[i]);
		val = val - A[i];
	}
	cout << val << endl;
	for (auto &an : ans) {
		cout << an.first << " " << an.second << el;
	}
}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 6116
#include<iostream>
using namespace std;
int main() {
    int n, a, s[200002] = {0}, x[200002] = {0};
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a;
        s[i] = s[i-1] + a;
        x[i] = x[i-1] ^ a;
    }
    long long res = 0;
    int j = 1;
    for (int i = 1; i <= n; i++) {
        for (; s[i] - s[j-1] != (x[i] ^ x[j-1]); j++);
        res += i - j + 1;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1792
#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 = 1e9 + 7;

int n;

long long quickpow(long long b, long long e)
{
	return e ? ((e & 1 ? b : 1)*quickpow(((b%MOD)*(b%MOD)) % MOD, e >> 1)) % MOD : 1;
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	long long ans = quickpow(10, n);
	long long tmp = quickpow(9, n);
	ans -= tmp;
	if (ans < 0) ans += MOD;
	ans -= tmp;
	if (ans < 0) ans += MOD;
	tmp = quickpow(8, n);
	ans += tmp;
	ans %= MOD;
	cout << ans << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 3480
#include<bits/stdc++.h>
using namespace std;
using T = tuple<string, int, int>;

bool cmp(T x, T y){
        if(get<0>(x) < get<0>(y)) return true;
        else if(get<0>(x) > get<0>(y)) return false;
        return get<1>(x) > get<1>(y);
}

int main(){
        int n; scanf("%d", &n);
        vector<T> sp(n);
        for(int i=0; i<n; i++){
                cin >> get<0>(sp[i]) >> get<1>(sp[i]);
                get<2>(sp[i]) = i+1;
        }
        sort(sp.begin(), sp.end(), cmp);
        //for(int i=0; i<n; i++) cout << get<0>(sp[i]) <<" "<< get<1>(sp[i]) << endl;
        for(int i=0; i<n; i++) printf("%d\n", get<2>(sp[i]));
        return 0;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)

function main()
  n = readline() |> parseInt

  ans=0
  m=floor(Int,sqrt(n))
  for i in m:-1:1
    if n%i==0
      ans=i-1+n÷i-1
      break
    end
  end

  println(ans)
end

main()


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;
using vll = vector<ll>;
using vld = vector<ld>;
using vpl = vector<pll>;
using vvll = vector<vll>;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(ll i=0;i<((ll)n);i++)
#define REP1(i,n) for(ll i=1;i<((ll)n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

    ll n;
    cin >> n;
    vpl edge(n);
    REP(i, n - 1) {
        ll u, v;
        cin >> u >> v;
        u--;
        v--;
        if (u > v)
            swap(u, v);
        edge[i].FI=u;
        edge[i].SE=v;
    }

    //�����W��S�̘A����=���_��-�Ӑ�
    //���_
    ll vertex= 0;
    REP(i, n) {
		ll l = i + 1;
		ll r = n - i;
        vertex+= l * r;
    }


    //��
    ll e = 0;
    REP(i, n - 1) {
        ll u = edge[i].FI;
		ll v = edge[i].SE;
		ll l = u + 1;
		ll r = n - v;

		e += l * r;
	}

    ll ans = vertex - e;
    cout << ans << endl;
}




Measured memory_bytes: 6344
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int dp[200005];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	rrep(i, k + 1) {
		for (int j : a) {
			if (i - j >= 0) dp[i] = dp[i] or !dp[i - j];
		}
	}
	if (dp[k])  cout << "First" << endl;
	else cout << "Second" << endl;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
using namespace std;

const int MAXN = 2005;
int ans = 1e9, n;
deque<bool> a, b;
deque<int> dpr, dpl;
string tmp;

void prpdp() {
	dpr.clear();
	dpl.clear();
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++)
			if (b[(i + j) % n]) {
				dpr.push_back(j);
				break;
			}
		for (int j = 0; j < n; j++)
			if (b[(i - j + n) % n]) {
				dpl.push_back(j);
				break;
			}
	}
}
void shift() {
	int e = a.front(), w = dpr.front(), z = dpl.front();
	a.pop_front(), dpr.pop_front(), dpl.pop_front();
	a.push_back(e), dpr.push_back(w), dpl.push_back(z);
}
void shiftr() {
	int e = a.back(), w = dpr.back(), z = dpl.back();
	a.pop_back(), dpr.pop_back(), dpl.pop_back();
	a.push_front(e), dpr.push_front(w), dpl.push_front(z);
}
void solve() {
	prpdp();
	for (int x = 0; x <= n; x++) {
		int ne = 0;
		for (int i = 0; i < n; i++)
			ne += a[i] != b[i];
		vector<pair<int, int> > rf;
		int R = x, L = 0;
		for (int i = 0; i < n; i++) {
			if (dpl[i] - x > 0 && a[i] != b[i])
				rf.push_back({ dpr[i] + x, i });
		}
		sort(rf.begin(), rf.end());
		reverse(rf.begin(), rf.end());
		for (int i = 0; i < rf.size(); i++) {
			R = rf[i].first;
			ans = min(ans, min(n, (R + L)) * 2 - x + ne);
			L = max(L, dpl[rf[i].second] - x);
		}
		ans = min(ans, min(n, (R + L)) * 2 - x + ne);
		ans = min(ans, n + x + ne);
		shift();
	}
	shiftr();
}
void todeq(string &a, deque<bool> &b) {
	for (int i = 0; i < a.size(); i++)
		b.push_back(a[i] - '0');
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> tmp;
	todeq(tmp, a);
	cin >> tmp;
	todeq(tmp, b);
	n = a.size();
	if (a == b)
		return cout << 0, 0;
	int c = 0, d = 0;
	for (int i = 0; i < b.size(); i++)
		c += b[i];
	for (int i = 0; i < a.size(); i++)
		d += a[i];
	if (c == 0 && d != c)
		return cout << -1, 0;
	solve();
	reverse(a.begin(), a.end());
	reverse(b.begin(), b.end());
	solve();
	if (ans == 1e9)
		return cout << -1, 0;
	cout << ans;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr long long LLINF = 1LL << 62;
constexpr double EPS = 1e-9;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
  }
} initializer;

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

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &pa) {
  return os << "(" << pa.first << ", " << pa.second << ")";
}

template<typename Tuple, size_t N>
struct TuplePrinter {
  static void print(const Tuple &t) {
    TuplePrinter<Tuple, N-1>::print(t);
    cout << ", " << get<N-1>(t);
  }
};

template<typename Tuple>
struct TuplePrinter<Tuple, 1> {
  static void print(const Tuple &t) {
    cout << get<0>(t);
  }
};

template<typename... T>
ostream &operator<<(ostream &os, const tuple<T...> &tup) {
  os << "(";
  TuplePrinter<decltype(tup), sizeof...(T)>::print(tup);
  return os << ")";
}

template<typename T>
ostream &operator<<(ostream &os, const set<T> &se) {
  os << "{";
  for (auto it = se.begin(); it != se.end(); ++it) {
    if (it != se.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &ma) {
  os << "{";
  for (auto it = ma.begin(); it != ma.end(); ++it) {
    if (it != ma.begin()) os << ", ";
    os << it->first << ": " << it->second;
  }
  return os << "}";
}

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }
#define dump(...) cout<<#__VA_ARGS__<<": [L_"<<__LINE__<<"]"<<'\n'; print(__VA_ARGS__);cout<<'\n';

template<class T, class U>inline bool chmax(T &a, const U &b) { if(a<b){ a=b; return 1; } return 0; }
template<class T, class U>inline bool chmin(T &a, const U &b) { if(b<a){ a=b; return 1; } return 0; }


int main() {
  long long a, b, c; cin>>a>>b>>c;
  long long l = 4 * a * b;
  long long r = (c - a - b) * (c - a - b);
  if (a >=c || b >= c) {
    puts("No");
    return 0;
  }
  if (l < r) puts("Yes");
  else puts("No");

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define all int i=0; i<n; i++
#define INF 9999999999999999
using namespace std;
typedef long long int ll; 
#define int ll    

int32_t main(){
	int n,k;
	cin>>n>>k;
	int h[n];
	for(all)cin>>h[i];
	sort(h, h+n, greater<int>());
	for(int i=0; i<min(n,k); i++){
		h[i] = 0;
	}
	int ans = 0;
	for(all)ans+=h[i];
	cout<<ans<<endl;
}

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

int main() {
  string s,t;
  cin >> s >> t;
  string ans = "Yes";
  rep(i,s.length()){
    if(s[i]!=t[i])ans="No";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
//
// Created by yuu on 2019-06-22.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>

using namespace std;

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

    return gcd(a, a % b);
}

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


long long c_lcm(long a, long b){
    long long x = a *b;
    long long tmp, r;
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }

    /* ユークリッドの互除法 */
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }

    return x/b;
}

int main(void){
    long long A,B;
    long C,D;

    cin>>A>>B>>C>>D;

    long cc = (B / C) - ((A-1) /C);
    long dd = (long)(B / D) - (long)((A-1) /D);

    long cd = (B / c_lcm(C,D)) - ((A-1) / c_lcm(C,D));

//    cout<<"cd"<<cc<<endl;
    cout<<(B-A+1) -(cc+dd-cd)<<endl;

//    cout<<"aa"<<c_lcm(6,8)<<endl;

    return 0;
}

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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  int l, r;
  l = r = -1;
  for (int i = 0; i < (int) s.size(); i++) {
    if (s[i] == 'A') {
      l = i + 1;
      break;
    }
  }
  for (int i = (int) s.size() - 1; i >= 0; i--) {
    if (s[i] == 'Z') {
      r = i + 1;
      break;
    }
  }
  cout << r - l + 1 << '\n';
  return 0;
}

Measured memory_bytes: 3744
a, b = map(str,input().split())
if a == 'H' and b == 'H':
    print('H')
elif a == 'H' and b == 'D':
    print('D')
elif a == 'D' and b == 'D':
    print('H')
elif a == 'D' and b == 'H':
    print('D')

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

int main () {
  int N, a = 0;
  cin >> N;
  
  while (N > 0) {
     N = N / 2;
     a++;
  }
  
  int b = 1;
  
  for (int i = 1; i < a; i++)
    b = b * 2;

  cout << b << endl;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

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

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

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

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

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

class UnionFind {
public:
  vector<int> Parent; //親の番号を格納する。親だった場合は-1

  // 作るときはParrentの値を-(その集合のサイズ)にする
  // こうするとすべてばらばらになる
  // 引数に初期化するノードの個数を指定する
  UnionFind(int N) {
    Parent = vector<int>(N, -1);
  }

  // Aがどのグループに属性しているか調べる
  int root (int A) {
    if (Parent[A] < 0) return A; // 自分がリーダー?
    return Parent[A] = root(Parent[A]);
  }

  // 自分のいるグループの頂点数を調べる
  // rootの値はもともとマイナスにしているのでサイズとして返すときは
  // さらに符号を付けることで正の値にしていることに注意
  int size (int A) {
    return -Parent[root(A)];
  }

  int connect(int A, int B) {
    // AとBを直接くっつけるのではなく、root(A) にroot(B)をくっつける
    A = root(A);
    B = root(B);

    if (A == B) { return false; }

    // 大きいほうに小さい方をくっつけたいので
    // 大小逆だったらひっくり返す
    if (size(A) < size(B)) swap(A,B);

    // Aのサイズを更新
    Parent[A] += Parent[B];
    // Ｂの親をAに更新
    Parent[B] = A;
    return true;
  }   

};

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M);
  for (int i = 0; i < M ; i++) {
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
  }

  vector<LL> ans(M);
  ans[M - 1] = (LL) N * (N-1) / 2;

  UnionFind uni(N);

  for (int i = M - 1; i >= 1 ; i--) {
    ans[i-1] = ans[i];
    if (uni.root(A[i]) != uni.root(B[i])) {
      ans[i-1] -= (LL) uni.size(A[i]) * uni.size(B[i]);
      uni.connect(A[i],B[i]);
    }
  }
  for (int i = 0; i < M; i++) {
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
	ll n;
	cin>>n;
	ll a[n][3];
	for(ll i=0;i<n;i++){
		for(ll j=0;j<3;j++){
			cin>>a[i][j];
		}
	}
	ll dp[n][3]={0};
	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	for(ll i=1;i<n;i++){
		for(ll j=0;j<3;j++){
			for(ll k=0;k<3;k++){
				if(k!=j)
				dp[i][j]=max(dp[i-1][k]+a[i][j],dp[i][j]);
			}
		}
	}
	cout<<max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2])<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
const ll MAX_N=1e5;
ll N,A[MAX_N+1];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>N;
    REP(i,N+1)cin>>A[i];
    ll sm=0;
    REP(i,N){
        ll b;
        cin>>b;
        ll k=min(A[i],b);
        sm+=k;
        A[i]-=k;
        b-=k;
        k=min(A[i+1],b);
        sm+=k;
        A[i+1]-=k;
        b-=k;
    }
    cout<<sm<<endl;
}

Measured memory_bytes: 1024
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=1e9+7;
const llint big=1e15+100;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
int main(void){
	int n;cin>>n;cout<<48-n<<endl;RE;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rrep(i,n) for (int i = 1; i <= (n); i++)
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;
using Pl = pair<ll,ll>;



int main() {
  int n,k; cin >> n >> k;
  vector<ll> a(n);
  vector<ll> v(n+1);
  rep(i,n) {
    cin >> a.at(i);
    v.at(i+1) = a.at(i);
  }
  rep(i,n) {
    v.at(i+1) = max(v.at(i), v.at(i+1));
  }

  ll ans = 1e18;
  rep(bit, 1ll<<n) {
    std::vector<ll> d;
    rep(i,n) {
      if (bit>>i&1) d.push_back(i);
    }
    if (d.size() != k) continue;
    ll maxH = 0, cost = 0;
    for (ll i : d) {
      maxH = max(maxH, v[i]);
      if (a[i] <= maxH) {
        maxH++;
        cost += maxH - a[i];
      } else {
        maxH = a[i];
      }
    }
    ans = min(ans, cost);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3624
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <queue>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

typedef long long ll;

#include <set>

using namespace std;

const ll mod = 998244353;

ll pow2(int n){
  ll r = 1;
  REP(i,n) r = (r * 2) % mod;
  return r;
}

int main(){
  const int n = getInt();
  vector<int> x(n);
  vector<int> y(n);

  REP(i,n){
    x[i] = getInt();
    y[i] = getInt();
  }

  if(n <= 2) {
    puts("0");
    return 0;
  }

  ll ans = pow2(n) - 1 - n;

  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      int cnt = 2;
      for(int k = 0; k < n; k++){
	if(k == i || k == j) continue;

	if((x[j] - x[i]) * (y[k] - y[i]) == (y[j] - y[i]) * (x[k] - x[i])){
	  if(k < j) goto bad;
	  cnt++;
	}
      }

      ans = (ans - (pow2(cnt) - cnt - 1) + mod) % mod;
    bad:;
    }
  }

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

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};



int main() {
    int x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
    
    int dx = -(x2-x1); int dy = -(y2-y1);
    int x3 = x2 + dy; int y3 = y2-dx;
    int x4 = x1+dy; int y4 = y1-dx;
    cout<<x3 << " " << y3 << " " << x4 << " " << y4 << endl;

    return 0;
}





Measured memory_bytes: 256
N = int(input())
H = list(map(int,list(input().split())))

current = H[0]
count = 0
maxCount = 0
i = 1
while i < len(H):
    h = H[i]
    if current >= h:
        count += 1
    else:
        if maxCount < count:
            maxCount = count
        count = 0
    current = h
    i += 1

if maxCount < count:
    maxCount = count

print(maxCount)


Measured memory_bytes: 64752
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<string>
#include<functional>
using namespace std;
typedef	long long int ll;

int main(){
    int k;
    cin >> k;
    int a[k];
    for(int i = 0; i < k; i++){
        cin >> a[i];
    }
    ll max = 2;
    ll min = 2;
    for(int i = k-1; i >= 0; i--){
        if(max/a[i]*a[i] >= min){
            if(min%a[i] == 0) min = min;
            else min = (min/a[i]+1)*a[i];
            max = max/a[i]*a[i] + a[i] - 1;
        }
        else{
            cout << -1 << endl;
            return 0;
        }
    }
    cout << min << " " << max << endl;
    return 0;
}

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

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

        String s = sc.next();

        int ans = 0;

        for (int i = 0; i<s.length();i++){
            ans += Character.getNumericValue(s.charAt(i));
        }

        if (ans % 9 == 0)
            System.out.println("Yes");
        else
            System.out.println("No");

    }
}


Measured memory_bytes: 40292
// -- Nitin
#include <bits/stdc++.h>
#define pb push_back
#define mkp make_pair
#define llu unsigned long long int
#define ll long long
#define ld long double
#define foi(a,n) for(int i = a; i < (int)n; i++)
#define foj(a,n) for(int j = a; j < (int)n; j++)
#define foin(a,n) for(int i = n; i >= a; i--)
#define fojn(a,n) for(int j = n; j >= a; j--)
#define bug(x) cerr << #x << " is " << x << endl;
#define isp2(x) x&&(!(x&(x-1)))
#define ln '\n'
#define ee 1000000007
#define eem 998244353
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define cases int tests; cin >> tests; while(tests--)

using namespace std;

ll fast(ll n,ll k){
    ll res = 1;
    n = n;
    while(k > 0){
        if ((k&1) == 1)
            res = (res * n);
        k = k>>1;
        n = (n * n);
    }
    return res;
}
 
//~ ll strsum(string s){
    //~ ll sm = 0, r = s.size();
    //~ foi(0,r)    sm += int(s[i]-'a');
    //~ return sm;
//~ }
 
//~ set <ll, greater <ll> > ss; //Prime Factors
//~ void pF(ll n)  {    
    //~ while (n % 2 == 0)  {  
        //~ ss.insert(2);  
        //~ n = n/2;  
    //~ }  
    //~ for (int i = 3; i <= sqrt(n); i = i + 2)  {   
        //~ while (n % i == 0)  {  
            //~ ss.insert(i); 
            //~ n = n/i;  
        //~ }  
    //~ }    
    //~ if (n > 2)  ss.insert(n);  
//~ }

//~ ll pre[1001][1001];

//~ ll go(ll n, ll k){
	//~ if(n==1) return 1;
	//~ else {
		//~ pre[n][k] = (go(n - 1, k) + k - 1) % n + 1;
		//~ return pre[n][k];
	//~ }
//~ }

//~ int dp[1002][1002];
//~ bool pal(string s){
	//~ for(int i = 0, j = s.size() - 1; i < s.size(); i++, j--){
		//~ if(s[i] != s[j]) return 0;
	//~ }
	//~ return 1;
//~ }

//~ void solve(){
	//~ int n;
	//~ cin >> n;		
//~ }


void go(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a, a+n);
	ll c = 0;
	for(int i = 0; i < n; i++){
		for(int j = i+1; j < n; j++){
			for(int k = j+1; k < n; k++){
				if(a[i] != a[j] && a[j] != a[k] &&(a[i]+a[j] > a[k]) && (a[i]+a[k] > a[j]) && (a[k] + a[j] > a[i])){
					c++;
					//~ cerr << a[i] << " " << a[j] << " " << a[k] << '\n';
				}
				
			}
		}
	}
	cout << c;
	return;
}

int main(){
    fio;
	//~ ll q, n, x, m , y;
	//~ string t;
	//~ for(int i = 1; i <= 1000; i++){
		//~ pre[1][i]=1;
		//~ go(1000,i);
	//~ }
	ll n, m, k;
    //~ cases
    {	
		go();
		cout << "\n";
	}
}
       
        


Measured memory_bytes: 3648
from math import sqrt
def get_dis(list1, list2):
    temp = 0
    for i in range(len(list1)):
        temp += (list2[i]-list1[i])**2
    return sqrt(temp)
N, D = map(int, input().split())
X_list = []
for i in range(N):
    X = list(map(int, input().split()))
    X_list.append(X)
cnt = 0
for i in range(N):
    for j in range(i+1, N):
        distance = get_dis(X_list[i], X_list[j])
        if distance.is_integer():
            cnt += 1
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
		int N, Q;
		string S;
		cin >> N >> Q >> S;

		int l[Q], r[Q];
		for (int i = 0; i < Q; i++) {
				cin >> l[i] >> r[i];
		}

		vector<int> cum_sum(N+1, 0);;
		for (int i = 2; i <= N; i++) {
				if (S[i-1] == 'C' && S[i-2] == 'A') cum_sum[i] = cum_sum[i-1] + 1;
				else cum_sum[i] = cum_sum[i - 1];
		}

		for (int i = 0; i < Q; i++) {
				cout << cum_sum[r[i]] - cum_sum[l[i]] << endl;
		}

		return 0;
}


Measured memory_bytes: 2176
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        // スペース区切りの整数の入力
        string[] input = Console.ReadLine().Split(' ');
        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);
        Boolean f = true;
        string c = Console.ReadLine();

        for(int i = 0; i < a; i++)
        {
            char st = c[i];
            try
            {
                int.Parse(st.ToString());
            }
            catch
            {
                f = false;
            }
        }
        if(c[a] != '-')
        {
            f = false;
        }
        for(int i = a + 1; i <= a + b; i++)
        {
            char st = c[i];
            try
            {
                int.Parse(st.ToString());
            }
            catch
            {
                f = false;
            }
        }
        if (f)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
        Console.ReadLine();
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll gcd(int a,int b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(int a,int b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll INFS=1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);

int main() {
  ll n,m;
  cin>>n>>m;
  if(n==1||m==1){
    if(n==1&&m==1){
      cout<<1<<endl;
      return 0;
    }
    ll mx=max(n,m);
    cout<<mx-2<<endl;
    return 0;
  }
  cout<<(n-2)*(m-2)<<endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n][2];
  for(int i=0;i<n;i++)
  {
      for(int j=0;j<2;j++)
      cin>>a[i][j];
  }
  for(int i=0;i<n-2;i++)
  {
      for(int j=0;j<1;j++)
  {
      if((a[i][j]==a[i][j+1])&&(a[i+1][j]==a[i+1][j+1])&&(a[i+2][j]==a[i+2][j+1]))
      {
        cout<<"Yes";
        return 0;
  }
 
      
  }
   
}
cout<<"No";
}

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

using ll = long long;

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

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

int main()
{
    cin.tie(nullptr); ios::sync_with_stdio(false);

    int N, Q;
    string S;
    cin >> N >> S >> Q;
    vector<int> K(Q); cin >> K;

    vector<ll> ans(Q);
    vector<int> sumd(N), summ(N), ic;
    vector<ll> sumdm(N);
    sumd[0] = S[0] == 'D';
    summ[0] = S[0] == 'M';
    sumdm[0] = 0;
    for (int i = 1; i < N; i++) {
        sumd[i] = sumd[i-1] + (S[i] == 'D');
        summ[i] = summ[i-1] + (S[i] == 'M');
        sumdm[i] = sumdm[i-1] + (S[i] == 'M' ? sumd[i] : 0);
        if (S[i] == 'C') {
            ll dm = sumdm[i-1];
            for (int j = 0; j < Q; j++) {
                const int& k = K[j];
                if (i - k >= 0) {
                    ans[j] += sumdm[i-1] - sumdm[i-k] - (ll)sumd[i-k] * (summ[i-1] - summ[i-k]);
                } else {
                    ans[j] += sumdm[i-1];
                }
            }
        }
    }

    for (const ll& a : ans) cout << a << endl;
}


Measured memory_bytes: 17052
N = int(input())

line = list(map(int,input().split()))


result = 0
for i in range(N):
    if line[i] % 2 == 0:
        if line[i] % 3 == 0 or line[i] % 5 == 0:
            result += 1
    else:
        result += 1
        
if result == N:
    print("APPROVED")
else:
    print("DENIED")
            

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

void solve(int test_case) {
	ll x;
	cin>>x;
	ll ans = x/11;
	ans*=2;
	if(x%11!=0)
	if(x%11<7)ans++;
	else ans+=2;
	cout<<ans;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
}	


Measured memory_bytes: 3612