akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loope(i,a,b) for(ll i=a;i<=b;i++)
#define test() ull t;cin>>t;while(t--)
#define puu pair<ull,ull>
#define f first
#define s second
#define pb push_back
#define mkp make_pair
#define ins insert
#define Vint vector<int>
#define Vull vector<ull>
#define nl cout<<endl
#define sp cout<<" "
#define MOD 1000000007
#define all(x) x.begin(),x.end()
bool comparefunc(tuple<string,int,int> a,tuple<string,int,int> b)
{
	if(get<0>(a)<get<0>(b))
		return true;
	else if(get<0>(a)>get<0>(b))
		return false;
	if(get<1>(a)<get<1>(b))
		return false;
	else
		return true;
}
int main() 
{
	 // #ifndef ONLINE_JUDGE
  //       freopen("input.txt", "r", stdin);
  //       freopen("output.txt", "w", stdout);
  //   #endif
  //   fastio();
    int n;
    cin>>n;
    vector<tuple<string,int,int>> lis;
    for(int i=0;i<n;i++)
    {
    	string s;
    	int sc;
    	cin>>s>>sc;
    	lis.pb(make_tuple(s,sc,i+1));
    }
    sort(lis.begin(),lis.end(),comparefunc);
    loop(i,0,n)
    {
    	cout<<get<2>(lis[i])<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i > 0; i--)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
template <typename Iter> std::string join(Iter begin, Iter end, std::string const& separator){ std::ostringstream result; if (begin != end){ result << *begin++; }; while (begin != end){ result << separator << *begin++; }; return result.str(); }
using namespace std;
typedef long long ll;
void dfs(vector<vector<ll>> &edges, vector<ll> &actions, vector<ll> &values, ll current_node, ll parent_value, ll parent_node) {
  values[current_node] = parent_value + actions[current_node];
  for(auto e: edges[current_node]) {
    if(e == parent_node) {
      continue;
    }
    dfs(edges, actions, values, e, values[current_node], current_node);
  }
}
void solve() {
  ll N, Q; cin >> N >> Q;
  vector<vector<ll>> edges(N, vector<ll>());
  REP(i, N - 1) {
    ll a, b; cin >> a >> b;
    edges[a-1].push_back(b-1);
    edges[b-1].push_back(a-1);
  }
  vector<ll> actions(N);
  REP(i, Q) {
    ll p, x; cin >> p >> x;
    actions[p-1] += x;
  }
  vector<ll> values(N);
  dfs(edges, actions, values, 0, 0, -1);
  cout << join(ALL(values), " ") << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


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

int FindSum(int n){
  int ans=0;
  while(n>0){
    ans += n%10;
    n /= 10;
  }
  return ans;
}

int main() {
  int n,ans,k,l;
  cin >> n;
  ans = 99999;
  for(int i=1;i<n;i++){
    k = FindSum(i);
    l = FindSum(n-i);
    ans = min(ans,k+l);
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    class Point {
        int x, y;
        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "(" + this.x + ", " + this.y + ")";
        }

    }

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Point[] aArr = new Point[n];
        Point[] bArr = new Point[n];
        for (int i = 0; i < n; i ++) {
            aArr[i] = new Point(sc.nextInt(), sc.nextInt());
        }
        for (int i = 0; i < n; i ++) {
            bArr[i] = new Point(sc.nextInt(), sc.nextInt());
        }

        Arrays.sort(aArr, (o1, o2) -> o1.x - o2.x);
        Arrays.sort(bArr, (o1, o2) -> o1.x - o2.x);
        int count = 0;
        for (Point b : bArr) {
            Arrays.sort(aArr, (o1, o2) -> o2.y - o1.y);
            for (int i = 0; i < n; i++) {
                Point a = aArr[i];
                if (a.x == Integer.MAX_VALUE) {
                    continue;
                }
                if (a.x < b.x && a.y < b.y) {
                    count++;
                    aArr[i] = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
                    break;
                }
            }
        }
        System.out.println(count);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


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

void solve()
{
    ll x,step=0,p=100;
    cin>>x;

    while(p<x)
    {
        p+=p/100;
        step++;
    }

    cout<<step<<endl;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    solve();
    return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <cassert>
#include <queue>
#include <ctime>
#include <string>
#include <cstring>
#define mp make_pair
#define pb push_back
#define NAME ""
#define y1 y1_423
#define list lista

using namespace std;

typedef long long ll;
typedef long double ld;

template<typename T>
ostream& operator << (ostream& cout, const vector<T> &a) {
	if ((int)a.size() == 0) {
		return (cout << "()");
	}
	cout << "(" << a[0];
	for (int i = 1; i < (int)a.size(); i++) {
		cout << "; " << a[i];
	}
	return (cout << ")");
}

template<typename T>
ostream& operator << (ostream& cout, const set<T> &a) {
	if ((int)a.size() == 0) {
		return (cout << "{}");
	}
	auto it = a.begin();
	cout << "{" << *it;
	++it;
	for (; it != a.end(); ++it) {
		cout << "; " << *it;
	}
	return (cout << "}");
}

template<typename T>
ostream& operator << (ostream& cout, const multiset<T> &a) {
	if ((int)a.size() == 0) {
		return (cout << "{}");
	}
	auto it = a.begin();
	cout << "{" << *it;
	++it;
	for (; it != a.end(); ++it) {
		cout << "; " << *it;
	}
	return (cout << "}");
}

template<typename T1, typename T2>
ostream& operator << (ostream& cout, const pair<T1, T2> &a) {
	return cout << "(" << a.first << "; " << a.second << ")";
}

const int nmax = 2000 * 1000;
const int inf = 2000 * 1000 * 1000;
const ll infl = 1000ll * 1000ll * 1000ll * 1000ll * 1000ll * 1000ll;
const int mod = 1000 * 1000 * 1000 + 7;
const ld pi = acos(-1.0);

int n;
ll x[nmax];
vector<int> e[nmax];
bool answer[nmax];

int main() {
	//freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
	//freopen(NAME".in", "r", stdin);freopen(NAME".out", "w", stdout);
	cin >> n;
	for (int i = 0; i < n; i++) {
		scanf("%lld", &x[i]);
	}
	for (int i = 0; i < n - 1; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		x--, y--;
		e[x].pb(y);
		e[y].pb(x);
	}
	bool f = true;
	while (f) {
		f = false;
		for (int v = 0; v < n; v++) {
			if (answer[v]) continue;
			for (int u : e[v]) {
				ll answ = x[v] - 1;
				for (int q : e[u]) {
					if (!answer[q]) {
						answ = min(answ, x[q]);
					}
				}
				if (answ >= x[u]) {
					answer[v] = f = true;
					break;
				}
			}
		}
	}
	for (int i = 0; i < n; i++) {
		if (answer[i]) {
			printf("%d ", i + 1);
		}
	}
	return 0;
}



Measured memory_bytes: 47360
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define MOD = 998244353;
#define int long long int
#define inf (int)(1e15)
#define all(x) (x).begin(), (x).end()
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define isYes(x) printf("%s\n", (x) ? "Yes" : "No")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define isIn(x, y, h, w) (x >= 0 && x < h && y >= 0 && y < w)
#define pair pair<int, int>
typedef vector<int> vi;   // Vector of long long
typedef vector<vi> vvi;   // Vector of vi
typedef vector<pair> vii; // Vector of pairs
typedef vector<vii> vvii; // Vector of Vector of pairs
typedef vector<bool> vb;  // Vector of bool
#define pq priority_queue // Max heap (To convert to min heap, use negative sign before every value)
#define ff first          // For pairs
#define ss second
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, -1, 0, 1};
const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}, dy8[] = {1, -1, 1, 0, -1, 1, -0, -1};
#define testcases(t) \
    int(t);          \
    cin >> (t);      \
    while ((t)--)
#define range(c, r) (c).begin(), (c).begin() + (r)    // Mainly used in sorting
#define present(c, x) ((c).find(x) != (c).end())      // for sets, maps, multi-maps
#define cpresent(c, x) (find(all(c), x) != (c).end()) // for vectors
#define run(x, c) for ((x) = (c).begin(); (x) != (c).end(); (x)++)
signed main()
{
    int n;
    cin >> n;
    int ans = n % 10;
    if (ans == 2 || ans == 4 || ans == 5 || ans == 7 || ans == 9)
    {
        cout << "hon" << endl;
    }
    else if (ans == 0 || ans == 1 || ans == 6 || ans == 8)
    {
        cout << "pon" << endl;
    }
    else
    {
        cout << "bon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
def codefes16qa_c():
    s = str(input())
    k = int(input())
    n = len(s)
    ans = ''
    for i in range(n):
        if s[i] == 'a':
            ans += s[i]
            continue
        step2a = 1 + ord('z') - ord(s[i])
        if step2a <= k:
            ans += 'a'
            k -= step2a
        else:
            ans += s[i]
    if k > 0:
        last = ord(ans[-1]) + (k % 26)
        ans = ans[:n-1] + chr(last)
    print(ans)

codefes16qa_c()

Measured memory_bytes: 3444
package main

import (
	"fmt"
	"math"
)

var N int

func main() {
	fmt.Scan(&N)

	fmt.Println(N / 3)
}

/*  ----------------------------------------  */

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

type LR struct {
	L int
	R int
}

// type LR []int

// func (a SortBy) Len() int           { return len(a) }
// func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
// func (a SortBy) Less(i, j int) bool { return a[i] < a[j] }


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

int main(){
	int N,M;
	cin >> N >> M;
	int p;
	string S;
	int sum = 0;
	vector<bool> ac(N,0);
	vector<int> wa(N,0);
	int w_ans = 0;

	for(int i = 0; i< M; i++){
		cin >> p >> S;
		if(S == "AC" && ac[p-1] == 0){
			ac[ p-1 ] = 1;
			sum++;
		}
		else if(S == "WA" && ac[p-1] == 0){
			wa[p-1] += 1;
		}
	}
	for(int i = 0; i < N; i++){
		if(ac[i] == 1)
			w_ans += wa[i];
	}

	cout << sum << " " << w_ans << endl;

	return 0;
}

Measured memory_bytes: 640
def main():

    n = int(input())
    h = list(map(int, input().split()))
    mx = 0
    sm = 0
    for i in range(n - 1):
        if h[i + 1] <= h[i]:
            sm += 1
        else:
            mx = max(mx, sm)
            sm = 0
    if mx < sm:
        mx = sm
    print(mx)

if __name__ == "__main__":
    main()

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    vector<vector<int>> A(3, vector<int>(3));
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            cin >> A[i][j];
        }
    }
    int n;
    cin >> n;
    map<int, int> total_count;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        ++total_count[x];
    }
    auto check = [&](int r1, int c1, int r2, int c2, int r3, int c3) {
        map<int, int> cnt;
        ++cnt[A[r1][c1]];
        ++cnt[A[r2][c2]];
        ++cnt[A[r3][c3]];
        for (auto &p : cnt) {
            if (!total_count.count(p.first) || total_count[p.first] < p.second) {
                return false;
            }
        }
        return true;
    };
    if (check(0, 0, 0, 1, 0, 2)
        || check(1, 0, 1, 1, 1, 2) 
        || check(2, 0, 2, 1, 2, 2)
        || check(0, 0, 1, 0, 2, 0)
        || check(0, 1, 1, 1, 2, 1)
        || check(0, 2, 1, 2, 2, 2)
        || check(0, 0, 1, 1, 2, 2)
        || check(0, 2, 1, 1, 2, 0)) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0;
}



Measured memory_bytes: 256
const main = (input: string) => {
  const lines = input.trim().split("\n");
  const P = lines.slice(1).map(str => parseInt(str))
  const MaxPrice = Math.max(...P)
  let sum = 0;

  P.forEach(p => {
    sum += p
  });

  console.log(sum - (MaxPrice / 2))
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
#include<stdio.h>
int main()
{
    int n;
    scanf ("%d",&n);
    if (n<105)
    {
        printf ("0\n");
    }
    else if (n==105)
    {
        printf ("1\n");
    }
    else if (n>=105 && n<135)
    {
        printf ("1\n");
    }
    else if (n==135)
    {
        printf ("2\n");
    }
    else if (n>=135 && n<165)
    {
        printf ("2\n");
    }
    else if (n==165)
    {
        printf ("3\n");
    }
    else if (n>=165 && n<189)
    {
        printf ("3\n");
    }
    else if (n==189)
    {
        printf ("4\n");
    }
    else if (n>=189 && n<195)
    {
        printf ("4\n");
    }
    else if (n>=195)
    {
        printf ("5\n");
    }
    return 0;
}


Measured memory_bytes: 128
/*
* @author:  codancer
* @createTime:  2020-08-15, 19:55:33
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9+7;
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define fep(i,a,b) for(int i=(a);i>=(b);i--)
#define deb(x) cerr<<#x<<" = "<<(x)<<"\n"
typedef vector<int> VI;
typedef vector<ll> VII;
typedef pair<int,int> pii;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll Rand(ll B) {
	return (ull)rng() % B;
}
int main(){
	string s;
	cin>>s;
	int ans=0;
	int cnt=0;
	for(int i=0;i<3;i++){
		if(s[i]=='R'){
			++cnt;
		}else{
			ans=max(ans,cnt);
			cnt=0;
		}
	}
	ans=max(ans,cnt);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3628
N = int(input())
A = [int(a) for a in input().split()]

S = [0]*(N+1)
for i in range(N):
    S[i+1] = S[i]+A[i]

S.sort()
S.append("last")
ans = 0
cnt = 1
for i in range(N+1):
    if S[i+1] == S[i]:
        cnt += 1
    else:
        ans += cnt*(cnt-1)//2
        cnt = 1
print(ans)

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

int main() {
  int n;
  cin >> n;
  ll ans = 1;
  bool ret = false;
  rep(i,n) {
    ll a;
    cin >> a;
    if(a == 0) {
      cout << 0 << endl;
      return 0;
    }
    if(ret || mx/ans < a) {
      ret = true;
    }
    ans *= a;
  }
  if(ret) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
#include <cctype>
#include <cstring>
#include <stdio.h>
#include <cstdlib>
using namespace std;

int main(){
    int a, b,c;
    cin >> a >> b>>c;
    if(b-a==c-b){
        cout << "YES";
    }else{
        cout << "NO";
    }
}


Measured memory_bytes: 256
///////////////////// author : TrEbLeCleF /////////////////////
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define For(i, a) for (int i=0; i<(a); i++)
#define FORR(i,a,b) for (int i = (b)-1; i >= a; i--)
#define Forr(i,a) for (int i = (a)-1; i >= 0; i--)
/////////////////////////// ..... ///////////////////////////
#define deb(...) cerr << "[" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__) 
void DBG() { cerr << "]\n";}
template<typename T, typename ...Args> void DBG(T first, Args... args){
cerr << first; if(sizeof...(args))cerr<<", "; DBG(args...); }
/////////////////////////// ..... ///////////////////////////
#define int ll
#define pb(x) push_back(x)
#define print(v,s,e) for(int i = s; i < e; i++)cout << v[i]<<" ";cout<<"\n";
#define INF 1e17
#define PI 3.14159265358979323846 
int del_x[4] = {-1, 1, 0, 0};
int del_y[4] = {0, 0, 1, -1};
int XX[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int YY[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
/////////////////////////// GLOBAL ///////////////////////////


/////////////////////////// GLOBAL ///////////////////////////
void solve(){
	int n, d;
	cin >> n >> d;
	int cnt = 0;
	For(i,n){
		double x,y; cin >> x >> y;
		if(sqrt(x*x + y*y) <= d+0.0){
			cnt++;
		}
	}
	cout << cnt <<"\n";
}

int32_t main(){ 
	#ifndef ONLINE_JUDGE
		clock_t tStart = clock();
		freopen("TC", "r", stdin);
		//freopen("output.txt","w",stdout);
	#endif 
    ios_base:: sync_with_stdio(false); 
   	cin.tie(0); 
	int t=1;
	//cin >> t;
	for(int tt=1;tt<=t;tt++){
		//cout << "Case #"<<tt<<": ";
		solve();
	}
	#ifndef ONLINE_JUDGE
    	cerr << "\nRun Time -> "<<(double)(clock()-tStart)/CLOCKS_PER_SEC <<" sec\n";
    #endif
}

Measured memory_bytes: 3844
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int ans = K*pow(K-1,N-1);
        System.out.println(ans);
        
    }
    static int pow(int a, int x){
        if(a==1||x==0)return 1;
        if(x%2==0){
            return pow(a*a,x/2);
        }else{
            return a*pow(a,x-1);
        }
    }
}

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

using namespace std;

#define pb            push_back
#define mp            make_pair
#define po            pop_back
#define fi            first
#define se            second
#define mxn           100005
#define ll            long long int
#define ldb           long double
#define fr(i,a,b,k)   for(int i=a ; i<b ; i+=k)
#define frr(i,a,b,k)  for(int i=a ; i>b ; i-=k)
#define all(v)        v.begin(),v.end()
#define endl          "\n"
#define deg(x)        cout<<endl<<#x<<" = "<<(x)<<endl;
#define casep(x)      cout<<"Case #"<<(x)<<": ";
#define fast          ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

typedef pair<ll,ll> pp;
typedef vector<int> vi;
typedef vector<pp> vpp;
typedef vector<vi> vvi;

const int inf = 1e9+7;
const int minf = (-1)*(1e9+7);

ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
ll gcd(ll a,ll b){ return __gcd(a,b);}
ll lcm(ll a,ll b){return a*b/__gcd(a,b);}


void solve(int test){

    ll x;
    cin >> x;
    (x>=30)?cout << "Yes":cout << "No";

}

int main(){

    fast;
    int t=1;
    // cin >> t;
    for(int i=1 ; i<=t ; i++){
        solve(i);
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3568
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val pList = readLine()!!.split(' ').map(String::toInt).toMutableList()
    pList.add(0, 0)
    var count = 0
    var conti = 0
    for (i in 1..n) {
        if (conti == 1) {
            count++
            conti = 0
        } else if (i == pList[i]) {
            conti = 1
        }
    }
    if (conti == 1) count++
    println(count)
}

Measured memory_bytes: 51968
// Copyright (C) 2018 Skqliao. All rights served.
#include <bits/stdc++.h>

#define rep(i, l, r) for (__typeof(l) i = (l), _##i##_ = (r); i < _##i##_; ++i)
#define rof(i, l, r) for (__typeof(l) i = (l) - 1, _##i##_ = (r); i >= _##i##_; --i)
#define irep(i, x) for (__typeof(x.begin()) i = x.begin(); i != x.end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) static_cast<int>((x).size())
typedef long long ll;
typedef std::pair<int, int> pii;
template<typename T> inline bool chkMin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkMax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

int N, M;

int main() {
	scanf("%d%d", &N, &M);
	if(N > M) {
		std::swap(N, M);
	}
	if(N >= 2) {
		printf("%lld\n", (ll)(N - 2) * (M - 2));
	} else {
		if(M == 1) {
			printf("1\n");
		} else {
			printf("%d\n", M - 2);
		}
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int n;
ll a[52];

ll k;

ll calc(){
  ll ans = 0;
  while(true){
    ll add = 0;
    REP(i,n){
      ll sub = a[i]/n;
      a[i] -= sub*(n+1);
      add += sub;
    }
    if(add==0)break;
    ans += add;
    REP(i,n)a[i]+=add;
  }
  return ans;
}

int main(){
  scanf("%lld",&k);
  ll po = k;
  n = 50;
  ll x = k/n;
  REP(i,n)a[i]=i+x;
  ll y = k%n;
  REP(i,y){
    a[i] += n;
    REP(j,n)if(i!=j)a[j]--;
  }
  puts("50");
  REP(i,n)printf("%lld%c",a[i],i==n-1?'\n':' ');
  assert(calc()==po);
  // DEBUG(calc());
  return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"
#include "cmath"

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

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

int main(int argc, char const *argv[]) {

  long long NN, MM;
  std::cin >> NN>>MM;

  // std::string S, T;
  //
  // std::cin >> S;
  // std::cin >> T;

  char S[NN], T[MM];
  for (size_t i = 0; i < NN; i++) {
    std::cin >> S[i];
  }
  for (size_t i = 0; i < MM; i++) {
    std::cin >> T[i];
  }

  // std::cout << S << '\n';
  // std::cout << T << '\n';
  //
  // std::cout << gcd(NN, MM) << '\n';
  long long flag =0;
  long long gcdd = gcd(NN, MM);

  long long inc_S = NN/gcdd, inc_T = MM/gcd(NN, MM);

  for (size_t i = 0; i < gcdd; i++) {
    if (S[inc_S * i] != T[inc_T * i]) {
      flag = 1;
    }
  }


  // std::cout << flag==0? gcd_nm:-1 << '\n';
  if (flag == 0) {
    std::cout << lcm(NN, MM) << '\n';
  }else{
    std::cout << -1  ;
  }

  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

int main(){
  int n,m;

  while(scanf("%d%d",&n,&m),n+m){
    int v[n], w[m];
    REP(i,n) scanf("%d",v+i);
    REP(i,m) scanf("%d",w+i);

    int pos = 0;
    REP(i,m){
      pos += w[i];
      if(pos >= n - 1){
        print(i+1);
        break;
      }
      pos = pos + v[pos];
      if(pos >= n - 1){
        print(i+1);
        break;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
D n;
int main(void){
    cin>>n;
    for(int i=1;i<=int(n);i++){
		D x=i;
		x*=1.08;
		if(n<=x&&x<n+1){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<":("<<endl;
}


Measured memory_bytes: 384
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto N = readln.chomp.to!int;
    auto S = readln.chomp;

    auto dp = new bool[][][][](N+1, 11, 11, 11);

    foreach (i; 0..N) {
        dp[i + 1] = dp[i].dup;
        foreach (j; 0..11) {
            foreach (k; 0..11) {
                if (dp[i][10][j][k]) {
                    dp[i + 1][j][k][S[i] - '0'] = true;
                }
            }
        }
        dp[i + 1][10][10][S[i] - '0'] = true;
    }

    int ans = 0;
    foreach (i; 0..10) foreach (j; 0..10) foreach (k; 0..10) ans += dp[N][i][j][k];
    ans.writeln;
}

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

using namespace std;

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

    long long ans;
    int n, k, cnt = 0;
    cin >> n >> k;

    cnt = n / k;
    ans = 1ll * cnt * cnt * cnt;

    if (k % 2 == 0) {
        cnt = 0;

        for (int i = k / 2; i <= n; i += k)
            cnt++;

        ans += 1ll * cnt * cnt * cnt;
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
/* 
	بسم الله الرحمن الرحیم

	(; طلا یک جهانی
*/

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

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int n, a, b, c, d;
	string s;
	cin >> n >> a >> b >> c >> d >> s;
	a--, b--, c--, d--;
	for (int i = a; i < c; i++)
		if (s[i] == '#' && s[i + 1] == '#')
			return cout << "No", 0;
	for (int i = b; i < d; i++)
		if (s[i] == '#' && s[i + 1] == '#')
			return cout << "No", 0;
	if (c < d)
		return cout << "Yes", 0;
	for (int i = b - 1; i < d; i++)
		if (s[i] == '.' && s[i + 1] == '.' && s[i + 2] == '.')
			return cout << "Yes", 0;
	cout << "No";
}


Measured memory_bytes: 592
using System;
using System.Linq;

class prog{
  static void Main(){
    string S = Console.ReadLine();
    string T = "";
    int ans = 0;
    for(int i = S.Length - 3; i > 0; i--){
      T = S.Substring(0, i);
      if(T.Substring(0, i / 2) == T.Substring(i / 2 + 1)){
        ans = i + 1;
        break;
      }
    }
    Console.WriteLine(ans);
  }
}
    

Measured memory_bytes: 13140
#include <stdio.h>

int main(void)
{
	int n, a = 0, b = 0, o = 0, ab = 0;
	char str[2];
	
	while (scanf("%d,%s", &n, str) != EOF){
		if (str[0] == 'O'){
			o++;
		}
		else if (str[0] == 'B'){
			b++;
		}
		else if (str[0] == 'A' && str[1] == 'B'){
			ab++;
		}
		else {
			a++;
		}
	}
	printf("%d\n%d\n%d\n%d\n", a, b, ab, o);
	
	return 0;
}

Measured memory_bytes: 592
N, W = map(int, input().split())
w = []
v = []
for i in range(N):
    a, b = map(int, input().split())
    w.append(a)
    v.append(b)
dp = [[0]*(W+1) for _ in range(N+1)]

for i in range(N):
    for sumw in range(W+1):
        if sumw - w[i]  >= 0:
            dp[i+1][sumw] = max(dp[i+1][sumw], dp[i][sumw-w[i]] + v[i])
        dp[i+1][sumw] = max(dp[i+1][sumw], dp[i][sumw])
print(dp[N][W])

Measured memory_bytes: 120684
from functools import lru_cache
 
N = int(input())
 
@lru_cache(maxsize=None)
def luca(n):
    if n == 0:
        return 2
    if n == 1:
        return 1
 
    return luca(n - 1) + luca(n - 2)
 
print(luca(N))

Measured memory_bytes: 4068
def tax(p,x):
    return p*(100+x) // 100

def solve(X,Y,S):
    A=0
    sum=0
    NS=0
    for a in range(1,S):
        for b in range(1,S-a+1):
            sum = tax(a,X)+tax(b,X)
            if sum == S:
                NS = tax(a,Y)+tax(b,Y)
                if NS > A:
                    A = NS
            if sum > S:
                break
    return A 

while True:
    X,Y,S = map(int, input().split()) 
    if X == 0:
        break
    print(solve(X,Y,S))


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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define debug(i) cout << i << endl;
#define debugarr(a) for(auto i : a) cout << i << " ";

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);

    int n, a, b;
    cin >> n >> a >> b;

    int trem = n * a;
    int taxi = b;

    cout << min(trem, taxi) << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
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 long long LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    int a ,b , ans = 0;
    
    cin >> a  >> b;
    
    if ( a > b){
    
        ans += a;
        a--;
    
        if ( a > b){
        
            ans += a;
            a--;
            
        
        }else {
        
            ans += b;
            b--;
        
        }
    
    }else {
    
        ans += b;
        b--;
    
    if ( a > b){
        
            ans += a;
            a--;
            
        
        }else {
        
            ans += b;
            b--;
        
        }
    
    }
    
    fin(ans);
    
    
    
//////////////////////////////////////////////////////
return 0;}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  for(int i=0;i<n;i++){
    if(a.at(i)%2==0){
      if(a.at(i)%3!=0&&a.at(i)%5!=0){        
        cout << "DENIED" << endl;
        return 0;
      }
    } 
  }
  cout << "APPROVED" << endl;
  return 0;
}

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

int main() {
	int n;cin>>n;
	int a[n];
	int b[20];
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<20;i++)b[i]=0;
	long long l=0;
	long long r=0;
	long long ans=n;
	int num=a[0];
	for(int i=0;i<20;i++){
		b[i]+=num%2;
		num/=2;
	}
	while(1){
		while(r<n){
			r++;
			if(r==n){
				ans+=(r-l)*(r-l-1)/2;
//				cout<<ans<<endl;
				break;
			}
			int flag=1;
			int num=a[r];
			for(int i=0;i<20;i++){
				b[i]+=num%2;
				num/=2;
				if(b[i]>=2)flag=0;
//				cout<<b[i];
			}
//			cout<<"flag"<<endl;
			if(flag){
			}else{

				ans+=(r-l)*(r-l-1)/2;
//				cout<<l<<r<<' '<<ans<<endl;
				break;
			}

		}
		if(r==n)break;
		while(1){
			int flag=1;
			int num=a[l];
			for(int i=0;i<20;i++){
				b[i]-=num%2;
				num/=2;
				if(b[i]>=2)flag=0;
			}
			l++;

			if(flag){
				ans-=(r-l)*(r-l-1)/2;
//				cout<<l<<r<<' '<<ans<<endl;
				break;
			}
		}

	}
	cout<<ans<<endl;
//	for(int j=0;j<n;j++){
//	int num=a[j];
//	for(int i=0;i<20;i++){
//		b[i]=num%2;
//		num/=2;
//		cout<<b[i];
//	}
//	cout<<endl;
//	}

	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
    int num[9] = {111,222,333,444,555,666,777,888,999};
    int n;
    scanf("%d", &n);
    for (int i=0; i < 10; i++){
        if(n <= num[i]){
            printf("%d", num[i]);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 128
N,A,B,C,D=map(int,input().split())
X=(N//A)*B
Y=(N//C)*D

if X==(N/A)*B and Y==(N/C)*D:
    if X<Y:
        print(X)
    else:
        print(Y)
elif X==(N/A)*B and Y!=(N/C)*D:
    if X<(Y+D):
        print(X)
    else:
        print(Y+D)
elif X!=(N/A)*B and Y==(N/C)*D:
    if X+B<Y:
        print(X+B)
    else:
        print(Y)
elif X!=(N/A)*B and Y!=(N/C)*D:
    if X+B<Y+D:
        print(X+B)
    else:
        print(Y+D)



Measured memory_bytes: 5600
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <algorithm>
#include <functional>
#include <cstring>
#include <iterator>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

int main()
{
	int N; cin >> N;
	vector<pair<int,int> >a(N);
	set<int>itr;
	rep(i, N) {
		int b; cin >> b;
		a[i] = make_pair(b,i);
	}
	sort(a.begin(), a.end());
	ll ans = 0;

	rep(i, N) {
		itr.insert(a[i].second);
		auto m = itr.find(a[i].second);
		int l, r;
		if (m == itr.begin())l = 0;
		else {
			l = *(--m) + 1;
			++m;
		}
		if (++m == itr.end())r = N-1;
		else {
			r = *m - 1;
		}
		ans += (ll)a[i].first*(a[i].second - l+1)*(r - a[i].second+1);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 11136
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S; cin >> S;
    int N = S.size();
    
    int ans = INF;
    REP(i,N-2){
        string t = S.substr(i, 3);
        ans = min(ans, abs(753 - stoi(t)));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
namespace Base{
	# define mr make_pair
	typedef long long ll;
	typedef double db;
	const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
	const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
	template<typename T> void read(T &x){
    	x = 0; int fh = 1; double num = 1.0; char ch = getchar();
		while (!isdigit(ch)){ if (ch == '-') fh = -1; ch = getchar(); }
		while (isdigit(ch)){ x = x * 10 + ch - '0'; ch = getchar(); }
	    if (ch == '.'){
	    	ch = getchar();
	    	while (isdigit(ch)){num /= 10; x = x + num * (ch - '0'); ch = getchar();}
		}
		x = x * fh;
	}
	template<typename T> void chmax(T &x, T y){x = x < y ? y : x;}
	template<typename T> void chmin(T &x, T y){x = x > y ? y : x;}
}
using namespace Base;

int n, k;
int a[200010], cnt[200010];
int main(){
	read(n); read(k);
	for (int i = 1; i <= n; i++) read(a[i]);
	bool flag = false;
	int j = 0;
	while (!flag && j < k){
		for (int i = 1; i <= n; i++){ 
			cnt[max(1, i - a[i])]++;
			cnt[min(n + 1, i + a[i] + 1)]--;
		}
		flag = true;
		for (int i = 1; i <= n; i++){
			a[i] = a[i - 1] + cnt[i];
			if (a[i] != n) flag = false;
		}
		memset(cnt, 0, sizeof(cnt));
		j++;
	}
	for (int i = 1; i <= n; i++)
		printf("%d%c", a[i], (i == n) ? '\n' : ' '); 
    return 0;
}


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

int main() {
  vector<int> v(3);
  for (int i = 0; i < 3; i++)
    cin >> v.at(i);
  sort(v.begin(), v.end());
  bool judge = false;
  if (v.at(0) == 5) {
    if (v.at(1) == 5) {
      if (v.at(2) == 7) {
        judge = true;
      }
    }
  }
  
  if(judge)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			for(int i = 1; i <= n; i++) {
				int x = i;
				if(x % 3 ==0) {
					System.out.print(" " + i);
					continue;
				}
				while(x != 0) {
					if(x % 10 == 3) {
						System.out.print(" " + i);
						break;
					}else {
						x /= 10;
					}
				}
			}
			System.out.println();
		}
	}
}



Measured memory_bytes: 28652
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int k;
    unsigned long long x = 0;
    cin >> k;
    rep(i, k) {
        int b;
        cin >> b;
        x += 1ULL<<b;
    }

    for(unsigned long long i = 0;;) {
        cout << i << ':';
        rep(j, n) if(i>>j&1) {
            cout << ' ' << j;
        }
        cout << '\n';
        i += -x;
        i &= x;
        if(!i) break;
    }
}


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

typedef long long ll;

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

    int N; cin >> N;
    int B[N]; for (int i = 0; i < N - 1; ++i) cin >> B[i];

    int ans = B[0] + B[N - 2];
    for (int i = 0; i < N - 2; ++i) ans += min(B[i], B[i + 1]);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int N;cin>>N;
    vector<int>L(N);
    rep(i,N){
        cin>>L.at(i);
    }
    int sum=0;
    sort(all(L));
    rep(i,N-1){
        sum+=L.at(i);
    }
    if(L.at(N-1)<sum){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3604
N = int(input())
S = [[]for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    S[a-1].append(b-1)
    S[b-1].append(a-1)
M = [0]*N
M[0],M[N-1] = 1,-1 # 1=黒=フェネック
F_que = S[0]
S_que = S[-1]
while F_que != S_que:
    n_que = []
    for i in F_que:
        if M[i] == 0:
            M[i] = 1
            for j in S[i]:
                n_que.append(j)
    F_que = n_que
    n_que = []
    for i in S_que:
        if M[i] == 0:
            M[i] = -1
            for j in S[i]:
                n_que.append(j)
    S_que = n_que
print(["Snuke","Fennec"][sum(M) > 0])

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

int main()
{
    int n;
    cin >> n;
    long long ans = 0;
    rep(i, n + 1)
    {
        if (i % 3 != 0 && i % 5 != 0)
        {
            ans += i;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <numeric>

using u32 = uint32_t;

int main()
{
	u32 n;
	
	std::cin >> n;
	
	std::vector<u32> b;
	
	for(u32 i = 0; i < n-1; i++)
	{
		u32 x;
		std::cin >> x;
		b.push_back(x);
	}

	std::vector<u32> a;
	a.resize(n, 0);

	a[n-1] = b[n-2];

	for(u32 i = n-2; i > 0; i--)
	{
		//std::cout << "i=" << i << "\n";
		a[i] = std::min(b[i-1], b[i]);
	}

	a[0] = std::max(b[0], a[1]);

	for(u32 i = 0; i < n; i++)
	{
		//std::cout << "a[" << i << "] = " << a[i] << "\n";
	}

	std::cout << std::accumulate(a.begin(), a.end(), 0) << "\n";
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pii pair<int,int>
#define ll long long
#define __ ios::sync_with_stdio(false),cin.tie(0)
/*
#pragma GCC optimize("O1")
#pragma GCC optimize("Ofast")
*/
using namespace std;
void solve(){
int n=0,m=0;
cin>>n>>m;
if(m>=n) cout<<"unsafe";
else cout<<"safe";

}
int main(){
//freopen("","",stdin);
__;
solve();
}


Measured memory_bytes: 3636
from itertools import *
from numpy import *
from scipy.sparse.csgraph import *
N,X,Y = map(int,input().split())
A = (N-1)*[0]
G = zeros((N,N))
G[X-1][Y-1] = 1
G[Y-1][X-1] = 1

for n in range(N-1):
  G[n][n+1] = 1
  G[n+1][n] = 1

S = shortest_path(G)

for i,j in combinations(range(N),2):
  A[int(S[i][j])-1]+=1

print(*A,sep="\n")

Measured memory_bytes: 116124
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int a;
  cin >> a;
  cout << a + a * a + a * a * a << endl;  

  return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

string s;

int main() {
	cin >> s;
	
	bool flag = false;
	inc(i, s.size() - 1) {
		if(s.substr(i, 2) == "AC") { flag = true; }
	}
	
	cout << (flag ? "Yes" : "No") << endl;
	
	return 0;
}


Measured memory_bytes: 256
T, D = list(map(int, input().split()))
ta, tb = list(map(int, input().split()))
da, db = list(map(int, input().split()))

ans = 10000000007



for i in range(D//da+1):
    for j in range(D//db+1):
        if (i*da + j*db <= D) and (i*da + j*db >= 1):
            tmp = (ta*i*da + tb*j*db)/(i*da + j*db)
            ans = min(abs(ans), abs(T - tmp))

print(ans)



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

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define FI first
#define SE second
using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}

int w[200001], b[200001];

int main(int argc, char const* argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int res = inf;
  for(int i = 0; i < n; i++){
    if(s[i] == '#')b[i]++;
    if(i > 0)b[i] = b[i] + b[i-1];
  }
  for(int i = n - 1; i >= 0; i--){
    if(s[i] == '#')w[i]++;
    if(i < n - 1)w[i] = w[i] + w[i+1];
  }
  for(int i = 0; i < n; i++){
    int tmp = (n - i) - w[i];
    if(i > 0)tmp += b[i-1];
    res = min(res, tmp);
  }
  res = min(res, min(b[n-1], n - b[n-1]));
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 2196