akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>
#include <bitset>
#include <list>
#include <iomanip>
#include <cctype>
#include<chrono>
#include<random>

#define for0(i, N)    for (long long i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (long long i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (long long i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (long long i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (long long i = (x); i <  (N); ++i)
#define forl(i, N, x, a) for (long long i = (x), a = 0; a < (N);    \
                              i = (i + 1) % (N), ++a)
#define int long long

long double constexpr pi = 3.141592653589793;

template<class T>
constexpr T sigma1(T i, T n){
    return (n - i + 1) * (i + n) / 2;
}

template<class T>
constexpr T sigma2(T i, T n){
    return (i == 1 ? n * (n + 1) * (2 * n + 1) / 6 :
            sigma2(1, n) - sigma2(1, i - 1));
}

template<class T>
constexpr T sigma3(T i, T n){
    if (i == 1) {
        auto temp = sigma1(i, n);
        return temp * temp;
    }
    return sigma2(1, n) - sigma2(1, i - 1);
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b, signed){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b + 1;
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b++;
    return temp;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b, signed){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b - 1;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b--;
    return temp;
}

long long constexpr inf = std::numeric_limits<long long>::max();

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;
typedef set<ll> sll;
typedef unordered_set<ll> usll;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vector<ll>> vvll;


signed main(void){
    cin.tie(0); ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);

    vll x(5);

    for0(i, 5){cin >> x[i];
        if (x[i] == 0) {
            cout << i + 1<< "\n";
            return 0;

        }}



    return 0;
}


Measured memory_bytes: 3572
n = int(input())
p = list(map(float,input().split()))
a = [[0 for i in range(n+1)] for j in range(n+1)]
a[0][0] = 1
for i in range(1, n+1):
    for j in range(n+1):
        if j == 0:
            a[i][j] = (1-p[i-1])*a[i-1][j]
        elif(i<j):
            a[i][j] = 0
        else:
            a[i][j] = p[i-1]*(a[i-1][j-1])
            if i-1>=j:
                a[i][j] += (1-p[i-1])*a[i-1][j]
mh = (n+1)//2
ans = 0 
for i in range(mh, n+1):
    ans += a[n][i]
print(ans)

Measured memory_bytes: 223964
INF = 10 ** 20
n, m = map(int, input().split())
dp = [[[-INF] * 9 for _ in range(m + 1)] for _ in range(n + 1)]
dp[0][m][0] = 0
for i in range(n):
  a, b, c = map(int, input().split())
  for rest in range(m + 1):
    for l1 in range(9):
      for l2 in range(min(9, rest + 1)):
        if l1 == 0 and l2 == 0:add = c
        elif l2 == 0:
          if b <= 0:add = max(b, c)
          else:add = max(b * l1, c)
        elif l1 == 0:
          if a <= 0:add = max(a, c)
          else:add = max(a * l2, c)
        else:
          if a <= 0 and b <= 0:add = max(a, b, c)
          elif a <= 0:add = max(b * l1, c)
          elif b <= 0:add = max(a * l2, c)
          elif a <= b:add = max(b * l1 + a * min(l2, 8 - l1), c)
          else:add = max(a * l2 + b * min(l1, 8 - l2), c)
        dp[i + 1][rest - l2][l2] = max(dp[i + 1][rest - l2][l2], dp[i][rest][l1] + add)

ans = -INF
for y in range(m + 1):
  for x in range(9):
    ans = max(ans, dp[n][y][x])
print(ans)


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD ((ll)1e9+7)
ll N,M,S,T;
vector<ll> uv[101010];
ll mk[101010][3];

ll i,j,k,ans;
int main(){
    scanf("%lld%lld", &N,&M);
    fornum(i,0,M){
        ll u, v;
        scanf("%lld%lld", &u, &v);
        uv[u].push_back(v);
    }
    scanf("%lld%lld", &S, &T);

    queue<pair<pll, ll>> q;
    q.push({{S, 0}, 0});
    while(!q.empty()){
        auto qq = q.front();
        q.pop();
        auto qa = qq.first.first;
        auto qb = (qq.first.second+1)%3;
        auto qc = qq.second+1;
        //printf("a%lld,%lld,%lld\n", qa, (qb + 2) % 3,qc-1);
        if(qa==T&&qq.first.second==0){
            printf("%lld", qq.second / 3);
            return 0;
        }
        fornum(i,0,uv[qa].size()){
            auto b = uv[qa][i];
            if(mk[b][qb]==0){
                mk[b][qb] = 1;
                q.push({{b, qb}, qc});
            }
        }
    }
    printf("-1");

    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
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; }
const ll INF = 1e18;

int main(){
    string t;
    cin >> t;
    string ans = "";
    int l = t.size();
    rep(i,l){
        if(t[i]!='?'){
            ans += t[i];
        }
        else{
            ans += 'D';
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3924
from collections import deque
n = int(input())
data = [None]*n
for _ in range(n):
    a,*b = map(int,input().split())
    a -= 1
    data[a] = [i-1 for i in b[1:]]
d = [-1]*n
dq = deque([(0,0)])
while dq:
    p,q = dq.popleft()
    if d[p] == -1:
        d[p] = q
        for i in data[p]:
            dq.append((i,q+1))
for i,j in enumerate(d):
    print(i+1,j)


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

using namespace std;

#define pb push_back
#define pp pop_back
#define mp make_pair
#define F first
#define S second
#define xmax(x,y) ((x) = max((x),(y)))
#define xmin(x,y) ((x) = min((x),(y)))
#define all(x) (x).begin(),(x).end()
#define mem(x) memset(x , 0 , sizeof(x))
#define _ ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define FP(a , b , c)  for(ll (a) = (b) ; (a) < (c) ; (a++));
#define FM(a , b , c)  for(ll (a) = (b) ; (a) >= (c) ; (a--));
#define connect(a , b , c) a[b].pb(c) , a[c].pb(b)

typedef long long int ll;
typedef unsigned long long int ull;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector <ll> vl;
typedef vector <int> vi;
typedef vector <string> vs;

const ll Maxn3 = 1e3 + 10;
const ll Maxn4 = 1e4 + 10;
const ll Maxn5 = 1e5 + 10;
const ll Maxn6 = 1e6 + 10;
const ll Maxn7 = 1e7 + 10;
const ll Maxn8 = 1e8 + 10;
const ll Maxn9 = 1e9 + 10;
const ll Maxn18 = 1e18 + 10;
const ll Mod1 = 1e7 + 7;
const ll Mod2 = 1e9 + 7;
const ll LLMax = LLONG_MAX;
const ll LLMin  = LLONG_MIN;
const ll INTMax = INT_MAX;
const ll INTMin  = INT_MIN;

ll mn = LLMax , mx = LLMin;

int main()
{_
	ll a, b, c, x, y, total = 0, total2 = 0;cin >>a >> b >> c >> x >> y;
	total = a * x + b * y;
	total2 = 2 * c * (x > y ? y : x);
	if(x > y)
        if(a < c * 2)
            total2 += a * (x - y);
        else
            total2 += c * 2 * (x - y);
	else
        if(b < c * 2)
            total2 += b * (y - x);
        else
            total2 += c * 2 * (y - x);
	return cout << xmin(total , total2) , 0;
}
///SAliB


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

using namespace std;

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

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int a;
	string s;
	cin >> a >> s;
	cout << (a >= 3200 ? s : "red") << endl;
    
    return 0;
}



Measured memory_bytes: 3620
#include"bits/stdc++.h"
using namespace std;

int main() {
    int64_t M;
    cin >> M;
    vector<int64_t> d(M), c(M);
    int64_t sum = 0, digit_sum = 0;
    for (int64_t i = 0; i < M; i++) {
        cin >> d[i] >> c[i];
        sum += d[i] * c[i];
        digit_sum += c[i];
    }

    int64_t ans = digit_sum - 1 + (sum - 1) / 9;
    cout << ans << endl;
}

Measured memory_bytes: 3328
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll max3(ll a, ll b, ll c){return max(a, max(b, c));};
ll min3(ll a, ll b, ll c){return min(a, min(b, c));};
ll max4(ll a, ll b, ll c, ll d){return max(max(a, b), min(c, d));};
ll min4(ll a, ll b, ll c, ll d){return min(min(a, b), min(c, d));};
ll max5(ll a, ll b, ll c, ll d, ll e){return max(max(a, b), max3(c, d, e));};
ll min5(ll a, ll b, ll c, ll d, ll e){return min(min(a, b), min3(c, d, e));};

const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};


ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}

/*
//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; 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 comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}
*/


int main(){
  ll N;
  cin >> N;
  vector<ll> H(N);
  rep(i, N) cin >> H[i];
  H.pb(INFL);
  ll cnt = 0;
  vector<ll> xs;
  rep(i, N){
    if(H[i] < H[i+1]){
      xs.pb(cnt);
      cnt = 0;
    }else{
      cnt++;
    }
  }
  cout << *max_element(xs.begin(), xs.end()) << endl;
}


Measured memory_bytes: 2800
int main()
{
	int a, b, c;

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

	if ((a < b) && (b < c))
	{
		printf("%s\n", "Yes");
	}
	else
	{
		printf("%s\n", "No");
	}


	return 0;

}

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

int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	long long sum = 0;
	for (int i = 0; i < k; i++) sum += a[i];
	cout << sum;

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, k;
    cin >> n >> k;
    set<int> st;
    rep(i, 0, k) {
        int d;
        cin >> d;
        rep(j, 0, d) {
            int a;
            cin >> a;
            st.insert(a);
        }
    }
    cout << n - (int)st.size() << endl;
    return 0;
}


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

using namespace std;

template <class T>
using lim = numeric_limits<T>;

typedef long long ll;
typedef long double ld;

const int N = 50;

bool grid[N+2][N+2];
bool vis[N+2][N+2];

queue<int> row;
queue<int> col;

int startr = 1;
int startc = 1;

int endr;
int endc;

bool reachedEnd = false;

int nodesNext = 0;
int moveCount = 0;
int nodesLeft = 1;

// shortest path
int solvePath(){
	row.push(startr);
	col.push(startc);
	vis[startr][startc] = true;
	
	while (row.size() > 0){
		int r = row.front();
		int c = col.front();
		row.pop();
		col.pop();
		
		if (r == endr && c == endc){
			reachedEnd = true;
			break;
		}
		
		for (int x = -1; x <= 1; x++){
			for (int y = -1; y <= 1; y++){
				if (abs(x)+abs(y)==1 && !vis[r+x][c+y] && !grid[r+x][c+y]){
					row.push(r+x);
					col.push(c+y);
					vis[r+x][c+y] = true;
					nodesNext++;
				}
			}
		}
		
		nodesLeft--;
		if (nodesLeft == 0){
			nodesLeft = nodesNext;
			nodesNext = 0;
			moveCount++;
		}
	}
	if (reachedEnd) return moveCount+1;
	return -1;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	memset(vis, false, sizeof vis);
	memset(grid, false, sizeof grid);
	
	int h, w; cin >> h >> w;
	
	// setting borders
	for (int i = 0; i <= w+1; i++){
		grid[0][i] = true;
		grid[h+1][i] = true;
	}
	
	for (int i = 0; i <= h+1; i++){
		grid[i][0] = true;
		grid[i][w+1] = true;
	}
	
	// getting input
	int black = 0;
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++){
			char c; cin >> c;
			grid[i][j] = c=='#';
			black += grid[i][j];
		}
	}
	
	endr = h;
	endc = w;
	int minPath = solvePath();
	
	int ans = (h*w)-minPath-black;
	
	cout << (minPath!=-1 ? ans : -1) << endl;
}


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

#define pb push_back

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const ll INF = (ll)1<<62;
const ll MOD = 1e9+7;

int main(){
	int n;
	cin>>n;
	if(n%10 == 3)
		cout<<"bon\n";
	else if(n%10 == 0 || n%10 == 1 || n%10 == 6 || n%10 == 8)
		cout<<"pon\n";
	else
		cout<<"hon\n";
	return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;



int main() {
	while (1) {
		int N, K; cin >> N >> K;
		if (!N)break;
		vector<int>oks(N + 1);
		bool flag = false;
		for (int i = 0; i < K; ++i) {
			int a; cin >> a; oks[a] = true;
			if (!a)flag = true;
		}
		int a = 0;
		int b = 0;
		int ans = 0;
		for (int i = 1; i <= N; ++i) {
			if (oks[i]) {
				a++;
				b++;
				ans = max(ans, a);
				if (flag)ans = max(ans, b);
			}
			else {
				b = a+1;
				a = 0;
			}
		}
		cout << ans << endl;

	}
	return 0;
}

Measured memory_bytes: 3076
#include<iostream>
#include<map>
#include<string>
using namespace std;
typedef long long ll;
int main() {
	map<char, int>ctoi;
	char itoc[27];
	int asdfghjkl = 1;
	for (char c = 'a'; c <= 'z'; c++) {
		ctoi[c] = asdfghjkl;
		itoc[asdfghjkl] = c;
		asdfghjkl++;
	}
	string s; cin >> s;
	int arr[114514];
	for (int i = 0; i < s.size(); i++) 
		arr[i] = ctoi[s[i]];
	int n; cin >> n;
	for (int i = 0; i < s.size() - 1; i++) {
		if (arr[i] == 1)continue;
		if (27 - arr[i] <= n) {
			n -= 27 - arr[i];
			arr[i] = 1;
		}
	}
	arr[s.size() - 1] += n;
	arr[s.size() - 1] %= 26;
	if (arr[s.size() - 1] == 0)arr[s.size() - 1] = 26;
	for (int i = 0; i < s.size(); i++)cout << itoc[arr[i]];
	cout << endl;
}

Measured memory_bytes: 1024
<?php
list($N, $A, $B) = ints();
echo intdiv($N, $A+$B) * $A + min($A, $N % ($A+$B));

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;}
function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;}

function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array: ";
            echo implode(" ", addIndex($val))."\n";
        }else{
            echo "array:array\n";
            if(isCleanArray($val)){
                foreach($val as $row)echo implode(" ", addIndex($row))."\n";
            }else{
                foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row))."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}
function addIndex($val){
    if(!isCleanArray($val)){
        $val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);
    }
    return $val;
}
function isCleanArray($array){
    $clean = true;
    $i = 0;
    foreach($array as $k => $v){
        if($k != $i++)$clean = false;
    }
    return $clean;
}
/**
 * 座圧対象の配列を渡すと以下の値を返す
 * ・圧縮された配列
 * ・復元用のMap
 * ・圧縮用のMap
 **/
function atsu($array){
    $a = array_flip($array);
    $fuku = array_flip($a);
    sort($fuku);
    $atsu = array_flip($fuku);
    foreach($array as $i => $val)$array[$i] = $atsu[$val];
    return [$array, $fuku, $atsu];
}
//配列の最大公約数
function gcdAll($array){
    $gcd = $array[0];
    for($i = 1; $i < count($array); $i++){
        $gcd = gcd($gcd, $array[$i]);
    }
    return $gcd;
}

//最大公約数
function gcd($m, $n){
    if(!$n)return $m;
    return gcd($n, $m % $n);
}

//配列の最小公倍数
function lcmAll($array){
    $lcm = $array[0];
    for($i = 1; $i < count($array); $i++){
        $lcm = lcm($lcm, $array[$i]);
    }
    return $lcm;
}

//最小公倍数
function lcm($a, $b) {
    return $a / gcd($a, $b) * $b;
}
//ビットカウント-1の数を数える
function popcount($x){
    $con = 0;
    while ($x) {
        $x &= $x-1;
        ++$con;
    }
    return $con;
}

Measured memory_bytes: 4728
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
string S;

void solve(){
	for(int i = 0; i < S.size(); i += 2)
		cout << S[i];
	cout << endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> S;
		solve();
	return 0;
}


Measured memory_bytes: 592
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

//#define int long long
#define endl "\n"
#define fi first
#define se second
#define fr front
#define m_p make_pair
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

int jousu(int, int);
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}




int main() {
	int n, l, t;
	cin >> n >> l;
	t = (l + l + n - 1) * n / 2;
	if (l <= 0 && (n + l - 1) >= 0) {
		cout << t << endl;
		return 0;
	}
	if (l < 0) {
		cout << t - (l + n - 1) << endl;
		return 0;
	}
	else {
		cout << t - l << endl;
	}
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	int a[50+7];
	scanf("%d%d",&n,&k);
	int sum=0;
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	sort(a,a+n);
	for(int i=n-1;n-i<=k;i--)
		sum+=a[i];	
	printf("%d",sum);
	return 0;
 } 

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

struct Node {
    int key;
    Node *next, *prev;
};

Node *nil;

Node* listSearch(int key){
    Node *cur = nil->next;
    while (cur != nil && cur-> key != key){
        cur = cur->next;
    };
    return cur;
}

void init(){
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
}

void printList(){
    Node *cur = nil->next;
    int isf = 0;
    while (1) {
        if (cur==nil) break;
        if (isf++ > 0) printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}

void deleteNode(Node *t){
    if (t==nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst(){
    deleteNode(nil->next);
}

void deleteLast(){
    deleteNode(nil->prev);
}

void deleteKey(int key){
    deleteNode(listSearch(key));
}

void insert(int key){
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev =x;
    nil->next = x;
    x->prev =nil;
}

int main(){
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for (i = 0; i<n; i++){
        scanf("%s%d", com, &key);
        if (com[0]=='i') {insert(key); np++; size++;}
        else if (com[0]=='d') {
            if (strlen(com)>6){
                if(com[6] == 'F'){
                    deleteFirst();
                }
                else if (com[6] == 'L') deleteLast();
            }else{
                deleteKey(key); nd++;
            }
            size--;
        }
    }
    printList();
    return 0;
}


Measured memory_bytes: 34456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n,t;
    cin >> n >> t;
    int mx=9999;
    while(n--){
        int c,d;
        cin >> c >> d;
        if(d<=t){
            if(c<mx){
                mx=c;
            }
        }
    }
    if(mx==9999){
        cout << "TLE" << endl;
    }
    else cout << mx << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <array>

using namespace std;

struct Card {
	char suit;
	int value;
  bool operator==(const Card& rhs) {
    return this->suit == rhs.suit && this->value == rhs.value;
  }
};

static void printCard(Card cards[], int N) {
  for (int i = 0; i < N; i++) {
    cout << (i != 0 ? " " : "") << cards[i].suit << cards[i].value;
  }
  cout << endl; 
}

static void inputCard(Card cards[], int N) {
  for (int i = 0; i < N; i++) {
    cin >> cards[i].suit >> cards[i].value;
   }
}

static int bubbleSort(Card cards[], int N) {
  bool flag = true;
  int count = 0;
  Card tmp;
  for (int i =0; flag; i++) {
    flag = false;
    for (int j = N - 1; j > i; j--) {
      if (cards[j].value < cards[j - 1].value) {
        swap(cards[j], cards[j - 1]);
	      flag = true;
      	count++;
      }
    }
  }
  return count;
}

static int selectionSort(Card cards[], int N) {
  int minj, count = 0;
  for (int i = 0; i < N; i++) {
    minj = i;
    for (int j = i; j < N; j++) {
      if (cards[j].value < cards[minj].value) {
      	minj = j;
      }
    }
    if (cards[i].value != cards[minj].value) {
        swap(cards[i], cards[minj]);
        count++;
    }
  }
  return count;
}

static bool isStable(Card in[], Card out[], int N) {
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      for (int a = 0; a < N; a++) {
        for (int b = a + 1; b < N; b++) {
          if (in[i].value == in[j].value && in[i] == out[b] && in[j] == out[a]) {
            return false;
          }
        }
      }
    }
  }
  return true;
}

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

  array<Card, 36> A, B;
  inputCard(A.data(), N);

  B = A;
  bubbleSort(B.data(), N);
  printCard(B.data(), N);
  bool stable;
  stable = isStable(A.data(), B.data(), N);
  cout << (stable ? "Stable" : "Not stable") << endl;
  
  B = A;
  selectionSort(B.data(), N);
  printCard(B.data(), N);
  stable = isStable(A.data(), B.data(), N);
  cout << (stable ? "Stable" : "Not stable") << endl;
  
  return 0;
}



Measured memory_bytes: 3140
import java.util.*;

class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int a, b, ans = 0;
	char op;

	while (true) {
	    String[] line = sc.nextLine().split(" ");
	    a = Integer.parseInt(line[0]);
	    op = line[1].charAt(0);
	    b = Integer.parseInt(line[2]);
	    if (op == '?') break;

	    switch (op) {
	    case '+':
		ans = a + b;
		break;
	    case '-':
		ans = a - b;
		break;
	    case '*':
		ans = a * b;
		break;
	    case '/':
		ans = a / b;
		break;
	    }
	    System.out.println(ans);
	}
    }
}

Measured memory_bytes: 17324
#include<iostream>
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define vi vector<int>
#define lvi vector<long long>
#define pi pair<int,int>
#define lpi pair<long long ,long long>
#define mp make_pair
#define pb push_back
#define ll long long 
#define N 100005
#define faltu ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007
#define mod1 1000000000000000007
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>multiordered_set;
ll int pw(ll int a, ll int b,ll md) {
    if (b == 0) return 1;
    ll int t = pw(a, b / 2,md);
    if (b % 2 == 0) return (t * t)%mod;
    else return ((t * t)%mod * a)%mod;
}
vector<int> pm;
void prm(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
              prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p]) pm.push_back(p);
}
bool cmp(const pair<ll int,ll int> &a,const pair<ll int,ll int> &b)
{
    if(a.first==b.first)return a.second<b.second;
    return a.first<b.first;
}
ll int gcd(ll int a,ll int b)
{
    if(!a)return b;
    return gcd(b%a,a);
}
bool isPrime(int n) 
{ 
    if (n <= 1) 
        return false; 
    for (int i = 2; i < n; i++) 
        if (n % i == 0) 
            return false; 
    return true; 
} 
map<int,int>pa;
int find(int i){
    if(pa[i]==i)return i;
    return pa[i]=find(pa[i]);
}     
void join(int i,int j){
    int a=find(i);
    int b=find(j);
    if(b>=a)pa[b]=a;
    else pa[a]=b;
}               
int ddx[]={-1,-1,-1,0,1,1,1,0};
int ddy[]={-1,0,1,1,1,0,-1,-1};
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int n,m;
ll p[N],h[N],x[N],y[N];
vector<int>ed[N];
int main()
{
    faltu;
    int t=1;
   // cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        if(n>=30)cout<<"Yes"<<endl;
        else cout<<"No\n";
    }
}

Measured memory_bytes: 5976
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll n;
  cin>>n;
  ll i,sum=0;
  for(i=1;i<=n;i++)
  {
      if(i%3==0&&i%5==0||i%3==0||i%5==0)
          continue;
    else
      sum+=i;
  }
  cout<<sum<<endl;

}


Measured memory_bytes: 3632
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
out = sum(b)
for i in range(n-1):
    if a[i]+1 == a[i+1]:
        out += c[a[i]-1]
print(out)

Measured memory_bytes: 3064
k = int(input())


dnum2list = {}
dnum2list[1] = list(map(str, range(1, 10)))

for i in range(2, 11):
    dnum2list[i] = []
    for num in dnum2list[i - 1]:
        if num[-1] != '0':
            dnum2list[i].append(num + chr(ord(num[-1]) - 1))
        dnum2list[i].append(num + num[-1])
        if num[-1] != '9':
            dnum2list[i].append(num + chr(ord(num[-1]) + 1))

all_vals = []
for vals in dnum2list.values():
    all_vals += [int(v) for v in vals]

all_vals.sort()
print(sorted(all_vals)[k - 1])


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

int main()
{
    ll n, max_weight;
    cin >> n >> max_weight;
    vector<ll> profit(n+1);
    vector<ll> weight(n+1);
    for(ll i = 1; i <= n; i++)
    {
        cin >> weight[i];
        cin >> profit[i];
    }
    int size = accumulate(profit.begin(), profit.end(), 0);
    vector<ll> dp(size+1,LONG_MAX);
    dp[0] = 0;
    for(int i = 1; i <= n; i++)
        for(int j = size - profit[i]; j >= 0; j--)
            if(dp[j] != LONG_MAX)
                dp[j + profit[i]] = min(dp[j + profit[i]], dp[j] + weight[i]);

    int ans = 0;
    for(int i = 0; i <= size; i++)
        if(dp[i] <= max_weight)
            ans = i;
    cout << ans;
    return 0;
}


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

int main()
{
    int n,od=0,tw=0,z=0,x;
    bool flag=1;
    cin>>n;
    //int num[n];
    for(int i=0;i<n;i++)
    {
        cin>>x;
        if(x%4==0) z++;
        else if(x%4==2) tw++;
        else if(x%2==1) od++;
    }
    if(od>(z+1)) flag=0;
    else z=z-od+1;
    if(tw%2==1 && tw!=n)
    {
        if(z==0) flag=0;
    }
    if(flag) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
class Case01

  def initialize
  end

  def show
    p self.instance_variables
        .map{ |sym| [sym, self.instance_variable_get(sym)] }
        .to_h
  end
  
  # 実行する
  def execute
    read
    solve
    output
  end

  def read
    @n = gets.chomp.to_i
  end

  def solve
    @result = @n ** 3
  end
  
  def output
    puts @result
  end

end

Case01.new.execute if $0 == __FILE__



Measured memory_bytes: 1788
<?PHP
$single_line_input = fgets(STDIN);
$array = explode(" ", $single_line_input);
$item_num = $array[0];
$weight_upper = $array[1];
for($i=0;$i<$array[0];++$i){
    fscanf(STDIN,"%d %d ",$x,$y);
    $weight[$i]=$x;
    $value[$i]=$y;
}

$dp = [];
foreach (range(0, $item_num-1) as $item_index) {
    $i_value = $value[$item_index];
    $i_weight = $weight[$item_index];
    foreach (range(1, 100001) as $value_index) {
        $zantei=$dp[$item_index-1][$value_index]?? PHP_INT_MAX;
        if ($i_value>=$value_index||isset($dp[$item_index-1][$value_index-$i_value])){
            $new=(($dp[$item_index-1][$value_index-$value[$item_index]] ?? 0 )+$i_weight);
            $dp[$item_index][$value_index]=$new >=$zantei ? $zantei:$new;}

    }

}
$answer=0;
foreach ($dp[(int)$item_num-1] as $index => $value) {
  if ($value<=$weight_upper){$answer=$index;}else{
  break;}
}
    echo $answer;


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

using ll = long long;
using ld = long double;

constexpr ld eps = 1e-18;

int main() {
    ll k; cin >> k;
    auto calc = [] (ll x) {
        ll tx = x, sum = 0;
        while(x > 0) {
            sum += x % 10;
            x /= 10;
        }
        return (ld) tx / sum;
    };
    auto f = [&calc] (ll x) {
        int d = 0;
        {
            auto tx = x;
            while(tx > 0) tx /= 10, d += 1;
        }
        ll y = 10;
        ll res = x;
        for(int i = 0; i < d; ++i) {
            const auto z = y * (x / y + 1) - 1;
            if(z <= x) continue;
            if(fabs(calc(res) - calc(z)) < eps) {
                res = min(res, z);
            } else if(calc(res) > calc(z)) {
                res = z;
            }
            y *= 10;
        }
        return res;
    };

    ll x = 1;
    for(int i = 0; i < k; ++i) {
        cout << x << endl;
        x = f(x + 1);
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <iomanip>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll W,a,b;
    cin >> W >> a >> b;
    ll m = min(a,b);
    ll M = max(a,b);
    cout << max(0ll,M-(m+W)) << endl;
}


Measured memory_bytes: 256
//
//  main.cpp
//  atcoderX
//
//  Created by 村井真奈美 on 2018/06/16.
//  Copyright © 2018年 村井真奈美. All rights reserved.
//

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

int main() {
    
    int N;
    cin >> N;
    
    vector<int> rc(N);
    
    for (int i=0 ; i<N ; i++){
        cin >> rc[i];
    }
    
    sort(rc.begin(),rc.end());
    int result  = 1;
    
    for(int i=0 ; i<N-1 ; i++){
        if(rc[i] < rc[i+1]) result++;
    }
    
    cout << result << endl;
 
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int mx=0,mn=1000000;
    for (int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        mx=max(mx,x);
        mn=min(mn,x);
    }
    cout<<mx-mn<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int N, W;
int w[110], v[110];
long long dp[100100];

long long max(long long a, long long b) {
    return (a > b ? a : b);
}

int main() {
    scanf("%d%d", &N, &W);
    for (int i = 1; i <= N; i++) {
        scanf("%d%d", &w[i], &v[i]);
    }
    dp[0] = 0;
    for (int i = 1; i <= N; i++) {
        for (int j = W; j >= w[i]; j--) {
            dp[j] = max(dp[j], dp[j - w[i]] + 1ll * v[i]);
        }
    }
    printf("%lld\n", dp[W]);
}

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

int main(){
  long long k,a,b;
  cin >> k >> a >> b;
  if(b - a >1){
    if(k - a + 1 >= 2){
      cout << (k-a+1)/2*(b-a)+(k-a+1)%2 + a << endl;
    }else{
      cout << 1 + k << endl;
    }
  }else{
    cout << 1+k << endl;
  }
}

Measured memory_bytes: 256
import bisect
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for i in b:
  d = bisect.bisect_left(a, i)
  e = bisect.bisect_right(c, i)
  if d > 0 and e < len(c):
    ans += d*(n-e)
print(ans)

Measured memory_bytes: 23360
from heapq import heappush, heappop
import sys
readline = sys.stdin.readline
write = sys.stdout.write

def solve():
    N, s, t = map(int, readline().split())
    if N == 0:
        return False
    *Q, = map(int, readline().split())
    G = [[] for i in range(N)]
    for v in range(N):
        *A, = map(int, readline().split())
        for w, a in enumerate(A):
            if not a:
                continue
            G[v].append((w, a))
    INF = 10**9
    que = [(0, t-1)]
    dist = [INF]*N
    dist[t-1] = 0

    while que:
        cost, v = heappop(que)
        if dist[v] < cost:
            continue
        for w, d in G[v]:
            if cost + d < dist[w]:
                dist[w] = cost + d
                heappush(que, (cost + d, w))

    if dist[s-1] == INF:
        write("impossible\n")
        return

    G0 = [[] for i in range(N)]
    for v in range(N):
        if v == t-1:
            continue
        if Q[v]:
            cost = dist[v]
            for w, d in G[v]:
                if cost != dist[w] + d:
                    continue
                G0[v].append((w, d))
        else:
            G0[v] = G[v]

    MT = [[0]*(N+1) for i in range(N)]
    for v in range(N):
        Mv = MT[v]
        Mv[v] = 1
        r = 0
        g = len(G0[v])
        for w, d in G0[v]:
            Mv[w] -= 1 / g
            r += d / g
        Mv[N] = r

    for i in range(N):
        Mi = MT[i]
        v = Mi[i]
        for j in range(N+1):
            Mi[j] /= v
        for k in range(N):
            Mk = MT[k]
            e = Mk[i]
            if e == 0 or i == k:
                continue
            for j in range(N+1):
                Mk[j] -= e * Mi[j]
    write("%.16f\n" % MT[s-1][N])
    return True
while solve():
    ...



Measured memory_bytes: 6880
def solve(S, T):
    ans = len(T)
    for i in range(len(S) - len(T) + 1):
        diff = 0
        for j in range(len(T)):
            if T[j] != S[i + j]:
                diff += 1
        ans = min(ans, diff)
    print(ans)


if __name__ == "__main__":
    S = input()
    T = input()
    solve(S, T)


Measured memory_bytes: 9060
#include<bits/stdc++.h>
#define M 1000000007

using namespace std ;

int r , c ;
vector< string > grid( 1001 ) ;
int dp[ 1005 ][ 1005 ] ;

void solve( int i , int j )
{
    if( i == r && j == c )
        return ;

    if( j != c && grid[ i ][ j + 1 ] != '#' )
    {
        if( dp[ i ][ j + 1 ] == 0 )
            solve( i , j + 1 ) ;

        dp[ i ][ j ] = ( dp[ i ][ j ] + dp[ i ][ j + 1 ] ) % M ;
    }

    if( i  != r && grid[ i + 1 ][ j ] != '#' )
     {
        if( dp[ i + 1 ][ j ] == 0 )
            solve( i + 1 , j ) ;
        dp[ i ][ j ] = ( dp[ i ][ j ] + dp[ i + 1 ][ j ] ) % M ;
    }

    if( dp[ i ][ j ] == 0 )
        grid[ i ][ j ] = '#' ;
}

int main()
{
    cin >> r >> c ;

    memset( dp , 0 , sizeof(dp) ) ;
    for( int i = 1 ; i <= r ; i++ )
    {
        string temp ;
        cin >> temp ;

        grid[ i ] = " " ;
        grid[ i ] += temp ;
    }

    dp[ r ][ c ] = 1 ;
    solve( 1 , 1 ) ;
    cout << dp[ 1 ][ 1 ] ;
}


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

#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define si set<int>
#define sl set<long long>
#define pq prioirty_queue
#define all(v) v.begin(),v.end()
#define left (2*idx)+1
#define right (2*idx)+2
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);

const ll N = (ll)(1e5 + 7);
const ll MOD = (ll)(1e9 + 7);

int main()
{
    FIO;
    int mx = 1000000;
    int mn = -1000000;

    int k, x;
    cin >> k >> x;
    si s;
    int i = x;
    int k1 = k;
    while(k--)
    {
    	s.insert(i);
    	i++;
    	if(i > mx)
    	{
    		break;
    	}
    }

    k1-=1;
    i = x-1;
    while(k1--)
    {
    	if(i < mn)
    	{
    		break;
    	}
    	s.insert(i);
    	i-=1;
    }

    for(auto i : s)
    {
    	cout << i << " ";
    }
    cout << "\n";

}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  int n,m,q;
  cin >> n >> m;
  vector<list<int>> e(n,list<int>());
  int a,b;
  for(int i=0;i<m;i++){
    cin >> a >> b;
    a--,b--;
    e[a].push_back(b);
    e[b].push_back(a);
  }
  cin >> q;
  int v,d,c;
  vector<vector<int>> query(n,vector<int>(11,0));
  vector<int> color(q+1);
  color[0]=0;
  for(int t=1;t<=q;t++){
    cin >> v >> d >> color[t];
    v--;
    query[v][d]=max(query[v][d],t);
  }
  for(int i=10;i>0;i--){
    for(int j=0;j<n;j++){
      for(auto itr=e[j].begin();itr!=e[j].end();itr++){
        query[(*itr)][i-1]=max(query[(*itr)][i-1],query[j][i]);
      }
    }
  }
  int ma;
  for(int i=0;i<n;i++){
    ma=query[i][0];
    // cout << query[i][0] << " ";
    for(int j=1;j<11;j++){
      ma=max(ma,query[i][j]);
      // cout << query[i][j] << " ";
    }
    // cout << endl;
    cout << color[ma] << endl;
  }
  return 0;
}


Measured memory_bytes: 17408
#include <bits/stdc++.h>
using namespace std;
long long a[90]={2,1};
long long lucas(int n)
{
    if (a[n]) return a[n];
    a[n]=lucas(n-1)+lucas(n-2);
    return a[n];
}
bool prime(int n)
{
    if (n==1) return 0;
    for (int i=2; i<=sqrt(n); i++)
    {
        if (n%i==0) return 0;
    }
    return 1;
}
int main()
{
    int n;
    cin>>n;
    cout<<lucas(n);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
    #include<string>
    #include<algorithm>
    using namespace std;
    int main(){
        string S;
        cin>>S;
        int res=S.size();
        int a=S.size();
        for(int i=1;i<S.size();i++){
            if(S[i]!=S[i-1])
                res=min(res,max(i,a-i));
        }
        cout<<res<<endl;
        return 0;
    }



Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main()
{
    string s , t , u;
    int x , y ;
    cin>>s>>t>>x>>y;
    cin>>u;
    if(u==s){x=x-1;}
    else if (u==t){y=y-1;}
    cout<<x<<" "<<y;
    return 0;
}


Measured memory_bytes: 256
#n=int(input())
#a,b,c=map(int,input().split())
#t=int(input())
#al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
s=list(input())
k=int(input())

if s.count("1")==len(s):
    ans="1"
else:
    for i in range(len(s)):
        if s[i]!= "1":
            break
    if k>i:
        ans=s[i]
    else:
        ans=s[i-1]
print(ans)

Measured memory_bytes: 9164
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int main()
{
	int a,b,c,d,e,k;
	cin >> a >> b >> c >> d >> e >> k;
	if(k<e-a) cout << ":(\n";
	else cout << "Yay!\n";
	return 0;
}

Measured memory_bytes: 256
#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 REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#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 A, B;
  cin >> A >> B;
  cout << A * B << endl;
  return 0;
}


Measured memory_bytes: 3652
///=======================///
/// coder: Andy - Tohrumi ///
///=======================///

#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define rep(i, m, n) for(int i = m; i < n; i++)
#define Rep(i, m, n) for(int i = m; i > n; i--)
#define repl(i, m, n) for(ll i = m; i < n; i++)
#define Repl(i, m, n) for(ll i = m; i > n; i--)
#define fastio ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
using namespace std;
typedef vector<int> vi;		typedef pair<int, int> ii;		typedef vector<ii> vii;

signed main() {
	fastio;
	ll a, b; cin >> a >> b;
	vector<ll> all;
	if(b - a < 10) {
		ll ans = a;
		repl(i, a + 1, b + 1) {
			ans ^= i;
		}
		cout << ans;
		return 0;
	}
	while(a % 4 != 0) {
		all.pb(a);
		a++;
	}
	while(b % 4 != 3) {
		all.pb(b);
		b--;
	}
	if(all.size() == 0) cout << 0 << endl;
	else {
		ll ans = all[0];
		rep(i, 1, all.size()) {
			ans ^= all[i];
		}
		cout << ans << endl;
	}
	return 0;
}


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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int n, m;
	cin >> n >> m;
	vi h(n+1);
	for(int i = 1; i <= n; i++) cin >> h[i];
	vi ma(n+1, 0);
	rep(i, m){
		int a, b;
		cin >> a >> b;
		ma[a] = max(ma[a], h[b]);
		ma[b] = max(ma[b], h[a]);
	}
	int ans = 0;
	for(int i = 1; i < n+1; i++){
		if(h[i] > ma[i]) ans++;
	}

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

Measured memory_bytes: 3992
import java.util.Scanner;

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

		int x1 = sc.nextInt();
		int y1 = sc.nextInt();
		int x2 = sc.nextInt();
		int y2 = sc.nextInt();
		
		int x3 = (x2 - (y2 - y1));
		int y3 = (y2 - (x1 - x2));
		int x4 = (x1 - (y2 - y1));
		int y4 = (y1 - (x1 - x2));
		
		System.out.println(x3 + " " + y3 + " " + x4 + " " + y4);
	}
}

Measured memory_bytes: 21716