akhauriyash/Code-Regression huggingface dataset:
// {{{ by shik
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

#ifdef SHIK
template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) do { \
    fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); \
    _dump(#__VA_ARGS__, __VA_ARGS__); \
} while (0)

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T, size_t N>
ostream& operator <<( ostream &s, const array<T,N> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
#else
#define dump(...)
#endif

template<typename T>
void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( long long &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }

void R() {}
template<typename T, typename... U>
void R( T& head, U&... tail ) {
    _R(head);
    R(tail...);
}

template<typename T>
void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
template<typename T>
void _W( const vector<T> &x ) {
    for ( auto i=x.cbegin(); i!=x.cend(); i++ ) {
        if ( i!=x.cbegin() ) putchar(' ');
        _W(*i);
    }
}

void W() {}
template<typename T, typename... U>
void W( const T& head, const U&... tail ) {
    _W(head);
    putchar(sizeof...(tail)?' ':'\n');
    W(tail...);
}

#ifdef SHIK
#define FILEIO(...)
#else
#define FILEIO(name) do {\
    freopen(name ".in","r",stdin); \
    freopen(name ".out","w",stdout); \
} while (0)
#endif

// }}}

const int N=1e5+10;
char s[N];
int main() {
    R(s);
    int n=strlen(s);
    REP(i,n-1) if ( s[i]==s[i+1] ) {
        W(i+1,i+2);
        return 0;
    }
    REP(i,n-1) if ( s[i]==s[i+2] ) {
        W(i+1,i+3);
        return 0;
    }
    W(-1,-1);
    return 0;
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N, R; cin >> N >> R;
    if(N >= 10) cout << R << endl;
    else cout << R + 100*(10-N) << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4352
import sys

def input():
    return sys.stdin.readline().strip()

def main():

    K = int(input())

    if K % 2 == 0:
        print(-1)
        exit()

    ans = 1
    X = 7
    count = K
    while count > 0:
        mod = X % K
        if mod == 0:
            break
        else:
            ans += 1
            X = mod * 10 + 7
            count -= 1
    print(ans if count > 0 else -1)
        

if __name__ == "__main__":
    main()

Measured memory_bytes: 9184
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n,k; cin >> n >> k;
  vl loglong(n); ll maxcnt = 0;
  
  rep(i,n){
    cin >> loglong[i];
    maxcnt = max(maxcnt,loglong[i]);
  }
  
    ll left = 0;
    ll right = maxcnt;

    while (right - left > 1) {
        ll mid = left + (right - left) / 2;
      
        ll cnt = 0;
        
        rep(i,n){
          cnt += (loglong[i]+mid-1) / mid - 1;
        }
        
        if (cnt <= k) right = mid;
        else left = mid;
      
      
    }

    
    
    cout << right << endl;
      
      
}



Measured memory_bytes: 4828
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

#define MAX_V 205
int V;
VI G[MAX_V];
int match[MAX_V];
bool used[MAX_V];

void add_edge(int u, int v) {
  G[u].PB(v);
  G[v].PB(u);
}

bool dfs(int v) {
  used[v] = true;
  REP(i, G[v].size()) {
    int u = G[v][i], w = match[u];
    if(w < 0 || !used[w] && dfs(w)) {
      match[v] = u;
      match[u] = v;
      return true;
    }
  }
  return false;
}

int bipartite_matching() {
  int res = 0;
  memset(match, -1, sizeof(match));
  REP(v, V) {
    if(match[v] < 0) {
      memset(used, 0, sizeof(used));
      if(dfs(v)) res++;
    }
  }
  return res;
}

int a[105], b[105], c[105], d[105];
signed main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;
  REP(i, n) cin >> a[i] >> b[i];
  REP(i, n) cin >> c[i] >> d[i];
  V = 2*n;

  REP(i, n) REP(j, n) {
    if(a[i] < c[j] && b[i] < d[j]) {
      // cout << i << "," << n+j << endl;
      add_edge(i, n+j);
    }
  }

  cout << bipartite_matching() << endl;

  return 0;
}


Measured memory_bytes: 384
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x, y;
  cin >> x >> y;
  vector<int> vec{0,1,3,1,2,1,2,1,1,2,1,2,1};
  bool f = false;
  if(vec[x] == vec[y]) f = true;
  YesorNo(f);
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
s = input()
t = ""
count = 0
for i in range(len(s)):
  if i == 0:
    t += s[i]
  elif i == len(s) - 1:
    t += s[i]
  else:
    count += 1
    if i == len(s) - 2:
      t += str(count)
print(t)


Measured memory_bytes: 2940
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	a, v := scanInt(), scanInt()
	b, w := scanInt(), scanInt()
	t := scanInt()
	if w != v && abs(a-b) <= t*(v-w) && v >= w {
		fmt.Fprintln(wr, "YES")
	} else {
		fmt.Fprintln(wr, "NO")
	}
}


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

int main(){
	string s;
  	cin >> s;
  	if(s[2]==s[3]&&s[4]==s[5]){
    	cout << "Yes\n";
    }else{
    	cout << "No\n";
    }
  	return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  int sum = 0;
  for(int i=0; i<m; i++){
    int a;
    cin >> a;
    sum += a;
  }
  if(sum>n){
    cout << -1 << endl;
  }
  else{
    cout << n-sum << endl;
  }
}



Measured memory_bytes: 3616
#include<stdio.h>
int main()
{
  int n1, n2;
  char temp;
  scanf("%d", &n1);
  scanf("%d", &n2);
  printf("a");
  if(n1>n2)
    {
      temp = '>'; 
      printf(" %c ", temp);
    }
  if(n1<n2)
    {
      temp = '<';
      printf(" %c ", temp);
    }
 if(n1 == n2)
    {
      temp = '=';
      printf(" %c%c ", temp, temp);
    }
  printf("b\n");
}


Measured memory_bytes: 2140
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

#define ll long long
#define FOR(x,z,y) for(ll x=z; x < (ll)y; x++)



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

    ll r;
    cin >> r;
    cout << 2*r*M_PI;
}


Measured memory_bytes: 3820
#include <bits/stdc++.h> 
using namespace std; 
  
// Graph class represents a undirected graph 
// using adjacency list representation 
class Graph { 
    // No. of vertices 
    int V; 
  
    // Pointer to an array containing adjacency lists 
    list<int>* adj; 
  
    // A function used by DFS 
    void DFSUtil(int v, bool visited[]); 
  
public: 
    // Constructor 
    Graph(int V); 
  
    void addEdge(int v, int w); 
    int NumberOfconnectedComponents(); 
}; 
  
// Function to return the number of 
// connected components in an undirected graph 
int Graph::NumberOfconnectedComponents() 
{ 
  
    // Mark all the vertices as not visited 
    bool* visited = new bool[V]; 
  
    // To store the number of connected components 
    int count = 0; 
    for (int v = 0; v < V; v++) 
        visited[v] = false; 
  
    for (int v = 0; v < V; v++) { 
        if (visited[v] == false) { 
            DFSUtil(v, visited); 
            count += 1; 
        } 
    } 
  
    return count; 
} 
  
void Graph::DFSUtil(int v, bool visited[]) 
{ 
  
    // Mark the current node as visited 
    visited[v] = true; 
  
    // Recur for all the vertices 
    // adjacent to this vertex 
    list<int>::iterator i; 
  
    for (i = adj[v].begin(); i != adj[v].end(); ++i) 
        if (!visited[*i]) 
            DFSUtil(*i, visited); 
} 
  
Graph::Graph(int V) 
{ 
    this->V = V; 
    adj = new list<int>[V]; 
} 
  
// Add an undirected edge 
void Graph::addEdge(int v, int w) 
{ 
    adj[v].push_back(w); 
    adj[w].push_back(v); 
} 
  
// Driver code 
int main() 
{   
    int n,m;
    cin>>n>>m;
    
    Graph g(n);
    
    while(m--){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        g.addEdge(a,b); 
    }
    
  
    cout << g.NumberOfconnectedComponents()-1; 
  
    return 0; 
} 

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

int main(){
    double ans_d = 0, ans_if = 0;
    int ans_i = 0;
    double a,b;
    cin >> a >> b;
    ans_i = (a+b)/2;
    ans_d = (a+b)/2;
    ans_if = ans_d - ans_i;
    if(ans_if >= 0.5) cout << ans_i + 1 << endl;
    else cout << ans_i << endl;
}

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

const ll maxs = 1e5+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

void pre(){

}

const ll N = 2003;

ll dp[N][2*N];
bool vis[N][2*N];
pair<ll,ll> a[N];
ll n;

ll go(ll ind,ll i,ll j){
    if(ind >= n )
        return 0;
    ll& ans = dp[ind][i-1+j-1];
    if(vis[ind][i-1+j-1])
        return dp[ind][i-1+j-1];
    vis[ind][i-1+j-1] = true;
    ans = a[ind].ff*abs(i - a[ind].ss) + go(ind+1,i+1,j);
    ans = max( ans , a[ind].ff*abs(j - a[ind].ss) + go(ind+1,i,j-1) );
    return ans;
}

void solve(){ 
    cin >> n;
    for(ll i=0;i<n;i++){
        ll val;
        cin >> val;
        a[i].ff = val;
        a[i].ss = i;
    }
    sort(a,a+n);
    reverse(a,a+n);
    ll ans = go(0,0,n-1);
    cout << ans << endl;
}


int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;   
    //cin>>T;
    while(T--){  
        solve();
    }
    return 0;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
#define mp            make_pair
template<class T, class S> inline bool minup(T& m, const S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, const S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-10;

string s;

int main()
{
  cin >> s;

  vrep(v, s) *v = *v  - 3 < 'A' ? *v - 3 + 'Z' - 'A' + 1 : *v - 3;

  cout << s << endl;

  return 0;
}

Measured memory_bytes: 1184
#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)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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;}
int const INF = 1001001001;


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

int N,K;
cin >> N >> K;
vi A(N);
rep(i,N) cin >> A[i];

int R = N-K;
K--;
cout << (R+K-1)/K + 1 << endl;
return 0;
}

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

int main() {
  char a,b;
  cin >> a >> b;
  cout << (a-b == 0 ? 'H' : 'D') << endl;
  return 0;
}

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

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<63;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

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

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

int main(void){
    int N; cin >> N;
    VI H(N); REP(i,N) cin >> H[i];
    REVERSE(H);
    REP(i,N-1){
        if(H[i+1]-H[i] == 1) H[i+1] = max(0, H[i+1]-1);
        else if(H[i+1] - H[i] > 1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> city(N);
  vector<int> count(N);

  for (int i = 0; i < N; i++) {
	  city.at(i) = i + 1;
  }

  int cCity1,cCity2 = 0;

  for (int i = 0; i < M; i++) {
	for (int j = 0; j < 2; j++) {
		cin >> cCity1;
		for (int k = 0; k < N; k++) {
			if (cCity1 == city.at(k)) {
				count.at(k)++;
				break;
			}
		}
	}
  }

  for (int i = 0; i < N; i++) {
	 cout << count.at(i) << endl;
  } 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
typedef long long ll;
typedef pair<int,int> Pii;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m,cx,cy;
	cin>>n>>m>>cx>>cy;
	int x[n];
	int y[m];
	for(int i=0;i<n;i++){
		cin>>x[i];
	}
	for(int i=0;i<m;i++){
		cin>>y[i];
	}
	int max=cx;
	int min=cy;
	for(int i=0;i<n;i++){
		max=max(max,x[i]);
	}
	for(int i=0;i<m;i++){
		min=min(min,y[i]);
	}
	if(max<min){
		cout<<"No War";
	}else{
		cout<<"War";
	}
	return 0;
}




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

using ll = long long;
using vll = vector<long long>;
using vi = vector<int>;

// Long long max = 1LL << 50LL;

int solve(vector<vll> m){
  ll res = *max_element(m[0].begin(), m[0].end());
  for(ll i = 1; i < m.size(); i++){
    for(ll j = 0; j<m[i].size(); j++){
      ll prev = 0;
      if(j == 0){
        prev = max(m[i-1][j+1], m[i-1][j+2]);
      } else if(j == 1){
        prev = max(m[i-1][j-1], m[i-1][j+1]);
      } else {
        prev = max(m[i-1][j-2], m[i-1][j-1]);
      }
      m[i][j] += prev;
      res = max(res, m[i][j]);
    }
  }
  return res;
}


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

  int n;
  cin >> n;

  vector<vll> m(n, vll(3));
  for(auto &row: m) {
    for(auto &x: row) cin >> x;
  }
  cout << solve(m) << endl;
  return 0;
}

Measured memory_bytes: 11264
import java.io.*;
import java.util.*;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();

        ArrayList<Integer>[] edge = new ArrayList[N];
        Arrays.setAll(edge, i -> new ArrayList<>());
        for (int i = 1; i < N; i++) {
            int a = in.i() - 1;
            int b = in.i() - 1;
            edge[a].add(b);
            edge[b].add(a);
        }

        int[] c = in.ii(N);
        Arrays.sort(c);

        int[] q = new int[N - 1];
        int qi = 0;
        q[qi++] = 0;

        int[] d = new int[N];
        for (int i = N - 1; i >= 0; i--) {
            int v = q[--qi];
            d[v] = c[i];
            for (int u : edge[v]) {
                if (d[u] == 0) {
                    q[qi++] = u;
                }
            }
        }

        long M = 0;
        for (int i = N - 2; i >= 0; i--) {
            M += c[i];
        }

        StringBuilder sb = new StringBuilder();
        sb.append(M).append('\n');
        for (int i = 0 ; i < N; i++) {
            sb.append(d[i]).append(' ');
        }
        System.out.println(sb);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    }

    public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }
}


Measured memory_bytes: 38636
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(int i=a; i<int(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto& e:c)
#define iter(it,c) for(auto it=c.begin(); it!=c.end(); ++it)

ll const inf = 1<<28;
double const pi = acos(-1);

int g[9][9];
bool ok[9][9];

void solve(){
    rep(y,9)rep(x,9){
        loop(i,y+1,9){
            if(g[y][x]==g[i][x]){
                ok[i][x]=false;
                ok[y][x]=false;
            }
        }

        loop(j,x+1,9){
            if(g[y][x]==g[y][j]){
                ok[y][j]=false;
                ok[y][x]=false;
            }
        }
    }

    rep(i,3)rep(j,3){
        rep(a,9){
            int x=a%3+i*3;
            int y=a/3+j*3;
            loop(b,a+1,9){
                int xx=b%3+i*3;
                int yy=b/3+j*3;
                if(g[y][x]==g[yy][xx]){
                    ok[yy][xx]=false;
                    ok[y][x]=false;
                }
            }
        }
    }

}

int main(){
    int n;
    cin>>n;
    rep(i,n){
        rep(y,9)rep(x,9){
            ok[y][x]=true;
        }
        rep(y,9)rep(x,9)cin>>g[y][x];
        solve();
        rep(y,9)rep(x,9){
            printf("%c%d",ok[y][x]?' ':'*',g[y][x]);
            if(x+1==9)puts("");
        }
        if(i+1!=n)puts("");
    }
}

Measured memory_bytes: 1144
#include<stdio.h>


int main(void){
    int N;
    scanf("%d", &N);
    int cnt = 0;
    for(int i = 1;i <= N; i = i+2){
        int yakusu_cnt;
        yakusu_cnt = 0;
        for(int j = 1;j <= i;j++){
            if(i % j == 0){
                yakusu_cnt++;
            }
        } 
        if(yakusu_cnt == 8){
            cnt++;
        }
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 1724
from collections import deque
N, Q = map(int, input().split())
tree = [[]*N for _ in range(N)]
for _ in range(N-1):
    a, b = map(lambda x: int(x)-1, input().split())
    tree[a].append(b)
    tree[b].append(a)
counter = [0]*N
for _ in range(Q):
    p, x = map(int, input().split())
    p -= 1
    counter[p] += x
# print(tree)
# print(counter)
# 幅優先探索で値を葉の方へ伝えていく
q = deque([0])
visited = [False]*N
visited[0] = True
while len(q):
    v = q.pop()
    for e in tree[v]:
        if visited[e]:
            continue
        visited[e] = True
        counter[e] += counter[v]
        q.append(e)
print(" ".join(map(str, counter)))


Measured memory_bytes: 67208
import sys
N = int(input())
A = list(map(int, input().split())) 
MAX = 10**6

not_pairwise_coprime = False #pairwise coprimeでないことを示すbool値(のちに更新)

# Aの要素に重複がある場合、少なくともpairwise coprimeではない
Ct = [0 for _ in range(MAX+1)]
for a in A:
  Ct[a] += 1 
if max(Ct[2:MAX+1]) > 1:
  not_pairwise_coprime = True
  
if max(Ct[2:MAX+1]) == N: # 全ての要素が等しい場合(例外処理)
  print("not coprime")
  sys.exit()
  
A = set(A) #集合型に書き換える(「q in A」をO(1)で判定するため)
N = len(A)

for p in range(2,MAX+1):
  ct = 0 #pの倍数の個数を求める
  for q in range(p,MAX+1,p): #qはpの倍数全てを走る
    if q in A:
      ct += 1
  
  # ct = Nのとき、pはすべてのA_nの約数。つまり、Aはnot coprime
  if ct == N:
    print("not coprime")
    sys.exit()
  
  # 2 <= ct < Nのとき、pは2つ以上のA_nの約数。つまり、Aはpairwise coprimeではない。
  # setwise coprimeか、not coprimeかを判定するため、次のpを調べる必要あり。 
  elif ct >= 2:
    not_pairwise_coprime = True
  
  # ct <= 1のとき、pはどの２つのA_nの公約数にも一致しない。次のpを調べる必要あり。
  #else: continue
  
  
# ループが途中で終わるのは、not coprimeの場合であり、その場合に限る。
# したがって、この時点で可能性があるのは、setwise coprimeかpairwise coprimeのどちらか。
print("setwise coprime" if not_pairwise_coprime else "pairwise coprime")
  
    
  

Measured memory_bytes: 223592
package main

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

var scanner = bufio.NewScanner(os.Stdin)

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

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func main() {
	scanner.Split(bufio.ScanWords)
	dict := make(map[string]int)
	q := nextInt()
	for i := 0; i < q; i++ {
		switch nextInt() {
		case 0:
			key := nextString()
			x := nextInt()
			if _, ok := dict[key]; ok {
				dict[key] = x
			} else {
				dict[key] = x
			}
		case 1:
			key := nextString()
			if _, ok := dict[key]; ok {
				fmt.Println(dict[key])
			} else {
				fmt.Println(0)
			}
		case 2:
			key := nextString()
			delete(dict, key)
		default:
			panic("no such operation!")
		}
	}
}


Measured memory_bytes: 18932
#include <math.h>
#include <ctype.h>
#include <limits.h>
#include <assert.h>

#include <vector>
#include <numeric>
#include <iostream>
#include <algorithm>
#include <functional>

#define nl                std::cout << "\n"
#define in(x)             std::cin  >> (x)
#define out(x)            std::cout << (x) << " "
#define err(x)            std::cerr << #x << "=" << (x) << " | "

#define inn(x)            int x; in(x)
#define rep(i, n)         for (int i =  0 ; i < (n); ++i)
#define per(i, n)         for (int i = (n) - 1; i > -1; --i)
#define repr(i, l, r)     for (int i = (l); i < (r); ++i)

#define no                puts("NO")
#define yes               puts("YES")

using ll  = long long int;
using vi  = std::vector<int>;
using ii  = std::pair<int, int>;
using iii = std::pair< ii, int>;
using vii = std::vector<ii>;

const int N = 1010101;
const int MD = 1e9 + 7;

void solve() {
    inn(n); inn(W);

    int w[n], v[n];
    rep(i, n) {
        in(w[i]);
        in(v[i]);
    }

    ll dp[n][W + 1];
    rep(i, w[0]) dp[0][i] = 0;
    repr(i, w[0], W + 1) dp[0][i] = v[0];

    repr(i, 1, n) {
        for (int j = W; j >= w[i]; --j) {
            dp[i][j] = std::max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
        }
        for (int j = w[i] - 1; j > -1; --j) {
            dp[i][j] = dp[i - 1][j];
        }
    }

    out(dp[n - 1][W]);
}

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

    //inn(t); repr(tc, 1, t + 1)
    solve();

    return 0;
}


Measured memory_bytes: 78336
#include<iostream>
#include<vector>
using namespace std;
int main() {
    int n; cin >> n;
    vector<int> a(n), v;
    v.push_back(0);
    for (int i = 0; i < n;++i) {
        cin >> a[i];
        if (i > 0) {
            if (a[i - 1] < a[i]) {
                v.push_back(v.back() + 1);
            } else if (a[i - 1] > a[i]) {
                v.push_back(v.back() - 1);
            }
        }
    }
    int m = (int)v.size();
    int ans = 1;
    for (int i = 1; i < m - 1; ++i) {
        if ((v[i] - v[i - 1]) * (v[i] - v[i + 1]) > 0) { //大小変わった
            ++ans;
            //順に数列を切り出すことを考える
            //すると、左端は1個ぼとばし
            ++i;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1276
#include <iostream>

using namespace std;

int main(int argc, const char * argv[]) {
    int H1, M1, H2, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    int d = (H2-H1)*60 + M2-M1 - K;
    cout << d << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define pb push_back
#define upmax(a,b) (a)=max((a),(b))
using namespace std;

const int MAXN = 2005;

vector<int> G[MAXN];

int dp[MAXN][MAXN];

int dep[MAXN], mxl[MAXN];

int N, K, Ans;

void f(int i, int d) {
	dep[i] = d;
	for(int v : G[i]) if(!dep[v]) {
		f(v, d+1);
		upmax(mxl[i], mxl[v]+1);
	}
	for(int v : G[i]) if(dep[v] > dep[i]) {
		for(int l = mxl[v]+1; l < mxl[i]; l++)
			dp[v][l] = dp[v][mxl[v]];
	}
	dp[i][0] = 1;
	for(int l = 0; l < mxl[i] && l < K; l++) {
		int &ret = dp[i][l+1];
		if(2*l + 2 <= K) {
			for(int v : G[i]) if(dep[v] > dep[i])
				ret += dp[v][l];
		} else if(0 <= K-l-2) {
			int sum = 0;
			for(int v : G[i]) if(dep[v] > dep[i])
				sum += dp[v][K-l-2];
			for(int v : G[i]) if(dep[v] > dep[i])
				upmax(ret, sum - dp[v][K-l-2] + dp[v][l]);
		} else {
			for(int v : G[i]) if(dep[v] > dep[i])
				upmax(ret, dp[v][l]);
		}
		ret++;
	}
}

int main() {
	cin >> N >> K;
	for(int i = 1, a, b; i < N; i++) {
		cin >> a >> b;
		G[a].pb(b); G[b].pb(a);
	}

	f(1, 1);

	for(int i = 1; i <= N; i++)
		upmax(Ans, *max_element(dp[i], dp[i]+mxl[i]+1));
	cout << N-Ans << endl;
	return 0;
}

Measured memory_bytes: 15488
a,b,c,x,y = map(int, input().split())

#A,Bだけで買う場合
bill_ab = a * x + b * y

#少ないほうはCで賄う場合
if x <= y:
  bill_abc = x * 2*c + (y - x) * b
else:
  bill_abc = y * 2*c + (x - y) * a

bill_c = max(x,y) * 2*c


print(min(bill_ab, bill_abc, bill_c))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main () {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
ll n,a,b;
cin>>n>>a>>b;
ll c=a+b;
ll d = n%c;
if(d>=a)
	cout<<((n/c)+1)*a;
else
{
	cout<<(n/c)*a+d;
}


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#define REP(i,k,n) for(int(i)=(k);(i)<(n);++(i))
using namespace std;

const int N_MAX = 110;
const int INF = int(1e9);

int main()
{
  int N;
  int s[N_MAX];
  cin >> N;
  REP(i,0,N) cin >> s[i];

  // 合計を計算
  int sum = 0;
  REP(i,0,N) sum += s[i];

  // 10の倍数でない s[i] のうちで、最小のものを探す
  int m = INF;
  REP(i,0,N) {
    if (s[i] % 10 != 0 && s[i] < m)
      m = s[i];
  }

  int res;
  if (sum % 10 != 0) res = sum;
  else if (m < INF) res = sum - m;
  // すべてが10の倍数の場合
  else res = 0;

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
// A.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;
int main()
{
    int a, b, c;

    cin >> a >> b >> c;

    if (a - b >= c) {
        cout << 0 << endl;
    }
    else {
        cout << c-(a - b)  << endl;
    }
    return 0;
}



Measured memory_bytes: 3608
#include <iostream>
using namespace std;
 
#define ll long long
#define pb push_back
#define mp make_pair
#define mo 1000000007
#define MAX 1000004

#define fast_io ios::sync_with_stdio(false)

long long foobar(long long a, long long b)
{
	return abs(a-b)/2;
}
int main()
{
	fast_io;

	long long n,a,b;
	cin >> n >> a >> b;
	if(a > b)
	{
		long long temp = a;
		a = b;
		b = temp;
	}
	if(abs(a-b) % 2 == 0)
		cout << abs(a-b)/2 << endl;
	else
		cout << min(a + foobar(1, b - a), n - b + 1 + foobar(min(n, a + n - b + 1), n)) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

int main() {
  ll n,k;
  cin >> n >> k;
  vector<ll> A(n, 0);
  for(ll i=0; i<n; i++) {
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  ll ans = 0;
  for(ll i=0; i<k; i++) {
    ans += A[i];
  }
  cout << ans << endl;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  ll X; cin >> X;
  ll i = 100;
  int ans = 0;
  while(true) {
    i += i / 100;
    ans++;
    if(i >= X || i < 0) break;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <map>
using namespace std;
static const int Inf = 1 << 30;
int main()
{
    string S;
    cin >> S;
    deque<char> deq;
    for (int i = 0; i < S.size(); ++i)
    {
        deq.push_back(S[i]);
    }
    int Q;
    cin >> Q;
    int head = true; // true:左端が先端 false:右端が先端
    for (int q = 0; q < Q; ++q)
    {
        int t;
        cin >> t;
        if (t == 1)
        {
            head = !head;
        }
        else
        {
            int f;
            char c;
            cin >> f >> c;
            if (f == 1)
            {
                if(head) deq.push_front(c);
                else deq.push_back(c);
            }
            else
            {
                if (head) deq.push_back(c);
                else deq.push_front(c);
            }
            
        }
    }
    
    if(head)
    {
        for (auto it = deq.cbegin(); it != deq.cend(); ++it)
        {
            cout << *it;
        }
        cout << endl;
        return 0;
    }
    else
    {
        for (auto it = deq.crbegin(); it != deq.crend(); ++it)
        {
            cout << *it;
        }
        cout << endl;
        return 0;
    }
    
    return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
#define ll long long
ll read() {ll x = 0;char f = 1, ch = getchar();while(ch < '0' || ch > '9') {if(ch == '-')f = -1;
ch = getchar();}while(ch >= '0' && ch <= '9') {x = x * 10 + ch - '0';ch = getchar();}return x * f;}
void write(ll x) {if(x < 0) x = -x, putchar('-');if(x > 9) write(x / 10);putchar(x % 10 + '0');}
inline void writeln(ll x) {write(x);puts("");}
using namespace std;
const int N = 300000;
int a[N], n, ans = 0x3f3f3f3f, d[N];
int main() {
	n = read();
	for(int i = 1; i <= n; ++i) {
		int x = read();
		d[x] = d[x - 1] + 1;
		ans = min(ans , n - d[x]);
	}
	writeln(ans);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#ifdef DEMETRIO
#define deb(...) fprintf(stderr,__VA_ARGS__)
#define deb1(x) cerr << #x << " = " << x << endl
#else
#define deb(...) 0
#define deb1(x) 0
#endif
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define SZ(x) ((int)(x).size())
#define mset(a,v) memset(a,v,sizeof(a))
#define mcopy(a,b) memcpy(a,b,sizeof(a))
using namespace std;
typedef long long ll;

int dp[302][302][302];
char s[302];int n,k;

int f(int i, int j, int k){
	int& r=dp[i][j][k];
	if(r>=0)return r;
	if(i==0||j==n)r=0;
	else if(s[i-1]==s[j])r=1+f(i-1,j+1,k);
	else {
		r=max(f(i-1,j,k),f(i,j+1,k));
		if(k)r=max(r,1+f(i-1,j+1,k-1));
	}
	return r;
}

int main(){
	memset(dp,-1,sizeof(dp));
	scanf("%s%d",s,&k);n=strlen(s);
	int r=0;
	fore(i,0,n)r=max(r,2*f(i,i,k)),r=max(r,2*f(i,i+1,k)+1);
	printf("%d\n",r);
	return 0;
}

Measured memory_bytes: 107904
#include <iostream>
#include<vector>
using namespace std;
vector<int> v;
int main()
{
    int n;
    cin>>n;
    while(n--){
        int tip,a;
        cin>>tip;
        if(tip==0){
            cin>>a;
            v.push_back(a);
        }
        else if(tip==1){
            cin>>a;
            cout<<v[a]<<endl;
        }
        else{
            v.pop_back();
        }
    }


}



Measured memory_bytes: 3868
#include <iostream>
#include <string>
using namespace std;
int main(){
    int hitpoint,weapon;
    int result;
    cin >> hitpoint;
    cin >> weapon;
    for(int i=0;i<weapon;i++){
        int in;
        cin >> in;
        result=result+in;
    }
    if(result>=hitpoint){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e9
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;


int d[100010];
ll MOD=998244353;
signed main(){
   int n;
   cin>>n;
   REP(i,n) cin>>d[i];
   if(d[0]!=0){
       cout<<0<<endl;
       return 0;
   }
   if(n==2){
       if(d[0]==0 && d[1]==1){
           cout<<1<<endl;

       }
       else cout<<0<<endl;
       return 0;
   }
   sort(d,d+n);
   int ans=1;
   int cnt=0;
   vector<int>v;
   if(n==1){
       if(d[0]==0LL)
       cout<<1<<endl;
       else cout<<0<<endl;
       return 0;
   }
   bool ok=false;
   int dis=1;
   if(d[1]!=1){
       cout<<0<<endl;
       return 0;
   }
   for (int i = 1; i < n-1; i++)
   {
       if(d[i]==d[i+1]) cnt++;
       else {
           if(d[i]!=dis){
               cout<<0<<endl;
               return 0;
           }
           dis++;
           v.push_back(cnt+1);
           cnt=0;
       }
   }
   v.push_back(cnt+1);
  
    
   cnt=0;
   for (int i = 0; i < v.size()-1; i++)
   {
       for (int j = 0; j < v[i+1]; j++)
       {
           ans*=v[i];
           ans%=MOD;
       }
       
       
   }
    cout<<ans%MOD<<endl;
    return 0;
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16

ll n,k;
ll x[101010],y[101010];
bool c[101010];
bool h[101010];
vector<ll> ex[1010],ey[1010];

int main(){
	cin>>n>>k;
  rep(i,n){
    char cc;
    cin>>x[i]>>y[i]>>cc;
    if(cc=='W')c[i]=false;
    else c[i]=true;
  }
  ll crt=0;
  rep(i,n){
    h[i]=((x[i]/k)+(y[i]/k))%2;
    if(h[i]==c[i])crt++;
    ex[(k-(x[i]%k))].push_back(i);
    ey[(k-(y[i]%k))].push_back(i);
  }

  ll res=0;
  rep(a,k+1){
    for(ll idx : ex[a]){
      if(h[idx]==c[idx])crt--;
      else crt++;
      h[idx]=1-h[idx];
    }
    rep(b,k+1){
      for(ll idx : ey[b]){
        if(h[idx]==c[idx])crt--;
        else crt++;
        h[idx]=1-h[idx];
      }
      maxch(res,max(crt,n-crt));
    }
    rep(i,n){
      if(h[i]==c[i])crt--;
      else crt++;
      h[i]=1-h[i];
    }
  }
  cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int A, B, C;
    cin >> A >> B >> C;
    int K;
    cin >> K;

    string ans = "No";
    for(int i=0; i<=K; i++)
    {
        for(int j=0; i+j<=K; j++)
        {
            int k = K - i - j;
            int a=A, b=B, c=C;
            for(int m=0; m<i; m++) a*=2;
            for(int m=0; m<j; m++) b*=2;
            for(int m=0; m<k; m++) c*=2;
            if(b > a && c > b) ans = "Yes";
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3648
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

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

			int n = sc.nextInt();
			int m = sc.nextInt();

			Map<Integer, Integer> map = new TreeMap<Integer, Integer>();
			for (int i = 0; i < m; i++) {
				for (int j = 0; j < 2; j++) {
					int x = sc.nextInt();
					if (map.get(x) == null) {
						map.put(x, 1);
					} else {
						map.put(x, map.get(x) + 1);
					}
				}
			}

			for (int i = 1; i <= n; i++) {
				if (map.get(i) == null) {
					System.out.println("0");
				} else {
					System.out.println(map.get(i));
				}
			}
		}
	}
}

Measured memory_bytes: 21716