akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
	string S;
	cin >> S;
	vector<string> a{ "Cloudy", "Rainy", "Sunny" };
	cout << a[(1 + find(a.begin(), a.end(), S) - a.begin()) % 3];
}

Measured memory_bytes: 256
package main

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

var stdin = bufio.NewScanner(os.Stdin)

func main() {
	stdin.Split(bufio.ScanWords)
	A := nextInt64()
	B := nextFloat64()
	fmt.Println(A * int64(math.Round((B * 100))) / 100)
}

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

func nextInt64() int64 {
	stdin.Scan()
	i, err := strconv.ParseInt(stdin.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func nextFloat64() float64 {
	stdin.Scan()
	i, err := strconv.ParseFloat(stdin.Text(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func nextStr() string {
	stdin.Scan()
	i := stdin.Text()
	return i
}


Measured memory_bytes: 1728
use std::io;
use std::iter::Iterator;

fn read<T: std::str::FromStr>() -> Vec<T> {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().split(' ').flat_map(str::parse).collect()
}

fn main() {
    let l1 = read::<f64>();

    let r = l1[0];

    const PI: f64 = std::f64::consts::PI;

    let a = r * r * PI;
    let c = r * 2.0 * PI;

    println!("{} {}", a, c);
}



Measured memory_bytes: 5060
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 200010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

//------------------------------------------------------

ll f(ll b, ll n) {
    if (b <= 1 || n <= 0) return LINF;
    else if (n < b) return n;
    else return f(b, n / b) + n % b;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, s;
    cin >> n >> s;
    ll sqrt_n = (ll) sqrt(n) + 2;
    ll best = LINF;
    auto update = [&](ll upd) {
        if (upd >= 2) best = min(best, upd);
    };
    if (n < s) {
        cout << -1 << endl;
        return 0;
    } else if (n == s) {
        cout << n + 1 << endl;
        return 0;
    }
    for (ll b = 2; b <= sqrt_n; ++b) {
        if (f(b, n) == s) update(b);
    }

    ll n_s = n - s;
    for (ll p = 1; p < sqrt(n_s); ++p) {
        if (n_s % p == 0) {
            ll b = n_s / p + 1;
            if (f(b, n) == s) update(b);
        }
    }
    cout << (best == LINF ? -1 : best) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int A[2000];
int n;

bool solve(int i, int m) {
    bool res;

    if (m == 0) {
        return true;
    }
    if (i >= n) {
        return false;
    }
    res = solve(i + 1, m) || solve(i + 1, m - A[i]);

    return res;
}


int main() {
    int m, tmp;

    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &A[i]);
    }
    scanf("%d", &m);
    for (int i = 0; i < m; i++) {
        scanf("%d", &tmp);
        if (solve(0, tmp)) {
            printf("yes\n");
        } else {
            printf("no\n");
        }
    }

    return 0;
}

Measured memory_bytes: 2696
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	int N;
	scanf("%d",&N);

	int tmp;
	vector<int> V;

	for(int loop = 0; loop < N; loop++){
		scanf("%d",&tmp);
		V.push_back(tmp);
	}

	int num_query;
	scanf("%d",&num_query);

	int left,right;

	for(int loop = 0; loop < num_query; loop++){

		scanf("%d %d",&left,&right);
		reverse(V.begin()+left,V.begin()+right);
	}

	printf("%d",V[0]);
	for(int i = 1; i < V.size(); i++){
		printf(" %d",V[i]);
	}
	printf("\n");

	return 0;
}




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

using namespace std;


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

	int jumps[n];

	vector<int> dp(n, 0);

	for(int i=0; i<n; i++){
		cin >> jumps[i];
	}
	dp[1] = abs(jumps[1] - jumps[0]);
	for(int i=2; i<n; i++){
		dp[i] = min(abs(jumps[i] - jumps[i-1]) + dp[i-1], abs(jumps[i] - jumps[i-2]) + dp[i-2]);
	}
	cout << dp[n-1];
	return 0;
}

Measured memory_bytes: 4040
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int V;
vector<int> v, parent, depth;

struct edge {
  int f, t, c;
  bool operator < (const edge &e) const { return c < e.c; };
};

int find(int a){
  if(parent[a] == a) return a;

  //ここで、検索時に辺の縮約も行う
  else return parent[a] = find(parent[a]);
}

void merge(int a, int b){
  int pa = find(a), pb = find(b);
  if(pa == pb) return ;

  if(depth[pa] > depth[pb]) swap(pa, pb);
  if(depth[pa] == depth[pb]) ++depth[pa];
  parent[pb] = pa;
}

bool same(int a, int b){
  return find(a) == find(b);
}

void init_union_find(int V){
  v = vector<int>(V);
  parent = vector<int>(V);
  depth = vector<int>(V, 1);
  REP(i, V) parent[i] = i;
}

int kruskal(int V, int E, vector<edge> es){
  sort(es.begin(), es.end());
  init_union_find(V);
  int min_cost = 0;
  REP(i, E){
    if(!same(es[i].f, es[i].t)){
      min_cost += es[i].c;
      merge(es[i].f, es[i].t);
    }
  }
  return min_cost;
}

int main() {
  int E;
  cin >>V >>E;
  vector<edge> es(E);
  REP(i, E) cin >>es[i].f >>es[i].t >>es[i].c;
  cout <<kruskal(V, E, es) <<endl;
  return 0;
}

Measured memory_bytes: 3652
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <vector>
#include<string>
#include <set>
#include <map>
#include <queue>
#include <limits.h>

using namespace std;

#define rip(i, n, s) for (int i = (s);i < ( int )( n ); i++)
#define all(a) (a).begin(), (a).end()
typedef long long ll;

int n;

bool dfs(vector<vector<bool>> &da, vector<bool> &ju, vector<bool> &bi, int now) {
	rip(i, n, 0) {
		if (da[now][i]) {
			if (ju[i]) {
				if (!bi[now] ^ bi[i]) {
					return false;
				}
			}
			else {
				bi[i] = bi[now] ^ true;
				ju[i] = true;
				if (!dfs(da, ju, bi, i)) {
					return false;
				}
			}
		}
	}
	return true;
}

int bfs(vector<vector<bool>> &da, int now) {
	vector<int> ans(n, 0);
	queue<int> q;
	q.push(now);
	ans[now] = 1;
	while (!q.empty()) {
		int gg = q.front();
		q.pop();
		rip(i, n, 0) {
			if (ans[i] == 0 && da[gg][i]) {
				ans[i] = ans[gg] + 1;
				q.push(i);
			}
		}
	}
	int ret = 0;
	rip(i, n, 0) {
		ret = max(ret, ans[i]);
	}
	return ret;
}

int main() {
	cin >> n;
	vector<vector<bool>> da(n, vector<bool>(n,false));
	string s;
	rip(i, n, 0) {
		cin >> s;
		rip(j, n, 0) {
			if (s[j] == '1') {
				da[i][j] = true;
			}
		}
	}
	vector<bool> ju(n, false), bi(n, true);
	if (!dfs(da, ju, bi, 0)) {
		cout << -1 << endl;
		return 0;
	}
	int ans = 0;
	rip(i, n, 0) {
		ans = max(ans, bfs(da, i));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define int         ll int
#define float       double
#define	endl		'\n'
#define maxpq       priority_queue<ll>
#define minpq       priority_queue<ll, vector<ll>, greater<ll> >
#define mii         map<int,int>
#define msi         map<string,int>
#define mis         map< int, string>
#define mpi         map<pair< int, int>, int>
#define pii         pair< int, int>
#define vi          vector< int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define EPS         1e-9
#define INF         1e18
#define PI          3.14159265358979323846
#define MAXI        1000000
#define what_is(x)  cerr << #x << " is " << x << endl;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
#define N 100005
int dp[3005][3005];
int rec(int arr[],int n,int start,int end)
{
	if(start>end) return 0;
	if(start==end) return arr[start];
	if(start==end-1) return max(arr[start],arr[end]);
	if(dp[start][end]!=-1) return dp[start][end];
	return dp[start][end]=max(arr[start]+min(rec(arr,n,start+2,end),rec(arr,n,start+1,end-1)),arr[end]+min(rec(arr,n,start+1,end-1),rec(arr,n,start,end-2)));// dusre player ka intension reduce karna hoga
	
}
signed main()
{
	fast;
	int t=1;
	//cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		int arr[n];
		int i,j,k;
		int sum=0;
		for(i=0;i<=n-1;i++)
		{
			cin>>arr[i];
			sum+=arr[i];
		}
		memset(dp,-1,sizeof(dp));
		int ans=rec(arr,n,0,n-1);
		cout<<ans-(sum-ans)<<endl;
	}
}

Measured memory_bytes: 74320
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


struct Edge {
    int to, cost;
    Edge(int to, int cost) : to(to), cost(cost) {}
};

typedef vector<vector<Edge> > AdjList;
AdjList graph;


vector<int> dist;

void bellman_ford(int n, int s) {
    dist = vector<int>(n, INF);
    dist[s] = 0;
    for (int i = 0; i < n; i++) {
        for (int v = 0; v < n; v++) {
            for (int k = 0; k < graph[v].size(); k++) {
                Edge e = graph[v][k];
                if (dist[v] != INF && dist[e.to] > dist[v] + e.cost) {
                    dist[e.to] = dist[v] + e.cost;
                    // if (i == n - 1) return true; // n回目にも更新があるなら負の閉路が存在
                }
            }
        }
    }
}

void find_negative_loop(int n){
    for (int i = 0; i < n; i++) {
        for (int v = 0; v < n; v++) {
            for (int k = 0; k < graph[v].size(); k++) {
                Edge e = graph[v][k];
                if (dist[v] != INF && dist[e.to] > dist[v] + e.cost) {
                    dist[e.to] = -INF;
                }
            }
        }
    }
}


int main() {
    int n, m, p;
    cin >> n >> m >> p;

    graph = AdjList(n);
    
    for (int i = 0; i < m; i++) {
        int from, to, cost;
        cin >> from >> to >> cost;
        from--, to--;
        graph[from].push_back(Edge(to, -cost+p));
    }
    
    bellman_ford(n, 0);
    find_negative_loop(n);
    
    if(dist[n-1] == -INF) cout << -1 << endl;
    else cout << max(- dist[n-1], 0) << endl;
    
    return 0;
}

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

int main() {
	ios_base::sync_with_stdio(false);cin.tie(nullptr);
	string S;
	int N, K;
	cin>>S>>K; N=S.size();
	vector<string> A;
	rep(i, 0, N) {
		string s;
		rep(j, i, min(i+K, N)) A.push_back(s+=S[j]);
	}
	sort(begin(A), end(A));
	A.erase(unique(begin(A), end(A)), end(A));
	cout<<A[K-1]<<'\n';
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

bool CHMAX(string &x, string y) {
    if (y[0] != '#' &&
        (x == "#" || sz(x) < sz(y) || (sz(x) == sz(y) && x < y))) {
        x = y;
        return true;
    }
    return false;
}
vector<string> memo(10010);
vector<int> f = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
vector<int> a;
string dp(int i) {
    if (i < 0) {
        return "#";
    }
    if (i == 0) {
        return "";
    }
    if (memo[i] != "-1") {
        return memo[i];
    }
    string ret = "#";
    for (int x : a) {
        CHMAX(ret, dp(i - f[x]) + to_string(x));
    }
    return memo[i] = ret;
}

int main() {
    int n, m;
    cin >> n >> m;
    a.resize(m);
    rep(i, m) cin >> a[i];
    rep(i, 10010) memo[i] = "-1";
    cout << dp(n) << endl;
}

Measured memory_bytes: 26624
#include <bits/stdc++.h>
#include <string>
#include <cmath>
using namespace std;
int main() {
    int n,k,ans=0;
    cin >> n >>k;
    int snk[n];
    for (int i = 0; i < n; i++)
    {
        snk[i] = 0;
    }
    
    int d[k];
    int a[100][100];
    for (int i = 0; i < k; i++)
    {
        cin>>d[i];
        for (int j = 0; j < d[i]; j++)
        {
            cin>>a[i][j];
            snk[a[i][j]-1]++;
        }
        
    }
    for (int i = 0; i < n; i++)
    {
        if(snk[i]==0){
            ans++;
        }
    }
    
    
    

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3680
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<ext/pb_ds/detail/standard_policies.hpp>

// common
#define endl     "\n"
#define M_PI     3.14159265358979323846

// fast input output
#define fast_io  ios_base::sync_with_stdio(false); cin.tie(NULL);  cout.tie(NULL)

// fixed float field
#define fix_prec cout.setf( std::ios::fixed, std:: ios::floatfield ); cout.precision(9);

// vector
#define vi       vector<int>
#define vvi      vector<vector<int>>
#define vpii     vector<pair<int,int>>
#define pb(v,x)  v.push_back(x)

// pair
#define pii      pair<int,int>
#define mp(a,b)  make_pair(a,b)
#define F        first
#define S        second

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

// bound
#define lb(v,x)  lower_bound(v.begin(),v.end(),x)
#define ub(v,x)  upper_bound(v.begin(),v.end(),x)

using namespace std;
//using namespace __gnu_pbds;

//typedef tree < int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > ordered_set;
typedef long long int lli;
typedef unsigned long long int ulli;

// constants
lli const mod  = 1e9+7;
lli const modl = 1e18;

// helper functions
// calculate gcd
lli gcd(lli x, lli y)
{
    if (y == 0)
        return x;
    return gcd(y, x % y);
}

// calculate fibonacci number
lli fib(int n)
{
    lli a,b,c,i;
    a=0,b=1;
    if(n == 0)
        return a;
    for(i=2;i<=n;i++)
    {
    	c=a+b;
    	a=b;
    	b=c;
    }
    return b;
}

// check if number if prime
bool isprime(lli n)
{
	if(n<=1)
		return false;
	else if(n==2)
		return true;
	else if(n%2==0)
		return false;
	else
	{
		int i;
		for(i=3;i*i<=n;i++)
		{
			if(n%i==0)
				return false;
		}
		return true;
	}
}

// read from and write to text file
void readwrite()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
} 

// seive
vector<lli>prime(100000+7,1);
void buildprime(lli n)
{
	lli i,j;
	prime[0]=prime[1]=0;
	for(i=2;i*i<=n;i++)
	{
		if(prime[i])
		{
			for(j=i*i;j<=n;j+=i)
				prime[j]=0;
		}
	}
}

// nCr
lli dp[1005][1005];
lli comb[1005][1005];
lli ncr(lli n,lli r)
{
	if(n==r)
		return 1;
	if(r==0)
		return 1;
	if(r==1)
		return n;
	if(dp[n][r]!=0)
		return dp[n][r];
	return dp[n][r] = (ncr(n-1,r)%mod+ncr(n-1,r-1)%mod)%mod;
}

void ncrm()
{
	comb[0][0]=1;
	for(int i=1;i<1001;i++)
	{
		comb[i][0]=1;
		for(int j=1;j<=i;j++)
		{
			comb[i][j]=(comb[i-1][j]%mod+comb[i-1][j-1]%mod)%mod;
		}
	}
}

// binary exponentiation
lli binpowm(lli a,lli b)
{
	lli res=1;
	a%=mod;
	while(b)
	{
		if(b&1)
			res=((res%mod)*(a%mod))%mod;
		a=((a%mod)*(a%mod))%mod;
		b>>=1;
	}
	return res%mod;
}
 
// factorial
lli fact(lli n)
{
	lli i,res=1;
	for(i=1;i<=n;i++)
		res=((res%mod)*(i%mod))%mod;
	return res%mod;
}

// driver code
void solve()
{
	int n,x,t;
	cin>>n>>x>>t;
	int ans=ceil(1.0*n/x)*t;
	cout<<ans;
}

int main()
{
  fast_io;
  fix_prec;
  //readwrite();
  int t=1;
  //cin>>t;
  while(t--)
  {
    solve();
    cout<<endl;     
  }
  return 0;	
}

/*
Kab Khoon khaulega tera jab sabka internship lag jayega tab
Shame on you if you do not get internship
*/

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

using namespace std;

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

    set<int>s;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        s.insert(x);
    }
    if (n == s.size()) {
        cout <<"YES" <<endl;
    }
    else {
        cout << "NO" << endl;
    }
    return 0;
}


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

using namespace std;

using ll = long long;

// https://ei1333.github.io/luzhiled/snippets/structure/li-chao-tree.html
template< typename T >
struct LiChaoTree {
  struct Line {
    T a, b;

    Line(T a, T b) : a(a), b(b) {}

    inline T get(T x) const { return a * x + b; }

    inline bool over(const Line &b, const T &x) const {
      return get(x) < b.get(x);
    }
  };

  vector< T > xs;
  vector< Line > seg;
  int sz;

  LiChaoTree(const vector< T > &x, T INF) : xs(x) {
    sz = 1;
    while(sz < xs.size()) sz <<= 1;
    while(xs.size() < sz) xs.push_back(xs.back() + 1);
    seg.assign(2 * sz - 1, Line(0, INF));
  }

  void update(Line &x, int k, int l, int r) {
    int mid = (l + r) >> 1;
    auto latte = x.over(seg[k], xs[l]), malta = x.over(seg[k], xs[mid]);
    if(malta) swap(seg[k], x);
    if(l + 1 >= r) return;
    else if(latte != malta) update(x, 2 * k + 1, l, mid);
    else update(x, 2 * k + 2, mid, r);
  }

  void update(T a, T b) { // ax+b
    Line l(a, b);
    update(l, 0, 0, sz);
  }

  T query(int k) { // xs[k]
    const T x = xs[k];
    k += sz - 1;
    T ret = seg[k].get(x);
    while(k > 0) {
      k = (k - 1) >> 1;
      ret = min(ret, seg[k].get(x));
    }
    return ret;
  }
};

const ll INF = 1LL << 60;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    ll C;
    cin >> n >> C;
    vector<ll> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }

    LiChaoTree<ll> lct(h, INF);
    vector<ll> dp(n, INF);

    dp[0] = 0;
    lct.update(-2 * h[0], h[0] * h[0]);
    for (int i = 1; i < n; i++) {
        dp[i] = lct.query(i) + h[i] * h[i] + C;
        lct.update(-2 * h[i], h[i] * h[i] + dp[i]);
    }
    cout << dp[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 14584
#include <stdio.h>

#include <algorithm>
#include <iostream>
#include <set>
using namespace std;

int main() {
    int N;
    cin >> N;
    set<int> values;
    for(int i=0;i<N;i++){
        int tmp;
        cin >> tmp;
        values.insert(tmp);
    }
    cout << values.size() << endl;
    return 0;
}


Measured memory_bytes: 256
### SNIPPET
  # n = gets.split.map(&:to_i)
  # array = n.times.map { gets.split.map(&:to_i) }
  # [].all?(&:even?)
  # a = [*1..m].repeated_combination(n).to_a
  # [1,2,3,4,5].select { |num| num.even? }  # => [2, 4]
  # ["a","a","b"].group_by(&:itself).map{|k,v| [k, v.count]}.to_h #=> {"a"=>2, "b"=>1}
  # 切り捨て: .floor(2).to_f ,切り上げ： .ceil(2).to_f,四捨五入: round(2)
  # 3.upto(6) do |i|, 6.downto(3) do |i|
  # 公約数125.gcd(100)、公倍数125.lcm(100)
  # PI = Math::PI
  # 高さ = a * Math.sin(w / 180.0 * Math::PI), 底辺 = a * Math.cos(w / 180.0 * Math::PI)
  # def chmax(a, b) a > b ? a : b end
  # INF = Float::INFINITY
  # def chmin(a, b) a < b ? a : b end

a,b = gets.split.map(&:to_i)

puts (a.to_s * b).to_i  > (b.to_s * a).to_i ? (a.to_s * b).to_i : (b.to_s * a).to_i

Measured memory_bytes: 1788
X,Y[104],i,j,n;main(N,S){for(;scanf(S="%d\n",&N)*N;n=i=j=!printf(S,j<N?-1:n-2)){for(;i<N+4;)scanf(S,Y+i++);for(X=Y[3];n++<=1e4&j<N;X=(*Y*X+Y[1])%Y[2])j+=X==Y[4+j];}}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
 
#define  rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i>=0; i++)
#define sz(x) ((int)(x).size())
#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; }
typedef long long ll;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int N; std::cin >> N;
  std::vector<int> a(N); rep(i,N) std::cin >> a[i];

  int cnt4 = 0;
  int cnt2 = 0;
  int cnt  = 0;
  rep(i,N) {
    if ( a[i] % 4 == 0 ) cnt4++;
    else if ( a[i] % 2 == 0 ) cnt2++;
    else cnt++;
  }

  if ( cnt4 >= cnt-1 && cnt2 == 0 ) std::cout << "Yes" << std::endl;
  else if ( cnt4 >= cnt && cnt2 != 0 ) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;

  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <stdio.h>

using namespace std;

//typedefリスト
typedef vector<int> vint;
typedef vector<string> vstr;




int main(void) {
	int siz,yn;
	yn = 0;
	string s;
	cin >> s;
	map<char, int>mp;
	siz = s.length();
	for (int i = 0; i < siz; i++) {
		mp[s[i]]++;
		if (mp[s[i]] == 2) {
			yn = 1;
		}
		
	}
	if (yn == 0)cout << "yes" << endl;
	else cout << "no" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
typedef long long ll;

int main()
{
	int n,m;cin >> n >> m;
	vector<int> A(n);
	rep(i, n)cin>>A[i];
	vector<pair<int , int>> BC(m);
	rep(i, m)
	{
		int b, c; cin >> b >> c;
		BC[i] = make_pair(c, b);
	}

	sort(A.begin(),A.end());
	sort(BC.begin(),BC.end(),greater<pair<int , int>>());

	//rep(i,BC.size())cout<<BC[i].first;
	
	
	rep(i,A.size())
	{
		if(A[i]<BC[0].first)
		{
			A[i]=BC[0].first;
			BC[0].second--;
		}
		else break;

		//cout<<BC[0].second<<endl;
		if(BC[0].second==0)
		{
			BC.erase(BC.begin());
		}
		if(BC.size()==0)break;
	}

	ll sum=0;
	rep(i,A.size())sum+=A[i];
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), ((a) + (n))
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define MODNUM (static_cast<int>(1e9 + 7))
#define MOD(x) ((x) % MODNUM)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

const int INF = 2e9;
const double EPS = 1e-10;
const double PI = acos(-1.0);

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

template <typename T>
int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T>
T square(T x) {
	return x * x;
}

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	char s[101];
	char t[101];
	scanf("%s %s", s, t);
	printf("%s%s\n", t, s);
	return 0;
}

Measured memory_bytes: 256
def solved(p):
    return cwa[p] == -1


n, m = map(int, input().split())

wa = 0
cwa = [0] * n
for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if solved(p):
        continue
    if s == 'AC':
        wa += cwa[p]
        cwa[p] = -1
    else:
        cwa[p] += 1

ac = cwa.count(-1)
print(ac, wa)


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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(A+B > C+D){
  	cout << "Left" << endl;
  }else if(A+B < C+D){
  	cout << "Right" << endl;
  }else{
  	cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    char top[10+1];
    int bottom;
    int w[] = {1, 9, 6, 4, 6, 6, 4, 6, 9, 1};

    while (scanf("%s", top)!= EOF){
        bottom=0;
        for (int i=0; i<10; i++){
            bottom += w[i]*(top[i] - '0');
        }
        bottom %= 10;
        printf("%d\n", bottom); 
    }

    return 0;
}

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

int main()
{
	int h, n, sum = 0;
	int lst[100000];

	cin >> h >> n;
	for (int i = 0; i < n; i++) {
		cin >> lst[i];
		sum += lst[i];
	}

	if (sum >= h) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cstring>
#include <deque>
#include <math.h>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <queue>
#include <vector>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); --(i))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define SORT(A) std::sort((A).begin(), (A).end())
#define ALL(A) (A).begin(), (A).end()
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())

using lli = long long int;
using pii = std::pair<int, int>;

template <typename T>
inline bool chmin(T& a, T b){
    if(b < a){ a = b; return true;}
    return false;
}

template <typename T>
inline bool chmax(T& a, T b){
    if(a < b){ a = b; return true;}
    return false;
}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


constexpr int N = 1000;
char str[N+10][N+10];

std::array<std::string, 4> four = {
    "aabc",
    "ddbc",
    "efgg",
    "efhh"
};
std::array<std::string, 5> five = {
    "aabbc",
    "hii.c",
    "h..jd",
    "g..jd",
    "gffee"
};
std::array<std::string, 6> six = {
    "aab.c.",
    "ddb.c.",
    ".eff.h",
    ".egg.h",
    "i..jkk",
    "i..jll"
};
std::array<std::string, 7> seven = {
    "aa.kk.j",
    "..b..lj",
    "..b..li",
    "cc.mm.i",
    "..d..nh",
    "..d..nh",
    "eeffgg.",
};


int main(void){
    int n; scanf("%d", &n);
    if(n <= 2){ puts("-1"); return 0;}
    if(n == 3){
        puts("aa.");
        puts("..b");
        puts("..b");
        return 0;
    }
    
        REP(i, n){ REP(j, n) str[i][j] = '.'; str[i][n] = '\0';}
        for(int i = n - 1; i - 3 >= 0; i -= 4){
            int j = i - 3;
            REP(a, 4) REP(b, 4) str[j+a][j+b] = four[a][b];
        }
        if(n % 4 == 0){
            REP(i, 4) REP(j, 4) str[i][j] = four[i][j];
        }
        else if(n % 4 == 1){
            REP(i, 5) REP(j, 5) str[i][j] = five[i][j];
        }
        else if(n % 4 == 2){
            REP(i, 6) REP(j, 6) str[i][j] = six[i][j];
        }
        else{
            REP(i, 7) REP(j, 7) str[i][j] = seven[i][j];
        }
        /*
        REP(i, n){
            std::set<char> S; REP(j, n) if(str[i][j] != '.') S.insert(str[i][j]);
            std::set<char> T; REP(j, n) if(str[j][i] != '.') T.insert(str[j][i]);
            if(S.size() != 3) puts("a");
            if(T.size() != 3) puts("a");
        }
        */

    REP(i, n) puts(str[i]);


    





    return 0;
}

Measured memory_bytes: 2176
N = int(input())
A = [int(i) for i in input().split()]
def ins(N, A):
    for i in range(N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        for k in range(N):
            if k == N - 1:
                print(A[k], end = "")
            else:
                print(A[k], end = " ")
        print()
        

ins(N, A)



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

#define clock_starts() clock_t begin = clock()
#define clock_ends() clock_t end = clock()
#define print_running_time() double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC; \
printf("Elapsed Time : %.10f second(s)\n", elapsed_secs)
#define readfile(s) freopen(s, "r", stdin)
#define writefile(s) freopen(s, "w", stdout)
#define debug(s) cout<< #s <<" = "<< s <<endl
#define all(v) v.begin(), v.end()
#define cin_cout_is_cool ios_base::sync_with_stdio(false); cin.tie(NULL)
#define printBinary(n) cout << #n << " = " << bitset<64>(n) << endl
#define min_pq priority_queue<int, vector<int>, greater<int> >
#define MEMSET(a,val) memset(a, val, sizeof a)
#define PB push_back
#define endl '\n'
#define cin(n) scanf("%d", &n)

template<typename T>T max(T a_,T b_,T c_) { return max(a_,max(b_,c_)); }
template<typename T>T min(T a_,T b_,T c_) { return min(a_,min(b_,c_)); }

typedef pair<int, int> ii;
typedef pair<long, long> pll;
typedef pair<double, double> pdd;

inline long long ceil(long long num, long long d) { return (num/d) + (num%d>0 ? 1 : 0); }
#define block_no(idx) 		( ceil(idx, BLOCK_SIZE) )
#define block_starting(idx) ( ((block_no(idx)-1) * BLOCK_SIZE) +1 )
#define block_ending(idx) 	( min(n, block_no(idx)*BLOCK_SIZE) )
#define block_ranking(idx) 	((idx%BLOCK_SIZE==0)?BLOCK_SIZE:idx%BLOCK_SIZE)

const int maxn = 600;
#define int long long

int c[maxn], f[maxn], s[maxn], n;

int solve(int pos) {
	int tot = 0;
	for(int i=pos; i<n; i++) {
		if(tot < s[i]) {
			tot = s[i] + c[i];
		}
		else {
			int temp = ceil(tot-s[i], f[i]);
			tot = s[i] + temp*f[i] + c[i];
		}
	} return tot;
}

int32_t main () {
	//readfile("input.in");
	//writefile("output.out");
	cin>>n;
	for(int i=1; i<n; i++) cin>>c[i]>>s[i]>>f[i];
	for(int i=1; i<n; i++) {
		cout<<solve(i)<<endl;
	} cout<<0<<endl;
	return 0;
}

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

int main(){
  int l,r,m,n,a[100],g,c;
  for(;;){
    cin >> n;
    if(!n)break;
    for(int i=0;i<n;i++)cin >> a[i];
    cin >> g;


    l = 0;r = n-1;
    c = 0;
    while(l<=r){
      c++;
      m = (l+r)/2;
      if(a[m]==g)break;
      else if(a[m]>g)r = m-1;
      else l = m+1;
    }

    cout << c << endl;
  }
}

Measured memory_bytes: 0
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define debug int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7

int main(){
    int n;
    string s[102];
    cin >> n;
    REP(i, n)cin >> s[i];
    bool four = false;
    REP(i, n){
        if(s[i] == "Y")four = true;
    }
    if(four){
        print("Four");
    }else{
        print("Three");
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<long long> vll, vLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,h,w;
    cin >> n >> h >> w;
    cout << (n-h+1)*(n-w+1) << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
max_val = 10 ** 18
ans = 1
z_count = a.count(0)
for i in a:
    if z_count >= 1:
        ans = 0
        break
    ans *= i
    if ans > max_val:
        ans = -1
        break
print(ans)


Measured memory_bytes: 21636
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
    int N;
    cin >> N;
    vector<int> H(N);
    int high=0;
    int count=0;
    for(int i=0;i<N;i++){
        cin >> H.at(i);
        high=max(high,H.at(i));
        if(H.at(i)>=high)count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 256
/*

Author : AllKilled
Date   : 202001186 20:10:00 UTC+8

Website: https://atcoder.jp/contests/keyence2020
Contest: Keyence Programming Contest 2020.
Problem: Task C.
Result :

*/
#include<bits/stdc++.h>
using namespace std;

typedef long long LL;

const int S = 1000 * 1000 * 1000;
const LL MAXN = 1e6+7;

///--------------------------------------------///

int n, k, s, f[MAXN];

int main()
{
    cin >> n >> k >> s;
    for (int i = 0; i < k; ++i) {
        cout << s << " ";
        --n;
    }
    s = s == S ? S - 1 : S;
    for (int i = 0; i < n; ++i) cout << s << " ";
    return 0;
}


Measured memory_bytes: 1280
import itertools


def main():
    N = int(input())

    # 7, 5, 3 だけでできている数をピックアップ
    cnt = 0
    for i in range(3, len(str(N)) + 1):
        for j in itertools.product([3, 5, 7], repeat=i):
            p = 0
            for a, b in enumerate(j[::-1]):
                p += b * 10 ** a

            if p > N:
                break

            # 3, 5, 7全てあるのを抽出
            if len(set(j)) == 3:
                cnt += 1

    print(cnt)


main()


Measured memory_bytes: 9140
//Zory-2019
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    typedef long long ll;
    #define pr pair<int,int>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    #define GG(x) if(x) {puts("error");exit(666);}
    #define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
    #define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=1e9+7;
    int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
    ll qpower(ll x,ll e,int mod=MOD){ll ans=1;GG(e<0)while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=1e6+10;

    vc<int> to[N],fm[N];
    bool gg;ll ct[3];bool vis[N];int COL[N];
    int counter;
    void dfs(int x,int col)
    {
        vis[x]=1;ct[col]++;COL[x]=col;counter+=sz(to[x]);
        for(auto y:to[x]) if(!vis[y]) dfs(y,(col+1)%3); else gg|=COL[y]!=(col+1)%3;
        for(auto y:fm[x]) if(!vis[y]) dfs(y,(col+2)%3); else gg|=COL[y]!=(col+2)%3;
    }
	void main()
	{
        int n=qread(),m=qread();
        while(m--)
        {
            int x=qread(),y=qread();
            to[x].PB(y);fm[y].PB(x);
        }
        ll ans=0;
        fo(i,1,n) if(!vis[i])
        {
            gg=0,ct[0]=ct[1]=ct[2]=0;counter=0;dfs(i,0);
            if(!gg) {if(!ct[1] or !ct[2]) ans+=counter; else ans+=ct[0]*ct[1]+ct[1]*ct[2]+ct[0]*ct[2];}
            else ans+=(ct[0]+ct[1]+ct[2])*(ct[0]+ct[1]+ct[2]),gg=0;
        }write(ans);
	}
};//(ans+MOD)%MOD
signed main()
{
    srand(time(0));
    mine::main();
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

int main(){
    ios_base::sync_with_stdio(false);
	cout.precision(10);
	cout << fixed;

    ll k, a, b;
    cin >> k >> a >> b;
    if(k <= a-1){
        cout << 1+k;
        return 0;
    }
    k -= a-1;
    if(b-a <= 2){
        cout << a+k;
        return 0;
    }
    else{
        ll res = (k/2)*(b-a) + a;
        if(k%2) res++;
        cout << res;
    }
    return 0;
}


Measured memory_bytes: 256
H,W = map(int,input().split())
S = [input() for i in range(H)]

L = [[0]*W for i in range(H)]
R = [[0]*W for i in range(H)]
U = [[0]*W for i in range(H)]
D = [[0]*W for i in range(H)]
for h in range(H):
    for w in range(W):
        if S[h][w]==".":
            if h==0:D[h][w]=1
            else:D[h][w]=D[h-1][w]+1
            if w==0:R[h][w]=1
            else:R[h][w]=R[h][w-1]+1
for h in range(H-1,-1,-1):
    for w in range(W-1,-1,-1):
        if S[h][w]==".":
            if h==H-1:U[h][w]=1
            else:U[h][w]=U[h+1][w]+1
            if w==W-1:L[h][w]=1
            else:L[h][w]=L[h][w+1]+1

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans,L[h][w]+R[h][w]+U[h][w]+D[h][w]-3)
print(ans)


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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

LL n,x,pre=0,ans=0;

int main()
{
	cin>>n;
	rep(i,n)
	{
		cin>>x;
		if(x<pre) ans+=pre-x;
		else pre=x;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3592
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define ull unsigned long long
using namespace std;
void io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
}

const int MAXN = 1e5 + 5;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9 + 7;

int n;
int a[MAXN];
int t[MAXN];
int len;

int main() {
    io();
    memset(t, -1, sizeof(t));
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        int p = upper_bound(t, t + len, a[i], greater<int>()) - t;
        t[p] = a[i];
        if (p == len) {
            len++;
        }
    }
    cout << len;
}


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

int main(){
  int n;
  cin>>n;
  vector<vector<int>> g(n);
  for(int i=0;i<n;i++){
   int I,k;
    cin>>I>>k;
    for(int j=0;j<k;j++){
      int x;
      cin>>x;
      x--;
      g[i].push_back(x);
    }
  }
  
  	vector<int> d(n,-1);
 	 queue<int> q;
  
 	 d[0]=0;
 	 q.push(0);
  
 	 while(!q.empty()){
  	  int v=q.front(); q.pop();
     
  	  for(int &nv: g[v]){
    	  if(d[nv]!=-1) continue;
       
    	  d[nv]=d[v]+1;
    	  q.push(nv);
      }
     }
  for(int i=0;i<n;i++) cout<<i+1<<" "<<d[i]<<endl;
}
  


Measured memory_bytes: 3152
#include <stdio.h>
void mergesort(int* A,int left,int right);
void merge(int* A,int left,int mid,int right);

int c=0;

int main(){
  int n,a[500000],i,mid;
  scanf("%d",&n);
  for(i=0;i<n;i++){scanf("%d",&a[i]);}

  mid=n/2;
  mergesort(a,0,n);

  for(i=0;i<n-1;i++){printf("%d ",a[i]);}
  printf("%d\n%d\n",a[n-1],c);
  return 0;
}

void mergesort(int A[], int left,int right){
  int mid;
  if (left+1 < right){
    mid = (left + right)/2;
    mergesort(A, left, mid);
    mergesort(A, mid, right);
    merge(A, left, mid, right);
  }
}

void merge(int A[],int left,int mid,int right){
  int i,j,k,n1,n2,LeftArr[500000],RightArr[500000];

  n1 = mid - left;
  n2 = right - mid;

  for (i = 0; i<n1;i++){LeftArr[i] = A[left + i];}
  for (i = 0; i<n2;i++){RightArr[i] = A[mid + i];}
  LeftArr[n1] = 1000000001;
  RightArr[n2] = 1000000001;

  i = 0;
  j = 0;

  for (k = left; k<right; k++){
    if (LeftArr[i] <= RightArr[j]){
      A[k] = LeftArr[i];
      i+=1;
      c++;
    }
    else {
      A[k] = RightArr[j];
      j+=1;
      c++;
    }
  }
}


Measured memory_bytes: 5636
#include <bits/stdc++.h>
using namespace std;
 
bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}
 
int a,b,c,d;

int main(){
    cin >> a >> b >> c >> d;
    cout << min(a,b) + min(c,d) << endl;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
const double eps=1e-9;
struct dot{
	double x,y;
	double len(){return sqrt(x*x+y*y);}
	dot(double a=0.0,double b=0.0){x=a,y=b;}
	dot operator +(const dot&b)const {return dot(x+b.x,y+b.y);}
	dot operator -(const dot&b)const {return dot(x-b.x,y-b.y);}
	dot operator *(const double&z)const {return dot(x*z,y*z);}
	bool operator <(const dot&b)const {return (x<b.x)||(x==b.x&&y<b.y);}
	void read(){scanf("%lf%lf",&x,&y);} 
};
struct line{
	dot x1,x2;
	void read(){x1.read();x2.read();};
	dot getdot(){return x2-x1;}
};
double chaji(dot x,dot y){
	return x.x*y.y-x.y*y.x;
}
double neiji(dot x,dot y){
	return x.x*y.x+x.y*y.y;
}
double cos(dot x,dot y){
	if (!x.len()||!y.len())return 0;
	return neiji(x,y)/x.len()/y.len();
}
dot Projection(dot x,line y){//求x关于直线y的投影点（垂足） 
	y.x2=y.x2-y.x1;
	x=x-y.x1;
	double len=cos(x,y.x2)*x.len()/y.x2.len();
	y.x2=y.x2*len;
	return y.x2+y.x1;
}
dot Reflection(dot x,line y){//求x关于直线y的对称点 
	dot z=Projection(x,y);
	return z*2-x;
}
int Counter_Clockwise(dot x,line y){//求两个向量的五种关系 
	x=x-y.x1;y.x2=y.x2-y.x1;
	if (chaji(y.x2,x)!=0){
		if (chaji(y.x2,x)>0)return 1;
		return 2;
	} 
	if (fabs(cos(x,y.x2)+1)<eps)return 3;
	if (x.len()>y.x2.len())return 4;
	return 5;
} 
int Parallel_Orthogonal(line x,line y){//求两个直线是垂直还是平行还是其他 
	dot a=x.getdot(),b=y.getdot();
	if (chaji(a,b)==0)return 2;
	if (neiji(a,b)==0)return 1;
	return 0;
}
int Intersection(line x,line y){//求两条直线是否相交 
	int Minx1=min(x.x1.x,x.x2.x),Maxx1=max(x.x1.x,x.x2.x);
	int Minx2=min(y.x1.x,y.x2.x),Maxx2=max(y.x1.x,y.x2.x);
	int Miny1=min(x.x1.y,x.x2.y),Maxy1=max(x.x1.y,x.x2.y);
	int Miny2=min(y.x1.y,y.x2.y),Maxy2=max(y.x1.y,y.x2.y);
	if (Minx1>Maxx2||Minx2>Maxx1)return 0;
	if (Miny1>Maxy2||Miny2>Maxy1)return 0;
	if (chaji(x.getdot(),y.x1-x.x1)*chaji(x.getdot(),y.x2-x.x1)>0)return 0;
	if (chaji(y.getdot(),x.x1-y.x1)*chaji(y.getdot(),x.x2-y.x1)>0)return 0;
	return 1;
}
dot CrossPoint(line x,line y){//求两条线段的交点 
	if (fabs(cos(x.getdot(),y.getdot())-1)<eps){
		if (x.x2<y.x2)return y.x2;
		else return x.x2;
	}
	else {
		if (x.x2.x-x.x1.x==0){
			double k2=(y.x2.y-y.x1.y)/(y.x2.x-y.x1.x),b2=y.x2.y-y.x2.x*k2;
			return dot(x.x2.x,x.x2.x*k2+b2);
		}
		if (y.x2.x-y.x1.x==0){
			double k1=(x.x2.y-x.x1.y)/(x.x2.x-x.x1.x),b1=x.x2.y-x.x2.x*k1;
			return dot(y.x2.x,y.x2.x*k1+b1);			
		}
		double k1=(x.x2.y-x.x1.y)/(x.x2.x-x.x1.x),b1=x.x2.y-x.x2.x*k1;
		double k2=(y.x2.y-y.x1.y)/(y.x2.x-y.x1.x),b2=y.x2.y-y.x2.x*k2;
		dot ans;
		ans.x=(b2-b1)/(k1-k2);ans.y=ans.x*k1+b1;
		return ans;
	}
} 
double Dis(dot x,dot y){//点到点的距离 
	return sqrt((x.x-y.x)*(x.x-y.x)+(x.y-y.y)*(x.y-y.y));
}
double dist(line x,dot y){//点到直线的距离 
	dot P=Projection(y,x);
	double k=neiji(x.getdot(),P-x.x1)/neiji(x.getdot(),x.getdot());
	if (k<=0)return Dis(x.x1,y);
	if (k>=1)return Dis(x.x2,y);
	return Dis(y,P);
}
double Distance(line x,line y){
	return min(min(dist(x,y.x1),dist(x,y.x2)),min(dist(y,x.x1),dist(y,x.x2)));
}
int main(){
	int T;
	scanf("%d",&T);
	while (T--){
		line x,y;
		x.read();y.read();
		if (Intersection(x,y))puts("0.0000000000");
		else printf("%.10lf\n",Distance(x,y));
	}
	return 0;
}



Measured memory_bytes: 3256
a = input()
list_a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't','u','v', 'w', 'x', 'y', 'z']

if a in list_a:
    print('a')
else:
    print('A')


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

int main(){
	int N;
	string S;
	cin >> N >> S;
	string ans = "No";
	if(N % 2 == 0){
		bool chk = true;
		for(int i=0;i<N/2;i++){
			if(S[i] != S[i + N / 2])chk = false;
		}
		if(chk) ans = "Yes";
	}
	cout << ans << endl;
}

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

using namespace std;

int totalCnt = 0;
vector<int> numVector;

void decompositPrime(ll n) {
    ll a = 2;
    ll cnt = 0;
    ll prevCnt = 0;
    ll lastDiv = n;
    while (n >= a * a) {
        if (n % a == 0) {
            n /= a;
            numVector.push_back(a);
            // cnt++;

            // if (cnt > prevCnt) {
            //     totalCnt++;
            //     prevCnt = cnt;
            //     cnt = 0;
            // }

            // lastDiv = a;
        } else {
            a++;
            // cnt = 0;
            // prevCnt = 0;
        }
    }

    // if (n > 1) {
    //     if (n == lastDiv) {
    //         cnt++;
    //     }

    //     if (cnt > prevCnt) {
    //         totalCnt++;
    //     }
    //     // numVec.push_back(n);
    // }
    if (n > 1) {
        numVector.push_back(n);
    }
}

/*
 * メイン処理
 */
int main() {
    ll iNum;
    cin >> iNum;

    decompositPrime(iNum);

    int prevNum = 0;
    int numCnt = 0;
    int numCntJ = 0;
    int cnt = 0;
    for (int i = 0; i < numVector.size(); i++) {
        // cout << numVector[i] << endl;
        if (prevNum != numVector[i]) {
            // numVector[i]
            prevNum = numVector[i];
            numCnt = 0;
            numCntJ = 1;
            cnt++;
        } else {
            numCnt++;
            if (numCnt > numCntJ) {
                numCnt = 0;
                numCntJ++;
                cnt++;
            }
        }
    }

    cout << cnt << endl;
    // 正常終了
    return 0;
}

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

struct edge{int to, cost;};
vector<edge> G[100000];

double p;
double dfs(int cur, int prev, double offset){
    double ret = 0;
    for(auto elm:G[cur]){
        if(elm.to==prev)continue;
        ret += elm.cost + dfs(elm.to, cur, offset);
    }
    
    return ret*p+offset;
}

int main(){
    cin>>p;
    int n;
    cin>>n;
    
    rep(i,n-1){
        int s,t,c;
        cin>>s>>t>>c;
        s--,t--;
        G[s].pb(edge{t,c});
        G[t].pb(edge{s,c});
    }
    double base = dfs(0,-1,0);
    double ans = dfs(0,-1,base);
    
    printf("%.20lf\n",ans);
    
}



Measured memory_bytes: 14944