akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
#define Nmax 1000005
#define INF 1000000000
#define MOD 1000000007
 
using namespace std;

 ll mod=1e9+7;
 
ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}

ll expo2(ll base,ll exponent)
{
	ll ans=1;
	while(exponent!=0)
	{
		if(exponent & 1) ans=(1LL*ans*base);
		base=(1LL*base*base);
		exponent>>=1;
	}
	return ans;
}

vector<bool>  prime(90000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=90000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=90000001; i += p) 
                prime[i] = false; 
        } 
    } 
}


int main()
{
    
    // #ifndef ONLINE_JUDGE
    //     freopen ("data.in","r",stdin);
    //     freopen ("E.out","w",stdout);
    // #endif
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // Sieve();
    int tests=1;
    // cin>>tests;
    while(tests--)
    {	
    	ll d,t,s;
    	cin>>d>>t>>s;
    	if(s*t>=d) cout<<"Yes";
    	else cout<<"No";
    }
    	return 0;
    
}

Measured memory_bytes: 14128
function Main(input){
	input = input.trim();
  var i = ~~input;
  var sum = input.split("").map(a=>~~a).reduce((a,b)=>a+b);
  
  return i % sum?"No":"Yes";
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
12
`);

Measured memory_bytes: 7372
//abc165-C//

//#include <math.h>
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#include<stdio.h>
#include <iostream>
#include <vector>
//#include <string.h>
using namespace std;

int n,m,q;
vector<int>a, b, c, d;
//vector<vector<int>>A(3,vector<int>(4));
int ans;

void dfs(vector<int>A){
    if(A.size()==n){
        int now=0;
        rep(i,q){
            if(A[b[i]-1]-A[a[i]-1]==c[i])now += d[i];
        }
        ans = max(ans,now);
        return;
    }
    A.push_back(A.back());
    while(A.back()<=m){
        dfs(A);
        A.back()++;
    }
    
}

int main(){
    cin >> n >> m >> q;
    a = b = c =d =vector<int>(q);
    rep(i,q){
        cin >> a[i]>>b[i]>>c[i]>>d.at(i);
    }
    dfs(vector<int>(1,1));
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>

int main(void) {
	int a, b, c, x, num = 0;
	scanf("%d %d %d %d",&a,&b,&c,&x);
	for (int i = 0; i <= a; i++)
	{
		for (int j = 0; j <= b; j++)
		{
			for (int k = 0; k <= c; k++)
			{
				if (500 * i + 100 * j + 50 * k == x) num++;
			}
		}
	}
	printf("%d",num);
	return 0;
}

Measured memory_bytes: 128
/*	
*  Sachin Mittal
*/
#include<bits/stdc++.h>
#define int long long
#define M 998244353
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define rep(i,j,n) for(int i=j;i<n;i++)
#define F first
#define S second
#define lb lower_bound
#define mem0(dp) memset(dp,0,sizeof(dp))
#define mem1(dp) memset(dp,-1,sizeof(dp))
#define pb push_back
#define sz(s) (int)(s.size())
#define debug(x) cout << #x << " = " << x << '\n';
using namespace std;

void solve()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int one=c/b+(c%b!=0);
	int two=a/d+(a%d!=0);
	if(one<=two)cout<<"Yes";
	else cout<<"No";
}

int32_t main(){

ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int tst=1;
//cin>>tst;
while(tst--)
{
	solve();
}
}

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

int main(){
	int N,K; cin>>N>>K;
	vector<int> A(N);
	vector<double> B(N+1), M(N+1);
	rep(i, N) cin>>A[i];
	rep(i, N) B[i+1] = B[i] + log10(A[i]);
	rep(i, N+1-K) M[i + K] = B[i + K] - B[i];
	for(int i=K+1; i<=N; ++i)
		puts( M[i] - M[i-1] > 1e-10? "Yes":"No");
}


Measured memory_bytes: 7220
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function getcod(cod,lim)
    if cod==0 || cod==lim+1
        return false
    else
        return true
    end
end

function main()
    n,x=parseMap(split(readline()))
    a=sort([parseInt(readline()) for i in 1:n])
    println(n+div(x-sum(a),a[1]))
end
main()

Measured memory_bytes: 117248
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, char> Q;
const ll mod = 1000000007;
const ll INF = 1000000000000000;

ll x, y, ans;

int main(void)
{
	cin >> x >> y;

	if (x == 1 && y == 1)
	{
		ans += 400000;
	}

	if (x <= 3)
	{
		ans += (4 - x) * 100000;
	}
	if (y <= 3)
	{
		ans += (4 - y) * 100000;
	}

	cout << ans << endl;

	int xxx;
	cin >> xxx;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();

	}
	static class Task{
		int M = (int) (1e9 + 7);
		public void solve(int testNumber, InputReader in, PrintWriter out) {
				int n = in.nextInt(), l = in.nextInt();
				int min = M, a, s = 0;
				for(int i = 0; ++i < n+1;) {
					a = l+i-1;
					s += a;
					if(Math.abs(a) < Math.abs(min)) min = a;
				}
			
				out.print(s - min);
	
		}//Solve
		

			
	}//task

	static class InputReader{
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}
		public String next() {
			while(tokenizer == null || ! tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public int[] nextIntArray(int n) {
			int[] arr = new int[n];
			for(int i = -1; ++i < n;) arr[i] = Integer.parseInt(next());
			return arr;
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		
	}
}

Measured memory_bytes: 21332
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let a: usize = scan(tokens);
    let b: usize = scan(tokens);
    let k: usize = scan(tokens);
    if k <= a {
        println!("{} {}", a - k, b);
    } else if k <= a + b {
        println!("0 {}", a + b - k);
    } else {
        println!("0 0");
    }
}


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

using namespace std;

#define INF 1000000007
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
signed main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if (C * A <= B)
    {
        cout << C << endl;
    }
    else
    {
        cout << B / A << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#define debug(x...) cout << #x << " = "; _print(x)
typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
#define rep(i,a,b) for (ll i = (a); i < (b); ++i)
#define per(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL) 

int solve(){
	int k;
	cin>> k;
	string s;
	cin>> s;
	if(s.size() <= k)
		cout<< s<< "\n";
	else
		cout<< s.substr(0, k)<< "...\n";
	return 0;
}
 
int main()
{
    fast;
    int t = 1;
   // cin>> t;
    while(t--){  
        solve();
    }
    return 0;
}
//v.clear(), vis.clear(); vis.resize(n + 1, 0), v.resize(n + 1);
 
/*  inv[1] = 1; // inv is ll
    for(int i=2; i<=mxn; ++i)
        inv[i]=mod-mod/i*inv[mod%i]%mod;*/


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

using namespace std;

#define MAX 100005
#define ll long long
ll w[105], v[105];
ll dp[MAX][105];

int main()
{
    ll n, cap;
    scanf("%lld %lld", &n, &cap);
    for(int i=1; i<=n; i++) scanf("%lld %lld", &w[i], &v[i]);
    memset(dp, 0, sizeof dp);
    for(int i=1; i<=n; i++){
        for(int j=1; j<=cap; j++){
            if(w[i] > j) {
				dp[j][i] = dp[j][i-1];
                continue;
            }
            dp[j][i] = max(dp[j][i-1], dp[j-w[i]][i-1]+v[i]);
        }
    }
    ll ans = 0;
    for(int i=0; i<=cap; i++) ans = max(ans, dp[i][n]);
    printf("%lld", ans);
}


Measured memory_bytes: 82304
a = input().split()
num = int(a[0])
L = int(a[1])
apple = dict()
orig_taste = 0
for i in range(1, num + 1) :
    apple[i] = L + i - 1
    orig_taste += L + i - 1

if(L + num - 1 > 0 and L > 0):
    print(orig_taste - L)
elif(L + num - 1 > 0 and L < 0):
    print(orig_taste)
elif(L + num - 1 < 0 and L < 0):
    print(orig_taste - L - num + 1)
else:
    print(orig_taste)



Measured memory_bytes: 3060
n = int(input())                                                                 
ary = [int(x) for x in input().split()]                                          
def check(ary):                                                                  
    biggest = 0                                                                  
    for num in ary:                                                              
        if biggest-1 > num:                                                      
            return False                                                         
        biggest = max(biggest, num)                                              
    return True                                                                  
if check(ary):                                                                   
    print("Yes")                                                                 
else:                                                                            
    print("No")

Measured memory_bytes: 14252
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    solve();
}

void solve(){
    ll n;cin>>n;
    vl a(n);rep(i,n)cin>>a[i];

    sort(all(a));
    if(n%2){
        ll ans1=0;
        rep(i,n/2)ans1-=a[i]*2;
        ans1+=a[n/2]+a[n/2+1];
        rep(i,n/2+2,n)ans1+=a[i]*2;

        ll ans2=0;
        rep(i,n/2-1)ans2-=a[i]*2;
        ans2-=a[n/2-1]+a[n/2];
        rep(i,n/2+1,n)ans2+=a[i]*2;
        
        cout<<max(ans1,ans2)<<endl;
    }else{
        ll ans=0;
        rep(i,n/2-1)ans-=a[i]*2;
        ans-=a[n/2-1];
        ans+=a[n/2];
        rep(i,n/2+1,n)ans+=a[i]*2;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int n;
long long dp[2005][2005];
vector<pair<long long, int> > v;
long long solve(int l, int r)
{
	if (r < l)
		return 0;
	if (dp[l][r] != -1)
		return dp[l][r];
	int i = l + n - r - 1;
	return dp[l][r] = max(v[i].first * abs(v[i].second - l) + solve(l + 1, r), v[i].first * abs(v[i].second - r) + solve(l, r - 1));
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		v.push_back({a, i});
	}
	sort(v.rbegin(), v.rend());
	memset(dp, -1, sizeof(dp));
	cout << solve(0, n - 1) << "\n";
}


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

typedef long long int ll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)

const ll MOD = 1000000007;

using namespace std;
bool F[100][10];
int P[100][11];

int main()
{
	int N;
	cin >> N;
	REP(i, N)
	{
		REP(j, 10)
		{
			int f = 0;
			cin >> f;
			F[i][j] = (bool)f;
		}
	}
	REP(i, N)
	{
		REP(j, 11)
		{
			cin >> P[i][j];
		}
	}

	ll max = -1000000005;
	FOR(i, 1 << 10, 1)
	{
		ll m = 0;
		REP(j, N)
		{
			int on = 0;
			REP(k, 10)
			{
				if ((i >> k & 1) == 1 && F[j][k])
				{
					on++;
				}
			}
			m += P[j][on];
		}
		if (m == 0)
		{
			cin >> N;
		}
		max = std::max(max, m);
	}
	cout << max << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAX_C = 30;
static int N, C;
static int D[MAX_C][MAX_C];
static int t[3][MAX_C];

int solve();

int solve() {
  int ans = 1 << 30;
  for (int i = 0; i < C; i++) {
    for (int j = 0; j < C; j++) {
      if (i != j) {
        for (int k = 0; k < C; k++) {
          if (i != k && j != k) {
            int tt = 0;
            for (int l = 0; l < C; l++) {
              tt += D[l][i] * t[0][l];
              tt += D[l][j] * t[1][l];
              tt += D[l][k] * t[2][l];
            }
            if (tt < ans) {
              ans = tt;
            }
          }
        }
      }
    }
  }
  return ans;
}

int main() {
  cin >> N >> C;
  int x;
  for (int i = 0; i < C; i++) {
    for (int j = 0; j < C; j++) {
      cin >> x;
      D[i][j] = x;
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cin >> x;
      t[(i + j) % 3][x - 1] += 1;
    }
  }
  cout << solve() << endl;
  return 0;
}


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

// clang-format off
template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }
template <typename T> T clamp(T val, T min, T max) { return val < min ? min : (max < val ? max : val); }
char capitalize(char c) { return static_cast<char>(std::toupper(static_cast<unsigned char>(c))); }
// template <typename T> size_t max_index(T begin, T end) { return distance(begin, max_element(begin, end)); }
// template <typename T> size_t min_index(T begin, T end) { return distance(begin, min_element(begin, end)); }
// clang-format on

#define int long long
#define YES "Yes"
#define NO  "No"

using namespace std;

signed main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  int num = 0;
  // num = numeric_limits<int>::max();
  // num = numeric_limits<int>::min();
  bool flag = false;
  flag = true;

  int h, w; cin >> h >> w;
  vector<string> c(h);
  for (int i = 0; i < h; ++i) cin >> c[i];

  for (int i = 0; i < 2 * h; ++i) {
    cout << c[i / 2] << endl;
  }
  
  // cout << num << endl;
  // cout << (flag ? YES : NO) << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;


void solve()
{
    ll n,m;
    cin>>n>>m;
    ll h[n];
    ll i,j;
    for(i=0;i<n;i++)
    {
        cin>>h[i];
    }
    ll x,y;
    ll ind[n];
    for(i=0;i<n;i++)
    {
        ind[i]=-INF;
    }
    for(i=0;i<m;i++)
    { 
       cin>>x>>y;
       x--,y--;
       ind[x]=max(ind[x],h[y]);
       ind[y]=max(ind[y],h[x]);
    }
    ll res=0;
    for(i=0;i<n;i++)
    {
        if(ind[i]<h[i])
        {
            res++;
        }
    }
    cout<<res<<"\n";
}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

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

typedef long double ld;

const ld EPS = 1e-9;
const ld INF = 1e10;
const ld PI = M_PI;

struct Point{
  ld x, y;
  Point(ld x, ld y):x(x), y(y){}
  Point(){}
};

Point operator+(const Point &a, const Point &b){
  return Point(a.x + b.x, a.y + b.y);
}
Point operator-(const Point &a, const Point &b){
  return Point(a.x - b.x, a.y - b.y);
}
Point operator*(const Point &a, const ld b){
  return Point(a.x * b, a.y * b);
}
Point operator*(const Point &a, const Point &b){
  return Point(a.x*b.x-a.y*b.y, a.x*b.y+a.y*b.x);
}
Point operator/(const Point &a, const ld b){
  return Point(a.x / b, a.y / b);
}

bool operator<(const Point &a, const Point &b){
  return make_pair(a.x, a.y) < make_pair(b.x, b.y);
}
bool operator==(const Point &a, const Point &b){
  return a.x == b.x && a.y == b.y;
}

ld cross(const Point &a, const Point &b){
  return a.x*b.y - a.y*b.x;
}

ld dot(const Point &a, const Point &b){
  return a.x*b.x + a.y*b.y;
}

ld norm(const Point &a){
  return dot(a, a);
}

struct Line:vector<Point>{
  Line(Point a = Point(0, 0), Point b = Point(0, 0)){
    this->push_back(a);
    this->push_back(b);
  }
};

typedef vector<Point> Polygon;

int ccw(Point a, Point b, Point c){
  b = b - a;
  c = c - a;
  if(cross(b, c) > EPS) return +1; // 反時計周り
  if(cross(b, c) < -EPS) return -1; // 時計周り
  if(dot(b, c) < 0) return +2; // c -- a -- b がこの順番に一直線上
  if(norm(b) < norm(c)) return -2; // a -- b -- c がこの順番に一直線上
  return 0; // a -- c -- b が一直線上
}

Point next(const Polygon &a, int x){
  return a[(x+1)%a.size()];
}

Point prev(const Polygon &a, int x){
  return a[(x-1+a.size()) % a.size()];
}

bool eq(ld a,ld b){ return abs(a-b) < EPS; }

bool compare(const Point &a, const Point &b){
  if(eq(a.y, b.y)) return a.x < b.x;
  return a.y < b.y;
}

Polygon convex_hull(Polygon ps){
  int n = ps.size(), k = 0;
  sort(ps.begin(), ps.end(), compare);
  Polygon ch(2*n);
  for(int i = 0 ; i < n ; i++){
    while(k > 1 && ccw(ch[k-2], ch[k-1], ps[i]) == -1) --k;    
    ch[k++] = ps[i];
  }
  int t = k;
  for(int i = n-2 ; i >= 0 ; i--){
    while(k > t && ccw(ch[k-2], ch[k-1], ps[i]) == -1) --k;
    ch[k++] = ps[i];
  }
  ch.resize(k-1);
  return ch;
}


int main(){
  int q;
  cin >> q;
  Polygon poly;
  while(q--){
    Point p;
    cin >> p.x >> p.y;
    poly.push_back(p);
  }
  
  Polygon ans = convex_hull(poly);
  cout << ans.size() << endl;
  for(int i = 0 ; i < (int)ans.size() ; i++){
    cout << ans[i].x << ' ' << ans[i].y << endl;
  }
  
  return 0;
}

Measured memory_bytes: 13552
#include <iostream>

using namespace std;

int main(){
  int S,h,m,s;
  cin >> S;
  h = S/3600;
  m = (S%3600)/60;
  s = (S%3600)%60;
  cout << h << ":" << m << ":" << s << endl;
  return 0;
}

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

int main(){
    int n, k, i, a, sum = 0;
    cin >> n >> k;
    int c[n+1];
    for(i=0; i<=n; i++){
        c[i] = 0;
    }
    for(i=0; i<n; i++){
        cin >> a;
        c[a]++;
    }
    sort(c, c+n+1);
    for(i=0; i<n-k+1; i++){
        sum += c[i];
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long N = scanner.nextLong();
        String S = scanner.next();
        scanner.close();

        long ans = 1;
        for(int i = 0; i < N - 1; i++) {
            if(S.charAt(i) != S.charAt(i + 1)) ans++;
        }
        System.out.println(ans);
    }
}

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

struct edge{int x,y,c; bool operator <(const edge &t)const{return c < t.c;}} E[400200];
int N,M,P[200200],C,U[200200];

int find(int x)
{
if (P[x] != x) P[x] = find(P[x]);
  return P[x];
}

int main()
{
  scanf ("%d %d",&N,&M);
  for (int i=0;i<N;i++){
P[i] = i; U[i] = 1111111111;
  }
  for (int i=0;i<M;i++){
  int a,b,c; scanf ("%d %d %d",&a,&b,&c);
    E[C++] = {a,b,c};
      U[a] = min(U[a],c+1);
      U[b] = min(U[b],c+2);
  }
      for (int k=0;k<2;k++) for (int i=0;i<N;i++){
      int x = (i + 1) % N;
        if (U[x] > U[i] + 2)
          U[x] = U[i] + 2;
      }
      for (int i=0;i<N;i++){

      int x = (i + 1) % N;
        E[C++] = {i,x,U[i]};
      }
  
  sort(E,E+C);
  long long ans = 0;
  for (int i=0;i<C;i++){
int x = find(E[i].x), y = find(E[i].y);
    if (x != y){
P[x] = y; ans += E[i].c;
    }
  }
  
  printf ("%lld\n",ans);
return 0;
}


Measured memory_bytes: 9472
#include<stdio.h>

int main(void){
    int c0[3],c1[3],c2[3],i,temp[3];
    scanf("%d %d %d",&c0[0],&c0[1],&c0[2]);
    scanf("%d %d %d",&c1[0],&c1[1],&c1[2]);
    scanf("%d %d %d",&c2[0],&c2[1],&c2[2]);
    
    for(i=0;i<3;i++){
        temp[i] = c1[i]-c0[i];
    }
    if(temp[0] != temp[1] || temp[1] != temp[2]){
        printf("No\n");
        return 0;
    }
    
    for(i=0;i<3;i++){
        temp[i] = c2[i]-c1[i];
    }
    if(temp[0] != temp[1] || temp[1] != temp[2]){
        printf("No\n");
        return 0;
    }
    temp[0] = c0[1]-c0[0];
    temp[1] = c1[1]-c1[0];
    temp[2] = c2[1]-c2[0];
    if(temp[0] != temp[1] || temp[1] != temp[2]){
        printf("No\n");
        return 0;
    }
    temp[0] = c0[2]-c0[1];
    temp[1] = c1[2]-c1[1];
    temp[2] = c2[2]-c2[1];
    if(temp[0] != temp[1] || temp[1] != temp[2]){
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
    return 0;
}

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

int main(void){
    int t,h,m;
    cin >> t;
    h = t / 3600;
    t -= 3600 * h;
    m = t / 60;
    t -= 60 * m;
    cout << h << ":" << m << ":" << t << endl;
    
    return 0;
    
}


Measured memory_bytes: 3092
//
//  main.cpp
//  codeforces
//
//  Created by cfhaiteeh on 29/5/2018.
//  Copyright © 2018 cfhaiteeh. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#define  LL long long

using namespace  std;
int n,k;
int ai[12345];
int bi[5];
void init(){
   
}


int ans;
void play(){

}
void pri(){
   
}
struct he1 {
    int x;
    int id;
}need[100];
int vvv[100];
bool cmp1(he1 a,he1 b){
    return a.x>b.x;
}
int main() {
    while(scanf("%d",&n)!=EOF){
        LL sum=0;
        for(int i=1;i<=n;i++){
            int u;
            scanf("%d",&u);
            while(u%2==0){
                u/=2;
                sum++;
            }
        }
        printf("%lld\n",sum);
    }

    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
#define endl "\n"
#define print_array(name,n) for(ll o=0;o<n;o++) cout<<name[o]<<" "
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2e18
#define pll pair<ll,ll>
#define pii pair<int,int>
bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
	return (a.ss>b.ss);
}
 
ll gcd(ll a,ll b){ if(b==0) return a; return gcd(b,a%b) ;} 

template <typename T>
string NumberTostring(T Number )
{
	ostringstream ss;
	ss<<Number;
	return ss.str();
}
 

 
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
 	ll n;
 	double d;
 	cin>>n>>d;
 	ll a,b;
 	int cnt = 0;
 	for(int i=0;i<n;i++){
 		cin>>a>>b;
 		double dif = sqrt(pow(a,2)+pow(b,2));
 		// cout<<dif<<endl;
 		if(dif<=d){
 			cnt++;
 		} 
 	}  
 	cout<<cnt<<endl; 
    return 0;
}

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

int main(){

    int x,a,b;
    cin>>x>>a>>b;

    if(b-a>=x+1) cout<<"dangerous"<<endl;
    else if(b-a>0) cout<<"safe"<<endl;
    else cout<<"delicious"<<endl;








    return 0;
}

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

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̒萔 (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

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

    int ans = 0;
    if (n / 100 == 7) ans++;
    if ((n / 10) % 10 == 7) ans++;
    if (n % 10 == 7) ans++;

    if (ans == 0)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

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

int N;
vector<long long> a;

void solve() {
    map<long long, long long> ma;
    for (int i = 0; i < N; ++i) ma[a[i]]++;
    long long res = 0;
    for (auto it : ma) res += it.second * (it.second - 1) / 2;
    for (int i = 0; i < N; ++i) {
        long long val = ma[a[i]];
        long long before = val * (val - 1) / 2;
        long long after = (val - 1) * (val - 2) / 2;
        cout << res + after - before << endl;
    }
}

int main() {
    cin >> N;
    a.resize(N);
    for (int i = 0; i < N; ++i) cin >> a[i];
    solve();
}


Measured memory_bytes: 11904
#include<iostream>
using namespace std;
using ll = long long;

int main() {
  ll K,a,i;
  cin>>K;
  a=7%K;
  for(i=1;i<=K && a>0;i++) {
    a=(a*10+7)%K;
  }
  cout<<(a==0 ? i : -1)<<endl;
  return 0;
}


Measured memory_bytes: 3152
n, k, q = map(int, input().split())
#N人、持ち点K、問題Q
anss = [0] * n
tmp = 0
for i in range(q):
  tmp = int(input())
  anss[tmp-1] += 1
for i in anss:
  if i > q - k:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 4680
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ui N; cin >> N;
  vector<ull> A(N);
  for(auto& a : A) cin >> a;

  // Aのxor和S0を求める
  auto XOR = [](ull a, ull b){ return a ^ b; };
  auto S0 = boost::accumulate(A, (ull)0, XOR);

  // ビット列S0のうちビット1の桁は題意の組み分けに依存せず決定される
  // 各A_iに対して、S0でビット0の桁を0にする
  for(auto& a : A){
    a &= ~S0;
  }

  // ビット列を行列と見立てて標準化を行う
  for(size_t i = 0; i < A.size(); ++i){
    for (int m_bit = 60; m_bit >= 0; --m_bit){
      // 各A_iの最上位桁を導出
      if(A[i] & (ull)1 << m_bit){
        // 他の各項のm_bit桁目を0にする
        for(size_t k = 0; k < A.size(); ++k)
        {
          if(i == k)
            continue;
          if(A[k] & (ull)1 << m_bit){
            A[k] ^= A[i];
          }
        }
        break;
      }
    }
  }

  // 標準化したAのxor和が題意の要求を満たす
  auto S1 = boost::accumulate(A, (ull)0, XOR);
  // 初めに下したビットを立てる
  auto S2 = S1 | S0;

  auto ans = S1 + S2;
  cout << ans << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define re register
#define pb push_back
#define fi first
#define se second
#define mp make_pair
const int N=2e6+10;
const int mod1=998244353;
const int mod2=19260811;
void read(int &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
int main()
{
    double l;
    cin>>l;
    l/=3;
    printf("%.10lf\n",l*l*l);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

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


int main(){
    ll N;
    cin >> N;
    vector<P> a;
    for(int i = 0; i < N; i++){
        ll x, L;    cin >> x >> L;
        a.emplace_back(P(x+L, L));
    }

    sort(a.begin(), a.end());
    ll cur = a[0].fs;
    int res = 1;
    for(int i = 1; i < N; i++){
        if(a[i].fs - a[i].sc * 2 >= cur){
            res++;
            cur = a[i].fs;
        }
    }

    cout << res << endl;


    return 0;
}


Measured memory_bytes: 2420
using System;
using System.Linq;
using System.Text;

namespace _058_Orthogonal
{
	class Program
	{
		static void Main ( string[] args )
		{
			string inputStr;
			StringBuilder output = new StringBuilder (100 * 4);

			while ((inputStr = Console.ReadLine ()) != null)
			{
				decimal[] inputPoint = inputStr.Split (' ').Select (decimal.Parse).ToArray ();

				Vector2 vector1 = new Vector2 (inputPoint[0], inputPoint[1], inputPoint[2], inputPoint[3]);
				Vector2 vector2 = new Vector2 (inputPoint[4], inputPoint[5], inputPoint[6], inputPoint[7]);

				bool isOrthogonal = Vector2.DotProduct (vector1, vector2) == 0;

				if (isOrthogonal)
					output.AppendLine ("YES");
				else
					output.AppendLine ("NO");
			}

			Console.Write (output);
		}
	}

	class Vector2
	{
		public Vector2 ( decimal x1, decimal y1, decimal x2, decimal y2 )
		{
			this.X = x1 - x2;
			this.Y = y1 - y2;
		}

		public decimal X { private set; get; }
		public decimal Y { private set; get; }

		public static decimal DotProduct ( Vector2 ob1, Vector2 ob2 )
		{
			return ob1.X * ob2.X + ob1.Y * ob2.Y;
		}
	}
}

Measured memory_bytes: 9540
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <utility>
#include <cstdlib>
#include <cmath>
#define INF 987654321
#define INT_MAX 2147483647
#define MIN(a, b) ((a) < (b) ? a : b)
#define MAX(a, b) ((a) > (b) ? a : b)
 
using namespace std;


int main() {
    int D, T, S;
    cin >> D >> T >> S;

    if(double(D) / double(S) > double(T)) cout << "No";
    else cout << "Yes";

}

Measured memory_bytes: 3044
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define loop(i, a, n) for(int i = (a); i < (n); i++)
#ifdef _DEBUG
#define dd(x) cout << #x << " : " << x << endl
#else
#define dd(x)
#endif
using namespace std;
using ll = int64_t;

int main(){
    char c; cin >> c;

    if('A' <= c && c <= 'Z') cout << 'A' << endl;
    else cout << 'a' << endl;

    return 0;
}

Measured memory_bytes: 3592
"""
DiceFaces : ?????????????????¢?????°???
    ?????????????????¢?????¶??? : [top, front, right, left, back, bottom]

Rotates : ?????¢????????????
"""

# ????????????????????¢??????????§?
EAST = "E"
WEST = "W"
SOUTH = "S"
NORTH = "N"

TOP = 0
FRONT = 1
RIGHT = 2
LEFT = 3
BACK = 4
BOTTOM = 5

def rotated_dice(DiceFaces, Rotate):
    """
    ????????????????????¢
    """
    if Rotate == EAST:
        # ??¢?????¶??? : [top, front, right, left, back, bottom] to [left, front, top, bottom, back, right]
        DiceFaces[TOP], DiceFaces[RIGHT], DiceFaces[LEFT], DiceFaces[BOTTOM] = DiceFaces[LEFT], DiceFaces[TOP], DiceFaces[BOTTOM], DiceFaces[RIGHT]
    elif Rotate == WEST:
        # ??¢?????¶??? : [top, front, right, left, back, bottom] to [right, front, bottom, top, back, left]
        DiceFaces[TOP], DiceFaces[RIGHT], DiceFaces[LEFT], DiceFaces[BOTTOM] = DiceFaces[RIGHT], DiceFaces[BOTTOM], DiceFaces[TOP], DiceFaces[LEFT]
    elif Rotate == SOUTH:
        # ??¢?????¶??? : [top, front, right, left, back, bottom] to [back, top, right, left, bottom, front]
        DiceFaces[TOP], DiceFaces[FRONT], DiceFaces[BACK], DiceFaces[BOTTOM] = DiceFaces[BACK], DiceFaces[TOP], DiceFaces[BOTTOM], DiceFaces[FRONT]
    elif Rotate == NORTH:
        # ??¢?????¶??? : [top, front, right, left, back, bottom] to [front, bottom, right, left, top, back]
        DiceFaces[TOP], DiceFaces[FRONT], DiceFaces[BACK], DiceFaces[BOTTOM] = DiceFaces[FRONT], DiceFaces[BOTTOM], DiceFaces[TOP], DiceFaces[BACK]

    return DiceFaces

if __name__ == "__main__":
    # ?????????????????¢?????°????????????
    DiceFaces = [int(x) for x in input().split(" ")]
    RotatesStirng = input()
    Rotates = [x for x in RotatesStirng]
    for Rotate in Rotates:
        DiceFaces = rotated_dice(DiceFaces, Rotate)

    print(DiceFaces[0])

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

using namespace std;


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

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




int main() {
  int N; cin >> N;
  int x[N];
  int y[N];
  double sum=0.0;
  ll count=0;
  vector<int> v;
  rep(i,N){
    cin >> x[i] >> y[i];
    v.push_back(i);
  }

  while(1){
    rep(i,v.size()-1){
      double xdist = x[v[i]] - x[v[i+1]];
      //cout <<"xdist:"<< xdist << endl;
      double ydist = y[v[i]] - y[v[i+1]];
      //cout <<"ydist:"<< ydist << endl;
      sum += sqrt(xdist*xdist + ydist*ydist);
      //cout <<"sum:" << sum << "\n" << endl;
    }
    count++;
    if(!next_permutation(v.begin(),v.end())) break;
  }
  //cout << "sum:" << sum <<", count:" << count << endl;
  cout << setprecision(12) << sum/count << endl;

}

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

int main() {
	int i, k, ans;
	int n;

	cin >> n;

	vector<int> a(n);

	for (i = 0; i < n; i++)		cin >> a[i];

	sort(a.begin(), a.end());

	a.push_back(0);

	k = 0;
	ans = 0;
	for (i = 0; i < n; i++) {
		k++;
		if (a[i] != a[i + 1]) {
			if (k > a[i])		ans += k - a[i];
			else if (k < a[i])	ans += k;
			k = 0;
		}
	}

	cout << ans << endl;
}

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

int main()
{
    string s, t;
    cin >> s;
    cin >> t;

    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());

    if(s<t){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
import sys

stdin = sys.stdin

mod = 1000000007
inf = 1 << 60

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n, k = na()
h = na()

dp = [inf] * n
dp[0] = 0
for i in range(n):
    for j in range(1, k + 1):
        if i + j < n:
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]))

print(dp[n - 1])


Measured memory_bytes: 52444
#include<iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
using namespace std;

long long find(vector<long long > &unionFindTree,long long N){
    if (unionFindTree[N] == N){
        return N;
    }else{
        return unionFindTree[N] = find(unionFindTree,unionFindTree[N]);
    }
}

bool same(vector<long long > &unionFindTree,long long x,long long y){
    return find(unionFindTree,x) == find(unionFindTree,y);
}

void unionTree(vector<long long > &unionFindTree,long long x,long long y){
    x = find(unionFindTree,x);
    y = find(unionFindTree,y);
    if (x==y) return;
    unionFindTree[x] = y;
}

int main()
{
    // 整数の入力
    long long total,N,minX,minY,maxX,maxY,x,y,i;
    vector<vector<long long>> towns;
    deque<vector<long long>> edges;
    vector<long long> vectorTree;
    total = 0;
    cin >> N;
    for (i =0;i < N ;i++){
        cin >> x >> y;
        vector<long long> a;
        a.push_back(i);
        a.push_back(x);
        a.push_back(y);
        towns.push_back(a);
        vectorTree.push_back(i);
    }

    sort(towns.begin(),towns.end(), [](vector<long long> v1,vector<long long> v2) -> long long {
                        return ( v1[1] < v2[1] );
                        } );
        for (i =1;i < N ;i++){
            vector<long long> edge;
            edge.push_back(towns[i][0]);
            edge.push_back(towns[i-1][0]);
            edge.push_back(towns[i][1] - towns[i-1][1]);
            edges.push_back(edge);
    }
    sort(towns.begin(),towns.end(), [](vector<long long> v1,vector<long long> v2) -> long long {
        return ( v1[2] < v2[2] );
    } );
    for (i =1;i < N ;i++){
        vector<long long> edge;
            edge.push_back(towns[i][0]);
            edge.push_back(towns[i-1][0]);
            edge.push_back(towns[i][2] - towns[i-1][2]);
            edges.push_back(edge);
    }
    sort(edges.begin(),edges.end(), [](vector<long long> v1,vector<long long> v2) -> long long {
        return ( v1[2] < v2[2] );
        });

    while (edges.size() > 0){
        vector<long long> edge = edges[0];
        edges.pop_front();
        if (!same(vectorTree,edge[0],edge[1])){
            unionTree(vectorTree,edge[0],edge[1]);
            total += edge[2];
        }
    }

    cout << total << endl;
    return 0;
}

Measured memory_bytes: 18224
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

int main(){
	int c[8];
	int N,S;
	cin>>N;
	for(int ds=1;ds<=N;ds++){
		printf("Case %d:\n",ds);
		cin>>S;
		for(int cnt=0;cnt<10;cnt++){
			S *= S;
			for(int i=0, w=1e7; i<8; i++, w/=10){
				c[i] = (S/w)%10;
			}
			S = 0;
			for(int i=2, w=1e3; i<6; i++, w/=10){
				S += c[i]*w;
			}
			printf("%d\n",S);
		}
	}
	return 0;
}

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

int main(){

    int x, y, z, tmp;

    cin >> x;

    if(x % 10 == 7){
        cout << "Yes" << endl;
    }else{
        y = x / 10;
        if(y % 10 == 7){
            cout << "Yes" << endl;
        }else{
            z = y / 10;
            if(z % 10 == 7){
                cout << "Yes" << endl;
            }else{
                cout << "No" << endl;
            }
        }
    }
    return 0;

}

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

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int begin = 0, end = s.size() - 1;
	int res = 0;
	while (begin < end) {
		while (begin < end && s[begin] == 'R') {
			begin++;
		}
		while (begin < end && s[end] == 'W') {
			end--;
		}
		if (begin < end) {
			res++;
			begin++;
			end--;
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 3756
#include <iostream>
#include <string>
using namespace std;
typedef long long int ll;

int main() {
    int K, A, B;
    bool flag;

    cin >> K >> A >> B;

    flag = false;
    for (int i = A; i <= B; i++){
        if (i%K == 0) flag = true;
    }

    if (flag) cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
}

Measured memory_bytes: 3644
/*input

*/
#include <bits/stdc++.h>
#define up(i,a,b) for(int (i) = (a);(i)<=(b);++(i))
#define down(i,b,a) for(int (i) = (b);i>=(a);--i)
#define debug(x) cerr << (x) << '\n';
#define bits(x,i) ((x >> i) & 1)
#define mid ((l+r)/2)
#define pr pair<int,int>
#define int long long
using namespace std;
const int N = 200005;
const int logN = 30;
int a[N], b[N];
int n;
vector<int> bitRep[logN];
long long cnt[logN];
signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	up(i,1,n) cin >> a[i];
	up(i,1,n) cin >> b[i];

	up(i,1,n) {
		int curVal = 0;
		for(int j=0;j<logN;++j){
			if (bits(a[i], j)) curVal += (1 << j);
			bitRep[j].push_back(curVal);
		}
	}
	up(i,0,logN-1) sort(bitRep[i].begin(), bitRep[i].end());
	// up(i,0,logN-1) {
	// 	for (auto v : bitRep[i]) cout << v << ' ';
	// 	cout << '\n';
	// }
	up(i,1,n){
		// count the number of bit 0.
		int bitVal = 0;
		for(int j=0;j<logN;++j){
			cnt[j] += n;
			if (!bits(b[i], j)){
				int pos = lower_bound(bitRep[j].begin(), bitRep[j].end(), (1 << j) - bitVal) - bitRep[j].begin();
				cnt[j] -= pos;
				// cout << b[i] << " "  << i << ' ' << j << ' ' << pos <<  ' ';
				pos = lower_bound(bitRep[j].begin(), bitRep[j].end(), (1 << (j+1)) - bitVal) - bitRep[j].begin();
				// cout << pos << ' ' << '\n';
				cnt[j] -= (int)bitRep[j].size() - pos;
			}
			else {
				bitVal += (1 << j);
				int l = lower_bound(bitRep[j].begin(), bitRep[j].end(), (1 << (j+1)) - bitVal) - bitRep[j].begin(), 
				r = lower_bound(bitRep[j].begin(), bitRep[j].end(), (1 << (j+1)) + (1 << j) - bitVal) - bitRep[j].begin();	
				// cout << i << ' '  << j << ' '  << l << ' ' << r << '\n';
				cnt[j] -=  r - l;
			}
		}
	}
	int ans = 0;
	up(i,0,logN-1){
		// cout << cnt[i] << ' ';
		if (cnt[i] & 1) ans += (1 << i);
	}
	cout << ans;
}


Measured memory_bytes: 53288
#include <bits/stdc++.h>
#define int long long
#define double long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define M   1000000007 // 1e9 + 7
#define MAXN 200100
using namespace std;
typedef pair<int,int> pii;
typedef pair<int,double> pdd;
inline int mod(int n, int m){int ret = n%m; if(ret < 0) ret += m; return ret;}
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }    else return mod(k*k,m);
}

int ok[30];

int32_t main(){
	fastio;
	int a,b;
	cin>>a>>b;
	if(a>9 || b>9)cout<<-1<<endl;
	else cout<<a*b<<endl;	
}

Measured memory_bytes: 256
import numpy as np

input()
a = np.fromiter(map(int, input().split()), int)
c = a.cumsum()
c2 = c.copy().astype(float)
c2[0] = c2[-1] = float('inf')
s = a.sum()
i = np.argmin(np.abs(c2 - s / 2))
print(abs(2 * c[i] - s))


Measured memory_bytes: 27696
#include <iostream>

int main() {
	int N;
  	std::cin >> N;
  	
  	int cnt = 1;
  	int max = 0;
  	std::cin >> max;
  	for (int i = 1; i < N; ++i) {
        int height = 0;
      	std::cin >> height;
      	if (height >= max) {
        	max = height;
          	++cnt;
        }
    }
  	std::cout << cnt << std::endl;
  
	return 0;
}

Measured memory_bytes: 256