akhauriyash/Code-Regression huggingface dataset:
import heapq
 
N, M = map(int, input().strip().split())
 
A = {}
 
for i in range(N):
  a, b = map(int, input().strip().split())
  if a not in A: A[a] = []
  A[a].append(b)

total = 0
days = [] #heap先
for i in range(1, M + 1): #1～M
  if i in A: #i日かかる仕事が候補にあったら
    for a in A[i]:
      heapq.heappush(days, -a) #daysにi日かかる金額をすべて入れる（最大値を出すため-1かける）
  if len(days) > 0:
    total += - heapq.heappop(days) #最大値（金額）を追い出して足す
                                   #i日かかる仕事が無ければ前回ためてたのが出る
 
print(total)

Measured memory_bytes: 27348
#include <bits/stdc++.h>     
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
#define int ll
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
 
using namespace std;
 
const int maxn = (int)108;
const int N = (int)1e5 + 100;
const int mod = (int)1e9 + 7;
 
#define inf mod
 
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;   
typedef vector<ll> Vll;               
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
 
int n, W, w[maxn], v[maxn];
int dp[maxn][N];

main () {
	cin >> n >> W;
	forn(i, 1, n)
		cin >> w[i] >> v[i];
	forn(i, 0, maxn - 1)
		forn(j, 0, N - 1)
			dp[i][j] = -inf * inf;
	dp[0][0] = 0;
	forn(i, 1, n){
		forn(j, 0, W){
			dp[i][j] = dp[i - 1][j];
			if(j >= w[i])
				dp[i][j] = max(dp[i][j], dp[i - 1][j - w[i]] + v[i]);
			if(j)
				dp[i][j] = max(dp[i][j], dp[i][j - 1]);
		}
	}
	cout << dp[n][W];
}

Measured memory_bytes: 84736
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
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; }
const long long INF = 1LL <<60;
typedef long long ll;
using namespace std;

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

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

ll choose2(ll n){
    return n*(n-1)/2;
}

int main(){
    int k;
    string s;
    cin>>k>>s;
    if(s.length()<=k) cout<<s<<endl;
    else{
        string ans;
        rep(i,0,k-1){
            ans += s[i];
        }
        cout<<ans<<"..."<<endl;
    }
    return 0;
}

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

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


#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << x << endl;
#else 
    #define dbg(x)
#endif

#define int long long
#define pb push_back
#define ppb pop_back()
#define mp make_pair
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


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



int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
       
    str s;
    cin >> s;
    int n = siz(s);
    fi(0, n - 1) {
        if (s[i] == s[i + 1]) {
            cout << i + 1 << ' ' << i + 2 << '\n';
            return 0;
        }
    }
    fi(0, n - 2) {
        if (s[i] == s[i + 2]) {
            cout << i + 1 << ' ' << i + 3 << '\n';
            return 0;
        }
    }
    cout << "-1 -1\n";
}

Measured memory_bytes: 3732
N = int(input())
v_list = list(map(int,input().split()))

v_list.sort(reverse=True)
v_list[-2] += v_list[-1]
v_list.pop(-1)

cnt = 1
ans = 0
for v in v_list:
    ans += v/(2**cnt)
    cnt += 1
    
print(ans)

Measured memory_bytes: 3060
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
ll INF=1e9+10;
ll a,b;
map<ll,vector<ll> >mp;
ll dp[100010];
ll dfs(ll x){
	if(mp[x].size()==0)return 0;
	if(dp[x]!=-1)return dp[x];
	ll ans=-1;
	for(auto it:mp[x]){
		debug()<<imie(it);
		ans=max(ans,1+dfs(it));
	}
	return dp[x]=ans;
}
int main(){
	fastio;
	cin>>a>>b;
	for(int i=0;i<b;i++){
		ll x,y;
		cin>>x>>y;
		mp[x].push_back(y);
	}
	debug() <<imie(mp);
	memset(dp,-1,sizeof dp);
	ll ans=-1;
	for(auto it:mp){
		debug()<<imie(it.first);
		ans=max(ans,dfs(it.first));
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 15360
a,b,k = map(int, input().split())
for i in range(k):
  if(i%2==0):
    if(a%2==1):
      a -=1
    b += + int(a/2)
    a = int(a/2)
  else:
    if(b%2==1):
      b-=1
    a +=int(b/2)
    b = int(b/2)
print(a,b)

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  cin >> N;

  bool same = true;
  LL ans = 0, mn = 1e9;
  REP(i,N){
	LL a, b;
	cin >> a >> b;
	same &= a == b;
	ans += a;
	
	if(a > b) mini(mn, b);
  }

  if(same) cout << 0 << endl;
  else cout << ans-mn << endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define fi first
#define se second
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int main(){
	vi a(10,0);
	fu(0,10){
		cin>>a[i];
	}
	sort(a.rbegin(), a.rend());
	fu(0,3){
		cout<<a[i]<<endl;
	}
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,s;
	while(cin>>n>>k>>s)
	{
		for(int i=0;i<k;i++) cout<<s<<" ";
		int a;
		if(s==pow(10,9)) a=s-1;
		else a=s+1;
		for(int i=0;i<n-k;i++) cout<<a<<" ";
		cout<<"\n";
	}
}

Measured memory_bytes: 1280
//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define f first
#define s second
#define rep(i,x) for(int i=0;i<x;i++)
short dp[5005][5005]={};
int main()
{
	srand((unsigned int)time(NULL));
	int n,q; scanf("%d %d",&n,&q);
	for(int i=0;i<q;i++)
	{
		int x,y,v; scanf("%d%d%d",&x,&y,&v);
		dp[x][y]=max(dp[x][y],(short)++v);
	}
	int ret=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=i;j++)
		{
			if(!dp[i][j]) continue;
			ret++;
			dp[i+1][j]=max(dp[i+1][j],--dp[i][j]);
			dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]);
		}
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 48928
#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 each(itr,v) for(auto itr:v)
#define pb push_back
#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 INT_MAX/3

ll n;
ll a[111111];
map<ll,ll> cnt;

int main(){
	cin.sync_with_stdio(false);
  cin>>n;
  rep(i,n){
    cin>>a[i];
    cnt[a[i]]++;
  }
  vector<ll> maxa;
  for(P p : cnt){
    if(p.se>1){
      maxa.push_back(p.fi);
    }
    if(p.se>3){
      maxa.push_back(p.fi);
    }
  }
  sort(all(maxa));
  reverse(all(maxa));
  if(maxa.size()<2)cout<<0<<endl;
  else cout<<maxa[0]*maxa[1]<<endl;
	return 0;
}


Measured memory_bytes: 7296
import javax.script.ScriptEngineManager
fun main(arg: Array<String>) {
    val S = next()
    val N = S.length - 1
    val manager = ScriptEngineManager()
    val engine = manager.getEngineByName("js")
    var ans = 0L
    for (b in 0 until 1.shl(N)) {
        val P = BooleanArray(N)
        for (n in 0 until N) {
            if (b.shr(n).and(1) == 1) P[n] = true
        }
        val Ex = StringBuilder()
        for (n in 0 until N) {
            Ex.append(S[n])
            if (P[n]) Ex.append('+')
        }
        Ex.append(S.last())
        ans += "${engine.eval(Ex.toString())}".toDouble().toLong()
    }
    println(ans)
}

fun next() = readLine()!!


Measured memory_bytes: 64908
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <tuple>


using namespace std;

int main(){

	string S, T;
	int A[26][26] = {};

	cin >> S >> T;

	for(int i = 0; i < S.size(); i++){
		A[S[i] - 'a'][T[i] - 'a'] = 1;
	}

	bool same = true;
	for(int i = 0; i < 26; i++){
		int x = 0;
		for(int j = 0; j < 26; j++){
			if(A[i][j] == 1) {
				x++;
			}
		}
		if(x >= 2) {
			same = false;
			break;
		}
	}

	for(int i = 0; i < 26; i++){
		int x = 0;
		for(int j = 0; j < 26; j++){
			if(A[j][i] == 1) {
				x++;
			}
		}
		if(x >= 2) {
			same = false;
		}
	}

	if(same == true){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include <set>

#define DIV 1000000007
using namespace std;
using ll = long long;

int main() {
    ll N;
    cin >> N;

    ll temp = N;
    ll twos = 1;
    vector<int> bit(5000 + 1);
    int mx = 0;
    for (int i = 0; temp != 0; i++) {
        if (abs(temp) % abs(twos * 2) != 0) {
            temp -= twos;
            bit[i] = 1;
        }
        twos *= (-2);
        mx = i;
    }
    for (int i = mx; i >= 0; i--)
        cout << bit[i];

     cout << endl;

}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>
#include <iostream>

using namespace std;

#define rep(i,j) for(int i=0;i<(j);i++)
#define INF (1<<29)

int N,K;
int dp[16][2049];
vector<int>b[16];

int dfs(int g, int k){
  if(k==0) return 0;
  if(k<0) return -INF;
  if(g>=10) return -INF;

  int &res = dp[g][k];
  if(res >= 0) return res;
  res = 0;
  int sum = 0;
  res = max(res, dfs(g+1, k));
  rep(i,b[g].size()){
    sum += b[g][i];
    res = max(res, dfs(g+1, k-i-1)+sum+(i*(i+1)));
  }
  return res;
}

int main(){
  scanf("%d%d", &N,&K);
  memset(dp, -1,sizeof(dp));
  rep(i,N){
    int c,g;
    scanf("%d%d", &c, &g);
    b[g-1].push_back(c);
  }
  rep(i,10) sort(b[i].begin(), b[i].end(), greater<int>());
  printf("%d\n", dfs(0, K));
  return 0;
}

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

int gcd(int a, int b) //100000 99999
{
	if(b==0) return a;
	else
	  return gcd(b, a%b); //99999 1
}

int main(){
	long long a, b;
	cin >> a >> b;
	long long ans=a*b/gcd(a, b);
	cout << ans;
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int>> vvint;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<int, vector<int>, greater<int>> spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int>> bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;        //大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


int INF = 1e9;
int NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::chrono::system_clock::time_point start,end;
    start = std::chrono::system_clock::now();

    ll n, k ;
    cin >> n >> k ;
    vll a(n) ;
    REP(i,n){
        cin >> a[i] ;
    }
    sort(ALL(a)) ;
    ll ans = 0 ;
    REP(i,k){
        ans += a[i] ;
    }
    cout << ans <<endl;


    end = std::chrono::system_clock::now();
    auto elapsed = std::chrono::duration_cast< std::chrono::milliseconds >(end - start).count();
    //std::cout << elapsed <<"ms"<< std::endl;

    

    return 0;
}



Measured memory_bytes: 3656
#include <stdio.h>
#define max(x, y) ((x)<(y) ? (y) : (x))
#define min(x, y) ((x)>(y) ? (y) : (x))

int main(){
  int n, k;  scanf("%d %d", &n, &k);
  long a[200005];
  for(int i=1; i<=n; i++)  scanf("%ld", a+i);
  int flag = 0;
  for(int kk=0; kk<k; kk++){
    int thisflag = 1;
    long turn[200005] = {0};
    for(int i=1; i<=n; i++){
      turn[max(1, i-a[i])]++;
      turn[min(n+1, i+a[i]+1)]--;
    }
    long sum = 0;
    for(int i=1; i<=n; i++){
      sum += turn[i];
      a[i] = sum;
      if(n != a[i])
	thisflag = 0;
    }
    if(thisflag){
      flag = 1;
      break;
    }
  }
  
  if(flag)
    for(int i=1; i<=n; i++)
      printf("%d ", n);
  else
    for(int i=1; i<=n; i++)
      printf("%ld ", a[i]);
  puts("");
  return 0;
}


Measured memory_bytes: 4824
#include <iostream>

using namespace std;

int main()
{
	string A, B, C;
	cin >> A >> B >> C;

	if (A[A.length() - 1] == B[0] && B[B.length() - 1] == C[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

}





Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	char f, s, t;
  	int ans = 0;
  	cin >> f >> s >> t;
  	if(f == s && f == t && f == 'R')ans = 3;
  	else if((f == s && f == 'R' )|| (s == t && s == 'R')){ans = 2;}
  	else if(f == 'R' || s == 'R' || t == 'R') {ans = 1;}
  	else ans = 0;
  	cout << ans << endl;
      
}


Measured memory_bytes: 3632
using System;
using System.Linq;
using System.Collections.Generic;

public static class Program {
    public static void Main() {
        String s=Console.ReadLine();
        String t=Console.ReadLine();
        int[,]dp=new int[s.Length+1,t.Length+1];
        for(int i=1;i<=s.Length;i++) {
            // Console.Write($"[dp[{i}]]");
            for(int j=1;j<=t.Length;j++){
                if(s[i-1]==t[j-1])dp[i,j]=1+dp[i-1,j-1];
                else {
                    Chmax(ref dp[i,j],dp[i,j-1]);
                    Chmax(ref dp[i,j],dp[i-1,j]);
                }
                // Console.Write($" {dp[i,j]}");
            }
            // Console.Write("\n");
        }

        int counter=dp[s.Length,t.Length];
        char[]ans=new char[counter];
        int nowi=s.Length,nowj=t.Length;
        while(0<nowi||0<nowj){
            if(0<nowi&&dp[nowi-1,nowj]==dp[nowi,nowj])nowi--;
            else if(0<nowj&&dp[nowi,nowj-1]==dp[nowi,nowj])nowj--;
            else{
                nowi--;
                nowj--;
                ans[--counter]=s[nowi];
            }
        }
        for(int i=0;i<dp[s.Length,t.Length];i++){
            Console.Write(ans[i]);
        }
        Console.Write("\n");
    }
    public static void Chmax(ref int x, int y) {
        x = Math.Max(x, y);
    }
}



Measured memory_bytes: 46048
#include <iostream>
#include <unordered_set>


using namespace std;
typedef long long ll;
typedef unordered_set<ll> pset;


ll pii(int y, int x) {
    return ll(y-1) * 1000000000LL + ll(x-1);
}

int neighbor_search(const pset& bs, int y, int x) {
    int r = 0;
    for(int i=y-1; i<=y+1; i++) for(int j=x-1; j<=x+1; j++) {
        if(bs.find(pii(i, j)) != bs.end()) {
            r++;
        }
    }
    return r;
}

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

    int h, w, n;
    cin >> h >> w >> n;
    pset blacks;
    for(int i=0; i<n; i++) {
        int a, b;
        cin >> a >> b;
        blacks.insert(pii(a, b));
    }
    pset visited;
    ll count[10] = {};
    for(auto itr=blacks.begin(); itr!=blacks.end(); ++itr) {
        int a = int(*itr / 1000000000LL) + 1, b = int(*itr % 1000000000LL) + 1;
        for(int i=max(a-1, 2); i<=min(a+1, h-1); i++) {
            for(int j=max(b-1, 2); j<=min(b+1, w-1); j++) {
                auto pib = visited.insert(pii(i, j));
                if(pib.second) {
                    int r = neighbor_search(blacks, i, j);
                    count[r]++;
                }
            }
        }
    }
    ll s = 0;
    for(int i=1; i<=9; i++) {
        s += count[i];
    }
    count[0] = ll(h-2) * ll(w-2) - s;
    for(int i=0; i<=9; i++) {
        cout << count[i]<< endl;
    }

}

Measured memory_bytes: 40720
S=list(str(input()))
ans=[]
for i in S:
    if i=='S':
        ans.append(i)
    elif i=='T' and len(ans)==0:
        ans.append(i)
    elif i=='T' and ans[-1]=='T':
        ans.append(i)
    elif i=='T' and ans[-1]=='S':
        del ans[-1]
print(len(ans))


Measured memory_bytes: 6564
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
// InSane Code	...	

int main(int argc , char** argv){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int n , gm = 0;
	cin >> n;
	string s;
	cin >> s;
	for(int i = 0 ; i < n-1 ; ++i){
		vector<int> a(30,0),b(30,0);
		for(int j = 0 ; j < n ; ++j){
			if(j <= i){
				a[s[j]-'a'+1]++;
			}
			else{
				b[s[j]-'a'+1]++;
			}
		}
		int lm = 0;
		for(int I = 1 ; I <= 26 ; ++I){
			if(a[I] > 0 && b[I] > 0)lm++;
		}
		gm = max(gm,lm);
	}
	cout << gm << endl;
	return 0;
}

Measured memory_bytes: 256
// Gaurav Aggarwal

/*
useful stl
array<ll,size> ar;         //size(),front(),back(),fill(),empty()
deque<ll> d                //push_back(),push_front(),pop_front(),pop_back()
vector<ll> v(size,val);    //push_back(),*max_element(v.begin(),v.end()),accumulate(v.begin(),v.end(),0)
stack<ll> g;               //push(),pop(),top(),size(),empty()         LIFO
queue<ll> q;               //push(),size(),front(),back(),empty()      FIFO
priority_queue<ll> pq
*/

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

typedef long long ll;
typedef pair<ll,ll> ipair;
typedef pair<long,long> lpair;
#define scan(x) do{while((x=getchar_unlocked())<'0'); for(x-='0'; '0'<=(_=getchar_unlocked()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define For(i, a, b) for(__typeof (a) i=a; i<=b; i++)
#define mod 1000000007
#define PI 3.141592653589793238462643383279502884 
#define debug1(a) cout<<a<<"\n";
#define debug2(a,b) cout<<a<<" "<<b<<"\n";
#define debug3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define debug_arr(a,n) {for(__typeof (n) i=0; i<n; ++i) {cout<<a[i]<<" ";}}
#define inp_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {cin>>a[i];}
#define beg_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {a[i] = 0;}

ll power(ll x, ll y) 
{ 
    ll res = 1;   
    while (y > 0) { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1;
        x = (x*x)%mod; 
    } 
    return res%mod; 
}

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

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("out.txt", "w", stdout); 
    // #endif  

    int n;
    cin>>n;
    ll a[n],b[n];
    inp_arr(a,n);
    inp_arr(b,n);

    vector<pair<ll,int> > v;
    for(int i=0;i<n;++i) {
        v.push_back(make_pair(a[i]-b[i],i));
    }

    sort(v.begin(),v.end());
    int c1 = 0;
    ll sumc1 = 0;
    for(int i=0;i<n;++i) {
        if(v[i].first < 0)  {
            ++c1;
            sumc1 += abs(v[i].first);
        }
    }
    // cout<<sumc1<<"\n";
    int c2 = 0;
    for(int i=v.size()-1;i>=0;--i) {
        if(sumc1 == 0)
            break;
        if(v[i].first > 0) {
            if(v[i].first < sumc1) {
                sumc1 -= v[i].first;
                ++c2;
            }
            else {
                sumc1 = 0;
                ++c2;
                break;
            }
        } 
        else {
            break;
        }
    }
    if(sumc1 > 0) 
        cout<<-1;
    else {
        cout<<c1+c2<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3956
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vi A(n),B(n);
  priority_queue<pair<ll,ll>>que;
  for(auto &a:A)cin>>a;
  ll ans=0;
  for(int i=0;i<n;i++){
    cin>>B[i];
    que.push(mp(B[i],i));
  }
  while(!que.empty()){
    ll num=que.top().F;
    ll po=que.top().S;
    que.pop();
    if(A[po]==B[po])continue;
    if(B[po]>num){cout<<-1<<endl;return 0;}
    ll ri=B[(po+1)%n];
    ll le=B[(po-1+n)%n];
    ll to=ri+le;
    if(B[po]<to){cout<<-1<<endl;return 0;}
    if((B[po]-A[po])%to==0){
      ans+=(B[po]-A[po])/to;
      B[po]=A[po];
    }else{
      ll he=(B[po]-A[po])/to;
      if(he==0){cout<<-1<<endl;return 0;}
      B[po]-=he*to;
      ans+=he;
      que.push(mp(B[po],po));
    }
  }
  bool fl=true;
  for(int i=0;i<n;i++)
    if(A[i]!=B[i])fl=false;
  if(fl)cout<<ans<<endl;
  else cout<<-1<<endl;
  return 0;
}


Measured memory_bytes: 9456
//from PKU1125
main(){
	int i,n,k,a,b,A,B,dist[101][101];
	scanf("%d%d",&n,&k);
		/*initialize*/
		memset(dist,11,sizeof(dist));
		for(i=1;i<=n;i++)dist[i][i]=0;
		for(;k;k--){
			scanf("%d,%d,%d,%d",&a,&b,&A,&B);
			dist[a][b]=A,dist[b][a]=B;
		}
		
		{/*warshall-floyd*/
			int k,i,j;
			for(k=1;k<=n;k++)
				for(i=1;i<=n;i++)
					for(j=1;j<=n;j++)
						if(dist[i][j]>dist[i][k]+dist[k][j])
							dist[i][j]=dist[i][k]+dist[k][j];
		}
		
		{/*query*/
			scanf("%d,%d,%d,%d",&a,&b,&A,&B);
			printf("%d\n",A-B-dist[a][b]-dist[b][a]);
		}
	exit(0);
}

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


// 44 27.672
// 46 33.227 240 2011/10/28
// 2011/10/29

// 0106 »Î
public class Main {

	// ¿à\ OÆli
	int[] tbl = {
		200,  380,
		1000, 1520,
		300,  550,
		1200, 1870,
		500,  850,
		1500, 2244,
	};
	
	int min;
	
	void think(int idx, int soba, int cost) {
		if (soba == 0) {
			if (cost < min) {
				min = cost;
				return;
			}
		}
		if (idx >=tbl.length / 2) {
			return;
		}
		
		int sobat = tbl[idx * 2]; // PÜÌd³
		int tanka = tbl[idx * 2 + 1];
		for(int i = 0;; i++) {
			if (sobat * (i - 1) >= soba)
				break;
			think(idx + 1, soba - sobat * i, cost + tanka * i);
		}
	}
	
	// C return falseÅ¨µÜ¢
	boolean main() throws IOException {

		int[] ir = readIntArray();
		int soba = ir[0];
		if (soba == 0)
			return false;
		
		min = Integer.MAX_VALUE;
		think(0, soba, 0);
		System.out.printf("%d\n", min);
		
		return true; // ³íI¹ Ö
	}
	

//	private final static boolean DEBUG = true;  // debug
	private final static boolean DEBUG = false; // release

	public static void main(String[] args) throws IOException {

		if (DEBUG) {
			log = System.out;
			
			String inputStr = "500:2200:0:";
			
			inputStr = inputStr.replace(":", "\n");

			reader = new BufferedReader(new StringReader(inputStr)); 

		}
		else {
			log = new PrintStream(new OutputStream() { public void write(int b) {} } ); // «ÌÄ
			reader = new BufferedReader(new InputStreamReader(System.in)); // R\[©ç
		}
		
		int N = Integer.MAX_VALUE;
		//int N = readIntArray()[0];

		for(int i = 0; i < N; i++) {
			boolean b = new Main().main();
			if (!b)
				break;
		}		
		
		reader.close();
	}

	
	static PrintStream log;
	static BufferedReader reader;
	

	// WüÍæè1sªÌæØè¶æØèÅÌ®lðÇÞ
	// EOFÌêÍnullðÔ·
	private static int[] readIntArray() throws IOException {

		String s = null;
		for(;;) {
			s = reader.readLine();
//			log.printf("%s\n", s);
			if (s == null)
				return null;
			s = s.trim();
			if (s.length() != 0) // ¦¦¦@Ç¤àËRósðÇÞ±Æª éBÇÝòÎ·Æ¤Ü­¢­çµ¢BBBB
				break;
		}
		
		String[] sp = s.split("[ ,]"); // æØè¶ÍXy[X©J}
		int[] a = new int[sp.length];
		for(int i = 0; i < sp.length; i++) {
			a[i] = Integer.parseInt(sp[i]);
		}
		return a;
	}
		
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

const int MAXN=50005;
const int NAX=1005;
const long MOD=(long)(1e9+7);

Int N,M,K;
Int X,Y,Z;

int main()
{
    int start=1;
    cin>>N>>K;
    int times=N;
    while(times--){
        if(start<K) start*=2;
        else start+=K;
    }
    cout<<start<<"\n";
   
}


Measured memory_bytes: 3640
def get_ints():
    return list(map(int, input().split()))

n = int(input())
a,b = [],[]
for i in range(n):
    x, y = get_ints()
    a.append(x+y)
    b.append(x-y)

a.sort()
b.sort()
ans = max(a[-1]-a[0], b[-1]-b[0])
print(ans)

Measured memory_bytes: 25832
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
#define MAX 10000000

int b[110];
bool used[110];
struct edge{int from, to, cost;};

int solve(int a[110][110], int n, int s, int e){
	fill(b, b+110, MAX);
	fill(used, used+110, false);
	b[s] = 0;
	while(1){
		int v = -1;
		for(int i = 1;i <= n;i++){
			if(!used[i] && (v == -1 || b[v] > b[i]))v = i;
		}
		if(v == -1)break;
		used[v] = true;
		for(int i = 1;i <= n;i++){
			if(a[v][i] != -1)b[i] = min(b[i], b[v] + a[v][i]);
		}
	}
	return 0;
}

int main(){
	int a[110][110], n, k;
	
	while(cin >> n >> k, k){
		fill((int*)a, (int*)(a+110), -1);
		int c, d, e, f;
		for(int i = 0;i < k;i++){
			cin >> c;
			if(c == 0){
				cin >> d >> e;
				solve(a, n, d, e);
				if(b[e] != MAX)cout << b[e] << endl;
				else cout << -1 << endl;
			}else {
				cin >> d >> e >> f;
				if(a[d][e] > f || a[d][e] == -1)
				a[d][e] = a[e][d] = f;
			}
		}
		
	}
	
	return 0;
}

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

int main(){

  vector<int> T(3);
  for(int i = 0; i < 3; i++){
    cin >> T[i];
  }

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

  cout << T[0] + T[1] << endl;
 
  return 0;
}

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

int main() {
    string a = "";
    string b = "";
    string S;
    cin >> S;
    int Q;
    cin >> Q;
    bool rev = false;
    rep(i, Q){
        int T;
        cin >> T;
        if(T == 1){
            if(rev) rev = false;
            else rev = true;
        }
        else if(T == 2){
            int F;
            cin >> F;
            string C;
            cin >> C;
            if(F == 1){
                if(rev) b = b + C;
                else a = C + a;
            }
            else if(F == 2){
                if(rev) a = C + a;
                else b = b + C;
            }
        }
    }
    S = a + S + b;
    if(rev) reverse(S.begin(), S.end());
    cout << S;
}


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

using namespace std;

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

  int d, n;
  cin >> d >> n;
  if (n == 100) {
    ++n;
  }

  int ans = n;
  for (int i = 0; i < d; ++i) {
    ans *= 100;
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937 mt32(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt32);
}
/*--------Library Zone!--------*/



signed main() {
	string s; cin >> s;
	int ans = 0;
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - i - 1])ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int 
using namespace std;
int main()
{ ll n,i,j,s;
cin>>n>>s;
ll w[n+1],v[n+1];
ll dp[n+1][s+1];
for(i=1;i<=n;i++) cin>>w[i]>>v[i];

for(i=0;i<n+1;i++) dp[i][0]=0;
for(i=0;i<s+1;i++) dp[0][i]=0;

for(i=1;i<=n;i++)
{ for(j=1;j<=s;j++)
{ if(w[i]<=j) {
	dp[i][j]=max(dp[i-1][j],v[i]+dp[i-1][j-w[i]]);
	
}
	else dp[i][j]=dp[i-1][j];
	
}
	
	
	
	 }	 
	/* 
for(i=0;i<=n;i++)
{ for(j=0;j<=s;j++)
{
	cout<<dp[i][j]<<" ";
}
cout<<"\n";	
	
	 }	 */
	 
	
cout<<dp[n][s];	
	
	
}


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

bool field[120][120];

int main() {
  int N, W, H;
  while (cin >> N and N) {
    for (int i = 0; i < 120; i++) {
      for (int j = 0; j < 120; j++) {
        field[i][j] = false;
      }
    }
    cin >> W >> H;

    REP(i, N) {
      int x, y;
      cin >> x >> y;
      x--; y--;
      field[x][y] = true;
    }

    int S, T; 
    cin >> S >> T;

    int ans = 0;

    for (int x = 0; x + S <= W; x++) {
      for (int y = 0; y + T <= H; y++) {
        int trees = 0;
        for (int i = 0; i < S; i++) {
          for (int j = 0; j < T; j++) {
            if (field[x + i][y + j]) {
              trees++;
            }
          }
        }
        ans = max(ans, trees);
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
 
using namespace std;
 
int segMin[1 << 20], segAdd[1 << 20];
int n, q;
char s[300001];
 
void add(int a, int b, int x, int k = 0, int l = 0, int r = n)
{
    if (r <= a || b <= l) return;
     
    if (a <= l && r <= b){
        segAdd[k] += x;
        while (k){
            k = (k - 1) / 2;
            segMin[k] = min(segMin[k * 2 + 1] + segAdd[k * 2 + 1], segMin[k * 2 + 2] + segAdd[k * 2 + 2]);
        }
        return;
    }
     
    add(a, b, x, k * 2 + 1, l, (l + r) / 2);
    add(a, b, x, k * 2 + 2, (l + r) / 2, r);
}
 
int getMin(int a, int b, int k = 0, int l = 0, int r = n)
{
    if (r <= a || b <= l) return (INT_MAX);
     
    if (a <= l && r <= b) return (segMin[k] + segAdd[k]);
     
    int left = getMin(a, b, k * 2 + 1, l, (l + r) / 2);
    int right = getMin(a, b, k * 2 + 2, (l + r) / 2, r);
     
    return (min(left, right) + segAdd[k]);
     
}
 
void fix(set<int> *a, set<int> *b, char before, int x)
{
    a->erase(x);
    b->insert(x);
     
    int base = before == '(' ? -1 : 1;
    s[x] = before == '(' ? ')' : '(';
     
    add(x, n, 2 * base);
     
    int l = 0, r = x;
    int p;
     
    while (l != r){
        int mid = l + r >> 1;
        p = *b->lower_bound(mid);
        if (getMin(p, n) >= 2 * base) r = mid;
        else l = mid + 1;
    }
     
    p = *b->lower_bound(l);
    add(p, n, -2 * base);
    b->erase(p);
    a->insert(p);
    s[p] = before;
     
    printf("%d\n", p + 1);
}
 
int main()
{
    scanf("%d %d", &n, &q);
    scanf("%s", s);
     
    set<int> lf, rg;
     
    for (int i = 0; s[i]; i++){
        if (s[i] == '('){
            add(i, n, 1);
            lf.insert(i);
        }
        else {
            add(i, n, -1);
            rg.insert(i);
        }
    }
     
    for (int i = 0; i < q; i++){
        int x;
        scanf("%d", &x); x--;
         
        if (s[x] == '(') fix(&lf, &rg, '(', x);
        else fix(&rg, &lf, ')', x);
    }
     
    return (0);
}

Measured memory_bytes: 23440
/**
*   Bismillahir Rahmanir Rahim.
*   Imtiaz_rafi
*   PCIU, CHITTAGONG
**/
#include<bits/stdc++.h>
using namespace std;
#define speed() ios::sync_with_stdio(0);cin.tie(0);
#define file() freopen ("input.txt", "r", stdin);freopen ("output.txt", "w", stdout);
#define rep(i,a) for(ll i=0;i<a;i++)
#define rep1(i,begin,end) for(ll i=begin;i<=end;i++)
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(v)   v.begin(),v.end()
#define rall(v)   v.rbegin(),v.rend()
#define pb push_back
#define pf push_front
#define mp make_pair
#define pi acos(-1)
#define MOD 1e9+7
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
// bitshift (1LL<<(3)) *2^3
typedef long long int ll;
typedef vector<ll>vi;
typedef map<ll,ll>mi;
typedef pair<ll,ll>pll;
typedef set<ll>st;
typedef set<char>sc;
ll dx[] ={-1,+1,0,0,+1,-1,+1,-1};
ll dy[] ={0,0,-1,+1,+1,+1,-1,-1};
const ll mx = 1e5+123;
bool vis[mx];
vi adj[mx];
int main()
{
    speed();
    ll a;
    cin>>a;
    if(a>=400 && a<=599)
    {
        cout<<8<<endl;
    }
    else if(a>=600 && a<=799)
    {
        cout<<7<<endl;
    }
    else if(a>=800 && a<=999)
    {
        cout<<6<<endl;
    }
    else if(a>=1000 && a<=1199)
    {
        cout<<5<<endl;
    }
    else if(a>=1200 && a<=1399)
    {
        cout<<4<<endl;
    }
    else if(a>=1400 && a<=1599)
    {
        cout<<3<<endl;
    }
    else if(a>=1600 && a<=1799)
    {
        cout<<2<<endl;
    }
    else if(a>=1800 && a<=1999)
    {
        cout<<1<<endl;
    }
}


Measured memory_bytes: 5992
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;
#include <cstring>

int main() {
  int n, q, v, w;
  cin >> n >> q;
  for (int i = 0; i < q; i++) {
    cin >> v >> w;
    if (n != 1) {
      while (v != w) {
        if (v > w) {
          if (v % n == 1) {
            v--;
          } else if (v % n) {
            v += n;
            v -= v % n;
          }
          v /= n;
        } else {
          if (w % n == 1) {
            w--;
          } else if (w % n) {
            w += n;
            w -= w % n;
          }
          w /= n;
        }
      }
      cout << v << endl;
    } else {
      cout << min(v, w) << endl;
    }
  }
}

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

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

    int odd;
    if(n % 2 == 0){
        odd = n / 2;
    }else{
        odd = n / 2 + 1;
    }

    double ans = (double)odd / n;
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
INF = float('inf')

N = int(input())
h = list(map(int, input().split()))

dp = [INF] * N
dp[0] = 0
dp[1] = abs(h[0] - h[1])

for i in range(2, N):
    dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))

print(dp[N - 1])


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)  
#define outdeb(fir, sec, thr) cout << fir << ":" << sec << ":" << thr << endl

void greatFirst(ll& a, ll& b)
{
  if(a < b)
  {
    ll tmp = a;
    a = b;
    b = tmp;
  }
}

void inputList(vector<ll>* list, ll n, int sortType = 0)
{
  repl(i, n)
  {
    ll tmp;
    cin >> tmp;
    list->push_back(tmp);
  }
  if(sortType == 1)
  {
    sort(list->begin(), list->end());
  }
  else if(sortType == 2)
  {
    sort(list->begin(), list->end(), greater<ll>());
  }
}

int main()
{
  ll a, b, n;
  cin >> a >> b >> n;
  
  double a1 = (double)a;
  double b1 = (double)b;
  double tmp = ((a1-1)*b1)/a1;
  
  //ll maxv = (ll)floor(tmp);
  ll maxv = b-1;
  
  if(maxv > n)
  {
    maxv = n;
  }
  
  ll ans = (ll)(a * maxv / b) - a * (ll)(maxv / b);
  
  cout << fixed << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3644
#include <math.h>

#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;

int main() {
    int N;
    double d;
    cin >> N;
    for (size_t i = 0; i < N; i++)
    {
        double tmp;
        cin >> tmp;
        d += (double)1.0/tmp;
    }

    printf("%.15f\n", (double)1.0/d);

    return 0;
}

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

bool visited[100005];

int main() {
	int n;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i]--;
	}
	
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (visited[i]) {
			continue;
		}
		if (a[a[i]] == i) {
			cnt++;
			visited[a[i]] = true;
		}
	}
	
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 4024
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
const ll MOD = (ll)1e9+7;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}

class dijkstra{
public:
	int n;
	vvector<pll> edges;
	vector<ll> fast;
	dijkstra(int N):n(N){
		edges.resize(n);
	}

	void add_edge(int from, int to, ll cost){
		edges[from].emplace_back(to, cost);
	}

	void solve(int start){
		priority_queuer<pll> pq;
		fast.assign(n, INFLL);
		pq.emplace(0, 0);
		fast[start] = 0;
		pq.emplace(0, start);
		while(pq.size()){
			pll d = pq.top();
			pq.pop();
			if(d.first!=fast[d.second])continue;
			foreach(i, edges[d.second]){
				ll next_time = d.first + i.second;
				int to = i.first;
				if(fast[to] <= next_time)continue;
				fast[to] = next_time;
				pq.emplace(next_time, to);
			}
		}
	}
};


int main(){
	int n;
	cin >> n;
	dijkstra dij(n);
	rep(i, n){
		int from;
		cin >> from;
		int time;
		cin >> time;
		rep(j, time){
			int to;
			ll cost;
			cin >> to >> cost;
			dij.add_edge(from, to, cost);
		}
	}
	dij.solve(0);
	rep(i, n){
		output(i);
		output(dij.fast[i]);
		outendl();
	}
	return 0;
}



Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, b;
  cin >> n;
  if(n == 1) cout << "Hello World" << "\n";
  else cin >> a >> b, cout << a + b << "\n";
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>

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



int main(){
    int n; cin >> n;
    vector<int> w(n);
    rep(i,n) cin >> w[i];
    
    int lsum=0,rsum=0;
    int ans = 100000;
    rep(i, n){
        rsum += w[i];
    }
    rep(i, n){
        lsum += w[i];
        rsum -= w[i];
       ans = min(ans, abs(lsum-rsum));
    }
    cout << ans << endl;
    
    
    
}



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

using namespace std;


int main(){

  int N;

  cin >> N;

  vector < vector <int> > points(N);
  vector < vector <int> > dp(N);

  for(int i=0;i<N;i++){
    points[i].resize(3);
    dp[i].resize(3);
    cin >> points[i][0] >> points[i][1] >> points[i][2];
  }

  dp[0] = points[0];

  for(int i=1;i<N;i++){
    for(int j=0;j<3;j++){
      dp[i][j] =  points[i][j] + max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3]);
    }
  }

  cout << max(dp[N-1][0],max(dp[N-1][1],dp[N-1][2])) << endl;

  return 0;
}

Measured memory_bytes: 11136
n = int(input())
a = list(map(int, input().split()))
ret = [sum([(2 if i & 1 == 0 else -2) * a[i] for i in range(n)]) // 2]
for i in range(n - 1):
    ret.append(2 * a[i] - ret[-1])
print(*ret)


Measured memory_bytes: 14092
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>

using namespace std;

#define rep(i,a,n) for(int (i)=a;(i)<(int)(n);(i)++)
#define rrep(i,a,n) for(int (i)=(n)-1;(i)>=a;(i)--)
#define all(x) (x).begin(),(x).end()

typedef long long ll;

const int INF = 1e9;

int main() {
    int n, m;
	cin >> n >> m;
	int a[n][m], b[m];
	rep(i,0,n) rep(j,0,m) cin >> a[i][j];
	rep(i,0,m) cin >> b[i];

	rep(i,0,n) {
		int tmp = 0;
		rep(j,0,m) {
			tmp += a[i][j] * b[j];
		}
		cout << tmp << endl;
	}	
}

Measured memory_bytes: 3116
import math

a,b,c=map(float,input().split())

if c<90:
    e=c*math.pi/180
    S=a*b*1/2*math.sin(e)
    t=a**2+b**2-2*a*b*math.cos(e)
    r=math.sqrt(t)
    L=a+b+r
    h=b*math.sin(e)
    print(S)
    print(L)
    print(h)

if c==90:
    e=c*math.pi/180
    S=a*b*1/2*math.sin(e)
    t=a**2+b**2-2*a*b*math.cos(e)
    r=math.sqrt(t)
    L=a+b+r
    h=b
    print(S)
    print(L)
    print(h)

if c>90:
    e=c*math.pi/180
    d=180*math.pi/180
    f=d-e
    S=a*b*1/2*math.sin(e)
    t=a**2+b**2-2*a*b*math.cos(e)
    r=math.sqrt(t)
    L=a+b+r
    h=b*math.sin(f)
    print(S)
    print(L)
    print(h)


Measured memory_bytes: 5708
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;
 
signed main(){
    int N;cin>>N;
    int now=1;
    int ans=0;
    REP(i,N){
        int a;cin>>a;
        if(a==now)now++;
        else ans++;
    }
    cout<<(now==1?-1:ans)<<endl;
}

Measured memory_bytes: 256