akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int) (n); i++)
#define _GLIBCXX_DEBUG

template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

const int max_n = 100010;
int n, k;
int a[max_n];

int main(){
    cin >> n >> k;
    rep(i, n) cin >> a[i];

    cout << (n-1+k-2) / (k-1) << endl;
    return 0;
}

Measured memory_bytes: 3944
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,c,d,x,y,z;
string s,t;
//

signed main() {
  RAPID;
  IN(s);
  s[3]='8';
  OUT(s);
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int N,dif,x=0, cnt=0;
    scanf("%d", &N);
    int H[N];
    for(int i=0; i<N; i++)
        scanf("%d", &H[i]);



    for(int i=N-1; i>0;i--){
        if(H[i]>=H[i-1]){

        }
        else if(H[i-1]-H[i]==1){
            H[i-1] -= 1;
        }
        else {
            x = 3;
        }

    }


    if(N == 1)
        x = 0;
    if(x==3)
        printf("No\n");
    else
    printf("Yes\n");
    

}


Measured memory_bytes: 512
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
-- end of templete


main = do
    [a, b] <- getInts
    when (a/=0 || b/=0) $ do
        n <- getInt
        arr <- newArray ((1,1),(a,b)) (-1) :: IO (IOUArray (Int,Int) Int)
        writeArray arr (1,1) 1
        replicateM_ n $ do
            [x, y] <- getInts
            writeArray arr (x,y) 0
        forM_ [(i,j) | i <- [1..a], j <- [1..b]] $ \(i,j) -> do
            c <- readArray arr (i,j)
            when (c==(-1)) $ do
                s <- if i/=1 then readArray arr (i-1,j) else return 0
                t <- if j/=1 then readArray arr (i,j-1) else return 0
                writeArray arr (i,j) (s+t)
        readArray arr (a,b) >>= print
        main

Measured memory_bytes: 4100
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
long long dp[100010];
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
  int N, h[100000];
  cin >> N;
  rep(i,N){
    cin >> h[i];
  }
  rep(i,100010){
    dp[i] = INF;
  }
  dp[0] = 0;
  for(int i=0;i<N;i++){
    chmin(dp[i+1],dp[i] + abs(h[i+1]-h[i]));
    chmin(dp[i+2],dp[i] + abs(h[i+2]-h[i]));
  }
  cout << dp[N-1] << endl;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

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

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

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

//main code
int main(int argc, char const* argv[])
{
	int a,b,k;
	cin >> a >> b >> k;
	VL num;
	for (int i = 1; i < min(a,b) + 1; i++) {
		if (a % i == 0 and b % i == 0) {
			num.push_back(i);
		}
	}
	cout << num[num.size() - k] << endl;
	return 0;
}



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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int A[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    int dpti[N];
    dpti[0] = 0;
    int one, two;
    for (int i = 1; i < N; i++) {
        if (i != 1) {
            one     = abs(A[i] - A[i - 1]) + dpti[i - 1];
            two     = abs(A[i] - A[i - 2]) + dpti[i - 2];
            dpti[i] = min(one, two);
        } else {
            dpti[i] = abs(A[i] - A[i - 1]);
        }
    }
    cout << dpti[N - 1] << endl;
}

Measured memory_bytes: 1024
fun main(arr:Array<String>) {
    val h = readLine()!!.toLong()
    println(getAns(h))
}

fun getAns(hp:Long):Long {
    if(hp == 1L) {
        return 1
    } else {
        val ret = getAns(hp/2)
        return ret * 2 + 1
    }
}

Measured memory_bytes: 31560
#include <stdio.h>

int ketawa(int n)
{
  if(n<100)
  {
    return n/10 + n%10;
  }
  else if(n<1000)
  {
     return n/100 + (n-(n/100)*100)/10 + n%10;
  }
  else if(n<10000)
  {
    return n/1000 + (n-(n/1000)*1000)/100 + (n-(n/100)*100)/10 + n%10;
  }
  else
  {
    return n/10000 + (n-(n/10000)*10000)/1000 + (n-(n/1000)*1000)/100 + (n-(n/100)*100)/10 + n%10;
  }
}

int main()
{
  int n,a,b;
  int sum=0;

  scanf("%d %d %d",&n,&a,&b);

  for(int i=1; i<=n; i++)
  {
    // printf("i;%d ketawa;%d\n",i,ketawa(i));
    if( a <= ketawa(i) && b >= ketawa(i))
    {
      // printf("sum;%d\n",sum);
      //printf("i;%d ketawa;%d\n",i,ketawa(i));
      sum = i + sum;
    }
  }
  printf("%d\n",sum);

  return 0;
}


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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define lint long long
#define FOR(i,a,b) for(lint i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define yes "Yes"
#define no "No"
#define divs 1000000007
#define dive 1000000009

typedef pair<int, int> P;

lint ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
	int k; cin>>k;
	int n; cin>>n;
	vector<int> a(n);
	REP(i,n) cin>>a[i];
	int ans = inf;
	REP(i,n-1){
		int now = k-(a[i+1]-a[i]);
		ans = min(ans,now); 
	}
	ans = min(ans,a[n-1]-a[0]);
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
/******************************************
* AUTHOR : PANDRAVISAM SHIVA SANTHOSH *
* Handle : santhosh_80 *
* INSTITUTION : IIT Palakkad *
******************************************/
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
#define ll long long int 
#define mod 1000000007
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define S(x) scanf("%d",&(x))
#define P(x) printf("%d\n",(x))
#define Sl(x) scanf("%lld",&(x))
#define Pl(x) printf("%lld\n",(x))
#define pb push_back
#define f first
#define s second

//can be used for all values of p which are not co-prime with 10 

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

	//int n;cin >> n ;
	int p = 2019 ;
	unordered_map<int ,ll> m ;
	ll pow_10 = 1;
	ll ans = 0;
	ll rem = 0;
	string str;cin >> str;
	int n = str.size();
	m[0]++;

	for(int i = n-1; i >= 0; i--){

		int x = str[i]-'0';
		rem = (rem + pow_10*x)%p ;
		m[rem]++;
		pow_10 = (pow_10*10)%p;
		rem=rem%p;
	}

	for(auto x : m){
		//if(x.f == 0)continue;
		ans = ans + (x.s)*(x.s-1)/2;
	}

	cout << ans;

 	return 0;
}

Measured memory_bytes: 3784
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> pii;
typedef std::pair<long long, long long> pll;

using namespace std;

const long long MOD = 1000000007;

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

	string s;
	cin >> s;

	int ans = 0;
	rep(i, s.length() / 2) {
		if (s[i] != s[s.length() - 1 - i]) ++ans;
	}

	cout << ans << "\n";

	return 0;
}


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

int x, y;

int main() {
    cin >> x >> y;
    
    if (x < y) swap(x, y);
    
    while (y > 0) {
        int mod = x % y;
        x = y;
        y = mod;
    }
    
    cout << x << endl;
    
    return 0;
}


Measured memory_bytes: 3084
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<iomanip>
#include<functional>
#include<numeric>
using namespace std;

int INF = 1e9 + 7;

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

int main() {
	int n, y;
	cin >> n >> y;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; i + j <= n; j++) {
			if (9*i + 4*j == (y / 1000) - n) {
				cout << i << " " << j << " " << n - i - j << endl;
				return 0;
			}
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
p = [int(x) - 1 for x in input().split()]

class UnionFind(object):
    def __init__(self, n):
        self._par = list(range(n))
        self.size = [1] * n
 
    def root(self, v):
        if self._par[v] == v:
            return v
        self._par[v] = self.root(self._par[v])
        return self._par[v]
 
    def unite(self, u, v):
        u, v = self.root(u), self.root(v)
        if u == v:
            return False
        if self.size[u] > self.size[v]:
            u, v = v, u # size[u] <= size[v]
        self.size[v] += self.size[u]
        self._par[u] = v
 
    def is_connected(self, u, v):
        return self.root(u) == self.root(v)

uf = UnionFind(n)
for _ in range(m):
    x, y = map(int, input().split())
    uf.unite(x-1, y-1)

ans = 0
for i in range(n):
    if uf.is_connected(i, p[i]):
        ans += 1

print(ans)

Measured memory_bytes: 20548
import sys

input = sys.stdin.readline


def main():
    A, B, C = map(int, input().split())

    ABC = [A, B, C]
    ABC.sort()

    ans = 0
    x = ABC[2] - ABC[1]
    ABC[0] += x
    ABC[1] += x
    y = ABC[1] - ABC[0]
    if y % 2 == 0:
        ans = x + y // 2
    else:
        ans = x + (y + 1) // 2 + 1
    print(ans)


if __name__ == "__main__":
    main()


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

int main(){
	int n;
	string s;
	long long ans = 0;

	cin >> n >> s;

	vector<int> r, g;
    set<int> b;
	for(int i=0; i<n; i++){
		if(s[i] == 'R'){
			r.push_back(i);
		}else if(s[i] == 'G'){
			g.push_back(i);
		}else{
			b.insert(i);
		}
	}

	for(int i=0; i<r.size(); i++){
		for(int j=0; j<g.size(); j++){
			int cnt = 0,  d = abs(r[i] - g[j]);
			int sm = min(r[i], g[j]), bi = max(r[i], g[j]);

			if((r[i]+g[j]) % 2 == 0){
				cnt += (b.count((r[i]+g[j])/2)) ? 1 : 0;
			}

			if(- d + sm >= 0){
				cnt += (b.count(-d+sm)) ? 1 : 0;
			}

			if(b.count(d+bi)){
				cnt++;
			}

			ans += b.size() - cnt;
		}
	}

	cout << ans << endl;
}



Measured memory_bytes: 3624
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
    int N; cin >> N;
    
    for (double i = 1; i <= 9; i++) {
        if ((N / i) == floor(N/i) and (N / i) >= 1 and (N / i) <= 9) {
            cout << "Yes";
            return 0;
        }
    }

    cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
int main(void)
{
	int a, b,c;
	cin >> a >> b >> c;
	if (a > b&&c > b)
	{
		if (a > c)
		{
			cout << b + c;
		}
		else
		{
			cout << b + a;
		}
	}
	else if (b > a&&c > a)
	{
		if (b > c)
		{
			cout << a + c;
		}
		else
		{
			cout << a + b;
		}
	}
	else
	{
		if (a > b)
		{
			cout << c + b;
		}
		else
		{
			cout << c + a;
		}
	}
	return 0;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
	int x,k;
	int maxx=-1,minn=10000;
	for(int i=1;i<=5;i++){
		scanf("%d",&x);
		maxx=max(maxx,x);
		minn=min(minn,x);
	}
	scanf("%d",&k);
	if(maxx-minn<=k)
		printf("Yay!\n");
	else
		printf(":(\n");
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define __V vector
#define all(x) x.begin(), x.end()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
typedef unsigned long long ull;
typedef long long ll;
typedef float ld;
typedef ll _I;
typedef pair<_I, _I> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
	doin();
	ll n, q, l, r, cc[100100], ac[100100], sc[100100];
	cin >> n >> q;
	string s;
	cin >> s;
	s = " " + s;
	for(int i = 1; i <= n; i++) {
		sc[i] = sc[i-1];
		if(s[i] == 'C' && i>1 && s[i-1] == 'A')
			sc[i]++;
	}
	while (q--) {
		cin >> l >> r;
		cout << (sc[r]-sc[l]) << "\n";
	}
	return 0;
}


Measured memory_bytes: 1772
n = int(input())
a = list(map(int, input().split())) + [10**18]
a = sorted(a)
c = 0
c_tmp = 1
num = a[0]
for i in range(1, n+1):
  if a[i] != num:
    if a[i-1] > c_tmp:
      c += c_tmp
    elif a[i-1] < c_tmp:
      c += c_tmp - a[i-1]
    c_tmp = 1
    num = a[i]
  else:
    c_tmp += 1
print(c)
    

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    ll A;
    string S;
    cin >> A >> S;
    ll B = 0;
    B += 100 * (S[0]-'0');
    B += 10 * (S[2]-'0');
    B += 1 * (S[3]-'0');
    cout << A * B / 100 << endl;

    return 0;
}

Measured memory_bytes: 3612
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.AGC_Challenge
{
    class _023_A
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] array = ReadInts();
            var sums = new Dictionary<long, long>();
            sums.Add(0, 1);
            long sum = 0;
            for(int i = 0; i < n; i++)
            {
                sum += array[i];
                if (!sums.ContainsKey(sum))
                {
                    sums.Add(sum, 0);
                }
                sums[sum]++;
            }

            long res = 0;
            foreach(var key in sums.Keys)
            {
                //Console.WriteLine(key+" "+sums[key]);
                res += sums[key] * (sums[key] - 1) / 2;
            }
            Console.WriteLine(res);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 42848
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int par[110000],rnk[110000];

void init(int n){
  rep(i,0,n){
    par[i]=i;
    rnk[i]=1;
  }
}

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

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

bool same(int x,int y){
 return find(x)==find(y); 
}

int spk[110000];

int main(){cout<<fixed<<setprecision(20);
           //unionfind O(kの総和)
           int n,m;
           cin>>n>>m;
           int k;
           init(n);
           rep(i,1,m+1){
             spk[i]=-1;
           }
           rep(i,0,n){
            cin>>k;
             int l;
             rep(j,0,k){
               cin>>l;
               if(spk[l]==-1){
                spk[l]=i; 
               }
               else{
                unite(i,spk[l]); 
               }
             }
           }
           bool ans=true;
           rep(i,0,n){
            if(find(0)!=find(i))ans=false; 
           }
           YES(ans);
}

Measured memory_bytes: 4580
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i--)
#define mmrep(i,a) for(int i=a;i>0;i--)
#define ll long long
#define INF 1123456789012
using namespace std;

int main(){
	ll x; cin >> x;
	ll count = 0;
	ll temp = 0;
	while (temp < x){
		temp += ++count;
	}cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  
  if(a == b){
    cout << "Draw" << endl;
  }
  else if(b == 1){
    cout << "Bob" << endl;
  }
  else if(a == 1){
    cout << "Alice" << endl;
  }
  else if(a > b){
    cout << "Alice" << endl;
  }
  else if(a < b){
    cout << "Bob" << endl;
  }

 
}
             
 


Measured memory_bytes: 3632
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
int main(void){
    ll W,H,x,y;cin>>W>>H>>x>>y;

    cout<<dcml(16)<<W*H/2.0<<" ";

    if(x*2==W and y*2==H)cout<<1<<"\n";
    else cout<<0<<"\n";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int[] count = new int[26];
	
	String S = scan.next();

	String ans = "yes";
	for (int i = 0; i < S.length(); i++) {
	    int index = S.charAt(i) - 'a';
	    count[index]++;
	    if(count[index] > 1) {
		ans = "no";
		break;
	    }
	}
	System.out.println(ans);
	scan.close();
    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }

constexpr int MAX_M = 20;
constexpr int MAX_N = 20;

int N, M, C;
int A[MAX_N][MAX_M];
int B[MAX_M];

void _main() {
  cin >> N >> M >> C;
  rep(i, 0, M) cin >> B[i];
  rep(i, 0, N) rep(j, 0, M) cin >> A[i][j];

  int ans = 0;
  rep(i, 0, N) {
    int t = 0;
    rep(j, 0, M) t += (A[i][j] * B[j]);
    t += C;
    if (t > 0) ans++;
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define M_PI  3.1415926535
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define Summon_Tourist ios::sync_with_stdio(false);cin.tie(0);
ll gcd(ll a , ll b) { return b==0?a: gcd( b, a%b); }
ll lcm(ll a , ll b) { return a/gcd(a,b) * b ; }
ll inf = 1e9 + 7;
ll modexp( ll base ,ll power)
 {
     if( power == 0  ) return 1;
     if( power & 1) return base*modexp( base , power-1 )%inf;
     return modexp(base*base%inf,power/2);
 }
 vector<ll> a[200005] ;
 vector<ll> visited(200005,0),weights(200005,1) ;
 ll dfs( ll x) {
   if( visited[x] ) return 0 ;
   visited[x] = 1 ;
   ll ret = weights[x] ;
   for( auto it : a[x] ) { if(visited[it]) continue ; ret += dfs(it) ; }
   return ret ;
    }
int main()
{
  Summon_Tourist
  //freopen("input.txt" , "r" , stdin ) ;
  ll t = 1;
  //cin>>t;
  while(t--)
  {
     ll n,m;
     cin>>n>>m;
     for( ll i = 0 ; i<m ; i++ ){
        ll x,y ;
        cin>>x>>y;
        a[x].push_back(y) ;
        a[y].push_back(x) ;
     }
    ll ans = -1 ;
    for( ll i = 1 ; i<=n ; i++ ){
        if( visited[i] != 1 ) {  ll ret = dfs(i) ; ans = max( ans , ret ); }
    }
    cout<<ans<<endl;

  }
return 0;


}


Measured memory_bytes: 23436
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;


signed main(){
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> x(n);
    rep(i, 0, n){
        cin >> x[i];
    }    
    int ans = 0;
    int now = x[0];
    rep(i, 1, n){
        if(a * (x[i] - x[i - 1]) < b) ans += a * (x[i] - x[i - 1]);
        else ans += b;
    }
    o(ans);
}

Measured memory_bytes: 1024
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<stdio.h>
using namespace std;
int main(){
    int h,w;
    cin>>h>>w;
    int masu[h+2][w+2];
    for(int i=1;i<h+1;i++){
        for(int j=1;j<w+1;j++){
            char c ;
            cin>>c;
            if(c=='#')masu[i][j]=1;
            else masu[i][j]=0;
        }
    }
    
    int flag=0;
    
    for(int i=1;i<h+1;i++){
        for(int j=1;j<w+1;j++){
            if(masu[i][j]==1){
                if(masu[i][j+1]==1||masu[i][j-1]==1){
                    
                }else if(masu[i-1][j]==1||masu[i+1][j]==1){
                   
                }else{
                    //cout<<masu[i-1][j]<<masu[i+1][j]<<endl;
                    //cout<<i<<j<<endl;
                    flag=1;break;}
              
            }
        }
        if(flag==1){break;
            
        }
    }
    cout<<(flag==1?"No":"Yes")<<endl;


return 0;
}

Measured memory_bytes: 256
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    cnt = [2500] * 26
    for i in range(n):
        s = input()
        cnts = [0] * 26
        for c in s:
            cnts[ord(c)- ord('a')] += 1
        
        for j in range(26):
            cnt[j] = min(cnt[j], cnts[j])
    
    for i in range(26):
        if cnt[i]>0:
            for j in range(cnt[i]):
                print(chr(ord('a')+i), end='')
    
    print()

solve()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,v;cin>>n;
  map<ll,ll> mp;
  for(ll x=1;x<=100;x++) {
    for(ll y=1;y<=100;y++) {
      for(ll z=1;z<=100;z++) {
        v=x*x+y*y+z*z+x*y+y*z+z*x;
        mp[v]++;
      }
    }
  }
  for(ll i=1;i<=n;i++) print(mp[i]);
  return 0;
}

Measured memory_bytes: 6008
#include<stdio.h>
#include<stdlib.h>
#include<math.h>


int main()
{
int n,k,i,j,l,cont=0;
int d[110],a[110];

scanf("%d %d",&n,&k);

for(i=0;i<110;i++)
{
    a[i]=0;
}

for(i=0;i<k;i++)
{
    scanf("%d",&d[i]);
    for(j=0;j<d[i];j++)
    {
        l=0;
        scanf("%d",&l);
        a[l]++;
    }
}

for(i=1;i<=n;i++)
{
    if(a[i]==0)
        cont++;
}

printf("%d",cont);
return 0;
}

Measured memory_bytes: 1732
N = int(input())
AA = list(map(int,input().split()))#0を含む可能性あり

A = []
count = 0
for i in range(N):
    if AA[i] != 0:
        A.append(AA[i])
    else:
        count += 1

NN = N - count
B = [abs(A[i]) for i in range(NN)]

if count == 0:
    det = 1
    s = A[0]//B[0]#最初のやつの符号
    for i in range(1,NN):
        if s * A[i] < 0:
            det = -1
            break

    if det == 1:#全て同符号
        m = min(B)

        M = sum(B) - 2 * m
        print(M)

        for i in range(NN):
            if m == B[i]:
                p = i
                break

        C = [A[i]//B[i] for i in range(NN)]

        C[p] *= -1

    else:#異符号が含まれる
        M = sum(B)
        print(M)
        C = [A[i]//B[i] for i in range(NN)]

    fp = -1 #firstplus
    fm = -1 #firstminus
    for i in range(NN):
        if fp == -1 and C[i] == 1:
            fp = i
        elif fm == -1 and C[i] == -1:
            fm = i
        elif fp != -1 and fm != -1:
            break

    X = []
    Y = []

    for i in range(NN):
        if i == fp or i == fm:
            continue
        if C[i] == -1:
            X.append(i)
        else:
            Y.append(i)

    x = A[fp]
    for i in X:
        print(x,A[i])
        x -= A[i]

    y = A[fm]
    for i in Y:
        print(y,A[i])
        y -= A[i]

    print(x,y)

elif A == []:
    print(0)
    for i in range(count-1):
        print(0,0)

else:

    det = 1
    s = A[0]//B[0]#最初のやつの符号
    for i in range(1,NN):
        if s * A[i] < 0:
            det = -1
            break

    M = sum(B)
    print(M)

    if det == 1:#全て同符号
        #これがまずい
        if s < 0:
            for i in range(count-1):
                print(0,0)
            x = 0
            for i in range(NN):
                print(x,A[i])
                x -= A[i]
        else:
            for i in range(count-1):
                print(0,0)
            x = 0
            for i in range(NN-1):
                print(x,A[i])
                x -= A[i]
            print(A[NN-1],x)
            




    else:#異符号が含まれる
        #こちらは今まで通り処理して最後に0を引きまくれば良い
        
        C = [A[i]//B[i] for i in range(NN)]

        fp = -1 #firstplus
        fm = -1 #firstminus
        for i in range(NN):
            if fp == -1 and C[i] == 1:
                fp = i
            elif fm == -1 and C[i] == -1:
                fm = i
            elif fp != -1 and fm != -1:
               break

        X = []
        Y = []

        for i in range(NN):
            if i == fp or i == fm:
                continue
            if C[i] == -1:
                X.append(i)
            else:
                Y.append(i)

        x = A[fp]
        for i in X:
            print(x,A[i])
            x -= A[i]

        y = A[fm]
        for i in Y:
            print(y,A[i])
            y -= A[i]

        print(x,y)

        for i in range(count):
            print(x-y,0)

Measured memory_bytes: 65580
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

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

int main(){
  string s;
  cin >> s;
  int n = s.size();
  vector<vector<mint>> dp(mx, vector<mint>(2,0));
  dp[0][0] = 1;
  rep(i,n){
    dp[i+1][0] = dp[i][0]*(s[i]=='1'?2:1);
    dp[i+1][1] = (s[i]=='0'?0:dp[i][0]) + dp[i][1]*3; 
  }
  mint ans = dp[n][0]+dp[n][1];
  cout << ans.x << endl;
  return 0;
}

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

int main() 
{
	int n, x, y, cur = 0;
	cin >> n >> x;
	for (int i = 1; i <= n; i++)
	{
		cin >> y;
		cur += y;
		if (x < cur) {cout << i; return 0;}
	}
	cout << n + 1;
}

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

int main(){
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<vector<int> > a(N, vector<int>());
    for(int i = 0; i < M; i++){
        int l, r;
        cin >> l >> r;
        a[l - 1].push_back(r - 1);
    }
    for(int i = 0; i < N; i++){
        sort(a[i].begin(), a[i].end());
    }
    for(int i = 0; i < Q; i++){
        int p, q;
        cin >> p >> q;
        p--; q--;
        int ans = 0;
        for(int j = p; j <= q; j++){
            ans += upper_bound(a[j].begin(), a[j].end(), q) - a[j].begin();
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 2176
N,K = list(map(int,input().split()))

e_list = [[] for i in range(N)]

for i in range(N-1):
    a,b = list(map(int,input().split()))
    a,b = a-1,b-1
    e_list[a].append(b)
    e_list[b].append(a)

if K==1:
    if N==1:
        print(1)
    else:
        print(0)
else:
    mod=10**9+7
    combA = [1]
    ca = 1
    for i in range(K-1):
        ca = (ca*(K-1-i))%mod
        combA.append(ca)
    combB = [1]
    cb = 1
    for i in range(K-2):
        cb = (cb*(K-2-i))%mod
        combB.append(cb)
    flag=True
    #print(combA)
    #print(combB)
    ans = K
    mod=10**9+7
    vi = 0 #時と場合によってここを変える
    from collections import deque
    Q = deque([vi])
    checked_list = [False for i in range(N)]
    checked_list[vi]=True
    while len(Q)>0:
        v = Q.pop()
        count=0
        for v1 in e_list[v]:
            if not checked_list[v1]:
                checked_list[v1]=True
                Q.appendleft(v1)
                count+=1
        
        if v==0:
            if count<=K-1:
                ans= (ans*combA[count])%mod
            else:
                flag=False
                break
        else:
            if count<=K-2:
                ans= (ans*combB[count])%mod
                #print(count)
            else:
                flag=False
                break
    if flag:
        print(ans)
    else:
        print(0)

Measured memory_bytes: 70816
n=int(input())
m=[]
a=[]
r=[]
c=[]
h=[]

for i in range(n):
    s=input()
    if s[0]=='M':
        m.append(s)
    elif s[0]=='A':
        a.append(s)
    elif s[0]=='R':
        r.append(s)
    elif s[0]=='C':
        c.append(s)
    elif s[0]=='H':
        h.append(s)

num=[0]*5
num[0]=len(m)
num[1]=len(a)
num[2]=len(r)
num[3]=len(c)
num[4]=len(h)

ans=0
for i in range(5):
    for j in range(i+1,5):
        for k in range(j+1,5):
            ans+=num[i]*num[j]*num[k]
print(ans)

Measured memory_bytes: 10100
#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
//#define int   long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int>
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >
#define vpl vector< pair<ll,ll> >
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define cd complex<double>
#define PI 4*atan(1)
#define mod %1000000007
#define pi 3.14159265358979323846//20 decimals
#define ld long double

ll h, n;
pair <ld, ld> p[1003];
ll dp[10004];

ll pro(ll id)
{
	ll i, j, k;
	if(dp[id] != -1)
		return dp[id];
	ll mn = 1000000000000000;
	fr(i,0,n)
	{
		ll tmp = 0;
		ll po = p[i].ff;
		ll pr = p[i].ss;
		if(po >= id)
			tmp = p[i].ss;
		else
			tmp = p[i].ss + pro(id - p[i].ff);
		mn = min(mn, tmp);
	}
	dp[id] = mn;
	return mn;
}

int main()
{
	FAST;
	ll i, j, k;
	cin >> h >> n;
	fr(i,0,h+1)
		dp[i] = -1;
	fr(i,0,n)
		cin >> p[i].ff >> p[i].ss;
	ll ans = pro(h);
	cout << ans;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};

int main() {
 ll N;
  ll K;
    cin >>N>>K;
  
  vl A(N);
  rep(i,N) {
    cin >>A.at(i);
  }
  
  ll a=N-1;
  ll b=K-1;
  long double x=(double)a/(double)b;
  ll c=ceil(x);
  cout<<c<<endl;
}
  
  
  


Measured memory_bytes: 1024
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<cstdio>
#include<string>
#include<vector>
#include<math.h>
#include<time.h>
#include<utility>
#include<cstdlib>
#include<sstream>
#include<cstring>
#include<stdio.h>
#include<iomanip>
#include<iostream>
#include<algorithm>
//#include<conio.h>
using namespace std;
int a[100032];
int ans;
int main(){
	ios::sync_with_stdio(false);
	int n;cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++){
		if(a[i]==i){
			if(i==1){
				swap(a[i],a[i+1]);
			}else if(i==n){
				swap(a[i],a[i-1]);
			}else{
				if(a[i+1]==i+1) swap(a[i+1],a[i]);
				else swap(a[i-1],a[i]);
			}
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
  int N,M,X,Y;
  cin>>N>>M>>X>>Y;
  vector<int> x(N),y(M);
  int max_x, min_y;
  for (int i = 0; i < N; i++) cin>>x[i];
  for (int i = 0; i < M; i++) cin>>y[i];
  sort(x.rbegin(),x.rend());
  sort(y.begin(),y.end());
  max_x = x[0];
  min_y = y[0];
  if (max_x < min_y && max_x >= X && min_y < Y) cout<<"No War"<<endl;
  else cout<<"War"<<endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int N = 1e4+50;
const ll oo = 1e18;
const ll mod = 1e9+7;


int main(){
    // 9opl.
    int n,m;
    cin>>n>>m;
    string x[n];
    for(int i=0;i<n;i++){
        cin>>x[i];
        bool ok=true;
        for(int j=0;j<m;j++)
            if(x[i][j]!='.'){
                ok=false;
                break;
            }
        if(ok){
            for(int j=0;j<m;j++){
                x[i][j]='@';
            }
        }
    }
    for(int i=0;i<m;i++){
        bool ok=true;
        for(int j=0;j<n;j++){
            if(x[j][i]=='@'||x[j][i]=='.')
                continue;
            ok=false;
            break;
        }
        if(ok){
            for(int j=0;j<n;j++){
                x[j][i]='@';
            }
        }
    }
    for(int i=0;i<n;i++){
        bool ok=true;
        for(int j=0;j<m;j++){
            if(x[i][j]=='@')
                continue;
            ok=false;
            cout<<x[i][j];
        }
        if(!ok)
            cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n[100] = { 0 };
	int	x[100] = { 0 };
	int i = 0,j;
	int a, b, c;
	int ways[100] = { 0 };
	while (1){
		scanf("%d %d", &n[i], &x[i]);
		if (n[i] == 0 && x[i] == 0){
			break;
		}
		for (a = 1; a <= n[i]; a++){
			for (b = 1; b <= n[i]; b++){
				for (c = 1; c <= n[i]; c++){
					if (a != b && b != c&&a != c){
						if (a  + b  + c == x[i]){
							ways[i]++;
						}
					}
				}
			}
		}
		ways[i] /= 6;
		i++;
		
	}

	for (j = 0; j < i; j++){
		printf("%d\n", ways[j]);
	}

}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;

int main() {
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  if (a + 1 > k) {
    cout << k << endl;
    return 0;
  }
  if (a + b + 1 > k) {
    cout << a << endl;
    return 0;
  }
  cout << a - (k - a - b) << endl;
  return 0;
}


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

using namespace std;

#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;

const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;

string s[405];
vi b[405 * 405], w[405 * 405];
bool bio[405][405];

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

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

	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		cin >> s[i];
	}
	int co = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			if(!bio[i][j]){
				bio[i][j] = 1;
				queue <ii> q;
				q.emplace(i, j);
				while(!q.empty()){
					ii temp = q.front();
					q.pop();
					if(s[temp.first][temp.second] == '.') w[co].push_back(1);
					else b[co].push_back(1);
					for(int k = 0; k < 4; k++){
						int nx = temp.first + dx[k];
						int ny = temp.second + dy[k];
						if(nx < 0 || ny < 0 || nx >= n || ny >= m || bio[nx][ny] || s[temp.first][temp.second] == s[nx][ny]) continue;
						q.emplace(nx, ny);
						bio[nx][ny] = 1;
					}
				}
				co++;
			}
		}
	}
	ll res = 0;
	for(int i = 0; i < co; i++){
		res += (b[i].size() * w[i].size());
	}
	cout << res;
}

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

x = int(input())
L = []

if x == 1:
    print(1)
    exit()

for i in range(2, 1001):
    for j in range(2,11):

        temp = i**j

        if temp <= x:
            L.append(temp)
        else:
            break

L.sort()

print(L[-1])

Measured memory_bytes: 3060
N=int(input())
A=list(map(int,input().split()))
daisum=0
maxheight=A[0]
for  i in range(1,N):
    if A[i]<maxheight:
        daisum+=maxheight-A[i]
    else:
        maxheight=A[i]
print(daisum)


Measured memory_bytes: 105280
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000

#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n;
vector<pair<ll,ll>>vec;
vector<ll>za;
ll ans;
ll mnx=1e18,mxx=-1e18,mny=1e18,mxy=-1e18;
struct RMQ{
	#define s (1<<19)
	ll seg[s];
	void init(){ fill(seg,seg+s,-1e18); }
	void update(int k,ll a){
		k+=s/2-1; seg[k]=a;
		while(k>0){
			k=(k-1)/2;
			seg[k]=max(seg[k*2+1],seg[k*2+2]);
		}
	}
	ll query(int a,int b,int k,int l,int r){
		if(r<a || b<l) return -1e18;
		if(a<=l && r<=b) return seg[k];
		else{
			ll vl=query(a,b,k*2+1,l,(l+r)/2);
			ll vr=query(a,b,k*2+2,(l+r)/2+1,r);
			return max(vl,vr);
		}
	}
}kaede[2][2];
int main(){
	scanf("%d",&n);
	repn(i,n){
	    ll x,y;
		scanf("%lld%lld",&x,&y);
		if(x > y) swap(x,y);
		vec.pb(mp(x,y));
		za.pb(x); za.pb(y);
		mnx = min(mnx,x); mxx = max(mxx,x);
		mny = min(mny,y); mxy = max(mxy,y);
	}
	ans = (mxx-mnx) * (mxy-mny);
	rep(a,2)rep(b,2) kaede[a][b].init();
	sort(vec.begin(),vec.end());
	rep(i,vec.size()){
		kaede[0][0].update(i,vec[i].fi);
		kaede[0][1].update(i,-vec[i].fi);
		kaede[1][0].update(i,vec[i].sc);
		kaede[1][1].update(i,-vec[i].sc);
	}
	SORT(za); ERASE(za);
	int id = POSL(za,mxx);
	
	for(int i=0;i<za.size();i++){
		int pos = POSL(vec,mp(za[i],-1ll));
		ll MX = kaede[1][0].query(0,pos-1,0,0,s/2-1);
		MX = max(MX,kaede[0][0].query(pos,n-1,0,0,s/2-1));
		ll MN = kaede[1][1].query(0,pos-1,0,0,s/2-1);
		MN = max(MN,kaede[0][1].query(pos,n-1,0,0,s/2-1));
		ll val = MX+MN;
		ans = min(ans, (mxy-mnx) * val);
	}
	cout << ans << '\n';
}


Measured memory_bytes: 24924