akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include<math.h>
 
int main(void) {
  long double h,a,b,count=0;
  int n;
 
  
  scanf("%d %Lf",&n,&h);
  while(n--)
  {
      scanf("%Lf %Lf",&a,&b);
      long double c=sqrt(a*a+b*b);
      if(c<=h)
      count++;
  }
  printf("%.0Lf\n",count);
  return 0;
}

Measured memory_bytes: 2204
#include <iostream>

using namespace std;


int main(){
    
    int m, f, r;

    while(true){
        cin >> m >> f >> r;
        if(m==-1 && f==-1 && r==-1){
            break;
        }
        if(m==-1 || f==-1){
            cout << "F" << endl;
        }
        if(m!=-1 && f!=-1){
            if(m+f >= 80){
                cout << "A" << endl;
            }else if(m+f>=65 && m+f<80){
                cout << "B" << endl;
            }else if(m+f>=50 && m+f<65){
                cout << "C" << endl;
            }else if(m+f>=30 && m+f<50){
                if(r>=50){
                    cout << "C" << endl;
                }else{
                    cout << "D" << endl;
                }
            }else if(m+f<30){
                cout << "F" << endl;
            }
        }
    }

    return 0;
}




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

int main(){
  int H,W;
  cin >> H >> W;
  vector<string> s(H);
  for(int i=0;i<H;i++){
    cin >> s.at(i);
  }
  const int INF=1e8;
  vector<vector<int> >dp(H,vector<int>(W,INF));

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if((i==0)&&(j==0)){
        dp.at(i).at(j)=0;
        if(s.at(i).at(j)=='#'){
          dp.at(i).at(j)++;
        }
        continue;
      }
      if(i==0){
        dp.at(i).at(j)=dp.at(i).at(j-1);
        if(s.at(i).at(j)!=s.at(i).at(j-1)){
          dp.at(i).at(j)++;
        }
      }else if(j==0){
        dp.at(i).at(j)=dp.at(i-1).at(j);
        if(s.at(i).at(j)!=s.at(i-1).at(j)){
          dp.at(i).at(j)++;
        }
      }else{
        if(dp.at(i).at(j-1)<dp.at(i-1).at(j)){
          dp.at(i).at(j)=dp.at(i).at(j-1);
          if(s.at(i).at(j)!=s.at(i).at(j-1)){
            dp.at(i).at(j)++;
          }
        }else if(dp.at(i).at(j-1)>dp.at(i-1).at(j)){
          dp.at(i).at(j)=dp.at(i-1).at(j);
          if(s.at(i).at(j)!=s.at(i-1).at(j)){
            dp.at(i).at(j)++;
          }
        }else{
          dp.at(i).at(j)=dp.at(i-1).at(j);
          if((s.at(i).at(j)!=s.at(i-1).at(j))&&(s.at(i).at(j)!=s.at(i).at(j-1))){
            dp.at(i).at(j)++;
          }
        }
      }
    }
  }
  if(s.at(H-1).at(W-1)=='#'){
    dp.at(H-1).at(W-1)++;
  }
  cout << dp.at(H-1).at(W-1)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        final String b = sc.next();

        if ("A".equals(b)) System.out.println("T");
        if ("T".equals(b)) System.out.println("A");
        if ("C".equals(b)) System.out.println("G");
        if ("G".equals(b)) System.out.println("C");
    }
}


Measured memory_bytes: 22740
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <numeric>
#include <cstring>
#include <algorithm>
#include <random>
#include <deque>
#include <queue>
#include <ctime>

using namespace std;

using LL = long long;

void solve() {
    int x1,y1, x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int n;
    cin >> n;

    if(x1 > x2) {
        swap(x1, x2);
        swap(y1, y2);
    }

    bool rev = y1 > y2;
    if(rev) {
        y1 *= -1;
        y2 *= -1;
    }

    vector<pair<int, int>> a(n);
    for(auto &it : a) {
        cin >> it.first >> it.second;
        if(rev) {
            it.second *= -1;
        }
    }

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

    vector<int> cl;
    for(auto it : a)  {
        if (x1 <= it.first && it.first <= x2 &&
            y1 <= it.second && it.second <= y2) {
            cl.push_back(it.second);
        }
    }

    vector<int> dp(n + 1, 1000*1000*1000);
    dp[0] = -1000*1000*1000;
    for(int i = 0; i < cl.size(); ++i) {
        int pos = upper_bound(dp.begin(), dp.end(), cl[i]) - dp.begin();
        if(dp[pos - 1] < cl[i] && cl[i] < dp[pos])
            dp[pos] = cl[i];
    }

    int cnt = 0;
    for(int i = 0; i <= n; ++i) {
        if(dp[i] != 1000*1000*1000) {
            cnt = i;
        }
    }

    LL ans = 100*LL(abs(x2 - x1) + abs(y2 - y1)) - 20*cnt;

    if(cnt == abs(y2 - y1) + 1 || cnt == abs(x2 - x1) + 1) {
        cnt++;
    }

    cout << ans + 5.0*cnt*acos(-1) << endl;
}

int main() {
    cout.precision(30);
    solve();
}


Measured memory_bytes: 3444
N=int(input())
X=0
if N<=9:
  X=N
elif N<=99:
  X=9
elif N<=999:
  X=9+(N-100+1)
elif N<=9999:
  X=9+900
elif N<=99999:
  X=909+(N-10000+1)
elif N<=100000:
  X=90909
print(X)

Measured memory_bytes: 2940
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    int n,k,x;
    cin>>n>>k;
    vector<int>vec;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        vec.pb(x);
    }
    int sum=0;
    sort(vec.begin(),vec.end());
    for(int i=0;i<k;i++)
    {
        sum+=vec[i];
    }
    cout<<sum<<endl;
    return 0;

}





































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

int main()
{
    // input
    int n,m;
    cin >> n >> m;
    vector<int> l(m);
    vector<int> r(m);
    rep(i,m){
        cin >> l[i] >> r[i];
        l[i]--;r[i]--;
    }

    // solve
    int L=0;
    int R=n-1;
    rep(i,m){
        L = max(L,l[i]);
        R = min(R,r[i]);
    }


    // output
    int ans = R-L+1;
    ans = max(ans,0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
N = int(input())
his = list(map(int, input().split()))

if N == 1:
    print("Yes")
else:
    for ri in reversed(range(1, N)):
        if his[ri] == his[ri - 1]:
            continue
        elif his[ri - 1] - his[ri] == 1:
            his[ri - 1] -= 1
        elif his[ri - 1] - his[ri] > 1:
            print("No")
            exit()
    print("Yes")


Measured memory_bytes: 14276
N,M = gets.chomp.split(" ").map(&:to_i)
strs = M.times.map{gets.split.map(&:to_i)}

strs.sort_by! { |a, b| b }

expect_bridge = 0
ans = 0
strs.each do |a, b|
  next if a <= expect_bridge
  ans += 1
  expect_bridge = b - 1
end
puts ans

Measured memory_bytes: 14456
while True:
    n=input()
    if n == 0: break
    a=[input() for i in range(n)]
    m=max(a)
    if m<=0: print m
    else:
        ans,temp=0,0
        for i in a:
            temp=max(0,temp+i)
            ans=max(ans,temp)
        print ans
#temp
       

Measured memory_bytes: 4452
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
   int a, b, h;
   cin >> a >> b >> h;
   cout << (a + b) * h / 2.0 << endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 N;
  string S;
  cin >> N >> S;
  vector<i64> cntR(N + 1), cntG(N + 1), cntB(N + 1);
  for (i64 i = 0; i < N; i++)
  {
    cntR[i + 1] = cntR[i] + (S[i] == 'R');
    cntG[i + 1] = cntG[i] + (S[i] == 'G');
    cntB[i + 1] = cntB[i] + (S[i] == 'B');
  }
  i64 ans = 0;
  for (i64 i = 1; i < N - 1; i++)
    for (i64 j = 0; j < i; j++)
    {
      if (S[i] == 'R')
      {
        if (S[j] == 'G')
          ans += cntB[N] - cntB[i] - (i + i - j < N && S[i + i - j] == 'B' ? 1 : 0);
        else if (S[j] == 'B')
          ans += cntG[N] - cntG[i] - (i + i - j < N && S[i + i - j] == 'G' ? 1 : 0);
      }
      else if (S[i] == 'G')
      {
        if (S[j] == 'R')
          ans += cntB[N] - cntB[i] - (i + i - j < N && S[i + i - j] == 'B' ? 1 : 0);
        else if (S[j] == 'B')
          ans += cntR[N] - cntR[i] - (i + i - j < N && S[i + i - j] == 'R' ? 1 : 0);
      }
      else
      {
        if (S[j] == 'R')
          ans += cntG[N] - cntG[i] - (i + i - j < N && S[i + i - j] == 'G' ? 1 : 0);
        else if (S[j] == 'G')
          ans += cntR[N] - cntR[i] - (i + i - j < N && S[i + i - j] == 'R' ? 1 : 0);
      }
    }
  cout << ans << endl;
  return 0;
}


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

#define FOR(i, j, n) for (int i(j); i < n; ++i)
#define FORR(v, c) for (auto &v : c)
#define F first
#define S second
#define SQ(x) (x)*(x)
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define dbg(x) cerr<<#x<<" = " << (x) << endl
#define pnl(x) cout << x << '\n'
#define pns(x) cout << x << ' '
#define read(x) cin >> x
#define read2(x,y) cin >> x >> y
#define read3(x, y, z) cin >> x >> y >> z
#define read4(a, b, c, d) cin >> a >> b >> c >> d
#define readv(v) FORR(c,v) read(c)

struct Arrete { int v, c;};
struct Point {int x, y; double distance(Point other) const {return sqrt(SQ(x-other.x)+SQ(y-other.y));}};

typedef	vector<int>	vi;
typedef pair<int,int>	ii;
typedef vector<string>	vs;
typedef vector<ii>	vii;
typedef vector<Arrete>	vg;
typedef vector<long long>	vl;
typedef	long long ll;

const int MAXK = 1e5+1;


// win[k] = true if you win when at k coins

bool win[MAXK];

int		main(void)
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	int N, K;
	read2(N, K);

	vi a(N);
	readv(a);

	win[0] = false;
	for (int i(1); i <= K; ++i)
		for (auto e : a)
			if (i - e >= 0)
				win[i] |= not win[i-e];
	if (win[K])
		pnl("First");
	else
		pnl("Second");
}



Measured memory_bytes: 384
stdin.ReadLine().ToCharArray()
|> Array.mapi (fun i x ->
    if (i % 2 = 0 && x = 'L') || (i % 2 = 1 && x = 'R') then 1
    else 0)
|> Array.sum
|> fun s ->
    if s > 0 then "No"
    else "Yes"
|> stdout.WriteLine

Measured memory_bytes: 11220
n=input()
a=input().split()
a=[int(i) for i in a]
x=sum(a)
y=0
z=0
for i in a:
    y+=i
    if y>=x//2:
        z=y
        z-=i
        break
y2=x-y
yy=abs(y-y2)
z2=x-z
zz=abs(z-z2)
print(min(yy,zz))



Measured memory_bytes: 3060
/* ---------- STL Libraries ---------- */

// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */

using namespace std;

/* ---------- Type Abbreviation ---------- */

using ll = long long;

template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using GPQ = priority_queue<T, vector<T>, greater<T>>;

#define mp make_pair
#define mt make_tuple

/* ----------- debug ---------- */

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p);

template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
    os << "[";
    for (auto vv : v)
        os << vv << ",";
    return os << "]";
}

template <class T>
ostream& operator<<(ostream& os, set<T> v) {
    os << "[";
    for (auto vv : v)
        os << vv << ",";
    return os << "]";
}

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
    return os << "(" << p.first << "," << p.second << ")";
}

/* ---------- Constants ---------- */

// const ll MOD = 1000000007;
// const ll MOD = 998244353;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* ---------- Short Functions ---------- */

template <typename T>
inline T sq(T a) { return a * a; }

template <typename T>
T gcd(T a, T b) {
    if (a > b) return gcd(b, a);
    return a == 0 ? b : gcd(b % a, a);
}

template <typename T, typename U>
T mypow(T b, U n) {
    if (n == 0) return 1;
    if (n == 1) return b /* % MOD */;
    if (n % 2 == 0) {
        return mypow(b * b /* % MOD */, n / 2);
    } else {
        return mypow(b, n - 1) * b /* % MOD */;
    }
}

ll pcnt(ll b) {
    return __builtin_popcountll(b);
}

template <typename T>
T iceil(T n, T d) {
    return (n + d - 1) / d;
}

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

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


Measured memory_bytes: 256
#ifndef INCLUDED_ROLLING_HASH_HPP
#define INCLUDED_ROLLING_HASH_HPP

#include <vector>
#include <string>

class rolling_hash {
public:
	using u64 = std::uint_fast64_t;
	using size_type = std::uint_fast32_t;
	using i128 = __int128_t;

	static constexpr u64 MOD = (1uL << 61) - 1;
	static constexpr u64 base = 20200213;

	std::string str;
	std::vector<u64> hash_, pow;

private:
	static constexpr u64 mask30 = (1ul << 30) - 1;
	static constexpr u64 mask31 = (1ul << 31) - 1;

	u64 mul(i128 a, i128 b) const {
		i128 t = a * b;		
		t = (t + ((t & MOD) << 61) - (t & MOD)) >> 61;
		
		if(t >= MOD) return t - MOD;
		return t;
	}
	size_type xorshift(size_type x) const {
		x ^= x << 13;
		x ^= x >> 17;
		x ^= x << 5;
		return x;
	}

public:
	rolling_hash(const rolling_hash &) = default;
	rolling_hash(rolling_hash&&) = default;

	rolling_hash() : str() {};
	rolling_hash(const std::string & str) : str(str) {
		hash_.resize(str.size() + 1, 0);
		pow.resize(str.size() + 1, 1);
		for(size_type i = 0; i < str.size(); i++) {
			hash_[i + 1] = mul(hash_[i], base) + xorshift(str[i] + 1);
			pow[i + 1] = mul(pow[i], base);
			if(hash_[i + 1] >= MOD) hash_[i + 1] -= MOD;
		}
	}

	u64 hash() const { return hash_.back(); }
	u64 hash(size_type l, size_type r) const {
		u64 ret = MOD + hash_[r] - mul(hash_[l], pow[r - l]);
		return ret < MOD ? ret : ret - MOD;
	}
	
	size_type size() const { return str.size(); }
};

#endif

#include <iostream>

int main() {
	int n; scanf("%d", &n);
	std::string s; std::cin >> s;
	
	int ans = 0;
	rolling_hash hash(s);
	for(int i = 0; i < s.size(); i++) {
		for(int j = i; j < s.size(); j++) {
			while(i + ans < j and j + ans < n) {
				if(hash.hash(i, i + ans + 1) != hash.hash(j, j + ans + 1)) break;
				ans++;
			}
		}
	}

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


Measured memory_bytes: 512
x,y=map(int,input().split())

a=(x+y)//3
n=(2*x-y)//3
m=a-n

mod=10**9+7 

def nCr(n, r, mod):#mod=10**9+7 
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

if n<0 or m<0 or (x+y)%3!=0:
      print(0)
      exit()

print(nCr(a,n,mod))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    int A, B, K;
    cin >> A >> B >> K;
    
    for(int i=0;i<K;i++){
        // 高橋君
        if(A%2 == 1){
            A--;
        }
        B += A/2;
        A = A/2;
        i++;
        if(i==K)
            break;
        // 青木君
        if(B%2 == 1){
            B--;
        }
        A += B/2;
        B = B/2;
    }

    cout << A << " " << B << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
int main()
{
	int n;
	int a,b,c,d;
	string s;
	cin>>n>>a>>b>>c>>d;
	cin>>s;
	bool ok=1;
	for(int i=b;i<=d-1;i++)
	{
		if(s[i]=='#'&&s[i-1]=='#') 
		{
			ok=0;
			break;
		}
	}
	for(int i=a;i<=c-1;i++)
	{
		if(s[i]=='#'&&s[i-1]=='#')
		{
			ok=0;break;
		}
	}
	if(c>d){
		bool cango=0;
		for(int i=max(1,b-1);i<d;i++)
		{
			if(s[i]=='.'&&s[i-1]=='.'&&s[i+1]=='.') cango=1;
		}
		if(!cango) ok=0;
	}
	if(ok) puts("Yes");
	else puts("No");
}


Measured memory_bytes: 640
n, m = map(int, input().split())
a = []
b = []
for i in range(m):
  l = list(map(int, input().split()))
  a.append(l[0])
  b.append(l[1])
cnt = 0

for i in range(1, n+1):
  for j in range(m):
    if a[j] == i:
      cnt += 1
    if b[j] == i:
      cnt += 1
  print(cnt)
  cnt = 0


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp make_pair
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

class UnionFind {
public:
  vector<int> par, rank;
  UnionFind(int sz) : par(sz, -1), rank(sz, 0){}
  int find(int x){
    if(par[x]<0) return x;
    else return par[x] = find(par[x]);
  }
  void unite(int x, int y){
    x=find(x); y=find(y);
    if(x==y) return;
    if(rank[x] < rank[y]) swap(x,y);
    par[x] += par[y];
    par[y] = x;
    if(rank[x]==rank[y]) rank[x]++;
  }
  inline bool same(int x, int y){ return find(x) == find(y); }
  inline int size(int x){ return -par[find(x)]; }
};

int main(){
  int n,m;
  cin>>n>>m;
  UnionFind uf(n);
  rep(i,m){
    int s,t;
    cin>>s>>t;
    s--;t--;
    uf.unite(s,t);
  }

  int ans = 0;
  rep(i,n){
    if(uf.size(i)==1) ans++;
    else if(uf.par[i]<0) ans--;
  }
  cout << abs(ans) << endl;

  return 0;
}



Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
    int N;
    cin >> N;
    vll A(N);
    cin >> A;
    while(1){
        sort(A.begin(),A.end());
        int st=1;
        ll a = 0;
        REP(i,N-1){
            if(0 != A[i]){
                st=i;
                a = A[i];
                break;
            }
        }
        if(0 == a)break;
        for(int i=st+1; i<N; i++){
            A[i] %= a;
        }
    }
    cout << A[N-1] << endl;
}

Measured memory_bytes: 3980
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N,K=get_i
puts K*(K-1)**(N-1)

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  string s;std::cin >> s;
  string t;std::cin >> t;
  re(i, t.size()) std::cout << s[i] << t[i];
  if(s.size()!=t.size()) std::cout << s[s.size()-1] << '\n';
  else std::cout << '\n';
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=1050;
//ここまでテンプレ
int main(){
	ll N,K;
	cin>>N>>K;
	ll ans=0;
	for(ll b=1;b<=N;b++){
		ans+=(N/b)*max(b-K,0LL);
		ans+=max(N%b-K+1,0LL);
		ans-=(0%b>=K);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        Integer[] lArr = new Integer[n];

        for (int i = 0; i < n; i++) {
            lArr[i] = sc.nextInt();
        }

        Arrays.sort(lArr, Collections.reverseOrder());

        int max = 0;
        for (int i = 0; i < k; i++) {
            max += lArr[i];
        }

        System.out.println(max);
    }
}


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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int A,B,N;
    Scd3(N,A,B);
    int x = min(A,B);
    int y = max(0,A+B-N);
    printf ("%d %d\n", x, y);

    return 0;
}



Measured memory_bytes: 256
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

S = i_s()


if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
inpl = lambda: list(map(int,input().split()))
def gcd(a, b):
    if a < 0: a = -a
    if b < 0: b = -b
    while b > 0:
        (a, b) = (b, a % b)
    return a

N, X = inpl()
x = inpl()
D = abs(x[0]-X)
for i in range(1,N):
  D = gcd(D, x[i]-X)
print(D)

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

using namespace std;

int main() {
	string a, b, c;

	cin >> a >> b >> c;

	cout << char(a.front() - ('a' - 'A')) << char(b.front() - ('a' - 'A')) << char(c.front() - ('a' - 'A')) <<endl;


	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>


/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
*/


#define int long long
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound


#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()


using namespace std;
typedef long long ll;
typedef char ch;
typedef string str;
typedef vector <long long> vl;
typedef vector <int> vi;
typedef vector<vector<long long>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<pair<ll, ll>>> vvpll;
typedef vector<vector<pair<int, int>>> vvpii;
typedef vector<char> vch;
typedef vector<vector<char>> vvch;
typedef vector<string> vs;
typedef map<ll, ll> mll;
typedef map<int, int> mii;
typedef map<int, ch> mich;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef unsigned long long ull;


string to_string(long long x) {
    string s;
    bool neg = x < 0;
    x = abs(x);
    do {
        s += char('0' + x % 10);
        x /= 10;
    } while (x != 0);
    if (neg)
        s += '-';
    reverse(s.begin(), s.end());
    return s;
}

ll powmod(ll a, ll b, ll mod) {
    if (b == 0 || a == 1)
        return mod == 1 ? 0 : 1;

    ll k = powmod(a, b / 2, mod);
    k = k * k % mod;
    if (b & 1)
        k = k * a % mod;
    return k;
}

ll pow10(ll a, ll b) {
    if (b == 0 || a == 1)
        return 1;
    ll k = pow10(a, b / 2);
    k *= k;
    if (b & 1)
        k *= a;
    return k;
}

ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

bool is_prime(ll n) {
    ll bound = sqrt(n);
    ll d = 2;
    while (d <= bound && n % d != 0)
        ++d;
    return d * d > n;
}


const int MOD = 1000000007;
const int MOD2 = 1000000009;
const int BASE = 257;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 100010;
const double EPS = 1e-9;
const int DI[]{1, -1, 0, 0};
const int DJ[]{0, 0, 1, -1};


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int32_t main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    int sum = 0;
    fi(1, n + 1) {
        if (i % 3 && i % 5)
            sum += i;
    }
    cout << sum;

}


Measured memory_bytes: 3680
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            var Ai = Sarray();
            //+から
            var ansp = 0L;
            var ansm = 0L;
            var sump = 0L;
            var summ = 0L;
            for (var i = 0; i < N; ++i)
            {
                sump += Ai[i];
                summ += Ai[i];
                if (i % 2 == 0)
                {
                    if (sump < 1)
                    {
                        ansp += -sump + 1;
                        sump = 1;
                    }
                    if (-1 < summ)
                    {
                        ansm += summ + 1;
                        summ = -1;
                    }
                }
                else
                {
                    if (-1 < sump)
                    {
                        ansp += sump + 1;
                        sump = -1;
                    }
                    if (summ < 1)
                    {
                        ansm += -summ + 1;
                        summ = 1;
                    }
                }
            }
            WriteLine(Min(ansp, ansm));
            //Out.Flush();
        }
    }
}

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

int main() {
    vector<int> a{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << a[k-1] << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <chrono>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using llong = long long;
using ullong = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()
#define loop(i, times) for(llong i = 0; i < times; i++)
#define rloop(i, times) for(llong i = times -1; 0 <= i; i--)

std::chrono::system_clock::time_point  start;

void TimeStart(void)
{
	start = std::chrono::system_clock::now();
}

void TimeEnd(void)
{
	auto time = std::chrono::system_clock::now() - start;
	auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count();
	cerr << endl <<msec << " msec" << endl;
}

#endif


int main()
{
	string b; cin >> b;
	if (b == "A")
	{
		cout << "T";
		return 0;
	}
	if (b == "T")
	{
		cout << "A";
		return 0;
	}
	if (b == "G")
	{
		cout << "C";
		return 0;
	}
	if (b == "C")
	{
		cout << "G";
		return 0;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int> v;
int n;
int main(){
	scanf("%d", &n);
	set<int> s;
	int temp = n, i = 1;
	s.insert(temp);
	while(true){
		temp = (n%2 == 0? n/2:(3*n+1));
		if(s.count(temp)){
			i++;
			break;
		}
		s.insert(temp);
		n = temp;
		i++;
	}
	printf("%d", i);
	return 0;
}


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

using namespace std;
using ll = long long;

using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

const long long INF = 1LL<<60;
const int mod = 1000000007;

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

int N;
string s;
vector<vector<ll>> dp;

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

    cin >> N >> s;

    dp.assign(N + 1, vector<ll>(N + 1, 0));
    REP(i, N) dp[0][i] = 1;

    for (int i = 0; i < N; i++) {
        vector<ll> S(N + 1, 0);
        for (int j = 0; j < N; j++) {
            S[j + 1] = S[j] + dp[i][j];
            S[j + 1] %= mod;
        }
        for (int j = 0; j < N; j++) {
            if (s[i] == '>') {
                dp[i + 1][j] = S[j + 1];
            } else if (s[i] == '<') {
                dp[i + 1][j] = (S[N - i] - S[j + 1] + mod) % mod;
            }
        }
    }

    cout << dp[N - 1][0] << endl;


    
    return 0;
}

Measured memory_bytes: 70784
n, m = map(int, input().split())
h = list(map(int, input().split()))

arcs = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    arcs[a-1].append(b-1)
    arcs[b-1].append(a-1)

c = 0
for i in range(n):
    if not arcs[i]:
        c += 1
        continue
    if max(map(lambda x: h[x], arcs[i])) < h[i]:
        c += 1
        continue

print(c)


Measured memory_bytes: 92948
#include <cstdio>
#include <vector>

typedef std::vector<int> V;

V solve(int a, int b, int S)
{
	V ans;
	if(S == 1)
	{
		ans.push_back(a);
		ans.push_back(b);
		return ans;
	}
	int id = -1, cnt = 0, c;
	for(int i = 0; i < S; i++)
	{
		if(((a >> i) & 1) != ((b >> i) & 1)) id = i;
		if((a >> i) & 1) cnt++;
	}
	
	int k = (a >> id) & 1;
	if(k) cnt--, a ^= 1 << id;
	else b ^= 1 << id;
	if(cnt & 1) c = 0;
	else c = 1;
	
	int A = a & ((1 << id) - 1);
	int _a = (a - A) >> 1;
	
	int B = b & ((1 << id) - 1);
	int _b = (b - B) >> 1;
	
	ans = solve(A + _a, c, S - 1);
	V cur = solve(c, B + _b, S - 1);
	
	int siz = ans.size();
	for(int i = 0; i < siz; i++)
	{
		int v = ans[i] & ((1 << id) - 1);
		ans[i] = ((ans[i] - v) << 1) + (k << id) + v;
	}
	
	siz = cur.size();
	for(int i = 0; i < siz; i++)
	{
		int v = cur[i] & ((1 << id) - 1);
		ans.push_back(((cur[i] - v) << 1) + ((k ^ 1) << id) + v);
	}
	
	return ans;
}

int main()
{
	int n, a, b; scanf("%d%d%d", &n, &a, &b);
	int cnt = 0;
	for(int i = 0; i < n; i++)
	{
		if(((a >> i) & 1) != ((b >> i) & 1)) cnt++;
	}
	if(!(cnt & 1)) return 0 * puts("NO");
	V ans = solve(a, b, n);
	int S = ans.size();
	puts("YES");
	for(int i = 0; i < S; i++) printf("%d ", ans[i]);
}

/*A和B的不同的二进制位的个数为奇数就有解
构造方式：
找到不同的一位
a0b
...
c1d

a0b
...
e0f
e1f
...
c1d

然后a0b -> e0f 和 e1f -> c1d 就是子问题了
    ab  -> ef     ef  -> cd
*/ 

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

int main(){
	int n,r;
	cin>>n;
	int minr=1;
	int maxv=-2000000000;
	for(int i=0;i<n;i++){
		cin>>r;
		if(i>0){
			if(maxv<(r-minr))
				maxv=r-minr;
			if(r<minr)
				minr=r;
		}else{
			minr=r;
		}
	}
	cout<<maxv<<endl;
	return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <ctime>
#include <random>
#include <bitset>
#include <climits>
#include <cstring>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) 
#define ll long long
#define eps 1e-8
#define inf 1e6
using namespace std;

vector<int>v;
int n, A, B, C;

int dfs(int pos, int a, int b, int c) {
	if (pos == n) {
		if (min({ a,b,c }) > 0)
			return abs(a - A) + abs(b - B) + abs(c - C) - 30;
		else
			return inf;
	}
	int q = dfs(pos + 1, a, b, c), 
		w = dfs(pos + 1, a + v[pos], b, c) + 10,
		e = dfs(pos + 1, a, b + v[pos], c) + 10, 
		r = dfs(pos + 1, a, b, c + v[pos]) + 10;
	return min({ q,w,e,r });
}

int main() {
	speed;
	cin >> n >> A >> B >> C;
	v.resize(n);
	for (int i = 0; i < n; ++i)
		cin >> v[i];
	cout << dfs(0, 0, 0, 0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<pair<string,int>,int> P;
P a[105];
string s;
int d;
int n;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>s>>d;
		a[i].first=make_pair(s,-d);
		a[i].second=i;
	}
	sort(a+1,a+1+n);
	for(int i=1;i<=n;i++)
	{
		cout<<a[i].second<<endl;
	}

 } 

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

int main() {
  int N;
  cin >> N;
  vector<int> dan(N);
  for (int i = 0; i < N; i++) {
    cin >> dan.at(i);
  }
  
  int y = 0;
  int M = 0;
  while (y < N - 1) {
  int i = y + 1;
  int x = 0;
  while (dan.at(i - 1) >= dan.at(i)) {
    x++;
    i++;
    if (i >= N) {
      break;
    }
  }
  y += x + 1;
  M = max(M, x);
  }

  cout << M <<endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
#include <float.h>

inline double cross_product_z(double v0x, double v0y, double vx, double vy) {
    return v0x * vy - v0y * vx;
}

int main() {
    int x, y, x0, y0, x1, y1;
    int q;
    double v0x, v0y, vx, vy, cp, cosa, denom, v0v, vv;
    const char *judge;
    const char *message[] = {
        "COUNTER_CLOCKWISE",
        "CLOCKWISE",
        "ONLINE_BACK",
        "ONLINE_FRONT",
        "ON_SEGMENT"
    };

    scanf("%d %d %d %d", &x0, &y0, &x1, &y1);
    scanf("%d", &q);

    v0x = x1 - x0;
    v0y = y1 - y0;
    
    while (q--) {
        scanf("%d %d", &x, &y);
        vx = x - x0;
        vy = y - y0;
        cp = cross_product_z(v0x, v0y, vx, vy);
        if (cp > 0) {
            judge = message[0];
        }
        else if (cp < 0) {
            judge = message[1];
        }
        else {
            v0v = v0x*v0x+v0y*v0y;
            vv = vx*vx+vy*vy;
            denom = sqrt(v0v) * sqrt(vv);
            if (denom < DBL_MIN) {
                judge = message[4];
            }
            else {
                cosa = (v0x*vx + v0y*vy)/denom;
                if (fabs(cosa + 1) < 0.1e-10) {
                    judge = message[2];
                }
                else {
                    if (v0v < vv) {
                        judge = message[3];
                    }
                    else {
                        judge = message[4];
                    }
                }
            }

        }
        printf("%s\n", judge);
    }
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

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

    vector<lint> a(3*n);
    for(auto& e : a)  cin >> e;
    sort(begin(a), end(a));
    reverse(begin(a), end(a));

    vector<lint> odd;
    for(lint i=0; i<3*n; i++) {
        if(i%2)  odd.push_back(a[i]);
    }

    cout << accumulate(begin(odd), begin(odd) + n, 0LL) << endl;
}


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

int main() {
  int num;
  int kekka = 0;
  bool chk = true;
  string tmp;
  
  cin >> num;
  
  vector<string> vec(num);
  for(int i = 0; i < num; i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end(), greater<string>());
  vec.erase(unique(vec.begin(),vec.end()),vec.end());
  cout << vec.size();
}


Measured memory_bytes: 9472
#include<iostream>
#include<map>
#include<string>
using namespace std;
int main(){
map<string,int> m{
{"SUN",7},
{"MON",6},
{"TUE",5},
{"WED",4},
{"THU",3},
{"FRI",2},
{"SAT",1}
};
string s;
cin >> s;
cout << m[s] << endl;
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  vector<int> hill(10);
  for(int i=0; i<10; i++) cin >>hill[i];
  sort(hill.begin(),hill.end());
  for(int i=9; i>6; i--) cout <<hill[i]<<endl;
  return 0;
}

Measured memory_bytes: 1212
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True  and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,a,b,c = inm()
l = []
for i in range(n):
    l.append(inn())
mn = BIG
for i in range(4**n):
    la = []
    lb = []
    lc = []
    x = i
    for j in range(n):
        y = x%4
        if y==1:
            la.append(l[j])
        if y==2:
            lb.append(l[j])
        if y==3:
            lc.append(l[j])
        x //= 4
    if len(la)==0 or len(lb)==0 or len(lc)==0:
        continue
    cost = len(la)*10-10 + abs(sum(la)-a) + \
           len(lb)*10-10 + abs(sum(lb)-b) + \
           len(lc)*10-10 + abs(sum(lc)-c)
    mn = min(mn, cost)
    if DBG and cost==110:
        print("la {} lb {} lc {}".format(la,lb,lc))
print(mn)


Measured memory_bytes: 3064
N, M = map(int, input().split())
H = [int(x) for x in input().split()]

d = [1] * N

for i in range(M):
    A, B = map(int, input().split())
    if H[A - 1] >= H[B - 1]:
        d[B - 1] = 0
    if H[A - 1] <= H[B - 1]:
        d[A - 1] = 0


print(sum(d))


Measured memory_bytes: 20016
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int k;
    int n;
    int Max = -1;
    int startPos = 0;
    int a[200001];
    int ans = 0;

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

    if(startPos == 0) ans -= (k - a[n-1] + a[0]);
    else ans -= (a[startPos] - a[startPos-1]);


    cout << ans;

    return 0;
}

Measured memory_bytes: 4432
#include<stdio.h>
#include<math.h>

typedef struct{
  double x;
  double y;
}Point;

void koch(int,Point,Point);

int main(){
  int n;
  scanf("%d",&n);
  Point endleft,endright;
  endleft.x=0;
  endleft.y=0;
  endright.x=100;
  endright.y=0;
  printf("%.8f %.8f\n",endleft.x,endleft.y);
  koch(n,endleft,endright);
  printf("%.8f %.8f\n",endright.x,endright.y);
    
  return 0;
}

void koch(int n,Point p1,Point p2){
  if(n==0)return;
  Point s,t,u;
  s.x=(2.0*p1.x+1.0*p2.x)/3.0;
  s.y=(2.0*p1.y+1.0*p2.y)/3.0;
  t.x=(1.0*p1.x+2.0*p2.x)/3.0;
  t.y=(1.0*p1.y+2.0*p2.y)/3.0;
  u.x=(t.x-s.x)*cos(M_PI/3.0)-(t.y-s.y)*sin(M_PI/3.0)+s.x;
  u.y=(t.x-s.x)*sin(M_PI/3.0)+(t.y-s.y)*cos(M_PI/3.0)+s.y;
  koch(n-1,p1,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(n-1,t,p2);
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
//#pragma comment(linker,"/STACK:1024000000,1024000000")
//251103FD
using namespace std;
#define PB pop_back
#define PF pop_front
#define np next_permutation
#define eb emplace_back
#define bf push_front
#define mp make_pair
#define s second
#define f first
#define mt make_tuple
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
#define forn(i, a) for(int i=0; i<a; ++i)
#define Forn(i, a) for(int i=1; i<=a; ++i)
#define read(x) ((scanf("%s", &_), (x) = _))
#define INF 1e9
#define memINF 127
#define inf 1e18
#define all(x) x.begin(), x.end()
#define MOD 1e9+7 
#define HASH 1543 

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<pi,int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef unsigned int uint;

using namespace std;

inline int in() 
{
    int x=0, c;
    for(; (uint)((c=getchar())-'0')>=10;) 
	{ 
		if(c=='-') 
			return -in(); 
		if(!~c)
			throw ~0; 
	}
    do 
	{ 
		x=(x<<3)+(x<<1)+(c^48); 
	} 
	while((uint)((c=getchar())^48)<10);
    return x;
}
inline int gcd(int a, int b){if(a>b) swap(a, b); return a==0?b:gcd(b%a, a);}
inline int lcm(int a, int b){return a*b/gcd(a, b);}

int N, M, par[400010], ranks[400010], a, b, c, dist[400010], all, newNode[400010], pa;
vector<pi> e[1000010];
vi adj[400010];
bool used[400010];

inline int find(int x)
{
	return par[x]==x?x:par[x]=find(par[x]);
}

inline void unite(int x, int y)
{
	x=find(x), y=find(y);
	if(x==y)
		return;
	if(ranks[x]<ranks[y])
		par[x]=y;
	else
	{
		par[y]=x;
		if(ranks[x]==ranks[y])
			ranks[x]++;
	}
}

int main()
{
	while(~scanf("%d %d",&N,&M))
	{
		while(M--)
		{
			a=in(), b=in();
			e[in()].eb(mp(a, b));
		}
		all=N;
		Forn(i, 1000000)
		{
			if(e[i].empty())
				continue;
			foreach(it, e[i])
	        {
	            used[it->f]=used[it->s]=false,
	            newNode[it->f]=newNode[it->s]=-1,
	            ranks[it->f]=ranks[it->s]=0;
	            par[it->f]=it->f;
				par[it->s]=it->s;
	        }
			foreach(it, e[i])
				unite(it->f, it->s);
			foreach(it, e[i])
	        {
	            if(!used[it->f])
	            {
	                used[it->f]=true;
	                pa=find(it->f);
	                if(newNode[pa]<=0)
	                    newNode[pa]=++all;
	                adj[it->f].eb(newNode[pa]);
	                adj[newNode[pa]].eb(it->f);
	            }
	            if(!used[it->s])
	            {
	                used[it->s]=true;
	                pa=find(it->s);
	                if(newNode[pa]<=0)
	                    newNode[pa]=++all;
	                adj[it->s].eb(newNode[pa]);
	                adj[newNode[pa]].eb(it->s);
	            }
	        }
		}
		queue<int> q;
		q.push(1);
		memset(dist, -1, sizeof(dist));
		dist[1]=0;
		while(!q.empty())
		{
			int cur=q.front();
			q.pop();
			foreach(it, adj[cur])
				if(dist[*it]<0)
					dist[*it]=dist[cur]+1, q.push(*it);
		}
		if(dist[N]<0)
			puts("-1");
		else
			printf("%d\n", dist[N]>>1);
		forn(i, all+1)
	    {
	    	e[i].clear();
	    	adj[i].clear();
	    	used[i]=0;
	    	newNode[i]=0;
	    }
	}
	return 0;
}


Measured memory_bytes: 55040
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: usize,
        x: Chars,
    }

    let p = x.iter().filter(|&c| *c == '1').count() as i64;

    let mut p2p1 = 0;
    let mut d = 1 % (p + 1);
    let mut dp1 = vec![0; n];
    for i in (0..n).rev() {
        if x[i] == '1' {
            p2p1 += d;
            p2p1 %= p + 1;
        }
        dp1[i] = d;
        d *= 2;
        d %= p + 1;
    }
    let mut p2m1 = 0;
    let mut dm1 = vec![0; n];
    if p > 1 {
        let mut d = 1 % (p - 1);
        for i in (0..n).rev() {
            if x[i] == '1' {
                p2m1 += d;
                p2m1 %= p - 1;
            }
            dm1[i] = d;
            d *= 2;
            d %= p - 1;
        }
    }

    for i in 0..n {
        let p2;
        if x[i] == '1' {
            p2 = p - 1;
        } else {
            p2 = p + 1;
        }
        if p2 == 0 {
            println!("0");
            continue;
        }
        if p2 == 1 {
            println!("1");
            continue;
        }

        let mut y;
        if x[i] == '0' {
            y = p2p1;
            y += dp1[i];
            y %= p2;
        } else {
            y = p2m1;
            y += p2 - dm1[i];
            y %= p2;
        }

        let mut res = 1;
        while y != 0 {
            y %= y.count_ones() as i64;
            res += 1;
        }
        println!("{}", res);
    }
}


Measured memory_bytes: 6232
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a;
    std::deque<int> deq;
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> a;
        deq.emplace_back(a);
    }
    auto result = unique(deq.begin(),deq.end());
    deq.erase(result,deq.end());
    for (int j=0;j<deq.size();j++) {
        if ( j==deq.size()-1 ) {
            cout << deq[j] << endl;
        } else {
            cout << deq[j] << " ";
        }
    }
}



Measured memory_bytes: 3404
import numpy as np
A, B, C, D, E = [int(input()) for i in range(5)]

x = np.array([A, B, C, D, E])
ans = int((np.ceil((x / 10)) * 10).sum())
x = x %10

if x.sum()==0:
    tmp = 0
else:
    tmp = 10 - x[np.where(x>0)].min()

ans = ans - tmp

print(ans)

Measured memory_bytes: 12512
import math
 
# Input the amount of money Takahashi paid
N = int(input())
 
# Find nearest integer price more than or equal to X/1.08
X = math.ceil(N / 1.08)
 
# Check if the "taxed price" is equal to N yen
if int(X * 1.08) == N:
	print(X)
else:
	print(":(")

Measured memory_bytes: 3060